@cogenta/agents-builtin 0.3.2 → 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 (37) hide show
  1. package/dist/image-creator/agent.d.ts +40 -0
  2. package/dist/image-creator/agent.d.ts.map +1 -0
  3. package/dist/image-creator/agent.js +48 -0
  4. package/dist/image-creator/agent.js.map +1 -0
  5. package/dist/index.d.ts +12 -0
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +7 -0
  8. package/dist/index.js.map +1 -1
  9. package/dist/theme-creator/agent.d.ts +13 -9
  10. package/dist/theme-creator/agent.d.ts.map +1 -1
  11. package/dist/theme-creator/agent.js +14 -10
  12. package/dist/theme-creator/agent.js.map +1 -1
  13. package/dist/theme-creator/generate-sandbox-theme.d.ts +148 -0
  14. package/dist/theme-creator/generate-sandbox-theme.d.ts.map +1 -0
  15. package/dist/theme-creator/generate-sandbox-theme.js +253 -0
  16. package/dist/theme-creator/generate-sandbox-theme.js.map +1 -0
  17. package/dist/theme-creator/generate-theme-candidates.d.ts +101 -0
  18. package/dist/theme-creator/generate-theme-candidates.d.ts.map +1 -0
  19. package/dist/theme-creator/generate-theme-candidates.js +133 -0
  20. package/dist/theme-creator/generate-theme-candidates.js.map +1 -0
  21. package/dist/theme-creator/preview-sandbox-tool.d.ts +57 -0
  22. package/dist/theme-creator/preview-sandbox-tool.d.ts.map +1 -0
  23. package/dist/theme-creator/preview-sandbox-tool.js +48 -0
  24. package/dist/theme-creator/preview-sandbox-tool.js.map +1 -0
  25. package/dist/theme-creator/read-sandbox-tool.d.ts +57 -0
  26. package/dist/theme-creator/read-sandbox-tool.d.ts.map +1 -0
  27. package/dist/theme-creator/read-sandbox-tool.js +55 -0
  28. package/dist/theme-creator/read-sandbox-tool.js.map +1 -0
  29. package/dist/theme-creator/theme-spec.d.ts +31 -0
  30. package/dist/theme-creator/theme-spec.d.ts.map +1 -0
  31. package/dist/theme-creator/theme-spec.js +254 -0
  32. package/dist/theme-creator/theme-spec.js.map +1 -0
  33. package/dist/theme-creator/write-sandbox-file-tool.d.ts +54 -0
  34. package/dist/theme-creator/write-sandbox-file-tool.d.ts.map +1 -0
  35. package/dist/theme-creator/write-sandbox-file-tool.js +109 -0
  36. package/dist/theme-creator/write-sandbox-file-tool.js.map +1 -0
  37. package/package.json +3 -3
