@agimon-ai/po-config 0.0.0-alpha.40 → 0.0.0-alpha.41

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index-nVcEC1jO.d.mts","names":[],"sources":["../src/services/init/templates.ts","../src/services/init/sync.ts","../src/services/init/index.ts"],"mappings":";;;cAOa;KAED,qBAAqB;;cAGpB,qBAAqB,SAAS,OAAO;;cA4NrC,gCAAgC,SAAS,OAAO;;UAgG5C;EACf;EACA;EACA;;EAEA;;UAGe;;;;;;;EAOf;;KAGU,0BAA0B;KAC1B,yBAAyB;;;;;;;;;;;;;iBC7JrB,yBACd,wBACA,UAAS,sBACR;;;;;;iBAea,6BACd,yBACA,UAAS,0BACR;;;KCxLE,YAAY,WAAW;;;;;;;iBA6FZ,8BACd,IAAI,YACJ,SAAS,WACT,wBACA,UAAS,sBACR,QAAQ;;iBAaK,kCACd,IAAI,YACJ,wBACA,SAAS,WACT,UAAS,0BACR,QAAQ"}
1
+ {"version":3,"file":"index-nVcEC1jO.d.mts","names":[],"sources":["../src/services/init/templates.ts","../src/services/init/sync.ts","../src/services/init/index.ts"],"mappings":";;;cAOa;KAED,qBAAqB;;cAGpB,qBAAqB,SAAS,OAAO;;cAyNrC,gCAAgC,SAAS,OAAO;;UA6F5C;EACf;EACA;EACA;;EAEA;;UAGe;;;;;;;EAOf;;KAGU,0BAA0B;KAC1B,yBAAyB;;;;;;;;;;;;;iBCvJrB,yBACd,wBACA,UAAS,sBACR;;;;;;iBAea,6BACd,yBACA,UAAS,0BACR;;;KCxLE,YAAY,WAAW;;;;;;;iBA6FZ,8BACd,IAAI,YACJ,SAAS,WACT,wBACA,UAAS,sBACR,QAAQ;;iBAaK,kCACd,IAAI,YACJ,wBACA,SAAS,WACT,UAAS,0BACR,QAAQ"}
package/dist/index.cjs CHANGED
@@ -13,7 +13,7 @@ const require_settingsApi = require("./settingsApi-BHq8b-3z.cjs");
13
13
  const require_piConfig = require("./piConfig-cluCie5i.cjs");
14
14
  const require_majorModes = require("./majorModes-Ck_usJaY.cjs");
15
15
  const require_profiles = require("./profiles-DjZjfvzV.cjs");
16
- const require_init = require("./init-Dotk_UW-.cjs");
16
+ const require_init = require("./init-Q5ygoQqU.cjs");
17
17
  require("./config-zZz80Mh5.cjs");
18
18
  const require_sessionConfig = require("./sessionConfig-CLFS1H8p.cjs");
19
19
  let _agimon_ai_po_core_contextProjection = require("@agimon-ai/po-core/contextProjection");
package/dist/index.mjs CHANGED
@@ -12,7 +12,7 @@ import { t as createSettingsApi } from "./settingsApi-rhlv9p4K.mjs";
12
12
  import { a as loadPiConfigAsync, c as piConfigPaths, d as MIN_IMAGE_MAX_DIMENSION, f as clampImageMaxDimension, i as loadPiConfig, l as piImageSettingsPath, o as loadPiImageSettings, p as parsePiImageSettings, s as savePiImageSettings, u as DEFAULT_IMAGE_MAX_DIMENSION } from "./piConfig-Bq36PQFF.mjs";
13
13
  import { a as loadMajorModesConfigLenient, c as resolveLayers, i as loadMajorModesConfig, l as resolvePackageConfigurations, o as isLocalPackageSpecifier, r as readPackageConfigurations, s as layerEntries } from "./majorModes-D-R9rBjJ.mjs";
14
14
  import { d as PERSONA_FILES, f as applyProfileEnvironment, l as loadProfiles, m as replaceProfileEnvironment, o as buildPersonaPrompt, s as listProfileNames, u as resolveProfile } from "./profiles-uZLR4_HJ.mjs";
15
- import { a as GLOBAL_PO_SEED_FILES, i as initializeRepositoryPoConfig, o as PO_CONFIG_TEMPLATES, r as initializeGlobalPoConfig, s as REPOSITORY_PO_CONFIG_TEMPLATES } from "./init-COTYNRQ9.mjs";
15
+ import { a as GLOBAL_PO_SEED_FILES, i as initializeRepositoryPoConfig, o as PO_CONFIG_TEMPLATES, r as initializeGlobalPoConfig, s as REPOSITORY_PO_CONFIG_TEMPLATES } from "./init-CGFjyWJ9.mjs";
16
16
  import { t as PO_CONFIG_SERVICE } from "./config-BBvn_ZLP.mjs";
17
17
  import { _ as supersedePoConfigTransition, a as appendPoConfigTransition, c as createPoConfigContextAsync, d as providePoConfigContext, f as readPoConfigContextGeneration, g as requirePoConfigContext, h as replacePoConfigContext, i as appendPoConfigSelection, l as freezePoConfigContext, m as readPoConfigSelection, n as PO_CONFIG_TRANSITION_ENTRY_TYPE, p as readPoConfigPendingSelection, r as acknowledgePoConfigTransition, s as createPoConfigContext, t as PO_CONFIG_ENTRY_TYPE } from "./sessionConfig-iUFOQJ8H.mjs";
18
18
  export { DEFAULT_IMAGE_MAX_DIMENSION, FILE_ONLY_STATE_FIELDS, GLOBAL_PO_SEED_FILES, HARNESS_STATE_KEYS, HARNESS_STATE_POINTER, MARKETPLACE_MANIFEST_RELATIVE_PATHS, MIN_IMAGE_MAX_DIMENSION, PERSONA_FILES, PO_CONFIG_ENTRY_TYPE, PO_CONFIG_SERVICE, PO_CONFIG_TEMPLATES, PO_CONFIG_TRANSITION_ENTRY_TYPE, PO_DIR, PO_PLANNING_THINKING_LEVELS, PO_VOICE_ENGINES, PO_VOICE_LIVE_VOICES, PO_VOICE_MODES, PO_VOICE_TTS_ENGINES, REPOSITORY_PO_CONFIG_TEMPLATES, acknowledgePoConfigTransition, appendPoConfigSelection, appendPoConfigTransition, applyProfileEnvironment, buildPersonaPrompt, clampImageMaxDimension, configLeafKeys, configRootKeys, configScopeOf, createHarnessSession, createPoConfigContext, createPoConfigContextAsync, createSettingsApi, disposeHarnessState, domainCompletionItems, domainCompletionPrefix, expandDomainNames, findPluginManifestPath, findPluginManifestPathAsync, freezePoConfigContext, getHarnessState, getSessionHarnessState, globalPoConfigDirectory, globalPoConfigPath, harnessRoot, initializeGlobalPoConfig, initializeRepositoryPoConfig, isLocalPackageSpecifier, isRemotePluginSource, layerEntries, listDomainNames, listProfileNames, loadDomains, loadHarnessState, loadMajorModesConfig, loadMajorModesConfigLenient, loadPiConfig, loadPiConfigAsync, loadPiImageSettings, loadPoConfig, loadPoConfigAsync, loadPoConfigLayers, loadPoConfigLenient, loadProfiles, mergePoConfigs, parseAutocompactModeConfig, parsePiImageSettings, parsePlanningModeConfig, parsePoConfig, piConfigPaths, piImageSettingsPath, pluginDirectoryForSource, projectHarnessEnvironment, providePoConfigContext, readHarnessState, readPackageConfigurations, readPoConfig, readPoConfigContextGeneration, readPoConfigLayers, readPoConfigLenient, readPoConfigPendingSelection, readPoConfigSelection, replacePoConfigContext, replaceProfileEnvironment, repositoryPoConfigPath, requireHarnessPaths, requireHarnessRoot, requirePoConfigContext, resetHarnessStore, resolveLayers, resolvePackageConfigurations, resolvePlanningPlansDirectory, resolvePluginDirectories, resolvePluginEntries, resolveProfile, resolveSharedSkills, resolveVoiceConfig, restoreHarnessStateSnapshot, savePiImageSettings, setPoConfigValue, setPoConfigValueAsync, snapshotHarnessState, supersedePoConfigTransition, unsetPoConfigValue, unsetPoConfigValueAsync, updateHarnessState, valueAtKeyPath, writePoConfigValues, writePoConfigValuesAsync, writePrivateAtomicJson, writePrivateAtomicJsonAsync };
@@ -79,7 +79,7 @@ default:
79
79
  - '@agimon-ai/po-edit'
80
80
  - '@agimon-ai/po-file-edit'
81
81
  - '@agimon-ai/po-autocompact'
82
- - '@agimon-ai/po-loop'
82
+ - '@agimon-ai/po-calendar'
83
83
  - '@agimon-ai/po-plan'
84
84
  - '@agimon-ai/po-author'
85
85
  - '@agimon-ai/po-computer-use'
@@ -104,9 +104,6 @@ layers:
104
104
  # # Tool names excluded from subagents launched by this package. These
105
105
  # # remove model-visible tools while preserving hidden team transport.
106
106
  # excludeTools: [ask_user_question, intercom, subagent]
107
- dynamic-workflow:
108
- packages:
109
- - '@agimon-ai/po-dynamic-workflow'
110
107
  ask-user:
111
108
  packages:
112
109
  - '@agimon-ai/po-user-feedback'
@@ -141,13 +138,13 @@ defaultMajorMode: copilot
141
138
  majorMode:
142
139
  minimal:
143
140
  description: Lean mode with Team delegation and persistent tasks.
144
- layers: [team, dynamic-workflow, task, llm]
141
+ layers: [team, task, llm]
145
142
  copilot:
146
143
  description: General-purpose coding mode with delegation, persistent tasks, supervised commands, and structured user feedback.
147
- layers: [team, dynamic-workflow, ask-user, task, sandbox, llm, source-control, design, image-gen, web-search, browser, coding]
144
+ layers: [team, ask-user, task, sandbox, llm, source-control, design, image-gen, web-search, browser, coding]
148
145
  examples:
149
- description: Base mode with dynamic workflows for the repository's plugin and workflow examples.
150
- layers: [dynamic-workflow]
146
+ description: Base mode for the repository's plugin and workflow examples.
147
+ layers: []
151
148
  # review:
152
149
  # description: Focused review mode for inspecting changes and reporting risks.
153
150
  # layers: [team, task, ask-user]
@@ -250,7 +247,7 @@ default:
250
247
  - '@agimon-ai/po-edit'
251
248
  - '@agimon-ai/po-file-edit'
252
249
  - '@agimon-ai/po-autocompact'
253
- - '@agimon-ai/po-loop'
250
+ - '@agimon-ai/po-calendar'
254
251
  - '@agimon-ai/po-plan'
255
252
  - '@agimon-ai/po-author'
256
253
  - '@agimon-ai/po-computer-use'
@@ -267,9 +264,6 @@ layers:
267
264
  team:
268
265
  packages:
269
266
  - name: '@agimon-ai/po-team'
270
- dynamic-workflow:
271
- packages:
272
- - '@agimon-ai/po-dynamic-workflow'
273
267
  ask-user:
274
268
  packages:
275
269
  - '@agimon-ai/po-user-feedback'
@@ -301,13 +295,13 @@ defaultMajorMode: copilot
301
295
  majorMode:
302
296
  minimal:
303
297
  description: Lean mode with Team delegation and persistent tasks.
304
- layers: [team, dynamic-workflow, task, llm]
298
+ layers: [team, task, llm]
305
299
  copilot:
306
300
  description: General-purpose coding mode with delegation, persistent tasks, supervised commands, and structured user feedback.
307
- layers: [team, dynamic-workflow, ask-user, task, sandbox, llm, source-control, design, image-gen, web-search, browser, coding]
301
+ layers: [team, ask-user, task, sandbox, llm, source-control, design, image-gen, web-search, browser, coding]
308
302
  examples:
309
- description: Base mode with dynamic workflows for the repository's plugin and workflow examples.
310
- layers: [dynamic-workflow]
303
+ description: Base mode for the repository's plugin and workflow examples.
304
+ layers: []
311
305
  `,
312
306
  "domains.yaml": `# Repository-local plugin catalog and domain selection.
313
307
  defaultDomains: [default]
