@uibot/skills 0.0.0-stage → 0.2.1

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 (38) hide show
  1. package/content/agents/artifact-lite.md +33 -0
  2. package/content/agents/default.md +57 -0
  3. package/content/craft/accessibility-baseline.md +6 -0
  4. package/content/craft/animation-discipline.md +6 -0
  5. package/content/craft/anti-ai-slop.md +7 -0
  6. package/content/craft/color.md +6 -0
  7. package/content/craft/density-and-spacing.md +6 -0
  8. package/content/craft/form-validation.md +6 -0
  9. package/content/craft/laws-of-ux.md +6 -0
  10. package/content/craft/rtl-and-bidi.md +5 -0
  11. package/content/craft/state-coverage.md +5 -0
  12. package/content/craft/typography.md +6 -0
  13. package/content/skills/apply-design-md/SKILL.md +73 -0
  14. package/content/skills/extract-design-tokens/SKILL.md +80 -0
  15. package/content/skills/generate-admin-page/SKILL.md +200 -0
  16. package/content/skills/generate-landing-page/SKILL.md +114 -0
  17. package/content/skills/html-deck/SKILL.md +53 -0
  18. package/content/skills/html-mobile-mockup/SKILL.md +49 -0
  19. package/content/skills/html-prototype/SKILL.md +49 -0
  20. package/content/skills/html-social-carousel/SKILL.md +90 -0
  21. package/content/skills/html-social-carousel/example.html +219 -0
  22. package/content/skills/uibot-yaml-spec/SKILL.md +166 -0
  23. package/dist/builtin-pack.d.ts +36 -0
  24. package/dist/capability.d.ts +16 -0
  25. package/dist/evolver.d.ts +85 -0
  26. package/dist/fs-source.d.ts +10 -0
  27. package/dist/index.d.ts +19 -0
  28. package/dist/index.js +162 -0
  29. package/dist/loader.d.ts +11 -0
  30. package/dist/match.d.ts +12 -0
  31. package/dist/reflection-store.d.ts +21 -0
  32. package/dist/registry.d.ts +10 -0
  33. package/dist/regression-store.d.ts +37 -0
  34. package/dist/schema.d.ts +9 -0
  35. package/dist/selector.d.ts +19 -0
  36. package/dist/usage-store.d.ts +24 -0
  37. package/package.json +38 -4
  38. package/README.md +0 -3
