@cogenta/agents 0.2.1 → 0.5.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 (242) 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 +98 -0
  6. package/dist/agents/orchestrator.d.ts.map +1 -0
  7. package/dist/agents/orchestrator.js +286 -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 +62 -5
  68. package/dist/index.d.ts.map +1 -1
  69. package/dist/index.js +33 -3
  70. package/dist/index.js.map +1 -1
  71. package/dist/progress/job-store.d.ts +41 -0
  72. package/dist/progress/job-store.d.ts.map +1 -0
  73. package/dist/progress/job-store.js +44 -0
  74. package/dist/progress/job-store.js.map +1 -0
  75. package/dist/progress/types.d.ts +21 -0
  76. package/dist/progress/types.d.ts.map +1 -0
  77. package/dist/progress/types.js +3 -0
  78. package/dist/progress/types.js.map +1 -0
  79. package/dist/prompts/render.d.ts +23 -0
  80. package/dist/prompts/render.d.ts.map +1 -0
  81. package/dist/prompts/render.js +35 -0
  82. package/dist/prompts/render.js.map +1 -0
  83. package/dist/prompts/seeds.d.ts +34 -0
  84. package/dist/prompts/seeds.d.ts.map +1 -0
  85. package/dist/prompts/seeds.js +166 -0
  86. package/dist/prompts/seeds.js.map +1 -0
  87. package/dist/prompts/store.d.ts +8 -0
  88. package/dist/prompts/store.d.ts.map +1 -0
  89. package/dist/prompts/store.js +153 -0
  90. package/dist/prompts/store.js.map +1 -0
  91. package/dist/prompts/types.d.ts +51 -0
  92. package/dist/prompts/types.d.ts.map +1 -0
  93. package/dist/prompts/types.js +24 -0
  94. package/dist/prompts/types.js.map +1 -0
  95. package/dist/providers/anthropic.d.ts +26 -3
  96. package/dist/providers/anthropic.d.ts.map +1 -1
  97. package/dist/providers/anthropic.js +60 -12
  98. package/dist/providers/anthropic.js.map +1 -1
  99. package/dist/providers/catalog.d.ts +41 -0
  100. package/dist/providers/catalog.d.ts.map +1 -0
  101. package/dist/providers/catalog.js +85 -0
  102. package/dist/providers/catalog.js.map +1 -0
  103. package/dist/providers/content-parts.d.ts +12 -0
  104. package/dist/providers/content-parts.d.ts.map +1 -0
  105. package/dist/providers/content-parts.js +18 -0
  106. package/dist/providers/content-parts.js.map +1 -0
  107. package/dist/providers/defaults.d.ts +44 -0
  108. package/dist/providers/defaults.d.ts.map +1 -0
  109. package/dist/providers/defaults.js +72 -0
  110. package/dist/providers/defaults.js.map +1 -0
  111. package/dist/providers/google.d.ts +20 -3
  112. package/dist/providers/google.d.ts.map +1 -1
  113. package/dist/providers/google.js +53 -12
  114. package/dist/providers/google.js.map +1 -1
  115. package/dist/providers/openai.d.ts +36 -4
  116. package/dist/providers/openai.d.ts.map +1 -1
  117. package/dist/providers/openai.js +113 -21
  118. package/dist/providers/openai.js.map +1 -1
  119. package/dist/providers/registry.d.ts +38 -21
  120. package/dist/providers/registry.d.ts.map +1 -1
  121. package/dist/providers/registry.js +64 -8
  122. package/dist/providers/registry.js.map +1 -1
  123. package/dist/providers/request-signal.d.ts +18 -0
  124. package/dist/providers/request-signal.d.ts.map +1 -0
  125. package/dist/providers/request-signal.js +21 -0
  126. package/dist/providers/request-signal.js.map +1 -0
  127. package/dist/providers/resolve.d.ts +13 -0
  128. package/dist/providers/resolve.d.ts.map +1 -0
  129. package/dist/providers/resolve.js +30 -0
  130. package/dist/providers/resolve.js.map +1 -0
  131. package/dist/providers/store.d.ts +70 -0
  132. package/dist/providers/store.d.ts.map +1 -0
  133. package/dist/providers/store.js +308 -0
  134. package/dist/providers/store.js.map +1 -0
  135. package/dist/providers/tool-names.d.ts +9 -0
  136. package/dist/providers/tool-names.d.ts.map +1 -0
  137. package/dist/providers/tool-names.js +56 -0
  138. package/dist/providers/tool-names.js.map +1 -0
  139. package/dist/providers/types.d.ts +87 -3
  140. package/dist/providers/types.d.ts.map +1 -1
  141. package/dist/rag/reference-documents/ingest.d.ts +22 -0
  142. package/dist/rag/reference-documents/ingest.d.ts.map +1 -0
  143. package/dist/rag/reference-documents/ingest.js +69 -0
  144. package/dist/rag/reference-documents/ingest.js.map +1 -0
  145. package/dist/rag/reference-documents/store.d.ts +23 -0
  146. package/dist/rag/reference-documents/store.d.ts.map +1 -0
  147. package/dist/rag/reference-documents/store.js +140 -0
  148. package/dist/rag/reference-documents/store.js.map +1 -0
  149. package/dist/rag/reference-documents/types.d.ts +52 -0
  150. package/dist/rag/reference-documents/types.d.ts.map +1 -0
  151. package/dist/rag/reference-documents/types.js +32 -0
  152. package/dist/rag/reference-documents/types.js.map +1 -0
  153. package/dist/runtime/loop.d.ts +29 -7
  154. package/dist/runtime/loop.d.ts.map +1 -1
  155. package/dist/runtime/loop.js +209 -44
  156. package/dist/runtime/loop.js.map +1 -1
  157. package/dist/runtime/retry.d.ts +2 -0
  158. package/dist/runtime/retry.d.ts.map +1 -1
  159. package/dist/runtime/retry.js +1 -0
  160. package/dist/runtime/retry.js.map +1 -1
  161. package/dist/runtime/types.d.ts +14 -3
  162. package/dist/runtime/types.d.ts.map +1 -1
  163. package/dist/site-plan/analyse-brief.d.ts +8 -0
  164. package/dist/site-plan/analyse-brief.d.ts.map +1 -1
  165. package/dist/site-plan/analyse-brief.js +17 -8
  166. package/dist/site-plan/analyse-brief.js.map +1 -1
  167. package/dist/site-plan/approval.d.ts +2 -2
  168. package/dist/site-plan/approval.d.ts.map +1 -1
  169. package/dist/site-plan/approval.js +34 -4
  170. package/dist/site-plan/approval.js.map +1 -1
  171. package/dist/site-plan/content-model.d.ts +14 -0
  172. package/dist/site-plan/content-model.d.ts.map +1 -1
  173. package/dist/site-plan/content-model.js +51 -9
  174. package/dist/site-plan/content-model.js.map +1 -1
  175. package/dist/site-plan/demo-content.d.ts.map +1 -1
  176. package/dist/site-plan/demo-content.js +1 -4
  177. package/dist/site-plan/demo-content.js.map +1 -1
  178. package/dist/site-plan/propose-plan.d.ts +10 -0
  179. package/dist/site-plan/propose-plan.d.ts.map +1 -1
  180. package/dist/site-plan/propose-plan.js +25 -1
  181. package/dist/site-plan/propose-plan.js.map +1 -1
  182. package/dist/site-plan/site-context.d.ts +81 -0
  183. package/dist/site-plan/site-context.d.ts.map +1 -0
  184. package/dist/site-plan/site-context.js +76 -0
  185. package/dist/site-plan/site-context.js.map +1 -0
  186. package/dist/site-plan/skin-candidates.d.ts +13 -1
  187. package/dist/site-plan/skin-candidates.d.ts.map +1 -1
  188. package/dist/site-plan/skin-candidates.js +15 -0
  189. package/dist/site-plan/skin-candidates.js.map +1 -1
  190. package/dist/site-plan/structural-gaps.d.ts +32 -0
  191. package/dist/site-plan/structural-gaps.d.ts.map +1 -0
  192. package/dist/site-plan/structural-gaps.js +77 -0
  193. package/dist/site-plan/structural-gaps.js.map +1 -0
  194. package/dist/site-plan/types.d.ts +7 -0
  195. package/dist/site-plan/types.d.ts.map +1 -1
  196. package/dist/skills/frontmatter.d.ts +19 -1
  197. package/dist/skills/frontmatter.d.ts.map +1 -1
  198. package/dist/skills/frontmatter.js +29 -5
  199. package/dist/skills/frontmatter.js.map +1 -1
  200. package/dist/skills/library.d.ts +133 -0
  201. package/dist/skills/library.d.ts.map +1 -0
  202. package/dist/skills/library.js +332 -0
  203. package/dist/skills/library.js.map +1 -0
  204. package/dist/skills/types.d.ts +8 -1
  205. package/dist/skills/types.d.ts.map +1 -1
  206. package/dist/skin/generate.d.ts +22 -1
  207. package/dist/skin/generate.d.ts.map +1 -1
  208. package/dist/skin/generate.js +60 -5
  209. package/dist/skin/generate.js.map +1 -1
  210. package/dist/theme-creator/propose-theme.d.ts +83 -0
  211. package/dist/theme-creator/propose-theme.d.ts.map +1 -0
  212. package/dist/theme-creator/propose-theme.js +234 -0
  213. package/dist/theme-creator/propose-theme.js.map +1 -0
  214. package/dist/tools/core/agent-delegate.d.ts +8 -5
  215. package/dist/tools/core/agent-delegate.d.ts.map +1 -1
  216. package/dist/tools/core/agent-delegate.js +16 -6
  217. package/dist/tools/core/agent-delegate.js.map +1 -1
  218. package/dist/tools/core/content-browse.d.ts +74 -0
  219. package/dist/tools/core/content-browse.d.ts.map +1 -0
  220. package/dist/tools/core/content-browse.js +63 -0
  221. package/dist/tools/core/content-browse.js.map +1 -0
  222. package/dist/tools/core/content-schema.d.ts +86 -0
  223. package/dist/tools/core/content-schema.d.ts.map +1 -0
  224. package/dist/tools/core/content-schema.js +83 -0
  225. package/dist/tools/core/content-schema.js.map +1 -0
  226. package/dist/tools/core/deps-scan.d.ts +25 -0
  227. package/dist/tools/core/deps-scan.d.ts.map +1 -0
  228. package/dist/tools/core/deps-scan.js +85 -0
  229. package/dist/tools/core/deps-scan.js.map +1 -0
  230. package/dist/tools/core/media.d.ts +18 -2
  231. package/dist/tools/core/media.d.ts.map +1 -1
  232. package/dist/tools/core/media.js +8 -2
  233. package/dist/tools/core/media.js.map +1 -1
  234. package/dist/tools/core/not-found-log.d.ts +44 -0
  235. package/dist/tools/core/not-found-log.d.ts.map +1 -0
  236. package/dist/tools/core/not-found-log.js +32 -0
  237. package/dist/tools/core/not-found-log.js.map +1 -0
  238. package/dist/tools/core/redirects.d.ts +51 -0
  239. package/dist/tools/core/redirects.d.ts.map +1 -0
  240. package/dist/tools/core/redirects.js +50 -0
  241. package/dist/tools/core/redirects.js.map +1 -0
  242. package/package.json +6 -4