@@ -0,0 +1,40 @@
1
+ import { type AgentDeclaration } from '@cogenta/agents';
2
+ /**
3
+ * "Je pense qu'on doit ajouter un agent de génération d'image, ça permet
4
+ * qu'on le configure en choisissant le bon modèle" — the product owner,
5
+ * asking for images to have an owner rather than being a function call
6
+ * buried in another feature.
7
+ *
8
+ * The model choice that request is about is now real: a provider entry can
9
+ * declare an `imageModel` alongside its text one (`StoredProviderConfig`,
10
+ * `@cogenta/agents`), so an admin picks the image model from the same
11
+ * Providers screen as everything else. A multimodal vendor is one entry
12
+ * sharing one key — which is why this agent's own `model` field still names
13
+ * a *text* provider: it is the model that reasons about what to draw, and
14
+ * the image model is resolved separately from the provider registry. Putting
15
+ * an image model in `model.preferred` would conflate two different kinds of
16
+ * client behind one name, and a fallback chain "anthropic → openai" means
17
+ * nothing for pixels.
18
+ *
19
+ * **What it may do, and what it structurally cannot.** Two tools:
20
+ * `assist.generate_image` (`sideEffects: false` — it returns data URLs and
21
+ * stores nothing, by its own contract) and
22
+ * `media.store_generated_image` (`sideEffects: true`, `reversible: false`).
23
+ * That second pair of flags is not decoration: `withAutonomy` forces an
24
+ * approval for a side-effecting tool that is not reversible *whatever* the
25
+ * configured level, so `autonomous` cannot make this agent fill a library on
26
+ * its own. A human confirms every file that lands. `autonomy: propose` is
27
+ * pinned on top of that, so even the proposal is deliberate.
28
+ *
29
+ * Disabled by default, like every other seed here: nothing exports an
30
+ * "image-creator" entry from `builtinAgentSeeds()`, so this catalog entry is
31
+ * inert until an operator wires it into their own site.
32
+ *
33
+ * Its budget is deliberately small. Image generation is the most expensive
34
+ * call in this codebase by an order of magnitude — `assist.generate_image`
35
+ * carries its own `rateLimit` of 30/hour for that reason — and an agent that
36
+ * can quietly bill a site for a hundred pictures is a bug even when every
37
+ * picture is good.
38
+ */
39
+ export declare const imageCreatorAgent: AgentDeclaration;
40
+ //# sourceMappingURL=agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/image-creator/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAe,MAAM,iBAAiB,CAAA;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,eAAO,MAAM,iBAAiB,EAAE,gBAQ9B,CAAA"}
@@ -0,0 +1,48 @@
1
+ import { defineAgent } from '@cogenta/agents';
2
+ /**
3
+ * "Je pense qu'on doit ajouter un agent de génération d'image, ça permet
4
+ * qu'on le configure en choisissant le bon modèle" — the product owner,
5
+ * asking for images to have an owner rather than being a function call
6
+ * buried in another feature.
7
+ *
8
+ * The model choice that request is about is now real: a provider entry can
9
+ * declare an `imageModel` alongside its text one (`StoredProviderConfig`,
10
+ * `@cogenta/agents`), so an admin picks the image model from the same
11
+ * Providers screen as everything else. A multimodal vendor is one entry
12
+ * sharing one key — which is why this agent's own `model` field still names
13
+ * a *text* provider: it is the model that reasons about what to draw, and
14
+ * the image model is resolved separately from the provider registry. Putting
15
+ * an image model in `model.preferred` would conflate two different kinds of
16
+ * client behind one name, and a fallback chain "anthropic → openai" means
17
+ * nothing for pixels.
18
+ *
19
+ * **What it may do, and what it structurally cannot.** Two tools:
20
+ * `assist.generate_image` (`sideEffects: false` — it returns data URLs and
21
+ * stores nothing, by its own contract) and
22
+ * `media.store_generated_image` (`sideEffects: true`, `reversible: false`).
23
+ * That second pair of flags is not decoration: `withAutonomy` forces an
24
+ * approval for a side-effecting tool that is not reversible *whatever* the
25
+ * configured level, so `autonomous` cannot make this agent fill a library on
26
+ * its own. A human confirms every file that lands. `autonomy: propose` is
27
+ * pinned on top of that, so even the proposal is deliberate.
28
+ *
29
+ * Disabled by default, like every other seed here: nothing exports an
30
+ * "image-creator" entry from `builtinAgentSeeds()`, so this catalog entry is
31
+ * inert until an operator wires it into their own site.
32
+ *
33
+ * Its budget is deliberately small. Image generation is the most expensive
34
+ * call in this codebase by an order of magnitude — `assist.generate_image`
35
+ * carries its own `rateLimit` of 30/hour for that reason — and an agent that
36
+ * can quietly bill a site for a hundred pictures is a bug even when every
37
+ * picture is good.
38
+ */
39
+ export const imageCreatorAgent = defineAgent({
40
+ name: 'image-creator',
41
+ identity: './identity.md',
42
+ model: { preferred: 'claude-sonnet', fallback: 'local' },
43
+ tools: ['assist.generate_image', 'media.store_generated_image'],
44
+ autonomy: { default: 'propose' },
45
+ budget: { tokensPerDay: 40_000, eurPerMonth: 8, callsPerHour: 12 },
46
+ memory: { episodic: false, semantic: false, scope: 'site' },
47
+ });
48
+ //# sourceMappingURL=agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/image-creator/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAqB,WAAW,CAAC;IAC7D,IAAI,EAAE,eAAe;IACrB,QAAQ,EAAE,eAAe;IACzB,KAAK,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,QAAQ,EAAE,OAAO,EAAE;IACxD,KAAK,EAAE,CAAC,uBAAuB,EAAE,6BAA6B,CAAC;IAC/D,QAAQ,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;IAChC,MAAM,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE;IAClE,MAAM,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE;CAC5D,CAAC,CAAA"}
package/dist/index.d.ts CHANGED
@@ -10,6 +10,7 @@ export { designerAgent } from './designer/agent.js';
10
10
  export { developerAgent } from './developer/agent.js';