@@ -0,0 +1,85 @@
1
+ import type { SkillEvolutionProposal } from "@uibot/contracts";
2
+ import type { SkillRegistry } from "./registry.js";
3
+ import type { SkillUsageStore } from "./usage-store.js";
4
+ import type { ReflectionStore } from "./reflection-store.js";
5
+ export interface SkillEvolverOptions {
6
+ /** Root directory containing `.uibot/skills/` */
7
+ rootDir: string;
8
+ /**
9
+ * Minimum consecutive failure count before triggering a proposal.
10
+ * Default: 10
11
+ */
12
+ failureThreshold?: number;
13
+ /**
14
+ * Cooldown in milliseconds between proposals for the same skill.
15
+ * Default: 86_400_000 (24 hours)
16
+ */
17
+ cooldownMs?: number;
18
+ /**
19
+ * Callback to generate an improved SKILL.md body.
20
+ * Receives the current body and failure context; returns improved body.
21
+ * In production this calls `ModelRegistry.generate()`; in tests inject a mock.
22
+ */
23
+ generateImprovedBody: (input: {
24
+ currentBody: string;
25
+ failureContext: string;
26
+ }) => Promise<string>;
27
+ /**
28
+ * Optional: generate a short natural-language reflection (1–2 sentences)
29
+ * diagnosing a single failure. Called by `reflectOnFailure`; result is
30
+ * persisted to `reflectionStore` and injected into later `poll()` proposals.
31
+ */
32
+ generateReflection?: (input: {
33
+ skillId: string;
34
+ skillBody: string;
35
+ trigger: "render-fail" | "user-thumb-down";
36
+ context: string;
37
+ }) => Promise<string>;
38
+ /** Store for reflections. Required when `generateReflection` is provided. */
39
+ reflectionStore?: ReflectionStore;
40
+ /** How many recent reflections to inject into failureContext. Default 10. */
41
+ reflectionLimit?: number;
42
+ /**
43
+ * Best-of-N tournament: how many candidate bodies to generate per round.
44
+ * >= 2 enables population-based evolution (AutoAgent-style); the highest-scoring
45
+ * candidate wins. Default 1 (current single-shot behavior).
46
+ */
47
+ populationSize?: number;
48
+ /**
49
+ * Required when `populationSize > 1`. Scores a candidate body (higher = better).
50
+ * Thrown errors are caught and treated as `-Infinity` (candidate is dropped).
51
+ * Common implementation: run `EvalRunner.run` against the first trigger and
52
+ * return `candidate.overallScore - current.overallScore`.
53
+ */
54
+ evaluateCandidate?: (input: {
55
+ skillId: string;
56
+ currentBody: string;
57
+ candidateBody: string;
58
+ candidateIndex: number;
59
+ }) => Promise<number>;
60
+ }
61
+ /**
62
+ * Polls a skill's usage signal and emits a `SkillEvolutionProposal` when:
63
+ * - Consecutive failures ≥ `failureThreshold` (default 10), AND
64
+ * - No proposal was created within `cooldownMs` (default 24h).
65
+ *
66
+ * Does NOT directly promote — promotion is handled by `AutoPromoter`.
67
+ */
68
+ export declare class SkillEvolver {
69
+ private readonly options;
70
+ private readonly failureThreshold;
71
+ private readonly cooldownMs;
72
+ constructor(options: SkillEvolverOptions);
73
+ /**
74
+ * Generate and persist one reflection for a single failure event. Idempotent,
75
+ * fire-and-forget safe — swallows errors so the caller's signal path is
76
+ * never blocked. Skipped silently when `generateReflection` or `reflectionStore`
77
+ * is not configured, or when the skill is unknown to the registry.
78
+ */
79
+ reflectOnFailure(skillId: string, trigger: "render-fail" | "user-thumb-down", registry: SkillRegistry, context?: string): Promise<void>;
80
+ /**
81
+ * Poll a single skill and create a proposal if conditions are met.
82
+ * Returns the proposal if one was created, or null otherwise.
83
+ */
84
+ poll(skillId: string, registry: SkillRegistry, _usageStore: SkillUsageStore): Promise<SkillEvolutionProposal | null>;
85
+ }
@@ -0,0 +1,10 @@
1
+ import type { Skill } from "@uibot/contracts";
2
+ import type { SkillRegistry } from "./registry.js";
3
+ /**
4
+ * Scan `<rootDir>/.uibot/skills/` for skill directories.
5
+ * Each subdirectory is expected to contain a `SKILL.md` file.
6
+ * Files that fail to parse are skipped with a console warning.
7
+ */
8
+ export declare function scanSkillsDir(rootDir: string): Skill[];
9
+ /** Convenience: scan rootDir and register all found skills into the given registry. */
10
+ export declare function loadFromFs(rootDir: string, registry: SkillRegistry): void;
@@ -0,0 +1,19 @@
1
+ export { splitFrontmatter, parseSkillFrontmatter } from "./schema.js";
2
+ export type { SkillFrontmatter } from "./schema.js";
3
+ export { loadSkillFile, SkillLoadError } from "./loader.js";
4
+ export { SkillRegistry } from "./registry.js";
5
+ export { scanSkillsDir, loadFromFs } from "./fs-source.js";
6
+ export { BUILTIN_PACK_DIR, BUILTIN_PACK_KINDS, seedBuiltinPack } from "./builtin-pack.js";
7
+ export type { SeedBuiltinPackOptions, SeedBuiltinPackResult } from "./builtin-pack.js";
8
+ export { SkillSelectorImpl } from "./selector.js";
9
+ export { scoreSkillMatch, triggerMatches } from "./match.js";
10
+ export { SkillUsageStore } from "./usage-store.js";
11
+ export type { SkillUsageStoreOptions } from "./usage-store.js";
12
+ export { ReflectionStore } from "./reflection-store.js";
13
+ export type { ReflectionStoreOptions } from "./reflection-store.js";
14
+ export { RegressionStore } from "./regression-store.js";
15
+ export type { RegressionStoreOptions } from "./regression-store.js";
16
+ export { createUIBotSkillsPlugin } from "./capability.js";
17
+ export type { UIBotSkillsPluginOptions } from "./capability.js";
18
+ export { SkillEvolver } from "./evolver.js";
19
+ export type { SkillEvolverOptions } from "./evolver.js";