@@ -0,0 +1,74 @@
1
+ import { z } from 'zod';
2
+ import type { ToolDefinition } from '../types.js';
3
+ /**
4
+ * `content.collections` / `content.list` — L22 task 3's missing half:
5
+ * `content.ts`'s `content.read` needs an `id` an agent cannot get any other
6
+ * way, so nothing before this lot let an agent discover what a site
7
+ * publishes. Both tools are read-only, both share `content.read`'s
8
+ * permission (browsing is the same access as reading one entry, not a wider
9
+ * grant), and both are generically useful beyond the monitoring agent this
10
+ * task ships them for — an agent choosing where to point a stale link needs
11
+ * exactly what a future "find thin content" or "suggest internal links"
12
+ * agent would too.
13
+ *
14
+ * `path` on a list item is computed by the caller (`@cogenta/cli`'s
15
+ * `agent-runtime.ts`, which alone has both the entry's field values and the
16
+ * collection's route pattern) and is `null` for a collection with no public
17
+ * route, or a values shape `buildPath` cannot fill — a candidate an agent
18
+ * must not offer as a redirect target either way.
19
+ */
20
+ export interface ContentBrowseAccessContext {
21
+ readonly actor: {
22
+ readonly id: string | null;
23
+ readonly roles: readonly string[];
24
+ };
25
+ }
26
+ export interface ContentCollectionSummaryLike {
27
+ readonly collection: string;
28
+ readonly total: number;
29
+ readonly published: number;
30
+ readonly routed: boolean;
31
+ }
32
+ export interface ContentListItemLike {
33
+ readonly id: string;
34
+ readonly title: string | null;
35
+ readonly path: string | null;
36
+ readonly status: string;
37
+ }
38
+ export interface ContentBrowseServiceLike {
39
+ /** Every collection this actor may read, with the same counts the dashboard's content summary widget uses. */
40
+ collections(context: ContentBrowseAccessContext): Promise<readonly ContentCollectionSummaryLike[]>;
41
+ /** `undefined` when `collection` does not exist, or this actor may not read it — never thrown, so the tool can turn it into a normal (non-crashing) tool error. */
42
+ list(context: ContentBrowseAccessContext, collection: string, options: {
43
+ readonly limit: number;
44
+ }): Promise<{
45
+ readonly items: readonly ContentListItemLike[];
46
+ } | undefined>;
47
+ }
48
+ declare const CollectionsOutputSchema: z.ZodObject<{
49
+ collections: z.ZodArray<z.ZodObject<{
50
+ collection: z.ZodString;
51
+ total: z.ZodNumber;
52
+ published: z.ZodNumber;
53
+ routed: z.ZodBoolean;
54
+ }, z.core.$strip>>;
55
+ }, z.core.$strip>;
56
+ type CollectionsOutput = z.infer<typeof CollectionsOutputSchema>;
57
+ export declare function createContentCollectionsTool(service: ContentBrowseServiceLike): ToolDefinition<Record<string, never>, CollectionsOutput>;
58
+ declare const ListInputSchema: z.ZodObject<{
59
+ collection: z.ZodString;
60
+ limit: z.ZodOptional<z.ZodNumber>;
61
+ }, z.core.$strip>;
62
+ type ListInput = z.infer<typeof ListInputSchema>;
63
+ declare const ListOutputSchema: z.ZodObject<{
64
+ items: z.ZodArray<z.ZodObject<{
65
+ id: z.ZodString;
66
+ title: z.ZodNullable<z.ZodString>;
67
+ path: z.ZodNullable<z.ZodString>;
68
+ status: z.ZodString;
69
+ }, z.core.$strip>>;
70
+ }, z.core.$strip>;
71
+ type ListOutput = z.infer<typeof ListOutputSchema>;
72
+ export declare function createContentListTool(service: ContentBrowseServiceLike): ToolDefinition<ListInput, ListOutput>;
73
+ export {};
74
+ //# sourceMappingURL=content-browse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-browse.d.ts","sourceRoot":"","sources":["../../../src/tools/core/content-browse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,CAAA;CAClF;AAED,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,UAAU,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AAC,OAAO,gBAAgB,CAAC,CAAA;AAIlD,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,wBAAwB,GAChC,cAAc,CAAC,SAAS,EAAE,UAAU,CAAC,CAmBvC"}
@@ -0,0 +1,63 @@
1
+ import { z } from 'zod';
2
+ import { defineTool } from '../define.js';
3
+ function accessContextOf(actor) {
4
+ return { actor };
5
+ }
6
+ const CollectionsOutputSchema = z.object({
7
+ collections: z.array(z.object({
8
+ collection: z.string(),
9
+ total: z.number(),
10
+ published: z.number(),
11
+ routed: z.boolean(),
12
+ })),
13
+ });
14
+ export function createContentCollectionsTool(service) {
15
+ return defineTool({
16
+ name: 'content.collections',
17
+ version: '1.0.0',
18
+ description: 'List every content collection this actor may read, with its entry counts and whether it has a public URL — the starting point for finding a page to point somewhere.',
19
+ input: z.object({}),
20
+ output: CollectionsOutputSchema,
21
+ permissions: ['content.read'],
22
+ sideEffects: false,
23
+ reversible: false,
24
+ cost: 'low',
25
+ async execute(_input, ctx) {
26
+ const collections = await service.collections(accessContextOf(ctx.actor));
27
+ return { collections: [...collections] };
28
+ },
29
+ });
30
+ }
31
+ const ListInputSchema = z.object({
32
+ collection: z.string(),
33
+ limit: z.number().int().positive().max(50).optional(),
34
+ });
35
+ const ListOutputSchema = z.object({
36
+ items: z.array(z.object({
37
+ id: z.string(),
38
+ title: z.string().nullable(),
39
+ path: z.string().nullable(),
40
+ status: z.string(),
41
+ })),
42
+ });
43
+ const DEFAULT_LIST_LIMIT = 20;
44
+ export function createContentListTool(service) {
45
+ return defineTool({
46
+ name: 'content.list',
47
+ version: '1.0.0',
48
+ description: 'List published entries of one collection (title, public path, status) — call content.collections first to discover collection names.',
49
+ input: ListInputSchema,
50
+ output: ListOutputSchema,
51
+ permissions: ['content.read'],
52
+ sideEffects: false,
53
+ reversible: false,
54
+ cost: 'low',
55
+ async execute(input, ctx) {
56
+ const page = await service.list(accessContextOf(ctx.actor), input.collection, {
57
+ limit: input.limit ?? DEFAULT_LIST_LIMIT,
58
+ });
59
+ return { items: page === undefined ? [] : [...page.items] };
60
+ },
61
+ });
62
+ }
63
+ //# sourceMappingURL=content-browse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-browse.js","sourceRoot":"","sources":["../../../src/tools/core/content-browse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAkDzC,SAAS,eAAe,CAAC,KAGxB;IACC,OAAO,EAAE,KAAK,EAAE,CAAA;AAClB,CAAC;AAED,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,WAAW,EAAE,CAAC,CAAC,KAAK,CAClB,CAAC,CAAC,MAAM,CAAC;QACP,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;QACtB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;QACjB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;QACrB,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;KACpB,CAAC,CACH;CACF,CAAC,CAAA;AAGF,MAAM,UAAU,4BAA4B,CAC1C,OAAiC;IAEjC,OAAO,UAAU,CAAC;QAChB,IAAI,EAAE,qBAAqB;QAC3B,OAAO,EAAE,OAAO;QAChB,WAAW,EACT,sKAAsK;QACxK,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;QACnB,MAAM,EAAE,uBAAuB;QAC/B,WAAW,EAAE,CAAC,cAAc,CAAC;QAC7B,WAAW,EAAE,KAAK;QAClB,UAAU,EAAE,KAAK;QACjB,IAAI,EAAE,KAAK;QACX,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG;YACvB,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAA;YACzE,OAAO,EAAE,WAAW,EAAE,CAAC,GAAG,WAAW,CAAC,EAAE,CAAA;QAC1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AAE,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAA;QAC7D,CAAC;KACF,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,86 @@
1
+ import { z } from 'zod';
2
+ import type { ToolDefinition } from '../types.js';
3
+ import type { ContentBrowseAccessContext } from './content-browse.js';
4
+ /**
5
+ * `content.schema` — the missing half of the browse pair (`content.
6
+ * collections`/`content.list`, L22 task 3): those answer "what entries
7
+ * exist", never "what shape does an entry take". `content.write_draft`'s
8
+ * `values` input is `z.record(z.string(), z.unknown())`, deliberately
9
+ * schema-blind (contract A's field set is open-ended, and the tool has no
10
+ * business re-validating what `ContentServiceLike.create`/`update` already
11
+ * validate) — which leaves an agent with no way to learn a collection's real
12
+ * field keys short of guessing or reverse-engineering an existing entry, and
13
+ * no way at all on a fresh collection with zero entries. A live run against
14
+ * "peux-tu générer un template ?" showed exactly this: the superagent had
15
+ * nothing to introspect, so it asked the human to specify everything.
16
+ *
17
+ * Read-only, and deliberately under the same permission as the browse pair:
18
+ * `content.read`. Describing a collection's *shape* is not a wider grant
19
+ * than reading one of its entries (the precedent this file follows is
20
+ * `content-browse.ts`'s own comment on the same point).
21
+ *
22
+ * The block vocabulary half needs no adapter and no permission check beyond
23
+ * the tool's own: it is contract B, static and site-independent, the same
24
+ * seventeen blocks on every Cogenta install. It is always present in the
25
+ * output, regardless of which (if any) collection was asked about, so an
26
+ * agent building a `blocks`-kind field's value never has to make a second
27
+ * call to learn what a "hero" block or a "prose" block actually holds.
28
+ */
29
+ export interface CollectionFieldSummary {
30
+ readonly key: string;
31
+ readonly kind: string;
32
+ readonly label: string | null;
33
+ readonly required: boolean;
34
+ readonly options: Readonly<Record<string, unknown>>;
35
+ }
36
+ export interface CollectionSchemaSummary {
37
+ readonly collection: string;
38
+ readonly labelSingular: string;
39
+ readonly labelPlural: string;
40
+ readonly routed: boolean;
41
+ readonly fields: readonly CollectionFieldSummary[];
42
+ }
43
+ export interface ContentSchemaServiceLike {
44
+ /**
45
+ * Every collection's schema this actor may read, or just `collection`'s
46
+ * when given — `undefined` in `collection`'s place means "all". An
47
+ * unreadable or unknown named collection is silently omitted (mirrors
48
+ * `content-browse.ts`'s own `list()`), never thrown: a tool result says
49
+ * "nothing here", a thrown error would end the agent's turn over what is,
50
+ * from the model's point of view, an ordinary "try a different name".
51
+ */
52
+ describe(context: ContentBrowseAccessContext, collection?: string): Promise<readonly CollectionSchemaSummary[]>;
53
+ }
54
+ declare const OutputSchema: z.ZodObject<{
55
+ collections: z.ZodArray<z.ZodObject<{
56
+ collection: z.ZodString;
57
+ labelSingular: z.ZodString;
58
+ labelPlural: z.ZodString;
59
+ routed: z.ZodBoolean;
60
+ fields: z.ZodArray<z.ZodObject<{
61
+ key: z.ZodString;
62
+ kind: z.ZodString;
63
+ label: z.ZodNullable<z.ZodString>;
64
+ required: z.ZodBoolean;
65
+ options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
66
+ }, z.core.$strip>>;
67
+ }, z.core.$strip>>;
68
+ blocks: z.ZodArray<z.ZodObject<{
69
+ name: z.ZodString;
70
+ version: z.ZodString;
71
+ fields: z.ZodArray<z.ZodObject<{
72
+ key: z.ZodString;
73
+ kind: z.ZodString;
74
+ required: z.ZodBoolean;
75
+ options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
76
+ }, z.core.$strip>>;
77
+ }, z.core.$strip>>;
78
+ }, z.core.$strip>;
79
+ type Output = z.infer<typeof OutputSchema>;
80
+ declare const InputSchema: z.ZodObject<{
81
+ collection: z.ZodOptional<z.ZodString>;
82
+ }, z.core.$strip>;
83
+ type Input = z.infer<typeof InputSchema>;
84
+ export declare function createContentSchemaTool(service: ContentSchemaServiceLike): ToolDefinition<Input, Output>;
85
+ export {};
86
+ //# sourceMappingURL=content-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-schema.d.ts","sourceRoot":"","sources":["../../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AAA;AAoBxC,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,wBAAwB,GAChC,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,CAgC/B"}
@@ -0,0 +1,83 @@
1
+ import { VOCABULARY } from '@cogenta/blocks';
2
+ import { z } from 'zod';
3
+ import { defineTool } from '../define.js';
4
+ const BlockFieldOutputSchema = z.object({
5
+ key: z.string(),
6
+ kind: z.string(),
7
+ required: z.boolean(),
8
+ options: z.record(z.string(), z.unknown()),
9
+ });
10
+ const BlockOutputSchema = z.object({
11
+ name: z.string(),
12
+ version: z.string(),
13
+ fields: z.array(BlockFieldOutputSchema),
14
+ });
15
+ const CollectionFieldOutputSchema = z.object({
16
+ key: z.string(),
17
+ kind: z.string(),
18
+ label: z.string().nullable(),
19
+ required: z.boolean(),
20
+ options: z.record(z.string(), z.unknown()),
21
+ });
22
+ const CollectionSchemaOutputSchema = z.object({
23
+ collection: z.string(),
24
+ labelSingular: z.string(),
25
+ labelPlural: z.string(),
26
+ routed: z.boolean(),
27
+ fields: z.array(CollectionFieldOutputSchema),
28
+ });
29
+ const OutputSchema = z.object({
30
+ collections: z.array(CollectionSchemaOutputSchema),
31
+ blocks: z.array(BlockOutputSchema),
32
+ });
33
+ const InputSchema = z.object({ collection: z.string().optional() });
34
+ /**
35
+ * Built once, from `@cogenta/blocks`' own `VOCABULARY` — a plain data
36
+ * mapping, not a query, so it costs nothing to compute on every call and
37
+ * needs no caching.
38
+ */
39
+ function blockVocabularyOutput() {
40
+ return VOCABULARY.map((block) => ({
41
+ name: block.name,
42
+ version: block.version,
43
+ fields: Object.entries(block.schema).map(([key, field]) => ({
44
+ key,
45
+ kind: field.kind,
46
+ required: field.required,
47
+ options: field.options,
48
+ })),
49
+ }));
50
+ }
51
+ export function createContentSchemaTool(service) {
52
+ return defineTool({
53
+ name: 'content.schema',
54
+ version: '1.0.0',
55
+ description: "Describe one or every collection's field shape (key, kind, required, label, kind-specific options) and this site's fixed block vocabulary (block type name, version, and its own field shape) — the type/field names a blocks-kind field's array items may use. Call this before content.write_draft to know which field keys and value shapes a collection actually accepts, instead of guessing.",
56
+ input: InputSchema,
57
+ output: OutputSchema,
58
+ permissions: ['content.read'],
59
+ sideEffects: false,
60
+ reversible: false,
61
+ cost: 'low',
62
+ async execute(input, ctx) {
63
+ const collections = await service.describe({ actor: ctx.actor }, input.collection);
64
+ return {
65
+ collections: collections.map((collection) => ({
66
+ collection: collection.collection,
67
+ labelSingular: collection.labelSingular,
68
+ labelPlural: collection.labelPlural,
69
+ routed: collection.routed,
70
+ fields: collection.fields.map((field) => ({
71
+ key: field.key,
72
+ kind: field.kind,
73
+ label: field.label,
74
+ required: field.required,
75
+ options: field.options,
76
+ })),
77
+ })),
78
+ blocks: blockVocabularyOutput(),
79
+ };
80
+ },
81
+ });
82
+ }
83
+ //# sourceMappingURL=content-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-schema.js","sourceRoot":"","sources":["../../../src/tools/core/content-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AA6DzC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;IACrB,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;CAC3C,CAAC,CAAA;AAEF,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,MAAM,EAAE,CAA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AK,CAAC,QAAQ;wBACxB,OAAO,EAAE,KAAK,CAAC,OAAO;qBACvB,CAAC,CAAC;iBACJ,CAAC,CAAC;gBACH,MAAM,EAAE,qBAAqB,EAAE;aAChC,CAAA;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { z } from 'zod';
2
+ import type { ToolDefinition } from '../types.js';
3
+ export interface DepsScanToolOptions {
4
+ /** Where this site's own `package.json` lives — `create-cogenta` always writes one at the project root. */
5
+ readonly projectRoot: string;
6
+ readonly readFileImpl?: (path: string) => Promise<string>;
7
+ }
8
+ declare const DepsScanInputSchema: z.ZodObject<{}, z.core.$strip>;
9
+ type DepsScanInput = z.infer<typeof DepsScanInputSchema>;
10
+ declare const DepsScanOutputSchema: z.ZodObject<{
11
+ scannedFile: z.ZodString;
12
+ totalDependencies: z.ZodNumber;
13
+ unpinned: z.ZodArray<z.ZodObject<{
14
+ name: z.ZodString;
15
+ range: z.ZodString;
16
+ kind: z.ZodEnum<{
17
+ dependencies: "dependencies";
18
+ devDependencies: "devDependencies";
19
+ }>;
20
+ }, z.core.$strip>>;
21
+ }, z.core.$strip>;
22
+ export type DepsScanOutput = z.infer<typeof DepsScanOutputSchema>;
23
+ export declare function createDepsScanTool(options: DepsScanToolOptions): ToolDefinition<DepsScanInput, DepsScanOutput>;
24
+ export {};
25
+ //# sourceMappingURL=deps-scan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deps-scan.d.ts","sourceRoot":"","sources":["../../../src/tools/core/deps-scan.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAsCjD,MAAM,WAAW,mBAAmB;IAClC,2GAA2G;IAC3G,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;CAC1D;AAED,QAAA,MAAM,mBAAmB,gCAAe,CAAA;AACxC,KAAK,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAQxD,QAAA,MAAM,oBAAoB;;;;;;;;;;;iBAIxB,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAOjE,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,mBAAmB,GAC3B,cAAc,CAAC,aAAa,EAAE,cAAc,CAAC,CAiC/C"}
@@ -0,0 +1,85 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { join } from 'node:path';
3
+ import { z } from 'zod';
4
+ import { defineTool } from '../define.js';
5
+ /**
6
+ * `deps.scan` — the built-in Security Scanner agent's (`agents/builtins.ts`)
7
+ * one real capability, "réutilise... les vérifications déjà documentées dans
8
+ * AGENTS.md" (L22 task 1 item 5): AGENTS.md's own R9 discipline names an
9
+ * unpinned/wildcard version as exactly the kind of dependency risk this
10
+ * project already cares about, so this tool reads the site's own
11
+ * `package.json` (read-only, no shell exec, no network — zero new
12
+ * dependency, R9/R10) and flags any dependency whose version specifier is
13
+ * not pinned in the loose sense semver tooling already treats as "someone
14
+ * decided this range on purpose": `^`, `~`, an exact version, or
15
+ * `workspace:*` inside this monorepo itself. `*`, `latest`, `x`, and a bare
16
+ * tag (`next`) are flagged — a site that ships one of these has no way to
17
+ * know what it will actually install on the next `npm install`.
18
+ *
19
+ * Deliberately narrow: this reads declared ranges, not installed versions or
20
+ * known CVEs (a real vulnerability database is a service dependency this
21
+ * tool does not take — R1). "Audit du journal d'audit pour des motifs
22
+ * suspects" (the other half the lot names for this agent) is not built here;
23
+ * see this task's closing report for why it is left as a documented
24
+ * follow-up rather than a second, rushed tool.
25
+ */
26
+ const UNPINNED_PATTERN = /^(\*|x|latest|next)$/iu;
27
+ function isUnpinned(range) {
28
+ const trimmed = range.trim();
29
+ if (trimmed.length === 0)
30
+ return true;
31
+ if (trimmed.startsWith('workspace:'))
32
+ return false;
33
+ if (UNPINNED_PATTERN.test(trimmed))
34
+ return true;
35
+ // A real semver range operator, or an exact version, or a URL/file spec —
36
+ // none of those are "we don't know what we'll get".
37
+ if (/^[\^~]?\d/u.test(trimmed))
38
+ return false;
39
+ if (/^(git|file|https?):/u.test(trimmed))
40
+ return false;
41
+ return true;
42
+ }
43
+ const DepsScanInputSchema = z.object({});
44
+ const DependencyFindingSchema = z.object({
45
+ name: z.string(),
46
+ range: z.string(),
47
+ kind: z.enum(['dependencies', 'devDependencies']),
48
+ });
49
+ const DepsScanOutputSchema = z.object({
50
+ scannedFile: z.string(),
51
+ totalDependencies: z.number(),
52
+ unpinned: z.array(DependencyFindingSchema),
53
+ });
54
+ export function createDepsScanTool(options) {
55
+ const read = options.readFileImpl ?? ((path) => readFile(path, 'utf8'));
56
+ const packageJsonPath = join(options.projectRoot, 'package.json');
57
+ return defineTool({
58
+ name: 'deps.scan',
59
+ version: '1.0.0',
60
+ description: "Scan this site's own package.json for dependencies with an unpinned or wildcard version.",
61
+ input: DepsScanInputSchema,
62
+ output: DepsScanOutputSchema,
63
+ permissions: ['deps.scan'],
64
+ sideEffects: false,
65
+ reversible: false,
66
+ cost: 'low',
67
+ async execute() {
68
+ const raw = await read(packageJsonPath);
69
+ const parsed = JSON.parse(raw);
70
+ const groups = ['dependencies', 'devDependencies'];
71
+ let total = 0;
72
+ const unpinned = [];
73
+ for (const kind of groups) {
74
+ const deps = parsed[kind] ?? {};
75
+ for (const [name, range] of Object.entries(deps)) {
76
+ total += 1;
77
+ if (isUnpinned(range))
78
+ unpinned.push({ name, range, kind });
79
+ }
80
+ }
81
+ return { scannedFile: packageJsonPath, totalDependencies: total, unpinned };
82
+ },
83
+ });
84
+ }
85
+ //# sourceMappingURL=deps-scan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deps-scan.js","sourceRoot":"","sources":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IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;gBAC7D,CAAC;YACH,CAAC;YAED,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,iBAAiB,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAA;QAC7E,CAAC;KACF,CAAC,CAAA;AACJ,CAAC"}
@@ -1,6 +1,22 @@
1
1
  import type { MediaAsset, MediaStore } from '@cogenta/core';