@@ -563,4 +557,4 @@ function initializeRepositoryPoConfigAsync(fs, repositoryRoot, context, options
563
557
  //#endregion
564
558
  export { GLOBAL_PO_SEED_FILES as a, initializeRepositoryPoConfig as i, initializeRepositoryPoConfigAsync as n, PO_CONFIG_TEMPLATES as o, initializeGlobalPoConfig as r, REPOSITORY_PO_CONFIG_TEMPLATES as s, initializeGlobalPoConfigAsync as t };
565
559
 
566
- //# sourceMappingURL=init-COTYNRQ9.mjs.map
560
+ //# sourceMappingURL=init-CGFjyWJ9.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init-CGFjyWJ9.mjs","names":["ensureDirectory","classifyTarget","initializePoConfig"],"sources":["../src/services/init/templates.ts","../src/services/init/sync.ts","../src/services/init/index.ts"],"sourcesContent":["export const PRIVATE_DIRECTORY_MODE = 0o700;\nexport const PRIVATE_FILE_MODE = 0o600;\nexport const REPOSITORY_DIRECTORY_MODE = 0o755;\nexport const REPOSITORY_FILE_MODE = 0o644;\nexport const PO_DIRECTORY = '.po';\n\n/** The global seed files are processed in this fixed order. */\nexport const GLOBAL_PO_SEED_FILES = ['config.yaml', 'modes.yaml', 'domains.yaml', 'profiles.yaml'] as const;\n\nexport type PoSeedFile = (typeof GLOBAL_PO_SEED_FILES)[number];\n\n/** Portable defaults for a new global Po configuration directory. */\nexport const PO_CONFIG_TEMPLATES: Readonly<Record<PoSeedFile, string>> = {\n 'config.yaml': `projectTrust: ask\n\n# Autonomous voice is opt-in and uses an explicitly configured Pi model.\n# voice:\n# autoCapture:\n# model: provider/model-id\n# startPhrases:\n# - hey po\n# stopPhrases:\n# - stop speaking\n# utteranceIdleMs: 3000\n# # Long prompts only: open a draft, keep talking, then send it in one piece.\n# # Short utterances are delivered as you finish them and need no phrase.\n# composeOpenPhrases:\n# - hey po\n# composeSendPhrases:\n# - that's it\n# composeCancelPhrases:\n# - scratch that\n# # Endpoint window while a draft collects, so a short command lands on its own.\n# composeUtteranceIdleMs: 1200\n# # Silence before Voice reminds you a draft is open. 0 turns the reminder off.\n# composeNudgeMs: 10000\n# tts:\n# engine: macos-say\n# voice: Samantha\n# rate: 190\n`,\n 'modes.yaml': `# A layer is a reusable named bundle of packages, built-in or local extensions,\n# and hook groups. Major modes below choose which layers load together for a session.\n#\n# Layers and modes defined here apply to every repository. A repository's own\n# .po/modes.yaml is read after this file and replaces any layer or mode of the\n# same name, so a repository can override one entry without restating the rest.\n#\n# Add a layer by giving it a unique name under layers. Local Pi scripts belong\n# under extensions, while installed Pi packages belong under packages:\n# review-tools:\n# extensions:\n# - './extensions/local-review.ts'\n# packages:\n# - '@scope/review-extension'\n# A bare extension name selects a Po built-in. A path beginning with ./ or\n# ../ loads a custom script or extension directory. A bare package loads its\n# ordered package.json pi.extensions entries, while an exported subpath selects\n# one adapter. Relative paths resolve beside this file here (~/.po), or\n# from the repository root in .po/modes.yaml.\n#\n# Use a package mapping when that package accepts configuration. Configuration\n# belongs under the package entry that consumes it, not beside packages.\n# The top-level default bundle loads before every major mode. Replace this whole\n# packages list to customize the distribution defaults. Po core packages\n# remain active independently of this list.\ndefault:\n packages:\n - '@agimon-ai/po-help'\n - '@agimon-ai/po-goal'\n - '@agimon-ai/po-voice'\n - '@agimon-ai/po-runner'\n - '@agimon-ai/po-codemode'\n - '@agimon-ai/po-read'\n - '@agimon-ai/po-grep'\n - '@agimon-ai/po-edit'\n - '@agimon-ai/po-file-edit'\n - '@agimon-ai/po-autocompact'\n - '@agimon-ai/po-calendar'\n - '@agimon-ai/po-plan'\n - '@agimon-ai/po-author'\n - '@agimon-ai/po-computer-use'\n - '@agimon-ai/po-workflow'\n - '@agimon-ai/po-log'\n - '@agimon-ai/po-mcp'\n - '@agimon-ai/po-prompt'\n - '@agimon-ai/po-template-advanced'\n - '@agimon-ai/po-template-elegant'\nlayers:\n coding:\n packages:\n - '@agimon-ai/po-vibe-lint'\n team:\n packages:\n - name: '@agimon-ai/po-team'\n # Optional Team configuration. Uncomment and choose models available to Pi.\n # config:\n # models:\n # - model: openai-codex/gpt-5.6-luna\n # thinking: xhigh\n # # Tool names excluded from subagents launched by this package. These\n # # remove model-visible tools while preserving hidden team transport.\n # excludeTools: [ask_user_question, intercom, subagent]\n ask-user:\n packages:\n - '@agimon-ai/po-user-feedback'\n task:\n packages:\n - '@agimon-ai/po-task'\n sandbox:\n packages:\n - '@agimon-ai/po-sandbox'\n design:\n packages:\n - '@agimon-ai/po-style-system'\n llm:\n packages:\n - '@agimon-ai/po-model-guidance'\n source-control:\n packages:\n - '@agimon-ai/po-git'\n image-gen:\n packages:\n - '@agimon-ai/po-image-gen'\n web-search:\n packages:\n - '@agimon-ai/po-web-search'\n browser:\n packages:\n - '@agimon-ai/po-browse'\n# A major mode explains when it should be used and names its ordered layers.\n# Add another entry under majorMode, then select it with\n# po --major-mode <name>. Change defaultMajorMode to make it the default.\ndefaultMajorMode: copilot\nmajorMode:\n minimal:\n description: Lean mode with Team delegation and persistent tasks.\n layers: [team, task, llm]\n copilot:\n description: General-purpose coding mode with delegation, persistent tasks, supervised commands, and structured user feedback.\n layers: [team, ask-user, task, sandbox, llm, source-control, design, image-gen, web-search, browser, coding]\n examples:\n description: Base mode for the repository's plugin and workflow examples.\n layers: []\n # review:\n # description: Focused review mode for inspecting changes and reporting risks.\n # layers: [team, task, ask-user]\n`,\n 'domains.yaml': `# Plugins are named once in this catalog, then selected by one or more domains.\n# Po automatically inspects personal and repository Codex marketplaces.\n# Each configured root may also be a folder whose direct children are plugins;\n# use roots: [plugins] to discover a repository plugin folder without one entry\n# per plugin. Discovery never scans recursively.\ndefaultDomains: [default]\nplugins:\n roots: []\n entries: {}\n # Local paths resolve beside this file in ~/.po. Repository paths in a\n # repository .po/domains.yaml resolve from that repository root.\n # entries:\n # development:\n # source: local\n # path: plugins/development\n # remote-review:\n # source: url\n # url: https://github.com/acme/review-plugin.git\n # ref: v1.2.0\n # published-review:\n # source: npm\n # package: '@acme/review-plugin'\n # version: 1.2.0\n# Domains carry descriptions and refer to catalog names, not filesystem paths.\ndomains:\n default:\n description: Shared skills and repository MCP only.\n plugins: []\n # development:\n # description: TypeScript implementation and review tools.\n # plugins:\n # - development\n # # Mapping form can load only selected resources from a shared plugin.\n # - name: remote-review\n # skills: [typescript]\n # agents: [reviewer]\n # hooks: false\n # mcp: true\n # # Set false only when this domain should omit shared .claude/skills.\n # sharedSkills: false\n # # Domain mcp is an allowlist over servers configured elsewhere, not a\n # # request to start new ones. Listing servers here drops the tool schemas\n # # of the ones left out, usually the largest context saving a domain can\n # # make. Run po --explain to see the token cost before and after.\n # # Filtering applies only when every selected domain declares mcp, so a\n # # selection mixing this with a domain that omits it stays unfiltered.\n # mcp:\n # servers: [code-intel]\n # proxy: [repository-search]\n# Select it with po --domains development, or add it to defaultDomains.\n#\n# Aliases let one selection enable multiple domains. Replace the empty mapping\n# below with entries like the commented example.\naliases: {}\n# aliases:\n# work: [default, development]\n`,\n 'profiles.yaml': `# Profiles select a persona and optional environment defaults for a session.\n# Each configured root may itself be a profile or contain direct-child profile\n# folders. A folder is discovered when it contains profile.md, SOUL.md, or\n# AGENTS.md; discovery never scans recursively.\nprofiles:\n roots: []\n entries: {}\n # Roots resolve beside this file in ~/.po. Repository roots in a\n # repository .po/profiles.yaml resolve from that repository root.\n # roots: [agents/acme]\n # Explicit entries override an automatically discovered folder of the same\n # name. Environment values must be strings; already exported values win.\n # entries:\n # writer:\n # persona: agents/special/writer\n # env:\n # BRAND: acme\n # TONE: concise\n# Po Pi concatenates profile.md, SOUL.md, then AGENTS.md for the persona.\n# Select one with: po --profile writer\n`,\n};\n\n/** Standalone defaults for a repository that is trying Po through Po. */\nexport const REPOSITORY_PO_CONFIG_TEMPLATES: Readonly<Record<PoSeedFile, string>> = {\n 'config.yaml': PO_CONFIG_TEMPLATES['config.yaml'],\n 'modes.yaml': `# Repository-local layers and major modes. These entries override personal\n# entries with the same name from ~/.po/modes.yaml.\n# This repository-local default replaces the personal top-level default as one\n# whole package list. Edit it to customize the standalone package baseline.\ndefault:\n packages:\n - '@agimon-ai/po-help'\n - '@agimon-ai/po-goal'\n - '@agimon-ai/po-voice'\n - '@agimon-ai/po-runner'\n - '@agimon-ai/po-codemode'\n - '@agimon-ai/po-read'\n - '@agimon-ai/po-grep'\n - '@agimon-ai/po-edit'\n - '@agimon-ai/po-file-edit'\n - '@agimon-ai/po-autocompact'\n - '@agimon-ai/po-calendar'\n - '@agimon-ai/po-plan'\n - '@agimon-ai/po-author'\n - '@agimon-ai/po-computer-use'\n - '@agimon-ai/po-workflow'\n - '@agimon-ai/po-log'\n - '@agimon-ai/po-mcp'\n - '@agimon-ai/po-prompt'\n - '@agimon-ai/po-template-advanced'\n - '@agimon-ai/po-template-elegant'\nlayers:\n coding:\n packages:\n - '@agimon-ai/po-vibe-lint'\n team:\n packages:\n - name: '@agimon-ai/po-team'\n ask-user:\n packages:\n - '@agimon-ai/po-user-feedback'\n task:\n packages:\n - '@agimon-ai/po-task'\n sandbox:\n packages:\n - '@agimon-ai/po-sandbox'\n design:\n packages:\n - '@agimon-ai/po-style-system'\n llm:\n packages:\n - '@agimon-ai/po-model-guidance'\n source-control:\n packages:\n - '@agimon-ai/po-git'\n image-gen:\n packages:\n - '@agimon-ai/po-image-gen'\n web-search:\n packages:\n - '@agimon-ai/po-web-search'\n browser:\n packages:\n - '@agimon-ai/po-browse'\ndefaultMajorMode: copilot\nmajorMode:\n minimal:\n description: Lean mode with Team delegation and persistent tasks.\n layers: [team, task, llm]\n copilot:\n description: General-purpose coding mode with delegation, persistent tasks, supervised commands, and structured user feedback.\n layers: [team, ask-user, task, sandbox, llm, source-control, design, image-gen, web-search, browser, coding]\n examples:\n description: Base mode for the repository's plugin and workflow examples.\n layers: []\n`,\n 'domains.yaml': `# Repository-local plugin catalog and domain selection.\ndefaultDomains: [default]\nplugins:\n roots: []\n entries: {}\ndomains:\n default:\n description: Shared skills and repository MCP only.\n plugins: []\naliases: {}\n`,\n 'profiles.yaml': `# Repository-local persona roots and environment defaults.\nprofiles:\n roots: []\n entries: {}\n`,\n};\n\n/** Result of filling a Po seed directory. File arrays contain names in seed order. */\nexport interface GlobalPoInitResult {\n directory: string;\n created: string[];\n preserved: string[];\n /** Existing files overwritten from the template. Only ever non-empty under `force`. */\n replaced: string[];\n}\n\nexport interface GlobalPoInitOptions {\n /**\n * Overwrite existing seed files instead of preserving them.\n *\n * Off by default: init is safe to re-run, and hand-edited config is the\n * normal case rather than the exception.\n */\n force?: boolean;\n}\n\nexport type RepositoryPoInitOptions = GlobalPoInitOptions;\nexport type RepositoryPoInitResult = GlobalPoInitResult;\n","import { randomUUID } from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport { nodeHost } from '@agimon-ai/po-core/platform';\n\nimport { globalPoConfigDirectory } from '../config';\nimport {\n PO_CONFIG_TEMPLATES,\n PO_DIRECTORY,\n GLOBAL_PO_SEED_FILES,\n PRIVATE_DIRECTORY_MODE,\n PRIVATE_FILE_MODE,\n REPOSITORY_DIRECTORY_MODE,\n REPOSITORY_PO_CONFIG_TEMPLATES,\n REPOSITORY_FILE_MODE,\n type PoSeedFile,\n type GlobalPoInitOptions,\n type GlobalPoInitResult,\n type RepositoryPoInitOptions,\n type RepositoryPoInitResult,\n} from './templates';\n\nconst UTF8_ENCODING = 'utf8';\nconst FILE_ALREADY_EXISTS = 'EEXIST';\nconst FILE_NOT_FOUND = 'ENOENT';\n\nfunction errorCode(error: unknown): string | undefined {\n if (!(error instanceof Error)) return undefined;\n const code = (error as NodeJS.ErrnoException).code;\n return typeof code === 'string' ? code : undefined;\n}\n\nfunction ensureDirectory(directory: string, mode: number): void {\n let stats: fs.Stats;\n try {\n stats = fs.lstatSync(directory);\n } catch (error) {\n if (errorCode(error) !== FILE_NOT_FOUND) throw error;\n try {\n fs.mkdirSync(directory, { mode });\n stats = fs.lstatSync(directory);\n } catch (mkdirError) {\n if (errorCode(mkdirError) !== FILE_ALREADY_EXISTS) throw mkdirError;\n stats = fs.lstatSync(directory);\n }\n }\n\n if (stats.isSymbolicLink()) {\n throw new Error(`Refusing to initialize through symlinked directory: ${directory}`);\n }\n if (!stats.isDirectory()) {\n throw new Error(`Po config path is not a directory: ${directory}`);\n }\n}\n\nfunction ensurePoDirectory(directory: string, mode: number): void {\n ensureDirectory(path.dirname(directory), mode);\n ensureDirectory(directory, mode);\n}\n\nfunction classifyTarget(targetPath: string): 'missing' | 'file' {\n let stats: fs.Stats;\n try {\n stats = fs.lstatSync(targetPath);\n } catch (error) {\n if (errorCode(error) === FILE_NOT_FOUND) return 'missing';\n throw error;\n }\n\n if (stats.isFile()) return 'file';\n if (stats.isSymbolicLink()) {\n try {\n if (fs.statSync(targetPath).isFile()) return 'file';\n } catch (error) {\n throw new Error(`Po config seed symlink is not file-like: ${targetPath}`, { cause: error });\n }\n }\n throw new Error(`Po config seed path is not file-like: ${targetPath}`);\n}\n\nfunction cleanupTemporaryFile(temporaryPath: string): void {\n try {\n fs.unlinkSync(temporaryPath);\n } catch (error) {\n if (errorCode(error) !== FILE_NOT_FOUND) throw error;\n }\n}\n\nfunction publishExclusively(targetPath: string, content: string, mode: number): boolean {\n const temporaryPath = `${targetPath}.${nodeHost.processId()}.${randomUUID()}.tmp`;\n let fileDescriptor: number | undefined;\n try {\n fileDescriptor = fs.openSync(temporaryPath, 'wx', mode);\n fs.writeFileSync(fileDescriptor, content, UTF8_ENCODING);\n fs.fchmodSync(fileDescriptor, mode);\n fs.fsyncSync(fileDescriptor);\n const descriptorToClose = fileDescriptor;\n fileDescriptor = undefined;\n fs.closeSync(descriptorToClose);\n\n try {\n fs.linkSync(temporaryPath, targetPath);\n return true;\n } catch (error) {\n if (errorCode(error) === FILE_ALREADY_EXISTS && classifyTarget(targetPath) === 'file') return false;\n throw error;\n }\n } finally {\n if (fileDescriptor !== undefined) {\n const descriptorToClose = fileDescriptor;\n fileDescriptor = undefined;\n fs.closeSync(descriptorToClose);\n }\n cleanupTemporaryFile(temporaryPath);\n }\n}\n\n/**\n * Replaces a seed file with the template, atomically.\n *\n * The rename swaps the directory entry in one step, so a reader either sees the\n * whole old file or the whole new one. Renaming onto a symlinked seed replaces\n * the link rather than writing through it.\n */\nfunction publishForcefully(targetPath: string, content: string, mode: number): void {\n const temporaryPath = `${targetPath}.${nodeHost.processId()}.${randomUUID()}.tmp`;\n let fileDescriptor: number | undefined;\n try {\n fileDescriptor = fs.openSync(temporaryPath, 'wx', mode);\n fs.writeFileSync(fileDescriptor, content, UTF8_ENCODING);\n fs.fchmodSync(fileDescriptor, mode);\n fs.fsyncSync(fileDescriptor);\n const descriptorToClose = fileDescriptor;\n fileDescriptor = undefined;\n fs.closeSync(descriptorToClose);\n\n fs.renameSync(temporaryPath, targetPath);\n } finally {\n if (fileDescriptor !== undefined) {\n const descriptorToClose = fileDescriptor;\n fileDescriptor = undefined;\n fs.closeSync(descriptorToClose);\n }\n cleanupTemporaryFile(temporaryPath);\n }\n}\n\nfunction initializePoConfig(\n directory: string,\n templates: Readonly<Record<PoSeedFile, string>>,\n options: GlobalPoInitOptions,\n directoryMode: number,\n fileMode: number,\n): GlobalPoInitResult {\n ensurePoDirectory(directory, directoryMode);\n\n const created: string[] = [];\n const preserved: string[] = [];\n const replaced: string[] = [];\n for (const fileName of GLOBAL_PO_SEED_FILES) {\n const targetPath = path.join(directory, fileName);\n const existed = classifyTarget(targetPath) === 'file';\n\n if (options.force) {\n publishForcefully(targetPath, templates[fileName], fileMode);\n (existed ? replaced : created).push(fileName);\n continue;\n }\n if (existed) {\n preserved.push(fileName);\n continue;\n }\n if (publishExclusively(targetPath, templates[fileName], fileMode)) created.push(fileName);\n else preserved.push(fileName);\n }\n\n return { directory, created, preserved, replaced };\n}\n\n/**\n * Fills missing global seed files.\n *\n * Existing files are left alone so that re-running init never discards\n * hand-edited config; pass `force` to overwrite them from the template. A new\n * file is published with an exclusive hard link, so a concurrent writer in\n * another process never loses its file to this one.\n *\n * @deprecated Node-only sync shim; use initializeGlobalPoConfigAsync. Removed in M2.\n */\nexport function initializeGlobalPoConfig(\n homeDirectory = nodeHost.homeDirectory(),\n options: GlobalPoInitOptions = {},\n): GlobalPoInitResult {\n return initializePoConfig(\n globalPoConfigDirectory(homeDirectory),\n PO_CONFIG_TEMPLATES,\n options,\n PRIVATE_DIRECTORY_MODE,\n PRIVATE_FILE_MODE,\n );\n}\n\n/**\n * Seeds repository-local configuration without creating or changing Pi settings.\n *\n * @deprecated Node-only sync shim; use initializeRepositoryPoConfigAsync. Removed in M2.\n */\nexport function initializeRepositoryPoConfig(\n repositoryRoot = process.cwd(),\n options: RepositoryPoInitOptions = {},\n): RepositoryPoInitResult {\n return initializePoConfig(\n path.join(path.resolve(repositoryRoot), PO_DIRECTORY),\n REPOSITORY_PO_CONFIG_TEMPLATES,\n options,\n REPOSITORY_DIRECTORY_MODE,\n REPOSITORY_FILE_MODE,\n );\n}\n","import path from 'node:path';\n\nimport {\n createSerialRunner,\n getOrThrow,\n nodeHost,\n writeFileAtomic,\n type FileSystem,\n} from '@agimon-ai/po-core/platform';\n\nimport { globalPoConfigDirectory } from '../config';\nimport {\n PO_CONFIG_TEMPLATES,\n PO_DIRECTORY,\n GLOBAL_PO_SEED_FILES,\n PRIVATE_DIRECTORY_MODE,\n PRIVATE_FILE_MODE,\n REPOSITORY_DIRECTORY_MODE,\n REPOSITORY_PO_CONFIG_TEMPLATES,\n REPOSITORY_FILE_MODE,\n type PoSeedFile,\n type GlobalPoInitOptions,\n type GlobalPoInitResult,\n type RepositoryPoInitOptions,\n type RepositoryPoInitResult,\n} from './templates';\n\ntype IoContext = Parameters<FileSystem['readTextFile']>[1];\n\nexport {\n PO_CONFIG_TEMPLATES,\n GLOBAL_PO_SEED_FILES,\n REPOSITORY_PO_CONFIG_TEMPLATES,\n type GlobalPoInitOptions,\n type GlobalPoInitResult,\n type RepositoryPoInitOptions,\n type RepositoryPoInitResult,\n} from './templates';\nexport { initializeGlobalPoConfig, initializeRepositoryPoConfig } from './sync';\n\n/** Seed writes in this process are queued per file, so a check and its write are not interleaved. */\nconst seedWrites = createSerialRunner();\n\nasync function ensureDirectory(fs: FileSystem, directory: string, mode: number, context: IoContext): Promise<void> {\n let info = await fs.fileInfo(directory, context);\n if (!info.ok && info.error.code === 'not_found') {\n const created = await fs.createDir(directory, { recursive: false }, context);\n if (created.ok) await nodeHost.setMode(directory, mode);\n info = await fs.fileInfo(directory, context);\n }\n const kind = getOrThrow(info).kind;\n if (kind === 'symlink') throw new Error(`Refusing to initialize through symlinked directory: ${directory}`);\n if (kind !== 'directory') throw new Error(`Po config path is not a directory: ${directory}`);\n}\n\nasync function classifyTarget(fs: FileSystem, targetPath: string, context: IoContext): Promise<'missing' | 'file'> {\n const info = await fs.fileInfo(targetPath, context);\n if (!info.ok && info.error.code === 'not_found') return 'missing';\n const kind = getOrThrow(info).kind;\n if (kind === 'file') return 'file';\n if (kind === 'symlink') {\n try {\n const target = getOrThrow(await fs.canonicalPath(targetPath, context));\n if (getOrThrow(await fs.fileInfo(target, context)).kind === 'file') return 'file';\n } catch (error) {\n throw new Error(`Po config seed symlink is not file-like: ${targetPath}`, { cause: error });\n }\n }\n throw new Error(`Po config seed path is not file-like: ${targetPath}`);\n}\n\nasync function publish(fs: FileSystem, targetPath: string, content: string, mode: number, context: IoContext) {\n await writeFileAtomic(fs, targetPath, content, context);\n await nodeHost.setMode(targetPath, mode);\n}\n\n/**\n * Fills one seed directory over a FileSystem.\n *\n * Without `force`, a missing file is checked and written inside one queued step\n * per file. The FileSystem has no exclusive create, so a second process writing\n * the same new file at the same instant can be overwritten; the Node-only sync\n * shim keeps its hard-link publication for that case.\n */\nasync function initializePoConfig(\n fs: FileSystem,\n directory: string,\n templates: Readonly<Record<PoSeedFile, string>>,\n options: GlobalPoInitOptions,\n directoryMode: number,\n fileMode: number,\n context: IoContext,\n): Promise<GlobalPoInitResult> {\n await ensureDirectory(fs, path.dirname(directory), directoryMode, context);\n await ensureDirectory(fs, directory, directoryMode, context);\n\n const created: string[] = [];\n const preserved: string[] = [];\n const replaced: string[] = [];\n for (const fileName of GLOBAL_PO_SEED_FILES) {\n const targetPath = path.join(directory, fileName);\n await seedWrites.forKey(path.resolve(targetPath))(async () => {\n const existed = (await classifyTarget(fs, targetPath, context)) === 'file';\n if (existed && !options.force) {\n preserved.push(fileName);\n return;\n }\n await publish(fs, targetPath, templates[fileName], fileMode, context);\n (existed ? replaced : created).push(fileName);\n });\n }\n return { directory, created, preserved, replaced };\n}\n\n/**\n * Fills missing global seed files over a FileSystem.\n *\n * Existing files are left alone so that re-running init never discards\n * hand-edited config; pass `force` to overwrite them from the template.\n */\nexport function initializeGlobalPoConfigAsync(\n fs: FileSystem,\n context: IoContext,\n homeDirectory = nodeHost.homeDirectory(),\n options: GlobalPoInitOptions = {},\n): Promise<GlobalPoInitResult> {\n return initializePoConfig(\n fs,\n globalPoConfigDirectory(homeDirectory),\n PO_CONFIG_TEMPLATES,\n options,\n PRIVATE_DIRECTORY_MODE,\n PRIVATE_FILE_MODE,\n context,\n );\n}\n\n/** Seeds repository-local configuration over a FileSystem without creating or changing Pi settings. */\nexport function initializeRepositoryPoConfigAsync(\n fs: FileSystem,\n repositoryRoot: string,\n context: IoContext,\n options: RepositoryPoInitOptions = {},\n): Promise<RepositoryPoInitResult> {\n return initializePoConfig(\n fs,\n path.join(path.resolve(repositoryRoot), PO_DIRECTORY),\n REPOSITORY_PO_CONFIG_TEMPLATES,\n options,\n REPOSITORY_DIRECTORY_MODE,\n REPOSITORY_FILE_MODE,\n context,\n );\n}\n"],"mappings":";;;;;;;;AAOA,MAAa,uBAAuB;CAAC;CAAe;CAAc;CAAgB;AAAe;;AAKjG,MAAa,sBAA4D;CACvE,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4Bf,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2Gd,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,IAAI;AACzC;;;;;;;;;AAUA,eAAe,mBACb,IACA,WACA,WACA,SACA,eACA,UACA,SAC6B;CAC7B,MAAM,gBAAgB,IAAI,KAAK,QAAQ,SAAS,GAAG,eAAe,OAAO;CACzE,MAAM,gBAAgB,IAAI,WAAW,eAAe,OAAO;CAE3D,MAAM,UAAoB,CAAC;CAC3B,MAAM,YAAsB,CAAC;CAC7B,MAAM,WAAqB,CAAC;CAC5B,KAAK,MAAM,YAAY,sBAAsB;EAC3C,MAAM,aAAa,KAAK,KAAK,WAAW,QAAQ;EAChD,MAAM,WAAW,OAAO,KAAK,QAAQ,UAAU,CAAC,CAAC,CAAC,YAAY;GAC5D,MAAM,UAAW,MAAM,eAAe,IAAI,YAAY,OAAO,MAAO;GACpE,IAAI,WAAW,CAAC,QAAQ,OAAO;IAC7B,UAAU,KAAK,QAAQ;IACvB;GACF;GACA,MAAM,QAAQ,IAAI,YAAY,UAAU,WAAW,UAAU,OAAO;GACpE,CAAC,UAAU,WAAW,QAAA,CAAS,KAAK,QAAQ;EAC9C,CAAC;CACH;CACA,OAAO;EAAE;EAAW;EAAS;EAAW;CAAS;AACnD;;;;;;;AAQA,SAAgB,8BACd,IACA,SACA,gBAAgB,SAAS,cAAc,GACvC,UAA+B,CAAC,GACH;CAC7B,OAAO,mBACL,IACA,wBAAwB,aAAa,GACrC,qBACA,SAAA,KAAA,KAGA,OACF;AACF;;AAGA,SAAgB,kCACd,IACA,gBACA,SACA,UAAmC,CAAC,GACH;CACjC,OAAO,mBACL,IACA,KAAK,KAAK,KAAK,QAAQ,cAAc,GAAA,KAAe,GACpD,gCACA,SAAA,KAAA,KAGA,OACF;AACF"}
@@ -82,7 +82,7 @@ default:
82
82
  - '@agimon-ai/po-edit'
83
83
  - '@agimon-ai/po-file-edit'
84
84
  - '@agimon-ai/po-autocompact'
85
- - '@agimon-ai/po-loop'
85
+ - '@agimon-ai/po-calendar'
86
86
  - '@agimon-ai/po-plan'
87
87
  - '@agimon-ai/po-author'
88
88
  - '@agimon-ai/po-computer-use'
@@ -107,9 +107,6 @@ layers:
107
107
  # # Tool names excluded from subagents launched by this package. These
108
108
  # # remove model-visible tools while preserving hidden team transport.
109
109
  # excludeTools: [ask_user_question, intercom, subagent]
110
- dynamic-workflow:
111
- packages:
112
- - '@agimon-ai/po-dynamic-workflow'
113
110
  ask-user:
114
111
  packages:
115
112
  - '@agimon-ai/po-user-feedback'
@@ -144,13 +141,13 @@ defaultMajorMode: copilot
144
141
  majorMode:
145
142
  minimal:
146
143
  description: Lean mode with Team delegation and persistent tasks.
147
- layers: [team, dynamic-workflow, task, llm]
144
+ layers: [team, task, llm]
148
145
  copilot:
149
146
  description: General-purpose coding mode with delegation, persistent tasks, supervised commands, and structured user feedback.
150
- layers: [team, dynamic-workflow, ask-user, task, sandbox, llm, source-control, design, image-gen, web-search, browser, coding]
147
+ layers: [team, ask-user, task, sandbox, llm, source-control, design, image-gen, web-search, browser, coding]
151
148
  examples:
152
- description: Base mode with dynamic workflows for the repository's plugin and workflow examples.
153
- layers: [dynamic-workflow]
149
+ description: Base mode for the repository's plugin and workflow examples.
150
+ layers: []
154
151
  # review:
155
152
  # description: Focused review mode for inspecting changes and reporting risks.
156
153
  # layers: [team, task, ask-user]
@@ -253,7 +250,7 @@ default:
253
250
  - '@agimon-ai/po-edit'
254
251
  - '@agimon-ai/po-file-edit'
255
252
  - '@agimon-ai/po-autocompact'
256
- - '@agimon-ai/po-loop'
253
+ - '@agimon-ai/po-calendar'
257
254
  - '@agimon-ai/po-plan'
258
255
  - '@agimon-ai/po-author'
259
256
  - '@agimon-ai/po-computer-use'
@@ -270,9 +267,6 @@ layers:
270
267
  team:
271
268
  packages:
272
269
  - name: '@agimon-ai/po-team'
273
- dynamic-workflow:
274
- packages:
275
- - '@agimon-ai/po-dynamic-workflow'
276
270
  ask-user:
277
271
  packages:
278
272
  - '@agimon-ai/po-user-feedback'
@@ -304,13 +298,13 @@ defaultMajorMode: copilot
304
298
  majorMode:
305
299
  minimal:
306
300
  description: Lean mode with Team delegation and persistent tasks.
307
- layers: [team, dynamic-workflow, task, llm]
301
+ layers: [team, task, llm]
308
302
  copilot:
309
303
  description: General-purpose coding mode with delegation, persistent tasks, supervised commands, and structured user feedback.
310
- layers: [team, dynamic-workflow, ask-user, task, sandbox, llm, source-control, design, image-gen, web-search, browser, coding]
304
+ layers: [team, ask-user, task, sandbox, llm, source-control, design, image-gen, web-search, browser, coding]
311
305
  examples:
312
- description: Base mode with dynamic workflows for the repository's plugin and workflow examples.
313
- layers: [dynamic-workflow]
306
+ description: Base mode for the repository's plugin and workflow examples.
307
+ layers: []
314
308
  `,
315
309
  "domains.yaml": `# Repository-local plugin catalog and domain selection.
316
310
  defaultDomains: [default]
@@ -607,4 +601,4 @@ Object.defineProperty(exports, "initializeRepositoryPoConfigAsync", {
607
601
  }
608
602
  });
