@agimon-ai/po-config 0.0.0-alpha.201 → 0.0.0-alpha.202
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{completion-BeLpnmA4.d.mts → completion-BrN-LdQ6.d.mts} +3 -3
- package/dist/{completion-BeLpnmA4.d.mts.map → completion-BrN-LdQ6.d.mts.map} +1 -1
- package/dist/{config-tk56d8mk.d.mts → config-CG_KJdcd.d.mts} +32 -2
- package/dist/config-CG_KJdcd.d.mts.map +1 -0
- package/dist/{config-DB7YUo6N.cjs → config-DNicyP1o.cjs} +4 -5
- package/dist/{config-DB7YUo6N.cjs.map → config-DNicyP1o.cjs.map} +1 -1
- package/dist/{config-BeErFE6a.mjs → config-UMC0q7Hw.mjs} +2 -3
- package/dist/{config-BeErFE6a.mjs.map → config-UMC0q7Hw.mjs.map} +1 -1
- package/dist/config.cjs +19 -19
- package/dist/config.d.mts +5 -5
- package/dist/config.mjs +3 -4
- package/dist/{configWriter-DwaYuqi8.mjs → configWriter-BwscA6Rd.mjs} +27 -6
- package/dist/configWriter-BwscA6Rd.mjs.map +1 -0
- package/dist/{configWriter-BzTOeJCT.cjs → configWriter-pyLYf49O.cjs} +33 -6
- package/dist/configWriter-pyLYf49O.cjs.map +1 -0
- package/dist/configWriter.cjs +2 -1
- package/dist/configWriter.d.mts +2 -2
- package/dist/configWriter.mjs +1 -1
- package/dist/{configPolicy-BL4UUBLR.cjs → core-0zEBs0G5.cjs} +458 -4
- package/dist/core-0zEBs0G5.cjs.map +1 -0
- package/dist/{core-DMD33YiW.d.mts → core-BfpG7H9Y.d.mts} +2 -2
- package/dist/{core-DMD33YiW.d.mts.map → core-BfpG7H9Y.d.mts.map} +1 -1
- package/dist/{configPolicy-BFBzdISO.mjs → core-DL7Cqt_6.mjs} +313 -5
- package/dist/core-DL7Cqt_6.mjs.map +1 -0
- package/dist/{domains-dSPktRdk.cjs → domains-B8ehjhd7.cjs} +4 -4
- package/dist/{domains-dSPktRdk.cjs.map → domains-B8ehjhd7.cjs.map} +1 -1
- package/dist/{domains-B2jnohjL.mjs → domains-BX0B7B_v.mjs} +4 -4
- package/dist/{domains-B2jnohjL.mjs.map → domains-BX0B7B_v.mjs.map} +1 -1
- package/dist/domains.cjs +3 -3
- package/dist/domains.d.mts +3 -3
- package/dist/domains.mjs +3 -3
- package/dist/extensions/server.cjs +2 -2
- package/dist/extensions/server.mjs +2 -2
- package/dist/harnessState.d.mts +1 -1
- package/dist/harnessStore.d.mts +1 -1
- package/dist/{index-wyQiF3PI.d.mts → index--qUH-gT7.d.mts} +3 -3
- package/dist/{index-wyQiF3PI.d.mts.map → index--qUH-gT7.d.mts.map} +1 -1
- package/dist/{index-CJ9sIwip.d.mts → index-B86o1Y6t.d.mts} +2 -2
- package/dist/{index-CJ9sIwip.d.mts.map → index-B86o1Y6t.d.mts.map} +1 -1
- package/dist/{index-BXUn46YE.d.mts → index-C7Gw9FE_.d.mts} +3 -3
- package/dist/{index-BXUn46YE.d.mts.map → index-C7Gw9FE_.d.mts.map} +1 -1
- package/dist/{index-BSqfRiCE.d.mts → index-C_TOY6Nv.d.mts} +2 -2
- package/dist/{index-BSqfRiCE.d.mts.map → index-C_TOY6Nv.d.mts.map} +1 -1
- package/dist/{index-Cehagk1u.d.mts → index-Cwo02oDp.d.mts} +3 -3
- package/dist/{index-Cehagk1u.d.mts.map → index-Cwo02oDp.d.mts.map} +1 -1
- package/dist/{index-ClDBEynT.d.mts → index-DCRZD74X.d.mts} +3 -3
- package/dist/{index-ClDBEynT.d.mts.map → index-DCRZD74X.d.mts.map} +1 -1
- package/dist/{index-_ANcZzRj.d.mts → index-HwdX1mGP.d.mts} +2 -2
- package/dist/{index-_ANcZzRj.d.mts.map → index-HwdX1mGP.d.mts.map} +1 -1
- package/dist/{index-OSfUuVIi.d.mts → index-K6JD2MmM.d.mts} +12 -3
- package/dist/index-K6JD2MmM.d.mts.map +1 -0
- package/dist/{index-N_GmmWJz.d.mts → index-mYHYXDnp.d.mts} +14 -2
- package/dist/index-mYHYXDnp.d.mts.map +1 -0
- package/dist/index.cjs +28 -27
- package/dist/index.d.mts +14 -14
- package/dist/index.mjs +11 -12
- package/dist/{init-sDZ0vh78.mjs → init-BycrOdge.mjs} +3 -3
- package/dist/{init-sDZ0vh78.mjs.map → init-BycrOdge.mjs.map} +1 -1
- package/dist/{init-DvEao9kS.cjs → init-nn_-5Anx.cjs} +3 -3
- package/dist/{init-DvEao9kS.cjs.map → init-nn_-5Anx.cjs.map} +1 -1
- package/dist/init.cjs +1 -1
- package/dist/init.mjs +1 -1
- package/dist/{layeredConfig-DpLY-Azh.mjs → layeredConfig-BnSp5MyT.mjs} +2 -2
- package/dist/{layeredConfig-DpLY-Azh.mjs.map → layeredConfig-BnSp5MyT.mjs.map} +1 -1
- package/dist/{layeredConfig-5gINd_qJ.cjs → layeredConfig-DpqoEuHx.cjs} +2 -2
- package/dist/{layeredConfig-5gINd_qJ.cjs.map → layeredConfig-DpqoEuHx.cjs.map} +1 -1
- package/dist/layeredConfig.cjs +1 -1
- package/dist/layeredConfig.d.mts +1 -1
- package/dist/layeredConfig.mjs +1 -1
- package/dist/piContext.cjs +1 -1
- package/dist/piContext.d.mts +2 -2
- package/dist/piContext.mjs +1 -1
- package/dist/po-runtime-identity.json +1 -1
- package/dist/{presetConfig-BcmdY04H.cjs → presetConfig-DtRtTwUO.cjs} +2 -2
- package/dist/{presetConfig-BcmdY04H.cjs.map → presetConfig-DtRtTwUO.cjs.map} +1 -1
- package/dist/{presetConfig-BmoZvYW-.mjs → presetConfig-Dww0K941.mjs} +2 -2
- package/dist/{presetConfig-BmoZvYW-.mjs.map → presetConfig-Dww0K941.mjs.map} +1 -1
- package/dist/{presets-lP01-CKK.mjs → presets-CRbBuITn.mjs} +5 -5
- package/dist/{presets-lP01-CKK.mjs.map → presets-CRbBuITn.mjs.map} +1 -1
- package/dist/{presets-6swHXI2u.cjs → presets-CzP4OiSX.cjs} +5 -5
- package/dist/{presets-6swHXI2u.cjs.map → presets-CzP4OiSX.cjs.map} +1 -1
- package/dist/presets.cjs +3 -3
- package/dist/presets.d.mts +2 -2
- package/dist/presets.mjs +3 -3
- package/dist/{profiles-CUHo67zR.cjs → profiles-BQBj8ODt.cjs} +2 -2
- package/dist/{profiles-CUHo67zR.cjs.map → profiles-BQBj8ODt.cjs.map} +1 -1
- package/dist/{profiles-CY2ga4PH.mjs → profiles-DSByNWWB.mjs} +2 -2
- package/dist/{profiles-CY2ga4PH.mjs.map → profiles-DSByNWWB.mjs.map} +1 -1
- package/dist/profiles.cjs +1 -1
- package/dist/profiles.d.mts +3 -3
- package/dist/profiles.mjs +1 -1
- package/dist/selectionSwitch.cjs +2 -2
- package/dist/selectionSwitch.d.mts +3 -3
- package/dist/selectionSwitch.mjs +2 -2
- package/dist/{sessionConfig-CLuSKK3A.cjs → sessionConfig-B5n8LdZl.cjs} +2 -2
- package/dist/{sessionConfig-CLuSKK3A.cjs.map → sessionConfig-B5n8LdZl.cjs.map} +1 -1
- package/dist/{sessionConfig-BESVV7Qg.mjs → sessionConfig-BeRSX_B-.mjs} +2 -2
- package/dist/{sessionConfig-BESVV7Qg.mjs.map → sessionConfig-BeRSX_B-.mjs.map} +1 -1
- package/dist/{settingsApi-bS3MV2dz.cjs → settingsApi-9sbGNwrj.cjs} +10 -11
- package/dist/{settingsApi-bS3MV2dz.cjs.map → settingsApi-9sbGNwrj.cjs.map} +1 -1
- package/dist/{settingsApi-BE3Jj3W9.mjs → settingsApi-COA9fZ7u.mjs} +8 -9
- package/dist/{settingsApi-BE3Jj3W9.mjs.map → settingsApi-COA9fZ7u.mjs.map} +1 -1
- package/dist/{sync-DW2exveL.d.mts → sync-x3mvBjeq.d.mts} +2 -2
- package/dist/{sync-DW2exveL.d.mts.map → sync-x3mvBjeq.d.mts.map} +1 -1
- package/dist/sync.cjs +2 -2
- package/dist/sync.d.mts +3 -3
- package/dist/sync.mjs +2 -2
- package/dist/types.d.mts +2 -2
- package/package.json +4 -4
- package/dist/config-tk56d8mk.d.mts.map +0 -1
- package/dist/configPolicy-BFBzdISO.mjs.map +0 -1
- package/dist/configPolicy-BL4UUBLR.cjs.map +0 -1
- package/dist/configWriter-BzTOeJCT.cjs.map +0 -1
- package/dist/configWriter-DwaYuqi8.mjs.map +0 -1
- package/dist/core-B8x1gjyx.cjs +0 -369
- package/dist/core-B8x1gjyx.cjs.map +0 -1
- package/dist/core-BjM59sEK.mjs +0 -230
- package/dist/core-BjM59sEK.mjs.map +0 -1
- package/dist/index-N_GmmWJz.d.mts.map +0 -1
- package/dist/index-OSfUuVIi.d.mts.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as GitPluginSource, d as PluginEntry, m as PluginSource, n as DomainManifest, u as PluginCatalogEntry } from "./domains-DBNTBmuc.mjs";
|
|
2
|
-
import "./index-
|
|
3
|
-
import { t as readPoConfigSourcesAsync } from "./index-
|
|
2
|
+
import "./index-C7Gw9FE_.mjs";
|
|
3
|
+
import { t as readPoConfigSourcesAsync } from "./index-HwdX1mGP.mjs";
|
|
4
4
|
import { FileSystem } from "@agimon-ai/po-core/platform";
|
|
5
5
|
//#region src/services/pluginCatalog/parse.d.ts
|
|
6
6
|
declare const MARKETPLACE_MANIFEST_RELATIVE_PATHS: readonly ['.agents/plugins/marketplace.json', '.agents/plugins/api_marketplace.json', '.claude-plugin/marketplace.json', '.cursor-plugin/marketplace.json'];
|
|
@@ -99,4 +99,4 @@ declare function domainCompletionItems(domainNames: string[], query: string): Ar
|
|
|
99
99
|
}>;
|
|
100
100
|
//#endregion
|
|
101
101
|
export { isRemotePluginSource as C, marketplaceSnapshotPath as D, marketplaceSnapshotEntries as E, pluginDirectoryForSource as O, MARKETPLACE_MANIFEST_RELATIVE_PATHS as S, marketplaceInstalledPath as T, defaultDomainsForPreset as _, loadDomainsAsync as a, findPluginManifestPathAsync as b, resolvePluginEntriesAsync as c, loadDomains as d, resolvePluginDirectories as f, PO_DOMAINS_ENV as g, DEFAULT_DOMAIN as h, listDomainNamesAsync as i, resolveSharedSkillsAsync as l, resolveSharedSkills as m, domainCompletionPrefix as n, resolveManifestPluginEntriesAsync as o, resolvePluginEntries as p, expandDomainNames as r, resolvePluginDirectoriesAsync as s, domainCompletionItems as t, listDomainNames as u, domainNamesOf as v, marketplaceInstalledEntries as w, findPluginManifestPath as x, sharedSkillsFor as y };
|
|
102
|
-
//# sourceMappingURL=completion-
|
|
102
|
+
//# sourceMappingURL=completion-BrN-LdQ6.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"completion-
|
|
1
|
+
{"version":3,"file":"completion-BrN-LdQ6.d.mts","names":[],"sources":["../src/services/pluginCatalog/parse.ts","../src/services/pluginCatalog/sync.ts","../src/services/pluginCatalog/index.ts","../src/services/domains/core.ts","../src/services/domains/sync.ts","../src/services/domains/index.ts","../src/services/domains/completion.ts"],"mappings":";;;;;cAmBa;iBAkXG,yBAAyB,QAAQ,cAAc;;iBAiB/C,wBACd,uBACA,aAAa,SAAS,qCACtB;;iBAQc,2BAA2B,cAAc,iBAAiB,eAAe;iBAwCzE,qBACd,QAAQ,eACP,UAAU,kBAAkB,QAAQ;EAAgB;;;iBAKvC,yBACd,uBACA,aAAa,SAAS,qCACtB,gBACA;;iBAac,4BAA4B,cAAc,iBAAiB,eAAe;;;;;;;iBChb1E,uBAAuB;;;KCtBlC,UAAU,WAAW;;iBA8DJ,4BACpB,IAAI,YACJ,oBACA,SAAS,UACR;;;iBCoGa,cAAc,UAAU;;;;;;;iBAUxB,gBAAgB,UAAU,gBAAgB;cA8F7C;cACA;;;;;;;;iBAiBG,wBACd,gBACA,aAAa,OAAO,YACpB;;;;;;;;iBCvSc,YAAY,kBAAkB,yBAAmD;;iBAMjF,gBAAgB,kBAAkB;;iBAKlC,oBAAoB,kBAAkB,uBAAuB;;iBAK7D,qBACd,kBACA,uBACA,+BACA,yBACC;;iBAkBa,yBACd,kBACA,uBACA,+BACA;;;KCnDG,YAAY,WAAW;;;;;;;;iBAkCN,iBACpB,IAAI,YACJ,kBACA,SAAS,WACT,wBACA,cAAc,kBAAkB,+BAC/B,QAAQ;iBAqBW,qBACpB,IAAI,YACJ,kBACA,SAAS,WACT,wBACA,cAAc,kBAAkB,+BAC/B;;;;;;;iBAUmB,yBACpB,IAAI,YACJ,kBACA,uBACA,SAAS,WACT,wBACA,cAAc,kBAAkB,+BAC/B;;iBAKmB,0BACpB,IAAI,YACJ,kBACA,uBACA,+BACA,SAAS,WACT,wBACA,cAAc,kBAAkB,+BAC/B,QAAQ;;iBAMW,kCACpB,IAAI,YACJ,UAAU,gBACV,uBACA,+BACA,SAAS,WACT,wBACC,QAAQ;iBAgBW,8BACpB,IAAI,YACJ,kBACA,uBACA,+BACA,SAAS,WACT,yBACC;;;;iBC/Ia,kBAAkB,UAAU,gBAAgB;iBAW5C,uBAAuB;iBAKvB,sBAAsB,uBAAuB,gBAAgB;EAAQ;EAAe"}
|
|
@@ -42,10 +42,18 @@ interface PlanningAgentConfig {
|
|
|
42
42
|
model?: string;
|
|
43
43
|
thinking?: PlanningThinkingLevel;
|
|
44
44
|
}
|
|
45
|
+
/** A plan mode the person defined: its brief is added to the Plan prompt while it is selected. */
|
|
46
|
+
interface PlanningModeDefinition {
|
|
47
|
+
label: string;
|
|
48
|
+
description?: string;
|
|
49
|
+
brief: string;
|
|
50
|
+
}
|
|
45
51
|
interface PlanningModeConfig {
|
|
46
52
|
main?: PlanningAgentConfig;
|
|
47
53
|
subagents?: PlanningAgentConfig;
|
|
48
54
|
plansDirectory?: string;
|
|
55
|
+
/** Custom plan modes by id. A workspace entry replaces the host entry with the same id. */
|
|
56
|
+
modes?: Record<string, PlanningModeDefinition>;
|
|
49
57
|
}
|
|
50
58
|
/**
|
|
51
59
|
* Ratios of the context window at which each autocompact pass fires.
|
|
@@ -105,6 +113,24 @@ interface CanvasConfig {
|
|
|
105
113
|
/** Where New canvas saves boards: a workspace-relative folder or `artifact:<folder>`. Unset saves to `artifact:canvas`. */
|
|
106
114
|
directory?: string;
|
|
107
115
|
}
|
|
116
|
+
interface WorkflowsConfig {
|
|
117
|
+
recovery?: {
|
|
118
|
+
/**
|
|
119
|
+
* True makes a recovery refuse an edited workflow that adds jobs before its restart point. Unset or false lets
|
|
120
|
+
* it adopt such an edit, for workflows still being written. The restart job must still exist either way.
|
|
121
|
+
*/
|
|
122
|
+
checkEdits?: boolean;
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
interface NotificationsConfig {
|
|
126
|
+
/**
|
|
127
|
+
* True runs one model check when a session settles with no background work, telling a finished
|
|
128
|
+
* session from one waiting on a question. Unset or false keeps the plain finished notice.
|
|
129
|
+
*/
|
|
130
|
+
idleCheck?: boolean;
|
|
131
|
+
/** `provider/model-id` that runs the idle check. Unset, or unavailable, uses the session model. */
|
|
132
|
+
idleCheckModel?: string;
|
|
133
|
+
}
|
|
108
134
|
interface SubagentsConfig {
|
|
109
135
|
model?: string;
|
|
110
136
|
thinking?: PlanningThinkingLevel;
|
|
@@ -304,6 +330,10 @@ interface PoConfig {
|
|
|
304
330
|
artifacts?: ArtifactsConfig;
|
|
305
331
|
/** Repository value wins over personal. */
|
|
306
332
|
canvas?: CanvasConfig;
|
|
333
|
+
/** Host and repository; the repository value wins. */
|
|
334
|
+
workflows?: WorkflowsConfig;
|
|
335
|
+
/** Host and repository; the repository value wins. */
|
|
336
|
+
notifications?: NotificationsConfig;
|
|
307
337
|
projectTrust: ProjectTrust;
|
|
308
338
|
editor?: EditorConfig;
|
|
309
339
|
browse?: BrowseConfig;
|
|
@@ -450,5 +480,5 @@ interface LenientParseResult {
|
|
|
450
480
|
diagnostics: ConfigDiagnostic[];
|
|
451
481
|
}
|
|
452
482
|
//#endregion
|
|
453
|
-
export {
|
|
454
|
-
//# sourceMappingURL=config-
|
|
483
|
+
export { PoHarnessContext as A, VoiceModelConfig as B, PoConfigLayer as C, PoConfigTransitionPhase as D, PoConfigSelection as E, VoiceAdapterConfig as F, PersonaFrontMatter as G, VoiceTtsEngine as H, VoiceAutoCaptureConfig as I, PersonaIdentity as K, VoiceConfig as L, ProjectTrust as M, ResolvedVoiceAutoCaptureConfig as N, PoConfigTransitionRecord as O, ResolvedVoiceConfig as P, VoiceEngine as R, PoConfigContext as S, PoConfigPendingSelection as T, WorkspaceDeclaration as U, VoiceTtsConfig as V, PersonaDocument as W, PlanningAgentConfig as _, ConfigDiagnostic as a, PlanningThinkingLevel as b, DesktopEnvironmentConfig as c, IPoConfigLoader as d, IPoConfigService$1 as f, PackageAttribution$1 as g, PO_CONFIG_SERVICE as h, AutocompactTokenConfig as i, PoSelectionConfig as j, PoConfigTransitionStrategy as k, EditorConfig as l, LenientParseResult as m, AutocompactOverrideConfig as n, ConfigValueOrigin as o, LenientParseOptions as p, PersonaVoiceOverride as q, AutocompactThresholdConfig as r, DeepReadonly as s, AutocompactModeConfig as t, HarnessState as u, PlanningModeConfig as v, PoConfigLayers as w, PoConfig as x, PlanningModeDefinition as y, VoiceMode as z };
|
|
484
|
+
//# sourceMappingURL=config-CG_KJdcd.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-CG_KJdcd.d.mts","names":["IPoConfigService","PoConfigServiceContract"],"sources":["../src/types/profiles.ts","../src/types/config.ts"],"mappings":";;;;UAAiB;EACf;EACA;;EAEA;;EAEA;;UAGe;;EAEf;;EAEA;;UAGe;;EAEf;;EAEA;;EAEA;;EAEA,QAAQ;;UAGO;EACf,cAAc;;EAEd;;;;KCvBU;KACA;KACA;KACA;KACA;UAEK;EACf;EACA,WAAW;;;UAGI;EACf;EACA;EACA;;UAEe;EACf,OAAO;EACP,YAAY;EACZ;;EAEA,QAAQ,eAAe;;;;;;;;;UASR;EACf;EACA;EACA;;;;;;;;;UASe;EACf;EACA;EACA;;;;;;;;;UASe;EACf;EACA,QAAQ;;UAEO;EACf;EACA;EACA,WAAW;EACX,aAAa;EACb,YAAY;;;UAGG;EACf;;;;;;UAMe;;EAEf;;UAEe;;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D;IAAW;;;EAEX;IAAW;;;UAMI;EACf;;EAEA;EACA;EACA;;EAEA;;;;;;;;;;;EAWA,qBAAqB,eAAe;;EAEpC;EACA;EACA,oBAAoB;EACpB;EACA;EACA;EACA;EACA;;EAEA,gBAAgB;EAChB;EACA;;;;;;EAMA,kBAAkB;;EAElB,eAAe;EACf;EACA;EACA;;KAGU,aAAa,UAAU,oBAAmB,6BAClD,SACA,+BAA+B,oBACpB,aAAa,WACtB,oCACc,cAAc,SAAS,aAAa,OAAO,YACvD;KAEI,mBAAmB,aAAa;UAE3B;WACN,UAAU,aAAa;WACvB,SAAS;;WAET,mBAAmB,aAAa;;WAEhC;;;UAIM;EACf,KAAK,kBAAkB,yBAAyB;;;UAIjCA,2BAAyBC,iBAAwB,iBAAiB;;YAGvE;IACR,aAAaD;;;;KAQL;;UAGK;EACf;EACA;;;;;;EAMA;;EAEA;;;;;;;;;;UAWe;;EAEf,YAAY;EACZ,gBAAgB;EAChB,WAAW;;EAEX,SAAS,6BAA6B;;EAEtC,QAAQ;;;;;;;;;UAUO;EACf;;EAEA;EACA;;;UAIe;EACf;;;UAIe;EACf,QAAQ;EACR,aAAa"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-VH7oDXx4.cjs");
|
|
2
|
-
const
|
|
3
|
-
const require_core = require("./core-B8x1gjyx.cjs");
|
|
2
|
+
const require_core = require("./core-0zEBs0G5.cjs");
|
|
4
3
|
let node_path = require("node:path");
|
|
5
4
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
6
5
|
let _agimon_ai_po_core_platform = require("@agimon-ai/po-core/platform");
|
|
@@ -108,7 +107,7 @@ async function readWorkspaceDeclarations({ fs, repositoryRoot, context }) {
|
|
|
108
107
|
"instructions",
|
|
109
108
|
"metadata"
|
|
110
109
|
].includes(key))) throw new Error(`Workspace declarations at ${filePath} require ${location} to contain only name, path, alias, instructions, metadata`);
|
|
111
|
-
const base =
|
|
110
|
+
const base = require_core.parsePoConfig(JSON.stringify({ workspaces: [{
|
|
112
111
|
name: entry.name,
|
|
113
112
|
instructions: entry.instructions
|
|
114
113
|
}] }), filePath).workspaces[0];
|
|
@@ -128,7 +127,7 @@ async function readWorkspaceDeclarations({ fs, repositoryRoot, context }) {
|
|
|
128
127
|
...entry.metadata === void 0 ? {} : { metadata: entry.metadata }
|
|
129
128
|
};
|
|
130
129
|
});
|
|
131
|
-
|
|
130
|
+
require_core.parsePoConfig(JSON.stringify({ workspaces: declarations.map(({ name, instructions }) => ({
|
|
132
131
|
name,
|
|
133
132
|
instructions
|
|
134
133
|
})) }), filePath);
|
|
@@ -289,4 +288,4 @@ Object.defineProperty(exports, "refreshGlobalSettingsCache", {
|
|
|
289
288
|
}
|
|
290
289
|
});
|
|
291
290
|
|
|
292
|
-
//# sourceMappingURL=config-
|
|
291
|
+
//# sourceMappingURL=config-DNicyP1o.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-DB7YUo6N.cjs","names":["fs","readText","nodeHost","globalPoConfigPath","repositoryConfigFor","mergeConfigLayers","configFromText","withGlobalLayer","globalSettingsCachePath","globalSettingsMember","globalSettingsOwnerPath","defaultPoConfig","mergeLenientLayers","lenientConfigFromText","composeConfigLayers","layerFromText","absentRepositoryLayer","path","readTextIfExists","configFromText","parseYaml","parsePoConfig","nodeHost","globalPoConfigPath","marketplaceOrigin","repositoryConfigFor","globalSettingsCachePath","globalSettingsMember","globalSettingsOwnerPath","withGlobalLayer","defaultPoConfig","mergeConfigLayers","GLOBAL_SETTINGS_READ_OPERATION","globalSettingsRecords","isGlobalSettingsBinding","sameGlobalSettingsBinding","writeFileAtomic","lenientConfigFromText","mergeLenientLayers","layerFromText","absentRepositoryLayer","composeConfigLayers"],"sources":["../src/services/config/sync.ts","../src/services/config/index.ts"],"sourcesContent":["// sync: readTextSync supports exported Node-only synchronous config readers retained for phase 2.\nimport fs from 'node:fs';\n\nimport { nodeHost } from '@agimon-ai/po-core/platform';\n\nimport type { PoConfig, PoConfigLayers, LenientParseResult } from '../../types/config';\nimport {\n absentRepositoryLayer,\n composeConfigLayers,\n configFromText,\n defaultPoConfig,\n globalPoConfigPath,\n globalSettingsCachePath,\n globalSettingsMember,\n globalSettingsOwnerPath,\n layerFromText,\n lenientConfigFromText,\n mergeConfigLayers,\n mergeLenientLayers,\n repositoryConfigFor,\n withGlobalLayer,\n} from './core';\n\nfunction readTextSync(filePath: string | undefined): string | undefined {\n if (filePath === undefined) return undefined;\n try {\n return fs.readFileSync(filePath, 'utf8');\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') return undefined;\n throw error;\n }\n}\n\nasync function readText(filePath: string): Promise<string | undefined> {\n try {\n return await fs.promises.readFile(filePath, 'utf8');\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') return undefined;\n throw error;\n }\n}\n\n/** @deprecated Node-only sync shim; use readPoConfig. Removed in M2. Applies the global layer as readPoConfig does. */\nexport function loadPoConfig(\n repoRoot: string,\n homeDirectory = nodeHost.homeDirectory(),\n environment: NodeJS.ProcessEnv = process.env,\n): PoConfig {\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n return mergeConfigLayers(\n configFromText(\n withGlobalLayer(\n readTextSync(globalSettingsCachePath(homeDirectory, environment)),\n readTextSync(globalPath),\n globalSettingsMember(environment, readTextSync(globalSettingsOwnerPath(homeDirectory, environment))),\n ),\n globalPath,\n ),\n repositoryPath === undefined ? defaultPoConfig() : configFromText(readTextSync(repositoryPath), repositoryPath),\n environment,\n );\n}\n\n/**\n * Loads the merged config, tolerating unknown keys in either file.\n *\n * Only `po sync` uses this. Everything that runs during a session keeps\n * `loadPoConfig`, because a key a running extension cannot understand is\n * better reported than silently ignored; a build that refuses to start over\n * the same key is not.\n *\n * @deprecated Node-only sync shim; use readPoConfigLenient. Removed in M2.\n */\nexport function loadPoConfigLenient(\n repoRoot: string,\n homeDirectory = nodeHost.homeDirectory(),\n environment: NodeJS.ProcessEnv = process.env,\n): LenientParseResult {\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n return mergeLenientLayers(\n lenientConfigFromText(readTextSync(globalPath), globalPath),\n lenientConfigFromText(readTextSync(repositoryPath), repositoryPath ?? ''),\n environment,\n );\n}\n\n/** @deprecated Node-only shim over node:fs; use readPoConfig. Removed in M2. */\nexport async function loadPoConfigAsync(\n repoRoot: string,\n homeDirectory = nodeHost.homeDirectory(),\n environment: NodeJS.ProcessEnv = process.env,\n): Promise<PoConfig> {\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n const globalConfig = configFromText(\n withGlobalLayer(\n await readText(globalSettingsCachePath(homeDirectory, environment)),\n await readText(globalPath),\n globalSettingsMember(environment, await readText(globalSettingsOwnerPath(homeDirectory, environment))),\n ),\n globalPath,\n );\n const repositoryConfig =\n repositoryPath === undefined ? defaultPoConfig() : configFromText(await readText(repositoryPath), repositoryPath);\n return mergeConfigLayers(globalConfig, repositoryConfig, environment);\n}\n\n/** @deprecated Node-only sync shim; use readPoConfigLayers. Removed in M2. */\nexport function loadPoConfigLayers(\n repoRoot: string | undefined,\n homeDirectory = nodeHost.homeDirectory(),\n environment: NodeJS.ProcessEnv = process.env,\n): PoConfigLayers {\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repoRoot === undefined ? undefined : repositoryConfigFor(repoRoot, homeDirectory, environment);\n const globalText = readTextSync(globalPath);\n const repositoryText = readTextSync(repositoryPath);\n const repositoryConfig =\n repositoryPath === undefined ? defaultPoConfig() : configFromText(repositoryText, repositoryPath);\n return composeConfigLayers(\n layerFromText(globalPath, globalText),\n repositoryPath === undefined ? absentRepositoryLayer() : layerFromText(repositoryPath, repositoryText),\n mergeConfigLayers(configFromText(globalText, globalPath), repositoryConfig, environment),\n );\n}\n","import path from 'node:path';\n\nimport { GLOBAL_SETTINGS_READ_OPERATION } from '@agimon-ai/po-core';\nimport { nodeHost, readTextIfExists, writeFileAtomic, type FileSystem } from '@agimon-ai/po-core/platform';\nimport { marketplaceOrigin } from '@agimon-ai/po-core/verifiedArchive';\nimport { parse as parseYaml } from 'yaml';\n\nimport type { PoConfig, PoConfigLayers, LenientParseResult, WorkspaceDeclaration } from '../../types/config';\nimport { parsePoConfig } from '../configPolicy';\nimport {\n absentRepositoryLayer,\n composeConfigLayers,\n configFromText,\n defaultPoConfig,\n globalPoConfigPath,\n globalSettingsCachePath,\n globalSettingsMember,\n isGlobalSettingsBinding,\n globalSettingsOwnerPath,\n layerFromText,\n lenientConfigFromText,\n mergeConfigLayers,\n mergeLenientLayers,\n repositoryConfigFor,\n sameGlobalSettingsBinding,\n globalSettingsRecords,\n withGlobalLayer,\n type ConfigEnvironment,\n type GlobalSettingsRecord,\n} from './core';\n\ntype IoContext = Parameters<FileSystem['readTextFile']>[1];\n\nexport interface ReadWorkspaceDeclarationsOptions {\n fs: FileSystem;\n repositoryRoot: string;\n context: IoContext;\n}\n\nexport interface WorkspaceDeclarationsResult {\n declarations: WorkspaceDeclaration[];\n source: 'workspaces.yaml' | 'config.yaml' | undefined;\n notices: string[];\n}\n\nconst object = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' &&\n value !== null &&\n (Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null);\n\nfunction jsonValue(value: unknown, seen = new Set<object>()): boolean {\n if (value === null || typeof value === 'string' || typeof value === 'boolean') return true;\n if (typeof value === 'number') return Number.isFinite(value);\n if (typeof value !== 'object' || (!Array.isArray(value) && !object(value)) || seen.has(value)) return false;\n seen.add(value);\n const valid = (Array.isArray(value) ? value : Object.values(value)).every((entry) => jsonValue(entry, seen));\n seen.delete(value);\n return valid;\n}\n\n/** Repository-only declarations. An existing new document is authoritative, even when empty. */\nexport async function readWorkspaceDeclarations({\n fs,\n repositoryRoot,\n context,\n}: ReadWorkspaceDeclarationsOptions): Promise<WorkspaceDeclarationsResult> {\n const filePath = path.join(repositoryRoot, '.po', 'workspaces.yaml');\n const text = await readTextIfExists(fs, filePath, context);\n if (text === undefined) {\n const legacyPath = path.join(repositoryRoot, '.po', 'config.yaml');\n const legacy = await readTextIfExists(fs, legacyPath, context);\n const declarations = legacy === undefined ? undefined : configFromText(legacy, legacyPath).workspaces;\n return {\n declarations: declarations ?? [],\n source: declarations === undefined ? undefined : 'config.yaml',\n notices:\n declarations === undefined\n ? []\n : [`Move workspaces from ${legacyPath} to ${filePath}; config.yaml workspaces is deprecated.`],\n };\n }\n let document: unknown;\n try {\n document = parseYaml(text);\n } catch (error) {\n throw new Error(`Could not parse workspace declarations at ${filePath}`, { cause: error });\n }\n if (\n !object(document) ||\n Object.keys(document).some((key) => key !== 'workspaces') ||\n !Array.isArray(document.workspaces)\n )\n throw new Error(`Workspace declarations at ${filePath} must be an object containing a workspaces list`);\n const aliases = new Set<string>();\n const declarations = document.workspaces.map((entry: unknown, index): WorkspaceDeclaration => {\n const location = `workspaces[${String(index)}]`;\n if (\n !object(entry) ||\n Object.keys(entry).some((key) => !['name', 'path', 'alias', 'instructions', 'metadata'].includes(key))\n )\n throw new Error(\n `Workspace declarations at ${filePath} require ${location} to contain only name, path, alias, instructions, metadata`,\n );\n // Reuse the established declaration name/instructions parser, without changing the legacy config contract.\n const base = parsePoConfig(\n JSON.stringify({ workspaces: [{ name: entry.name, instructions: entry.instructions }] }),\n filePath,\n ).workspaces![0]!;\n if (base.name.length > 80 || !/^[A-Za-z0-9][A-Za-z0-9 ._-]*$/u.test(base.name) || base.name.includes('..'))\n throw new Error(\n `Workspace declarations at ${filePath} require ${location}.name to use letters, numbers, spaces, dots, dashes, or underscores (up to 80 characters)`,\n );\n if (\n entry.path !== undefined &&\n (typeof entry.path !== 'string' || entry.path.trim() === '' || entry.path.includes('\\0'))\n )\n throw new Error(`Workspace declarations at ${filePath} require ${location}.path to be a non-empty path`);\n if (entry.alias !== undefined && (typeof entry.alias !== 'string' || entry.alias.trim() === ''))\n throw new Error(`Workspace declarations at ${filePath} require ${location}.alias to be a non-empty string`);\n const alias = typeof entry.alias === 'string' ? entry.alias.trim() : undefined;\n if (alias !== undefined) {\n if (aliases.has(alias)) throw new Error(`Workspace declarations at ${filePath} have duplicate alias: ${alias}`);\n aliases.add(alias);\n }\n if (entry.metadata !== undefined && (!object(entry.metadata) || !jsonValue(entry.metadata)))\n throw new Error(`Workspace declarations at ${filePath} require ${location}.metadata to be a JSON object`);\n return {\n ...base,\n ...(entry.path === undefined ? {} : { path: entry.path as string }),\n ...(alias === undefined ? {} : { alias }),\n ...(entry.metadata === undefined ? {} : { metadata: entry.metadata as Record<string, unknown> }),\n };\n });\n // Retain the legacy parser's case-insensitive duplicate-name rule across the entire document.\n parsePoConfig(\n JSON.stringify({ workspaces: declarations.map(({ name, instructions }) => ({ name, instructions })) }),\n filePath,\n );\n return { declarations, source: 'workspaces.yaml', notices: [] };\n}\n\nexport interface ReadPoConfigOptions {\n /** Defaults to the host's home directory. */\n readonly homeDirectory?: string;\n /** Admitted environment for locating Po home and member overrides. Defaults to empty. */\n readonly environment?: ConfigEnvironment;\n}\n\nfunction resolved(options: ReadPoConfigOptions): { homeDirectory: string; environment: ConfigEnvironment } {\n return {\n homeDirectory: options.homeDirectory ?? nodeHost.homeDirectory(),\n environment: options.environment ?? {},\n };\n}\n\n/** Reads only the machine owner's config, never repository or org-member preferences. */\nexport async function readHostMarketplaceOrigin(\n fs: FileSystem,\n homeDirectory: string,\n environment: ConfigEnvironment,\n context: IoContext,\n): Promise<string> {\n const file = globalPoConfigPath(homeDirectory, environment);\n const config = configFromText(await readTextIfExists(fs, file, context), file);\n return marketplaceOrigin(config.marketplace?.url);\n}\n\nconst readText = (fs: FileSystem, filePath: string | undefined, context: IoContext) =>\n filePath === undefined ? Promise.resolve(undefined) : readTextIfExists(fs, filePath, context);\n\n/**\n * Loads the merged global and repository config over a FileSystem. A missing\n * file contributes the defaults, so a host with neither file, such as a fresh\n * Durable Object filesystem, reads the same config as an empty Node home.\n * One person's cached global settings sit beneath the host file, portable keys only: the session starter's\n * when the environment names one, else the host owner's.\n */\nexport async function readPoConfig(\n fs: FileSystem,\n repoRoot: string,\n context: IoContext,\n options: ReadPoConfigOptions = {},\n): Promise<PoConfig> {\n const { homeDirectory, environment } = resolved(options);\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n const hostText = await readText(fs, globalPath, context);\n const cacheText = await readText(fs, globalSettingsCachePath(homeDirectory, environment), context);\n const member = globalSettingsMember(\n environment,\n await readText(fs, globalSettingsOwnerPath(homeDirectory, environment), context),\n );\n const globalConfig = configFromText(withGlobalLayer(cacheText, hostText, member), globalPath);\n const repositoryConfig =\n repositoryPath === undefined\n ? defaultPoConfig()\n : configFromText(await readText(fs, repositoryPath, context), repositoryPath);\n return mergeConfigLayers(globalConfig, repositoryConfig, environment);\n}\n\n/**\n * Refreshes the global settings cache from what the host's federation answers: one entry for each person\n * whose grant it holds. `ok` replaces that person's copy and `removed` (they left the team, or took the\n * grant back) drops it, as does having no entry at all. Any other refusal keeps their last copy, and no\n * answer, such as no network, keeps the whole cache.\n */\nexport async function refreshGlobalSettingsCache(\n fs: FileSystem,\n accountCall: (operation: string, input: unknown) => Promise<unknown>,\n context: IoContext,\n options: Required<ReadPoConfigOptions>,\n): Promise<'written' | 'removed' | 'kept'> {\n const answers = await accountCall(GLOBAL_SETTINGS_READ_OPERATION, {}).catch(() => undefined);\n if (!Array.isArray(answers)) return 'kept';\n const cachePath = globalSettingsCachePath(options.homeDirectory, options.environment);\n const before = globalSettingsRecords(await readText(fs, cachePath, context));\n const after: GlobalSettingsRecord[] = [];\n for (const answer of answers as ({ ok?: unknown; yaml?: unknown; code?: unknown; binding?: unknown } | null)[]) {\n const binding = answer?.binding;\n // An answer that names nobody is about nobody, so it is never written.\n if (!answer || !isGlobalSettingsBinding(binding)) continue;\n const last = before.find((record) => sameGlobalSettingsBinding(record.binding, binding));\n if (answer.ok === true && typeof answer.yaml === 'string') after.push({ binding, yaml: answer.yaml });\n else if (answer.code !== 'removed' && last) after.push(last);\n }\n if (JSON.stringify(after) === JSON.stringify(before)) return 'kept';\n if (after.length) {\n await writeFileAtomic(fs, cachePath, JSON.stringify({ members: after }), context);\n return 'written';\n }\n const removed = await fs.remove(cachePath, { force: true }, context);\n if (!removed.ok) throw new Error(`Could not remove ${cachePath}`, { cause: removed.error });\n return 'removed';\n}\n\n/** As `readPoConfig`, tolerating unknown keys in either file and reporting them. */\nexport async function readPoConfigLenient(\n fs: FileSystem,\n repoRoot: string,\n context: IoContext,\n options: ReadPoConfigOptions = {},\n): Promise<LenientParseResult> {\n const { homeDirectory, environment } = resolved(options);\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n const globalConfig = lenientConfigFromText(await readText(fs, globalPath, context), globalPath);\n const repositoryConfig =\n repositoryPath === undefined\n ? lenientConfigFromText(undefined, '')\n : lenientConfigFromText(await readText(fs, repositoryPath, context), repositoryPath);\n return mergeLenientLayers(globalConfig, repositoryConfig, environment);\n}\n\n/**\n * The two config files kept apart, with the merge alongside them.\n *\n * `repoRoot` is optional because the global file is complete on its own: a\n * settings surface with no repository in view still has settings to show.\n */\nexport async function readPoConfigLayers(\n fs: FileSystem,\n repoRoot: string | undefined,\n context: IoContext,\n options: ReadPoConfigOptions = {},\n): Promise<PoConfigLayers> {\n const { homeDirectory, environment } = resolved(options);\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repoRoot === undefined ? undefined : repositoryConfigFor(repoRoot, homeDirectory, environment);\n const globalText = await readText(fs, globalPath, context);\n const repositoryText = await readText(fs, repositoryPath, context);\n const globalLayer = layerFromText(globalPath, globalText);\n const repositoryLayer =\n repositoryPath === undefined ? absentRepositoryLayer() : layerFromText(repositoryPath, repositoryText);\n const repositoryConfig =\n repositoryPath === undefined ? defaultPoConfig() : configFromText(repositoryText, repositoryPath);\n const effective = mergeConfigLayers(configFromText(globalText, globalPath), repositoryConfig, environment);\n return composeConfigLayers(globalLayer, repositoryLayer, effective);\n}\n\nexport {\n globalPoConfigDirectory,\n globalPoConfigPath,\n globalSettingsCachePath,\n globalSettingsPeople,\n isGlobalPoConfigRoot,\n SESSION_MEMBER_ENVIRONMENT,\n repositoryPoConfigPath,\n resolvePlanningPlansDirectory,\n} from './core';\nexport type { ConfigEnvironment, GlobalSettingsPerson } from './core';\nexport { loadPoConfig, loadPoConfigAsync, loadPoConfigLayers, loadPoConfigLenient } from './sync';\n"],"mappings":";;;;;;;;;;;;AAuBA,SAAS,aAAa,UAAkD;CACtE,IAAI,aAAa,KAAA,GAAW,OAAO,KAAA;CACnC,IAAI;EACF,OAAOA,QAAAA,QAAG,aAAa,UAAU,MAAM;CACzC,SAAS,OAAO;EACd,IAAK,MAAgC,SAAS,UAAU,OAAO,KAAA;EAC/D,MAAM;CACR;AACF;AAEA,eAAeC,WAAS,UAA+C;CACrE,IAAI;EACF,OAAO,MAAMD,QAAAA,QAAG,SAAS,SAAS,UAAU,MAAM;CACpD,SAAS,OAAO;EACd,IAAK,MAAgC,SAAS,UAAU,OAAO,KAAA;EAC/D,MAAM;CACR;AACF;;AAGA,SAAgB,aACd,UACA,gBAAgBE,4BAAAA,SAAS,cAAc,GACvC,cAAiC,QAAQ,KAC/B;CACV,MAAM,aAAaC,aAAAA,mBAAmB,eAAe,WAAW;CAChE,MAAM,iBAAiBC,aAAAA,oBAAoB,UAAU,eAAe,WAAW;CAC/E,OAAOC,aAAAA,kBACLC,aAAAA,eACEC,aAAAA,gBACE,aAAaC,aAAAA,wBAAwB,eAAe,WAAW,CAAC,GAChE,aAAa,UAAU,GACvBC,aAAAA,qBAAqB,aAAa,aAAaC,aAAAA,wBAAwB,eAAe,WAAW,CAAC,CAAC,CACrG,GACA,UACF,GACA,mBAAmB,KAA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aAAAA,sBAAsB,MAAM,SAAS,IAAI,YAAY,OAAO,GAAG,UAAU;CAC9F,MAAM,mBACJ,mBAAmB,KAAA,IACfA,aAAAA,sBAAsB,KAAA,GAAW,EAAE,IACnCA,aAAAA,sBAAsB,MAAM,SAAS,IAAI,gBAAgB,OAAO,GAAG,cAAc;CACvF,OAAOC,aAAAA,mBAAmB,cAAc,kBAAkB,WAAW;AACvE;;;;;;;AAQA,eAAsB,mBACpB,IACA,UACA,SACA,UAA+B,CAAC,GACP;CACzB,MAAM,EAAE,eAAe,gBAAgB,SAAS,OAAO;CACvD,MAAM,aAAaf,aAAAA,mBAAmB,eAAe,WAAW;CAChE,MAAM,iBAAiB,aAAa,KAAA,IAAY,KAAA,IAAYE,aAAAA,oBAAoB,UAAU,eAAe,WAAW;CACpH,MAAM,aAAa,MAAM,SAAS,IAAI,YAAY,OAAO;CACzD,MAAM,iBAAiB,MAAM,SAAS,IAAI,gBAAgB,OAAO;CACjE,MAAM,cAAcc,aAAAA,cAAc,YAAY,UAAU;CACxD,MAAM,kBACJ,mBAAmB,KAAA,IAAYC,aAAAA,sBAAsB,IAAID,aAAAA,cAAc,gBAAgB,cAAc;CACvG,MAAM,mBACJ,mBAAmB,KAAA,IAAYT,aAAAA,gBAAgB,IAAIX,aAAAA,eAAe,gBAAgB,cAAc;CAClG,MAAM,YAAYY,aAAAA,kBAAkBZ,aAAAA,eAAe,YAAY,UAAU,GAAG,kBAAkB,WAAW;CACzG,OAAOsB,aAAAA,oBAAoB,aAAa,iBAAiB,SAAS;AACpE"}
|
|
1
|
+
{"version":3,"file":"config-DNicyP1o.cjs","names":["fs","readText","nodeHost","globalPoConfigPath","repositoryConfigFor","mergeConfigLayers","configFromText","withGlobalLayer","globalSettingsCachePath","globalSettingsMember","globalSettingsOwnerPath","defaultPoConfig","mergeLenientLayers","lenientConfigFromText","composeConfigLayers","layerFromText","absentRepositoryLayer","path","readTextIfExists","configFromText","parseYaml","parsePoConfig","nodeHost","globalPoConfigPath","marketplaceOrigin","repositoryConfigFor","globalSettingsCachePath","globalSettingsMember","globalSettingsOwnerPath","withGlobalLayer","defaultPoConfig","mergeConfigLayers","GLOBAL_SETTINGS_READ_OPERATION","globalSettingsRecords","isGlobalSettingsBinding","sameGlobalSettingsBinding","writeFileAtomic","lenientConfigFromText","mergeLenientLayers","layerFromText","absentRepositoryLayer","composeConfigLayers"],"sources":["../src/services/config/sync.ts","../src/services/config/index.ts"],"sourcesContent":["// sync: readTextSync supports exported Node-only synchronous config readers retained for phase 2.\nimport fs from 'node:fs';\n\nimport { nodeHost } from '@agimon-ai/po-core/platform';\n\nimport type { PoConfig, PoConfigLayers, LenientParseResult } from '../../types/config';\nimport {\n absentRepositoryLayer,\n composeConfigLayers,\n configFromText,\n defaultPoConfig,\n globalPoConfigPath,\n globalSettingsCachePath,\n globalSettingsMember,\n globalSettingsOwnerPath,\n layerFromText,\n lenientConfigFromText,\n mergeConfigLayers,\n mergeLenientLayers,\n repositoryConfigFor,\n withGlobalLayer,\n} from './core';\n\nfunction readTextSync(filePath: string | undefined): string | undefined {\n if (filePath === undefined) return undefined;\n try {\n return fs.readFileSync(filePath, 'utf8');\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') return undefined;\n throw error;\n }\n}\n\nasync function readText(filePath: string): Promise<string | undefined> {\n try {\n return await fs.promises.readFile(filePath, 'utf8');\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') return undefined;\n throw error;\n }\n}\n\n/** @deprecated Node-only sync shim; use readPoConfig. Removed in M2. Applies the global layer as readPoConfig does. */\nexport function loadPoConfig(\n repoRoot: string,\n homeDirectory = nodeHost.homeDirectory(),\n environment: NodeJS.ProcessEnv = process.env,\n): PoConfig {\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n return mergeConfigLayers(\n configFromText(\n withGlobalLayer(\n readTextSync(globalSettingsCachePath(homeDirectory, environment)),\n readTextSync(globalPath),\n globalSettingsMember(environment, readTextSync(globalSettingsOwnerPath(homeDirectory, environment))),\n ),\n globalPath,\n ),\n repositoryPath === undefined ? defaultPoConfig() : configFromText(readTextSync(repositoryPath), repositoryPath),\n environment,\n );\n}\n\n/**\n * Loads the merged config, tolerating unknown keys in either file.\n *\n * Only `po sync` uses this. Everything that runs during a session keeps\n * `loadPoConfig`, because a key a running extension cannot understand is\n * better reported than silently ignored; a build that refuses to start over\n * the same key is not.\n *\n * @deprecated Node-only sync shim; use readPoConfigLenient. Removed in M2.\n */\nexport function loadPoConfigLenient(\n repoRoot: string,\n homeDirectory = nodeHost.homeDirectory(),\n environment: NodeJS.ProcessEnv = process.env,\n): LenientParseResult {\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n return mergeLenientLayers(\n lenientConfigFromText(readTextSync(globalPath), globalPath),\n lenientConfigFromText(readTextSync(repositoryPath), repositoryPath ?? ''),\n environment,\n );\n}\n\n/** @deprecated Node-only shim over node:fs; use readPoConfig. Removed in M2. */\nexport async function loadPoConfigAsync(\n repoRoot: string,\n homeDirectory = nodeHost.homeDirectory(),\n environment: NodeJS.ProcessEnv = process.env,\n): Promise<PoConfig> {\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n const globalConfig = configFromText(\n withGlobalLayer(\n await readText(globalSettingsCachePath(homeDirectory, environment)),\n await readText(globalPath),\n globalSettingsMember(environment, await readText(globalSettingsOwnerPath(homeDirectory, environment))),\n ),\n globalPath,\n );\n const repositoryConfig =\n repositoryPath === undefined ? defaultPoConfig() : configFromText(await readText(repositoryPath), repositoryPath);\n return mergeConfigLayers(globalConfig, repositoryConfig, environment);\n}\n\n/** @deprecated Node-only sync shim; use readPoConfigLayers. Removed in M2. */\nexport function loadPoConfigLayers(\n repoRoot: string | undefined,\n homeDirectory = nodeHost.homeDirectory(),\n environment: NodeJS.ProcessEnv = process.env,\n): PoConfigLayers {\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repoRoot === undefined ? undefined : repositoryConfigFor(repoRoot, homeDirectory, environment);\n const globalText = readTextSync(globalPath);\n const repositoryText = readTextSync(repositoryPath);\n const repositoryConfig =\n repositoryPath === undefined ? defaultPoConfig() : configFromText(repositoryText, repositoryPath);\n return composeConfigLayers(\n layerFromText(globalPath, globalText),\n repositoryPath === undefined ? absentRepositoryLayer() : layerFromText(repositoryPath, repositoryText),\n mergeConfigLayers(configFromText(globalText, globalPath), repositoryConfig, environment),\n );\n}\n","import path from 'node:path';\n\nimport { GLOBAL_SETTINGS_READ_OPERATION } from '@agimon-ai/po-core';\nimport { nodeHost, readTextIfExists, writeFileAtomic, type FileSystem } from '@agimon-ai/po-core/platform';\nimport { marketplaceOrigin } from '@agimon-ai/po-core/verifiedArchive';\nimport { parse as parseYaml } from 'yaml';\n\nimport type { PoConfig, PoConfigLayers, LenientParseResult, WorkspaceDeclaration } from '../../types/config';\nimport { parsePoConfig } from '../configPolicy';\nimport {\n absentRepositoryLayer,\n composeConfigLayers,\n configFromText,\n defaultPoConfig,\n globalPoConfigPath,\n globalSettingsCachePath,\n globalSettingsMember,\n isGlobalSettingsBinding,\n globalSettingsOwnerPath,\n layerFromText,\n lenientConfigFromText,\n mergeConfigLayers,\n mergeLenientLayers,\n repositoryConfigFor,\n sameGlobalSettingsBinding,\n globalSettingsRecords,\n withGlobalLayer,\n type ConfigEnvironment,\n type GlobalSettingsRecord,\n} from './core';\n\ntype IoContext = Parameters<FileSystem['readTextFile']>[1];\n\nexport interface ReadWorkspaceDeclarationsOptions {\n fs: FileSystem;\n repositoryRoot: string;\n context: IoContext;\n}\n\nexport interface WorkspaceDeclarationsResult {\n declarations: WorkspaceDeclaration[];\n source: 'workspaces.yaml' | 'config.yaml' | undefined;\n notices: string[];\n}\n\nconst object = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' &&\n value !== null &&\n (Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null);\n\nfunction jsonValue(value: unknown, seen = new Set<object>()): boolean {\n if (value === null || typeof value === 'string' || typeof value === 'boolean') return true;\n if (typeof value === 'number') return Number.isFinite(value);\n if (typeof value !== 'object' || (!Array.isArray(value) && !object(value)) || seen.has(value)) return false;\n seen.add(value);\n const valid = (Array.isArray(value) ? value : Object.values(value)).every((entry) => jsonValue(entry, seen));\n seen.delete(value);\n return valid;\n}\n\n/** Repository-only declarations. An existing new document is authoritative, even when empty. */\nexport async function readWorkspaceDeclarations({\n fs,\n repositoryRoot,\n context,\n}: ReadWorkspaceDeclarationsOptions): Promise<WorkspaceDeclarationsResult> {\n const filePath = path.join(repositoryRoot, '.po', 'workspaces.yaml');\n const text = await readTextIfExists(fs, filePath, context);\n if (text === undefined) {\n const legacyPath = path.join(repositoryRoot, '.po', 'config.yaml');\n const legacy = await readTextIfExists(fs, legacyPath, context);\n const declarations = legacy === undefined ? undefined : configFromText(legacy, legacyPath).workspaces;\n return {\n declarations: declarations ?? [],\n source: declarations === undefined ? undefined : 'config.yaml',\n notices:\n declarations === undefined\n ? []\n : [`Move workspaces from ${legacyPath} to ${filePath}; config.yaml workspaces is deprecated.`],\n };\n }\n let document: unknown;\n try {\n document = parseYaml(text);\n } catch (error) {\n throw new Error(`Could not parse workspace declarations at ${filePath}`, { cause: error });\n }\n if (\n !object(document) ||\n Object.keys(document).some((key) => key !== 'workspaces') ||\n !Array.isArray(document.workspaces)\n )\n throw new Error(`Workspace declarations at ${filePath} must be an object containing a workspaces list`);\n const aliases = new Set<string>();\n const declarations = document.workspaces.map((entry: unknown, index): WorkspaceDeclaration => {\n const location = `workspaces[${String(index)}]`;\n if (\n !object(entry) ||\n Object.keys(entry).some((key) => !['name', 'path', 'alias', 'instructions', 'metadata'].includes(key))\n )\n throw new Error(\n `Workspace declarations at ${filePath} require ${location} to contain only name, path, alias, instructions, metadata`,\n );\n // Reuse the established declaration name/instructions parser, without changing the legacy config contract.\n const base = parsePoConfig(\n JSON.stringify({ workspaces: [{ name: entry.name, instructions: entry.instructions }] }),\n filePath,\n ).workspaces![0]!;\n if (base.name.length > 80 || !/^[A-Za-z0-9][A-Za-z0-9 ._-]*$/u.test(base.name) || base.name.includes('..'))\n throw new Error(\n `Workspace declarations at ${filePath} require ${location}.name to use letters, numbers, spaces, dots, dashes, or underscores (up to 80 characters)`,\n );\n if (\n entry.path !== undefined &&\n (typeof entry.path !== 'string' || entry.path.trim() === '' || entry.path.includes('\\0'))\n )\n throw new Error(`Workspace declarations at ${filePath} require ${location}.path to be a non-empty path`);\n if (entry.alias !== undefined && (typeof entry.alias !== 'string' || entry.alias.trim() === ''))\n throw new Error(`Workspace declarations at ${filePath} require ${location}.alias to be a non-empty string`);\n const alias = typeof entry.alias === 'string' ? entry.alias.trim() : undefined;\n if (alias !== undefined) {\n if (aliases.has(alias)) throw new Error(`Workspace declarations at ${filePath} have duplicate alias: ${alias}`);\n aliases.add(alias);\n }\n if (entry.metadata !== undefined && (!object(entry.metadata) || !jsonValue(entry.metadata)))\n throw new Error(`Workspace declarations at ${filePath} require ${location}.metadata to be a JSON object`);\n return {\n ...base,\n ...(entry.path === undefined ? {} : { path: entry.path as string }),\n ...(alias === undefined ? {} : { alias }),\n ...(entry.metadata === undefined ? {} : { metadata: entry.metadata as Record<string, unknown> }),\n };\n });\n // Retain the legacy parser's case-insensitive duplicate-name rule across the entire document.\n parsePoConfig(\n JSON.stringify({ workspaces: declarations.map(({ name, instructions }) => ({ name, instructions })) }),\n filePath,\n );\n return { declarations, source: 'workspaces.yaml', notices: [] };\n}\n\nexport interface ReadPoConfigOptions {\n /** Defaults to the host's home directory. */\n readonly homeDirectory?: string;\n /** Admitted environment for locating Po home and member overrides. Defaults to empty. */\n readonly environment?: ConfigEnvironment;\n}\n\nfunction resolved(options: ReadPoConfigOptions): { homeDirectory: string; environment: ConfigEnvironment } {\n return {\n homeDirectory: options.homeDirectory ?? nodeHost.homeDirectory(),\n environment: options.environment ?? {},\n };\n}\n\n/** Reads only the machine owner's config, never repository or org-member preferences. */\nexport async function readHostMarketplaceOrigin(\n fs: FileSystem,\n homeDirectory: string,\n environment: ConfigEnvironment,\n context: IoContext,\n): Promise<string> {\n const file = globalPoConfigPath(homeDirectory, environment);\n const config = configFromText(await readTextIfExists(fs, file, context), file);\n return marketplaceOrigin(config.marketplace?.url);\n}\n\nconst readText = (fs: FileSystem, filePath: string | undefined, context: IoContext) =>\n filePath === undefined ? Promise.resolve(undefined) : readTextIfExists(fs, filePath, context);\n\n/**\n * Loads the merged global and repository config over a FileSystem. A missing\n * file contributes the defaults, so a host with neither file, such as a fresh\n * Durable Object filesystem, reads the same config as an empty Node home.\n * One person's cached global settings sit beneath the host file, portable keys only: the session starter's\n * when the environment names one, else the host owner's.\n */\nexport async function readPoConfig(\n fs: FileSystem,\n repoRoot: string,\n context: IoContext,\n options: ReadPoConfigOptions = {},\n): Promise<PoConfig> {\n const { homeDirectory, environment } = resolved(options);\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n const hostText = await readText(fs, globalPath, context);\n const cacheText = await readText(fs, globalSettingsCachePath(homeDirectory, environment), context);\n const member = globalSettingsMember(\n environment,\n await readText(fs, globalSettingsOwnerPath(homeDirectory, environment), context),\n );\n const globalConfig = configFromText(withGlobalLayer(cacheText, hostText, member), globalPath);\n const repositoryConfig =\n repositoryPath === undefined\n ? defaultPoConfig()\n : configFromText(await readText(fs, repositoryPath, context), repositoryPath);\n return mergeConfigLayers(globalConfig, repositoryConfig, environment);\n}\n\n/**\n * Refreshes the global settings cache from what the host's federation answers: one entry for each person\n * whose grant it holds. `ok` replaces that person's copy and `removed` (they left the team, or took the\n * grant back) drops it, as does having no entry at all. Any other refusal keeps their last copy, and no\n * answer, such as no network, keeps the whole cache.\n */\nexport async function refreshGlobalSettingsCache(\n fs: FileSystem,\n accountCall: (operation: string, input: unknown) => Promise<unknown>,\n context: IoContext,\n options: Required<ReadPoConfigOptions>,\n): Promise<'written' | 'removed' | 'kept'> {\n const answers = await accountCall(GLOBAL_SETTINGS_READ_OPERATION, {}).catch(() => undefined);\n if (!Array.isArray(answers)) return 'kept';\n const cachePath = globalSettingsCachePath(options.homeDirectory, options.environment);\n const before = globalSettingsRecords(await readText(fs, cachePath, context));\n const after: GlobalSettingsRecord[] = [];\n for (const answer of answers as ({ ok?: unknown; yaml?: unknown; code?: unknown; binding?: unknown } | null)[]) {\n const binding = answer?.binding;\n // An answer that names nobody is about nobody, so it is never written.\n if (!answer || !isGlobalSettingsBinding(binding)) continue;\n const last = before.find((record) => sameGlobalSettingsBinding(record.binding, binding));\n if (answer.ok === true && typeof answer.yaml === 'string') after.push({ binding, yaml: answer.yaml });\n else if (answer.code !== 'removed' && last) after.push(last);\n }\n if (JSON.stringify(after) === JSON.stringify(before)) return 'kept';\n if (after.length) {\n await writeFileAtomic(fs, cachePath, JSON.stringify({ members: after }), context);\n return 'written';\n }\n const removed = await fs.remove(cachePath, { force: true }, context);\n if (!removed.ok) throw new Error(`Could not remove ${cachePath}`, { cause: removed.error });\n return 'removed';\n}\n\n/** As `readPoConfig`, tolerating unknown keys in either file and reporting them. */\nexport async function readPoConfigLenient(\n fs: FileSystem,\n repoRoot: string,\n context: IoContext,\n options: ReadPoConfigOptions = {},\n): Promise<LenientParseResult> {\n const { homeDirectory, environment } = resolved(options);\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n const globalConfig = lenientConfigFromText(await readText(fs, globalPath, context), globalPath);\n const repositoryConfig =\n repositoryPath === undefined\n ? lenientConfigFromText(undefined, '')\n : lenientConfigFromText(await readText(fs, repositoryPath, context), repositoryPath);\n return mergeLenientLayers(globalConfig, repositoryConfig, environment);\n}\n\n/**\n * The two config files kept apart, with the merge alongside them.\n *\n * `repoRoot` is optional because the global file is complete on its own: a\n * settings surface with no repository in view still has settings to show.\n */\nexport async function readPoConfigLayers(\n fs: FileSystem,\n repoRoot: string | undefined,\n context: IoContext,\n options: ReadPoConfigOptions = {},\n): Promise<PoConfigLayers> {\n const { homeDirectory, environment } = resolved(options);\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repoRoot === undefined ? undefined : repositoryConfigFor(repoRoot, homeDirectory, environment);\n const globalText = await readText(fs, globalPath, context);\n const repositoryText = await readText(fs, repositoryPath, context);\n const globalLayer = layerFromText(globalPath, globalText);\n const repositoryLayer =\n repositoryPath === undefined ? absentRepositoryLayer() : layerFromText(repositoryPath, repositoryText);\n const repositoryConfig =\n repositoryPath === undefined ? defaultPoConfig() : configFromText(repositoryText, repositoryPath);\n const effective = mergeConfigLayers(configFromText(globalText, globalPath), repositoryConfig, environment);\n return composeConfigLayers(globalLayer, repositoryLayer, effective);\n}\n\nexport {\n globalPoConfigDirectory,\n globalPoConfigPath,\n globalSettingsCachePath,\n globalSettingsPeople,\n isGlobalPoConfigRoot,\n SESSION_MEMBER_ENVIRONMENT,\n repositoryPoConfigPath,\n resolvePlanningPlansDirectory,\n} from './core';\nexport type { ConfigEnvironment, GlobalSettingsPerson } from './core';\nexport { loadPoConfig, loadPoConfigAsync, loadPoConfigLayers, loadPoConfigLenient } from './sync';\n"],"mappings":";;;;;;;;;;;AAuBA,SAAS,aAAa,UAAkD;CACtE,IAAI,aAAa,KAAA,GAAW,OAAO,KAAA;CACnC,IAAI;EACF,OAAOA,QAAAA,QAAG,aAAa,UAAU,MAAM;CACzC,SAAS,OAAO;EACd,IAAK,MAAgC,SAAS,UAAU,OAAO,KAAA;EAC/D,MAAM;CACR;AACF;AAEA,eAAeC,WAAS,UAA+C;CACrE,IAAI;EACF,OAAO,MAAMD,QAAAA,QAAG,SAAS,SAAS,UAAU,MAAM;CACpD,SAAS,OAAO;EACd,IAAK,MAAgC,SAAS,UAAU,OAAO,KAAA;EAC/D,MAAM;CACR;AACF;;AAGA,SAAgB,aACd,UACA,gBAAgBE,4BAAA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,YAAY,UAAU,GAAG,kBAAkB,WAAW;CACzG,OAAOsB,aAAAA,oBAAoB,aAAa,iBAAiB,SAAS;AACpE"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { C as withGlobalLayer, S as sameGlobalSettingsBinding, _ as mergeConfigLayers, a as defaultPoConfig, c as globalSettingsCachePath, f as globalSettingsRecords, g as lenientConfigFromText, h as layerFromText, i as configFromText, l as globalSettingsMember, m as isGlobalSettingsBinding, n as absentRepositoryLayer, r as composeConfigLayers, s as globalPoConfigPath, u as globalSettingsOwnerPath, v as mergeLenientLayers, y as repositoryConfigFor } from "./core-BjM59sEK.mjs";
|
|
1
|
+
import { B as parsePoConfig, C as withGlobalLayer, S as sameGlobalSettingsBinding, _ as mergeConfigLayers, a as defaultPoConfig, c as globalSettingsCachePath, f as globalSettingsRecords, g as lenientConfigFromText, h as layerFromText, i as configFromText, l as globalSettingsMember, m as isGlobalSettingsBinding, n as absentRepositoryLayer, r as composeConfigLayers, s as globalPoConfigPath, u as globalSettingsOwnerPath, v as mergeLenientLayers, y as repositoryConfigFor } from "./core-DL7Cqt_6.mjs";
|
|
3
2
|
import path from "node:path";
|
|
4
3
|
import { nodeHost, readTextIfExists, writeFileAtomic } from "@agimon-ai/po-core/platform";
|
|
5
4
|
import fs from "node:fs";
|
|
@@ -227,4 +226,4 @@ async function readPoConfigLayers(fs, repoRoot, context, options = {}) {
|
|
|
227
226
|
//#endregion
|
|
228
227
|
export { readWorkspaceDeclarations as a, loadPoConfigAsync as c, readPoConfigLenient as i, loadPoConfigLayers as l, readPoConfig as n, refreshGlobalSettingsCache as o, readPoConfigLayers as r, loadPoConfig as s, readHostMarketplaceOrigin as t, loadPoConfigLenient as u };
|
|
229
228
|
|
|
230
|
-
//# sourceMappingURL=config-
|
|
229
|
+
//# sourceMappingURL=config-UMC0q7Hw.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-BeErFE6a.mjs","names":["readText","parseYaml"],"sources":["../src/services/config/sync.ts","../src/services/config/index.ts"],"sourcesContent":["// sync: readTextSync supports exported Node-only synchronous config readers retained for phase 2.\nimport fs from 'node:fs';\n\nimport { nodeHost } from '@agimon-ai/po-core/platform';\n\nimport type { PoConfig, PoConfigLayers, LenientParseResult } from '../../types/config';\nimport {\n absentRepositoryLayer,\n composeConfigLayers,\n configFromText,\n defaultPoConfig,\n globalPoConfigPath,\n globalSettingsCachePath,\n globalSettingsMember,\n globalSettingsOwnerPath,\n layerFromText,\n lenientConfigFromText,\n mergeConfigLayers,\n mergeLenientLayers,\n repositoryConfigFor,\n withGlobalLayer,\n} from './core';\n\nfunction readTextSync(filePath: string | undefined): string | undefined {\n if (filePath === undefined) return undefined;\n try {\n return fs.readFileSync(filePath, 'utf8');\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') return undefined;\n throw error;\n }\n}\n\nasync function readText(filePath: string): Promise<string | undefined> {\n try {\n return await fs.promises.readFile(filePath, 'utf8');\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') return undefined;\n throw error;\n }\n}\n\n/** @deprecated Node-only sync shim; use readPoConfig. Removed in M2. Applies the global layer as readPoConfig does. */\nexport function loadPoConfig(\n repoRoot: string,\n homeDirectory = nodeHost.homeDirectory(),\n environment: NodeJS.ProcessEnv = process.env,\n): PoConfig {\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n return mergeConfigLayers(\n configFromText(\n withGlobalLayer(\n readTextSync(globalSettingsCachePath(homeDirectory, environment)),\n readTextSync(globalPath),\n globalSettingsMember(environment, readTextSync(globalSettingsOwnerPath(homeDirectory, environment))),\n ),\n globalPath,\n ),\n repositoryPath === undefined ? defaultPoConfig() : configFromText(readTextSync(repositoryPath), repositoryPath),\n environment,\n );\n}\n\n/**\n * Loads the merged config, tolerating unknown keys in either file.\n *\n * Only `po sync` uses this. Everything that runs during a session keeps\n * `loadPoConfig`, because a key a running extension cannot understand is\n * better reported than silently ignored; a build that refuses to start over\n * the same key is not.\n *\n * @deprecated Node-only sync shim; use readPoConfigLenient. Removed in M2.\n */\nexport function loadPoConfigLenient(\n repoRoot: string,\n homeDirectory = nodeHost.homeDirectory(),\n environment: NodeJS.ProcessEnv = process.env,\n): LenientParseResult {\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n return mergeLenientLayers(\n lenientConfigFromText(readTextSync(globalPath), globalPath),\n lenientConfigFromText(readTextSync(repositoryPath), repositoryPath ?? ''),\n environment,\n );\n}\n\n/** @deprecated Node-only shim over node:fs; use readPoConfig. Removed in M2. */\nexport async function loadPoConfigAsync(\n repoRoot: string,\n homeDirectory = nodeHost.homeDirectory(),\n environment: NodeJS.ProcessEnv = process.env,\n): Promise<PoConfig> {\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n const globalConfig = configFromText(\n withGlobalLayer(\n await readText(globalSettingsCachePath(homeDirectory, environment)),\n await readText(globalPath),\n globalSettingsMember(environment, await readText(globalSettingsOwnerPath(homeDirectory, environment))),\n ),\n globalPath,\n );\n const repositoryConfig =\n repositoryPath === undefined ? defaultPoConfig() : configFromText(await readText(repositoryPath), repositoryPath);\n return mergeConfigLayers(globalConfig, repositoryConfig, environment);\n}\n\n/** @deprecated Node-only sync shim; use readPoConfigLayers. Removed in M2. */\nexport function loadPoConfigLayers(\n repoRoot: string | undefined,\n homeDirectory = nodeHost.homeDirectory(),\n environment: NodeJS.ProcessEnv = process.env,\n): PoConfigLayers {\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repoRoot === undefined ? undefined : repositoryConfigFor(repoRoot, homeDirectory, environment);\n const globalText = readTextSync(globalPath);\n const repositoryText = readTextSync(repositoryPath);\n const repositoryConfig =\n repositoryPath === undefined ? defaultPoConfig() : configFromText(repositoryText, repositoryPath);\n return composeConfigLayers(\n layerFromText(globalPath, globalText),\n repositoryPath === undefined ? absentRepositoryLayer() : layerFromText(repositoryPath, repositoryText),\n mergeConfigLayers(configFromText(globalText, globalPath), repositoryConfig, environment),\n );\n}\n","import path from 'node:path';\n\nimport { GLOBAL_SETTINGS_READ_OPERATION } from '@agimon-ai/po-core';\nimport { nodeHost, readTextIfExists, writeFileAtomic, type FileSystem } from '@agimon-ai/po-core/platform';\nimport { marketplaceOrigin } from '@agimon-ai/po-core/verifiedArchive';\nimport { parse as parseYaml } from 'yaml';\n\nimport type { PoConfig, PoConfigLayers, LenientParseResult, WorkspaceDeclaration } from '../../types/config';\nimport { parsePoConfig } from '../configPolicy';\nimport {\n absentRepositoryLayer,\n composeConfigLayers,\n configFromText,\n defaultPoConfig,\n globalPoConfigPath,\n globalSettingsCachePath,\n globalSettingsMember,\n isGlobalSettingsBinding,\n globalSettingsOwnerPath,\n layerFromText,\n lenientConfigFromText,\n mergeConfigLayers,\n mergeLenientLayers,\n repositoryConfigFor,\n sameGlobalSettingsBinding,\n globalSettingsRecords,\n withGlobalLayer,\n type ConfigEnvironment,\n type GlobalSettingsRecord,\n} from './core';\n\ntype IoContext = Parameters<FileSystem['readTextFile']>[1];\n\nexport interface ReadWorkspaceDeclarationsOptions {\n fs: FileSystem;\n repositoryRoot: string;\n context: IoContext;\n}\n\nexport interface WorkspaceDeclarationsResult {\n declarations: WorkspaceDeclaration[];\n source: 'workspaces.yaml' | 'config.yaml' | undefined;\n notices: string[];\n}\n\nconst object = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' &&\n value !== null &&\n (Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null);\n\nfunction jsonValue(value: unknown, seen = new Set<object>()): boolean {\n if (value === null || typeof value === 'string' || typeof value === 'boolean') return true;\n if (typeof value === 'number') return Number.isFinite(value);\n if (typeof value !== 'object' || (!Array.isArray(value) && !object(value)) || seen.has(value)) return false;\n seen.add(value);\n const valid = (Array.isArray(value) ? value : Object.values(value)).every((entry) => jsonValue(entry, seen));\n seen.delete(value);\n return valid;\n}\n\n/** Repository-only declarations. An existing new document is authoritative, even when empty. */\nexport async function readWorkspaceDeclarations({\n fs,\n repositoryRoot,\n context,\n}: ReadWorkspaceDeclarationsOptions): Promise<WorkspaceDeclarationsResult> {\n const filePath = path.join(repositoryRoot, '.po', 'workspaces.yaml');\n const text = await readTextIfExists(fs, filePath, context);\n if (text === undefined) {\n const legacyPath = path.join(repositoryRoot, '.po', 'config.yaml');\n const legacy = await readTextIfExists(fs, legacyPath, context);\n const declarations = legacy === undefined ? undefined : configFromText(legacy, legacyPath).workspaces;\n return {\n declarations: declarations ?? [],\n source: declarations === undefined ? undefined : 'config.yaml',\n notices:\n declarations === undefined\n ? []\n : [`Move workspaces from ${legacyPath} to ${filePath}; config.yaml workspaces is deprecated.`],\n };\n }\n let document: unknown;\n try {\n document = parseYaml(text);\n } catch (error) {\n throw new Error(`Could not parse workspace declarations at ${filePath}`, { cause: error });\n }\n if (\n !object(document) ||\n Object.keys(document).some((key) => key !== 'workspaces') ||\n !Array.isArray(document.workspaces)\n )\n throw new Error(`Workspace declarations at ${filePath} must be an object containing a workspaces list`);\n const aliases = new Set<string>();\n const declarations = document.workspaces.map((entry: unknown, index): WorkspaceDeclaration => {\n const location = `workspaces[${String(index)}]`;\n if (\n !object(entry) ||\n Object.keys(entry).some((key) => !['name', 'path', 'alias', 'instructions', 'metadata'].includes(key))\n )\n throw new Error(\n `Workspace declarations at ${filePath} require ${location} to contain only name, path, alias, instructions, metadata`,\n );\n // Reuse the established declaration name/instructions parser, without changing the legacy config contract.\n const base = parsePoConfig(\n JSON.stringify({ workspaces: [{ name: entry.name, instructions: entry.instructions }] }),\n filePath,\n ).workspaces![0]!;\n if (base.name.length > 80 || !/^[A-Za-z0-9][A-Za-z0-9 ._-]*$/u.test(base.name) || base.name.includes('..'))\n throw new Error(\n `Workspace declarations at ${filePath} require ${location}.name to use letters, numbers, spaces, dots, dashes, or underscores (up to 80 characters)`,\n );\n if (\n entry.path !== undefined &&\n (typeof entry.path !== 'string' || entry.path.trim() === '' || entry.path.includes('\\0'))\n )\n throw new Error(`Workspace declarations at ${filePath} require ${location}.path to be a non-empty path`);\n if (entry.alias !== undefined && (typeof entry.alias !== 'string' || entry.alias.trim() === ''))\n throw new Error(`Workspace declarations at ${filePath} require ${location}.alias to be a non-empty string`);\n const alias = typeof entry.alias === 'string' ? entry.alias.trim() : undefined;\n if (alias !== undefined) {\n if (aliases.has(alias)) throw new Error(`Workspace declarations at ${filePath} have duplicate alias: ${alias}`);\n aliases.add(alias);\n }\n if (entry.metadata !== undefined && (!object(entry.metadata) || !jsonValue(entry.metadata)))\n throw new Error(`Workspace declarations at ${filePath} require ${location}.metadata to be a JSON object`);\n return {\n ...base,\n ...(entry.path === undefined ? {} : { path: entry.path as string }),\n ...(alias === undefined ? {} : { alias }),\n ...(entry.metadata === undefined ? {} : { metadata: entry.metadata as Record<string, unknown> }),\n };\n });\n // Retain the legacy parser's case-insensitive duplicate-name rule across the entire document.\n parsePoConfig(\n JSON.stringify({ workspaces: declarations.map(({ name, instructions }) => ({ name, instructions })) }),\n filePath,\n );\n return { declarations, source: 'workspaces.yaml', notices: [] };\n}\n\nexport interface ReadPoConfigOptions {\n /** Defaults to the host's home directory. */\n readonly homeDirectory?: string;\n /** Admitted environment for locating Po home and member overrides. Defaults to empty. */\n readonly environment?: ConfigEnvironment;\n}\n\nfunction resolved(options: ReadPoConfigOptions): { homeDirectory: string; environment: ConfigEnvironment } {\n return {\n homeDirectory: options.homeDirectory ?? nodeHost.homeDirectory(),\n environment: options.environment ?? {},\n };\n}\n\n/** Reads only the machine owner's config, never repository or org-member preferences. */\nexport async function readHostMarketplaceOrigin(\n fs: FileSystem,\n homeDirectory: string,\n environment: ConfigEnvironment,\n context: IoContext,\n): Promise<string> {\n const file = globalPoConfigPath(homeDirectory, environment);\n const config = configFromText(await readTextIfExists(fs, file, context), file);\n return marketplaceOrigin(config.marketplace?.url);\n}\n\nconst readText = (fs: FileSystem, filePath: string | undefined, context: IoContext) =>\n filePath === undefined ? Promise.resolve(undefined) : readTextIfExists(fs, filePath, context);\n\n/**\n * Loads the merged global and repository config over a FileSystem. A missing\n * file contributes the defaults, so a host with neither file, such as a fresh\n * Durable Object filesystem, reads the same config as an empty Node home.\n * One person's cached global settings sit beneath the host file, portable keys only: the session starter's\n * when the environment names one, else the host owner's.\n */\nexport async function readPoConfig(\n fs: FileSystem,\n repoRoot: string,\n context: IoContext,\n options: ReadPoConfigOptions = {},\n): Promise<PoConfig> {\n const { homeDirectory, environment } = resolved(options);\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n const hostText = await readText(fs, globalPath, context);\n const cacheText = await readText(fs, globalSettingsCachePath(homeDirectory, environment), context);\n const member = globalSettingsMember(\n environment,\n await readText(fs, globalSettingsOwnerPath(homeDirectory, environment), context),\n );\n const globalConfig = configFromText(withGlobalLayer(cacheText, hostText, member), globalPath);\n const repositoryConfig =\n repositoryPath === undefined\n ? defaultPoConfig()\n : configFromText(await readText(fs, repositoryPath, context), repositoryPath);\n return mergeConfigLayers(globalConfig, repositoryConfig, environment);\n}\n\n/**\n * Refreshes the global settings cache from what the host's federation answers: one entry for each person\n * whose grant it holds. `ok` replaces that person's copy and `removed` (they left the team, or took the\n * grant back) drops it, as does having no entry at all. Any other refusal keeps their last copy, and no\n * answer, such as no network, keeps the whole cache.\n */\nexport async function refreshGlobalSettingsCache(\n fs: FileSystem,\n accountCall: (operation: string, input: unknown) => Promise<unknown>,\n context: IoContext,\n options: Required<ReadPoConfigOptions>,\n): Promise<'written' | 'removed' | 'kept'> {\n const answers = await accountCall(GLOBAL_SETTINGS_READ_OPERATION, {}).catch(() => undefined);\n if (!Array.isArray(answers)) return 'kept';\n const cachePath = globalSettingsCachePath(options.homeDirectory, options.environment);\n const before = globalSettingsRecords(await readText(fs, cachePath, context));\n const after: GlobalSettingsRecord[] = [];\n for (const answer of answers as ({ ok?: unknown; yaml?: unknown; code?: unknown; binding?: unknown } | null)[]) {\n const binding = answer?.binding;\n // An answer that names nobody is about nobody, so it is never written.\n if (!answer || !isGlobalSettingsBinding(binding)) continue;\n const last = before.find((record) => sameGlobalSettingsBinding(record.binding, binding));\n if (answer.ok === true && typeof answer.yaml === 'string') after.push({ binding, yaml: answer.yaml });\n else if (answer.code !== 'removed' && last) after.push(last);\n }\n if (JSON.stringify(after) === JSON.stringify(before)) return 'kept';\n if (after.length) {\n await writeFileAtomic(fs, cachePath, JSON.stringify({ members: after }), context);\n return 'written';\n }\n const removed = await fs.remove(cachePath, { force: true }, context);\n if (!removed.ok) throw new Error(`Could not remove ${cachePath}`, { cause: removed.error });\n return 'removed';\n}\n\n/** As `readPoConfig`, tolerating unknown keys in either file and reporting them. */\nexport async function readPoConfigLenient(\n fs: FileSystem,\n repoRoot: string,\n context: IoContext,\n options: ReadPoConfigOptions = {},\n): Promise<LenientParseResult> {\n const { homeDirectory, environment } = resolved(options);\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n const globalConfig = lenientConfigFromText(await readText(fs, globalPath, context), globalPath);\n const repositoryConfig =\n repositoryPath === undefined\n ? lenientConfigFromText(undefined, '')\n : lenientConfigFromText(await readText(fs, repositoryPath, context), repositoryPath);\n return mergeLenientLayers(globalConfig, repositoryConfig, environment);\n}\n\n/**\n * The two config files kept apart, with the merge alongside them.\n *\n * `repoRoot` is optional because the global file is complete on its own: a\n * settings surface with no repository in view still has settings to show.\n */\nexport async function readPoConfigLayers(\n fs: FileSystem,\n repoRoot: string | undefined,\n context: IoContext,\n options: ReadPoConfigOptions = {},\n): Promise<PoConfigLayers> {\n const { homeDirectory, environment } = resolved(options);\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repoRoot === undefined ? undefined : repositoryConfigFor(repoRoot, homeDirectory, environment);\n const globalText = await readText(fs, globalPath, context);\n const repositoryText = await readText(fs, repositoryPath, context);\n const globalLayer = layerFromText(globalPath, globalText);\n const repositoryLayer =\n repositoryPath === undefined ? absentRepositoryLayer() : layerFromText(repositoryPath, repositoryText);\n const repositoryConfig =\n repositoryPath === undefined ? defaultPoConfig() : configFromText(repositoryText, repositoryPath);\n const effective = mergeConfigLayers(configFromText(globalText, globalPath), repositoryConfig, environment);\n return composeConfigLayers(globalLayer, repositoryLayer, effective);\n}\n\nexport {\n globalPoConfigDirectory,\n globalPoConfigPath,\n globalSettingsCachePath,\n globalSettingsPeople,\n isGlobalPoConfigRoot,\n SESSION_MEMBER_ENVIRONMENT,\n repositoryPoConfigPath,\n resolvePlanningPlansDirectory,\n} from './core';\nexport type { ConfigEnvironment, GlobalSettingsPerson } from './core';\nexport { loadPoConfig, loadPoConfigAsync, loadPoConfigLayers, loadPoConfigLenient } from './sync';\n"],"mappings":";;;;;;;;;AAuBA,SAAS,aAAa,UAAkD;CACtE,IAAI,aAAa,KAAA,GAAW,OAAO,KAAA;CACnC,IAAI;EACF,OAAO,GAAG,aAAa,UAAU,MAAM;CACzC,SAAS,OAAO;EACd,IAAK,MAAgC,SAAS,UAAU,OAAO,KAAA;EAC/D,MAAM;CACR;AACF;AAEA,eAAeA,WAAS,UAA+C;CACrE,IAAI;EACF,OAAO,MAAM,GAAG,SAAS,SAAS,UAAU,MAAM;CACpD,SAAS,OAAO;EACd,IAAK,MAAgC,SAAS,UAAU,OAAO,KAAA;EAC/D,MAAM;CACR;AACF;;AAGA,SAAgB,aACd,UACA,gBAAgB,SAAS,cAAc,GACvC,cAAiC,QAAQ,KAC/B;CACV,MAAM,aAAa,mBAAmB,eAAe,WAAW;CAChE,MAAM,iBAAiB,oBAAoB,UAAU,eAAe,WAAW;CAC/E,OAAO,kBACL,eACE,gBACE,aAAa,wBAAwB,eAAe,WAAW,CAAC,GAChE,aAAa,UAAU,GACvB,qBAAqB,aAAa,aAAa,wBAAwB,eAAe,WAAW,CA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ACxD,MAAM,kBACJ,mBAAmB,KAAA,IAAY,sBAAsB,IAAI,cAAc,gBAAgB,cAAc;CACvG,MAAM,mBACJ,mBAAmB,KAAA,IAAY,gBAAgB,IAAI,eAAe,gBAAgB,cAAc;CAClG,MAAM,YAAY,kBAAkB,eAAe,YAAY,UAAU,GAAG,kBAAkB,WAAW;CACzG,OAAO,oBAAoB,aAAa,iBAAiB,SAAS;AACpE"}
|
|
1
|
+
{"version":3,"file":"config-UMC0q7Hw.mjs","names":["readText","parseYaml"],"sources":["../src/services/config/sync.ts","../src/services/config/index.ts"],"sourcesContent":["// sync: readTextSync supports exported Node-only synchronous config readers retained for phase 2.\nimport fs from 'node:fs';\n\nimport { nodeHost } from '@agimon-ai/po-core/platform';\n\nimport type { PoConfig, PoConfigLayers, LenientParseResult } from '../../types/config';\nimport {\n absentRepositoryLayer,\n composeConfigLayers,\n configFromText,\n defaultPoConfig,\n globalPoConfigPath,\n globalSettingsCachePath,\n globalSettingsMember,\n globalSettingsOwnerPath,\n layerFromText,\n lenientConfigFromText,\n mergeConfigLayers,\n mergeLenientLayers,\n repositoryConfigFor,\n withGlobalLayer,\n} from './core';\n\nfunction readTextSync(filePath: string | undefined): string | undefined {\n if (filePath === undefined) return undefined;\n try {\n return fs.readFileSync(filePath, 'utf8');\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') return undefined;\n throw error;\n }\n}\n\nasync function readText(filePath: string): Promise<string | undefined> {\n try {\n return await fs.promises.readFile(filePath, 'utf8');\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') return undefined;\n throw error;\n }\n}\n\n/** @deprecated Node-only sync shim; use readPoConfig. Removed in M2. Applies the global layer as readPoConfig does. */\nexport function loadPoConfig(\n repoRoot: string,\n homeDirectory = nodeHost.homeDirectory(),\n environment: NodeJS.ProcessEnv = process.env,\n): PoConfig {\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n return mergeConfigLayers(\n configFromText(\n withGlobalLayer(\n readTextSync(globalSettingsCachePath(homeDirectory, environment)),\n readTextSync(globalPath),\n globalSettingsMember(environment, readTextSync(globalSettingsOwnerPath(homeDirectory, environment))),\n ),\n globalPath,\n ),\n repositoryPath === undefined ? defaultPoConfig() : configFromText(readTextSync(repositoryPath), repositoryPath),\n environment,\n );\n}\n\n/**\n * Loads the merged config, tolerating unknown keys in either file.\n *\n * Only `po sync` uses this. Everything that runs during a session keeps\n * `loadPoConfig`, because a key a running extension cannot understand is\n * better reported than silently ignored; a build that refuses to start over\n * the same key is not.\n *\n * @deprecated Node-only sync shim; use readPoConfigLenient. Removed in M2.\n */\nexport function loadPoConfigLenient(\n repoRoot: string,\n homeDirectory = nodeHost.homeDirectory(),\n environment: NodeJS.ProcessEnv = process.env,\n): LenientParseResult {\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n return mergeLenientLayers(\n lenientConfigFromText(readTextSync(globalPath), globalPath),\n lenientConfigFromText(readTextSync(repositoryPath), repositoryPath ?? ''),\n environment,\n );\n}\n\n/** @deprecated Node-only shim over node:fs; use readPoConfig. Removed in M2. */\nexport async function loadPoConfigAsync(\n repoRoot: string,\n homeDirectory = nodeHost.homeDirectory(),\n environment: NodeJS.ProcessEnv = process.env,\n): Promise<PoConfig> {\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n const globalConfig = configFromText(\n withGlobalLayer(\n await readText(globalSettingsCachePath(homeDirectory, environment)),\n await readText(globalPath),\n globalSettingsMember(environment, await readText(globalSettingsOwnerPath(homeDirectory, environment))),\n ),\n globalPath,\n );\n const repositoryConfig =\n repositoryPath === undefined ? defaultPoConfig() : configFromText(await readText(repositoryPath), repositoryPath);\n return mergeConfigLayers(globalConfig, repositoryConfig, environment);\n}\n\n/** @deprecated Node-only sync shim; use readPoConfigLayers. Removed in M2. */\nexport function loadPoConfigLayers(\n repoRoot: string | undefined,\n homeDirectory = nodeHost.homeDirectory(),\n environment: NodeJS.ProcessEnv = process.env,\n): PoConfigLayers {\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repoRoot === undefined ? undefined : repositoryConfigFor(repoRoot, homeDirectory, environment);\n const globalText = readTextSync(globalPath);\n const repositoryText = readTextSync(repositoryPath);\n const repositoryConfig =\n repositoryPath === undefined ? defaultPoConfig() : configFromText(repositoryText, repositoryPath);\n return composeConfigLayers(\n layerFromText(globalPath, globalText),\n repositoryPath === undefined ? absentRepositoryLayer() : layerFromText(repositoryPath, repositoryText),\n mergeConfigLayers(configFromText(globalText, globalPath), repositoryConfig, environment),\n );\n}\n","import path from 'node:path';\n\nimport { GLOBAL_SETTINGS_READ_OPERATION } from '@agimon-ai/po-core';\nimport { nodeHost, readTextIfExists, writeFileAtomic, type FileSystem } from '@agimon-ai/po-core/platform';\nimport { marketplaceOrigin } from '@agimon-ai/po-core/verifiedArchive';\nimport { parse as parseYaml } from 'yaml';\n\nimport type { PoConfig, PoConfigLayers, LenientParseResult, WorkspaceDeclaration } from '../../types/config';\nimport { parsePoConfig } from '../configPolicy';\nimport {\n absentRepositoryLayer,\n composeConfigLayers,\n configFromText,\n defaultPoConfig,\n globalPoConfigPath,\n globalSettingsCachePath,\n globalSettingsMember,\n isGlobalSettingsBinding,\n globalSettingsOwnerPath,\n layerFromText,\n lenientConfigFromText,\n mergeConfigLayers,\n mergeLenientLayers,\n repositoryConfigFor,\n sameGlobalSettingsBinding,\n globalSettingsRecords,\n withGlobalLayer,\n type ConfigEnvironment,\n type GlobalSettingsRecord,\n} from './core';\n\ntype IoContext = Parameters<FileSystem['readTextFile']>[1];\n\nexport interface ReadWorkspaceDeclarationsOptions {\n fs: FileSystem;\n repositoryRoot: string;\n context: IoContext;\n}\n\nexport interface WorkspaceDeclarationsResult {\n declarations: WorkspaceDeclaration[];\n source: 'workspaces.yaml' | 'config.yaml' | undefined;\n notices: string[];\n}\n\nconst object = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' &&\n value !== null &&\n (Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null);\n\nfunction jsonValue(value: unknown, seen = new Set<object>()): boolean {\n if (value === null || typeof value === 'string' || typeof value === 'boolean') return true;\n if (typeof value === 'number') return Number.isFinite(value);\n if (typeof value !== 'object' || (!Array.isArray(value) && !object(value)) || seen.has(value)) return false;\n seen.add(value);\n const valid = (Array.isArray(value) ? value : Object.values(value)).every((entry) => jsonValue(entry, seen));\n seen.delete(value);\n return valid;\n}\n\n/** Repository-only declarations. An existing new document is authoritative, even when empty. */\nexport async function readWorkspaceDeclarations({\n fs,\n repositoryRoot,\n context,\n}: ReadWorkspaceDeclarationsOptions): Promise<WorkspaceDeclarationsResult> {\n const filePath = path.join(repositoryRoot, '.po', 'workspaces.yaml');\n const text = await readTextIfExists(fs, filePath, context);\n if (text === undefined) {\n const legacyPath = path.join(repositoryRoot, '.po', 'config.yaml');\n const legacy = await readTextIfExists(fs, legacyPath, context);\n const declarations = legacy === undefined ? undefined : configFromText(legacy, legacyPath).workspaces;\n return {\n declarations: declarations ?? [],\n source: declarations === undefined ? undefined : 'config.yaml',\n notices:\n declarations === undefined\n ? []\n : [`Move workspaces from ${legacyPath} to ${filePath}; config.yaml workspaces is deprecated.`],\n };\n }\n let document: unknown;\n try {\n document = parseYaml(text);\n } catch (error) {\n throw new Error(`Could not parse workspace declarations at ${filePath}`, { cause: error });\n }\n if (\n !object(document) ||\n Object.keys(document).some((key) => key !== 'workspaces') ||\n !Array.isArray(document.workspaces)\n )\n throw new Error(`Workspace declarations at ${filePath} must be an object containing a workspaces list`);\n const aliases = new Set<string>();\n const declarations = document.workspaces.map((entry: unknown, index): WorkspaceDeclaration => {\n const location = `workspaces[${String(index)}]`;\n if (\n !object(entry) ||\n Object.keys(entry).some((key) => !['name', 'path', 'alias', 'instructions', 'metadata'].includes(key))\n )\n throw new Error(\n `Workspace declarations at ${filePath} require ${location} to contain only name, path, alias, instructions, metadata`,\n );\n // Reuse the established declaration name/instructions parser, without changing the legacy config contract.\n const base = parsePoConfig(\n JSON.stringify({ workspaces: [{ name: entry.name, instructions: entry.instructions }] }),\n filePath,\n ).workspaces![0]!;\n if (base.name.length > 80 || !/^[A-Za-z0-9][A-Za-z0-9 ._-]*$/u.test(base.name) || base.name.includes('..'))\n throw new Error(\n `Workspace declarations at ${filePath} require ${location}.name to use letters, numbers, spaces, dots, dashes, or underscores (up to 80 characters)`,\n );\n if (\n entry.path !== undefined &&\n (typeof entry.path !== 'string' || entry.path.trim() === '' || entry.path.includes('\\0'))\n )\n throw new Error(`Workspace declarations at ${filePath} require ${location}.path to be a non-empty path`);\n if (entry.alias !== undefined && (typeof entry.alias !== 'string' || entry.alias.trim() === ''))\n throw new Error(`Workspace declarations at ${filePath} require ${location}.alias to be a non-empty string`);\n const alias = typeof entry.alias === 'string' ? entry.alias.trim() : undefined;\n if (alias !== undefined) {\n if (aliases.has(alias)) throw new Error(`Workspace declarations at ${filePath} have duplicate alias: ${alias}`);\n aliases.add(alias);\n }\n if (entry.metadata !== undefined && (!object(entry.metadata) || !jsonValue(entry.metadata)))\n throw new Error(`Workspace declarations at ${filePath} require ${location}.metadata to be a JSON object`);\n return {\n ...base,\n ...(entry.path === undefined ? {} : { path: entry.path as string }),\n ...(alias === undefined ? {} : { alias }),\n ...(entry.metadata === undefined ? {} : { metadata: entry.metadata as Record<string, unknown> }),\n };\n });\n // Retain the legacy parser's case-insensitive duplicate-name rule across the entire document.\n parsePoConfig(\n JSON.stringify({ workspaces: declarations.map(({ name, instructions }) => ({ name, instructions })) }),\n filePath,\n );\n return { declarations, source: 'workspaces.yaml', notices: [] };\n}\n\nexport interface ReadPoConfigOptions {\n /** Defaults to the host's home directory. */\n readonly homeDirectory?: string;\n /** Admitted environment for locating Po home and member overrides. Defaults to empty. */\n readonly environment?: ConfigEnvironment;\n}\n\nfunction resolved(options: ReadPoConfigOptions): { homeDirectory: string; environment: ConfigEnvironment } {\n return {\n homeDirectory: options.homeDirectory ?? nodeHost.homeDirectory(),\n environment: options.environment ?? {},\n };\n}\n\n/** Reads only the machine owner's config, never repository or org-member preferences. */\nexport async function readHostMarketplaceOrigin(\n fs: FileSystem,\n homeDirectory: string,\n environment: ConfigEnvironment,\n context: IoContext,\n): Promise<string> {\n const file = globalPoConfigPath(homeDirectory, environment);\n const config = configFromText(await readTextIfExists(fs, file, context), file);\n return marketplaceOrigin(config.marketplace?.url);\n}\n\nconst readText = (fs: FileSystem, filePath: string | undefined, context: IoContext) =>\n filePath === undefined ? Promise.resolve(undefined) : readTextIfExists(fs, filePath, context);\n\n/**\n * Loads the merged global and repository config over a FileSystem. A missing\n * file contributes the defaults, so a host with neither file, such as a fresh\n * Durable Object filesystem, reads the same config as an empty Node home.\n * One person's cached global settings sit beneath the host file, portable keys only: the session starter's\n * when the environment names one, else the host owner's.\n */\nexport async function readPoConfig(\n fs: FileSystem,\n repoRoot: string,\n context: IoContext,\n options: ReadPoConfigOptions = {},\n): Promise<PoConfig> {\n const { homeDirectory, environment } = resolved(options);\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n const hostText = await readText(fs, globalPath, context);\n const cacheText = await readText(fs, globalSettingsCachePath(homeDirectory, environment), context);\n const member = globalSettingsMember(\n environment,\n await readText(fs, globalSettingsOwnerPath(homeDirectory, environment), context),\n );\n const globalConfig = configFromText(withGlobalLayer(cacheText, hostText, member), globalPath);\n const repositoryConfig =\n repositoryPath === undefined\n ? defaultPoConfig()\n : configFromText(await readText(fs, repositoryPath, context), repositoryPath);\n return mergeConfigLayers(globalConfig, repositoryConfig, environment);\n}\n\n/**\n * Refreshes the global settings cache from what the host's federation answers: one entry for each person\n * whose grant it holds. `ok` replaces that person's copy and `removed` (they left the team, or took the\n * grant back) drops it, as does having no entry at all. Any other refusal keeps their last copy, and no\n * answer, such as no network, keeps the whole cache.\n */\nexport async function refreshGlobalSettingsCache(\n fs: FileSystem,\n accountCall: (operation: string, input: unknown) => Promise<unknown>,\n context: IoContext,\n options: Required<ReadPoConfigOptions>,\n): Promise<'written' | 'removed' | 'kept'> {\n const answers = await accountCall(GLOBAL_SETTINGS_READ_OPERATION, {}).catch(() => undefined);\n if (!Array.isArray(answers)) return 'kept';\n const cachePath = globalSettingsCachePath(options.homeDirectory, options.environment);\n const before = globalSettingsRecords(await readText(fs, cachePath, context));\n const after: GlobalSettingsRecord[] = [];\n for (const answer of answers as ({ ok?: unknown; yaml?: unknown; code?: unknown; binding?: unknown } | null)[]) {\n const binding = answer?.binding;\n // An answer that names nobody is about nobody, so it is never written.\n if (!answer || !isGlobalSettingsBinding(binding)) continue;\n const last = before.find((record) => sameGlobalSettingsBinding(record.binding, binding));\n if (answer.ok === true && typeof answer.yaml === 'string') after.push({ binding, yaml: answer.yaml });\n else if (answer.code !== 'removed' && last) after.push(last);\n }\n if (JSON.stringify(after) === JSON.stringify(before)) return 'kept';\n if (after.length) {\n await writeFileAtomic(fs, cachePath, JSON.stringify({ members: after }), context);\n return 'written';\n }\n const removed = await fs.remove(cachePath, { force: true }, context);\n if (!removed.ok) throw new Error(`Could not remove ${cachePath}`, { cause: removed.error });\n return 'removed';\n}\n\n/** As `readPoConfig`, tolerating unknown keys in either file and reporting them. */\nexport async function readPoConfigLenient(\n fs: FileSystem,\n repoRoot: string,\n context: IoContext,\n options: ReadPoConfigOptions = {},\n): Promise<LenientParseResult> {\n const { homeDirectory, environment } = resolved(options);\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repositoryConfigFor(repoRoot, homeDirectory, environment);\n const globalConfig = lenientConfigFromText(await readText(fs, globalPath, context), globalPath);\n const repositoryConfig =\n repositoryPath === undefined\n ? lenientConfigFromText(undefined, '')\n : lenientConfigFromText(await readText(fs, repositoryPath, context), repositoryPath);\n return mergeLenientLayers(globalConfig, repositoryConfig, environment);\n}\n\n/**\n * The two config files kept apart, with the merge alongside them.\n *\n * `repoRoot` is optional because the global file is complete on its own: a\n * settings surface with no repository in view still has settings to show.\n */\nexport async function readPoConfigLayers(\n fs: FileSystem,\n repoRoot: string | undefined,\n context: IoContext,\n options: ReadPoConfigOptions = {},\n): Promise<PoConfigLayers> {\n const { homeDirectory, environment } = resolved(options);\n const globalPath = globalPoConfigPath(homeDirectory, environment);\n const repositoryPath = repoRoot === undefined ? undefined : repositoryConfigFor(repoRoot, homeDirectory, environment);\n const globalText = await readText(fs, globalPath, context);\n const repositoryText = await readText(fs, repositoryPath, context);\n const globalLayer = layerFromText(globalPath, globalText);\n const repositoryLayer =\n repositoryPath === undefined ? absentRepositoryLayer() : layerFromText(repositoryPath, repositoryText);\n const repositoryConfig =\n repositoryPath === undefined ? defaultPoConfig() : configFromText(repositoryText, repositoryPath);\n const effective = mergeConfigLayers(configFromText(globalText, globalPath), repositoryConfig, environment);\n return composeConfigLayers(globalLayer, repositoryLayer, effective);\n}\n\nexport {\n globalPoConfigDirectory,\n globalPoConfigPath,\n globalSettingsCachePath,\n globalSettingsPeople,\n isGlobalPoConfigRoot,\n SESSION_MEMBER_ENVIRONMENT,\n repositoryPoConfigPath,\n resolvePlanningPlansDirectory,\n} from './core';\nexport type { ConfigEnvironment, GlobalSettingsPerson } from './core';\nexport { loadPoConfig, loadPoConfigAsync, loadPoConfigLayers, loadPoConfigLenient } from './sync';\n"],"mappings":";;;;;;;;AAuBA,SAAS,aAAa,UAAkD;CACtE,IAAI,aAAa,KAAA,GAAW,OAAO,KAAA;CACnC,IAAI;EACF,OAAO,GAAG,aAAa,UAAU,MAAM;CACzC,SAAS,OAAO;EACd,IAAK,MAAgC,SAAS,UAAU,OAAO,KAAA;EAC/D,MAAM;CACR;AACF;AAEA,eAAeA,WAAS,UAA+C;CACrE,IAAI;EACF,OAAO,MAAM,GAAG,SAAS,SAAS,UAAU,MAAM;CACpD,SAAS,OAAO;EACd,IAAK,MAAgC,SAAS,UAAU,OAAO,KAAA;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CAAC,GACP;CACzB,MAAM,EAAE,eAAe,gBAAgB,SAAS,OAAO;CACvD,MAAM,aAAa,mBAAmB,eAAe,WAAW;CAChE,MAAM,iBAAiB,aAAa,KAAA,IAAY,KAAA,IAAY,oBAAoB,UAAU,eAAe,WAAW;CACpH,MAAM,aAAa,MAAM,SAAS,IAAI,YAAY,OAAO;CACzD,MAAM,iBAAiB,MAAM,SAAS,IAAI,gBAAgB,OAAO;CACjE,MAAM,cAAc,cAAc,YAAY,UAAU;CACxD,MAAM,kBACJ,mBAAmB,KAAA,IAAY,sBAAsB,IAAI,cAAc,gBAAgB,cAAc;CACvG,MAAM,mBACJ,mBAAmB,KAAA,IAAY,gBAAgB,IAAI,eAAe,gBAAgB,cAAc;CAClG,MAAM,YAAY,kBAAkB,eAAe,YAAY,UAAU,GAAG,kBAAkB,WAAW;CACzG,OAAO,oBAAoB,aAAa,iBAAiB,SAAS;AACpE"}
|
package/dist/config.cjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const require_config = require("./config-DB7YUo6N.cjs");
|
|
2
|
+
const require_core = require("./core-0zEBs0G5.cjs");
|
|
3
|
+
const require_config = require("./config-DNicyP1o.cjs");
|
|
5
4
|
let _agimon_ai_po_core = require("@agimon-ai/po-core");
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
exports.
|
|
9
|
-
exports.
|
|
10
|
-
exports.
|
|
5
|
+
exports.PO_PLANNING_MODE_LIMITS = require_core.PO_PLANNING_MODE_LIMITS;
|
|
6
|
+
exports.PO_PLANNING_THINKING_LEVELS = require_core.PO_PLANNING_THINKING_LEVELS;
|
|
7
|
+
exports.PO_VOICE_ENGINES = require_core.PO_VOICE_ENGINES;
|
|
8
|
+
exports.PO_VOICE_LIVE_VOICES = require_core.PO_VOICE_LIVE_VOICES;
|
|
9
|
+
exports.PO_VOICE_MODES = require_core.PO_VOICE_MODES;
|
|
10
|
+
exports.PO_VOICE_TTS_ENGINES = require_core.PO_VOICE_TTS_ENGINES;
|
|
11
11
|
exports.SESSION_MEMBER_ENVIRONMENT = require_core.SESSION_MEMBER_ENVIRONMENT;
|
|
12
|
-
exports.configLeafKeys =
|
|
13
|
-
exports.configRootKeys =
|
|
14
|
-
exports.configScopeOf =
|
|
12
|
+
exports.configLeafKeys = require_core.configLeafKeys;
|
|
13
|
+
exports.configRootKeys = require_core.configRootKeys;
|
|
14
|
+
exports.configScopeOf = require_core.configScopeOf;
|
|
15
15
|
exports.globalPoConfigDirectory = require_core.globalPoConfigDirectory;
|
|
16
16
|
exports.globalPoConfigPath = require_core.globalPoConfigPath;
|
|
17
17
|
exports.globalSettingsCachePath = require_core.globalSettingsCachePath;
|
|
@@ -22,18 +22,18 @@ Object.defineProperty(exports, "isPortableConfigKey", {
|
|
|
22
22
|
return _agimon_ai_po_core.isPortableConfigKey;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
|
-
exports.mergeGlobalConfigLayer =
|
|
26
|
-
exports.mergePoConfigs =
|
|
25
|
+
exports.mergeGlobalConfigLayer = require_core.mergeGlobalConfigLayer;
|
|
26
|
+
exports.mergePoConfigs = require_core.mergePoConfigs;
|
|
27
27
|
Object.defineProperty(exports, "nonPortableConfigKeys", {
|
|
28
28
|
enumerable: true,
|
|
29
29
|
get: function() {
|
|
30
30
|
return _agimon_ai_po_core.nonPortableConfigKeys;
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
|
-
exports.nonPortableConfigText =
|
|
34
|
-
exports.parseAutocompactModeConfig =
|
|
35
|
-
exports.parsePlanningModeConfig =
|
|
36
|
-
exports.parsePoConfig =
|
|
33
|
+
exports.nonPortableConfigText = require_core.nonPortableConfigText;
|
|
34
|
+
exports.parseAutocompactModeConfig = require_core.parseAutocompactModeConfig;
|
|
35
|
+
exports.parsePlanningModeConfig = require_core.parsePlanningModeConfig;
|
|
36
|
+
exports.parsePoConfig = require_core.parsePoConfig;
|
|
37
37
|
exports.readHostMarketplaceOrigin = require_config.readHostMarketplaceOrigin;
|
|
38
38
|
exports.readPoConfig = require_config.readPoConfig;
|
|
39
39
|
exports.readPoConfigLayers = require_config.readPoConfigLayers;
|
|
@@ -42,5 +42,5 @@ exports.readWorkspaceDeclarations = require_config.readWorkspaceDeclarations;
|
|
|
42
42
|
exports.refreshGlobalSettingsCache = require_config.refreshGlobalSettingsCache;
|
|
43
43
|
exports.repositoryPoConfigPath = require_core.repositoryPoConfigPath;
|
|
44
44
|
exports.resolvePlanningPlansDirectory = require_core.resolvePlanningPlansDirectory;
|
|
45
|
-
exports.resolveVoiceConfig =
|
|
46
|
-
exports.valueAtKeyPath =
|
|
45
|
+
exports.resolveVoiceConfig = require_core.resolveVoiceConfig;
|
|
46
|
+
exports.valueAtKeyPath = require_core.valueAtKeyPath;
|
package/dist/config.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
import { a as globalPoConfigPath, c as repositoryPoConfigPath, i as globalPoConfigDirectory, l as resolvePlanningPlansDirectory, n as GlobalSettingsPerson, o as globalSettingsCachePath, r as SESSION_MEMBER_ENVIRONMENT, s as globalSettingsPeople } from "./core-
|
|
3
|
-
import { a as readPoConfig, c as readWorkspaceDeclarations, i as readHostMarketplaceOrigin, l as refreshGlobalSettingsCache, n as ReadWorkspaceDeclarationsOptions, o as readPoConfigLayers, r as WorkspaceDeclarationsResult, s as readPoConfigLenient, t as ReadPoConfigOptions } from "./index-
|
|
4
|
-
import { _ as
|
|
5
|
-
export { type ConfigDiagnostic, type ConfigKeyScope, type ConfigValueOrigin, type GlobalSettingsPerson, type LenientParseOptions, type LenientParseResult, PO_PLANNING_THINKING_LEVELS, PO_VOICE_ENGINES, PO_VOICE_LIVE_VOICES, PO_VOICE_MODES, PO_VOICE_TTS_ENGINES, type PoConfigLayer, type PoConfigLayers, type ReadPoConfigOptions, type ReadWorkspaceDeclarationsOptions, SESSION_MEMBER_ENVIRONMENT, type WorkspaceDeclarationsResult, configLeafKeys, configRootKeys, configScopeOf, globalPoConfigDirectory, globalPoConfigPath, globalSettingsCachePath, globalSettingsPeople, isPortableConfigKey, mergeGlobalConfigLayer, mergePoConfigs, nonPortableConfigKeys, nonPortableConfigText, parseAutocompactModeConfig, parsePlanningModeConfig, parsePoConfig, readHostMarketplaceOrigin, readPoConfig, readPoConfigLayers, readPoConfigLenient, readWorkspaceDeclarations, refreshGlobalSettingsCache, repositoryPoConfigPath, resolvePlanningPlansDirectory, resolveVoiceConfig, valueAtKeyPath };
|
|
1
|
+
import { C as PoConfigLayer, a as ConfigDiagnostic, m as LenientParseResult, o as ConfigValueOrigin, p as LenientParseOptions, w as PoConfigLayers } from "./config-CG_KJdcd.mjs";
|
|
2
|
+
import { a as globalPoConfigPath, c as repositoryPoConfigPath, i as globalPoConfigDirectory, l as resolvePlanningPlansDirectory, n as GlobalSettingsPerson, o as globalSettingsCachePath, r as SESSION_MEMBER_ENVIRONMENT, s as globalSettingsPeople } from "./core-BfpG7H9Y.mjs";
|
|
3
|
+
import { a as readPoConfig, c as readWorkspaceDeclarations, i as readHostMarketplaceOrigin, l as refreshGlobalSettingsCache, n as ReadWorkspaceDeclarationsOptions, o as readPoConfigLayers, r as WorkspaceDeclarationsResult, s as readPoConfigLenient, t as ReadPoConfigOptions } from "./index-C7Gw9FE_.mjs";
|
|
4
|
+
import { _ as parsePlanningModeConfig, a as PO_VOICE_LIVE_VOICES, b as valueAtKeyPath, c as configLeafKeys, d as isPortableConfigKey, f as mergeGlobalConfigLayer, g as parseAutocompactModeConfig, h as nonPortableConfigText, i as PO_VOICE_ENGINES, l as configRootKeys, m as nonPortableConfigKeys, n as PO_PLANNING_MODE_LIMITS, o as PO_VOICE_MODES, p as mergePoConfigs, r as PO_PLANNING_THINKING_LEVELS, s as PO_VOICE_TTS_ENGINES, t as ConfigKeyScope, u as configScopeOf, v as parsePoConfig, y as resolveVoiceConfig } from "./index-K6JD2MmM.mjs";
|
|
5
|
+
export { type ConfigDiagnostic, type ConfigKeyScope, type ConfigValueOrigin, type GlobalSettingsPerson, type LenientParseOptions, type LenientParseResult, PO_PLANNING_MODE_LIMITS, PO_PLANNING_THINKING_LEVELS, PO_VOICE_ENGINES, PO_VOICE_LIVE_VOICES, PO_VOICE_MODES, PO_VOICE_TTS_ENGINES, type PoConfigLayer, type PoConfigLayers, type ReadPoConfigOptions, type ReadWorkspaceDeclarationsOptions, SESSION_MEMBER_ENVIRONMENT, type WorkspaceDeclarationsResult, configLeafKeys, configRootKeys, configScopeOf, globalPoConfigDirectory, globalPoConfigPath, globalSettingsCachePath, globalSettingsPeople, isPortableConfigKey, mergeGlobalConfigLayer, mergePoConfigs, nonPortableConfigKeys, nonPortableConfigText, parseAutocompactModeConfig, parsePlanningModeConfig, parsePoConfig, readHostMarketplaceOrigin, readPoConfig, readPoConfigLayers, readPoConfigLenient, readWorkspaceDeclarations, refreshGlobalSettingsCache, repositoryPoConfigPath, resolvePlanningPlansDirectory, resolveVoiceConfig, valueAtKeyPath };
|
package/dist/config.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export { PO_PLANNING_THINKING_LEVELS, PO_VOICE_ENGINES, PO_VOICE_LIVE_VOICES, PO_VOICE_MODES, PO_VOICE_TTS_ENGINES, SESSION_MEMBER_ENVIRONMENT, configLeafKeys, configRootKeys, configScopeOf, globalPoConfigDirectory, globalPoConfigPath, globalSettingsCachePath, globalSettingsPeople, isPortableConfigKey, mergeGlobalConfigLayer, mergePoConfigs, nonPortableConfigKeys, nonPortableConfigText, parseAutocompactModeConfig, parsePlanningModeConfig, parsePoConfig, readHostMarketplaceOrigin, readPoConfig, readPoConfigLayers, readPoConfigLenient, readWorkspaceDeclarations, refreshGlobalSettingsCache, repositoryPoConfigPath, resolvePlanningPlansDirectory, resolveVoiceConfig, valueAtKeyPath };
|
|
1
|
+
import { A as configLeafKeys, B as parsePoConfig, D as PO_VOICE_LIVE_VOICES, E as PO_VOICE_ENGINES, F as mergePoConfigs, H as valueAtKeyPath, I as nonPortableConfigKeys, L as nonPortableConfigText, M as configScopeOf, N as isPortableConfigKey, O as PO_VOICE_MODES, P as mergeGlobalConfigLayer, R as parseAutocompactModeConfig, T as PO_PLANNING_THINKING_LEVELS, V as resolveVoiceConfig, b as repositoryPoConfigPath, c as globalSettingsCachePath, d as globalSettingsPeople, j as configRootKeys, k as PO_VOICE_TTS_ENGINES, o as globalPoConfigDirectory, s as globalPoConfigPath, t as SESSION_MEMBER_ENVIRONMENT, w as PO_PLANNING_MODE_LIMITS, x as resolvePlanningPlansDirectory, z as parsePlanningModeConfig } from "./core-DL7Cqt_6.mjs";
|
|
2
|
+
import { a as readWorkspaceDeclarations, i as readPoConfigLenient, n as readPoConfig, o as refreshGlobalSettingsCache, r as readPoConfigLayers, t as readHostMarketplaceOrigin } from "./config-UMC0q7Hw.mjs";
|
|
3
|
+
export { PO_PLANNING_MODE_LIMITS, PO_PLANNING_THINKING_LEVELS, PO_VOICE_ENGINES, PO_VOICE_LIVE_VOICES, PO_VOICE_MODES, PO_VOICE_TTS_ENGINES, SESSION_MEMBER_ENVIRONMENT, configLeafKeys, configRootKeys, configScopeOf, globalPoConfigDirectory, globalPoConfigPath, globalSettingsCachePath, globalSettingsPeople, isPortableConfigKey, mergeGlobalConfigLayer, mergePoConfigs, nonPortableConfigKeys, nonPortableConfigText, parseAutocompactModeConfig, parsePlanningModeConfig, parsePoConfig, readHostMarketplaceOrigin, readPoConfig, readPoConfigLayers, readPoConfigLenient, readWorkspaceDeclarations, refreshGlobalSettingsCache, repositoryPoConfigPath, resolvePlanningPlansDirectory, resolveVoiceConfig, valueAtKeyPath };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as createDirectoryWithMode } from "./atomicJson-Dj3rlZbD.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { B as parsePoConfig, h as layerFromText } from "./core-DL7Cqt_6.mjs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { createSerialRunner, nodeHost, readTextIfExists, writeFileAtomic } from "@agimon-ai/po-core/platform";
|
|
5
5
|
import { randomUUID } from "node:crypto";
|
|
@@ -57,6 +57,17 @@ function modesForScope(scope) {
|
|
|
57
57
|
directory: PRIVATE_DIRECTORY_MODE
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
+
/** The file changed since the caller read it. `hash` is what it holds now. */
|
|
61
|
+
var PoConfigConflictError = class extends Error {
|
|
62
|
+
filePath;
|
|
63
|
+
hash;
|
|
64
|
+
constructor(filePath, hash) {
|
|
65
|
+
super(`Po config at ${filePath} changed since it was read.`);
|
|
66
|
+
this.filePath = filePath;
|
|
67
|
+
this.hash = hash;
|
|
68
|
+
this.name = "PoConfigConflictError";
|
|
69
|
+
}
|
|
70
|
+
};
|
|
60
71
|
function isEmptyCollection(value) {
|
|
61
72
|
if (value === null || typeof value !== "object") return false;
|
|
62
73
|
const items = value.items;
|
|
@@ -106,7 +117,7 @@ async function readIfPresent(filePath) {
|
|
|
106
117
|
try {
|
|
107
118
|
return await fs.readFile(filePath, "utf8");
|
|
108
119
|
} catch (error) {
|
|
109
|
-
if (error instanceof Error && "code" in error && error.code === "ENOENT") return
|
|
120
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") return void 0;
|
|
110
121
|
throw error;
|
|
111
122
|
}
|
|
112
123
|
}
|
|
@@ -118,7 +129,12 @@ async function readIfPresent(filePath) {
|
|
|
118
129
|
async function writePoConfigValues(filePath, edits, options = {}) {
|
|
119
130
|
if (edits.length === 0) return;
|
|
120
131
|
await configWrites.forKey(path.resolve(filePath))(async () => {
|
|
121
|
-
const
|
|
132
|
+
const text = await readIfPresent(filePath);
|
|
133
|
+
if (options.expectedHash !== void 0) {
|
|
134
|
+
const hash = layerFromText(filePath, text).hash;
|
|
135
|
+
if (hash !== options.expectedHash) throw new PoConfigConflictError(filePath, hash);
|
|
136
|
+
}
|
|
137
|
+
const output = applyPoConfigEdits(text ?? "", filePath, edits, options);
|
|
122
138
|
const modes = modesForScope(options.scope ?? "host");
|
|
123
139
|
await fs.mkdir(path.dirname(filePath), {
|
|
124
140
|
mode: modes.directory,
|
|
@@ -158,7 +174,12 @@ async function unsetPoConfigValue(filePath, keyPath, options = {}) {
|
|
|
158
174
|
async function writePoConfigValuesAsync(fs, filePath, edits, context, options = {}) {
|
|
159
175
|
if (edits.length === 0) return;
|
|
160
176
|
await configWrites.forKey(path.resolve(filePath))(async () => {
|
|
161
|
-
const
|
|
177
|
+
const text = await readTextIfExists(fs, filePath, context);
|
|
178
|
+
if (options.expectedHash !== void 0) {
|
|
179
|
+
const hash = layerFromText(filePath, text).hash;
|
|
180
|
+
if (hash !== options.expectedHash) throw new PoConfigConflictError(filePath, hash);
|
|
181
|
+
}
|
|
182
|
+
const output = applyPoConfigEdits(text ?? "", filePath, edits, options);
|
|
162
183
|
const modes = modesForScope(options.scope ?? "host");
|
|
163
184
|
await createDirectoryWithMode(fs, path.dirname(filePath), modes.directory, context);
|
|
164
185
|
await writeFileAtomic(fs, filePath, output, context);
|
|
@@ -175,6 +196,6 @@ async function unsetPoConfigValueAsync(fs, filePath, keyPath, context, options =
|
|
|
175
196
|
await writePoConfigValuesAsync(fs, filePath, [{ keyPath }], context, options);
|
|
176
197
|
}
|
|
177
198
|
//#endregion
|
|
178
|
-
export { unsetPoConfigValue as a, setPoConfigValue as i, unsetPoConfigValueAsync as n, writePoConfigValues as o, writePoConfigValuesAsync as r, setPoConfigValueAsync as t };
|
|
199
|
+
export { unsetPoConfigValue as a, setPoConfigValue as i, unsetPoConfigValueAsync as n, writePoConfigValues as o, writePoConfigValuesAsync as r, PoConfigConflictError as s, setPoConfigValueAsync as t };
|
|
179
200
|
|
|
180
|
-
//# sourceMappingURL=configWriter-
|
|
201
|
+
//# sourceMappingURL=configWriter-BwscA6Rd.mjs.map
|