2
2
  import { z } from 'zod';
3
3
  import type { ToolDefinition } from '../types.js';
4
+ /**
5
+ * `media.read`/`media.write`'s output shape — deliberately **not** the same
6
+ * type as `@cogenta/core`'s `MediaAsset` any more.
7
+ *
8
+ * Fiche 46 added `folderId` to `MediaAsset` (the media library's folder
9
+ * tree). Contract C (`docs/04-contrats.md`, ADR-0020) treats an existing
10
+ * tool's signature as figured: growing it — even by an additive field —
11
+ * needs a governance decision this session cannot make unilaterally (unlike
12
+ * contract A or D, contract C's own text carries no "additive is minor"
13
+ * exception for an already-shipped tool). Rather than touch it, `folderId`
14
+ * is stripped before this shape is built at all, so `media.read`/`.write`'s
15
+ * wire output is byte-for-byte what it was before this fiche — an agent
16
+ * asking to move a file between folders needs a new, separate tool, not
17
+ * this one grown quietly.
18
+ */
19
+ type MediaToolAsset = Omit<MediaAsset, 'folderId'>;
4
20
  declare const ReadInputSchema: z.ZodObject<{
5
21
  id: z.ZodString;
6
22
  }, z.core.$strip>;
@@ -12,7 +28,7 @@ type ReadInput = z.infer<typeof ReadInputSchema>;
12
28
  * actual gate, enforced by the manifest before the call ever reaches the