609
603
 
610
- //# sourceMappingURL=init-Dotk_UW-.cjs.map
604
+ //# sourceMappingURL=init-Q5ygoQqU.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init-Q5ygoQqU.cjs","names":["ensureDirectory","fs","path","classifyTarget","nodeHost","randomUUID","initializePoConfig","globalPoConfigDirectory","createSerialRunner","nodeHost","getOrThrow","writeFileAtomic","path","globalPoConfigDirectory"],"sources":["../src/services/init/templates.ts","../src/services/init/sync.ts","../src/services/init/index.ts"],"sourcesContent":["export const PRIVATE_DIRECTORY_MODE = 0o700;\nexport const PRIVATE_FILE_MODE = 0o600;\nexport const REPOSITORY_DIRECTORY_MODE = 0o755;\nexport const REPOSITORY_FILE_MODE = 0o644;\nexport const PO_DIRECTORY = '.po';\n\n/** The global seed files are processed in this fixed order. */\nexport const GLOBAL_PO_SEED_FILES = ['config.yaml', 'modes.yaml', 'domains.yaml', 'profiles.yaml'] as const;\n\nexport type PoSeedFile = (typeof GLOBAL_PO_SEED_FILES)[number];\n\n/** Portable defaults for a new global Po configuration directory. */\nexport const PO_CONFIG_TEMPLATES: Readonly<Record<PoSeedFile, string>> = {\n 'config.yaml': `projectTrust: ask\n\n# Autonomous voice is opt-in and uses an explicitly configured Pi model.\n# voice:\n# autoCapture:\n# model: provider/model-id\n# startPhrases:\n# - hey po\n# stopPhrases:\n# - stop speaking\n# utteranceIdleMs: 3000\n# # Long prompts only: open a draft, keep talking, then send it in one piece.\n# # Short utterances are delivered as you finish them and need no phrase.\n# composeOpenPhrases:\n# - hey po\n# composeSendPhrases:\n# - that's it\n# composeCancelPhrases:\n# - scratch that\n# # Endpoint window while a draft collects, so a short command lands on its own.\n# composeUtteranceIdleMs: 1200\n# # Silence before Voice reminds you a draft is open. 0 turns the reminder off.\n# composeNudgeMs: 10000\n# tts:\n# engine: macos-say\n# voice: Samantha\n# rate: 190\n`,\n 'modes.yaml': `# A layer is a reusable named bundle of packages, built-in or local extensions,\n# and hook groups. Major modes below choose which layers load together for a session.\n#\n# Layers and modes defined here apply to every repository. A repository's own\n# .po/modes.yaml is read after this file and replaces any layer or mode of the\n# same name, so a repository can override one entry without restating the rest.\n#\n# Add a layer by giving it a unique name under layers. Local Pi scripts belong\n# under extensions, while installed Pi packages belong under packages:\n# review-tools:\n# extensions:\n# - './extensions/local-review.ts'\n# packages:\n# - '@scope/review-extension'\n# A bare extension name selects a Po built-in. A path beginning with ./ or\n# ../ loads a custom script or extension directory. A bare package loads its\n# ordered package.json pi.extensions entries, while an exported subpath selects\n# one adapter. Relative paths resolve beside this file here (~/.po), or\n# from the repository root in .po/modes.yaml.\n#\n# Use a package mapping when that package accepts configuration. Configuration\n# belongs under the package entry that consumes it, not beside packages.\n# The top-level default bundle loads before every major mode. Replace this whole\n# packages list to customize the distribution defaults. Po core packages\n# remain active independently of this list.\ndefault:\n packages:\n - '@agimon-ai/po-help'\n - '@agimon-ai/po-goal'\n - '@agimon-ai/po-voice'\n - '@agimon-ai/po-runner'\n - '@agimon-ai/po-codemode'\n - '@agimon-ai/po-read'\n - '@agimon-ai/po-grep'\n - '@agimon-ai/po-edit'\n - '@agimon-ai/po-file-edit'\n - '@agimon-ai/po-autocompact'\n - '@agimon-ai/po-calendar'\n - '@agimon-ai/po-plan'\n - '@agimon-ai/po-author'\n - '@agimon-ai/po-computer-use'\n - '@agimon-ai/po-workflow'\n - '@agimon-ai/po-log'\n - '@agimon-ai/po-mcp'\n - '@agimon-ai/po-prompt'\n - '@agimon-ai/po-template-advanced'\n - '@agimon-ai/po-template-elegant'\nlayers:\n coding:\n packages:\n - '@agimon-ai/po-vibe-lint'\n team:\n packages:\n - name: '@agimon-ai/po-team'\n # Optional Team configuration. Uncomment and choose models available to Pi.\n # config:\n # models:\n # - model: openai-codex/gpt-5.6-luna\n # thinking: xhigh\n # # Tool names excluded from subagents launched by this package. These\n # # remove model-visible tools while preserving hidden team transport.\n # excludeTools: [ask_user_question, intercom, subagent]\n ask-user:\n packages:\n - '@agimon-ai/po-user-feedback'\n task:\n packages:\n - '@agimon-ai/po-task'\n sandbox:\n packages:\n - '@agimon-ai/po-sandbox'\n design:\n packages:\n - '@agimon-ai/po-style-system'\n llm:\n packages:\n - '@agimon-ai/po-model-guidance'\n source-control:\n packages:\n - '@agimon-ai/po-git'\n image-gen:\n packages:\n - '@agimon-ai/po-image-gen'\n web-search:\n packages:\n - '@agimon-ai/po-web-search'\n browser:\n packages:\n - '@agimon-ai/po-browse'\n# A major mode explains when it should be used and names its ordered layers.\n# Add another entry under majorMode, then select it with\n# po --major-mode <name>. Change defaultMajorMode to make it the default.\ndefaultMajorMode: copilot\nmajorMode:\n minimal:\n description: Lean mode with Team delegation and persistent tasks.\n layers: [team, task, llm]\n copilot:\n description: General-purpose coding mode with delegation, persistent tasks, supervised commands, and structured user feedback.\n layers: [team, ask-user, task, sandbox, llm, source-control, design, image-gen, web-search, browser, coding]\n examples:\n description: Base mode for the repository's plugin and workflow examples.\n layers: []\n # review:\n # description: Focused review mode for inspecting changes and reporting risks.\n # layers: [team, task, ask-user]\n`,\n 'domains.yaml': `# Plugins are named once in this catalog, then selected by one or more domains.\n# Po automatically inspects personal and repository Codex marketplaces.\n# Each configured root may also be a folder whose direct children are plugins;\n# use roots: [plugins] to discover a repository plugin folder without one entry\n# per plugin. Discovery never scans recursively.\ndefaultDomains: [default]\nplugins:\n roots: []\n entries: {}\n # Local paths resolve beside this file in ~/.po. Repository paths in a\n # repository .po/domains.yaml resolve from that repository root.\n # entries:\n # development:\n # source: local\n # path: plugins/development\n # remote-review:\n # source: url\n # url: https://github.com/acme/review-plugin.git\n # ref: v1.2.0\n # published-review:\n # source: npm\n # package: '@acme/review-plugin'\n # version: 1.2.0\n# Domains carry descriptions and refer to catalog names, not filesystem paths.\ndomains:\n default:\n description: Shared skills and repository MCP only.\n plugins: []\n # development:\n # description: TypeScript implementation and review tools.\n # plugins:\n # - development\n # # Mapping form can load only selected resources from a shared plugin.\n # - name: remote-review\n # skills: [typescript]\n # agents: [reviewer]\n # hooks: false\n # mcp: true\n # # Set false only when this domain should omit shared .claude/skills.\n # sharedSkills: false\n # # Domain mcp is an allowlist over servers configured elsewhere, not a\n # # request to start new ones. Listing servers here drops the tool schemas\n # # of the ones left out, usually the largest context saving a domain can\n # # make. Run po --explain to see the token cost before and after.\n # # Filtering applies only when every selected domain declares mcp, so a\n # # selection mixing this with a domain that omits it stays unfiltered.\n # mcp:\n # servers: [code-intel]\n # proxy: [repository-search]\n# Select it with po --domains development, or add it to defaultDomains.\n#\n# Aliases let one selection enable multiple domains. Replace the empty mapping\n# below with entries like the commented example.\naliases: {}\n# aliases:\n# work: [default, development]\n`,\n 'profiles.yaml': `# Profiles select a persona and optional environment defaults for a session.\n# Each configured root may itself be a profile or contain direct-child profile\n# folders. A folder is discovered when it contains profile.md, SOUL.md, or\n# AGENTS.md; discovery never scans recursively.\nprofiles:\n roots: []\n entries: {}\n # Roots resolve beside this file in ~/.po. Repository roots in a\n # repository .po/profiles.yaml resolve from that repository root.\n # roots: [agents/acme]\n # Explicit entries override an automatically discovered folder of the same\n # name. Environment values must be strings; already exported values win.\n # entries:\n # writer:\n # persona: agents/special/writer\n # env:\n # BRAND: acme\n # TONE: concise\n# Po Pi concatenates profile.md, SOUL.md, then AGENTS.md for the persona.\n# Select one with: po --profile writer\n`,\n};\n\n/** Standalone defaults for a repository that is trying Po through Po. */\nexport const REPOSITORY_PO_CONFIG_TEMPLATES: Readonly<Record<PoSeedFile, string>> = {\n 'config.yaml': PO_CONFIG_TEMPLATES['config.yaml'],\n 'modes.yaml': `# Repository-local layers and major modes. These entries override personal\n# entries with the same name from ~/.po/modes.yaml.\n# This repository-local default replaces the personal top-level default as one\n# whole package list. Edit it to customize the standalone package baseline.\ndefault:\n packages:\n - '@agimon-ai/po-help'\n - '@agimon-ai/po-goal'\n - '@agimon-ai/po-voice'\n - '@agimon-ai/po-runner'\n - '@agimon-ai/po-codemode'\n - '@agimon-ai/po-read'\n - '@agimon-ai/po-grep'\n - '@agimon-ai/po-edit'\n - '@agimon-ai/po-file-edit'\n - '@agimon-ai/po-autocompact'\n - '@agimon-ai/po-calendar'\n - '@agimon-ai/po-plan'\n - '@agimon-ai/po-author'\n - '@agimon-ai/po-computer-use'\n - '@agimon-ai/po-workflow'\n - '@agimon-ai/po-log'\n - '@agimon-ai/po-mcp'\n - '@agimon-ai/po-prompt'\n - '@agimon-ai/po-template-advanced'\n - '@agimon-ai/po-template-elegant'\nlayers:\n coding:\n packages:\n - '@agimon-ai/po-vibe-lint'\n team:\n packages:\n - name: '@agimon-ai/po-team'\n ask-user:\n packages:\n - '@agimon-ai/po-user-feedback'\n task:\n packages:\n - '@agimon-ai/po-task'\n sandbox:\n packages:\n - '@agimon-ai/po-sandbox'\n design:\n packages:\n - '@agimon-ai/po-style-system'\n llm:\n packages:\n - '@agimon-ai/po-model-guidance'\n source-control:\n packages:\n - '@agimon-ai/po-git'\n image-gen:\n packages:\n - '@agimon-ai/po-image-gen'\n web-search:\n packages:\n - '@agimon-ai/po-web-search'\n browser:\n packages:\n - '@agimon-ai/po-browse'\ndefaultMajorMode: copilot\nmajorMode:\n minimal:\n description: Lean mode with Team delegation and persistent tasks.\n layers: [team, task, llm]\n copilot:\n description: General-purpose coding mode with delegation, persistent tasks, supervised commands, and structured user feedback.\n layers: [team, ask-user, task, sandbox, llm, source-control, design, image-gen, web-search, browser, coding]\n examples:\n description: Base mode for the repository's plugin and workflow examples.\n layers: []\n`,\n 'domains.yaml': `# Repository-local plugin catalog and domain selection.\ndefaultDomains: [default]\nplugins:\n roots: []\n entries: {}\ndomains:\n default:\n description: Shared skills and repository MCP only.\n plugins: []\naliases: {}\n`,\n 'profiles.yaml': `# Repository-local persona roots and environment defaults.\nprofiles:\n roots: []\n entries: {}\n`,\n};\n\n/** Result of filling a Po seed directory. File arrays contain names in seed order. */\nexport interface GlobalPoInitResult {\n directory: string;\n created: string[];\n preserved: string[];\n /** Existing files overwritten from the template. Only ever non-empty under `force`. */\n replaced: string[];\n}\n\nexport interface GlobalPoInitOptions {\n /**\n * Overwrite existing seed files instead of preserving them.\n *\n * Off by default: init is safe to re-run, and hand-edited config is the\n * normal case rather than the exception.\n */\n force?: boolean;\n}\n\nexport type RepositoryPoInitOptions = GlobalPoInitOptions;\nexport type RepositoryPoInitResult = GlobalPoInitResult;\n","import { randomUUID } from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport { nodeHost } from '@agimon-ai/po-core/platform';\n\nimport { globalPoConfigDirectory } from '../config';\nimport {\n PO_CONFIG_TEMPLATES,\n PO_DIRECTORY,\n GLOBAL_PO_SEED_FILES,\n PRIVATE_DIRECTORY_MODE,\n PRIVATE_FILE_MODE,\n REPOSITORY_DIRECTORY_MODE,\n REPOSITORY_PO_CONFIG_TEMPLATES,\n REPOSITORY_FILE_MODE,\n type PoSeedFile,\n type GlobalPoInitOptions,\n type GlobalPoInitResult,\n type RepositoryPoInitOptions,\n type RepositoryPoInitResult,\n} from './templates';\n\nconst UTF8_ENCODING = 'utf8';\nconst FILE_ALREADY_EXISTS = 'EEXIST';\nconst FILE_NOT_FOUND = 'ENOENT';\n\nfunction errorCode(error: unknown): string | undefined {\n if (!(error instanceof Error)) return undefined;\n const code = (error as NodeJS.ErrnoException).code;\n return typeof code === 'string' ? code : undefined;\n}\n\nfunction ensureDirectory(directory: string, mode: number): void {\n let stats: fs.Stats;\n try {\n stats = fs.lstatSync(directory);\n } catch (error) {\n if (errorCode(error) !== FILE_NOT_FOUND) throw error;\n try {\n fs.mkdirSync(directory, { mode });\n stats = fs.lstatSync(directory);\n } catch (mkdirError) {\n if (errorCode(mkdirError) !== FILE_ALREADY_EXISTS) throw mkdirError;\n stats = fs.lstatSync(directory);\n }\n }\n\n if (stats.isSymbolicLink()) {\n throw new Error(`Refusing to initialize through symlinked directory: ${directory}`);\n }\n if (!stats.isDirectory()) {\n throw new Error(`Po config path is not a directory: ${directory}`);\n }\n}\n\nfunction ensurePoDirectory(directory: string, mode: number): void {\n ensureDirectory(path.dirname(directory), mode);\n ensureDirectory(directory, mode);\n}\n\nfunction classifyTarget(targetPath: string): 'missing' | 'file' {\n let stats: fs.Stats;\n try {\n stats = fs.lstatSync(targetPath);\n } catch (error) {\n if (errorCode(error) === FILE_NOT_FOUND) return 'missing';\n throw error;\n }\n\n if (stats.isFile()) return 'file';\n if (stats.isSymbolicLink()) {\n try {\n if (fs.statSync(targetPath).isFile()) return 'file';\n } catch (error) {\n throw new Error(`Po config seed symlink is not file-like: ${targetPath}`, { cause: error });\n }\n }\n throw new Error(`Po config seed path is not file-like: ${targetPath}`);\n}\n\nfunction cleanupTemporaryFile(temporaryPath: string): void {\n try {\n fs.unlinkSync(temporaryPath);\n } catch (error) {\n if (errorCode(error) !== FILE_NOT_FOUND) throw error;\n }\n}\n\nfunction publishExclusively(targetPath: string, content: string, mode: number): boolean {\n const temporaryPath = `${targetPath}.${nodeHost.processId()}.${randomUUID()}.tmp`;\n let fileDescriptor: number | undefined;\n try {\n fileDescriptor = fs.openSync(temporaryPath, 'wx', mode);\n fs.writeFileSync(fileDescriptor, content, UTF8_ENCODING);\n fs.fchmodSync(fileDescriptor, mode);\n fs.fsyncSync(fileDescriptor);\n const descriptorToClose = fileDescriptor;\n fileDescriptor = undefined;\n fs.closeSync(descriptorToClose);\n\n try {\n fs.linkSync(temporaryPath, targetPath);\n return true;\n } catch (error) {\n if (errorCode(error) === FILE_ALREADY_EXISTS && classifyTarget(targetPath) === 'file') return false;\n throw error;\n }\n } finally {\n if (fileDescriptor !== undefined) {\n const descriptorToClose = fileDescriptor;\n fileDescriptor = undefined;\n fs.closeSync(descriptorToClose);\n }\n cleanupTemporaryFile(temporaryPath);\n }\n}\n\n/**\n * Replaces a seed file with the template, atomically.\n *\n * The rename swaps the directory entry in one step, so a reader either sees the\n * whole old file or the whole new one. Renaming onto a symlinked seed replaces\n * the link rather than writing through it.\n */\nfunction publishForcefully(targetPath: string, content: string, mode: number): void {\n const temporaryPath = `${targetPath}.${nodeHost.processId()}.${randomUUID()}.tmp`;\n let fileDescriptor: number | undefined;\n try {\n fileDescriptor = fs.openSync(temporaryPath, 'wx', mode);\n fs.writeFileSync(fileDescriptor, content, UTF8_ENCODING);\n fs.fchmodSync(fileDescriptor, mode);\n fs.fsyncSync(fileDescriptor);\n const descriptorToClose = fileDescriptor;\n fileDescriptor = undefined;\n fs.closeSync(descriptorToClose);\n\n fs.renameSync(temporaryPath, targetPath);\n } finally {\n if (fileDescriptor !== undefined) {\n const descriptorToClose = fileDescriptor;\n fileDescriptor = undefined;\n fs.closeSync(descriptorToClose);\n }\n cleanupTemporaryFile(temporaryPath);\n }\n}\n\nfunction initializePoConfig(\n directory: string,\n templates: Readonly<Record<PoSeedFile, string>>,\n options: GlobalPoInitOptions,\n directoryMode: number,\n fileMode: number,\n): GlobalPoInitResult {\n ensurePoDirectory(directory, directoryMode);\n\n const created: string[] = [];\n const preserved: string[] = [];\n const replaced: string[] = [];\n for (const fileName of GLOBAL_PO_SEED_FILES) {\n const targetPath = path.join(directory, fileName);\n const existed = classifyTarget(targetPath) === 'file';\n\n if (options.force) {\n publishForcefully(targetPath, templates[fileName], fileMode);\n (existed ? replaced : created).push(fileName);\n continue;\n }\n if (existed) {\n preserved.push(fileName);\n continue;\n }\n if (publishExclusively(targetPath, templates[fileName], fileMode)) created.push(fileName);\n else preserved.push(fileName);\n }\n\n return { directory, created, preserved, replaced };\n}\n\n/**\n * Fills missing global seed files.\n *\n * Existing files are left alone so that re-running init never discards\n * hand-edited config; pass `force` to overwrite them from the template. A new\n * file is published with an exclusive hard link, so a concurrent writer in\n * another process never loses its file to this one.\n *\n * @deprecated Node-only sync shim; use initializeGlobalPoConfigAsync. Removed in M2.\n */\nexport function initializeGlobalPoConfig(\n homeDirectory = nodeHost.homeDirectory(),\n options: GlobalPoInitOptions = {},\n): GlobalPoInitResult {\n return initializePoConfig(\n globalPoConfigDirectory(homeDirectory),\n PO_CONFIG_TEMPLATES,\n options,\n PRIVATE_DIRECTORY_MODE,\n PRIVATE_FILE_MODE,\n );\n}\n\n/**\n * Seeds repository-local configuration without creating or changing Pi settings.\n *\n * @deprecated Node-only sync shim; use initializeRepositoryPoConfigAsync. Removed in M2.\n */\nexport function initializeRepositoryPoConfig(\n repositoryRoot = process.cwd(),\n options: RepositoryPoInitOptions = {},\n): RepositoryPoInitResult {\n return initializePoConfig(\n path.join(path.resolve(repositoryRoot), PO_DIRECTORY),\n REPOSITORY_PO_CONFIG_TEMPLATES,\n options,\n REPOSITORY_DIRECTORY_MODE,\n REPOSITORY_FILE_MODE,\n );\n}\n","import path from 'node:path';\n\nimport {\n createSerialRunner,\n getOrThrow,\n nodeHost,\n writeFileAtomic,\n type FileSystem,\n} from '@agimon-ai/po-core/platform';\n\nimport { globalPoConfigDirectory } from '../config';\nimport {\n PO_CONFIG_TEMPLATES,\n PO_DIRECTORY,\n GLOBAL_PO_SEED_FILES,\n PRIVATE_DIRECTORY_MODE,\n PRIVATE_FILE_MODE,\n REPOSITORY_DIRECTORY_MODE,\n REPOSITORY_PO_CONFIG_TEMPLATES,\n REPOSITORY_FILE_MODE,\n type PoSeedFile,\n type GlobalPoInitOptions,\n type GlobalPoInitResult,\n type RepositoryPoInitOptions,\n type RepositoryPoInitResult,\n} from './templates';\n\ntype IoContext = Parameters<FileSystem['readTextFile']>[1];\n\nexport {\n PO_CONFIG_TEMPLATES,\n GLOBAL_PO_SEED_FILES,\n REPOSITORY_PO_CONFIG_TEMPLATES,\n type GlobalPoInitOptions,\n type GlobalPoInitResult,\n type RepositoryPoInitOptions,\n type RepositoryPoInitResult,\n} from './templates';\nexport { initializeGlobalPoConfig, initializeRepositoryPoConfig } from './sync';\n\n/** Seed writes in this process are queued per file, so a check and its write are not interleaved. */\nconst seedWrites = createSerialRunner();\n\nasync function ensureDirectory(fs: FileSystem, directory: string, mode: number, context: IoContext): Promise<void> {\n let info = await fs.fileInfo(directory, context);\n if (!info.ok && info.error.code === 'not_found') {\n const created = await fs.createDir(directory, { recursive: false }, context);\n if (created.ok) await nodeHost.setMode(directory, mode);\n info = await fs.fileInfo(directory, context);\n }\n const kind = getOrThrow(info).kind;\n if (kind === 'symlink') throw new Error(`Refusing to initialize through symlinked directory: ${directory}`);\n if (kind !== 'directory') throw new Error(`Po config path is not a directory: ${directory}`);\n}\n\nasync function classifyTarget(fs: FileSystem, targetPath: string, context: IoContext): Promise<'missing' | 'file'> {\n const info = await fs.fileInfo(targetPath, context);\n if (!info.ok && info.error.code === 'not_found') return 'missing';\n const kind = getOrThrow(info).kind;\n if (kind === 'file') return 'file';\n if (kind === 'symlink') {\n try {\n const target = getOrThrow(await fs.canonicalPath(targetPath, context));\n if (getOrThrow(await fs.fileInfo(target, context)).kind === 'file') return 'file';\n } catch (error) {\n throw new Error(`Po config seed symlink is not file-like: ${targetPath}`, { cause: error });\n }\n }\n throw new Error(`Po config seed path is not file-like: ${targetPath}`);\n}\n\nasync function publish(fs: FileSystem, targetPath: string, content: string, mode: number, context: IoContext) {\n await writeFileAtomic(fs, targetPath, content, context);\n await nodeHost.setMode(targetPath, mode);\n}\n\n/**\n * Fills one seed directory over a FileSystem.\n *\n * Without `force`, a missing file is checked and written inside one queued step\n * per file. The FileSystem has no exclusive create, so a second process writing\n * the same new file at the same instant can be overwritten; the Node-only sync\n * shim keeps its hard-link publication for that case.\n */\nasync function initializePoConfig(\n fs: FileSystem,\n directory: string,\n templates: Readonly<Record<PoSeedFile, string>>,\n options: GlobalPoInitOptions,\n directoryMode: number,\n fileMode: number,\n context: IoContext,\n): Promise<GlobalPoInitResult> {\n await ensureDirectory(fs, path.dirname(directory), directoryMode, context);\n await ensureDirectory(fs, directory, directoryMode, context);\n\n const created: string[] = [];\n const preserved: string[] = [];\n const replaced: string[] = [];\n for (const fileName of GLOBAL_PO_SEED_FILES) {\n const targetPath = path.join(directory, fileName);\n await seedWrites.forKey(path.resolve(targetPath))(async () => {\n const existed = (await classifyTarget(fs, targetPath, context)) === 'file';\n if (existed && !options.force) {\n preserved.push(fileName);\n return;\n }\n await publish(fs, targetPath, templates[fileName], fileMode, context);\n (existed ? replaced : created).push(fileName);\n });\n }\n return { directory, created, preserved, replaced };\n}\n\n/**\n * Fills missing global seed files over a FileSystem.\n *\n * Existing files are left alone so that re-running init never discards\n * hand-edited config; pass `force` to overwrite them from the template.\n */\nexport function initializeGlobalPoConfigAsync(\n fs: FileSystem,\n context: IoContext,\n homeDirectory = nodeHost.homeDirectory(),\n options: GlobalPoInitOptions = {},\n): Promise<GlobalPoInitResult> {\n return initializePoConfig(\n fs,\n globalPoConfigDirectory(homeDirectory),\n PO_CONFIG_TEMPLATES,\n options,\n PRIVATE_DIRECTORY_MODE,\n PRIVATE_FILE_MODE,\n context,\n );\n}\n\n/** Seeds repository-local configuration over a FileSystem without creating or changing Pi settings. */\nexport function initializeRepositoryPoConfigAsync(\n fs: FileSystem,\n repositoryRoot: string,\n context: IoContext,\n options: RepositoryPoInitOptions = {},\n): Promise<RepositoryPoInitResult> {\n return initializePoConfig(\n fs,\n path.join(path.resolve(repositoryRoot), PO_DIRECTORY),\n REPOSITORY_PO_CONFIG_TEMPLATES,\n options,\n REPOSITORY_DIRECTORY_MODE,\n REPOSITORY_FILE_MODE,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AAI,YAAY,OAAO,MAAO;GACpE,IAAI,WAAW,CAAC,QAAQ,OAAO;IAC7B,UAAU,KAAK,QAAQ;IACvB;GACF;GACA,MAAM,QAAQ,IAAI,YAAY,UAAU,WAAW,UAAU,OAAO;GACpE,CAAC,UAAU,WAAW,QAAA,CAAS,KAAK,QAAQ;EAC9C,CAAC;CACH;CACA,OAAO;EAAE;EAAW;EAAS;EAAW;CAAS;AACnD;;;;;;;AAQA,SAAgB,8BACd,IACA,SACA,gBAAgBH,4BAAAA,SAAS,cAAc,GACvC,UAA+B,CAAC,GACH;CAC7B,OAAO,mBACL,IACAI,aAAAA,wBAAwB,aAAa,GACrC,qBACA,SAAA,KAAA,KAGA,OACF;AACF;;AAGA,SAAgB,kCACd,IACA,gBACA,SACA,UAAmC,CAAC,GACH;CACjC,OAAO,mBACL,IACAD,UAAAA,QAAK,KAAKA,UAAAA,QAAK,QAAQ,cAAc,GAAA,KAAe,GACpD,gCACA,SAAA,KAAA,KAGA,OACF;AACF"}
package/dist/init.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_init = require("./init-Dotk_UW-.cjs");
2
+ const require_init = require("./init-Q5ygoQqU.cjs");
3
3
  exports.GLOBAL_PO_SEED_FILES = require_init.GLOBAL_PO_SEED_FILES;
