@agimon-ai/po-config 0.0.0-alpha.140 → 0.0.0-alpha.142

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.
Files changed (108) hide show
  1. package/dist/apiContracts.cjs +10 -4
  2. package/dist/apiContracts.cjs.map +1 -1
  3. package/dist/apiContracts.d.mts +2 -2
  4. package/dist/apiContracts.d.mts.map +1 -1
  5. package/dist/apiContracts.mjs +10 -4
  6. package/dist/apiContracts.mjs.map +1 -1
  7. package/dist/{config-CIdo5eB2.d.mts → config-Cg7egyk2.d.mts} +7 -3
  8. package/dist/{config-CIdo5eB2.d.mts.map → config-Cg7egyk2.d.mts.map} +1 -1
  9. package/dist/{config-YZTd0uSD.mjs → config-D-T8JjG-.mjs} +3 -3
  10. package/dist/{config-YZTd0uSD.mjs.map → config-D-T8JjG-.mjs.map} +1 -1
  11. package/dist/{config-WvSXEgXQ.cjs → config-D9rtLodC.cjs} +3 -3
  12. package/dist/{config-WvSXEgXQ.cjs.map → config-D9rtLodC.cjs.map} +1 -1
  13. package/dist/config.cjs +3 -3
  14. package/dist/config.d.mts +2 -2
  15. package/dist/config.mjs +3 -3
  16. package/dist/{configPolicy-DIYWpvHZ.mjs → configPolicy-BT71r27N.mjs} +25 -10
  17. package/dist/configPolicy-BT71r27N.mjs.map +1 -0
  18. package/dist/{configPolicy-BChyVz5d.cjs → configPolicy-W2seYFQB.cjs} +25 -10
  19. package/dist/configPolicy-W2seYFQB.cjs.map +1 -0
  20. package/dist/{configWriter-B5K3aPLm.mjs → configWriter-0WAnxrzI.mjs} +4 -4
  21. package/dist/configWriter-0WAnxrzI.mjs.map +1 -0
  22. package/dist/{configWriter-BdbDXvcs.cjs → configWriter-Czw7eAgL.cjs} +4 -4
  23. package/dist/configWriter-Czw7eAgL.cjs.map +1 -0
  24. package/dist/configWriter.cjs +1 -1
  25. package/dist/configWriter.d.mts +1 -1
  26. package/dist/configWriter.mjs +1 -1
  27. package/dist/{core-Cyysknc3.cjs → core-CbNA8nkH.cjs} +4 -4
  28. package/dist/{core-Cyysknc3.cjs.map → core-CbNA8nkH.cjs.map} +1 -1
  29. package/dist/{core-DWO9z4du.mjs → core-Cj4dpauK.mjs} +4 -4
  30. package/dist/{core-DWO9z4du.mjs.map → core-Cj4dpauK.mjs.map} +1 -1
  31. package/dist/{domains-D5M1H3rX.mjs → domains-CqaxkLc7.mjs} +4 -4
  32. package/dist/{domains-D5M1H3rX.mjs.map → domains-CqaxkLc7.mjs.map} +1 -1
  33. package/dist/{domains-Dg4YAym-.cjs → domains-DmDA8k57.cjs} +4 -4
  34. package/dist/{domains-Dg4YAym-.cjs.map → domains-DmDA8k57.cjs.map} +1 -1
  35. package/dist/domains.cjs +2 -2
  36. package/dist/domains.mjs +2 -2
  37. package/dist/extensions/server.cjs +3 -3
  38. package/dist/extensions/server.cjs.map +1 -1
  39. package/dist/extensions/server.mjs +3 -3
  40. package/dist/extensions/server.mjs.map +1 -1
  41. package/dist/harnessState.d.mts +1 -1
  42. package/dist/harnessStore.d.mts +1 -1
  43. package/dist/{index-BeBzQZ2y.d.mts → index-B00iPuJ3.d.mts} +4 -4
  44. package/dist/{index-BeBzQZ2y.d.mts.map → index-B00iPuJ3.d.mts.map} +1 -1
  45. package/dist/{index-UCsGES0Y.d.mts → index-C5Bj_IA6.d.mts} +2 -2
  46. package/dist/{index-UCsGES0Y.d.mts.map → index-C5Bj_IA6.d.mts.map} +1 -1
  47. package/dist/{index-D4-jvX59.d.mts → index-D272M5qh.d.mts} +3 -3
  48. package/dist/{index-D4-jvX59.d.mts.map → index-D272M5qh.d.mts.map} +1 -1
  49. package/dist/{index-q3hKP26Y.d.mts → index-DNEkm_mv.d.mts} +2 -2
  50. package/dist/{index-q3hKP26Y.d.mts.map → index-DNEkm_mv.d.mts.map} +1 -1
  51. package/dist/{index-COokUToB.d.mts → index-N_GmmWJz.d.mts} +3 -3
  52. package/dist/{index-COokUToB.d.mts.map → index-N_GmmWJz.d.mts.map} +1 -1
  53. package/dist/{index-lBhPxGYT.d.mts → index-kKiK2G4M.d.mts} +2 -2
  54. package/dist/{index-lBhPxGYT.d.mts.map → index-kKiK2G4M.d.mts.map} +1 -1
  55. package/dist/index-nVcEC1jO.d.mts.map +1 -1
  56. package/dist/index.cjs +11 -11
  57. package/dist/index.d.mts +7 -7
  58. package/dist/index.d.mts.map +1 -1
  59. package/dist/index.mjs +11 -11
  60. package/dist/{init-C9uAxDR8.mjs → init-CCsu-urm.mjs} +5 -3
  61. package/dist/init-CCsu-urm.mjs.map +1 -0
  62. package/dist/{init-C2h_5Wnd.cjs → init-DdL1o4ma.cjs} +5 -3
  63. package/dist/init-DdL1o4ma.cjs.map +1 -0
  64. package/dist/init.cjs +1 -1
  65. package/dist/init.mjs +1 -1
  66. package/dist/{layeredConfig-gg8cI8jj.mjs → layeredConfig-CFd2zP-e.mjs} +2 -2
  67. package/dist/{layeredConfig-gg8cI8jj.mjs.map → layeredConfig-CFd2zP-e.mjs.map} +1 -1
  68. package/dist/{layeredConfig-BwWQJbk8.cjs → layeredConfig-CVadM1mp.cjs} +2 -2
  69. package/dist/{layeredConfig-BwWQJbk8.cjs.map → layeredConfig-CVadM1mp.cjs.map} +1 -1
  70. package/dist/layeredConfig.cjs +1 -1
  71. package/dist/layeredConfig.mjs +1 -1
  72. package/dist/{majorModes-CBTXMJZb.mjs → majorModes-BIB20nid.mjs} +2 -2
  73. package/dist/{majorModes-CBTXMJZb.mjs.map → majorModes-BIB20nid.mjs.map} +1 -1
  74. package/dist/{majorModes-BmRJ4RvP.cjs → majorModes-DkXRF1aR.cjs} +2 -2
  75. package/dist/{majorModes-BmRJ4RvP.cjs.map → majorModes-DkXRF1aR.cjs.map} +1 -1
  76. package/dist/majorModes.cjs +1 -1
  77. package/dist/majorModes.d.mts +1 -1
  78. package/dist/majorModes.mjs +1 -1
  79. package/dist/piContext.cjs +1 -1
  80. package/dist/piContext.d.mts +2 -2
  81. package/dist/piContext.mjs +1 -1
  82. package/dist/{profiles-fcR7TAmA.mjs → profiles-Bv5Oyyxp.mjs} +2 -2
  83. package/dist/{profiles-fcR7TAmA.mjs.map → profiles-Bv5Oyyxp.mjs.map} +1 -1
  84. package/dist/{profiles-q6C39HtK.cjs → profiles-n88OwAUH.cjs} +2 -2
  85. package/dist/{profiles-q6C39HtK.cjs.map → profiles-n88OwAUH.cjs.map} +1 -1
  86. package/dist/profiles.cjs +1 -1
  87. package/dist/profiles.mjs +1 -1
  88. package/dist/selectionSwitch.cjs +2 -2
  89. package/dist/selectionSwitch.d.mts +2 -2
  90. package/dist/selectionSwitch.mjs +2 -2
  91. package/dist/{sessionConfig-DDpiIhIL.cjs → sessionConfig-CyrLXPYv.cjs} +2 -2
  92. package/dist/{sessionConfig-DDpiIhIL.cjs.map → sessionConfig-CyrLXPYv.cjs.map} +1 -1
  93. package/dist/{sessionConfig-DB-c4mPl.mjs → sessionConfig-eyKx-_JP.mjs} +2 -2
  94. package/dist/{sessionConfig-DB-c4mPl.mjs.map → sessionConfig-eyKx-_JP.mjs.map} +1 -1
  95. package/dist/{settingsApi-CY5Lq55P.mjs → settingsApi-BC7F4Jgk.mjs} +77 -18
  96. package/dist/settingsApi-BC7F4Jgk.mjs.map +1 -0
  97. package/dist/{settingsApi-Bkgsqc4V.cjs → settingsApi-CE9IH3Ps.cjs} +77 -18
  98. package/dist/settingsApi-CE9IH3Ps.cjs.map +1 -0
  99. package/dist/types.d.mts +1 -1
  100. package/package.json +5 -5
  101. package/dist/configPolicy-BChyVz5d.cjs.map +0 -1
  102. package/dist/configPolicy-DIYWpvHZ.mjs.map +0 -1
  103. package/dist/configWriter-B5K3aPLm.mjs.map +0 -1
  104. package/dist/configWriter-BdbDXvcs.cjs.map +0 -1
  105. package/dist/init-C2h_5Wnd.cjs.map +0 -1
  106. package/dist/init-C9uAxDR8.mjs.map +0 -1
  107. package/dist/settingsApi-Bkgsqc4V.cjs.map +0 -1
  108. package/dist/settingsApi-CY5Lq55P.mjs.map +0 -1
@@ -10,6 +10,11 @@ const Optional = typebox.Type.Optional;
10
10
  const Strings = typebox.Type.Array(Text);
11
11
  const NullableText = typebox.Type.Union([Text, typebox.Type.Null()]);
12
12
  const Scope = typebox.Type.Union([typebox.Type.Literal("global"), typebox.Type.Literal("repository")]);