13
29
  * store.
14
30
  */
15
- export declare function createMediaReadTool(store: MediaStore): ToolDefinition<ReadInput, MediaAsset>;
31
+ export declare function createMediaReadTool(store: MediaStore): ToolDefinition<ReadInput, MediaToolAsset>;
16
32
  declare const WriteInputSchema: z.ZodObject<{
17
33
  id: z.ZodString;
18
34
  alt: z.ZodOptional<z.ZodString>;
@@ -33,6 +49,6 @@ type WriteInput = z.infer<typeof WriteInputSchema>;
33
49
  * editing an existing asset's accessibility metadata, which is the concrete
34
50
  * use case this tool exists for (e.g. an accessibility-review agent).
35
51
  */
36
- export declare function createMediaWriteTool(store: MediaStore): ToolDefinition<WriteInput, MediaAsset>;
52
+ export declare function createMediaWriteTool(store: MediaStore): ToolDefinition<WriteInput, MediaToolAsset>;
37
53
  export {};
38
54
  //# sourceMappingURL=media.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../src/tools/core/media.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAoB,MAAM,eAAe,CAAA;AAE7E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAqBjD,QAAA,MAAM,eAAe;;iBAA+B,CAAA;AACpD,KAAK,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AAEhD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,UAAU,GAAG,cAAc,CAAC,SAAS,EAAE,UAAU,CAAC,CAuB5F;AAED,QAAA,MAAM,gBAAgB;;;;;;;;;iBAMpB,CAAA;AACF,KAAK,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAElD;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,UAAU,GAAG,cAAc,CAAC,UAAU,EAAE,UAAU,CAAC,CAuB9F"}
1
+ {"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../src/tools/core/media.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAoB,MAAM,eAAe,CAAA;AAE7E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAIjD;;;;;;;;;;;;;;GAcG;AACH,KAAK,cAAc,GAAG,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;AA0BlD,QAAA,MAAM,eAAe;;iBAA+B,CAAA;AACpD,KAAK,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AAEhD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,UAAU,GAAG,cAAc,CAAC,SAAS,EAAE,cAAc,CAAC,CAuBhG;AAED,QAAA,MAAM,gBAAgB;;;;;;;;;iBAMpB,CAAA;AACF,KAAK,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAElD;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,UAAU,GAChB,cAAc,CAAC,UAAU,EAAE,cAAc,CAAC,CAuB5C"}
@@ -2,6 +2,10 @@ import { CogentaError } from '@cogenta/core';
2
2
  import { z } from 'zod';
3
3
  import { defineTool } from '../define.js';
4
4
  const FocalPointSchema = z.object({ x: z.number(), y: z.number() });
5
+ function toToolAsset(asset) {
6
+ const { folderId: _folderId, ...rest } = asset;
7
+ return rest;
8
+ }
5
9
  const MediaAssetSchema = z.object({
6
10
  id: z.string(),
7
11
  kind: z.enum(['image', 'video', 'audio', 'file']),
@@ -15,6 +19,8 @@ const MediaAssetSchema = z.object({
15
19
  decorativeJustification: z.string().nullable(),
16
20
  focal: FocalPointSchema.nullable(),
17
21
  storageKey: z.string(),
22
+ tags: z.array(z.string()),
23
+ contentHash: z.string(),
18
24
  createdAt: z.string(),
19
25
  createdBy: z.string().nullable(),
20
26
  });
@@ -46,7 +52,7 @@ export function createMediaReadTool(store) {
46
52
  hint: 'Check the id, or list media to find the right one.',
47
53
  });
48
54
  }
49
- return asset;
55
+ return toToolAsset(asset);
50
56
  },