4
4
  exports.PO_CONFIG_TEMPLATES = require_init.PO_CONFIG_TEMPLATES;
5
5
  exports.REPOSITORY_PO_CONFIG_TEMPLATES = require_init.REPOSITORY_PO_CONFIG_TEMPLATES;
package/dist/init.mjs CHANGED
@@ -1 +1 @@
1
- export { a as GLOBAL_PO_SEED_FILES, o as PO_CONFIG_TEMPLATES, s as REPOSITORY_PO_CONFIG_TEMPLATES, r as initializeGlobalPoConfig, t as initializeGlobalPoConfigAsync, i as initializeRepositoryPoConfig, n as initializeRepositoryPoConfigAsync } from "./init-COTYNRQ9.mjs";
1
+ export { a as GLOBAL_PO_SEED_FILES, o as PO_CONFIG_TEMPLATES, s as REPOSITORY_PO_CONFIG_TEMPLATES, r as initializeGlobalPoConfig, t as initializeGlobalPoConfigAsync, i as initializeRepositoryPoConfig, n as initializeRepositoryPoConfigAsync } from "./init-CGFjyWJ9.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agimon-ai/po-config",
3
- "version": "0.0.0-alpha.40",
3
+ "version": "0.0.0-alpha.41",
4
4
  "description": "Typed configuration loading, validation, and host services for composing Po sessions.",
