@cogenta/agents 0.2.1 → 0.4.0

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 (229) hide show
  1. package/dist/agents/builtins.d.ts +51 -0
  2. package/dist/agents/builtins.d.ts.map +1 -0
  3. package/dist/agents/builtins.js +190 -0
  4. package/dist/agents/builtins.js.map +1 -0
  5. package/dist/agents/orchestrator.d.ts +95 -0
  6. package/dist/agents/orchestrator.d.ts.map +1 -0
  7. package/dist/agents/orchestrator.js +285 -0
  8. package/dist/agents/orchestrator.js.map +1 -0
  9. package/dist/agents/store.d.ts +71 -0
  10. package/dist/agents/store.d.ts.map +1 -0
  11. package/dist/agents/store.js +211 -0
  12. package/dist/agents/store.js.map +1 -0
  13. package/dist/agents/types.d.ts +10 -0
  14. package/dist/agents/types.d.ts.map +1 -1
  15. package/dist/assist/agent-identity.d.ts +44 -0
  16. package/dist/assist/agent-identity.d.ts.map +1 -0
  17. package/dist/assist/agent-identity.js +136 -0
  18. package/dist/assist/agent-identity.js.map +1 -0
  19. package/dist/assist/chat.d.ts +2 -0
  20. package/dist/assist/chat.d.ts.map +1 -1
  21. package/dist/assist/chat.js +14 -5
  22. package/dist/assist/chat.js.map +1 -1
  23. package/dist/assist/classify.d.ts +3 -2
  24. package/dist/assist/classify.d.ts.map +1 -1
  25. package/dist/assist/classify.js +30 -11
  26. package/dist/assist/classify.js.map +1 -1
  27. package/dist/assist/faq.d.ts +3 -2
  28. package/dist/assist/faq.d.ts.map +1 -1
  29. package/dist/assist/faq.js +31 -13
  30. package/dist/assist/faq.js.map +1 -1
  31. package/dist/assist/runtime.d.ts +8 -2
  32. package/dist/assist/runtime.d.ts.map +1 -1
  33. package/dist/assist/runtime.js +2 -2
  34. package/dist/assist/runtime.js.map +1 -1
  35. package/dist/assist/toolset.d.ts +10 -0
  36. package/dist/assist/toolset.d.ts.map +1 -1
  37. package/dist/assist/toolset.js +36 -8
  38. package/dist/assist/toolset.js.map +1 -1
  39. package/dist/assist/usage.d.ts +58 -0
  40. package/dist/assist/usage.d.ts.map +1 -0
  41. package/dist/assist/usage.js +53 -0
  42. package/dist/assist/usage.js.map +1 -0
  43. package/dist/assist/writing.d.ts +10 -9
  44. package/dist/assist/writing.d.ts.map +1 -1
  45. package/dist/assist/writing.js +126 -58
  46. package/dist/assist/writing.js.map +1 -1
  47. package/dist/audit/with-audit.d.ts +13 -0
  48. package/dist/audit/with-audit.d.ts.map +1 -1
  49. package/dist/audit/with-audit.js +6 -0
  50. package/dist/audit/with-audit.js.map +1 -1
  51. package/dist/autonomy/levels.d.ts +37 -0
  52. package/dist/autonomy/levels.d.ts.map +1 -0
  53. package/dist/autonomy/levels.js +51 -0
  54. package/dist/autonomy/levels.js.map +1 -0
  55. package/dist/conversations/store.d.ts +62 -0
  56. package/dist/conversations/store.d.ts.map +1 -0
  57. package/dist/conversations/store.js +0 -0
  58. package/dist/conversations/store.js.map +1 -0
  59. package/dist/identity/context.d.ts +8 -0
  60. package/dist/identity/context.d.ts.map +1 -1
  61. package/dist/identity/context.js +19 -4
  62. package/dist/identity/context.js.map +1 -1
  63. package/dist/identity/markdown.d.ts +38 -0
  64. package/dist/identity/markdown.d.ts.map +1 -0
  65. package/dist/identity/markdown.js +85 -0
  66. package/dist/identity/markdown.js.map +1 -0
  67. package/dist/index.d.ts +56 -5
  68. package/dist/index.d.ts.map +1 -1
  69. package/dist/index.js +30 -3
  70. package/dist/index.js.map +1 -1
  71. package/dist/prompts/render.d.ts +23 -0
  72. package/dist/prompts/render.d.ts.map +1 -0
  73. package/dist/prompts/render.js +35 -0
  74. package/dist/prompts/render.js.map +1 -0
  75. package/dist/prompts/seeds.d.ts +34 -0
  76. package/dist/prompts/seeds.d.ts.map +1 -0
  77. package/dist/prompts/seeds.js +166 -0
  78. package/dist/prompts/seeds.js.map +1 -0
  79. package/dist/prompts/store.d.ts +8 -0
  80. package/dist/prompts/store.d.ts.map +1 -0
  81. package/dist/prompts/store.js +153 -0
  82. package/dist/prompts/store.js.map +1 -0
  83. package/dist/prompts/types.d.ts +51 -0
  84. package/dist/prompts/types.d.ts.map +1 -0
  85. package/dist/prompts/types.js +24 -0
  86. package/dist/prompts/types.js.map +1 -0
  87. package/dist/providers/anthropic.d.ts +21 -3
  88. package/dist/providers/anthropic.d.ts.map +1 -1
  89. package/dist/providers/anthropic.js +60 -12
  90. package/dist/providers/anthropic.js.map +1 -1
  91. package/dist/providers/catalog.d.ts +41 -0
  92. package/dist/providers/catalog.d.ts.map +1 -0
  93. package/dist/providers/catalog.js +85 -0
  94. package/dist/providers/catalog.js.map +1 -0
  95. package/dist/providers/content-parts.d.ts +12 -0
  96. package/dist/providers/content-parts.d.ts.map +1 -0
  97. package/dist/providers/content-parts.js +18 -0
  98. package/dist/providers/content-parts.js.map +1 -0
  99. package/dist/providers/defaults.d.ts +15 -0
  100. package/dist/providers/defaults.d.ts.map +1 -0
  101. package/dist/providers/defaults.js +15 -0
  102. package/dist/providers/defaults.js.map +1 -0
  103. package/dist/providers/google.d.ts +16 -3
  104. package/dist/providers/google.d.ts.map +1 -1
  105. package/dist/providers/google.js +54 -12
  106. package/dist/providers/google.js.map +1 -1
  107. package/dist/providers/openai.d.ts +32 -4
  108. package/dist/providers/openai.d.ts.map +1 -1
  109. package/dist/providers/openai.js +114 -21
  110. package/dist/providers/openai.js.map +1 -1
  111. package/dist/providers/registry.d.ts +31 -20
  112. package/dist/providers/registry.d.ts.map +1 -1
  113. package/dist/providers/registry.js +49 -7
  114. package/dist/providers/registry.js.map +1 -1
  115. package/dist/providers/request-signal.d.ts +23 -0
  116. package/dist/providers/request-signal.d.ts.map +1 -0
  117. package/dist/providers/request-signal.js +26 -0
  118. package/dist/providers/request-signal.js.map +1 -0
  119. package/dist/providers/resolve.d.ts +13 -0
  120. package/dist/providers/resolve.d.ts.map +1 -0
  121. package/dist/providers/resolve.js +30 -0
  122. package/dist/providers/resolve.js.map +1 -0
  123. package/dist/providers/store.d.ts +70 -0
  124. package/dist/providers/store.d.ts.map +1 -0
  125. package/dist/providers/store.js +308 -0
  126. package/dist/providers/store.js.map +1 -0
  127. package/dist/providers/tool-names.d.ts +9 -0
  128. package/dist/providers/tool-names.d.ts.map +1 -0
  129. package/dist/providers/tool-names.js +56 -0
  130. package/dist/providers/tool-names.js.map +1 -0
  131. package/dist/providers/types.d.ts +78 -3
  132. package/dist/providers/types.d.ts.map +1 -1
  133. package/dist/rag/reference-documents/ingest.d.ts +22 -0
  134. package/dist/rag/reference-documents/ingest.d.ts.map +1 -0
  135. package/dist/rag/reference-documents/ingest.js +69 -0
  136. package/dist/rag/reference-documents/ingest.js.map +1 -0
  137. package/dist/rag/reference-documents/store.d.ts +23 -0
  138. package/dist/rag/reference-documents/store.d.ts.map +1 -0
  139. package/dist/rag/reference-documents/store.js +140 -0
  140. package/dist/rag/reference-documents/store.js.map +1 -0
  141. package/dist/rag/reference-documents/types.d.ts +52 -0
  142. package/dist/rag/reference-documents/types.d.ts.map +1 -0
  143. package/dist/rag/reference-documents/types.js +32 -0
  144. package/dist/rag/reference-documents/types.js.map +1 -0
  145. package/dist/runtime/loop.d.ts +29 -7
  146. package/dist/runtime/loop.d.ts.map +1 -1
  147. package/dist/runtime/loop.js +200 -42
  148. package/dist/runtime/loop.js.map +1 -1
  149. package/dist/runtime/types.d.ts +4 -3
  150. package/dist/runtime/types.d.ts.map +1 -1
  151. package/dist/site-plan/analyse-brief.d.ts +8 -0
  152. package/dist/site-plan/analyse-brief.d.ts.map +1 -1
  153. package/dist/site-plan/analyse-brief.js +18 -7
  154. package/dist/site-plan/analyse-brief.js.map +1 -1
  155. package/dist/site-plan/approval.d.ts +2 -2
  156. package/dist/site-plan/approval.d.ts.map +1 -1
  157. package/dist/site-plan/approval.js +34 -4
  158. package/dist/site-plan/approval.js.map +1 -1
  159. package/dist/site-plan/content-model.d.ts +14 -0
  160. package/dist/site-plan/content-model.d.ts.map +1 -1
  161. package/dist/site-plan/content-model.js +52 -8
  162. package/dist/site-plan/content-model.js.map +1 -1
  163. package/dist/site-plan/demo-content.js +2 -3
  164. package/dist/site-plan/demo-content.js.map +1 -1
  165. package/dist/site-plan/propose-plan.d.ts +10 -0
  166. package/dist/site-plan/propose-plan.d.ts.map +1 -1
  167. package/dist/site-plan/propose-plan.js +25 -1
  168. package/dist/site-plan/propose-plan.js.map +1 -1
  169. package/dist/site-plan/site-context.d.ts +81 -0
  170. package/dist/site-plan/site-context.d.ts.map +1 -0
  171. package/dist/site-plan/site-context.js +76 -0
  172. package/dist/site-plan/site-context.js.map +1 -0
  173. package/dist/site-plan/skin-candidates.d.ts +7 -0
  174. package/dist/site-plan/skin-candidates.d.ts.map +1 -1
  175. package/dist/site-plan/skin-candidates.js +6 -0
  176. package/dist/site-plan/skin-candidates.js.map +1 -1
  177. package/dist/site-plan/structural-gaps.d.ts +32 -0
  178. package/dist/site-plan/structural-gaps.d.ts.map +1 -0
  179. package/dist/site-plan/structural-gaps.js +77 -0
  180. package/dist/site-plan/structural-gaps.js.map +1 -0
  181. package/dist/site-plan/types.d.ts +7 -0
  182. package/dist/site-plan/types.d.ts.map +1 -1
  183. package/dist/skills/frontmatter.d.ts +19 -1
  184. package/dist/skills/frontmatter.d.ts.map +1 -1
  185. package/dist/skills/frontmatter.js +29 -5
  186. package/dist/skills/frontmatter.js.map +1 -1
  187. package/dist/skills/library.d.ts +133 -0
  188. package/dist/skills/library.d.ts.map +1 -0
  189. package/dist/skills/library.js +332 -0
  190. package/dist/skills/library.js.map +1 -0
  191. package/dist/skills/types.d.ts +8 -1
  192. package/dist/skills/types.d.ts.map +1 -1
  193. package/dist/skin/generate.d.ts +10 -0
  194. package/dist/skin/generate.d.ts.map +1 -1
  195. package/dist/skin/generate.js +43 -4
  196. package/dist/skin/generate.js.map +1 -1
  197. package/dist/theme-creator/propose-theme.d.ts +77 -0
  198. package/dist/theme-creator/propose-theme.d.ts.map +1 -0
  199. package/dist/theme-creator/propose-theme.js +228 -0
  200. package/dist/theme-creator/propose-theme.js.map +1 -0
  201. package/dist/tools/core/agent-delegate.d.ts +8 -5
  202. package/dist/tools/core/agent-delegate.d.ts.map +1 -1
  203. package/dist/tools/core/agent-delegate.js +16 -6
  204. package/dist/tools/core/agent-delegate.js.map +1 -1
  205. package/dist/tools/core/content-browse.d.ts +74 -0
  206. package/dist/tools/core/content-browse.d.ts.map +1 -0
  207. package/dist/tools/core/content-browse.js +63 -0
  208. package/dist/tools/core/content-browse.js.map +1 -0
  209. package/dist/tools/core/content-schema.d.ts +86 -0
  210. package/dist/tools/core/content-schema.d.ts.map +1 -0
  211. package/dist/tools/core/content-schema.js +83 -0
  212. package/dist/tools/core/content-schema.js.map +1 -0
  213. package/dist/tools/core/deps-scan.d.ts +25 -0
  214. package/dist/tools/core/deps-scan.d.ts.map +1 -0
  215. package/dist/tools/core/deps-scan.js +85 -0
  216. package/dist/tools/core/deps-scan.js.map +1 -0
  217. package/dist/tools/core/media.d.ts +18 -2
  218. package/dist/tools/core/media.d.ts.map +1 -1
  219. package/dist/tools/core/media.js +8 -2
  220. package/dist/tools/core/media.js.map +1 -1
  221. package/dist/tools/core/not-found-log.d.ts +44 -0
  222. package/dist/tools/core/not-found-log.d.ts.map +1 -0
  223. package/dist/tools/core/not-found-log.js +32 -0
  224. package/dist/tools/core/not-found-log.js.map +1 -0
  225. package/dist/tools/core/redirects.d.ts +51 -0
  226. package/dist/tools/core/redirects.d.ts.map +1 -0
  227. package/dist/tools/core/redirects.js +50 -0
  228. package/dist/tools/core/redirects.js.map +1 -0
  229. package/package.json +6 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"site-context.js","sourceRoot":"","sources":["../../src/site-plan/site-context.ts"],"names":[],"mappings":"AAuDA,8FAA8F;AAC9F,MAAM,CAAC,MAAM,mBAAmB,GAAyB;IACvD,WAAW,EAAE,EAAE;IACf,UAAU,EAAE,EAAE;IACd,WAAW,EAAE,EAAE;IACf,YAAY,EAAE,EAAE;CACjB,CAAA;AAkBD,MAAM,UAAU,oBAAoB,CAAC,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AG,CAAC,EAAE,CAAC;QACnC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,2CAA2C,CAAC,CAAA;QAC3D,KAAK,MAAM,QAAQ,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC;YAC3C,KAAK,CAAC,IAAI,CAAC,KAAK,QAAQ,CAAC,IAAI,KAAK,QAAQ,CAAC,SAAS,WAAW,CAAC,CAAA;QAClE,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACzB,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import type { ProviderClient } from '../providers/types.js';