11
11
  export type { CodePatchInput, CodePatchOutput, CodePatchToolOptions, } from './developer/patch-tool.js';
12
12
  export { createCodePatchTool } from './developer/patch-tool.js';
13
+ export { imageCreatorAgent } from './image-creator/agent.js';
13
14
  export { performanceAgent } from './performance/agent.js';
14
15
  export { compareToBudget } from './performance/budget.js';
15
16
  export type { CruxFormFactor, QueryCruxOptions } from './performance/crux-client.js';
@@ -51,6 +52,17 @@ export { findOrphanedRedirects } from './seo/redirects.js';
51
52
  export { cosineSimilarity } from './seo/similarity.js';
52
53
  export type { SeoAuditResult, SeoFinding, SeoHeading, SeoImage, SeoIssueSeverity, SeoPageInput, } from './seo/types.js';
53
54
  export { themeCreatorAgent } from './theme-creator/agent.js';
55
+ export type { GenerateSandboxThemeInput, GenerateSandboxThemeResult, } from './theme-creator/generate-sandbox-theme.js';
56
+ export { generateSandboxTheme } from './theme-creator/generate-sandbox-theme.js';
57
+ export type { GenerateThemeCandidatesInput, GenerateThemeCandidatesResult, ThemeCandidate, } from './theme-creator/generate-theme-candidates.js';
58
+ export { generateThemeCandidates } from './theme-creator/generate-theme-candidates.js';
59
+ export type { PreviewSandboxInput, PreviewSandboxOutput, PreviewSandboxToolOptions, } from './theme-creator/preview-sandbox-tool.js';
60
+ export { createPreviewSandboxTool } from './theme-creator/preview-sandbox-tool.js';
54
61
  export type { ProposeThemeInput, ProposeThemeOutput, ProposeThemeToolOptions, } from './theme-creator/propose-theme-tool.js';
55
62
  export { createProposeThemeTool } from './theme-creator/propose-theme-tool.js';
63
+ export type { ListSandboxFilesInput, ListSandboxFilesOutput, ReadSandboxFileInput, ReadSandboxFileOutput, ReadSandboxToolsOptions, } from './theme-creator/read-sandbox-tool.js';
64
+ export { createListSandboxFilesTool, createReadSandboxFileTool, } from './theme-creator/read-sandbox-tool.js';
65
+ export { COGENTA_THEME_SPECIFICATION } from './theme-creator/theme-spec.js';
66
+ export type { WriteSandboxFileInput, WriteSandboxFileOutput, WriteSandboxFileToolOptions, } from './theme-creator/write-sandbox-file-tool.js';
67
+ export { createWriteSandboxFileTool } from './theme-creator/write-sandbox-file-tool.js';
56
68
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,YAAY,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAA;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AAChE,YAAY,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,YAAY,EACV,eAAe,EACf,uBAAuB,EACvB,cAAc,EACd,kBAAkB,GACnB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAC5F,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,YAAY,EACV,cAAc,EACd,eAAe,EACf,oBAAoB,GACrB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AACpF,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAA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BAAmB,EACnB,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,yCAAyC,CAAA;AAChD,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAA;AAClF,YAAY,EACV,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,uCAAuC,CAAA;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,YAAY,EACV,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAA;AAC3E,YAAY,EACV,qBAAqB,EACrB,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,4CAA4C,CAAA;AACnD,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAA"}
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@ export { suggestTopicGaps } from './content/topic-gaps.js';
5
5
  export { designerAgent } from './designer/agent.js';