5
5
  "keywords": [
6
6
  "agent-configuration",
@@ -139,14 +139,14 @@
139
139
  "registry": "https://registry.npmjs.org/"
140
140
  },
141
141
  "dependencies": {
142
- "@agimon-ai/po-core": "0.0.0-alpha.40",
143
- "@agimon-ai/po-web-components": "0.0.0-alpha.40",
142
+ "@agimon-ai/po-core": "0.0.0-alpha.41",
143
+ "@agimon-ai/po-web-components": "0.0.0-alpha.41",
144
144
  "@deepseek-ai/cordis": "4.0.5",
145
145
  "typebox": "1.4.2",
146
146
  "yaml": "2.9.1"
147
147
  },
148
148
  "devDependencies": {
149
- "@agimon-ai/po-build": "0.0.0-alpha.40",
149
+ "@agimon-ai/po-build": "0.0.0-alpha.41",
150
150
  "@earendil-works/pi-coding-agent": "1.3.0",
151
151
  "@modelcontextprotocol/ext-apps": "2.0.3",
152
152
  "@modelcontextprotocol/server": "2.3.1",
@@ -1 +0,0 @@
1
- {"version":3,"file":"init-COTYNRQ9.mjs","names":["ensureDirectory","classifyTarget","initializePoConfig"],"sources":["../src/services/init/templates.ts","../src/services/init/sync.ts","../src/services/init/index.ts"],"sourcesContent":["export const PRIVATE_DIRECTORY_MODE = 0o700;\nexport const PRIVATE_FILE_MODE = 0o600;\nexport const REPOSITORY_DIRECTORY_MODE = 0o755;\nexport const REPOSITORY_FILE_MODE = 0o644;\nexport const PO_DIRECTORY = '.po';\n\n/** The global seed files are processed in this fixed order. */\nexport const GLOBAL_PO_SEED_FILES = ['config.yaml', 'modes.yaml', 'domains.yaml', 'profiles.yaml'] as const;\n\nexport type PoSeedFile = (typeof GLOBAL_PO_SEED_FILES)[number];\n\n/** Portable defaults for a new global Po configuration directory. */\nexport const PO_CONFIG_TEMPLATES: Readonly<Record<PoSeedFile, string>> = {\n 'config.yaml': `projectTrust: ask\n\n# Autonomous voice is opt-in and uses an explicitly configured Pi model.\n# voice:\n# autoCapture:\n# model: provider/model-id\n# startPhrases:\n# - hey po\n# stopPhrases:\n# - stop speaking\n# utteranceIdleMs: 3000\n# # Long prompts only: open a draft, keep talking, then send it in one piece.\n# # Short utterances are delivered as you finish them and need no phrase.\n# composeOpenPhrases:\n# - hey po\n# composeSendPhrases:\n# - that's it\n# composeCancelPhrases:\n# - scratch that\n# # Endpoint window while a draft collects, so a short command lands on its own.\n# composeUtteranceIdleMs: 1200\n# # Silence before Voice reminds you a draft is open. 0 turns the reminder off.\n# composeNudgeMs: 10000\n# tts:\n# engine: macos-say\n# voice: Samantha\n# rate: 190\n`,\n 'modes.yaml': `# A layer is a reusable named bundle of packages, built-in or local extensions,\n# and hook groups. Major modes below choose which layers load together for a session.\n#\n# Layers and modes defined here apply to every repository. A repository's own\n# .po/modes.yaml is read after this file and replaces any layer or mode of the\n# same name, so a repository can override one entry without restating the rest.\n#\n# Add a layer by giving it a unique name under layers. Local Pi scripts belong\n# under extensions, while installed Pi packages belong under packages:\n# review-tools:\n# extensions:\n# - './extensions/local-review.ts'\n# packages:\n# - '@scope/review-extension'\n# A bare extension name selects a Po built-in. A path beginning with ./ or\n# ../ loads a custom script or extension directory. A bare package loads its\n# ordered package.json pi.extensions entries, while an exported subpath selects\n# one adapter. Relative paths resolve beside this file here (~/.po), or\n# from the repository root in .po/modes.yaml.\n#\n# Use a package mapping when that package accepts configuration. Configuration\n# belongs under the package entry that consumes it, not beside packages.\n# The top-level default bundle loads before every major mode. Replace this whole\n# packages list to customize the distribution defaults. Po core packages\n# remain active independently of this list.\ndefault:\n packages:\n - '@agimon-ai/po-help'\n - '@agimon-ai/po-goal'\n - '@agimon-ai/po-voice'\n - '@agimon-ai/po-runner'\n - '@agimon-ai/po-codemode'\n - '@agimon-ai/po-read'\n - '@agimon-ai/po-grep'\n - '@agimon-ai/po-edit'\n - '@agimon-ai/po-file-edit'\n - '@agimon-ai/po-autocompact'\n - '@agimon-ai/po-loop'\n - '@agimon-ai/po-plan'\n - '@agimon-ai/po-author'\n - '@agimon-ai/po-computer-use'\n - '@agimon-ai/po-workflow'\n - '@agimon-ai/po-log'\n - '@agimon-ai/po-mcp'\n - '@agimon-ai/po-prompt'\n - '@agimon-ai/po-template-advanced'\n - '@agimon-ai/po-template-elegant'\nlayers:\n coding:\n packages:\n - '@agimon-ai/po-vibe-lint'\n team:\n packages:\n - name: '@agimon-ai/po-team'\n # Optional Team configuration. Uncomment and choose models available to Pi.\n # config:\n # models:\n # - model: openai-codex/gpt-5.6-luna\n # thinking: xhigh\n # # Tool names excluded from subagents launched by this package. These\n # # remove model-visible tools while preserving hidden team transport.\n # excludeTools: [ask_user_question, intercom, subagent]\n dynamic-workflow:\n packages:\n - '@agimon-ai/po-dynamic-workflow'\n ask-user:\n packages:\n - '@agimon-ai/po-user-feedback'\n task:\n packages:\n - '@agimon-ai/po-task'\n sandbox:\n packages:\n - '@agimon-ai/po-sandbox'\n design:\n packages:\n - '@agimon-ai/po-style-system'\n llm:\n packages:\n - '@agimon-ai/po-model-guidance'\n source-control:\n packages:\n - '@agimon-ai/po-git'\n image-gen:\n packages:\n - '@agimon-ai/po-image-gen'\n web-search:\n packages:\n - '@agimon-ai/po-web-search'\n browser:\n packages:\n - '@agimon-ai/po-browse'\n# A major mode explains when it should be used and names its ordered layers.\n# Add another entry under majorMode, then select it with\n# po --major-mode <name>. Change defaultMajorMode to make it the default.\ndefaultMajorMode: copilot\nmajorMode:\n minimal:\n description: Lean mode with Team delegation and persistent tasks.\n layers: [team, dynamic-workflow, task, llm]\n copilot:\n description: General-purpose coding mode with delegation, persistent tasks, supervised commands, and structured user feedback.\n layers: [team, dynamic-workflow, ask-user, task, sandbox, llm, source-control, design, image-gen, web-search, browser, coding]\n examples:\n description: Base mode with dynamic workflows for the repository's plugin and workflow examples.\n layers: [dynamic-workflow]\n # review:\n # description: Focused review mode for inspecting changes and reporting risks.\n # layers: [team, task, ask-user]\n`,\n 'domains.yaml': `# Plugins are named once in this catalog, then selected by one or more domains.\n# Po automatically inspects personal and repository Codex marketplaces.\n# Each configured root may also be a folder whose direct children are plugins;\n# use roots: [plugins] to discover a repository plugin folder without one entry\n# per plugin. Discovery never scans recursively.\ndefaultDomains: [default]\nplugins:\n roots: []\n entries: {}\n # Local paths resolve beside this file in ~/.po. Repository paths in a\n # repository .po/domains.yaml resolve from that repository root.\n # entries:\n # development:\n # source: local\n # path: plugins/development\n # remote-review:\n # source: url\n # url: https://github.com/acme/review-plugin.git\n # ref: v1.2.0\n # published-review:\n # source: npm\n # package: '@acme/review-plugin'\n # version: 1.2.0\n# Domains carry descriptions and refer to catalog names, not filesystem paths.\ndomains:\n default:\n description: Shared skills and repository MCP only.\n plugins: []\n # development:\n # description: TypeScript implementation and review tools.\n # plugins:\n # - development\n # # Mapping form can load only selected resources from a shared plugin.\n # - name: remote-review\n # skills: [typescript]\n # agents: [reviewer]\n # hooks: false\n # mcp: true\n # # Set false only when this domain should omit shared .claude/skills.\n # sharedSkills: false\n # # Domain mcp is an allowlist over servers configured elsewhere, not a\n # # request to start new ones. Listing servers here drops the tool schemas\n # # of the ones left out, usually the largest context saving a domain can\n # # make. Run po --explain to see the token cost before and after.\n # # Filtering applies only when every selected domain declares mcp, so a\n # # selection mixing this with a domain that omits it stays unfiltered.\n # mcp:\n # servers: [code-intel]\n # proxy: [repository-search]\n# Select it with po --domains development, or add it to defaultDomains.\n#\n# Aliases let one selection enable multiple domains. Replace the empty mapping\n# below with entries like the commented example.\naliases: {}\n# aliases:\n# work: [default, development]\n`,\n 'profiles.yaml': `# Profiles select a persona and optional environment defaults for a session.\n# Each configured root may itself be a profile or contain direct-child profile\n# folders. A folder is discovered when it contains profile.md, SOUL.md, or\n# AGENTS.md; discovery never scans recursively.\nprofiles:\n roots: []\n entries: {}\n # Roots resolve beside this file in ~/.po. Repository roots in a\n # repository .po/profiles.yaml resolve from that repository root.\n # roots: [agents/acme]\n # Explicit entries override an automatically discovered folder of the same\n # name. Environment values must be strings; already exported values win.\n # entries:\n # writer:\n # persona: agents/special/writer\n # env:\n # BRAND: acme\n # TONE: concise\n# Po Pi concatenates profile.md, SOUL.md, then AGENTS.md for the persona.\n# Select one with: po --profile writer\n`,\n};\n\n/** Standalone defaults for a repository that is trying Po through Po. */\nexport const REPOSITORY_PO_CONFIG_TEMPLATES: Readonly<Record<PoSeedFile, string>> = {\n 'config.yaml': PO_CONFIG_TEMPLATES['config.yaml'],\n 'modes.yaml': `# Repository-local layers and major modes. These entries override personal\n# entries with the same name from ~/.po/modes.yaml.\n# This repository-local default replaces the personal top-level default as one\n# whole package list. Edit it to customize the standalone package baseline.\ndefault:\n packages:\n - '@agimon-ai/po-help'\n - '@agimon-ai/po-goal'\n - '@agimon-ai/po-voice'\n - '@agimon-ai/po-runner'\n - '@agimon-ai/po-codemode'\n - '@agimon-ai/po-read'\n - '@agimon-ai/po-grep'\n - '@agimon-ai/po-edit'\n - '@agimon-ai/po-file-edit'\n - '@agimon-ai/po-autocompact'\n - '@agimon-ai/po-loop'\n - '@agimon-ai/po-plan'\n - '@agimon-ai/po-author'\n - '@agimon-ai/po-computer-use'\n - '@agimon-ai/po-workflow'\n - '@agimon-ai/po-log'\n - '@agimon-ai/po-mcp'\n - '@agimon-ai/po-prompt'\n - '@agimon-ai/po-template-advanced'\n - '@agimon-ai/po-template-elegant'\nlayers:\n coding:\n packages:\n - '@agimon-ai/po-vibe-lint'\n team:\n packages:\n - name: '@agimon-ai/po-team'\n dynamic-workflow:\n packages:\n - '@agimon-ai/po-dynamic-workflow'\n ask-user:\n packages:\n - '@agimon-ai/po-user-feedback'\n task:\n packages:\n - '@agimon-ai/po-task'\n sandbox:\n packages:\n - '@agimon-ai/po-sandbox'\n design:\n packages:\n - '@agimon-ai/po-style-system'\n llm:\n packages:\n - '@agimon-ai/po-model-guidance'\n source-control:\n packages:\n - '@agimon-ai/po-git'\n image-gen:\n packages:\n - '@agimon-ai/po-image-gen'\n web-search:\n packages:\n - '@agimon-ai/po-web-search'\n browser:\n packages:\n - '@agimon-ai/po-browse'\ndefaultMajorMode: copilot\nmajorMode:\n minimal:\n description: Lean mode with Team delegation and persistent tasks.\n layers: [team, dynamic-workflow, task, llm]\n copilot:\n description: General-purpose coding mode with delegation, persistent tasks, supervised commands, and structured user feedback.\n layers: [team, dynamic-workflow, ask-user, task, sandbox, llm, source-control, design, image-gen, web-search, browser, coding]\n examples:\n description: Base mode with dynamic workflows for the repository's plugin and workflow examples.\n layers: [dynamic-workflow]\n`,\n 'domains.yaml': `# Repository-local plugin catalog and domain selection.\ndefaultDomains: [default]\nplugins:\n roots: []\n entries: {}\ndomains:\n default:\n description: Shared skills and repository MCP only.\n plugins: []\naliases: {}\n`,\n 'profiles.yaml': `# Repository-local persona roots and environment defaults.\nprofiles:\n roots: []\n entries: {}\n`,\n};\n\n/** Result of filling a Po seed directory. File arrays contain names in seed order. */\nexport interface GlobalPoInitResult {\n directory: string;\n created: string[];\n preserved: string[];\n /** Existing files overwritten from the template. Only ever non-empty under `force`. */\n replaced: string[];\n}\n\nexport interface GlobalPoInitOptions {\n /**\n * Overwrite existing seed files instead of preserving them.\n *\n * Off by default: init is safe to re-run, and hand-edited config is the\n * normal case rather than the exception.\n */\n force?: boolean;\n}\n\nexport type RepositoryPoInitOptions = GlobalPoInitOptions;\nexport type RepositoryPoInitResult = GlobalPoInitResult;\n","import { randomUUID } from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport { nodeHost } from '@agimon-ai/po-core/platform';\n\nimport { globalPoConfigDirectory } from '../config';\nimport {\n PO_CONFIG_TEMPLATES,\n PO_DIRECTORY,\n GLOBAL_PO_SEED_FILES,\n PRIVATE_DIRECTORY_MODE,\n PRIVATE_FILE_MODE,\n REPOSITORY_DIRECTORY_MODE,\n REPOSITORY_PO_CONFIG_TEMPLATES,\n REPOSITORY_FILE_MODE,\n type PoSeedFile,\n type GlobalPoInitOptions,\n type GlobalPoInitResult,\n type RepositoryPoInitOptions,\n type RepositoryPoInitResult,\n} from './templates';\n\nconst UTF8_ENCODING = 'utf8';\nconst FILE_ALREADY_EXISTS = 'EEXIST';\nconst FILE_NOT_FOUND = 'ENOENT';\n\nfunction errorCode(error: unknown): string | undefined {\n if (!(error instanceof Error)) return undefined;\n const code = (error as NodeJS.ErrnoException).code;\n return typeof code === 'string' ? code : undefined;\n}\n\nfunction ensureDirectory(directory: string, mode: number): void {\n let stats: fs.Stats;\n try {\n stats = fs.lstatSync(directory);\n } catch (error) {\n if (errorCode(error) !== FILE_NOT_FOUND) throw error;\n try {\n fs.mkdirSync(directory, { mode });\n stats = fs.lstatSync(directory);\n } catch (mkdirError) {\n if (errorCode(mkdirError) !== FILE_ALREADY_EXISTS) throw mkdirError;\n stats = fs.lstatSync(directory);\n }\n }\n\n if (stats.isSymbolicLink()) {\n throw new Error(`Refusing to initialize through symlinked directory: ${directory}`);\n }\n if (!stats.isDirectory()) {\n throw new Error(`Po config path is not a directory: ${directory}`);\n }\n}\n\nfunction ensurePoDirectory(directory: string, mode: number): void {\n ensureDirectory(path.dirname(directory), mode);\n ensureDirectory(directory, mode);\n}\n\nfunction classifyTarget(targetPath: string): 'missing' | 'file' {\n let stats: fs.Stats;\n try {\n stats = fs.lstatSync(targetPath);\n } catch (error) {\n if (errorCode(error) === FILE_NOT_FOUND) return 'missing';\n throw error;\n }\n\n if (stats.isFile()) return 'file';\n if (stats.isSymbolicLink()) {\n try {\n if (fs.statSync(targetPath).isFile()) return 'file';\n } catch (error) {\n throw new Error(`Po config seed symlink is not file-like: ${targetPath}`, { cause: error });\n }\n }\n throw new Error(`Po config seed path is not file-like: ${targetPath}`);\n}\n\nfunction cleanupTemporaryFile(temporaryPath: string): void {\n try {\n fs.unlinkSync(temporaryPath);\n } catch (error) {\n if (errorCode(error) !== FILE_NOT_FOUND) throw error;\n }\n}\n\nfunction publishExclusively(targetPath: string, content: string, mode: number): boolean {\n const temporaryPath = `${targetPath}.${nodeHost.processId()}.${randomUUID()}.tmp`;\n let fileDescriptor: number | undefined;\n try {\n fileDescriptor = fs.openSync(temporaryPath, 'wx', mode);\n fs.writeFileSync(fileDescriptor, content, UTF8_ENCODING);\n fs.fchmodSync(fileDescriptor, mode);\n fs.fsyncSync(fileDescriptor);\n const descriptorToClose = fileDescriptor;\n fileDescriptor = undefined;\n fs.closeSync(descriptorToClose);\n\n try {\n fs.linkSync(temporaryPath, targetPath);\n return true;\n } catch (error) {\n if (errorCode(error) === FILE_ALREADY_EXISTS && classifyTarget(targetPath) === 'file') return false;\n throw error;\n }\n } finally {\n if (fileDescriptor !== undefined) {\n const descriptorToClose = fileDescriptor;\n fileDescriptor = undefined;\n fs.closeSync(descriptorToClose);\n }\n cleanupTemporaryFile(temporaryPath);\n }\n}\n\n/**\n * Replaces a seed file with the template, atomically.\n *\n * The rename swaps the directory entry in one step, so a reader either sees the\n * whole old file or the whole new one. Renaming onto a symlinked seed replaces\n * the link rather than writing through it.\n */\nfunction publishForcefully(targetPath: string, content: string, mode: number): void {\n const temporaryPath = `${targetPath}.${nodeHost.processId()}.${randomUUID()}.tmp`;\n let fileDescriptor: number | undefined;\n try {\n fileDescriptor = fs.openSync(temporaryPath, 'wx', mode);\n fs.writeFileSync(fileDescriptor, content, UTF8_ENCODING);\n fs.fchmodSync(fileDescriptor, mode);\n fs.fsyncSync(fileDescriptor);\n const descriptorToClose = fileDescriptor;\n fileDescriptor = undefined;\n fs.closeSync(descriptorToClose);\n\n fs.renameSync(temporaryPath, targetPath);\n } finally {\n if (fileDescriptor !== undefined) {\n const descriptorToClose = fileDescriptor;\n fileDescriptor = undefined;\n fs.closeSync(descriptorToClose);\n }\n cleanupTemporaryFile(temporaryPath);\n }\n}\n\nfunction initializePoConfig(\n directory: string,\n templates: Readonly<Record<PoSeedFile, string>>,\n options: GlobalPoInitOptions,\n directoryMode: number,\n fileMode: number,\n): GlobalPoInitResult {\n ensurePoDirectory(directory, directoryMode);\n\n const created: string[] = [];\n const preserved: string[] = [];\n const replaced: string[] = [];\n for (const fileName of GLOBAL_PO_SEED_FILES) {\n const targetPath = path.join(directory, fileName);\n const existed = classifyTarget(targetPath) === 'file';\n\n if (options.force) {\n publishForcefully(targetPath, templates[fileName], fileMode);\n (existed ? replaced : created).push(fileName);\n continue;\n }\n if (existed) {\n preserved.push(fileName);\n continue;\n }\n if (publishExclusively(targetPath, templates[fileName], fileMode)) created.push(fileName);\n else preserved.push(fileName);\n }\n\n return { directory, created, preserved, replaced };\n}\n\n/**\n * Fills missing global seed files.\n *\n * Existing files are left alone so that re-running init never discards\n * hand-edited config; pass `force` to overwrite them from the template. A new\n * file is published with an exclusive hard link, so a concurrent writer in\n * another process never loses its file to this one.\n *\n * @deprecated Node-only sync shim; use initializeGlobalPoConfigAsync. Removed in M2.\n */\nexport function initializeGlobalPoConfig(\n homeDirectory = nodeHost.homeDirectory(),\n options: GlobalPoInitOptions = {},\n): GlobalPoInitResult {\n return initializePoConfig(\n globalPoConfigDirectory(homeDirectory),\n PO_CONFIG_TEMPLATES,\n options,\n PRIVATE_DIRECTORY_MODE,\n PRIVATE_FILE_MODE,\n );\n}\n\n/**\n * Seeds repository-local configuration without creating or changing Pi settings.\n *\n * @deprecated Node-only sync shim; use initializeRepositoryPoConfigAsync. Removed in M2.\n */\nexport function initializeRepositoryPoConfig(\n repositoryRoot = process.cwd(),\n options: RepositoryPoInitOptions = {},\n): RepositoryPoInitResult {\n return initializePoConfig(\n path.join(path.resolve(repositoryRoot), PO_DIRECTORY),\n REPOSITORY_PO_CONFIG_TEMPLATES,\n options,\n REPOSITORY_DIRECTORY_MODE,\n REPOSITORY_FILE_MODE,\n );\n}\n","import path from 'node:path';\n\nimport {\n createSerialRunner,\n getOrThrow,\n nodeHost,\n writeFileAtomic,\n type FileSystem,\n} from '@agimon-ai/po-core/platform';\n\nimport { globalPoConfigDirectory } from '../config';\nimport {\n PO_CONFIG_TEMPLATES,\n PO_DIRECTORY,\n GLOBAL_PO_SEED_FILES,\n PRIVATE_DIRECTORY_MODE,\n PRIVATE_FILE_MODE,\n REPOSITORY_DIRECTORY_MODE,\n REPOSITORY_PO_CONFIG_TEMPLATES,\n REPOSITORY_FILE_MODE,\n type PoSeedFile,\n type GlobalPoInitOptions,\n type GlobalPoInitResult,\n type RepositoryPoInitOptions,\n type RepositoryPoInitResult,\n} from './templates';\n\ntype IoContext = Parameters<FileSystem['readTextFile']>[1];\n\nexport {\n PO_CONFIG_TEMPLATES,\n GLOBAL_PO_SEED_FILES,\n REPOSITORY_PO_CONFIG_TEMPLATES,\n type GlobalPoInitOptions,\n type GlobalPoInitResult,\n type RepositoryPoInitOptions,\n type RepositoryPoInitResult,\n} from './templates';\nexport { initializeGlobalPoConfig, initializeRepositoryPoConfig } from './sync';\n\n/** Seed writes in this process are queued per file, so a check and its write are not interleaved. */\nconst seedWrites = createSerialRunner();\n\nasync function ensureDirectory(fs: FileSystem, directory: string, mode: number, context: IoContext): Promise<void> {\n let info = await fs.fileInfo(directory, context);\n if (!info.ok && info.error.code === 'not_found') {\n const created = await fs.createDir(directory, { recursive: false }, context);\n if (created.ok) await nodeHost.setMode(directory, mode);\n info = await fs.fileInfo(directory, context);\n }\n const kind = getOrThrow(info).kind;\n if (kind === 'symlink') throw new Error(`Refusing to initialize through symlinked directory: ${directory}`);\n if (kind !== 'directory') throw new Error(`Po config path is not a directory: ${directory}`);\n}\n\nasync function classifyTarget(fs: FileSystem, targetPath: string, context: IoContext): Promise<'missing' | 'file'> {\n const info = await fs.fileInfo(targetPath, context);\n if (!info.ok && info.error.code === 'not_found') return 'missing';\n const kind = getOrThrow(info).kind;\n if (kind === 'file') return 'file';\n if (kind === 'symlink') {\n try {\n const target = getOrThrow(await fs.canonicalPath(targetPath, context));\n if (getOrThrow(await fs.fileInfo(target, context)).kind === 'file') return 'file';\n } catch (error) {\n throw new Error(`Po config seed symlink is not file-like: ${targetPath}`, { cause: error });\n }\n }\n throw new Error(`Po config seed path is not file-like: ${targetPath}`);\n}\n\nasync function publish(fs: FileSystem, targetPath: string, content: string, mode: number, context: IoContext) {\n await writeFileAtomic(fs, targetPath, content, context);\n await nodeHost.setMode(targetPath, mode);\n}\n\n/**\n * Fills one seed directory over a FileSystem.\n *\n * Without `force`, a missing file is checked and written inside one queued step\n * per file. The FileSystem has no exclusive create, so a second process writing\n * the same new file at the same instant can be overwritten; the Node-only sync\n * shim keeps its hard-link publication for that case.\n */\nasync function initializePoConfig(\n fs: FileSystem,\n directory: string,\n templates: Readonly<Record<PoSeedFile, string>>,\n options: GlobalPoInitOptions,\n directoryMode: number,\n fileMode: number,\n context: IoContext,\n): Promise<GlobalPoInitResult> {\n await ensureDirectory(fs, path.dirname(directory), directoryMode, context);\n await ensureDirectory(fs, directory, directoryMode, context);\n\n const created: string[] = [];\n const preserved: string[] = [];\n const replaced: string[] = [];\n for (const fileName of GLOBAL_PO_SEED_FILES) {\n const targetPath = path.join(directory, fileName);\n await seedWrites.forKey(path.resolve(targetPath))(async () => {\n const existed = (await classifyTarget(fs, targetPath, context)) === 'file';\n if (existed && !options.force) {\n preserved.push(fileName);\n return;\n }\n await publish(fs, targetPath, templates[fileName], fileMode, context);\n (existed ? replaced : created).push(fileName);\n });\n }\n return { directory, created, preserved, replaced };\n}\n\n/**\n * Fills missing global seed files over a FileSystem.\n *\n * Existing files are left alone so that re-running init never discards\n * hand-edited config; pass `force` to overwrite them from the template.\n */\nexport function initializeGlobalPoConfigAsync(\n fs: FileSystem,\n context: IoContext,\n homeDirectory = nodeHost.homeDirectory(),\n options: GlobalPoInitOptions = {},\n): Promise<GlobalPoInitResult> {\n return initializePoConfig(\n fs,\n globalPoConfigDirectory(homeDirectory),\n PO_CONFIG_TEMPLATES,\n options,\n PRIVATE_DIRECTORY_MODE,\n PRIVATE_FILE_MODE,\n context,\n );\n}\n\n/** Seeds repository-local configuration over a FileSystem without creating or changing Pi settings. */\nexport function initializeRepositoryPoConfigAsync(\n fs: FileSystem,\n repositoryRoot: string,\n context: IoContext,\n options: RepositoryPoInitOptions = {},\n): Promise<RepositoryPoInitResult> {\n return initializePoConfig(\n fs,\n path.join(path.resolve(repositoryRoot), PO_DIRECTORY),\n REPOSITORY_PO_CONFIG_TEMPLATES,\n options,\n REPOSITORY_DIRECTORY_MODE,\n REPOSITORY_FILE_MODE,\n context,\n );\n}\n"],"mappings":";;;;;;;;AAOA,MAAa,uBAAuB;CAAC;CAAe;CAAc;CAAgB;AAAe;;AAKjG,MAAa,sBAA4D;CACvE,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4Bf,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8Gd,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyDhB,iBAAiB;;;;;;;;;;;;;;;;;;;;;AAqBnB;;AAGA,MAAa,iCAAuE;CAClF,eAAe,oBAAoB;CACnC,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2Ed,gBAAgB;;;;;;;;;;;CAWhB,iBAAiB;;;;;AAKnB;;;AC9SA,MAAM,gBAAgB;AACtB,MAAM,sBAAsB;AAC5B,MAAM,iBAAiB;AAEvB,SAAS,UAAU,OAAoC;CACrD,IAAI,EAAE,iBAAiB,QAAQ,OAAO,KAAA;CACtC,MAAM,OAAQ,MAAgC;CAC9C,OAAO,OAAO,SAAS,WAAW,OAAO,KAAA;AAC3C;AAEA,SAASA,kBAAgB,WAAmB,MAAoB;CAC9D,IAAI;CACJ,IAAI;EACF,QAA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IAAI,YAAY,UAAU,WAAW,UAAU,OAAO;GACpE,CAAC,UAAU,WAAW,QAAA,CAAS,KAAK,QAAQ;EAC9C,CAAC;CACH;CACA,OAAO;EAAE;EAAW;EAAS;EAAW;CAAS;AACnD;;;;;;;AAQA,SAAgB,8BACd,IACA,SACA,gBAAgB,SAAS,cAAc,GACvC,UAA+B,CAAC,GACH;CAC7B,OAAO,mBACL,IACA,wBAAwB,aAAa,GACrC,qBACA,SAAA,KAAA,KAGA,OACF;AACF;;AAGA,SAAgB,kCACd,IACA,gBACA,SACA,UAAmC,CAAC,GACH;CACjC,OAAO,mBACL,IACA,KAAK,KAAK,KAAK,QAAQ,cAAc,GAAA,KAAe,GACpD,gCACA,SAAA,KAAA,KAGA,OACF;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"init-Dotk_UW-.cjs","names":["ensureDirectory","fs","path","classifyTarget","nodeHost","randomUUID","initializePoConfig","globalPoConfigDirectory","createSerialRunner","nodeHost","getOrThrow","writeFileAtomic","path","globalPoConfigDirectory"],"sources":["../src/services/init/templates.ts","../src/services/init/sync.ts","../src/services/init/index.ts"],"sourcesContent":["export const PRIVATE_DIRECTORY_MODE = 0o700;\nexport const PRIVATE_FILE_MODE = 0o600;\nexport const REPOSITORY_DIRECTORY_MODE = 0o755;\nexport const REPOSITORY_FILE_MODE = 0o644;\nexport const PO_DIRECTORY = '.po';\n\n/** The global seed files are processed in this fixed order. */\nexport const GLOBAL_PO_SEED_FILES = ['config.yaml', 'modes.yaml', 'domains.yaml', 'profiles.yaml'] as const;\n\nexport type PoSeedFile = (typeof GLOBAL_PO_SEED_FILES)[number];\n\n/** Portable defaults for a new global Po configuration directory. */\nexport const PO_CONFIG_TEMPLATES: Readonly<Record<PoSeedFile, string>> = {\n 'config.yaml': `projectTrust: ask\n\n# Autonomous voice is opt-in and uses an explicitly configured Pi model.\n# voice:\n# autoCapture:\n# model: provider/model-id\n# startPhrases:\n# - hey po\n# stopPhrases:\n# - stop speaking\n# utteranceIdleMs: 3000\n# # Long prompts only: open a draft, keep talking, then send it in one piece.\n# # Short utterances are delivered as you finish them and need no phrase.\n# composeOpenPhrases:\n# - hey po\n# composeSendPhrases:\n# - that's it\n# composeCancelPhrases:\n# - scratch that\n# # Endpoint window while a draft collects, so a short command lands on its own.\n# composeUtteranceIdleMs: 1200\n# # Silence before Voice reminds you a draft is open. 0 turns the reminder off.\n# composeNudgeMs: 10000\n# tts:\n# engine: macos-say\n# voice: Samantha\n# rate: 190\n`,\n 'modes.yaml': `# A layer is a reusable named bundle of packages, built-in or local extensions,\n# and hook groups. Major modes below choose which layers load together for a session.\n#\n# Layers and modes defined here apply to every repository. A repository's own\n# .po/modes.yaml is read after this file and replaces any layer or mode of the\n# same name, so a repository can override one entry without restating the rest.\n#\n# Add a layer by giving it a unique name under layers. Local Pi scripts belong\n# under extensions, while installed Pi packages belong under packages:\n# review-tools:\n# extensions:\n# - './extensions/local-review.ts'\n# packages:\n# - '@scope/review-extension'\n# A bare extension name selects a Po built-in. A path beginning with ./ or\n# ../ loads a custom script or extension directory. A bare package loads its\n# ordered package.json pi.extensions entries, while an exported subpath selects\n# one adapter. Relative paths resolve beside this file here (~/.po), or\n# from the repository root in .po/modes.yaml.\n#\n# Use a package mapping when that package accepts configuration. Configuration\n# belongs under the package entry that consumes it, not beside packages.\n# The top-level default bundle loads before every major mode. Replace this whole\n# packages list to customize the distribution defaults. Po core packages\n# remain active independently of this list.\ndefault:\n packages:\n - '@agimon-ai/po-help'\n - '@agimon-ai/po-goal'\n - '@agimon-ai/po-voice'\n - '@agimon-ai/po-runner'\n - '@agimon-ai/po-codemode'\n - '@agimon-ai/po-read'\n - '@agimon-ai/po-grep'\n - '@agimon-ai/po-edit'\n - '@agimon-ai/po-file-edit'\n - '@agimon-ai/po-autocompact'\n - '@agimon-ai/po-loop'\n - '@agimon-ai/po-plan'\n - '@agimon-ai/po-author'\n - '@agimon-ai/po-computer-use'\n - '@agimon-ai/po-workflow'\n - '@agimon-ai/po-log'\n - '@agimon-ai/po-mcp'\n - '@agimon-ai/po-prompt'\n - '@agimon-ai/po-template-advanced'\n - '@agimon-ai/po-template-elegant'\nlayers:\n coding:\n packages:\n - '@agimon-ai/po-vibe-lint'\n team:\n packages:\n - name: '@agimon-ai/po-team'\n # Optional Team configuration. Uncomment and choose models available to Pi.\n # config:\n # models:\n # - model: openai-codex/gpt-5.6-luna\n # thinking: xhigh\n # # Tool names excluded from subagents launched by this package. These\n # # remove model-visible tools while preserving hidden team transport.\n # excludeTools: [ask_user_question, intercom, subagent]\n dynamic-workflow:\n packages:\n - '@agimon-ai/po-dynamic-workflow'\n ask-user:\n packages:\n - '@agimon-ai/po-user-feedback'\n task:\n packages:\n - '@agimon-ai/po-task'\n sandbox:\n packages:\n - '@agimon-ai/po-sandbox'\n design:\n packages:\n - '@agimon-ai/po-style-system'\n llm:\n packages:\n - '@agimon-ai/po-model-guidance'\n source-control:\n packages:\n - '@agimon-ai/po-git'\n image-gen:\n packages:\n - '@agimon-ai/po-image-gen'\n web-search:\n packages:\n - '@agimon-ai/po-web-search'\n browser:\n packages:\n - '@agimon-ai/po-browse'\n# A major mode explains when it should be used and names its ordered layers.\n# Add another entry under majorMode, then select it with\n# po --major-mode <name>. Change defaultMajorMode to make it the default.\ndefaultMajorMode: copilot\nmajorMode:\n minimal:\n description: Lean mode with Team delegation and persistent tasks.\n layers: [team, dynamic-workflow, task, llm]\n copilot:\n description: General-purpose coding mode with delegation, persistent tasks, supervised commands, and structured user feedback.\n layers: [team, dynamic-workflow, ask-user, task, sandbox, llm, source-control, design, image-gen, web-search, browser, coding]\n examples:\n description: Base mode with dynamic workflows for the repository's plugin and workflow examples.\n layers: [dynamic-workflow]\n # review:\n # description: Focused review mode for inspecting changes and reporting risks.\n # layers: [team, task, ask-user]\n`,\n 'domains.yaml': `# Plugins are named once in this catalog, then selected by one or more domains.\n# Po automatically inspects personal and repository Codex marketplaces.\n# Each configured root may also be a folder whose direct children are plugins;\n# use roots: [plugins] to discover a repository plugin folder without one entry\n# per plugin. Discovery never scans recursively.\ndefaultDomains: [default]\nplugins:\n roots: []\n entries: {}\n # Local paths resolve beside this file in ~/.po. Repository paths in a\n # repository .po/domains.yaml resolve from that repository root.\n # entries:\n # development:\n # source: local\n # path: plugins/development\n # remote-review:\n # source: url\n # url: https://github.com/acme/review-plugin.git\n # ref: v1.2.0\n # published-review:\n # source: npm\n # package: '@acme/review-plugin'\n # version: 1.2.0\n# Domains carry descriptions and refer to catalog names, not filesystem paths.\ndomains:\n default:\n description: Shared skills and repository MCP only.\n plugins: []\n # development:\n # description: TypeScript implementation and review tools.\n # plugins:\n # - development\n # # Mapping form can load only selected resources from a shared plugin.\n # - name: remote-review\n # skills: [typescript]\n # agents: [reviewer]\n # hooks: false\n # mcp: true\n # # Set false only when this domain should omit shared .claude/skills.\n # sharedSkills: false\n # # Domain mcp is an allowlist over servers configured elsewhere, not a\n # # request to start new ones. Listing servers here drops the tool schemas\n # # of the ones left out, usually the largest context saving a domain can\n # # make. Run po --explain to see the token cost before and after.\n # # Filtering applies only when every selected domain declares mcp, so a\n # # selection mixing this with a domain that omits it stays unfiltered.\n # mcp:\n # servers: [code-intel]\n # proxy: [repository-search]\n# Select it with po --domains development, or add it to defaultDomains.\n#\n# Aliases let one selection enable multiple domains. Replace the empty mapping\n# below with entries like the commented example.\naliases: {}\n# aliases:\n# work: [default, development]\n`,\n 'profiles.yaml': `# Profiles select a persona and optional environment defaults for a session.\n# Each configured root may itself be a profile or contain direct-child profile\n# folders. A folder is discovered when it contains profile.md, SOUL.md, or\n# AGENTS.md; discovery never scans recursively.\nprofiles:\n roots: []\n entries: {}\n # Roots resolve beside this file in ~/.po. Repository roots in a\n # repository .po/profiles.yaml resolve from that repository root.\n # roots: [agents/acme]\n # Explicit entries override an automatically discovered folder of the same\n # name. Environment values must be strings; already exported values win.\n # entries:\n # writer:\n # persona: agents/special/writer\n # env:\n # BRAND: acme\n # TONE: concise\n# Po Pi concatenates profile.md, SOUL.md, then AGENTS.md for the persona.\n# Select one with: po --profile writer\n`,\n};\n\n/** Standalone defaults for a repository that is trying Po through Po. */\nexport const REPOSITORY_PO_CONFIG_TEMPLATES: Readonly<Record<PoSeedFile, string>> = {\n 'config.yaml': PO_CONFIG_TEMPLATES['config.yaml'],\n 'modes.yaml': `# Repository-local layers and major modes. These entries override personal\n# entries with the same name from ~/.po/modes.yaml.\n# This repository-local default replaces the personal top-level default as one\n# whole package list. Edit it to customize the standalone package baseline.\ndefault:\n packages:\n - '@agimon-ai/po-help'\n - '@agimon-ai/po-goal'\n - '@agimon-ai/po-voice'\n - '@agimon-ai/po-runner'\n - '@agimon-ai/po-codemode'\n - '@agimon-ai/po-read'\n - '@agimon-ai/po-grep'\n - '@agimon-ai/po-edit'\n - '@agimon-ai/po-file-edit'\n - '@agimon-ai/po-autocompact'\n - '@agimon-ai/po-loop'\n - '@agimon-ai/po-plan'\n - '@agimon-ai/po-author'\n - '@agimon-ai/po-computer-use'\n - '@agimon-ai/po-workflow'\n - '@agimon-ai/po-log'\n - '@agimon-ai/po-mcp'\n - '@agimon-ai/po-prompt'\n - '@agimon-ai/po-template-advanced'\n - '@agimon-ai/po-template-elegant'\nlayers:\n coding:\n packages:\n - '@agimon-ai/po-vibe-lint'\n team:\n packages:\n - name: '@agimon-ai/po-team'\n dynamic-workflow:\n packages:\n - '@agimon-ai/po-dynamic-workflow'\n ask-user:\n packages:\n - '@agimon-ai/po-user-feedback'\n task:\n packages:\n - '@agimon-ai/po-task'\n sandbox:\n packages:\n - '@agimon-ai/po-sandbox'\n design:\n packages:\n - '@agimon-ai/po-style-system'\n llm:\n packages:\n - '@agimon-ai/po-model-guidance'\n source-control:\n packages:\n - '@agimon-ai/po-git'\n image-gen:\n packages:\n - '@agimon-ai/po-image-gen'\n web-search:\n packages:\n - '@agimon-ai/po-web-search'\n browser:\n packages:\n - '@agimon-ai/po-browse'\ndefaultMajorMode: copilot\nmajorMode:\n minimal:\n description: Lean mode with Team delegation and persistent tasks.\n layers: [team, dynamic-workflow, task, llm]\n copilot:\n description: General-purpose coding mode with delegation, persistent tasks, supervised commands, and structured user feedback.\n layers: [team, dynamic-workflow, ask-user, task, sandbox, llm, source-control, design, image-gen, web-search, browser, coding]\n examples:\n description: Base mode with dynamic workflows for the repository's plugin and workflow examples.\n layers: [dynamic-workflow]\n`,\n 'domains.yaml': `# Repository-local plugin catalog and domain selection.\ndefaultDomains: [default]\nplugins:\n roots: []\n entries: {}\ndomains:\n default:\n description: Shared skills and repository MCP only.\n plugins: []\naliases: {}\n`,\n 'profiles.yaml': `# Repository-local persona roots and environment defaults.\nprofiles:\n roots: []\n entries: {}\n`,\n};\n\n/** Result of filling a Po seed directory. File arrays contain names in seed order. */\nexport interface GlobalPoInitResult {\n directory: string;\n created: string[];\n preserved: string[];\n /** Existing files overwritten from the template. Only ever non-empty under `force`. */\n replaced: string[];\n}\n\nexport interface GlobalPoInitOptions {\n /**\n * Overwrite existing seed files instead of preserving them.\n *\n * Off by default: init is safe to re-run, and hand-edited config is the\n * normal case rather than the exception.\n */\n force?: boolean;\n}\n\nexport type RepositoryPoInitOptions = GlobalPoInitOptions;\nexport type RepositoryPoInitResult = GlobalPoInitResult;\n","import { randomUUID } from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport { nodeHost } from '@agimon-ai/po-core/platform';\n\nimport { globalPoConfigDirectory } from '../config';\nimport {\n PO_CONFIG_TEMPLATES,\n PO_DIRECTORY,\n GLOBAL_PO_SEED_FILES,\n PRIVATE_DIRECTORY_MODE,\n PRIVATE_FILE_MODE,\n REPOSITORY_DIRECTORY_MODE,\n REPOSITORY_PO_CONFIG_TEMPLATES,\n REPOSITORY_FILE_MODE,\n type PoSeedFile,\n type GlobalPoInitOptions,\n type GlobalPoInitResult,\n type RepositoryPoInitOptions,\n type RepositoryPoInitResult,\n} from './templates';\n\nconst UTF8_ENCODING = 'utf8';\nconst FILE_ALREADY_EXISTS = 'EEXIST';\nconst FILE_NOT_FOUND = 'ENOENT';\n\nfunction errorCode(error: unknown): string | undefined {\n if (!(error instanceof Error)) return undefined;\n const code = (error as NodeJS.ErrnoException).code;\n return typeof code === 'string' ? code : undefined;\n}\n\nfunction ensureDirectory(directory: string, mode: number): void {\n let stats: fs.Stats;\n try {\n stats = fs.lstatSync(directory);\n } catch (error) {\n if (errorCode(error) !== FILE_NOT_FOUND) throw error;\n try {\n fs.mkdirSync(directory, { mode });\n stats = fs.lstatSync(directory);\n } catch (mkdirError) {\n if (errorCode(mkdirError) !== FILE_ALREADY_EXISTS) throw mkdirError;\n stats = fs.lstatSync(directory);\n }\n }\n\n if (stats.isSymbolicLink()) {\n throw new Error(`Refusing to initialize through symlinked directory: ${directory}`);\n }\n if (!stats.isDirectory()) {\n throw new Error(`Po config path is not a directory: ${directory}`);\n }\n}\n\nfunction ensurePoDirectory(directory: string, mode: number): void {\n ensureDirectory(path.dirname(directory), mode);\n ensureDirectory(directory, mode);\n}\n\nfunction classifyTarget(targetPath: string): 'missing' | 'file' {\n let stats: fs.Stats;\n try {\n stats = fs.lstatSync(targetPath);\n } catch (error) {\n if (errorCode(error) === FILE_NOT_FOUND) return 'missing';\n throw error;\n }\n\n if (stats.isFile()) return 'file';\n if (stats.isSymbolicLink()) {\n try {\n if (fs.statSync(targetPath).isFile()) return 'file';\n } catch (error) {\n throw new Error(`Po config seed symlink is not file-like: ${targetPath}`, { cause: error });\n }\n }\n throw new Error(`Po config seed path is not file-like: ${targetPath}`);\n}\n\nfunction cleanupTemporaryFile(temporaryPath: string): void {\n try {\n fs.unlinkSync(temporaryPath);\n } catch (error) {\n if (errorCode(error) !== FILE_NOT_FOUND) throw error;\n }\n}\n\nfunction publishExclusively(targetPath: string, content: string, mode: number): boolean {\n const temporaryPath = `${targetPath}.${nodeHost.processId()}.${randomUUID()}.tmp`;\n let fileDescriptor: number | undefined;\n try {\n fileDescriptor = fs.openSync(temporaryPath, 'wx', mode);\n fs.writeFileSync(fileDescriptor, content, UTF8_ENCODING);\n fs.fchmodSync(fileDescriptor, mode);\n fs.fsyncSync(fileDescriptor);\n const descriptorToClose = fileDescriptor;\n fileDescriptor = undefined;\n fs.closeSync(descriptorToClose);\n\n try {\n fs.linkSync(temporaryPath, targetPath);\n return true;\n } catch (error) {\n if (errorCode(error) === FILE_ALREADY_EXISTS && classifyTarget(targetPath) === 'file') return false;\n throw error;\n }\n } finally {\n if (fileDescriptor !== undefined) {\n const descriptorToClose = fileDescriptor;\n fileDescriptor = undefined;\n fs.closeSync(descriptorToClose);\n }\n cleanupTemporaryFile(temporaryPath);\n }\n}\n\n/**\n * Replaces a seed file with the template, atomically.\n *\n * The rename swaps the directory entry in one step, so a reader either sees the\n * whole old file or the whole new one. Renaming onto a symlinked seed replaces\n * the link rather than writing through it.\n */\nfunction publishForcefully(targetPath: string, content: string, mode: number): void {\n const temporaryPath = `${targetPath}.${nodeHost.processId()}.${randomUUID()}.tmp`;\n let fileDescriptor: number | undefined;\n try {\n fileDescriptor = fs.openSync(temporaryPath, 'wx', mode);\n fs.writeFileSync(fileDescriptor, content, UTF8_ENCODING);\n fs.fchmodSync(fileDescriptor, mode);\n fs.fsyncSync(fileDescriptor);\n const descriptorToClose = fileDescriptor;\n fileDescriptor = undefined;\n fs.closeSync(descriptorToClose);\n\n fs.renameSync(temporaryPath, targetPath);\n } finally {\n if (fileDescriptor !== undefined) {\n const descriptorToClose = fileDescriptor;\n fileDescriptor = undefined;\n fs.closeSync(descriptorToClose);\n }\n cleanupTemporaryFile(temporaryPath);\n }\n}\n\nfunction initializePoConfig(\n directory: string,\n templates: Readonly<Record<PoSeedFile, string>>,\n options: GlobalPoInitOptions,\n directoryMode: number,\n fileMode: number,\n): GlobalPoInitResult {\n ensurePoDirectory(directory, directoryMode);\n\n const created: string[] = [];\n const preserved: string[] = [];\n const replaced: string[] = [];\n for (const fileName of GLOBAL_PO_SEED_FILES) {\n const targetPath = path.join(directory, fileName);\n const existed = classifyTarget(targetPath) === 'file';\n\n if (options.force) {\n publishForcefully(targetPath, templates[fileName], fileMode);\n (existed ? replaced : created).push(fileName);\n continue;\n }\n if (existed) {\n preserved.push(fileName);\n continue;\n }\n if (publishExclusively(targetPath, templates[fileName], fileMode)) created.push(fileName);\n else preserved.push(fileName);\n }\n\n return { directory, created, preserved, replaced };\n}\n\n/**\n * Fills missing global seed files.\n *\n * Existing files are left alone so that re-running init never discards\n * hand-edited config; pass `force` to overwrite them from the template. A new\n * file is published with an exclusive hard link, so a concurrent writer in\n * another process never loses its file to this one.\n *\n * @deprecated Node-only sync shim; use initializeGlobalPoConfigAsync. Removed in M2.\n */\nexport function initializeGlobalPoConfig(\n homeDirectory = nodeHost.homeDirectory(),\n options: GlobalPoInitOptions = {},\n): GlobalPoInitResult {\n return initializePoConfig(\n globalPoConfigDirectory(homeDirectory),\n PO_CONFIG_TEMPLATES,\n options,\n PRIVATE_DIRECTORY_MODE,\n PRIVATE_FILE_MODE,\n );\n}\n\n/**\n * Seeds repository-local configuration without creating or changing Pi settings.\n *\n * @deprecated Node-only sync shim; use initializeRepositoryPoConfigAsync. Removed in M2.\n */\nexport function initializeRepositoryPoConfig(\n repositoryRoot = process.cwd(),\n options: RepositoryPoInitOptions = {},\n): RepositoryPoInitResult {\n return initializePoConfig(\n path.join(path.resolve(repositoryRoot), PO_DIRECTORY),\n REPOSITORY_PO_CONFIG_TEMPLATES,\n options,\n REPOSITORY_DIRECTORY_MODE,\n REPOSITORY_FILE_MODE,\n );\n}\n","import path from 'node:path';\n\nimport {\n createSerialRunner,\n getOrThrow,\n nodeHost,\n writeFileAtomic,\n type FileSystem,\n} from '@agimon-ai/po-core/platform';\n\nimport { globalPoConfigDirectory } from '../config';\nimport {\n PO_CONFIG_TEMPLATES,\n PO_DIRECTORY,\n GLOBAL_PO_SEED_FILES,\n PRIVATE_DIRECTORY_MODE,\n PRIVATE_FILE_MODE,\n REPOSITORY_DIRECTORY_MODE,\n REPOSITORY_PO_CONFIG_TEMPLATES,\n REPOSITORY_FILE_MODE,\n type PoSeedFile,\n type GlobalPoInitOptions,\n type GlobalPoInitResult,\n type RepositoryPoInitOptions,\n type RepositoryPoInitResult,\n} from './templates';\n\ntype IoContext = Parameters<FileSystem['readTextFile']>[1];\n\nexport {\n PO_CONFIG_TEMPLATES,\n GLOBAL_PO_SEED_FILES,\n REPOSITORY_PO_CONFIG_TEMPLATES,\n type GlobalPoInitOptions,\n type GlobalPoInitResult,\n type RepositoryPoInitOptions,\n type RepositoryPoInitResult,\n} from './templates';\nexport { initializeGlobalPoConfig, initializeRepositoryPoConfig } from './sync';\n\n/** Seed writes in this process are queued per file, so a check and its write are not interleaved. */\nconst seedWrites = createSerialRunner();\n\nasync function ensureDirectory(fs: FileSystem, directory: string, mode: number, context: IoContext): Promise<void> {\n let info = await fs.fileInfo(directory, context);\n if (!info.ok && info.error.code === 'not_found') {\n const created = await fs.createDir(directory, { recursive: false }, context);\n if (created.ok) await nodeHost.setMode(directory, mode);\n info = await fs.fileInfo(directory, context);\n }\n const kind = getOrThrow(info).kind;\n if (kind === 'symlink') throw new Error(`Refusing to initialize through symlinked directory: ${directory}`);\n if (kind !== 'directory') throw new Error(`Po config path is not a directory: ${directory}`);\n}\n\nasync function classifyTarget(fs: FileSystem, targetPath: string, context: IoContext): Promise<'missing' | 'file'> {\n const info = await fs.fileInfo(targetPath, context);\n if (!info.ok && info.error.code === 'not_found') return 'missing';\n const kind = getOrThrow(info).kind;\n if (kind === 'file') return 'file';\n if (kind === 'symlink') {\n try {\n const target = getOrThrow(await fs.canonicalPath(targetPath, context));\n if (getOrThrow(await fs.fileInfo(target, context)).kind === 'file') return 'file';\n } catch (error) {\n throw new Error(`Po config seed symlink is not file-like: ${targetPath}`, { cause: error });\n }\n }\n throw new Error(`Po config seed path is not file-like: ${targetPath}`);\n}\n\nasync function publish(fs: FileSystem, targetPath: string, content: string, mode: number, context: IoContext) {\n await writeFileAtomic(fs, targetPath, content, context);\n await nodeHost.setMode(targetPath, mode);\n}\n\n/**\n * Fills one seed directory over a FileSystem.\n *\n * Without `force`, a missing file is checked and written inside one queued step\n * per file. The FileSystem has no exclusive create, so a second process writing\n * the same new file at the same instant can be overwritten; the Node-only sync\n * shim keeps its hard-link publication for that case.\n */\nasync function initializePoConfig(\n fs: FileSystem,\n directory: string,\n templates: Readonly<Record<PoSeedFile, string>>,\n options: GlobalPoInitOptions,\n directoryMode: number,\n fileMode: number,\n context: IoContext,\n): Promise<GlobalPoInitResult> {\n await ensureDirectory(fs, path.dirname(directory), directoryMode, context);\n await ensureDirectory(fs, directory, directoryMode, context);\n\n const created: string[] = [];\n const preserved: string[] = [];\n const replaced: string[] = [];\n for (const fileName of GLOBAL_PO_SEED_FILES) {\n const targetPath = path.join(directory, fileName);\n await seedWrites.forKey(path.resolve(targetPath))(async () => {\n const existed = (await classifyTarget(fs, targetPath, context)) === 'file';\n if (existed && !options.force) {\n preserved.push(fileName);\n return;\n }\n await publish(fs, targetPath, templates[fileName], fileMode, context);\n (existed ? replaced : created).push(fileName);\n });\n }\n return { directory, created, preserved, replaced };\n}\n\n/**\n * Fills missing global seed files over a FileSystem.\n *\n * Existing files are left alone so that re-running init never discards\n * hand-edited config; pass `force` to overwrite them from the template.\n */\nexport function initializeGlobalPoConfigAsync(\n fs: FileSystem,\n context: IoContext,\n homeDirectory = nodeHost.homeDirectory(),\n options: GlobalPoInitOptions = {},\n): Promise<GlobalPoInitResult> {\n return initializePoConfig(\n fs,\n globalPoConfigDirectory(homeDirectory),\n PO_CONFIG_TEMPLATES,\n options,\n PRIVATE_DIRECTORY_MODE,\n PRIVATE_FILE_MODE,\n context,\n );\n}\n\n/** Seeds repository-local configuration over a FileSystem without creating or changing Pi settings. */\nexport function initializeRepositoryPoConfigAsync(\n fs: FileSystem,\n repositoryRoot: string,\n context: IoContext,\n options: RepositoryPoInitOptions = {},\n): Promise<RepositoryPoInitResult> {\n return initializePoConfig(\n fs,\n path.join(path.resolve(repositoryRoot), PO_DIRECTORY),\n REPOSITORY_PO_CONFIG_TEMPLATES,\n options,\n REPOSITORY_D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