2
+ import { type ExistingSiteSnapshot } from './site-context.js';
2
3
  import type { SkinCandidate } from './types.js';
3
4
  /**
4
5
  * L19 task 3 — "l'utilisateur voit et choisit explicitement entre deux et
@@ -40,6 +41,12 @@ export interface GenerateSkinCandidatesOptions {
40
41
  readonly count?: number;
41
42
  /** Passed to each candidate's own validation loop. */
42
43
  readonly maxAttemptsPerCandidate?: number;
44
+ /**
45
+ * Fiche 60 task 3 — the site these candidates would style, when one
46
+ * already exists. Threaded to every `generateSkin` call as tagged,
47
+ * escaped data (R8), never folded into `description`.
48
+ */
49
+ readonly existingSite?: ExistingSiteSnapshot;
43
50
  }
44
51
  export interface SkinCandidateFailure {
45
52
  readonly id: string;
@@ -1 +1 @@
1
- {"version":3,"file":"skin-candidates.d.ts","sourceRoot":"","sources":["../../src/site-plan/skin-candidates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAE3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,6EAA6E;IAC7E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC3B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,QAAQ,CAAC,UAAU,EAAE,SAAS,aAAa,EAAE,CAAA;IAC7C,QAAQ,CAAC,QAAQ,EAAE,SAAS,oBAAoB,EAAE,CAAA;CACnD,GACD;IACE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAA;IAClB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,8FAA8F;IAC9F,QAAQ,CAAC,UAAU,EAAE,SAAS,aAAa,EAAE,CAAA;IAC7C,QAAQ,CAAC,QAAQ,EAAE,SAAS,oBAAoB,EAAE,CAAA;CACnD,CAAA;AAOL,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,4BAA4B,CAAC,CAoEvC"}
@@ -1,4 +1,5 @@
1
1
  import { generateSkin } from '../skin/generate.js';
2
+ import { isExistingSiteEmpty, renderExistingSiteForPrompt, } from './site-context.js';
2
3
  /**
3
4
  * Five directions, ordered. Asking one model for "three different skins"
4
5
  * in one call reliably produces three near-identical ones; asking three
@@ -43,6 +44,10 @@ function clampCount(count) {
43
44
  }
44
45
  export async function generateSkinCandidates(options) {
45
46
  const directions = SKIN_DIRECTIONS.slice(0, clampCount(options.count));
47
+ const hasExistingSite = options.existingSite !== undefined && !isExistingSiteEmpty(options.existingSite);
48
+ const context = hasExistingSite && options.existingSite !== undefined
49
+ ? [{ source: 'current site', content: renderExistingSiteForPrompt(options.existingSite) }]
50
+ : undefined;
46
51
  // Run in parallel: the installer's whole promise is measured in seconds,
47
52
  // and five sequential three-attempt loops is a minute of staring at a
48
53
  // spinner. Each call is independent — no candidate reads another's result.
@@ -55,6 +60,7 @@ export async function generateSkinCandidates(options) {
55
60
  ...(options.maxAttemptsPerCandidate === undefined
56
61
  ? {}
57
62
  : { maxAttempts: options.maxAttemptsPerCandidate }),
63
+ ...(context === undefined ? {} : { context }),
58
64
  });
59
65
  return { direction, result };
60
66
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"skin-candidates.js","sourceRoot":"","sources":["../../src/site-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GAAG,CAAC,WAAW,CAAC,CAAA;QACrB,UAAU,CAAC,IAAI,CAAC;YACd,EAAE,EAAE,SAAS,CAAC,EAAE;YAChB,KAAK,EAAE,SAAS,CAAC,KAAK;YACtB,SAAS,EAAE,SAAS,CAAC,SAAS;YAC9B,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ;SAC1B,CAAC,CAAA;IACJ,CAAC;IAED,IAAI,UAAU,CAAC,MAAM,GAAG,mBAAmB,EAAE,CAAC;QAC5C,OAAO;YACL,EAAE,EAAE,KAAK;YACT,MAAM,EACJ,UAAU,CAAC,MAAM,KAAK,CAAC;gBACrB,CAAC,CAAC,2CAA2C;gBAC7C,CAAC,CAAC,wEAAwE;YAC9E,UAAU;YACV,QAAQ;SACT,CAAA;IACH,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAA;AAC3C,CAAC"}
1
+ {"version":3,"file":"skin-candidates.js","sourceRoot":"","sources":["../../src/site-plan/skin-candidates.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAEL,mBAAmB,EACnB,2BAA2B,GAC5B,MAAM,mBAAmB,CAAA;AAwB1B;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,eAAe,GAA6B;IACvD;QACE,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,gBAAgB;QACvB,SAAS,EACP,oJAAoJ;KACvJ;IACD;QACE,EAAE,EAAE,UAAU;QACd,KAAK,EAAE,oBAAoB;QAC3B,SAAS,EACP,+HAA+H;KAClI;IACD;QACE,EAAE,EAAE,MAAM;QACV,KAAK,EAAE,kBAAkB;QACzB,SAAS,EACP,gJAAgJ;KACnJ;IACD;QACE,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,mBAAmB;QAC1B,SAAS,EACP,sIAAsI;KACzI;IACD;QACE,EAAE,EAAE,SAAS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CAAC,EAAE;YAChB,KAAK,EAAE,SAAS,CAAC,KAAK;YACtB,SAAS,EAAE,SAAS,CAAC,SAAS;YAC9B,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ;SAC1B,CAAC,CAAA;IACJ,CAAC;IAED,IAAI,UAAU,CAAC,MAAM,GAAG,mBAAmB,EAAE,CAAC;QAC5C,OAAO;YACL,EAAE,EAAE,KAAK;YACT,MAAM,EACJ,UAAU,CAAC,MAAM,KAAK,CAAC;gBACrB,CAAC,CAAC,2CAA2C;gBAC7C,CAAC,CAAC,wEAAwE;YAC9E,UAAU;YACV,QAAQ;SACT,CAAA;IACH,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAA;AAC3C,CAAC"}
@@ -0,0 +1,32 @@
1
+ import type { ExistingSiteSnapshot } from './site-context.js';
2
+ import type { ProposedPage } from './types.js';
3
+ /**
4
+ * Fiche 60 task 5 — "un site sans page « contact » reçoit une suggestion
5
+ * nommée comme telle, refusable comme tout le reste."
6
+ *
7
+ * Deterministic, like `./constraints.js`: this never asks a model. It
8
+ * compares what the plan already proposes, plus what the site already
9
+ * declares, against a closed list of pages most sites need — and says
10
+ * nothing about the ones already covered. A suggestion is never applied by
11
+ * itself (R6): it becomes its own reviewable item (`./approval.js`'s
12
+ * `structuralGaps` section), accepted or rejected exactly like a proposed
13
+ * collection or a proposed page.
14
+ */
15
+ export declare const STRUCTURAL_GAP_TOPICS: readonly ['contact', 'legal', 'privacy'];
16
+ export type StructuralGapTopic = (typeof STRUCTURAL_GAP_TOPICS)[number];
17
+ export interface StructuralGapSuggestion {
18
+ /** Stable within a draft — one topic can appear at most once. */
19
+ readonly id: StructuralGapTopic;
20
+ readonly topic: StructuralGapTopic;
21
+ readonly title: string;
22
+ readonly slug: string;
23
+ readonly reason: string;
24
+ }
25
+ export interface DetectStructuralGapsInput {
26
+ readonly proposedPages: readonly ProposedPage[];
27
+ readonly existingSite: ExistingSiteSnapshot;
28
+ /** Which language to phrase a suggestion's title/reason in. Defaults to `en`. */
29
+ readonly locale?: string;
30
+ }
31
+ export declare function detectStructuralGaps(input: DetectStructuralGapsInput): readonly StructuralGapSuggestion[];
32
+ //# sourceMappingURL=structural-gaps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structural-gaps.d.ts","sourceRoot":"","sources":["../../src/site-plan/structural-gaps.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,qBAAqB,YAAI,SAAS,EAAE,OAAO,EAAE,SAAS,CAAU,CAAA;AAC7E,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAA;AAEvE,MAAM,WAAW,uBAAuB;IACtC,iEAAiE;IACjE,QAAQ,CAAC,EAAE,EAAE,kBAAkB,CAAA;IAC/B,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAA;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAyDD,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,aAAa,EAAE,SAAS,YAAY,EAAE,CAAA;IAC/C,QAAQ,CAAC,YAAY,EAAE,oBAAoB,CAAA;IAC3C,iFAAiF;IACjF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,yBAAyB,GAC/B,SAAS,uBAAuB,EAAE,CAuBpC"}
@@ -0,0 +1,77 @@
1
+ import { fold } from './constraints.js';
2
+ /**
3
+ * Fiche 60 task 5 — "un site sans page « contact » reçoit une suggestion
4
+ * nommée comme telle, refusable comme tout le reste."
5
+ *
6
+ * Deterministic, like `./constraints.js`: this never asks a model. It
7
+ * compares what the plan already proposes, plus what the site already
8
+ * declares, against a closed list of pages most sites need — and says
9
+ * nothing about the ones already covered. A suggestion is never applied by
10
+ * itself (R6): it becomes its own reviewable item (`./approval.js`'s
11
+ * `structuralGaps` section), accepted or rejected exactly like a proposed
12
+ * collection or a proposed page.
13
+ */
14
+ export const STRUCTURAL_GAP_TOPICS = ['contact', 'legal', 'privacy'];
15
+ const GAP_TEMPLATES = [
16
+ {
17
+ topic: 'contact',
18
+ pattern: /\b(contact|nous contacter|contactez[- ]nous|reach us|get in touch)\b/,
19
+ title: { en: 'Contact', fr: 'Contact' },
20
+ slug: { en: 'contact', fr: 'contact' },
21
+ reason: {
22
+ en: 'Most sites need a way for a visitor to reach the site owner.',
23
+ fr: 'La plupart des sites ont besoin d’un moyen pour qu’un visiteur puisse joindre le responsable du site.',
24
+ },
25
+ },
26
+ {
27
+ topic: 'legal',
28
+ pattern: /\b(mentions legales|legal notice|imprint|impressum)\b/,
29
+ title: { en: 'Legal notice', fr: 'Mentions légales' },
30
+ slug: { en: 'legal-notice', fr: 'mentions-legales' },
31
+ reason: {
32
+ en: 'Legally required in most jurisdictions once a site names an identified owner.',
33
+ fr: 'Obligatoire dans la plupart des juridictions dès qu’un site nomme un responsable identifié.',
34
+ },
35
+ },
36
+ {
37
+ topic: 'privacy',
38
+ pattern: /\b(politique de confidentialite|vie privee|privacy policy|donnees personnelles)\b/,
39
+ title: { en: 'Privacy policy', fr: 'Politique de confidentialité' },
40
+ slug: { en: 'privacy-policy', fr: 'politique-de-confidentialite' },
41
+ reason: {
42
+ en: 'Expected wherever the site collects any personal data — a contact form, an account, analytics.',
43
+ fr: 'Attendue dès que le site collecte des données personnelles — un formulaire de contact, un compte, des statistiques de visite.',
44
+ },
45
+ },
46
+ ];
47
+ function covered(pattern, texts) {
48
+ return texts.some((text) => pattern.test(fold(text)));
49
+ }
50
+ function pick(text, locale) {
51
+ return locale.toLowerCase().startsWith('fr') ? text.fr : text.en;
52
+ }
53
+ export function detectStructuralGaps(input) {
54
+ const locale = input.locale ?? 'en';
55
+ const known = [
56
+ ...input.proposedPages.flatMap((page) => [page.title, page.slug]),
57
+ ...input.existingSite.collections.flatMap((collection) => [
58
+ collection.name,
59
+ collection.labels.singular,
60
+ collection.labels.plural,
61
+ ]),
62
+ ];
63
+ const suggestions = [];
64
+ for (const template of GAP_TEMPLATES) {
65
+ if (covered(template.pattern, known))
66
+ continue;
67
+ suggestions.push({
68
+ id: template.topic,
69
+ topic: template.topic,
70
+ title: pick(template.title, locale),
71
+ slug: pick(template.slug, locale),
72
+ reason: pick(template.reason, locale),
73
+ });
74
+ }
75
+ return suggestions;
76
+ }
77
+ //# sourceMappingURL=structural-gaps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structural-gaps.js","sourceRoot":"","sources":["../../src/site-plan/structural-gaps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAIvC;;;;;;;;;;;GAWG;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,CAAU,CAAA;AA0B7E,MAAM,aAAa,GAA2B;IAC5C;QACE,KAAK,EAAE,SAAS;QAChB,OAAO,EAAE,sEAAsE;QAC/E,KAAK,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE;QACvC,IAAI,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE;QACtC,MAAM,EAAE;YACN,EAAE,EAAE,8DAA8D;YAClE,EAAE,EAAE,uGAAuG;SAC5G;KACF;IACD;QACE,KAAK,EAAE,OAAO;QACd,OAAO,EAAE,uDAAuD;QAChE,KAAK,EAAE,EAAE,EAAE,EAAE,cAAc,EAAE,EAAE,EAAE,kBAAkB,EAAE;QAC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,MAAM,CAAC,QAAQ;YAC1B,UAAU,CAAC,MAAM,CAAC,MAAM;SACzB,CAAC;KACH,CAAA;IAED,MAAM,WAAW,GAA8B,EAAE,CAAA;IACjD,KAAK,MAAM,QAAQ,IAAI,aAAa,EAAE,CAAC;QACrC,IAAI,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;YAAE,SAAQ;QAC9C,WAAW,CAAC,IAAI,CAAC;YACf,EAAE,EAAE,QAAQ,CAAC,KAAK;YAClB,KAAK,EAAE,QAAQ,CAAC,KAAK;YACrB,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;YACnC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;YACjC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;SACtC,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,WAAW,CAAA;AACpB,CAAC"}
@@ -2,6 +2,7 @@ import type { SkinTokens } from '@cogenta/render';
2
2
  import type { CollectionDefinition } from '@cogenta/schema';
3
3
  import type { DocumentFormat } from '../documents/extract-text.js';
4
4
  import type { DetectedConstraint } from './constraints.js';
5
+ import type { StructuralGapSuggestion } from './structural-gaps.js';
5
6
  /**
6
7
  * The shapes L19's four agents pass between each other.
7
8
  *
@@ -80,6 +81,12 @@ export interface SitePlanDraft {
80
81
  readonly demoContent: readonly DemoEntry[];
81
82
  /** What was removed or flagged because it contradicted an explicit constraint. */
82
83
  readonly violations: readonly ConstraintViolation[];
84
+ /**
85
+ * Usual pages this plan, and the site it would join, still lack —
86
+ * contact, a legal notice, a privacy policy (fiche 60 task 5). Its own
87
+ * reviewable section, never applied on its own (R6).
88
+ */
89
+ readonly structuralGaps: readonly StructuralGapSuggestion[];
83
90
  readonly warnings: readonly string[];
84
91
  }
85
92
  export interface ConstraintViolation {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","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parser (R9: no new dependency for three flat
3
+ * Deliberately not a YAML parser (R9: no new dependency for a handful of flat
4
4
  * string fields) — `---\nkey: value\n---\nbody`, one `key: value` per line,
5
5
  * nothing nested.
6
+ *
7
+ * `version` is deliberately **not** required (L24 task 4): a real
8
+ * Claude Code/Codex `SKILL.md` — see any `SKILL.md` under this very repo's
9
+ * `.claude/skills/` directory — only ever carries `name` and `description`.
10
+ * Requiring a third field
11
+ * this format doesn't have would refuse the exact copy-paste this task exists
12
+ * to support. `file-store.ts`'s marketplace registry (L7) still writes a
13
+ * `version` (it needs one, to compare installed-vs-available), so this parser
14
+ * keeps reading it when present — it is just never demanded.
6
15
  */
7
16
  export declare function parseSkillFile(path: string, raw: string): {
8
17
  readonly metadata: SkillMetadata;
9
18
  readonly instructions: string;
10
19
  };
20
+ /**
21
+ * The inverse of `parseSkillFile` — renders a skill back to `SKILL.md` text.
22
+ * Used by `library.ts` to write the canonical on-disk form of a skill edited
23
+ * through the structured `AgentSkillStore` contract. Field order (`name`,
24
+ * `description`, then `version` only if present) matches every real
25
+ * Claude Code/Codex skill this project has seen, so a file this function
26
+ * writes reads exactly like one a human would have written by hand.
27
+ */
28
+ export declare function renderSkillFile(metadata: SkillMetadata, instructions: string): string;
11
29
  //# sourceMappingURL=frontmatter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../../src/skills/frontmatter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAI/C;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,GACV;IAAE,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAsCrE"}
1
+ {"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../../src/skills/frontmatter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAI/C;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,GACV;IAAE,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAsCrE;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAKrF"}
@@ -1,9 +1,18 @@
1
1
  import { CogentaError } from '@cogenta/core';
2
- const REQUIRED_FIELDS = ['name', 'version', 'description'];
2
+ const REQUIRED_FIELDS = ['name', 'description'];
3
3
  /**
4
- * Deliberately not a YAML parser (R9: no new dependency for three flat
4
+ * Deliberately not a YAML parser (R9: no new dependency for a handful of flat
5
5
  * string fields) — `---\nkey: value\n---\nbody`, one `key: value` per line,
6
6
  * nothing nested.
7
+ *
8
+ * `version` is deliberately **not** required (L24 task 4): a real
9
+ * Claude Code/Codex `SKILL.md` — see any `SKILL.md` under this very repo's
10
+ * `.claude/skills/` directory — only ever carries `name` and `description`.
11
+ * Requiring a third field
12
+ * this format doesn't have would refuse the exact copy-paste this task exists
13
+ * to support. `file-store.ts`'s marketplace registry (L7) still writes a
14
+ * `version` (it needs one, to compare installed-vs-available), so this parser
15
+ * keeps reading it when present — it is just never demanded.
7
16
  */
8
17
  export function parseSkillFile(path, raw) {
9
18
  const match = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/.exec(raw);
@@ -11,7 +20,7 @@ export function parseSkillFile(path, raw) {
11
20
  throw new CogentaError({
12
21
  code: 'SKILL_DEFINITION_INVALID',
13
22
  message: `"${path}" has no --- frontmatter block.`,
14
- hint: 'Start the file with --- \\n name: ... \\n version: ... \\n description: ... \\n ---',
23
+ hint: 'Start the file with --- \\n name: ... \\n description: ... \\n ---',
15
24
  });
16
25
  }
17
26
  const [, frontmatter = '', body = ''] = match;
@@ -31,16 +40,31 @@ export function parseSkillFile(path, raw) {
31
40
  throw new CogentaError({
32
41
  code: 'SKILL_DEFINITION_INVALID',
33
42
  message: `"${path}" is missing required frontmatter field(s): ${missing.join(', ')}.`,
34
- hint: 'A skill needs name, version and description in its frontmatter.',
43
+ hint: 'A skill needs at least name and description in its frontmatter.',
35
44
  });
36
45
  }
37
46
  return {
38
47
  metadata: {
39
48
  name: fields.name,
40
- version: fields.version,
41
49
  description: fields.description,
50
+ ...(fields.version === undefined ? {} : { version: fields.version }),
42
51
  },
43
52
  instructions: body.trim(),
44
53
  };
45
54
  }
55
+ /**
56
+ * The inverse of `parseSkillFile` — renders a skill back to `SKILL.md` text.
57
+ * Used by `library.ts` to write the canonical on-disk form of a skill edited
58
+ * through the structured `AgentSkillStore` contract. Field order (`name`,
59
+ * `description`, then `version` only if present) matches every real
60
+ * Claude Code/Codex skill this project has seen, so a file this function
61
+ * writes reads exactly like one a human would have written by hand.
62
+ */
63
+ export function renderSkillFile(metadata, instructions) {
64
+ const lines = [`name: ${metadata.name}`, `description: ${metadata.description}`];
65
+ if (metadata.version !== undefined)
66
+ lines.splice(1, 0, `version: ${metadata.version}`);
67
+ const body = instructions.trim();
68
+ return `---\n${lines.join('\n')}\n---\n\n${body}\n`;
69
+ }
46
70
  //# sourceMappingURL=frontmatter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"frontmatter.js","sourceRoot":"","sources":["../../src/skills/frontmatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAG5C,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,aAAa,CAAU,CAAA;AAEnE;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAC5B,IAAY,EACZ,GAAW;IAEX,MAAM,KAAK,GAAG,6CAA6C,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACrE,IAAI,KAAK,KAAK,IA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ACrD,CAAC"}
@@ -0,0 +1,133 @@
1
+ /**
2
+ * The standard reference-folder layout (fiche 57), matching the real Claude
3
+ * Code/Anthropic skill convention: sub-folders under a skill's own
4
+ * directory, all optional, `SKILL.md` the only thing required at the root.
5
+ * `references/` is documents consulted on demand, `scripts/` executable
6
+ * utilities, `assets/` templates/images/files used as-is — none of these are
7
+ * automatically read into an agent's context (see `AgentSkillStore`'s module
8
+ * doc for why); they exist for a human, or a future `skill.read_resource`
9
+ * tool, to reach for on purpose.
10
+ */
11
+ export declare const SKILL_RESOURCE_DIRS: readonly ['references', 'scripts', 'assets'];
12
+ export type SkillResourceDir = (typeof SKILL_RESOURCE_DIRS)[number];
13
+ export interface SkillResource {
14
+ /** Relative to the skill's own directory, e.g. `"references/style-guide.md"`. Forward slashes always, on every OS. */
15
+ readonly path: string;
16
+ readonly size: number;
17
+ readonly updatedAt: string;
18
+ }
19
+ /**
20
+ * L22 task 1bis's "Skills" screen — a **different concept** from
21
+ * `skills/file-store.ts`'s `SkillStore`/`Skill`, which is L7's marketplace
22
+ * registry (a signed, distributable folder with resource files, gated by
23
+ * pre-check + review). This one is what the lot actually describes: "un
24
+ * skill est un texte d'instruction nommé... qu'un agent charge dans son
25
+ * contexte" — a short, site-authored piece of prompt text ("comment rédiger
26
+ * un article"), never installed from anywhere, never signed, edited
27
+ * in-place from the admin. Naming it `AgentSkill`/`AgentSkillStore` (this
28
+ * file lives in the same `skills/` directory as the marketplace one on
29
+ * purpose — they are siblings, not a replacement) keeps the two distinct in
30
+ * every import site rather than overloading `Skill`/`SkillStore`.
31
+ *
32
+ * **Storage format, changed in L24 task 4**: originally one JSON file per
33
+ * record (`<id>.json`). Now `<dir>/<id>/SKILL.md` (frontmatter + body),
34
+ * reusing `parseSkillFile`/`renderSkillFile` from `frontmatter.ts` rather
35
+ * than a second parser — the same format `file-store.ts`'s marketplace
36
+ * registry already speaks, and the format a real Claude Code/Codex skill
37
+ * ships in. This is what makes L24 task 4's acceptance criterion possible:
38
+ * a `SKILL.md` copied verbatim from `.claude/skills/` (or any other
39
+ * standard agent) is a valid `name`+`description`+body skill the moment it
40
+ * is dropped into this store's directory and given a matching `.meta.json`
41
+ * (or, read without one at all — see `readRecord` below).
42
+ *
43
+ * The fields this store needs that a portable `SKILL.md` has no room for
44
+ * (`enabledByDefault`, `builtin`, `createdAt`, `updatedAt`) are **not**
45
+ * folded into the frontmatter. Two options were open here (see
46
+ * `docs/lots/L24-langgraph-agents-avances.md` task 4): extra frontmatter
47
+ * keys (the parser already ignores keys it does not know), or a sidecar
48
+ * meta file. This store picks the sidecar (`.meta.json`, next to
49
+ * `SKILL.md`) **on purpose**: the whole point of this migration is
50
+ * portability — a skill authored here should export as a clean `SKILL.md`
51
+ * with nothing Cogenta-specific in it, and a `SKILL.md` imported here
52
+ * should not have its author's own frontmatter fields overwritten by this
53
+ * store's bookkeeping. Gluing `enabledByDefault`/`builtin`/timestamps into
54
+ * the frontmatter would make every skill this store ever touches carry
55
+ * Cogenta-only keys forever, defeating that.
56
+ */
57
+ export interface AgentSkill {
58
+ readonly id: string;
59
+ readonly name: string;
60
+ readonly description: string;
61
+ readonly instructions: string;
62
+ /**
63
+ * The exact `SKILL.md` text on disk (frontmatter + body), rendered by
64
+ * `renderSkillFile` — what the admin's raw-Markdown editor (L24 task 4)
65
+ * reads and writes, and what a "copy this skill out" action would hand
66
+ * someone verbatim. Always the canonical rendering of `name`/`description`/
67
+ * `instructions` below: this store has one source of truth (the structured
68
+ * fields on `AgentSkillStore`'s contract, kept stable for its 11 existing
69
+ * call sites), and `content` is a derived, always-consistent view of it —
70
+ * never a second, independently-edited copy that could drift.
71
+ */
72
+ readonly content: string;
73
+ /**
74
+ * "Par défaut, un nouvel agent hérite de tous les skills du site" (L22 task
75
+ * 1bis) — a new agent's `AgentDeclaration.skills` is seeded with every
76
+ * skill whose `enabledByDefault` is true at the moment it is created
77
+ * (`agents/orchestrator.ts`'s creation path reads this), so the field stays
78
+ * a plain inclusion list (contract C's own documented shape) while still
79
+ * producing the lot's "inherit everything, exclude what you don't want"
80
+ * behaviour from the admin's point of view.
81
+ */
82
+ readonly enabledByDefault: boolean;
83
+ readonly builtin: boolean;
84
+ readonly createdAt: string;
85
+ readonly updatedAt: string;
86
+ }
87
+ export interface AgentSkillInput {
88
+ readonly name: string;
89
+ readonly description: string;
90
+ readonly instructions: string;
91
+ readonly enabledByDefault?: boolean;
92
+ }
93
+ export type AgentSkillPatch = Partial<AgentSkillInput>;
94
+ export interface AgentSkillStore {
95
+ list(): Promise<readonly AgentSkill[]>;
96
+ get(id: string): Promise<AgentSkill | undefined>;
97
+ create(input: AgentSkillInput, builtin?: boolean): Promise<AgentSkill>;
98
+ update(id: string, patch: AgentSkillPatch): Promise<AgentSkill>;
99
+ /** Refuses to remove a builtin (`AGENT_SKILL_BUILTIN_UNDELETABLE`). */
100
+ remove(id: string): Promise<void>;
101
+ /**
102
+ * Every file under the skill's directory except `SKILL.md`/`.meta.json` —
103
+ * `references/`, `scripts/`, `assets/`, and (for a skill imported from
104
+ * outside this store, which never had to follow the standard layout) any
105
+ * other file that happens to sit there too. Throws `AGENT_SKILL_UNKNOWN`
106
+ * for an unknown id. A skill created before this fiche, with no
107
+ * sub-folders yet, returns an empty list — never an error.
108
+ */
109
+ listResources(id: string): Promise<readonly SkillResource[]>;
110
+ /**
111
+ * Writes (or overwrites) a reference file. `relativePath` must start with
112
+ * one of `SKILL_RESOURCE_DIRS` — anything else, or a path that tries to
113
+ * escape the skill's own directory, is refused with
114
+ * `AGENT_SKILL_RESOURCE_INVALID`. Throws `AGENT_SKILL_UNKNOWN` for an
115
+ * unknown skill id.
116
+ */
117
+ addResource(id: string, relativePath: string, content: string | Uint8Array): Promise<SkillResource>;
118
+ /**
119
+ * Throws `AGENT_SKILL_RESOURCE_INVALID` for a path outside the three
120
+ * standard folders, `AGENT_SKILL_RESOURCE_UNKNOWN` for a path that names
121
+ * no file, and `AGENT_SKILL_UNKNOWN` for an unknown skill id.
122
+ */
123
+ removeResource(id: string, relativePath: string): Promise<void>;
124
+ }
125
+ export interface FileAgentSkillStoreOptions {
126
+ readonly dir: string;
127
+ readonly now?: () => Date;
128
+ }
129
+ export declare function createFileAgentSkillStore(options: FileAgentSkillStoreOptions): AgentSkillStore;
130
+ /** L22 task 1bis: "au minimum ces trois" — content writing, a basic security review, and site-structure/menu management. */
131
+ export declare function builtinAgentSkillSeeds(): readonly AgentSkillInput[];
132
+ export declare function ensureBuiltinAgentSkills(store: AgentSkillStore): Promise<void>;
133
+ //# sourceMappingURL=library.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../src/skills/library.ts"],"names":[],"mappings":"AASA;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,YAAI,YAAY,EAAE,SAAS,EAAE,QAAQ,CAAU,CAAA;AAC/E,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAA;AAEnE,MAAM,WAAW,aAAa;IAC5B,sHAAsH;IACtH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B;;;;;;;;;OASG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB;;;;;;;;OAQG;IACH,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAA;IAClC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,SA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