51
57
  });
52
58
  }
@@ -86,7 +92,7 @@ export function createMediaWriteTool(store) {
86
92
  : { decorativeJustification: input.decorativeJustification }),
87
93
  ...(input.focal === undefined ? {} : { focal: input.focal }),
88
94
  };
89
- return store.update(input.id, update);
95
+ return toToolAsset(await store.update(input.id, update));
90
96
  },
91
97
  });
92
98
  }
@@ -1 +1 @@
1
- {"version":3,"file":"media.js","sourceRoot":"","sources":["../../../src/tools/core/media.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAGzC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;AAEnE,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACjD,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE;IACvB,uBAAuB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9C,KAAK,EAAE,gBAAgB,CAAC,QAAQ,EAAE;IAClC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,SAAS,EAAE,CAAC,CAAC,MAAM,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,44 @@
1
+ import { z } from 'zod';
2
+ import type { ToolDefinition } from '../types.js';
3
+ /**
4
+ * `logs.read_not_found` — L22 task 3, "le superagent avec accès aux
5
+ * journaux (jamais au code source)". This is the one log this lot wires an
6
+ * agent to: the 404 log `@cogenta/schema`'s `NotFoundLogStore` has kept
7
+ * since fiche 12, never previously reachable from a tool. It carries a path,
8
+ * a hit count and timestamps — no request body, no header, no IP, no user
9
+ * agent (the store's own doc comment says why: `AGENTS.md` § Logs forbids
10
+ * either) — so there is nothing here for R8 to worry about beyond what
11
+ * `assembleContext`'s `data` channel already does for any external text.
12
+ *
13
+ * A narrow structural type, not the full `NotFoundLogStore`, for the same
14
+ * reason `content.ts`'s `ContentServiceLike` is narrow: this tool only ever
15
+ * reads.
16
+ */
17
+ export interface NotFoundLogReader {
18
+ list(options?: {
19
+ readonly limit?: number;
20
+ }): Promise<readonly {
21
+ readonly path: string;
22
+ readonly hits: number;
23
+ readonly firstSeen: number;
24
+ readonly lastSeen: number;
25
+ readonly lastReferrer: string | null;
26
+ }[]>;
27
+ }
28
+ declare const InputSchema: z.ZodObject<{
29
+ limit: z.ZodOptional<z.ZodNumber>;
30
+ }, z.core.$strip>;
31
+ type Input = z.infer<typeof InputSchema>;
32
+ declare const OutputSchema: z.ZodObject<{
33
+ entries: z.ZodArray<z.ZodObject<{
34
+ path: z.ZodString;
35
+ hits: z.ZodNumber;
36
+ firstSeen: z.ZodNumber;
37
+ lastSeen: z.ZodNumber;
38
+ lastReferrer: z.ZodNullable<z.ZodString>;
39
+ }, z.core.$strip>>;
40
+ }, z.core.$strip>;
41
+ type Output = z.infer<typeof OutputSchema>;
42
+ export declare function createNotFoundLogReadTool(store: NotFoundLogReader): ToolDefinition<Input, Output>;
43
+ export {};
44
+ //# sourceMappingURL=not-found-log.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"not-found-log.d.ts","sourceRoot":"","sources":["../../../src/tools/core/not-found-log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAClD,SAAS;QACP,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;QACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;QACrB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;QAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;QACzB,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;KACrC,EAAE,CACJ,CAAA;CACF;AAED,QAAA,MAAM,WAAW;;iBAGf,CAAA;AACF,KAAK,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAA;AAUxC,QAAA,MAAM,YAAY;;;;;;;;iBAA8C,CAAA;AAChE,KAAK,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA;AAE1C,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,iBAAiB,GAAG,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,CAiBjG"}
@@ -0,0 +1,32 @@
1
+ import { z } from 'zod';
2
+ import { defineTool } from '../define.js';
3
+ const InputSchema = z.object({
4
+ /** Highest hit count first, same default and cap as the admin's own `/api/not-found`. */
5
+ limit: z.number().int().positive().max(200).optional(),
6
+ });
7
+ const EntrySchema = z.object({
8
+ path: z.string(),
9
+ hits: z.number(),
10
+ firstSeen: z.number(),
11
+ lastSeen: z.number(),
12
+ lastReferrer: z.string().nullable(),
13
+ });
14
+ const OutputSchema = z.object({ entries: z.array(EntrySchema) });
15
+ export function createNotFoundLogReadTool(store) {
16
+ return defineTool({
17
+ name: 'logs.read_not_found',
18
+ version: '1.0.0',
19
+ description: "Read this site's log of public URLs that answered a 404, sorted by hit count — the paths worth investigating first.",
20
+ input: InputSchema,
21
+ output: OutputSchema,
22
+ permissions: ['logs.read'],
23
+ sideEffects: false,
24
+ reversible: false,
25
+ cost: 'low',
26
+ async execute(input) {
27
+ const entries = await store.list(input.limit === undefined ? {} : { limit: input.limit });
28
+ return { entries: [...entries] };
29
+ },
30
+ });
31
+ }
32
+ //# sourceMappingURL=not-found-log.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"not-found-log.js","sourceRoot":"","sources":["../../../src/tools/core/not-found-log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AA6BzC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,yFAAyF;IACzF,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;CACvD,CAAC,CAAA;AAGF,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACpC,CAAC,CAAA;AAEF,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC,CAAA;AAGhE,MAAM,UAAU,yBAAyB,CAAC,KAAwB;IAChE,OAAO,UAAU,CAAC;QAChB,IAAI,EAAE,qBAAqB;QAC3B,OAAO,EAAE,OA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