6
6
  export { developerAgent } from './developer/agent.js';
7
7
  export { createCodePatchTool } from './developer/patch-tool.js';
8
+ export { imageCreatorAgent } from './image-creator/agent.js';
8
9
  export { performanceAgent } from './performance/agent.js';
9
10
  export { compareToBudget } from './performance/budget.js';
10
11
  export { queryCrux } from './performance/crux-client.js';
@@ -30,5 +31,11 @@ export { countWords, fleschReadingEase } from './seo/readability.js';
30
31
  export { findOrphanedRedirects } from './seo/redirects.js';
31
32
  export { cosineSimilarity } from './seo/similarity.js';
32
33
  export { themeCreatorAgent } from './theme-creator/agent.js';
34
+ export { generateSandboxTheme } from './theme-creator/generate-sandbox-theme.js';
35
+ export { generateThemeCandidates } from './theme-creator/generate-theme-candidates.js';
36
+ export { createPreviewSandboxTool } from './theme-creator/preview-sandbox-tool.js';
33
37
  export { createProposeThemeTool } from './theme-creator/propose-theme-tool.js';
38
+ export { createListSandboxFilesTool, createReadSandboxFileTool, } from './theme-creator/read-sandbox-tool.js';
39
+ export { COGENTA_THEME_SPECIFICATION } from './theme-creator/theme-spec.js';
40
+ export { createWriteSandboxFileTool } from './theme-creator/write-sandbox-file-tool.js';
34
41
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AAEhE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAO3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAMrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAEzD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AACrE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAEjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAS9D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAMlE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AAMnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AAEjE,OAAO,EAAE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mB,CAAA;AACnD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAEpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAStD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAK5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAMhF,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAA;AAMtF,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAA;AAMlF,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAA;AAQ9E,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAA;AAM3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAA"}
@@ -6,15 +6,19 @@ import { type AgentDeclaration } from '@cogenta/agents';
6
6
  * système détaillé pour ça." (L26 tâche 5, demandé en direct.)
7
7
  *
8
8
  * `theme.propose_theme` (`tools@1.5`) is `sideEffects: false` and has no
9
- * write path at any autonomy level — there is nothing this agent can do
10
- * other than propose, structurally, the same guarantee `designerAgent`
11
- * documents for its own lack of a write tool. `autonomy: propose` is set
12
- * anyway, for the same reason `developerAgent` pins it despite
13
- * `code.propose_patch` already being reversible: this is a user-facing,
14
- * review-worthy action (a new theme candidate an admin will look at before
15
- * doing anything), and `propose` is this codebase's established default
16
- * posture for that shape of feature, not a gate against a write this tool
17
- * could not perform anyway.
9
+ * write path at any autonomy level — the same guarantee `designerAgent`
10
+ * documents for its own lack of a write tool.
11
+ *
12
+ * `theme.write_sandbox_file` (`tools@1.6`, fiche 73 task 7) is different:
13
+ * `sideEffects: true`, `reversible: true`, and it does write — but only ever
14
+ * into one sandbox directory (`.cogenta/theme-sandbox/<id>/`), never into
15
+ * `themes/`, never anything a live request could resolve. `autonomy:
16
+ * propose` still governs both tools identically: for `theme.propose_theme`
17
+ * it is this codebase's established default posture for a review-worthy
18
+ * feature, not a gate against a write the tool could not perform anyway; for
19
+ * `theme.write_sandbox_file` it is a real, load-bearing gate — `withAutonomy`
20
+ * (R4) requires human approval for every sandbox write at this pinned level,
21
+ * exactly as it would for any other `sideEffects: true` tool.
18
22
  *
19
23
  * Disabled by default, the same structural mechanism as every other seed in
20
24
  * this package: nothing exports a "theme-creator" entry from