13
+ const RequestScope = typebox.Type.Union([
14
+ typebox.Type.Literal("host"),
15
+ typebox.Type.Literal("global"),
16
+ typebox.Type.Literal("repository")
17
+ ]);
13
18
  const Origin = typebox.Type.Union([
14
19
  typebox.Type.Literal("global"),
15
20
  typebox.Type.Literal("repository"),
@@ -18,6 +23,7 @@ const Origin = typebox.Type.Union([
18
23
  const SettingsConfigSchema = typebox.Type.Object({
19
24
  repoRoot: Text,
20
25
  hashes: typebox.Type.Object({
26
+ host: Text,
21
27
  global: Text,
22
28
  repository: Text
23
29
  }),
@@ -37,12 +43,12 @@ const SettingsEditSchema = typebox.Type.Object({
37
43
  });
38
44
  const SettingsWriteSchema = typebox.Type.Union([typebox.Type.Object({
39
45
  repoRoot: Text,
40
- scope: Scope,
46
+ scope: RequestScope,
41
47
  ...SettingsEditSchema.properties,
42
48
  expectedHash: Text
43
49
  }), typebox.Type.Object({
44
50
  repoRoot: Text,
45
- scope: Scope,
51
+ scope: RequestScope,
46
52
  edits: typebox.Type.Array(SettingsEditSchema, {
47
53
  minItems: 1,
48
54
  maxItems: 100
@@ -100,7 +106,7 @@ const Images = typebox.Type.Object({
100
106
  minDimension: typebox.Type.Number(),
101
107
  maxAllowedDimension: typebox.Type.Number()
102
108
  });
103
- const http = ["global", "workspace"].flatMap((scope) => {
109
+ const http = ["host", "workspace"].flatMap((scope) => {
104
110
  const common = {
105
111
  scope,
106
112
  basePath: "settings",
@@ -165,7 +171,7 @@ const http = ["global", "workspace"].flatMap((scope) => {
165
171
  },
166
172
  responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(RepositorySettingsSchema)
167
173
  },
168
- ...scope === "global" ? [{
174
+ ...scope === "host" ? [{
169
175
  ...common,
170
176
  id: "images.get",
171
177
  path: "/images",
@@ -1 +1 @@
1
- {"version":3,"file":"apiContracts.cjs","names":["Type","jsonApiResponses","defineApiContract"],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract, jsonApiResponses, type PoHttpContract } from '@agimon-ai/po-core/apiContracts';\nimport { Type } from 'typebox';\n\nconst Text = Type.String();\nconst Optional = Type.Optional;\nconst Strings = Type.Array(Text);\nconst NullableText = Type.Union([Text, Type.Null()]);\nconst Scope = Type.Union([Type.Literal('global'), Type.Literal('repository')]);\nconst Origin = Type.Union([Type.Literal('global'), Type.Literal('repository'), Type.Literal('default')]);\nexport const SettingsConfigSchema = Type.Object({\n repoRoot: Text,\n hashes: Type.Object({ global: Text, repository: Text }),\n values: Type.Record(\n Text,\n Type.Object({\n value: Optional(Text),\n origin: Origin,\n scope: Type.Union([Scope, Type.Literal('both')]),\n }),\n ),\n});\nconst SettingsEditSchema = Type.Object({ keyPath: Strings, value: Type.Union([Text, Type.Number(), Type.Null()]) });\nexport const SettingsWriteSchema = Type.Union([\n Type.Object({ repoRoot: Text, scope: Scope, ...SettingsEditSchema.properties, expectedHash: Text }),\n Type.Object({\n repoRoot: Text,\n scope: Scope,\n edits: Type.Array(SettingsEditSchema, { minItems: 1, maxItems: 100 }),\n expectedHash: Text,\n }),\n]);\n\nconst Repository = Type.Object({ id: Text, name: Text, path: Text, active: Type.Boolean() });\nconst Catalog = Type.Array(\n Type.Object({ name: Text, description: Optional(Text), expandsTo: Optional(Strings), layers: Optional(Strings) }),\n);\nconst SelectionText = Type.Object({ effective: Optional(Text), repository: Optional(Text), origin: Origin });\nconst SelectionStrings = Type.Object({ effective: Optional(Strings), repository: Optional(Strings), origin: Origin });\nexport const RepositorySettingsSchema = Type.Object({\n repository: Repository,\n hash: Text,\n catalogs: Type.Object({ majorModes: Catalog, domains: Catalog, profiles: Catalog }),\n selection: Type.Object({ majorMode: SelectionText, domains: SelectionStrings, profile: SelectionText }),\n});\nexport const RepositorySelectionWriteSchema = Type.Object({\n repositoryId: Text,\n expectedHash: Text,\n changes: Type.Object({\n majorMode: Optional(NullableText),\n domains: Optional(Type.Union([Strings, Type.Null()])),\n profile: Optional(NullableText),\n }),\n});\nconst Images = Type.Object({\n autoResize: Type.Boolean(),\n maxDimension: Type.Number(),\n minDimension: Type.Number(),\n maxAllowedDimension: Type.Number(),\n});\nconst http: PoHttpContract[] = (['global', 'workspace'] as const).flatMap((scope) => {\n const common = { scope, basePath: 'settings', authentication: 'owner' as const };\n return [\n {\n ...common,\n id: 'config',\n path: '/',\n method: 'GET',\n description: 'Read selected settings keys and file hashes.',\n parameters: [{ name: 'key', in: 'query', required: false, schema: Strings }],\n responses: jsonApiResponses(SettingsConfigSchema),\n },\n {\n ...common,\n id: 'value',\n path: '/value',\n method: 'PUT',\n description: 'Write a setting with an optimistic file hash.',\n body: { contentType: 'application/json', required: true, schema: SettingsWriteSchema },\n responses: jsonApiResponses(SettingsConfigSchema),\n },\n {\n ...common,\n id: 'repositories',\n path: '/repositories',\n method: 'GET',\n description: 'List admitted repositories.',\n responses: jsonApiResponses(Type.Object({ repositories: Type.Array(Repository) })),\n },\n {\n ...common,\n id: 'repository',\n path: '/repository',\n method: 'GET',\n description: 'Read the mounted workspace catalog and selection.',\n availability: 'Requires a workspace mount; global returns 404.',\n responses: jsonApiResponses(RepositorySettingsSchema),\n },\n {\n ...common,\n id: 'selection',\n path: '/repository/selection',\n method: 'PUT',\n description: 'Update the mounted workspace selection.',\n availability: 'Requires a workspace mount; global returns 404.',\n body: { contentType: 'application/json', required: true, schema: RepositorySelectionWriteSchema },\n responses: jsonApiResponses(RepositorySettingsSchema),\n },\n ...(scope === 'global'\n ? [\n {\n ...common,\n id: 'images.get',\n path: '/images',\n method: 'GET' as const,\n description: 'Read image resizing limits.',\n responses: jsonApiResponses(Images),\n },\n {\n ...common,\n id: 'images.put',\n path: '/images',\n method: 'PUT' as const,\n description: 'Update image resizing settings; dimensions are clamped.',\n body: {\n contentType: 'application/json',\n required: true,\n schema: Type.Object({ autoResize: Optional(Type.Boolean()), maxDimension: Optional(Type.Number()) }),\n },\n responses: jsonApiResponses(Images),\n },\n ]\n : []),\n ] satisfies PoHttpContract[];\n});\nexport const apiContracts = defineApiContract({ version: 1, http, sockets: [], dynamic: [] });\nexport default apiContracts;\n"],"mappings":";;;;;;;AAGA,MAAM,OAAOA,QAAAA,KAAK,OAAO;AACzB,MAAM,WAAWA,QAAAA,KAAK;AACtB,MAAM,UAAUA,QAAAA,KAAK,MAAM,IAAI;AAC/B,MAAM,eAAeA,QAAAA,KAAK,MAAM,CAAC,MAAMA,QAAAA,KAAK,KAAK,CAAC,CAAC;AACnD,MAAM,QAAQA,QAAAA,KAAK,MAAM,CAACA,QAAAA,KAAK,QAAQ,QAAQ,GAAGA,QAAAA,KAAK,QAAQ,YAAY,CAAC,CAAC;AAC7E,MAAM,SAASA,QAAAA,KAAK,MAAM;CAACA,QAAAA,KAAK,QAAQ,QAAQ;CAAGA,QAAAA,KAAK,QAAQ,YAAY;CAAGA,QAAAA,KAAK,QAAQ,SAAS;AAAC,CAAC;AACvG,MAAa,uBAAuBA,QAAAA,KAAK,OAAO;CAC9C,UAAU;CACV,QAAQA,QAAAA,KAAK,OAAO;EAAE,QAAQ;EAAM,YAAY;CAAK,CAAC;CACtD,QAAQA,QAAAA,KAAK,OACX,MACAA,QAAAA,KAAK,OAAO;EACV,OAAO,SAAS,IAAI;EACpB,QAAQ;EACR,OAAOA,QAAAA,KAAK,MAAM,CAAC,OAAOA,QAAAA,KAAK,QAAQ,MAAM,CAAC,CAAC;CACjD,CAAC,CACH;AACF,CAAC;AACD,MAAM,qBAAqBA,QAAAA,KAAK,OAAO;CAAE,SAAS;CAAS,OAAOA,QAAAA,KAAK,MAAM;EAAC;EAAMA,QAAAA,KAAK,OAAO;EAAGA,QAAAA,KAAK,KAAK;CAAC,CAAC;AAAE,CAAC;AAClH,MAAa,sBAAsBA,QAAAA,KAAK,MAAM,CAC5CA,QAAAA,KA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AG;GACH,IAAI;GACJ,MAAM;GACN,QAAQ;GACR,aAAa;GACb,YAAA,GAAWA,gCAAAA,iBAAAA,CAAiB,MAAM;EACpC,GACA;GACE,GAAG;GACH,IAAI;GACJ,MAAM;GACN,QAAQ;GACR,aAAa;GACb,MAAM;IACJ,aAAa;IACb,UAAU;IACV,QAAQD,QAAAA,KAAK,OAAO;KAAE,YAAY,SAASA,QAAAA,KAAK,QAAQ,CAAC;KAAG,cAAc,SAASA,QAAAA,KAAK,OAAO,CAAC;IAAE,CAAC;GACrG;GACA,YAAA,GAAWC,gCAAAA,iBAAAA,CAAiB,MAAM;EACpC,CACF,IACA,CAAC;CACP;AACF,CAAC;AACD,MAAa,gBAAA,GAAeC,gCAAAA,kBAAAA,CAAkB;CAAE,SAAS;CAAG;CAAM,SAAS,CAAC;CAAG,SAAS,CAAC;AAAE,CAAC"}
1
+ {"version":3,"file":"apiContracts.cjs","names":["Type","jsonApiResponses","defineApiContract"],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract, jsonApiResponses, type PoHttpContract } from '@agimon-ai/po-core/apiContracts';\nimport { Type } from 'typebox';\n\nconst Text = Type.String();\nconst Optional = Type.Optional;\nconst Strings = Type.Array(Text);\nconst NullableText = Type.Union([Text, Type.Null()]);\n// ponytail: the wire spells the host tier 'global' until Phase 10; requests may also say 'host'.\nconst Scope = Type.Union([Type.Literal('global'), Type.Literal('repository')]);\nconst RequestScope = Type.Union([Type.Literal('host'), Type.Literal('global'), Type.Literal('repository')]);\nconst Origin = Type.Union([Type.Literal('global'), Type.Literal('repository'), Type.Literal('default')]);\nexport const SettingsConfigSchema = Type.Object({\n repoRoot: Text,\n // ponytail: `global` duplicates `host` for older clients until Phase 10.\n hashes: Type.Object({ host: Text, global: Text, repository: Text }),\n values: Type.Record(\n Text,\n Type.Object({\n value: Optional(Text),\n origin: Origin,\n scope: Type.Union([Scope, Type.Literal('both')]),\n }),\n ),\n});\nconst SettingsEditSchema = Type.Object({ keyPath: Strings, value: Type.Union([Text, Type.Number(), Type.Null()]) });\nexport const SettingsWriteSchema = Type.Union([\n Type.Object({ repoRoot: Text, scope: RequestScope, ...SettingsEditSchema.properties, expectedHash: Text }),\n Type.Object({\n repoRoot: Text,\n scope: RequestScope,\n edits: Type.Array(SettingsEditSchema, { minItems: 1, maxItems: 100 }),\n expectedHash: Text,\n }),\n]);\n\nconst Repository = Type.Object({ id: Text, name: Text, path: Text, active: Type.Boolean() });\nconst Catalog = Type.Array(\n Type.Object({ name: Text, description: Optional(Text), expandsTo: Optional(Strings), layers: Optional(Strings) }),\n);\nconst SelectionText = Type.Object({ effective: Optional(Text), repository: Optional(Text), origin: Origin });\nconst SelectionStrings = Type.Object({ effective: Optional(Strings), repository: Optional(Strings), origin: Origin });\nexport const RepositorySettingsSchema = Type.Object({\n repository: Repository,\n hash: Text,\n catalogs: Type.Object({ majorModes: Catalog, domains: Catalog, profiles: Catalog }),\n selection: Type.Object({ majorMode: SelectionText, domains: SelectionStrings, profile: SelectionText }),\n});\nexport const RepositorySelectionWriteSchema = Type.Object({\n repositoryId: Text,\n expectedHash: Text,\n changes: Type.Object({\n majorMode: Optional(NullableText),\n domains: Optional(Type.Union([Strings, Type.Null()])),\n profile: Optional(NullableText),\n }),\n});\nconst Images = Type.Object({\n autoResize: Type.Boolean(),\n maxDimension: Type.Number(),\n minDimension: Type.Number(),\n maxAllowedDimension: Type.Number(),\n});\nconst http: PoHttpContract[] = (['host', 'workspace'] as const).flatMap((scope) => {\n const common = { scope, basePath: 'settings', authentication: 'owner' as const };\n return [\n {\n ...common,\n id: 'config',\n path: '/',\n method: 'GET',\n description: 'Read selected settings keys and file hashes.',\n parameters: [{ name: 'key', in: 'query', required: false, schema: Strings }],\n responses: jsonApiResponses(SettingsConfigSchema),\n },\n {\n ...common,\n id: 'value',\n path: '/value',\n method: 'PUT',\n description: 'Write a setting with an optimistic file hash.',\n body: { contentType: 'application/json', required: true, schema: SettingsWriteSchema },\n responses: jsonApiResponses(SettingsConfigSchema),\n },\n {\n ...common,\n id: 'repositories',\n path: '/repositories',\n method: 'GET',\n description: 'List admitted repositories.',\n responses: jsonApiResponses(Type.Object({ repositories: Type.Array(Repository) })),\n },\n {\n ...common,\n id: 'repository',\n path: '/repository',\n method: 'GET',\n description: 'Read the mounted workspace catalog and selection.',\n availability: 'Requires a workspace mount; global returns 404.',\n responses: jsonApiResponses(RepositorySettingsSchema),\n },\n {\n ...common,\n id: 'selection',\n path: '/repository/selection',\n method: 'PUT',\n description: 'Update the mounted workspace selection.',\n availability: 'Requires a workspace mount; global returns 404.',\n body: { contentType: 'application/json', required: true, schema: RepositorySelectionWriteSchema },\n responses: jsonApiResponses(RepositorySettingsSchema),\n },\n ...(scope === 'host'\n ? [\n {\n ...common,\n id: 'images.get',\n path: '/images',\n method: 'GET' as const,\n description: 'Read image resizing limits.',\n responses: jsonApiResponses(Images),\n },\n {\n ...common,\n id: 'images.put',\n path: '/images',\n method: 'PUT' as const,\n description: 'Update image resizing settings; dimensions are clamped.',\n body: {\n contentType: 'application/json',\n required: true,\n schema: Type.Object({ autoResize: Optional(Type.Boolean()), maxDimension: Optional(Type.Number()) }),\n },\n responses: jsonApiResponses(Images),\n },\n ]\n : []),\n ] satisfies PoHttpContract[];\n});\nexport const apiContracts = defineApiContract({ version: 1, http, sockets: [], dynamic: [] });\nexport default apiContracts;\n"],"mappings":";;;;;;;AAGA,MAAM,OAAOA,QAAAA,KAAK,OAAO;AACzB,MAAM,WAAWA,QAAAA,KAAK;AACtB,MAAM,UAAUA,QAAAA,KAAK,MAAM,IAAI;AAC/B,MAAM,eAAeA,QAAAA,KAAK,MAAM,CAAC,MAAMA,QAAAA,KAAK,KAAK,CAAC,CAAC;AAEnD,MAAM,QAAQA,QAAAA,KAAK,MAAM,CAACA,QAAAA,KAAK,QAAQ,QAAQ,GAAGA,QAAAA,KAAK,QAAQ,YAAY,CAAC,CAAC;AAC7E,MAAM,eAAeA,QAAAA,KAAK,MAAM;CAACA,QAAAA,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,CAAC;AACD,MAAa,gBAAA,GAAeC,gCAAAA,kBAAAA,CAAkB;CAAE,SAAS;CAAG;CAAM,SAAS,CAAC;CAAG,SAAS,CAAC;AAAE,CAAC"}
@@ -6,7 +6,7 @@ export declare const apiContracts: {
6
6
  schemas?: Record<string, boolean | object> | undefined;
7
7
  http: {
8
8
  id: string;
9
- scope: "global" | "session" | "workspace";
9
+ scope: "host" | "session" | "workspace";
10
10
  basePath?: string | undefined;
11
11
  path: string;
12
12
  method: "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT";
@@ -34,7 +34,7 @@ export declare const apiContracts: {
34
34
  }[];
35
35
  sockets: {
36
36
  id: string;
37
- scope: "global" | "session" | "workspace";
37
+ scope: "host" | "session" | "workspace";
38
38
  description: string;
39
39
  availability?: string | undefined;
40
40
  service: string;
@@ -1 +1 @@
1
- {"version":3,"file":"apiContracts.d.mts","names":[],"sources":["../src/schemas/apiContracts.ts"],"mappings":";;qBAsIa"}
1
+ {"version":3,"file":"apiContracts.d.mts","names":[],"sources":["../src/schemas/apiContracts.ts"],"mappings":";;qBAyIa"}
@@ -6,6 +6,11 @@ const Optional = Type.Optional;
6
6
  const Strings = Type.Array(Text);
7
7
  const NullableText = Type.Union([Text, Type.Null()]);
8
8
  const Scope = Type.Union([Type.Literal("global"), Type.Literal("repository")]);
9
+ const RequestScope = Type.Union([
10
+ Type.Literal("host"),
11
+ Type.Literal("global"),
12
+ Type.Literal("repository")
13
+ ]);
9
14
  const Origin = Type.Union([
10
15
  Type.Literal("global"),
11
16
  Type.Literal("repository"),
@@ -14,6 +19,7 @@ const Origin = Type.Union([
14
19
  const SettingsConfigSchema = Type.Object({
15
20
  repoRoot: Text,
16
21
  hashes: Type.Object({
22
+ host: Text,
17
23
  global: Text,
18
24
  repository: Text
19
25
  }),
@@ -33,12 +39,12 @@ const SettingsEditSchema = Type.Object({
33
39
  });
34
40
  const SettingsWriteSchema = Type.Union([Type.Object({
35
41
  repoRoot: Text,
36
- scope: Scope,
42
+ scope: RequestScope,
37
43
  ...SettingsEditSchema.properties,
38
44
  expectedHash: Text
39
45
  }), Type.Object({
40
46
  repoRoot: Text,
41
- scope: Scope,
47
+ scope: RequestScope,
42
48
  edits: Type.Array(SettingsEditSchema, {
43
49
  minItems: 1,
44
50
  maxItems: 100
@@ -96,7 +102,7 @@ const Images = Type.Object({
96
102
  minDimension: Type.Number(),
97
103
  maxAllowedDimension: Type.Number()
98
104
  });
99
- const http = ["global", "workspace"].flatMap((scope) => {
105
+ const http = ["host", "workspace"].flatMap((scope) => {
100
106
  const common = {
101
107
  scope,
102
108
  basePath: "settings",
@@ -161,7 +167,7 @@ const http = ["global", "workspace"].flatMap((scope) => {
161
167
  },
162
168
  responses: jsonApiResponses(RepositorySettingsSchema)
163
169
  },
164
- ...scope === "global" ? [{
170
+ ...scope === "host" ? [{
165
171
  ...common,
166
172
  id: "images.get",
167
173
  path: "/images",
@@ -1 +1 @@
1
- {"version":3,"file":"apiContracts.mjs","names":[],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract, jsonApiResponses, type PoHttpContract } from '@agimon-ai/po-core/apiContracts';\nimport { Type } from 'typebox';\n\nconst Text = Type.String();\nconst Optional = Type.Optional;\nconst Strings = Type.Array(Text);\nconst NullableText = Type.Union([Text, Type.Null()]);\nconst Scope = Type.Union([Type.Literal('global'), Type.Literal('repository')]);\nconst Origin = Type.Union([Type.Literal('global'), Type.Literal('repository'), Type.Literal('default')]);\nexport const SettingsConfigSchema = Type.Object({\n repoRoot: Text,\n hashes: Type.Object({ global: Text, repository: Text }),\n values: Type.Record(\n Text,\n Type.Object({\n value: Optional(Text),\n origin: Origin,\n scope: Type.Union([Scope, Type.Literal('both')]),\n }),\n ),\n});\nconst SettingsEditSchema = Type.Object({ keyPath: Strings, value: Type.Union([Text, Type.Number(), Type.Null()]) });\nexport const SettingsWriteSchema = Type.Union([\n Type.Object({ repoRoot: Text, scope: Scope, ...SettingsEditSchema.properties, expectedHash: Text }),\n Type.Object({\n repoRoot: Text,\n scope: Scope,\n edits: Type.Array(SettingsEditSchema, { minItems: 1, maxItems: 100 }),\n expectedHash: Text,\n }),\n]);\n\nconst Repository = Type.Object({ id: Text, name: Text, path: Text, active: Type.Boolean() });\nconst Catalog = Type.Array(\n Type.Object({ name: Text, description: Optional(Text), expandsTo: Optional(Strings), layers: Optional(Strings) }),\n);\nconst SelectionText = Type.Object({ effective: Optional(Text), repository: Optional(Text), origin: Origin });\nconst SelectionStrings = Type.Object({ effective: Optional(Strings), repository: Optional(Strings), origin: Origin });\nexport const RepositorySettingsSchema = Type.Object({\n repository: Repository,\n hash: Text,\n catalogs: Type.Object({ majorModes: Catalog, domains: Catalog, profiles: Catalog }),\n selection: Type.Object({ majorMode: SelectionText, domains: SelectionStrings, profile: SelectionText }),\n});\nexport const RepositorySelectionWriteSchema = Type.Object({\n repositoryId: Text,\n expectedHash: Text,\n changes: Type.Object({\n majorMode: Optional(NullableText),\n domains: Optional(Type.Union([Strings, Type.Null()])),\n profile: Optional(NullableText),\n }),\n});\nconst Images = Type.Object({\n autoResize: Type.Boolean(),\n maxDimension: Type.Number(),\n minDimension: Type.Number(),\n maxAllowedDimension: Type.Number(),\n});\nconst http: PoHttpContract[] = (['global', 'workspace'] as const).flatMap((scope) => {\n const common = { scope, basePath: 'settings', authentication: 'owner' as const };\n return [\n {\n ...common,\n id: 'config',\n path: '/',\n method: 'GET',\n description: 'Read selected settings keys and file hashes.',\n parameters: [{ name: 'key', in: 'query', required: false, schema: Strings }],\n responses: jsonApiResponses(SettingsConfigSchema),\n },\n {\n ...common,\n id: 'value',\n path: '/value',\n method: 'PUT',\n description: 'Write a setting with an optimistic file hash.',\n body: { contentType: 'application/json', required: true, schema: SettingsWriteSchema },\n responses: jsonApiResponses(SettingsConfigSchema),\n },\n {\n ...common,\n id: 'repositories',\n path: '/repositories',\n method: 'GET',\n description: 'List admitted repositories.',\n responses: jsonApiResponses(Type.Object({ repositories: Type.Array(Repository) })),\n },\n {\n ...common,\n id: 'repository',\n path: '/repository',\n method: 'GET',\n description: 'Read the mounted workspace catalog and selection.',\n availability: 'Requires a workspace mount; global returns 404.',\n responses: jsonApiResponses(RepositorySettingsSchema),\n },\n {\n ...common,\n id: 'selection',\n path: '/repository/selection',\n method: 'PUT',\n description: 'Update the mounted workspace selection.',\n availability: 'Requires a workspace mount; global returns 404.',\n body: { contentType: 'application/json', required: true, schema: RepositorySelectionWriteSchema },\n responses: jsonApiResponses(RepositorySettingsSchema),\n },\n ...(scope === 'global'\n ? [\n {\n ...common,\n id: 'images.get',\n path: '/images',\n method: 'GET' as const,\n description: 'Read image resizing limits.',\n responses: jsonApiResponses(Images),\n },\n {\n ...common,\n id: 'images.put',\n path: '/images',\n method: 'PUT' as const,\n description: 'Update image resizing settings; dimensions are clamped.',\n body: {\n contentType: 'application/json',\n required: true,\n schema: Type.Object({ autoResize: Optional(Type.Boolean()), maxDimension: Optional(Type.Number()) }),\n },\n responses: jsonApiResponses(Images),\n },\n ]\n : []),\n ] satisfies PoHttpContract[];\n});\nexport const apiContracts = defineApiContract({ version: 1, http, sockets: [], dynamic: [] });\nexport default apiContracts;\n"],"mappings":";;;AAGA,MAAM,OAAO,KAAK,OAAO;AACzB,MAAM,WAAW,KAAK;AACtB,MAAM,UAAU,KAAK,MAAM,IAAI;AAC/B,MAAM,eAAe,KAAK,MAAM,CAAC,MAAM,KAAK,KAAK,CAAC,CAAC;AACnD,MAAM,QAAQ,KAAK,MAAM,CAAC,KAAK,QAAQ,QAAQ,GAAG,KAAK,QAAQ,YAAY,CAAC,CAAC;AAC7E,MAAM,SAAS,KAAK,MAAM;CAAC,KAAK,QAAQ,QAAQ;CAAG,KAAK,QAAQ,YAAY;CAAG,KAAK,QAAQ,SAAS;AAAC,CAAC;AACvG,MAAa,uBAAuB,KAAK,OAAO;CAC9C,UAAU;CACV,QAAQ,KAAK,OAAO;EAAE,QAAQ;EAAM,YAAY;CAAK,CAAC;CACtD,QAAQ,K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ACtD;EACA,GAAI,UAAU,WACV,CACE;GACE,GAAG;GACH,IAAI;GACJ,MAAM;GACN,QAAQ;GACR,aAAa;GACb,WAAW,iBAAiB,MAAM;EACpC,GACA;GACE,GAAG;GACH,IAAI;GACJ,MAAM;GACN,QAAQ;GACR,aAAa;GACb,MAAM;IACJ,aAAa;IACb,UAAU;IACV,QAAQ,KAAK,OAAO;KAAE,YAAY,SAAS,KAAK,QAAQ,CAAC;KAAG,cAAc,SAAS,KAAK,OAAO,CAAC;IAAE,CAAC;GACrG;GACA,WAAW,iBAAiB,MAAM;EACpC,CACF,IACA,CAAC;CACP;AACF,CAAC;AACD,MAAa,eAAe,kBAAkB;CAAE,SAAS;CAAG;CAAM,SAAS,CAAC;CAAG,SAAS,CAAC;AAAE,CAAC"}
1
+ {"version":3,"file":"apiContracts.mjs","names":[],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract, jsonApiResponses, type PoHttpContract } from '@agimon-ai/po-core/apiContracts';\nimport { Type } from 'typebox';\n\nconst Text = Type.String();\nconst Optional = Type.Optional;\nconst Strings = Type.Array(Text);\nconst NullableText = Type.Union([Text, Type.Null()]);\n// ponytail: the wire spells the host tier 'global' until Phase 10; requests may also say 'host'.\nconst Scope = Type.Union([Type.Literal('global'), Type.Literal('repository')]);\nconst RequestScope = Type.Union([Type.Literal('host'), Type.Literal('global'), Type.Literal('repository')]);\nconst Origin = Type.Union([Type.Literal('global'), Type.Literal('repository'), Type.Literal('default')]);\nexport const SettingsConfigSchema = Type.Object({\n repoRoot: Text,\n // ponytail: `global` duplicates `host` for older clients until Phase 10.\n hashes: Type.Object({ host: Text, global: Text, repository: Text }),\n values: Type.Record(\n Text,\n Type.Object({\n value: Optional(Text),\n origin: Origin,\n scope: Type.Union([Scope, Type.Literal('both')]),\n }),\n ),\n});\nconst SettingsEditSchema = Type.Object({ keyPath: Strings, value: Type.Union([Text, Type.Number(), Type.Null()]) });\nexport const SettingsWriteSchema = Type.Union([\n Type.Object({ repoRoot: Text, scope: RequestScope, ...SettingsEditSchema.properties, expectedHash: Text }),\n Type.Object({\n repoRoot: Text,\n scope: RequestScope,\n edits: Type.Array(SettingsEditSchema, { minItems: 1, maxItems: 100 }),\n expectedHash: Text,\n }),\n]);\n\nconst Repository = Type.Object({ id: Text, name: Text, path: Text, active: Type.Boolean() });\nconst Catalog = Type.Array(\n Type.Object({ name: Text, description: Optional(Text), expandsTo: Optional(Strings), layers: Optional(Strings) }),\n);\nconst SelectionText = Type.Object({ effective: Optional(Text), repository: Optional(Text), origin: Origin });\nconst SelectionStrings = Type.Object({ effective: Optional(Strings), repository: Optional(Strings), origin: Origin });\nexport const RepositorySettingsSchema = Type.Object({\n repository: Repository,\n hash: Text,\n catalogs: Type.Object({ majorModes: Catalog, domains: Catalog, profiles: Catalog }),\n selection: Type.Object({ majorMode: SelectionText, domains: SelectionStrings, profile: SelectionText }),\n});\nexport const RepositorySelectionWriteSchema = Type.Object({\n repositoryId: Text,\n expectedHash: Text,\n changes: Type.Object({\n majorMode: Optional(NullableText),\n domains: Optional(Type.Union([Strings, Type.Null()])),\n profile: Optional(NullableText),\n }),\n});\nconst Images = Type.Object({\n autoResize: Type.Boolean(),\n maxDimension: Type.Number(),\n minDimension: Type.Number(),\n maxAllowedDimension: Type.Number(),\n});\nconst http: PoHttpContract[] = (['host', 'workspace'] as const).flatMap((scope) => {\n const common = { scope, basePath: 'settings', authentication: 'owner' as const };\n return [\n {\n ...common,\n id: 'config',\n path: '/',\n method: 'GET',\n description: 'Read selected settings keys and file hashes.',\n parameters: [{ name: 'key', in: 'query', required: false, schema: Strings }],\n responses: jsonApiResponses(SettingsConfigSchema),\n },\n {\n ...common,\n id: 'value',\n path: '/value',\n method: 'PUT',\n description: 'Write a setting with an optimistic file hash.',\n body: { contentType: 'application/json', required: true, schema: SettingsWriteSchema },\n responses: jsonApiResponses(SettingsConfigSchema),\n },\n {\n ...common,\n id: 'repositories',\n path: '/repositories',\n method: 'GET',\n description: 'List admitted repositories.',\n responses: jsonApiResponses(Type.Object({ repositories: Type.Array(Repository) })),\n },\n {\n ...common,\n id: 'repository',\n path: '/repository',\n method: 'GET',\n description: 'Read the mounted workspace catalog and selection.',\n availability: 'Requires a workspace mount; global returns 404.',\n responses: jsonApiResponses(RepositorySettingsSchema),\n },\n {\n ...common,\n id: 'selection',\n path: '/repository/selection',\n method: 'PUT',\n description: 'Update the mounted workspace selection.',\n availability: 'Requires a workspace mount; global returns 404.',\n body: { contentType: 'application/json', required: true, schema: RepositorySelectionWriteSchema },\n responses: jsonApiResponses(RepositorySettingsSchema),\n },\n ...(scope === 'host'\n ? [\n {\n ...common,\n id: 'images.get',\n path: '/images',\n method: 'GET' as const,\n description: 'Read image resizing limits.',\n responses: jsonApiResponses(Images),\n },\n {\n ...common,\n id: 'images.put',\n path: '/images',\n method: 'PUT' as const,\n description: 'Update image resizing settings; dimensions are clamped.',\n body: {\n contentType: 'application/json',\n required: true,\n schema: Type.Object({ autoResize: Optional(Type.Boolean()), maxDimension: Optional(Type.Number()) }),\n },\n responses: jsonApiResponses(Images),\n },\n ]\n : []),\n ] satisfies PoHttpContract[];\n});\nexport const apiContracts = defineApiContract({ version: 1, http, sockets: [], dynamic: [] });\nexport default apiContracts;\n"],"mappings":";;;AAGA,MAAM,OAAO,KAAK,OAAO;AACzB,MAAM,WAAW,KAAK;AACtB,MAAM,UAAU,KAAK,MAAM,IAAI;AAC/B,MAAM,eAAe,KAAK,MAAM,CAAC,MAAM,KAAK,KAAK,CAAC,CAAC;AAEnD,MAAM,QAAQ,KAAK,MAAM,CAAC,KAAK,QAAQ,QAAQ,GAAG,KAAK,QAAQ,YAAY,CAAC,CAAC;AAC7E,MAAM,eAAe,KAAK,MAAM;CAAC,KAAK,QAAQ,MAAM;CAAG,KAAK,QAAQ,QAAQ;CAAG,KAAK,QAAQ,YAAY;AAAC,CAAC;AAC1G,MAAM,SAAS,KAAK,MAAM;CAAC,KAAK,QAAQ,QAAQ;CAAG,KAAK,QAAQ,Y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AiB,wBAAwB;EACtD;EACA;GACE,GAAG;GACH,IAAI;GACJ,MAAM;GACN,QAAQ;GACR,aAAa;GACb,cAAc;GACd,MAAM;IAAE,aAAa;IAAoB,UAAU;IAAM,QAAQ;GAA+B;GAChG,WAAW,iBAAiB,wBAAwB;EACtD;EACA,GAAI,UAAU,SACV,CACE;GACE,GAAG;GACH,IAAI;GACJ,MAAM;GACN,QAAQ;GACR,aAAa;GACb,WAAW,iBAAiB,MAAM;EACpC,GACA;GACE,GAAG;GACH,IAAI;GACJ,MAAM;GACN,QAAQ;GACR,aAAa;GACb,MAAM;IACJ,aAAa;IACb,UAAU;IACV,QAAQ,KAAK,OAAO;KAAE,YAAY,SAAS,KAAK,QAAQ,CAAC;KAAG,cAAc,SAAS,KAAK,OAAO,CAAC;IAAE,CAAC;GACrG;GACA,WAAW,iBAAiB,MAAM;EACpC,CACF,IACA,CAAC;CACP;AACF,CAAC;AACD,MAAa,eAAe,kBAAkB;CAAE,SAAS;CAAG;CAAM,SAAS,CAAC;CAAG,SAAS,CAAC;AAAE,CAAC"}
@@ -262,9 +262,13 @@ interface PoConfig {
262
262
  ios?: IosConfig;
263
263
  voice?: VoiceConfig;
264
264
  selection?: PoSelectionConfig;
265
- /** Default layout identifier, resolved against the available web template packages. */
265
+ /**
266
+ * Default layout identifier, resolved against the available web template packages, and the chosen
267
+ * background: `<pluginId>/<fillId>` of an installed `backdrop` fill, or `none`. Unset shows Po's meadow.
268
+ */
266
269
  web?: {
267
270
  template?: string;
271
+ backdrop?: string;
268
272
  };
269
273
  /** Phone app layout identifier, resolved against the native templates the admitted packages offer. */
270
274
  native?: {
@@ -337,7 +341,7 @@ declare module '@deepseek-ai/cordis' {
337
341
  }
338
342
  }
339
343
  /** Which file the effective value for a key came from, or that no file set it. */
340
- type ConfigValueOrigin = 'global' | 'repository' | 'default';
344
+ type ConfigValueOrigin = 'host' | 'repository' | 'default';
341
345
  /** One of the two config files, as a settings surface needs to see it. */
342
346
  interface PoConfigLayer {
343
347
  filePath: string;
@@ -393,4 +397,4 @@ interface LenientParseResult {
393
397
  }
394
398
  //#endregion
395
399
  export { PoSelectionConfig as A, VoiceTtsConfig as B, PoConfigLayers as C, PoConfigTransitionRecord as D, PoConfigTransitionPhase as E, VoiceAutoCaptureConfig as F, WorkspaceDeclaration as H, VoiceConfig as I, VoiceEngine as L, ResolvedVoiceAutoCaptureConfig as M, ResolvedVoiceConfig as N, PoConfigTransitionStrategy as O, VoiceAdapterConfig as P, VoiceMode as R, PoConfigLayer as S, PoConfigSelection as T, VoiceTtsEngine as V, PlanningAgentConfig as _, ConfigDiagnostic as a, PoConfig as b, DesktopEnvironmentConfig as c, IPoConfigLoader as d, IPoConfigService$1 as f, PackageAttribution$1 as g, PO_CONFIG_SERVICE as h, AutocompactTokenConfig as i, ProjectTrust as j, PoHarnessContext as k, EditorConfig as l, LenientParseResult as m, AutocompactOverrideConfig as n, ConfigValueOrigin as o, LenientParseOptions as p, AutocompactThresholdConfig as r, DeepReadonly as s, AutocompactModeConfig as t, HarnessState as u, PlanningModeConfig as v, PoConfigPendingSelection as w, PoConfigContext as x, PlanningThinkingLevel as y, VoiceModelConfig as z };
396
- //# sourceMappingURL=config-CIdo5eB2.d.mts.map
400
+ //# sourceMappingURL=config-Cg7egyk2.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config-CIdo5eB2.d.mts","names":["IPoConfigService","PoConfigServiceContract"],"sources":["../src/types/config.ts"],"mappings":";;;;;KAOY;KACA;KACA;KACA;KACA;UAEK;EACf;EACA,WAAW;;UAEI;EACf,OAAO;EACP,YAAY;EACZ;;;;;;;;;UASe;EACf;EACA;EACA;;;;;;;;;UASe;EACf;EACA;EACA;;;;;;;;;UASe;EACf;EACA,QAAQ;;UAEO;EACf;EACA;EACA,WAAW;EACX,aAAa;EACb,YAAY;;;UAGG;EACf;;;;;;UAMe;EACf;EACA,WAAW;EACX;EACA;;UAEe;EACf;;;;;;;UAOe;;EAEf;;EAEA;;EAEA;;EAEA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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
+ {"version":3,"file":"config-Cg7egyk2.d.mts","names":["IPoConfigService","PoConfigServiceContract"],"sources":["../src/types/config.ts"],"mappings":";;;;;KAOY;KACA;KACA;KACA;KACA;UAEK;EACf;EACA,WAAW;;UAEI;EACf,OAAO;EACP,YAAY;EACZ;;;;;;;;;UASe;EACf;EACA;EACA;;;;;;;;;UASe;EACf;EACA;EACA;;;;;;;;;UASe;EACf;EACA,QAAQ;;UAEO;EACf;EACA;EACA,WAAW;EACX,aAAa;EACb,YAAY;;;UAGG;EACf;;;;;;UAMe;EACf;EACA,WAAW;EACX;EACA;;UAEe;EACf;;;;;;;UAOe;;EAEf;;EAEA;;EAEA;;EAEA,MAAM;;UAGS;EACf;;;UAGe;;EAEf;;EAEA;;;UAGe;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;UAGe;EACf,OAAO;;EAEP;EACA;;IAEE;;IAEA,eAAe;;;UAGF;EACf;EACA;;UAEe;EACf;EACA,OAAO;;UAEQ;EACf,QAAQ;EACR;EACA;;UAEe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,KAAK;;UAEU;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,KAAK;;UAEU;EACf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AEtC,QAAQ;;;;;;;;;UAUO;EACf;;EAEA;EACA;;;UAIe;EACf;;;UAIe;EACf,QAAQ;EACR,aAAa"}
@@ -1,5 +1,5 @@
1
- import { f as parsePoConfig } from "./configPolicy-DIYWpvHZ.mjs";
2
- import { c as layerFromText, d as mergeLenientLayers, f as repositoryConfigFor, i as defaultPoConfig, l as lenientConfigFromText, n as composeConfigLayers, o as globalPoConfigPath, r as configFromText, t as absentRepositoryLayer, u as mergeConfigLayers } from "./core-DWO9z4du.mjs";
1
+ import { f as parsePoConfig } from "./configPolicy-BT71r27N.mjs";
2
+ import { c as layerFromText, d as mergeLenientLayers, f as repositoryConfigFor, i as defaultPoConfig, l as lenientConfigFromText, n as composeConfigLayers, o as globalPoConfigPath, r as configFromText, t as absentRepositoryLayer, u as mergeConfigLayers } from "./core-Cj4dpauK.mjs";
3
3
  import path from "node:path";
4
4
  import { nodeHost, readTextIfExists } from "@agimon-ai/po-core/platform";
5
5
  import fs from "node:fs";
@@ -183,4 +183,4 @@ async function readPoConfigLayers(fs, repoRoot, context, options = {}) {
183
183
  //#endregion
184
184
  export { loadPoConfig as a, loadPoConfigLenient as c, readWorkspaceDeclarations as i, readPoConfigLayers as n, loadPoConfigAsync as o, readPoConfigLenient as r, loadPoConfigLayers as s, readPoConfig as t };
185
185
 
186
- //# sourceMappingURL=config-YZTd0uSD.mjs.map
186
+ //# sourceMappingURL=config-D-T8JjG-.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"config-YZTd0uSD.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 layerFromText,\n lenientConfigFromText,\n mergeConfigLayers,\n mergeLenientLayers,\n repositoryConfigFor,\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. */\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(readTextSync(globalPath), globalPath),\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(await readText(globalPath), globalPath);\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 { nodeHost, readTextIfExists, type FileSystem } from '@agimon-ai/po-core/platform';\nimport { parse as parseYaml } from 'yaml';\n\nimport type { PoConfig, PoConfigLayers, LenientParseResult, WorkspaceDeclaration } from '../../types/config';\nimport { parsePoConfig } from '../configPolicy';\nimport {\n absentRepositoryLayer,\n composeConfigLayers,\n configFromText,\n defaultPoConfig,\n globalPoConfigPath,\n layerFromText,\n lenientConfigFromText,\n mergeConfigLayers,\n mergeLenientLayers,\n repositoryConfigFor,\n type ConfigEnvironment,\n} from './core';\n\ntype IoContext = Parameters<FileSystem['readTextFile']>[1];\n\nexport interface ReadWorkspaceDeclarationsOptions {\n fs: FileSystem;\n repositoryRoot: string;\n context: IoContext;\n}\n\nexport interface WorkspaceDeclarationsResult {\n declarations: WorkspaceDeclaration[];\n source: 'workspaces.yaml' | 'config.yaml' | undefined;\n notices: string[];\n}\n\nconst object = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' &&\n value !== null &&\n (Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null);\n\nfunction jsonValue(value: unknown, seen = new Set<object>()): boolean {\n if (value === null || typeof value === 'string' || typeof value === 'boolean') return true;\n if (typeof value === 'number') return Number.isFinite(value);\n if (typeof value !== 'object' || (!Array.isArray(value) && !object(value)) || seen.has(value)) return false;\n seen.add(value);\n const valid = (Array.isArray(value) ? value : Object.values(value)).every((entry) => jsonValue(entry, seen));\n seen.delete(value);\n return valid;\n}\n\n/** Repository-only declarations. An existing new document is authoritative, even when empty. */\nexport async function readWorkspaceDeclarations({\n fs,\n repositoryRoot,\n context,\n}: ReadWorkspaceDeclarationsOptions): Promise<WorkspaceDeclarationsResult> {\n const filePath = path.join(repositoryRoot, '.po', 'workspaces.yaml');\n const text = await readTextIfExists(fs, filePath, context);\n if (text === undefined) {\n const legacyPath = path.join(repositoryRoot, '.po', 'config.yaml');\n const legacy = await readTextIfExists(fs, legacyPath, context);\n const declarations = legacy === undefined ? undefined : configFromText(legacy, legacyPath).workspaces;\n return {\n declarations: declarations ?? [],\n source: declarations === undefined ? undefined : 'config.yaml',\n notices:\n declarations === undefined\n ? []\n : [`Move workspaces from ${legacyPath} to ${filePath}; config.yaml workspaces is deprecated.`],\n };\n }\n let document: unknown;\n try {\n document = parseYaml(text);\n } catch (error) {\n throw new Error(`Could not parse workspace declarations at ${filePath}`, { cause: error });\n }\n if (\n !object(document) ||\n Object.keys(document).some((key) => key !== 'workspaces') ||\n !Array.isArray(document.workspaces)\n )\n throw new Error(`Workspace declarations at ${filePath} must be an object containing a workspaces list`);\n const aliases = new Set<string>();\n const declarations = document.workspaces.map((entry: unknown, index): WorkspaceDeclaration => {\n const location = `workspaces[${String(index)}]`;\n if (\n !object(entry) ||\n Object.keys(entry).some((key) => !['name', 'path', 'alias', 'instructions', 'metadata'].includes(key))\n )\n throw new Error(\n `Workspace declarations at ${filePath} require ${location} to contain only name, path, alias, instructions, metadata`,\n );\n // Reuse the established declaration name/instructions parser, without changing the legacy config contract.\n const base = parsePoConfig(\n JSON.stringify({ workspaces: [{ name: entry.name, instructions: entry.instructions }] }),\n filePath,\n ).workspaces![0]!;\n if (base.name.length > 80 || !/^[A-Za-z0-9][A-Za-z0-9 ._-]*$/u.test(base.name) || base.name.includes('..'))\n throw new Error(\n `Workspace declarations at ${filePath} require ${location}.name to use letters, numbers, spaces, dots, dashes, or underscores (up to 80 characters)`,\n );\n if (\n entry.path !== undefined &&\n (typeof entry.path !== 'string' || entry.path.trim() === '' || entry.path.includes('\\0'))\n )\n throw new Error(`Workspace declarations at ${filePath} require ${location}.path to be a non-empty path`);\n if (entry.alias !== undefined && (typeof entry.alias !== 'string' || entry.alias.trim() === ''))\n throw new Error(`Workspace declarations at ${filePath} require ${location}.alias to be a non-empty string`);\n const alias = typeof entry.alias === 'string' ? entry.alias.trim() : undefined;\n if (alias !== undefined) {\n if (aliases.has(alias)) throw new Error(`Workspace declarations at ${filePath} have duplicate alias: ${alias}`);\n aliases.add(alias);\n }\n if (entry.metadata !== undefined && (!object(entry.metadata) || !jsonValue(entry.metadata)))\n throw new Error(`Workspace declarations at ${filePath} require ${location}.metadata to be a JSON object`);\n return {\n ...base,\n ...(entry.path === undefined ? {} : { path: entry.path as string }),\n ...(alias === undefined ? {} : { alias }),\n ...(entry.metadata === undefined ? {} : { metadata: entry.metadata as Record<string, unknown> }),\n };\n });\n // Retain the legacy parser's case-insensitive duplicate-name rule across the entire document.\n parsePoConfig(\n JSON.stringify({ workspaces: declarations.map(({ name, instructions }) => ({ name, instructions })) }),\n filePath,\n );\n return { declarations, source: 'workspaces.yaml', notices: [] };\n}\n\nexport interface ReadPoConfigOptions {\n /** Defaults to the host's home directory. */\n readonly homeDirectory?: string;\n /** Defaults to `process.env`. */\n readonly environment?: ConfigEnvironment;\n}\n\nfunction resolved(options: ReadPoConfigOptions): { homeDirectory: string; environment: ConfigEnvironment } {\n return {\n homeDirectory: options.homeDirectory ?? nodeHost.homeDirectory(),\n environment: options.environment ?? process.env,\n };\n}\n\nconst readText = (fs: FileSystem, filePath: string | undefined, context: IoContext) =>\n filePath === undefined ? Promise.resolve(undefined) : readTextIfExists(fs, filePath, context);\n\n/**\n * Loads the merged global and repository config over a FileSystem. A missing\n * file contributes the defaults, so a host with neither file, such as a fresh\n * Durable Object filesystem, reads the same config as an empty Node home.\n */\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 globalConfig = configFromText(await readText(fs, globalPath, context), 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/** 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 isGlobalPoConfigRoot,\n repositoryPoConfigPath,\n resolvePlanningPlansDirectory,\n} from './core';\nexport type { ConfigEnvironment } from './core';\nexport { loadPoConfig, loadPoConfigAsync, loadPoConfigLayers, loadPoConfigLenient } from './sync';\n"],"mappings":";;;;;;;AAmBA,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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E"}
1
+ {"version":3,"file":"config-D-T8JjG-.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 layerFromText,\n lenientConfigFromText,\n mergeConfigLayers,\n mergeLenientLayers,\n repositoryConfigFor,\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. */\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(readTextSync(globalPath), globalPath),\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(await readText(globalPath), globalPath);\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 { nodeHost, readTextIfExists, type FileSystem } from '@agimon-ai/po-core/platform';\nimport { parse as parseYaml } from 'yaml';\n\nimport type { PoConfig, PoConfigLayers, LenientParseResult, WorkspaceDeclaration } from '../../types/config';\nimport { parsePoConfig } from '../configPolicy';\nimport {\n absentRepositoryLayer,\n composeConfigLayers,\n configFromText,\n defaultPoConfig,\n globalPoConfigPath,\n layerFromText,\n lenientConfigFromText,\n mergeConfigLayers,\n mergeLenientLayers,\n repositoryConfigFor,\n type ConfigEnvironment,\n} from './core';\n\ntype IoContext = Parameters<FileSystem['readTextFile']>[1];\n\nexport interface ReadWorkspaceDeclarationsOptions {\n fs: FileSystem;\n repositoryRoot: string;\n context: IoContext;\n}\n\nexport interface WorkspaceDeclarationsResult {\n declarations: WorkspaceDeclaration[];\n source: 'workspaces.yaml' | 'config.yaml' | undefined;\n notices: string[];\n}\n\nconst object = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' &&\n value !== null &&\n (Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null);\n\nfunction jsonValue(value: unknown, seen = new Set<object>()): boolean {\n if (value === null || typeof value === 'string' || typeof value === 'boolean') return true;\n if (typeof value === 'number') return Number.isFinite(value);\n if (typeof value !== 'object' || (!Array.isArray(value) && !object(value)) || seen.has(value)) return false;\n seen.add(value);\n const valid = (Array.isArray(value) ? value : Object.values(value)).every((entry) => jsonValue(entry, seen));\n seen.delete(value);\n return valid;\n}\n\n/** Repository-only declarations. An existing new document is authoritative, even when empty. */\nexport async function readWorkspaceDeclarations({\n fs,\n repositoryRoot,\n context,\n}: ReadWorkspaceDeclarationsOptions): Promise<WorkspaceDeclarationsResult> {\n const filePath = path.join(repositoryRoot, '.po', 'workspaces.yaml');\n const text = await readTextIfExists(fs, filePath, context);\n if (text === undefined) {\n const legacyPath = path.join(repositoryRoot, '.po', 'config.yaml');\n const legacy = await readTextIfExists(fs, legacyPath, context);\n const declarations = legacy === undefined ? undefined : configFromText(legacy, legacyPath).workspaces;\n return {\n declarations: declarations ?? [],\n source: declarations === undefined ? undefined : 'config.yaml',\n notices:\n declarations === undefined\n ? []\n : [`Move workspaces from ${legacyPath} to ${filePath}; config.yaml workspaces is deprecated.`],\n };\n }\n let document: unknown;\n try {\n document = parseYaml(text);\n } catch (error) {\n throw new Error(`Could not parse workspace declarations at ${filePath}`, { cause: error });\n }\n if (\n !object(document) ||\n Object.keys(document).some((key) => key !== 'workspaces') ||\n !Array.isArray(document.workspaces)\n )\n throw new Error(`Workspace declarations at ${filePath} must be an object containing a workspaces list`);\n const aliases = new Set<string>();\n const declarations = document.workspaces.map((entry: unknown, index): WorkspaceDeclaration => {\n const location = `workspaces[${String(index)}]`;\n if (\n !object(entry) ||\n Object.keys(entry).some((key) => !['name', 'path', 'alias', 'instructions', 'metadata'].includes(key))\n )\n throw new Error(\n `Workspace declarations at ${filePath} require ${location} to contain only name, path, alias, instructions, metadata`,\n );\n // Reuse the established declaration name/instructions parser, without changing the legacy config contract.\n const base = parsePoConfig(\n JSON.stringify({ workspaces: [{ name: entry.name, instructions: entry.instructions }] }),\n filePath,\n ).workspaces![0]!;\n if (base.name.length > 80 || !/^[A-Za-z0-9][A-Za-z0-9 ._-]*$/u.test(base.name) || base.name.includes('..'))\n throw new Error(\n `Workspace declarations at ${filePath} require ${location}.name to use letters, numbers, spaces, dots, dashes, or underscores (up to 80 characters)`,\n );\n if (\n entry.path !== undefined &&\n (typeof entry.path !== 'string' || entry.path.trim() === '' || entry.path.includes('\\0'))\n )\n throw new Error(`Workspace declarations at ${filePath} require ${location}.path to be a non-empty path`);\n if (entry.alias !== undefined && (typeof entry.alias !== 'string' || entry.alias.trim() === ''))\n throw new Error(`Workspace declarations at ${filePath} require ${location}.alias to be a non-empty string`);\n const alias = typeof entry.alias === 'string' ? entry.alias.trim() : undefined;\n if (alias !== undefined) {\n if (aliases.has(alias)) throw new Error(`Workspace declarations at ${filePath} have duplicate alias: ${alias}`);\n aliases.add(alias);\n }\n if (entry.metadata !== undefined && (!object(entry.metadata) || !jsonValue(entry.metadata)))\n throw new Error(`Workspace declarations at ${filePath} require ${location}.metadata to be a JSON object`);\n return {\n ...base,\n ...(entry.path === undefined ? {} : { path: entry.path as string }),\n ...(alias === undefined ? {} : { alias }),\n ...(entry.metadata === undefined ? {} : { metadata: entry.metadata as Record<string, unknown> }),\n };\n });\n // Retain the legacy parser's case-insensitive duplicate-name rule across the entire document.\n parsePoConfig(\n JSON.stringify({ workspaces: declarations.map(({ name, instructions }) => ({ name, instructions })) }),\n filePath,\n );\n return { declarations, source: 'workspaces.yaml', notices: [] };\n}\n\nexport interface ReadPoConfigOptions {\n /** Defaults to the host's home directory. */\n readonly homeDirectory?: string;\n /** Defaults to `process.env`. */\n readonly environment?: ConfigEnvironment;\n}\n\nfunction resolved(options: ReadPoConfigOptions): { homeDirectory: string; environment: ConfigEnvironment } {\n return {\n homeDirectory: options.homeDirectory ?? nodeHost.homeDirectory(),\n environment: options.environment ?? process.env,\n };\n}\n\nconst readText = (fs: FileSystem, filePath: string | undefined, context: IoContext) =>\n filePath === undefined ? Promise.resolve(undefined) : readTextIfExists(fs, filePath, context);\n\n/**\n * Loads the merged global and repository config over a FileSystem. A missing\n * file contributes the defaults, so a host with neither file, such as a fresh\n * Durable Object filesystem, reads the same config as an empty Node home.\n */\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 globalConfig = configFromText(await readText(fs, globalPath, context), 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/** 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 isGlobalPoConfigRoot,\n repositoryPoConfigPath,\n resolvePlanningPlansDirectory,\n} from './core';\nexport type { ConfigEnvironment } from './core';\nexport { loadPoConfig, loadPoConfigAsync, loadPoConfigLayers, loadPoConfigLenient } from './sync';\n"],"mappings":";;;;;;;AAmBA,SAAS,aAAa,UAAkD;CACtE,IAAI,aAAa,KAAA,GAAW,OAAO,KAAA;CACnC,IAAI;EACF,OAAO,GAAG,aAAa,UAAU,MAAM;CACzC,SAAS,OAAO;EACd,IAAK,MAAgC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,iBAAiB,MAAM,SAAS,IAAI,gBAAgB,OAAO;CACjE,MAAM,cAAc,cAAc,YAAY,UAAU;CACxD,MAAM,kBACJ,mBAAmB,KAAA,IAAY,sBAAsB,IAAI,cAAc,gBAAgB,cAAc;CACvG,MAAM,mBACJ,mBAAmB,KAAA,IAAY,gBAAgB,IAAI,eAAe,gBAAgB,cAAc;CAClG,MAAM,YAAY,kBAAkB,eAAe,YAAY,UAAU,GAAG,kBAAkB,WAAW;CACzG,OAAO,oBAAoB,aAAa,iBAAiB,SAAS;AACpE"}
@@ -1,6 +1,6 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-VH7oDXx4.cjs");
2
- const require_configPolicy = require("./configPolicy-BChyVz5d.cjs");
3
- const require_core = require("./core-Cyysknc3.cjs");
2
+ const require_configPolicy = require("./configPolicy-W2seYFQB.cjs");
3
+ const require_core = require("./core-CbNA8nkH.cjs");
4
4
  let node_path = require("node:path");
5
5
  node_path = require_rolldown_runtime.__toESM(node_path, 1);
6
6
  let _agimon_ai_po_core_platform = require("@agimon-ai/po-core/platform");
@@ -233,4 +233,4 @@ Object.defineProperty(exports, "readWorkspaceDeclarations", {
233
233
  }
234
234
  });
235
235
 
236
- //# sourceMappingURL=config-WvSXEgXQ.cjs.map
236
+ //# sourceMappingURL=config-D9rtLodC.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"config-WvSXEgXQ.cjs","names":["fs","readText","nodeHost","globalPoConfigPath","repositoryConfigFor","mergeConfigLayers","configFromText","defaultPoConfig","mergeLenientLayers","lenientConfigFromText","composeConfigLayers","layerFromText","absentRepositoryLayer","path","readTextIfExists","configFromText","parseYaml","parsePoConfig","nodeHost","globalPoConfigPath","repositoryConfigFor","defaultPoConfig","mergeConfigLayers","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 layerFromText,\n lenientConfigFromText,\n mergeConfigLayers,\n mergeLenientLayers,\n repositoryConfigFor,\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. */\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(readTextSync(globalPath), globalPath),\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(await readText(globalPath), globalPath);\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 { nodeHost, readTextIfExists, type FileSystem } from '@agimon-ai/po-core/platform';\nimport { parse as parseYaml } from 'yaml';\n\nimport type { PoConfig, PoConfigLayers, LenientParseResult, WorkspaceDeclaration } from '../../types/config';\nimport { parsePoConfig } from '../configPolicy';\nimport {\n absentRepositoryLayer,\n composeConfigLayers,\n configFromText,\n defaultPoConfig,\n globalPoConfigPath,\n layerFromText,\n lenientConfigFromText,\n mergeConfigLayers,\n mergeLenientLayers,\n repositoryConfigFor,\n type ConfigEnvironment,\n} from './core';\n\ntype IoContext = Parameters<FileSystem['readTextFile']>[1];\n\nexport interface ReadWorkspaceDeclarationsOptions {\n fs: FileSystem;\n repositoryRoot: string;\n context: IoContext;\n}\n\nexport interface WorkspaceDeclarationsResult {\n declarations: WorkspaceDeclaration[];\n source: 'workspaces.yaml' | 'config.yaml' | undefined;\n notices: string[];\n}\n\nconst object = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' &&\n value !== null &&\n (Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null);\n\nfunction jsonValue(value: unknown, seen = new Set<object>()): boolean {\n if (value === null || typeof value === 'string' || typeof value === 'boolean') return true;\n if (typeof value === 'number') return Number.isFinite(value);\n if (typeof value !== 'object' || (!Array.isArray(value) && !object(value)) || seen.has(value)) return false;\n seen.add(value);\n const valid = (Array.isArray(value) ? value : Object.values(value)).every((entry) => jsonValue(entry, seen));\n seen.delete(value);\n return valid;\n}\n\n/** Repository-only declarations. An existing new document is authoritative, even when empty. */\nexport async function readWorkspaceDeclarations({\n fs,\n repositoryRoot,\n context,\n}: ReadWorkspaceDeclarationsOptions): Promise<WorkspaceDeclarationsResult> {\n const filePath = path.join(repositoryRoot, '.po', 'workspaces.yaml');\n const text = await readTextIfExists(fs, filePath, context);\n if (text === undefined) {\n const legacyPath = path.join(repositoryRoot, '.po', 'config.yaml');\n const legacy = await readTextIfExists(fs, legacyPath, context);\n const declarations = legacy === undefined ? undefined : configFromText(legacy, legacyPath).workspaces;\n return {\n declarations: declarations ?? [],\n source: declarations === undefined ? undefined : 'config.yaml',\n notices:\n declarations === undefined\n ? []\n : [`Move workspaces from ${legacyPath} to ${filePath}; config.yaml workspaces is deprecated.`],\n };\n }\n let document: unknown;\n try {\n document = parseYaml(text);\n } catch (error) {\n throw new Error(`Could not parse workspace declarations at ${filePath}`, { cause: error });\n }\n if (\n !object(document) ||\n Object.keys(document).some((key) => key !== 'workspaces') ||\n !Array.isArray(document.workspaces)\n )\n throw new Error(`Workspace declarations at ${filePath} must be an object containing a workspaces list`);\n const aliases = new Set<string>();\n const declarations = document.workspaces.map((entry: unknown, index): WorkspaceDeclaration => {\n const location = `workspaces[${String(index)}]`;\n if (\n !object(entry) ||\n Object.keys(entry).some((key) => !['name', 'path', 'alias', 'instructions', 'metadata'].includes(key))\n )\n throw new Error(\n `Workspace declarations at ${filePath} require ${location} to contain only name, path, alias, instructions, metadata`,\n );\n // Reuse the established declaration name/instructions parser, without changing the legacy config contract.\n const base = parsePoConfig(\n JSON.stringify({ workspaces: [{ name: entry.name, instructions: entry.instructions }] }),\n filePath,\n ).workspaces![0]!;\n if (base.name.length > 80 || !/^[A-Za-z0-9][A-Za-z0-9 ._-]*$/u.test(base.name) || base.name.includes('..'))\n throw new Error(\n `Workspace declarations at ${filePath} require ${location}.name to use letters, numbers, spaces, dots, dashes, or underscores (up to 80 characters)`,\n );\n if (\n entry.path !== undefined &&\n (typeof entry.path !== 'string' || entry.path.trim() === '' || entry.path.includes('\\0'))\n )\n throw new Error(`Workspace declarations at ${filePath} require ${location}.path to be a non-empty path`);\n if (entry.alias !== undefined && (typeof entry.alias !== 'string' || entry.alias.trim() === ''))\n throw new Error(`Workspace declarations at ${filePath} require ${location}.alias to be a non-empty string`);\n const alias = typeof entry.alias === 'string' ? entry.alias.trim() : undefined;\n if (alias !== undefined) {\n if (aliases.has(alias)) throw new Error(`Workspace declarations at ${filePath} have duplicate alias: ${alias}`);\n aliases.add(alias);\n }\n if (entry.metadata !== undefined && (!object(entry.metadata) || !jsonValue(entry.metadata)))\n throw new Error(`Workspace declarations at ${filePath} require ${location}.metadata to be a JSON object`);\n return {\n ...base,\n ...(entry.path === undefined ? {} : { path: entry.path as string }),\n ...(alias === undefined ? {} : { alias }),\n ...(entry.metadata === undefined ? {} : { metadata: entry.metadata as Record<string, unknown> }),\n };\n });\n // Retain the legacy parser's case-insensitive duplicate-name rule across the entire document.\n parsePoConfig(\n JSON.stringify({ workspaces: declarations.map(({ name, instructions }) => ({ name, instructions })) }),\n filePath,\n );\n return { declarations, source: 'workspaces.yaml', notices: [] };\n}\n\nexport interface ReadPoConfigOptions {\n /** Defaults to the host's home directory. */\n readonly homeDirectory?: string;\n /** Defaults to `process.env`. */\n readonly environment?: ConfigEnvironment;\n}\n\nfunction resolved(options: ReadPoConfigOptions): { homeDirectory: string; environment: ConfigEnvironment } {\n return {\n homeDirectory: options.homeDirectory ?? nodeHost.homeDirectory(),\n environment: options.environment ?? process.env,\n };\n}\n\nconst readText = (fs: FileSystem, filePath: string | undefined, context: IoContext) =>\n filePath === undefined ? Promise.resolve(undefined) : readTextIfExists(fs, filePath, context);\n\n/**\n * Loads the merged global and repository config over a FileSystem. A missing\n * file contributes the defaults, so a host with neither file, such as a fresh\n * Durable Object filesystem, reads the same config as an empty Node home.\n */\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 globalConfig = configFromText(await readText(fs, globalPath, context), 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/** 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 isGlobalPoConfigRoot,\n repositoryPoConfigPath,\n resolvePlanningPlansDirectory,\n} from './core';\nexport type { ConfigEnvironment } from './core';\nexport { loadPoConfig, loadPoConfigAsync, loadPoConfigLayers, loadPoConfigLenient } from './sync';\n"],"mappings":";;;;;;;;;;AAmBA,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,UAA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AAM,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,aAAaL,aAAAA,mBAAmB,eAAe,WAAW;CAChE,MAAM,iBAAiB,aAAa,KAAA,IAAY,KAAA,IAAYC,aAAAA,oBAAoB,UAAU,eAAe,WAAW;CACpH,MAAM,aAAa,MAAM,SAAS,IAAI,YAAY,OAAO;CACzD,MAAM,iBAAiB,MAAM,SAAS,IAAI,gBAAgB,OAAO;CACjE,MAAM,cAAcK,aAAAA,cAAc,YAAY,UAAU;CACxD,MAAM,kBACJ,mBAAmB,KAAA,IAAYC,aAAAA,sBAAsB,IAAID,aAAAA,cAAc,gBAAgB,cAAc;CACvG,MAAM,mBACJ,mBAAmB,KAAA,IAAYJ,aAAAA,gBAAgB,IAAIN,aAAAA,eAAe,gBAAgB,cAAc;CAClG,MAAM,YAAYO,aAAAA,kBAAkBP,aAAAA,eAAe,YAAY,UAAU,GAAG,kBAAkB,WAAW;CACzG,OAAOY,aAAAA,oBAAoB,aAAa,iBAAiB,SAAS;AACpE"}
1
+ {"version":3,"file":"config-D9rtLodC.cjs","names":["fs","readText","nodeHost","globalPoConfigPath","repositoryConfigFor","mergeConfigLayers","configFromText","defaultPoConfig","mergeLenientLayers","lenientConfigFromText","composeConfigLayers","layerFromText","absentRepositoryLayer","path","readTextIfExists","configFromText","parseYaml","parsePoConfig","nodeHost","globalPoConfigPath","repositoryConfigFor","defaultPoConfig","mergeConfigLayers","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 layerFromText,\n lenientConfigFromText,\n mergeConfigLayers,\n mergeLenientLayers,\n repositoryConfigFor,\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. */\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(readTextSync(globalPath), globalPath),\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(await readText(globalPath), globalPath);\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 { nodeHost, readTextIfExists, type FileSystem } from '@agimon-ai/po-core/platform';\nimport { parse as parseYaml } from 'yaml';\n\nimport type { PoConfig, PoConfigLayers, LenientParseResult, WorkspaceDeclaration } from '../../types/config';\nimport { parsePoConfig } from '../configPolicy';\nimport {\n absentRepositoryLayer,\n composeConfigLayers,\n configFromText,\n defaultPoConfig,\n globalPoConfigPath,\n layerFromText,\n lenientConfigFromText,\n mergeConfigLayers,\n mergeLenientLayers,\n repositoryConfigFor,\n type ConfigEnvironment,\n} from './core';\n\ntype IoContext = Parameters<FileSystem['readTextFile']>[1];\n\nexport interface ReadWorkspaceDeclarationsOptions {\n fs: FileSystem;\n repositoryRoot: string;\n context: IoContext;\n}\n\nexport interface WorkspaceDeclarationsResult {\n declarations: WorkspaceDeclaration[];\n source: 'workspaces.yaml' | 'config.yaml' | undefined;\n notices: string[];\n}\n\nconst object = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' &&\n value !== null &&\n (Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null);\n\nfunction jsonValue(value: unknown, seen = new Set<object>()): boolean {\n if (value === null || typeof value === 'string' || typeof value === 'boolean') return true;\n if (typeof value === 'number') return Number.isFinite(value);\n if (typeof value !== 'object' || (!Array.isArray(value) && !object(value)) || seen.has(value)) return false;\n seen.add(value);\n const valid = (Array.isArray(value) ? value : Object.values(value)).every((entry) => jsonValue(entry, seen));\n seen.delete(value);\n return valid;\n}\n\n/** Repository-only declarations. An existing new document is authoritative, even when empty. */\nexport async function readWorkspaceDeclarations({\n fs,\n repositoryRoot,\n context,\n}: ReadWorkspaceDeclarationsOptions): Promise<WorkspaceDeclarationsResult> {\n const filePath = path.join(repositoryRoot, '.po', 'workspaces.yaml');\n const text = await readTextIfExists(fs, filePath, context);\n if (text === undefined) {\n const legacyPath = path.join(repositoryRoot, '.po', 'config.yaml');\n const legacy = await readTextIfExists(fs, legacyPath, context);\n const declarations = legacy === undefined ? undefined : configFromText(legacy, legacyPath).workspaces;\n return {\n declarations: declarations ?? [],\n source: declarations === undefined ? undefined : 'config.yaml',\n notices:\n declarations === undefined\n ? []\n : [`Move workspaces from ${legacyPath} to ${filePath}; config.yaml workspaces is deprecated.`],\n };\n }\n let document: unknown;\n try {\n document = parseYaml(text);\n } catch (error) {\n throw new Error(`Could not parse workspace declarations at ${filePath}`, { cause: error });\n }\n if (\n !object(document) ||\n Object.keys(document).some((key) => key !== 'workspaces') ||\n !Array.isArray(document.workspaces)\n )\n throw new Error(`Workspace declarations at ${filePath} must be an object containing a workspaces list`);\n const aliases = new Set<string>();\n const declarations = document.workspaces.map((entry: unknown, index): WorkspaceDeclaration => {\n const location = `workspaces[${String(index)}]`;\n if (\n !object(entry) ||\n Object.keys(entry).some((key) => !['name', 'path', 'alias', 'instructions', 'metadata'].includes(key))\n )\n throw new Error(\n `Workspace declarations at ${filePath} require ${location} to contain only name, path, alias, instructions, metadata`,\n );\n // Reuse the established declaration name/instructions parser, without changing the legacy config contract.\n const base = parsePoConfig(\n JSON.stringify({ workspaces: [{ name: entry.name, instructions: entry.instructions }] }),\n filePath,\n ).workspaces![0]!;\n if (base.name.length > 80 || !/^[A-Za-z0-9][A-Za-z0-9 ._-]*$/u.test(base.name) || base.name.includes('..'))\n throw new Error(\n `Workspace declarations at ${filePath} require ${location}.name to use letters, numbers, spaces, dots, dashes, or underscores (up to 80 characters)`,\n );\n if (\n entry.path !== undefined &&\n (typeof entry.path !== 'string' || entry.path.trim() === '' || entry.path.includes('\\0'))\n )\n throw new Error(`Workspace declarations at ${filePath} require ${location}.path to be a non-empty path`);\n if (entry.alias !== undefined && (typeof entry.alias !== 'string' || entry.alias.trim() === ''))\n throw new Error(`Workspace declarations at ${filePath} require ${location}.alias to be a non-empty string`);\n const alias = typeof entry.alias === 'string' ? entry.alias.trim() : undefined;\n if (alias !== undefined) {\n if (aliases.has(alias)) throw new Error(`Workspace declarations at ${filePath} have duplicate alias: ${alias}`);\n aliases.add(alias);\n }\n if (entry.metadata !== undefined && (!object(entry.metadata) || !jsonValue(entry.metadata)))\n throw new Error(`Workspace declarations at ${filePath} require ${location}.metadata to be a JSON object`);\n return {\n ...base,\n ...(entry.path === undefined ? {} : { path: entry.path as string }),\n ...(alias === undefined ? {} : { alias }),\n ...(entry.metadata === undefined ? {} : { metadata: entry.metadata as Record<string, unknown> }),\n };\n });\n // Retain the legacy parser's case-insensitive duplicate-name rule across the entire document.\n parsePoConfig(\n JSON.stringify({ workspaces: declarations.map(({ name, instructions }) => ({ name, instructions })) }),\n filePath,\n );\n return { declarations, source: 'workspaces.yaml', notices: [] };\n}\n\nexport interface ReadPoConfigOptions {\n /** Defaults to the host's home directory. */\n readonly homeDirectory?: string;\n /** Defaults to `process.env`. */\n readonly environment?: ConfigEnvironment;\n}\n\nfunction resolved(options: ReadPoConfigOptions): { homeDirectory: string; environment: ConfigEnvironment } {\n return {\n homeDirectory: options.homeDirectory ?? nodeHost.homeDirectory(),\n environment: options.environment ?? process.env,\n };\n}\n\nconst readText = (fs: FileSystem, filePath: string | undefined, context: IoContext) =>\n filePath === undefined ? Promise.resolve(undefined) : readTextIfExists(fs, filePath, context);\n\n/**\n * Loads the merged global and repository config over a FileSystem. A missing\n * file contributes the defaults, so a host with neither file, such as a fresh\n * Durable Object filesystem, reads the same config as an empty Node home.\n */\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 globalConfig = configFromText(await readText(fs, globalPath, context), 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/** 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 isGlobalPoConfigRoot,\n repositoryPoConfigPath,\n resolvePlanningPlansDirectory,\n} from './core';\nexport type { ConfigEnvironment } from './core';\nexport { loadPoConfig, loadPoConfigAsync, loadPoConfigLayers, loadPoConfigLenient } from './sync';\n"],"mappings":";;;;;;;;;;AAmBA,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,I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AAG,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,aAAaL,aAAAA,mBAAmB,eAAe,WAAW;CAChE,MAAM,iBAAiB,aAAa,KAAA,IAAY,KAAA,IAAYC,aAAAA,oBAAoB,UAAU,eAAe,WAAW;CACpH,MAAM,aAAa,MAAM,SAAS,IAAI,YAAY,OAAO;CACzD,MAAM,iBAAiB,MAAM,SAAS,IAAI,gBAAgB,OAAO;CACjE,MAAM,cAAcK,aAAAA,cAAc,YAAY,UAAU;CACxD,MAAM,kBACJ,mBAAmB,KAAA,IAAYC,aAAAA,sBAAsB,IAAID,aAAAA,cAAc,gBAAgB,cAAc;CACvG,MAAM,mBACJ,mBAAmB,KAAA,IAAYJ,aAAAA,gBAAgB,IAAIN,aAAAA,eAAe,gBAAgB,cAAc;CAClG,MAAM,YAAYO,aAAAA,kBAAkBP,aAAAA,eAAe,YAAY,UAAU,GAAG,kBAAkB,WAAW;CACzG,OAAOY,aAAAA,oBAAoB,aAAa,iBAAiB,SAAS;AACpE"}
package/dist/config.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_configPolicy = require("./configPolicy-BChyVz5d.cjs");
3
- const require_core = require("./core-Cyysknc3.cjs");
4
- const require_config = require("./config-WvSXEgXQ.cjs");
2
+ const require_configPolicy = require("./configPolicy-W2seYFQB.cjs");
3
+ const require_core = require("./core-CbNA8nkH.cjs");
4
+ const require_config = require("./config-D9rtLodC.cjs");
5
5
  exports.PO_PLANNING_THINKING_LEVELS = require_configPolicy.PO_PLANNING_THINKING_LEVELS;
6
6
  exports.PO_VOICE_ENGINES = require_configPolicy.PO_VOICE_ENGINES;
7
7
  exports.PO_VOICE_LIVE_VOICES = require_configPolicy.PO_VOICE_LIVE_VOICES;
package/dist/config.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { C as PoConfigLayers, S as PoConfigLayer, a as ConfigDiagnostic, m as LenientParseResult, o as ConfigValueOrigin, p as LenientParseOptions } from "./config-CIdo5eB2.mjs";
2
- import { A as resolvePlanningPlansDirectory, C as loadPoConfig, D as globalPoConfigDirectory, E as loadPoConfigLenient, O as globalPoConfigPath, S as readWorkspaceDeclarations, T as loadPoConfigLayers, _ as ReadWorkspaceDeclarationsOptions, a as PO_VOICE_MODES, b as readPoConfigLayers, c as configRootKeys, d as parseAutocompactModeConfig, f as parsePlanningModeConfig, g as ReadPoConfigOptions, h as valueAtKeyPath, i as PO_VOICE_LIVE_VOICES, k as repositoryPoConfigPath, l as configScopeOf, m as resolveVoiceConfig, n as PO_PLANNING_THINKING_LEVELS, o as PO_VOICE_TTS_ENGINES, p as parsePoConfig, r as PO_VOICE_ENGINES, s as configLeafKeys, t as ConfigKeyScope, u as mergePoConfigs, v as WorkspaceDeclarationsResult, w as loadPoConfigAsync, x as readPoConfigLenient, y as readPoConfig } from "./index-BeBzQZ2y.mjs";
1
+ import { C as PoConfigLayers, S as PoConfigLayer, a as ConfigDiagnostic, m as LenientParseResult, o as ConfigValueOrigin, p as LenientParseOptions } from "./config-Cg7egyk2.mjs";
2
+ import { A as resolvePlanningPlansDirectory, C as loadPoConfig, D as globalPoConfigDirectory, E as loadPoConfigLenient, O as globalPoConfigPath, S as readWorkspaceDeclarations, T as loadPoConfigLayers, _ as ReadWorkspaceDeclarationsOptions, a as PO_VOICE_MODES, b as readPoConfigLayers, c as configRootKeys, d as parseAutocompactModeConfig, f as parsePlanningModeConfig, g as ReadPoConfigOptions, h as valueAtKeyPath, i as PO_VOICE_LIVE_VOICES, k as repositoryPoConfigPath, l as configScopeOf, m as resolveVoiceConfig, n as PO_PLANNING_THINKING_LEVELS, o as PO_VOICE_TTS_ENGINES, p as parsePoConfig, r as PO_VOICE_ENGINES, s as configLeafKeys, t as ConfigKeyScope, u as mergePoConfigs, v as WorkspaceDeclarationsResult, w as loadPoConfigAsync, x as readPoConfigLenient, y as readPoConfig } from "./index-B00iPuJ3.mjs";
3
3
  export { type ConfigDiagnostic, type ConfigKeyScope, type ConfigValueOrigin, type LenientParseOptions, type LenientParseResult, PO_PLANNING_THINKING_LEVELS, PO_VOICE_ENGINES, PO_VOICE_LIVE_VOICES, PO_VOICE_MODES, PO_VOICE_TTS_ENGINES, type PoConfigLayer, type PoConfigLayers, type ReadPoConfigOptions, type ReadWorkspaceDeclarationsOptions, type WorkspaceDeclarationsResult, configLeafKeys, configRootKeys, configScopeOf, globalPoConfigDirectory, globalPoConfigPath, loadPoConfig, loadPoConfigAsync, loadPoConfigLayers, loadPoConfigLenient, mergePoConfigs, parseAutocompactModeConfig, parsePlanningModeConfig, parsePoConfig, readPoConfig, readPoConfigLayers, readPoConfigLenient, readWorkspaceDeclarations, repositoryPoConfigPath, resolvePlanningPlansDirectory, resolveVoiceConfig, valueAtKeyPath };
package/dist/config.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as PO_VOICE_TTS_ENGINES, c as configScopeOf, d as parsePlanningModeConfig, f as parsePoConfig, i as PO_VOICE_MODES, l as mergePoConfigs, m as valueAtKeyPath, n as PO_VOICE_ENGINES, o as configLeafKeys, p as resolveVoiceConfig, r as PO_VOICE_LIVE_VOICES, s as configRootKeys, t as PO_PLANNING_THINKING_LEVELS, u as parseAutocompactModeConfig } from "./configPolicy-DIYWpvHZ.mjs";
2
- import { a as globalPoConfigDirectory, m as resolvePlanningPlansDirectory, o as globalPoConfigPath, p as repositoryPoConfigPath } from "./core-DWO9z4du.mjs";
3
- import { a as loadPoConfig, c as loadPoConfigLenient, i as readWorkspaceDeclarations, n as readPoConfigLayers, o as loadPoConfigAsync, r as readPoConfigLenient, s as loadPoConfigLayers, t as readPoConfig } from "./config-YZTd0uSD.mjs";
1
+ import { a as PO_VOICE_TTS_ENGINES, c as configScopeOf, d as parsePlanningModeConfig, f as parsePoConfig, i as PO_VOICE_MODES, l as mergePoConfigs, m as valueAtKeyPath, n as PO_VOICE_ENGINES, o as configLeafKeys, p as resolveVoiceConfig, r as PO_VOICE_LIVE_VOICES, s as configRootKeys, t as PO_PLANNING_THINKING_LEVELS, u as parseAutocompactModeConfig } from "./configPolicy-BT71r27N.mjs";
2
+ import { a as globalPoConfigDirectory, m as resolvePlanningPlansDirectory, o as globalPoConfigPath, p as repositoryPoConfigPath } from "./core-Cj4dpauK.mjs";
3
+ import { a as loadPoConfig, c as loadPoConfigLenient, i as readWorkspaceDeclarations, n as readPoConfigLayers, o as loadPoConfigAsync, r as readPoConfigLenient, s as loadPoConfigLayers, t as readPoConfig } from "./config-D-T8JjG-.mjs";
4
4
  export { PO_PLANNING_THINKING_LEVELS, PO_VOICE_ENGINES, PO_VOICE_LIVE_VOICES, PO_VOICE_MODES, PO_VOICE_TTS_ENGINES, configLeafKeys, configRootKeys, configScopeOf, globalPoConfigDirectory, globalPoConfigPath, loadPoConfig, loadPoConfigAsync, loadPoConfigLayers, loadPoConfigLenient, mergePoConfigs, parseAutocompactModeConfig, parsePlanningModeConfig, parsePoConfig, readPoConfig, readPoConfigLayers, readPoConfigLenient, readWorkspaceDeclarations, repositoryPoConfigPath, resolvePlanningPlansDirectory, resolveVoiceConfig, valueAtKeyPath };
@@ -642,15 +642,27 @@ function parseIos(value, filePath) {
642
642
  }
643
643
  return result;
644
644
  }
645
- /** `web` and `native` each choose a template, so both read the same `{ template }` shape. */
645
+ const KEBAB_ID = "[a-z][a-z0-9]*(?:-[a-z0-9]+)*";
646
+ const TEMPLATE_ID = new RegExp(`^${KEBAB_ID}$`);
647
+ /** A background is `none` or the `<pluginId>/<fillId>` of an installed `backdrop` fill. */
648
+ const BACKDROP_CHOICE = new RegExp(`^(?:none|${KEBAB_ID}/${KEBAB_ID})$`);
649
+ /** `web` and `native` each choose a template, so both read the same `{ template }` shape; `web` also chooses a background. */
646
650
  function parseTemplateChoice(value, root, filePath) {
647
651
  if (value === void 0) return void 0;
648
652
  if (!isObject(value)) throw new Error(`Po config at ${filePath} requires ${root} to be an object`);
649
- assertKeys(value, ["template"], root, filePath);
650
- if (value.template === void 0) return {};
651
- const template = optionalString(value.template, `${root}.template`, filePath);
652
- if (!template || template.length > 160 || !/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(template)) throw new Error(`Po config at ${filePath} requires ${root}.template to be a kebab-case template identifier`);
653
- return { template };
653
+ assertKeys(value, root === "web" ? ["template", "backdrop"] : ["template"], root, filePath);
654
+ const choice = {};
655
+ if (value.template !== void 0) {
656
+ const template = optionalString(value.template, `${root}.template`, filePath);
657
+ if (!template || template.length > 160 || !TEMPLATE_ID.test(template)) throw new Error(`Po config at ${filePath} requires ${root}.template to be a kebab-case template identifier`);
658
+ choice.template = template;
659
+ }
660
+ if (value.backdrop !== void 0) {
661
+ const backdrop = optionalString(value.backdrop, `${root}.backdrop`, filePath);
662
+ if (!backdrop || backdrop.length > 160 || !BACKDROP_CHOICE.test(backdrop)) throw new Error(`Po config at ${filePath} requires ${root}.backdrop to be none or <pluginId>/<fillId>`);
663
+ choice.backdrop = backdrop;
664
+ }
665
+ return choice;
654
666
  }
655
667
  function parseComputerUse(value, filePath) {
656
668
  if (value === void 0) return void 0;
@@ -825,7 +837,10 @@ function mergePoConfigs(globalConfig, repositoryConfig) {
825
837
  browse: globalConfig.browse,
826
838
  ios: globalConfig.ios,
827
839
  voice,
828
- web: globalConfig.web || repositoryConfig.web ? { template: repositoryConfig.web?.template ?? globalConfig.web?.template } : void 0,
840
+ web: globalConfig.web || repositoryConfig.web ? {
841
+ template: repositoryConfig.web?.template ?? globalConfig.web?.template,
842
+ backdrop: repositoryConfig.web?.backdrop ?? globalConfig.web?.backdrop
843
+ } : void 0,
829
844
  native: globalConfig.native || repositoryConfig.native ? { template: repositoryConfig.native?.template ?? globalConfig.native?.template } : void 0,
830
845
  selection: globalConfig.selection || repositoryConfig.selection ? {
831
846
  ...globalConfig.selection,
@@ -927,9 +942,9 @@ function startsWith(keyPath, prefix) {
927
942
  */
928
943
  function configScopeOf(keyPath) {
929
944
  if (keyPath.length === 0) return "both";
930
- if (GLOBAL_ONLY_PATHS.some((prefix) => startsWith(keyPath, prefix))) return "global";
945
+ if (GLOBAL_ONLY_PATHS.some((prefix) => startsWith(keyPath, prefix))) return "host";
931
946
  const root = keyPath[0];
932
- if (GLOBAL_ONLY_ROOTS.includes(root)) return "global";
947
+ if (GLOBAL_ONLY_ROOTS.includes(root)) return "host";
933
948
  if (REPOSITORY_ONLY_ROOTS.includes(root)) return "repository";
934
949
  return "both";
935
950
  }
@@ -971,4 +986,4 @@ function valueAtKeyPath(value, keyPath) {
971
986
  //#endregion
972
987
  export { PO_VOICE_TTS_ENGINES as a, configScopeOf as c, parsePlanningModeConfig as d, parsePoConfig as f, PO_VOICE_MODES as i, mergePoConfigs as l, valueAtKeyPath as m, PO_VOICE_ENGINES as n, configLeafKeys as o, resolveVoiceConfig as p, PO_VOICE_LIVE_VOICES as r, configRootKeys as s, PO_PLANNING_THINKING_LEVELS as t, parseAutocompactModeConfig as u };
973
988
 
974
- //# sourceMappingURL=configPolicy-DIYWpvHZ.mjs.map
989
+ //# sourceMappingURL=configPolicy-BT71r27N.mjs.map