@@ -1 +1 @@
1
- {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/theme-creator/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAe,MAAM,iBAAiB,CAAA;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,iBAAiB,EAAE,gBAQ9B,CAAA"}
1
+ {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/theme-creator/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAe,MAAM,iBAAiB,CAAA;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,iBAAiB,EAAE,gBAQ9B,CAAA"}
@@ -6,15 +6,19 @@ import { defineAgent } from '@cogenta/agents';
6
6
  * système détaillé pour ça." (L26 tâche 5, demandé en direct.)
7
7
  *
8
8
  * `theme.propose_theme` (`tools@1.5`) is `sideEffects: false` and has no
9
- * write path at any autonomy level — there is nothing this agent can do
10
- * other than propose, structurally, the same guarantee `designerAgent`
11
- * documents for its own lack of a write tool. `autonomy: propose` is set
12
- * anyway, for the same reason `developerAgent` pins it despite
13
- * `code.propose_patch` already being reversible: this is a user-facing,
14
- * review-worthy action (a new theme candidate an admin will look at before
15
- * doing anything), and `propose` is this codebase's established default
16
- * posture for that shape of feature, not a gate against a write this tool
17
- * could not perform anyway.
9
+ * write path at any autonomy level — the same guarantee `designerAgent`
10
+ * documents for its own lack of a write tool.
11
+ *
12
+ * `theme.write_sandbox_file` (`tools@1.6`, fiche 73 task 7) is different:
13
+ * `sideEffects: true`, `reversible: true`, and it does write — but only ever
14
+ * into one sandbox directory (`.cogenta/theme-sandbox/<id>/`), never into
15
+ * `themes/`, never anything a live request could resolve. `autonomy:
16
+ * propose` still governs both tools identically: for `theme.propose_theme`
17
+ * it is this codebase's established default posture for a review-worthy
18
+ * feature, not a gate against a write the tool could not perform anyway; for
19
+ * `theme.write_sandbox_file` it is a real, load-bearing gate — `withAutonomy`
20
+ * (R4) requires human approval for every sandbox write at this pinned level,
21
+ * exactly as it would for any other `sideEffects: true` tool.
18
22
  *
19
23
  * Disabled by default, the same structural mechanism as every other seed in
20
24
  * this package: nothing exports a "theme-creator" entry from
@@ -34,7 +38,7 @@ export const themeCreatorAgent = defineAgent({
34
38
  name: 'theme-creator',
35
39
  identity: './identity.md',
36
40
  model: { preferred: 'claude-sonnet', fallback: 'local' },
37
- tools: ['theme.propose_theme'],
41
+ tools: ['theme.propose_theme', 'theme.write_sandbox_file'],
38
42
  autonomy: { default: 'propose' },
39
43
  budget: { tokensPerDay: 100_000, eurPerMonth: 6, callsPerHour: 20 },
40
44
  memory: { episodic: false, semantic: false, scope: 'site' },
@@ -1 +1 @@
1
- {"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/theme-creator/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAqB,WAAW,CAAC;IAC7D,IAAI,EAAE,eAAe;IACrB,QAAQ,EAAE,eAAe;IACzB,KAAK,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,QAAQ,EAAE,OAAO,EAAE;IACxD,KAAK,EAAE,CAAC,qBAAqB,CAAC;IAC9B,QAAQ,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;IAChC,MAAM,EAAE,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE;IACnE,MAAM,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE;CAC5D,CAAC,CAAA"}
1
+ {"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/theme-creator/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAqB,WAAW,CAAC;IAC7D,IAAI,EAAE,eAAe;IACrB,QAAQ,EAAE,eAAe;IACzB,KAAK,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,QAAQ,EAAE,OAAO,EAAE;IACxD,KAAK,EAAE,CAAC,qBAAqB,EAAE,0BAA0B,CAAC;IAC1D,QAAQ,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;IAChC,MAAM,EAAE,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE;IACnE,MAAM,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE;CAC5D,CAAC,CAAA"}
@@ -0,0 +1,148 @@
1
+ import { type AuditLogLike, type ProgressReporter, type ProviderClient, type ThemeCreatorAttachment } from '@cogenta/agents';
2
+ /**
3
+ * Fiche 73 follow-up, mode 2 made reachable — a live user report: "Générer
4
+ * un thème avec l'IA" could only ever recolour whichever theme package was
5
+ * already active (`theme.propose_theme` → contract D tokens), never write
6
+ * the actual page layout a reference screenshot or a "make it look exactly
7
+ * like this" request asked for. `theme.write_sandbox_file` already existed
8
+ * (fiche 73 task 7) but no admin-facing flow ever drove a model through
9
+ * calling it. This is that flow.
10
+ *
11
+ * **Why it was rebuilt.** The first version of this run did produce themes,
12
+ * and they still came back nowhere near an attached screenshot. Three
13
+ * reasons, all fixed here rather than by asking for a better model:
14
+ *
15
+ * - It ran **open-loop**. The only feedback a write earned was "accepted" or
16
+ * a structural rejection; the model never saw the page its code rendered.
17
+ * `theme.preview_sandbox` (`preview-sandbox-tool.ts`) closes that loop with
18
+ * the render the admin preview screen was already using.
19
+ * - It **began by writing**. The opening message was "write the theme files
20
+ * now", so the first act on a barely-examined screenshot was a manifest,
21
+ * and every later file inherited that first guess. The objectives below
22
+ * now impose look → plan → write → preview → correct.
23
+ * - Its **system prompt was one sentence and ten bullets**, while everything
24
+ * about what a theme actually is sat in a tool `description` — read as API
25
+ * reference for one call, not as standing knowledge. That structural brief
26
+ * is now its own system-prompt section (`theme-spec.ts`), which is also
27
+ * where the palette rule was corrected: a theme owns its design colours
28
+ * instead of inheriting whatever skin the site already had.
29
+ *
30
+ * **Autonomy, deliberately local to this call, not the catalog agent's own.**
31
+ * The "Cogenta Theme Creator" catalog declaration
32
+ * (`theme-creator/agent.ts`) pins `autonomy: { default: 'propose' }` for its
33
+ * *other* entry points (chat, a scheduled trigger) — there, a human should
34
+ * see and approve each sandbox write before it happens. This function is not
35
+ * that entry point: it is the direct implementation of one admin screen's
36
+ * "Générer" button, and a sandbox write is, by the tool's own contract,
37
+ * inert until a *separate*, already-existing, human-confirmed gesture
38
+ * (`checkThemeDeployment`/`deployThemeFromSandbox`, `@cogenta/cli`'s
39
+ * `theme-sandbox.ts`) promotes it into `themes/`. Gating the write itself
40
+ * behind a second approval step here would only make the "Générer" button
41
+ * silently produce nothing — `withAutonomy`'s `propose` level returns
42
+ * `{proposed: true}` without ever calling `writeFile` — while adding no real
43
+ * safety, since deploying stays gated regardless. `autonomous` is therefore
44
+ * the correct level for *this* call specifically, not a loosening of R4: the
45
+ * permission (`theme.write_sandbox`) and the tool's own scope (this one
46
+ * sandbox directory, never `themes/`, never live) are unchanged.
47
+ */
48
+ export interface GenerateSandboxThemeInput {
49
+ readonly client: ProviderClient;
50
+ readonly model: string;
51
+ /** Free text: what the requested theme should look and feel like. */
52
+ readonly description: string;
53
+ readonly siteName: string;
54
+ readonly attachments?: readonly ThemeCreatorAttachment[];
55
+ /** Already created (or about to be created by the first write) — this function never invents its own id. */
56
+ readonly sandboxId: string;
57
+ readonly writeFile: (input: {
58
+ readonly sandboxId: string;
59
+ readonly path: string;
60
+ readonly content: string;
61
+ }) => Promise<{
62
+ readonly path: string;
63
+ }>;
64
+ readonly deleteFile: (input: {
65
+ readonly sandboxId: string;
66
+ readonly path: string;
67
+ }) => Promise<void>;
68
+ /**
69
+ * Present when this run continues an earlier one instead of starting a
70
+ * theme — the operator has seen the result and is asking for a change
71
+ * ("plus sombre", "la grille en deux colonnes"). `description` then holds
72
+ * the change, not the original brief.
73
+ */
74
+ readonly refine?: {
75
+ readonly originalBrief: string;
76
+ /** What was already said, oldest first — so a third request can refer to what the second one settled. */
77
+ readonly priorTurns?: readonly {
78
+ readonly role: 'user' | 'assistant';
79
+ readonly text: string;
80
+ }[];
81
+ };
82
+ /**
83
+ * What this site actually stores, described in plain terms — collection
84
+ * names, their fields, and whether each has a public page.
85
+ *
86
+ * A theme renders the site's content, so a writer that does not know the
87
+ * real collection names invents them; an invented `posts` on a site whose
88
+ * entries live in `article` renders nothing, and the tempting fix is to
89
+ * hardcode articles into the markup, where nobody can edit or translate
90
+ * them. Absent only when the caller has no schema in hand.
91
+ */
92
+ readonly contentModel?: string;
93
+ /** Lists what is already in the sandbox. Required, with `readFile`, for a run that adjusts an existing theme rather than writing a new one. */
94
+ readonly listFiles?: (input: {
95
+ readonly sandboxId: string;
96
+ }) => Promise<readonly string[]>;
97
+ /** Reads one existing sandbox file, so a change can be made to what is really there instead of to what the agent assumes is there. */
98
+ readonly readFile?: (input: {
99
+ readonly sandboxId: string;
100
+ readonly path: string;
101
+ }) => Promise<string>;
102
+ /** Renders what has been written so far, so the run is a closed loop rather than a blind one — see `preview-sandbox-tool.ts`. Omitting it silently returns this run to the old write-and-hope behaviour. */
103
+ readonly renderPreview?: (input: {
104
+ readonly sandboxId: string;
105
+ }) => Promise<{
106
+ readonly ok: true;
107
+ readonly html: string;
108
+ } | {
109
+ readonly ok: false;
110
+ readonly error: string;
111
+ }>;
112
+ readonly onProgress?: ProgressReporter;
113
+ /** R6 — every write this run makes is journalled, the same way every other agent tool call already is. Absent only when the caller has no audit log available yet (never the common case). */
114
+ readonly auditLog?: AuditLogLike;
115
+ /** Hard ceiling on model turns — analysis, a plan, config + render + CSS, then preview-and-correct cycles, all fit under the default. */
116
+ readonly maxSteps?: number;
117
+ /** How many byte-identical tool calls this run tolerates before it stops — see where it is passed for why the runtime default is wrong for this particular loop. */
118
+ readonly maxRepeats?: number;
119
+ readonly signal?: AbortSignal;
120
+ }
121
+ export type GenerateSandboxThemeResult = {
122
+ readonly ok: true;
123
+ readonly sandboxId: string;
124
+ /** Sandbox-relative paths, in the order they were successfully written. */
125
+ readonly filesWritten: readonly string[];
126
+ /** The model's own closing text, whole — it belongs in the conversation, where length is not a problem. */
127
+ readonly rationale: string;
128
+ /**
129
+ * The same thing, cut to something a card can hold.
130
+ *
131
+ * The prompt asks for at most three sentences, and a live run answered
132
+ * with its entire page-by-page analysis instead — several thousand
133
+ * words that stretched the candidate card past any usable height. An
134
+ * instruction is a request; this is the guarantee.
135
+ */
136
+ readonly summary: string;
137
+ } | {
138
+ readonly ok: false;
139
+ readonly reason: string;
140
+ };
141
+ /**
142
+ * Cuts the model's closing text down to a card-sized line: whole sentences
143
+ * while they fit, then a hard character stop so a single unpunctuated
144
+ * paragraph cannot defeat it either.
145
+ */
146
+ export declare function summarise(text: string, limit?: number): string;
147
+ export declare function generateSandboxTheme(input: GenerateSandboxThemeInput): Promise<GenerateSandboxThemeResult>;
148
+ //# sourceMappingURL=generate-sandbox-theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-s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