self-evolving-workflow 0.0.0-stage → 0.1.4
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.
- package/LICENSE +27 -0
- package/README.md +195 -2
- package/dist/agent-memory-prompts.d.ts +13 -0
- package/dist/agent-memory-prompts.js +55 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +6 -0
- package/dist/closeout.d.ts +105 -0
- package/dist/closeout.js +473 -0
- package/dist/code.d.ts +39 -0
- package/dist/code.js +124 -0
- package/dist/codex-memory.d.ts +24 -0
- package/dist/codex-memory.js +217 -0
- package/dist/common.d.ts +16 -0
- package/dist/common.js +52 -0
- package/dist/context-envelope.d.ts +59 -0
- package/dist/context-envelope.js +23 -0
- package/dist/host-adapters.d.ts +34 -0
- package/dist/host-adapters.js +151 -0
- package/dist/http.d.ts +3 -0
- package/dist/http.js +90 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +13 -0
- package/dist/knowledge-cli.d.ts +198 -0
- package/dist/knowledge-cli.js +761 -0
- package/dist/knowledge-reads.d.ts +72 -0
- package/dist/knowledge-reads.js +201 -0
- package/dist/memory-config.d.ts +44 -0
- package/dist/memory-config.js +204 -0
- package/dist/memory-evidence.d.ts +13 -0
- package/dist/memory-evidence.js +40 -0
- package/dist/memory-history.d.ts +46 -0
- package/dist/memory-history.js +432 -0
- package/dist/memory.d.ts +96 -0
- package/dist/memory.js +362 -0
- package/dist/retrospective.d.ts +57 -0
- package/dist/retrospective.js +240 -0
- package/dist/search.d.ts +36 -0
- package/dist/search.js +112 -0
- package/dist/skill-addition.d.ts +25 -0
- package/dist/skill-addition.js +89 -0
- package/dist/skill-design.d.ts +96 -0
- package/dist/skill-design.js +226 -0
- package/dist/skill-replay.d.ts +55 -0
- package/dist/skill-replay.js +448 -0
- package/dist/skill-route.d.ts +30 -0
- package/dist/skill-route.js +75 -0
- package/dist/transcript-evidence.d.ts +3 -0
- package/dist/transcript-evidence.js +58 -0
- package/dist/upstream/chunker.d.ts +24 -0
- package/dist/upstream/chunker.js +96 -0
- package/dist/upstream/file-protocol.d.ts +45 -0
- package/dist/upstream/file-protocol.js +117 -0
- package/dist/upstream/frontmatter.d.ts +47 -0
- package/dist/upstream/frontmatter.js +86 -0
- package/dist/upstream/graph-search.d.ts +33 -0
- package/dist/upstream/graph-search.js +67 -0
- package/dist/upstream/l1-extraction.d.ts +26 -0
- package/dist/upstream/l1-extraction.js +405 -0
- package/dist/upstream/llm.d.ts +8 -0
- package/dist/upstream/llm.js +1 -0
- package/dist/upstream/merge.d.ts +50 -0
- package/dist/upstream/merge.js +153 -0
- package/dist/upstream/prompts.d.ts +53 -0
- package/dist/upstream/prompts.js +181 -0
- package/dist/upstream/search-utils.d.ts +34 -0
- package/dist/upstream/search-utils.js +55 -0
- package/dist/upstream/slug.d.ts +26 -0
- package/dist/upstream/slug.js +103 -0
- package/dist/upstream/template.d.ts +29 -0
- package/dist/upstream/template.js +80 -0
- package/dist/upstream/tokenize.d.ts +4 -0
- package/dist/upstream/tokenize.js +29 -0
- package/dist/wiki-change.d.ts +76 -0
- package/dist/wiki-change.js +299 -0
- package/dist/wiki-entry.d.ts +26 -0
- package/dist/wiki-entry.js +93 -0
- package/dist/wiki-ingest.d.ts +12 -0
- package/dist/wiki-ingest.js +126 -0
- package/dist/wiki-migration.d.ts +16 -0
- package/dist/wiki-migration.js +268 -0
- package/dist/wiki-tokens.d.ts +1 -0
- package/dist/wiki-tokens.js +46 -0
- package/dist/wiki.d.ts +103 -0
- package/dist/wiki.js +330 -0
- package/dist/workflow-cli.d.ts +2 -0
- package/dist/workflow-cli.js +319 -0
- package/dist/workflow-install.d.ts +37 -0
- package/dist/workflow-install.js +148 -0
- package/dist/workflow-knowledge.d.ts +18 -0
- package/dist/workflow-knowledge.js +32 -0
- package/dist/workflow-mcp.d.ts +2 -0
- package/dist/workflow-mcp.js +137 -0
- package/dist/workflow-names.d.ts +4 -0
- package/dist/workflow-names.js +31 -0
- package/dist/workflow-runtime.d.ts +735 -0
- package/dist/workflow-runtime.js +747 -0
- package/dist/workflow-skills.d.ts +48 -0
- package/dist/workflow-skills.js +141 -0
- package/docs/images/impeccable-skill.png +0 -0
- package/docs/images/workflow-overview.png +0 -0
- package/docs/images/workflow-skills.png +0 -0
- package/package.json +77 -4
- package/skills/ew-impeccable/LICENSE +191 -0
- package/skills/ew-impeccable/NOTICE.md +19 -0
- package/skills/ew-impeccable/SKILL.md +91 -0
- package/skills/ew-impeccable/UPSTREAM.md +23 -0
- package/skills/ew-impeccable/reference/adapt.md +314 -0
- package/skills/ew-impeccable/reference/adapt.native.md +60 -0
- package/skills/ew-impeccable/reference/android.md +46 -0
- package/skills/ew-impeccable/reference/animate.md +91 -0
- package/skills/ew-impeccable/reference/audit.md +138 -0
- package/skills/ew-impeccable/reference/audit.native.md +141 -0
- package/skills/ew-impeccable/reference/bolder.md +35 -0
- package/skills/ew-impeccable/reference/clarify.md +96 -0
- package/skills/ew-impeccable/reference/colorize.md +88 -0
- package/skills/ew-impeccable/reference/craft-floor.md +44 -0
- package/skills/ew-impeccable/reference/craft.md +5 -0
- package/skills/ew-impeccable/reference/critique.md +808 -0
- package/skills/ew-impeccable/reference/degraded/asset-producer.md +36 -0
- package/skills/ew-impeccable/reference/degraded/documenter.md +23 -0
- package/skills/ew-impeccable/reference/degraded/finish-reviewer.md +72 -0
- package/skills/ew-impeccable/reference/degraded/manual-edit-applier.md +91 -0
- package/skills/ew-impeccable/reference/delight.md +72 -0
- package/skills/ew-impeccable/reference/distill.md +113 -0
- package/skills/ew-impeccable/reference/doctor.md +56 -0
- package/skills/ew-impeccable/reference/document.md +418 -0
- package/skills/ew-impeccable/reference/extract.md +68 -0
- package/skills/ew-impeccable/reference/harden.md +338 -0
- package/skills/ew-impeccable/reference/hooks.md +113 -0
- package/skills/ew-impeccable/reference/init.md +133 -0
- package/skills/ew-impeccable/reference/ios.md +51 -0
- package/skills/ew-impeccable/reference/layout.md +86 -0
- package/skills/ew-impeccable/reference/live-setup.md +102 -0
- package/skills/ew-impeccable/reference/live.md +326 -0
- package/skills/ew-impeccable/reference/new-work.md +209 -0
- package/skills/ew-impeccable/reference/onboard.md +236 -0
- package/skills/ew-impeccable/reference/operate.md +61 -0
- package/skills/ew-impeccable/reference/optimize.md +260 -0
- package/skills/ew-impeccable/reference/overdrive.md +127 -0
- package/skills/ew-impeccable/reference/polish.md +105 -0
- package/skills/ew-impeccable/reference/quieter.md +101 -0
- package/skills/ew-impeccable/reference/routing.md +20 -0
- package/skills/ew-impeccable/reference/shape.md +59 -0
- package/skills/ew-impeccable/reference/typeset.md +82 -0
- package/skills/ew-impeccable/reference/visualize.md +46 -0
- package/skills/ew-impeccable/scripts/build-phase.mjs +1022 -0
- package/skills/ew-impeccable/scripts/command-metadata.json +94 -0
- package/skills/ew-impeccable/scripts/comp-diff.mjs +391 -0
- package/skills/ew-impeccable/scripts/comp-spec.mjs +513 -0
- package/skills/ew-impeccable/scripts/concept-seed.mjs +814 -0
- package/skills/ew-impeccable/scripts/context-signals.mjs +325 -0
- package/skills/ew-impeccable/scripts/context.mjs +1521 -0
- package/skills/ew-impeccable/scripts/critique-storage.mjs +473 -0
- package/skills/ew-impeccable/scripts/data/font-index-failures.json +121 -0
- package/skills/ew-impeccable/scripts/data/font-index.json +1 -0
- package/skills/ew-impeccable/scripts/detect-csp.mjs +246 -0
- package/skills/ew-impeccable/scripts/detect.mjs +30 -0
- package/skills/ew-impeccable/scripts/detector/browser/injected/index.mjs +2580 -0
- package/skills/ew-impeccable/scripts/detector/cli/main.mjs +498 -0
- package/skills/ew-impeccable/scripts/detector/design-system.mjs +1311 -0
- package/skills/ew-impeccable/scripts/detector/detect-antipatterns-browser.js +9486 -0
- package/skills/ew-impeccable/scripts/detector/detect-antipatterns.mjs +51 -0
- package/skills/ew-impeccable/scripts/detector/engines/browser/detect-url.mjs +434 -0
- package/skills/ew-impeccable/scripts/detector/engines/regex/detect-text.mjs +1439 -0
- package/skills/ew-impeccable/scripts/detector/engines/static-html/css-cascade.mjs +1242 -0
- package/skills/ew-impeccable/scripts/detector/engines/static-html/detect-html.mjs +263 -0
- package/skills/ew-impeccable/scripts/detector/engines/visual/screenshot-contrast.mjs +189 -0
- package/skills/ew-impeccable/scripts/detector/findings.mjs +23 -0
- package/skills/ew-impeccable/scripts/detector/node/file-system.mjs +225 -0
- package/skills/ew-impeccable/scripts/detector/profile/profiler.mjs +166 -0
- package/skills/ew-impeccable/scripts/detector/registry/antipatterns.mjs +636 -0
- package/skills/ew-impeccable/scripts/detector/rules/checks.mjs +5750 -0
- package/skills/ew-impeccable/scripts/detector/shared/color.mjs +596 -0
- package/skills/ew-impeccable/scripts/detector/shared/constants.mjs +127 -0
- package/skills/ew-impeccable/scripts/detector/shared/fonts.mjs +30 -0
- package/skills/ew-impeccable/scripts/detector/shared/inline-ignores.mjs +148 -0
- package/skills/ew-impeccable/scripts/detector/shared/page.mjs +7 -0
- package/skills/ew-impeccable/scripts/detector/vendor/MDN-DATA-LICENSE +116 -0
- package/skills/ew-impeccable/scripts/detector/vendor/THIRD_PARTY_LICENSES.md +227 -0
- package/skills/ew-impeccable/scripts/detector/vendor/static-html-parser.build-entry.txt +11 -0
- package/skills/ew-impeccable/scripts/detector/vendor/static-html-parser.bundle.mjs +9121 -0
- package/skills/ew-impeccable/scripts/doctor.mjs +330 -0
- package/skills/ew-impeccable/scripts/embed-prompt.mjs +166 -0
- package/skills/ew-impeccable/scripts/font-match.mjs +457 -0
- package/skills/ew-impeccable/scripts/generate-image.mjs +447 -0
- package/skills/ew-impeccable/scripts/hook-admin.mjs +829 -0
- package/skills/ew-impeccable/scripts/hook-before-edit.mjs +538 -0
- package/skills/ew-impeccable/scripts/hook-lib.mjs +2493 -0
- package/skills/ew-impeccable/scripts/hook.mjs +79 -0
- package/skills/ew-impeccable/scripts/lib/artifact-schema.mjs +93 -0
- package/skills/ew-impeccable/scripts/lib/composition-catalog.mjs +200 -0
- package/skills/ew-impeccable/scripts/lib/concept-catalog.mjs +395 -0
- package/skills/ew-impeccable/scripts/lib/design-parser.mjs +880 -0
- package/skills/ew-impeccable/scripts/lib/font-fingerprint.mjs +564 -0
- package/skills/ew-impeccable/scripts/lib/font-index.mjs +130 -0
- package/skills/ew-impeccable/scripts/lib/hero-checks.mjs +246 -0
- package/skills/ew-impeccable/scripts/lib/image-metrics.mjs +306 -0
- package/skills/ew-impeccable/scripts/lib/impeccable-config.mjs +640 -0
- package/skills/ew-impeccable/scripts/lib/impeccable-paths.mjs +137 -0
- package/skills/ew-impeccable/scripts/lib/is-generated.mjs +72 -0
- package/skills/ew-impeccable/scripts/lib/live-path-globs.mjs +37 -0
- package/skills/ew-impeccable/scripts/lib/open-system-browser.mjs +26 -0
- package/skills/ew-impeccable/scripts/lib/png.mjs +281 -0
- package/skills/ew-impeccable/scripts/lib/provider.mjs +5 -0
- package/skills/ew-impeccable/scripts/lib/raster.mjs +194 -0
- package/skills/ew-impeccable/scripts/lib/roll-selection.mjs +369 -0
- package/skills/ew-impeccable/scripts/lib/staleness-deep.mjs +491 -0
- package/skills/ew-impeccable/scripts/lib/staleness-notice.mjs +169 -0
- package/skills/ew-impeccable/scripts/lib/staleness.mjs +532 -0
- package/skills/ew-impeccable/scripts/lib/surface-briefs.mjs +149 -0
- package/skills/ew-impeccable/scripts/lib/target-args.mjs +42 -0
- package/skills/ew-impeccable/scripts/lib/target-slug.mjs +33 -0
- package/skills/ew-impeccable/scripts/lib/template-extensions.mjs +146 -0
- package/skills/ew-impeccable/scripts/live/accept-css.mjs +617 -0
- package/skills/ew-impeccable/scripts/live/accept-verify.mjs +60 -0
- package/skills/ew-impeccable/scripts/live/browser-script-parts.mjs +84 -0
- package/skills/ew-impeccable/scripts/live/completion.mjs +28 -0
- package/skills/ew-impeccable/scripts/live/event-validation.mjs +199 -0
- package/skills/ew-impeccable/scripts/live/frameworks/astro.mjs +47 -0
- package/skills/ew-impeccable/scripts/live/frameworks/detect-utils.mjs +73 -0
- package/skills/ew-impeccable/scripts/live/frameworks/index.mjs +143 -0
- package/skills/ew-impeccable/scripts/live/frameworks/journal.mjs +197 -0
- package/skills/ew-impeccable/scripts/live/frameworks/nextjs.mjs +49 -0
- package/skills/ew-impeccable/scripts/live/frameworks/nuxt.mjs +161 -0
- package/skills/ew-impeccable/scripts/live/frameworks/script-src.mjs +17 -0
- package/skills/ew-impeccable/scripts/live/frameworks/static-html.mjs +26 -0
- package/skills/ew-impeccable/scripts/live/frameworks/sveltekit.mjs +71 -0
- package/skills/ew-impeccable/scripts/live/frameworks/tag-strategy.mjs +247 -0
- package/skills/ew-impeccable/scripts/live/frameworks/tanstack-start.mjs +70 -0
- package/skills/ew-impeccable/scripts/live/frameworks/vite-generic.mjs +42 -0
- package/skills/ew-impeccable/scripts/live/generation-preflight.mjs +149 -0
- package/skills/ew-impeccable/scripts/live/insert-ui.mjs +458 -0
- package/skills/ew-impeccable/scripts/live/instructions.mjs +142 -0
- package/skills/ew-impeccable/scripts/live/manual-apply.mjs +939 -0
- package/skills/ew-impeccable/scripts/live/manual-edit-routes.mjs +357 -0
- package/skills/ew-impeccable/scripts/live/manual-edits-buffer.mjs +152 -0
- package/skills/ew-impeccable/scripts/live/poll-lanes.mjs +14 -0
- package/skills/ew-impeccable/scripts/live/project-ignores.mjs +139 -0
- package/skills/ew-impeccable/scripts/live/roots.mjs +508 -0
- package/skills/ew-impeccable/scripts/live/session-store.mjs +563 -0
- package/skills/ew-impeccable/scripts/live/source-lock.mjs +105 -0
- package/skills/ew-impeccable/scripts/live/source-search.mjs +105 -0
- package/skills/ew-impeccable/scripts/live/svelte-ast.mjs +969 -0
- package/skills/ew-impeccable/scripts/live/svelte-component.mjs +1366 -0
- package/skills/ew-impeccable/scripts/live/sveltekit-adapter.mjs +304 -0
- package/skills/ew-impeccable/scripts/live/tanstack-adapter.mjs +259 -0
- package/skills/ew-impeccable/scripts/live/ui-surfaces.mjs +75 -0
- package/skills/ew-impeccable/scripts/live/vocabulary.mjs +171 -0
- package/skills/ew-impeccable/scripts/live-accept.mjs +938 -0
- package/skills/ew-impeccable/scripts/live-browser-dom.js +167 -0
- package/skills/ew-impeccable/scripts/live-browser-ignores.js +242 -0
- package/skills/ew-impeccable/scripts/live-browser-session.js +144 -0
- package/skills/ew-impeccable/scripts/live-browser.js +12851 -0
- package/skills/ew-impeccable/scripts/live-commit-manual-edits.mjs +1200 -0
- package/skills/ew-impeccable/scripts/live-complete.mjs +107 -0
- package/skills/ew-impeccable/scripts/live-copy-edit-agent.mjs +800 -0
- package/skills/ew-impeccable/scripts/live-discard-manual-edits.mjs +51 -0
- package/skills/ew-impeccable/scripts/live-inject.mjs +463 -0
- package/skills/ew-impeccable/scripts/live-insert.mjs +292 -0
- package/skills/ew-impeccable/scripts/live-manual-edit-evidence.mjs +368 -0
- package/skills/ew-impeccable/scripts/live-poll.mjs +430 -0
- package/skills/ew-impeccable/scripts/live-resume.mjs +123 -0
- package/skills/ew-impeccable/scripts/live-server.mjs +1698 -0
- package/skills/ew-impeccable/scripts/live-status.mjs +71 -0
- package/skills/ew-impeccable/scripts/live-target.mjs +30 -0
- package/skills/ew-impeccable/scripts/live-wrap.mjs +927 -0
- package/skills/ew-impeccable/scripts/live.mjs +334 -0
- package/skills/ew-impeccable/scripts/modern-screenshot.umd.js +14 -0
- package/skills/ew-impeccable/scripts/palette.mjs +628 -0
- package/skills/ew-impeccable/scripts/pin.mjs +352 -0
- package/skills/ew-impeccable/scripts/serve-question.mjs +1783 -0
- package/skills/ew-impeccable/scripts/surface-brief.mjs +74 -0
- package/skills/ew-knowledge/SKILL.md +35 -0
- package/skills/ew-knowledge/references/closeout-protocol.md +68 -0
- package/skills/ew-knowledge/references/knowledge-route.md +73 -0
- package/skills/ew-knowledge/references/wiki-maintenance.md +27 -0
- package/skills/ew-odyssey/SKILL.md +106 -0
- package/skills/ew-odyssey/references/audit-artifacts.md +7 -0
- package/skills/ew-odyssey/references/odyssey-base.md +104 -0
- package/skills/ew-odyssey/references/odyssey-debug.md +264 -0
- package/skills/ew-odyssey/references/odyssey-defensive.md +351 -0
- package/skills/ew-odyssey/references/odyssey-improve.md +230 -0
- package/skills/ew-odyssey/references/odyssey-planex.md +294 -0
- package/skills/ew-odyssey/references/odyssey-review.md +233 -0
- package/skills/ew-odyssey/references/odyssey-security.md +231 -0
- package/skills/ew-odyssey/references/odyssey-ui.md +232 -0
- package/skills/ew-odyssey/references/prepare/odyssey-debug.md +102 -0
- package/skills/ew-odyssey/references/prepare/odyssey-defensive.md +117 -0
- package/skills/ew-odyssey/references/prepare/odyssey-improve.md +95 -0
- package/skills/ew-odyssey/references/prepare/odyssey-planex.md +105 -0
- package/skills/ew-odyssey/references/prepare/odyssey-review.md +105 -0
- package/skills/ew-odyssey/references/prepare/odyssey-security.md +91 -0
- package/skills/ew-odyssey/references/prepare/odyssey-ui.md +88 -0
- package/skills/ew-odyssey/references/runtime-adapters.md +31 -0
- package/skills/ew-orchestrate/SKILL.md +89 -0
- package/skills/ew-orchestrate/references/auto-policy.md +66 -0
- package/skills/ew-orchestrate/references/boundary-grill.md +51 -0
- package/skills/ew-orchestrate/references/companion-route.md +40 -0
- package/skills/ew-orchestrate/references/ew-orchestrate.md +44 -0
- package/skills/ew-orchestrate/references/goal.md +51 -0
- package/skills/ew-orchestrate/references/orchestrator-run-loop.md +33 -0
- package/skills/ew-orchestrate/references/planning.md +54 -0
- package/skills/ew-orchestrate/steps/ew-analyze/SKILL.md +70 -0
- package/skills/ew-orchestrate/steps/ew-analyze/references/issue-gaps-analyze.md +24 -0
- package/skills/ew-orchestrate/steps/ew-analyze/references/prepare.md +8 -0
- package/skills/ew-orchestrate/steps/ew-analyze/references/workflow.md +138 -0
- package/skills/ew-orchestrate/steps/ew-auto-test/SKILL.md +80 -0
- package/skills/ew-orchestrate/steps/ew-auto-test/references/prepare.md +23 -0
- package/skills/ew-orchestrate/steps/ew-auto-test/references/workflow.md +31 -0
- package/skills/ew-orchestrate/steps/ew-blueprint/SKILL.md +122 -0
- package/skills/ew-orchestrate/steps/ew-blueprint/references/prepare.md +21 -0
- package/skills/ew-orchestrate/steps/ew-blueprint/references/workflow.md +28 -0
- package/skills/ew-orchestrate/steps/ew-brainstorm/SKILL.md +49 -0
- package/skills/ew-orchestrate/steps/ew-companion/SKILL.md +50 -0
- package/skills/ew-orchestrate/steps/ew-debug/SKILL.md +85 -0
- package/skills/ew-orchestrate/steps/ew-debug/references/prepare.md +27 -0
- package/skills/ew-orchestrate/steps/ew-debug/references/workflow.md +31 -0
- package/skills/ew-orchestrate/steps/ew-execute/SKILL.md +74 -0
- package/skills/ew-orchestrate/steps/ew-execute/references/prepare.md +27 -0
- package/skills/ew-orchestrate/steps/ew-execute/references/workflow.md +87 -0
- package/skills/ew-orchestrate/steps/ew-grill/SKILL.md +62 -0
- package/skills/ew-orchestrate/steps/ew-grill/references/prepare.md +26 -0
- package/skills/ew-orchestrate/steps/ew-grill/references/workflow.md +31 -0
- package/skills/ew-orchestrate/steps/ew-init/SKILL.md +56 -0
- package/skills/ew-orchestrate/steps/ew-init/references/prepare.md +25 -0
- package/skills/ew-orchestrate/steps/ew-init/references/workflow.md +28 -0
- package/skills/ew-orchestrate/steps/ew-plan/SKILL.md +131 -0
- package/skills/ew-orchestrate/steps/ew-plan/references/prepare.md +8 -0
- package/skills/ew-orchestrate/steps/ew-plan/references/tdd.md +53 -0
- package/skills/ew-orchestrate/steps/ew-plan/references/workflow.md +100 -0
- package/skills/ew-orchestrate/steps/ew-retrospective/SKILL.md +68 -0
- package/skills/ew-orchestrate/steps/ew-retrospective/references/prepare.md +18 -0
- package/skills/ew-orchestrate/steps/ew-retrospective/references/workflow.md +34 -0
- package/skills/ew-orchestrate/steps/ew-review/SKILL.md +45 -0
- package/skills/ew-orchestrate/steps/ew-review/references/prepare.md +17 -0
- package/skills/ew-orchestrate/steps/ew-review/references/workflow.md +116 -0
- package/skills/ew-orchestrate/steps/ew-roadmap/SKILL.md +62 -0
- package/skills/ew-orchestrate/steps/ew-roadmap/references/prepare.md +27 -0
- package/skills/ew-orchestrate/steps/ew-roadmap/references/workflow.md +28 -0
- package/skills/ew-orchestrate/steps/ew-test/SKILL.md +99 -0
- package/skills/ew-orchestrate/steps/ew-test/references/prepare.md +23 -0
- package/skills/ew-orchestrate/steps/ew-test/references/workflow.md +23 -0
- package/skills/ew-orchestrate/steps/ew-verify/SKILL.md +73 -0
- package/skills/ew-orchestrate/steps/ew-verify/references/prepare.md +21 -0
- package/skills/ew-orchestrate/steps/ew-verify/references/workflow.md +29 -0
- package/skills/ew-skill-design/SKILL.md +30 -0
- package/skills/ew-skill-design/references/package-contract.md +40 -0
- package/skills/ew-skill-design/references/validation.md +21 -0
- package/skills/team-swarm/SKILL.md +68 -0
- package/skills/team-swarm/references/mcp-coordination.md +14 -0
- package/skills/team-swarm/roles/analyst/role.md +181 -0
- package/skills/team-swarm/roles/ant/role.md +149 -0
- package/skills/team-swarm/roles/coordinator/commands/converge.md +112 -0
- package/skills/team-swarm/roles/coordinator/commands/init-swarm.md +136 -0
- package/skills/team-swarm/roles/coordinator/commands/iterate.md +171 -0
- package/skills/team-swarm/roles/coordinator/role.md +170 -0
- package/skills/team-swarm/roles/scorer/role.md +150 -0
- package/skills/team-swarm/scripts/aco.py +646 -0
- package/skills/team-swarm/scripts/pheromone.py +144 -0
- package/skills/team-swarm/scripts/scoring.py +111 -0
- package/skills/team-swarm/scripts/test_aco.py +606 -0
- package/skills/team-swarm/specs/ant-output-schema.md +127 -0
- package/skills/team-swarm/specs/convergence-criteria.md +108 -0
- package/skills/team-swarm/specs/pheromone-schema.md +125 -0
- package/skills/team-swarm/specs/swarm-config-template.json +71 -0
- package/skills/team-swarm/specs/swarm-protocol.md +119 -0
- package/skills/workflow-evolve/SKILL.md +64 -0
- package/skills/workflow-evolve/references/agy-gate.md +27 -0
- package/skills/workflow-evolve/references/auto-loop.md +23 -0
- package/skills/workflow-evolve/references/history-review.md +15 -0
- package/skills/workflow-evolve/scripts/codex-memory-replay.mjs +86 -0
- package/skills/workflow-evolve/scripts/codex-replay.mjs +1 -0
- package/skills/workflow-evolve/scripts/evolve-loop.mjs +260 -0
- package/skills/workflow-evolve/scripts/memory-codex-mcp.mjs +124 -0
- package/workflows/index.json +33 -0
package/dist/search.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type AgentMemoryContextScope, type AgentMemoryEnvelope } from './context-envelope.js';
|
|
2
|
+
import type { CodeGraph } from './code.js';
|
|
3
|
+
import type { MemorySearchOptions, MemoryStore } from './memory.js';
|
|
4
|
+
import type { Wiki, WikiSearchOptions } from './wiki.js';
|
|
5
|
+
import type { WikiContext } from './wiki-entry.js';
|
|
6
|
+
import type { KnowledgeReads } from './knowledge-reads.js';
|
|
7
|
+
export interface SearchSources {
|
|
8
|
+
code?: CodeGraph;
|
|
9
|
+
wiki?: Wiki;
|
|
10
|
+
memory?: MemoryStore;
|
|
11
|
+
}
|
|
12
|
+
export type SearchScope = keyof SearchSources | 'all';
|
|
13
|
+
export interface SearchOptions {
|
|
14
|
+
scope?: SearchScope;
|
|
15
|
+
limit?: number;
|
|
16
|
+
wiki?: Omit<WikiSearchOptions, 'limit'>;
|
|
17
|
+
memory?: Omit<MemorySearchOptions, 'limit'>;
|
|
18
|
+
knowledgeReads?: KnowledgeReads;
|
|
19
|
+
}
|
|
20
|
+
export interface ContextOptions {
|
|
21
|
+
limit?: number;
|
|
22
|
+
context?: WikiContext;
|
|
23
|
+
wiki?: Omit<WikiSearchOptions, 'limit'>;
|
|
24
|
+
memory?: Omit<MemorySearchOptions, 'limit'>;
|
|
25
|
+
contextScope?: AgentMemoryContextScope;
|
|
26
|
+
includeWorkingMemory?: boolean;
|
|
27
|
+
knowledgeReads?: KnowledgeReads;
|
|
28
|
+
}
|
|
29
|
+
export interface SearchResults {
|
|
30
|
+
code?: Awaited<ReturnType<CodeGraph['search']>>;
|
|
31
|
+
wiki?: ReturnType<Wiki['search']>;
|
|
32
|
+
memory?: Awaited<ReturnType<MemoryStore['search']>>;
|
|
33
|
+
}
|
|
34
|
+
export declare function parseScope(scope: string): SearchScope;
|
|
35
|
+
export declare function search(sources: SearchSources, query: string, options?: SearchOptions): Promise<SearchResults>;
|
|
36
|
+
export declare function context(sources: SearchSources, query: string, options?: ContextOptions): Promise<AgentMemoryEnvelope>;
|
package/dist/search.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { createAgentMemoryEnvelope, } from './context-envelope.js';
|
|
3
|
+
import { InputError, NotFoundError, requireText, searchLimit } from './common.js';
|
|
4
|
+
export function parseScope(scope) {
|
|
5
|
+
if (scope === 'all' || scope === 'code' || scope === 'wiki' || scope === 'memory')
|
|
6
|
+
return scope;
|
|
7
|
+
throw new InputError('scope must be all, code, wiki or memory');
|
|
8
|
+
}
|
|
9
|
+
export async function search(sources, query, options = {}) {
|
|
10
|
+
const text = requireText(query, 'query');
|
|
11
|
+
const limit = searchLimit(options.limit);
|
|
12
|
+
const scope = parseScope(options.scope ?? 'all');
|
|
13
|
+
if (scope !== 'all' && !sources[scope])
|
|
14
|
+
throw new NotFoundError(`Search source is not configured: ${scope}`);
|
|
15
|
+
const wiki = scope === 'all' || scope === 'wiki' ? sources.wiki?.search(text, { ...options.wiki, limit }) : undefined;
|
|
16
|
+
const [code, memory] = await Promise.all([
|
|
17
|
+
scope === 'all' || scope === 'code' ? sources.code?.search(text, limit) : undefined,
|
|
18
|
+
scope === 'all' || scope === 'memory' ? sources.memory?.search(text, { ...options.memory, limit }) : undefined,
|
|
19
|
+
]);
|
|
20
|
+
const tracker = options.knowledgeReads;
|
|
21
|
+
if (tracker && wiki) {
|
|
22
|
+
tracker.recordSearch({
|
|
23
|
+
source: 'wiki', query: text, filters: options.wiki,
|
|
24
|
+
returnedIds: wiki.results.map(hit => hit.id),
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
if (tracker && code) {
|
|
28
|
+
const returnedIds = Array.isArray(code) ? code.flatMap(item => {
|
|
29
|
+
if (!item || typeof item !== 'object')
|
|
30
|
+
return [];
|
|
31
|
+
const id = item.id ?? item.node?.id;
|
|
32
|
+
return typeof id === 'string' ? [id] : [];
|
|
33
|
+
}) : [];
|
|
34
|
+
tracker.recordSearch({ source: 'code', query: text, returnedIds });
|
|
35
|
+
}
|
|
36
|
+
if (tracker && memory) {
|
|
37
|
+
tracker.recordSearch({
|
|
38
|
+
source: 'memory', query: text, filters: options.memory,
|
|
39
|
+
returnedIds: memory.results.map(hit => hit.id),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
return { ...(code && { code }), ...(wiki && { wiki }), ...(memory && { memory }) };
|
|
43
|
+
}
|
|
44
|
+
export async function context(sources, query, options = {}) {
|
|
45
|
+
const text = requireText(query, 'query');
|
|
46
|
+
const limit = searchLimit(options.limit);
|
|
47
|
+
const wikiContext = options.context ?? {};
|
|
48
|
+
const constraints = sources.wiki?.constraints(wikiContext).slice(0, limit) ?? [];
|
|
49
|
+
const references = sources.wiki?.references(text, wikiContext, { ...options.wiki, limit }).results ?? [];
|
|
50
|
+
const workingMemories = options.includeWorkingMemory && sources.memory
|
|
51
|
+
? (await sources.memory.search(text, { ...options.memory, limit })).results
|
|
52
|
+
: [];
|
|
53
|
+
const tracker = options.knowledgeReads;
|
|
54
|
+
if (tracker) {
|
|
55
|
+
for (const constraint of constraints) {
|
|
56
|
+
tracker.bindConstraint({
|
|
57
|
+
knowledgeId: constraint.id,
|
|
58
|
+
scope: constraint.entry?.scope ?? [],
|
|
59
|
+
categories: constraint.entry?.categories,
|
|
60
|
+
content: constraint.body,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
if (sources.wiki) {
|
|
64
|
+
tracker.recordSearch({
|
|
65
|
+
source: 'wiki_references', query: text,
|
|
66
|
+
filters: { ...wikiContext, ...options.wiki },
|
|
67
|
+
returnedIds: references.map(hit => hit.id),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
if (options.includeWorkingMemory && sources.memory) {
|
|
71
|
+
tracker.recordSearch({
|
|
72
|
+
source: 'memory', query: text, filters: options.memory,
|
|
73
|
+
returnedIds: workingMemories.map(memory => memory.id),
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return createAgentMemoryEnvelope({
|
|
78
|
+
contextScope: options.contextScope,
|
|
79
|
+
constraints: constraints.map(page => ({
|
|
80
|
+
knowledge_id: page.id,
|
|
81
|
+
title: page.title,
|
|
82
|
+
mode: 'constraint',
|
|
83
|
+
authority: 'binding',
|
|
84
|
+
scope: page.entry?.scope ?? [],
|
|
85
|
+
...(page.entry?.categories ? { categories: page.entry.categories } : {}),
|
|
86
|
+
content: page.body,
|
|
87
|
+
content_sha256: `sha256:${createHash('sha256').update(page.body).digest('hex')}`,
|
|
88
|
+
sources: page.sources,
|
|
89
|
+
source_count: page.sources.length,
|
|
90
|
+
})),
|
|
91
|
+
references: references.map(hit => ({
|
|
92
|
+
knowledge_id: hit.id,
|
|
93
|
+
title: hit.title,
|
|
94
|
+
mode: 'reference',
|
|
95
|
+
authority: 'advisory',
|
|
96
|
+
score: hit.score,
|
|
97
|
+
hop: hit.hop,
|
|
98
|
+
snippet: hit.snippet,
|
|
99
|
+
sources: hit.sources,
|
|
100
|
+
related_knowledge_ids: hit.related.map(related => related.id),
|
|
101
|
+
})),
|
|
102
|
+
workingMemories: workingMemories.map(memory => ({
|
|
103
|
+
memory_id: memory.id,
|
|
104
|
+
session_id: memory.session,
|
|
105
|
+
type: memory.type,
|
|
106
|
+
authority: 'unverified_episodic',
|
|
107
|
+
content: memory.content,
|
|
108
|
+
source_ids: memory.sourceMessageIds,
|
|
109
|
+
linked_knowledge_id: null,
|
|
110
|
+
})),
|
|
111
|
+
});
|
|
112
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type SkillPriority = 'high' | 'normal' | 'low';
|
|
2
|
+
export declare const learningIndex = "references/learnings/index.md";
|
|
3
|
+
export declare function learningDocument(id: string): string;
|
|
4
|
+
export declare function draftSkillAddition(input: {
|
|
5
|
+
entry: string;
|
|
6
|
+
priority: SkillPriority;
|
|
7
|
+
instruction: string;
|
|
8
|
+
sources: string[];
|
|
9
|
+
when?: string;
|
|
10
|
+
}): {
|
|
11
|
+
baseline: {
|
|
12
|
+
path: string;
|
|
13
|
+
sha256: string;
|
|
14
|
+
};
|
|
15
|
+
changes: {
|
|
16
|
+
path: string;
|
|
17
|
+
content: string;
|
|
18
|
+
}[];
|
|
19
|
+
when?: string | undefined;
|
|
20
|
+
id: string;
|
|
21
|
+
priority: SkillPriority;
|
|
22
|
+
sources: string[];
|
|
23
|
+
instruction: string;
|
|
24
|
+
};
|
|
25
|
+
export type SkillAddition = ReturnType<typeof draftSkillAddition>;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { lstatSync, readFileSync } from 'node:fs';
|
|
3
|
+
import { dirname, resolve } from 'node:path';
|
|
4
|
+
import { InputError, requireText } from './common.js';
|
|
5
|
+
export const learningIndex = 'references/learnings/index.md';
|
|
6
|
+
export function learningDocument(id) {
|
|
7
|
+
return `references/learnings/${id}.md`;
|
|
8
|
+
}
|
|
9
|
+
function readOptionalDocument(path) {
|
|
10
|
+
const info = lstatSync(path, { throwIfNoEntry: false });
|
|
11
|
+
if (info && !info.isFile())
|
|
12
|
+
throw new InputError(`Expected a regular Skill Markdown file: ${path}`);
|
|
13
|
+
return info ? readFileSync(path, 'utf8') : undefined;
|
|
14
|
+
}
|
|
15
|
+
function appendBlock(baseline, marker, block) {
|
|
16
|
+
if (!baseline.includes(marker))
|
|
17
|
+
return `${baseline.trimEnd()}\n\n${block}\n`;
|
|
18
|
+
if (!baseline.replace(/\r\n/g, '\n').includes(block)) {
|
|
19
|
+
throw new InputError('Existing Skill learning block differs from this draft');
|
|
20
|
+
}
|
|
21
|
+
return baseline;
|
|
22
|
+
}
|
|
23
|
+
export function draftSkillAddition(input) {
|
|
24
|
+
const entry = resolve(input.entry);
|
|
25
|
+
if (!lstatSync(entry, { throwIfNoEntry: false })?.isFile())
|
|
26
|
+
throw new InputError('Expected a regular Skill Markdown file');
|
|
27
|
+
const baseline = readFileSync(entry, 'utf8');
|
|
28
|
+
const instruction = requireText(input.instruction, 'Skill instruction');
|
|
29
|
+
const when = input.when === undefined ? undefined : requireText(input.when, 'learning trigger');
|
|
30
|
+
const sources = [...new Set(input.sources.map(source => requireText(source, 'evidence reference')))].sort();
|
|
31
|
+
if (!sources.length)
|
|
32
|
+
throw new InputError('At least one evidence reference is required');
|
|
33
|
+
if (/[\r\n]/.test(sources.join('')) || /<!--\s*\/?evolve:learning\b/.test(instruction)) {
|
|
34
|
+
throw new InputError('Evidence references must use one line and instructions must omit learning markers');
|
|
35
|
+
}
|
|
36
|
+
if (when && (/[\r\n]/.test(when) || /<!--/.test(when)))
|
|
37
|
+
throw new InputError('A learning trigger must use one line');
|
|
38
|
+
if (input.priority === 'high' && (/[\r\n]/.test(instruction) || [...instruction].length > 280)) {
|
|
39
|
+
throw new InputError('A high-priority inline addition must be one instruction under 281 characters');
|
|
40
|
+
}
|
|
41
|
+
const id = createHash('sha256').update(JSON.stringify([input.priority, instruction, sources, when])).digest('hex').slice(0, 20);
|
|
42
|
+
const start = `<!-- evolve:learning:${id} -->`;
|
|
43
|
+
const end = '<!-- /evolve:learning -->';
|
|
44
|
+
const relative = learningDocument(id);
|
|
45
|
+
const details = `# Skill learning\n\n${when ? `When: ${when}\n\n` : ''}${instruction}\n\n## Evidence\n\n${sources.map(source => `- ${source}`).join('\n')}\n`;
|
|
46
|
+
const packageRoot = dirname(entry);
|
|
47
|
+
const changes = [];
|
|
48
|
+
if (input.priority !== 'high') {
|
|
49
|
+
for (const directory of ['references', 'references/learnings']) {
|
|
50
|
+
const info = lstatSync(resolve(packageRoot, directory), { throwIfNoEntry: false });
|
|
51
|
+
if (info && !info.isDirectory())
|
|
52
|
+
throw new InputError(`Expected a regular Skill reference directory: ${directory}`);
|
|
53
|
+
}
|
|
54
|
+
const path = resolve(packageRoot, relative);
|
|
55
|
+
const existing = readOptionalDocument(path);
|
|
56
|
+
if (existing !== undefined && existing.replace(/\r\n/g, '\n') !== details) {
|
|
57
|
+
throw new InputError(`Existing Skill learning document differs from this draft: ${relative}`);
|
|
58
|
+
}
|
|
59
|
+
changes.push({ path, content: details });
|
|
60
|
+
}
|
|
61
|
+
if (input.priority === 'low') {
|
|
62
|
+
const indexPath = resolve(packageRoot, learningIndex);
|
|
63
|
+
const index = readOptionalDocument(indexPath) ?? '# Optional Skill references\n';
|
|
64
|
+
const title = [...(when ?? instruction).split(/\r?\n/, 1)[0]].slice(0, 100).join('').replace(/[&<>()[\]\\`*_]/g, '\\$&');
|
|
65
|
+
const indexContent = appendBlock(index, start, `${start}\n- [${title}](./${id}.md)\n${end}`);
|
|
66
|
+
const indexMarker = '<!-- evolve:learning:index -->';
|
|
67
|
+
const entryContent = appendBlock(baseline, indexMarker, `${indexMarker}\n[Optional Skill references](${learningIndex}) for tasks that explicitly need additional examples or troubleshooting.\n${end}`);
|
|
68
|
+
if (indexContent !== index)
|
|
69
|
+
changes.push({ path: indexPath, content: indexContent });
|
|
70
|
+
if (entryContent !== baseline)
|
|
71
|
+
changes.unshift({ path: entry, content: entryContent });
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
const body = input.priority === 'high' ? instruction
|
|
75
|
+
: `[Read the workflow learning](${relative}) when ${when ?? 'the documented conditions apply'}.`;
|
|
76
|
+
const addition = `${start}\n${body}\n${end}`;
|
|
77
|
+
let content = appendBlock(baseline, start, addition);
|
|
78
|
+
if (input.priority === 'high' && content !== baseline) {
|
|
79
|
+
const frontmatter = /^---\r?\n[\s\S]*?\r?\n---(?:\r?\n|$)/.exec(baseline)?.[0] ?? '';
|
|
80
|
+
content = `${frontmatter}\n${addition}\n\n${baseline.slice(frontmatter.length)}`;
|
|
81
|
+
}
|
|
82
|
+
changes.unshift({ path: entry, content });
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
id, priority: input.priority, sources, instruction, ...(when ? { when } : {}),
|
|
86
|
+
baseline: { path: entry, sha256: createHash('sha256').update(baseline).digest('hex') },
|
|
87
|
+
changes,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { SkillRouteDecision } from './skill-route.js';
|
|
2
|
+
export declare const SKILL_DESIGN_TASK_VERSION = "skill-design-task/1.0";
|
|
3
|
+
export declare const SKILL_DESIGN_RECEIPT_VERSION = "skill-design-receipt/1.0";
|
|
4
|
+
export interface SkillDesignTask {
|
|
5
|
+
schema_version: typeof SKILL_DESIGN_TASK_VERSION;
|
|
6
|
+
id: string;
|
|
7
|
+
created_at: string;
|
|
8
|
+
route: 'skill-design';
|
|
9
|
+
source: {
|
|
10
|
+
closeout_id: string;
|
|
11
|
+
candidate_id: string;
|
|
12
|
+
evidence: string[];
|
|
13
|
+
content: string;
|
|
14
|
+
};
|
|
15
|
+
target: {
|
|
16
|
+
skill_id?: string;
|
|
17
|
+
skill_version?: string;
|
|
18
|
+
entry?: string;
|
|
19
|
+
};
|
|
20
|
+
design_request: {
|
|
21
|
+
reasons: string[];
|
|
22
|
+
instruction: string;
|
|
23
|
+
acceptance: string[];
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface SkillDesignReceipt {
|
|
27
|
+
schema_version: typeof SKILL_DESIGN_RECEIPT_VERSION;
|
|
28
|
+
id: string;
|
|
29
|
+
task_id: string;
|
|
30
|
+
status: 'designed' | 'reviewed' | 'replayed' | 'applied' | 'rolled_back';
|
|
31
|
+
runner: {
|
|
32
|
+
path: string;
|
|
33
|
+
sha256: string;
|
|
34
|
+
};
|
|
35
|
+
design: {
|
|
36
|
+
schema_version: 'skill-design/1.0';
|
|
37
|
+
task_id: string;
|
|
38
|
+
draft: Record<string, unknown>;
|
|
39
|
+
};
|
|
40
|
+
review?: {
|
|
41
|
+
status: 'passed';
|
|
42
|
+
checks: string[];
|
|
43
|
+
};
|
|
44
|
+
replay_receipt_id?: string;
|
|
45
|
+
}
|
|
46
|
+
export declare function createSkillDesignTask(root: string, input: {
|
|
47
|
+
closeoutId: string;
|
|
48
|
+
candidateId: string;
|
|
49
|
+
content: string;
|
|
50
|
+
sources: string[];
|
|
51
|
+
decision: SkillRouteDecision;
|
|
52
|
+
skillId?: string;
|
|
53
|
+
skillVersion?: string;
|
|
54
|
+
}): {
|
|
55
|
+
id: string;
|
|
56
|
+
path: string;
|
|
57
|
+
task: SkillDesignTask;
|
|
58
|
+
replayed: boolean;
|
|
59
|
+
};
|
|
60
|
+
export declare function readSkillDesignTask(root: string, id: string): SkillDesignTask;
|
|
61
|
+
export declare function runSkillDesign(root: string, taskId: string, runnerPath: string): {
|
|
62
|
+
path: string;
|
|
63
|
+
replayed: boolean;
|
|
64
|
+
schema_version: typeof SKILL_DESIGN_RECEIPT_VERSION;
|
|
65
|
+
id: string;
|
|
66
|
+
task_id: string;
|
|
67
|
+
status: "designed" | "reviewed" | "replayed" | "applied" | "rolled_back";
|
|
68
|
+
runner: {
|
|
69
|
+
path: string;
|
|
70
|
+
sha256: string;
|
|
71
|
+
};
|
|
72
|
+
design: {
|
|
73
|
+
schema_version: "skill-design/1.0";
|
|
74
|
+
task_id: string;
|
|
75
|
+
draft: Record<string, unknown>;
|
|
76
|
+
};
|
|
77
|
+
review?: {
|
|
78
|
+
status: "passed";
|
|
79
|
+
checks: string[];
|
|
80
|
+
};
|
|
81
|
+
replay_receipt_id?: string;
|
|
82
|
+
};
|
|
83
|
+
export declare function reviewSkillDesign(root: string, designId: string): SkillDesignReceipt;
|
|
84
|
+
export declare function replaySkillDesign(root: string, designId: string, options: {
|
|
85
|
+
runner: string;
|
|
86
|
+
scenarios: unknown;
|
|
87
|
+
}): SkillDesignReceipt & {
|
|
88
|
+
replay: Record<string, unknown>;
|
|
89
|
+
};
|
|
90
|
+
export declare function applySkillDesign(root: string, designId: string, rollback?: boolean): {
|
|
91
|
+
design_id: string;
|
|
92
|
+
replay_receipt_id: string;
|
|
93
|
+
id: string;
|
|
94
|
+
commit: string;
|
|
95
|
+
replayed: boolean;
|
|
96
|
+
};
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process';
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
4
|
+
import { dirname, join, resolve } from 'node:path';
|
|
5
|
+
import { InputError, requireText } from './common.js';
|
|
6
|
+
import { draftSkillAddition } from './skill-addition.js';
|
|
7
|
+
import { changeSkillVersion, replaySkillAddition, replaySkillPackage } from './skill-replay.js';
|
|
8
|
+
export const SKILL_DESIGN_TASK_VERSION = 'skill-design-task/1.0';
|
|
9
|
+
export const SKILL_DESIGN_RECEIPT_VERSION = 'skill-design-receipt/1.0';
|
|
10
|
+
function hash(value) {
|
|
11
|
+
return createHash('sha256').update(value).digest('hex');
|
|
12
|
+
}
|
|
13
|
+
function designRoot(root) {
|
|
14
|
+
return join(resolve(root), '.agent-memory', 'skill-design');
|
|
15
|
+
}
|
|
16
|
+
function taskPath(root, id) {
|
|
17
|
+
if (!/^[a-f0-9]{64}$/.test(id))
|
|
18
|
+
throw new InputError('Expected an exact Skill design task ID');
|
|
19
|
+
return join(designRoot(root), 'tasks', `${id}.json`);
|
|
20
|
+
}
|
|
21
|
+
function receiptPath(root, id) {
|
|
22
|
+
if (!/^[a-f0-9]{64}$/.test(id))
|
|
23
|
+
throw new InputError('Expected an exact Skill design receipt ID');
|
|
24
|
+
return join(designRoot(root), 'receipts', `${id}.json`);
|
|
25
|
+
}
|
|
26
|
+
function object(value, field) {
|
|
27
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
28
|
+
throw new InputError(`Invalid ${field}`);
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
function stringList(value, field) {
|
|
32
|
+
if (!Array.isArray(value) || value.some(item => typeof item !== 'string' || !item.trim())) {
|
|
33
|
+
throw new InputError(`Invalid ${field}`);
|
|
34
|
+
}
|
|
35
|
+
return [...new Set(value.map(item => item.trim()))];
|
|
36
|
+
}
|
|
37
|
+
function writeOnce(path, content) {
|
|
38
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
39
|
+
if (existsSync(path)) {
|
|
40
|
+
if (readFileSync(path, 'utf8') !== content)
|
|
41
|
+
throw new InputError(`Skill design artifact changed: ${path}`);
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
writeFileSync(path, content, { flag: 'wx' });
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
function readTask(root, id) {
|
|
48
|
+
const path = taskPath(root, id);
|
|
49
|
+
if (!existsSync(path))
|
|
50
|
+
throw new InputError(`Skill design task not found: ${id}`);
|
|
51
|
+
const task = object(JSON.parse(readFileSync(path, 'utf8')), 'Skill design task');
|
|
52
|
+
if (task.schema_version !== SKILL_DESIGN_TASK_VERSION || task.id !== id || task.route !== 'skill-design') {
|
|
53
|
+
throw new InputError(`Invalid Skill design task: ${id}`);
|
|
54
|
+
}
|
|
55
|
+
return task;
|
|
56
|
+
}
|
|
57
|
+
function readReceipt(root, id) {
|
|
58
|
+
const path = receiptPath(root, id);
|
|
59
|
+
if (!existsSync(path))
|
|
60
|
+
throw new InputError(`Skill design receipt not found: ${id}`);
|
|
61
|
+
const receipt = object(JSON.parse(readFileSync(path, 'utf8')), 'Skill design receipt');
|
|
62
|
+
if (receipt.schema_version !== SKILL_DESIGN_RECEIPT_VERSION || receipt.id !== id ||
|
|
63
|
+
!receipt.design || receipt.design.schema_version !== 'skill-design/1.0') {
|
|
64
|
+
throw new InputError(`Invalid Skill design receipt: ${id}`);
|
|
65
|
+
}
|
|
66
|
+
return receipt;
|
|
67
|
+
}
|
|
68
|
+
function saveReceipt(root, receipt) {
|
|
69
|
+
const path = receiptPath(root, receipt.id);
|
|
70
|
+
writeFileSync(path, JSON.stringify(receipt, null, 2) + '\n');
|
|
71
|
+
}
|
|
72
|
+
export function createSkillDesignTask(root, input) {
|
|
73
|
+
if (input.decision.route !== 'skill-design' || !input.decision.invoke_meta_skill) {
|
|
74
|
+
throw new InputError('Skill design task requires a skill-design route decision');
|
|
75
|
+
}
|
|
76
|
+
const skillId = input.skillId === undefined ? undefined : requireText(input.skillId, 'Skill ID');
|
|
77
|
+
if (skillId && !/^[a-z0-9][a-z0-9-]*$/i.test(skillId))
|
|
78
|
+
throw new InputError('Invalid Skill ID for design task');
|
|
79
|
+
const content = requireText(input.content, 'Skill design candidate content');
|
|
80
|
+
const sources = stringList(input.sources, 'Skill design evidence');
|
|
81
|
+
if (!sources.length)
|
|
82
|
+
throw new InputError('Skill design task requires evidence');
|
|
83
|
+
const taskBase = {
|
|
84
|
+
schema_version: SKILL_DESIGN_TASK_VERSION,
|
|
85
|
+
route: 'skill-design',
|
|
86
|
+
source: {
|
|
87
|
+
closeout_id: requireText(input.closeoutId, 'closeout ID'),
|
|
88
|
+
candidate_id: requireText(input.candidateId, 'candidate ID'),
|
|
89
|
+
evidence: sources,
|
|
90
|
+
content,
|
|
91
|
+
},
|
|
92
|
+
target: {
|
|
93
|
+
...(skillId ? { skill_id: skillId } : {}),
|
|
94
|
+
...(input.skillVersion ? { skill_version: requireText(input.skillVersion, 'Skill version') } : {}),
|
|
95
|
+
...(skillId ? { entry: `skills/${skillId}/SKILL.md` } : {}),
|
|
96
|
+
},
|
|
97
|
+
design_request: {
|
|
98
|
+
reasons: input.decision.reasons,
|
|
99
|
+
instruction: input.decision.meta_skill?.instruction ?? 'Design the smallest Skill package that captures the verified workflow.',
|
|
100
|
+
acceptance: [
|
|
101
|
+
'Preserve the evidence and target Skill identity.',
|
|
102
|
+
'Keep the design in a candidate artifact until review passes.',
|
|
103
|
+
'Return a replayable draft with at least one failing and one passing scenario.',
|
|
104
|
+
'For a new or contract-changing Skill, return mode package with every new Markdown file in changes.',
|
|
105
|
+
'Use Markdown links for conditional procedure documents.',
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
const id = hash(JSON.stringify(taskBase));
|
|
110
|
+
const task = { ...taskBase, id, created_at: new Date().toISOString() };
|
|
111
|
+
const path = taskPath(root, id);
|
|
112
|
+
const replayed = !writeOnce(path, JSON.stringify(task, null, 2) + '\n');
|
|
113
|
+
return { id, path, task, replayed };
|
|
114
|
+
}
|
|
115
|
+
export function readSkillDesignTask(root, id) {
|
|
116
|
+
return readTask(root, id);
|
|
117
|
+
}
|
|
118
|
+
export function runSkillDesign(root, taskId, runnerPath) {
|
|
119
|
+
const task = readTask(root, taskId);
|
|
120
|
+
const runner = resolve(requireText(runnerPath, 'design runner'));
|
|
121
|
+
if (!existsSync(runner))
|
|
122
|
+
throw new InputError(`Design runner not found: ${runner}`);
|
|
123
|
+
const output = execFileSync(process.execPath, [runner], {
|
|
124
|
+
cwd: resolve(root), input: JSON.stringify({ task, task_id: task.id, root: resolve(root) }),
|
|
125
|
+
encoding: 'utf8', windowsHide: true, stdio: ['pipe', 'pipe', 'pipe'], timeout: 120_000,
|
|
126
|
+
});
|
|
127
|
+
const design = object(JSON.parse(output), 'Skill design output');
|
|
128
|
+
if (design.schema_version !== 'skill-design/1.0' || design.task_id !== task.id) {
|
|
129
|
+
throw new InputError('Design runner returned an invalid Skill design envelope');
|
|
130
|
+
}
|
|
131
|
+
const draft = object(design.draft, 'Skill design draft');
|
|
132
|
+
const designReceipt = {
|
|
133
|
+
schema_version: SKILL_DESIGN_RECEIPT_VERSION,
|
|
134
|
+
id: hash(JSON.stringify([task.id, design])),
|
|
135
|
+
task_id: task.id,
|
|
136
|
+
status: 'designed',
|
|
137
|
+
runner: { path: runner, sha256: hash(readFileSync(runner)) },
|
|
138
|
+
design: { schema_version: 'skill-design/1.0', task_id: task.id, draft },
|
|
139
|
+
};
|
|
140
|
+
const path = receiptPath(root, designReceipt.id);
|
|
141
|
+
const replayed = !writeOnce(path, JSON.stringify(designReceipt, null, 2) + '\n');
|
|
142
|
+
return { ...designReceipt, path, replayed };
|
|
143
|
+
}
|
|
144
|
+
export function reviewSkillDesign(root, designId) {
|
|
145
|
+
const receipt = readReceipt(root, designId);
|
|
146
|
+
const task = readTask(root, receipt.task_id);
|
|
147
|
+
const draft = receipt.design.draft;
|
|
148
|
+
if (draft.mode === 'package') {
|
|
149
|
+
const skillId = requireText(draft.skill_id, 'Skill package ID');
|
|
150
|
+
const packagePath = `skills/${skillId}`;
|
|
151
|
+
const entry = `${packagePath}/SKILL.md`;
|
|
152
|
+
if (task.target.skill_id !== skillId || task.target.entry !== entry || draft.package_path !== packagePath || draft.entry !== entry) {
|
|
153
|
+
throw new InputError('Skill package target does not match its task');
|
|
154
|
+
}
|
|
155
|
+
if (!Array.isArray(draft.changes) || !draft.changes.length)
|
|
156
|
+
throw new InputError('Skill package design has no files');
|
|
157
|
+
const paths = draft.changes.map((value, index) => {
|
|
158
|
+
const change = object(value, `Skill package file ${index}`);
|
|
159
|
+
const path = requireText(change.path, `Skill package file ${index} path`).replaceAll('\\', '/');
|
|
160
|
+
if (!path.startsWith(`${packagePath}/`) || path.split('/').some(part => !part || part === '.' || part === '..') ||
|
|
161
|
+
typeof change.content !== 'string') {
|
|
162
|
+
throw new InputError(`Invalid Skill package file: ${path}`);
|
|
163
|
+
}
|
|
164
|
+
return path;
|
|
165
|
+
});
|
|
166
|
+
if (new Set(paths).size !== paths.length || !paths.includes(entry)) {
|
|
167
|
+
throw new InputError('Skill package design must contain one unique SKILL.md entry');
|
|
168
|
+
}
|
|
169
|
+
if (!Array.isArray(draft.sources) || !draft.sources.length || draft.sources.some(source => typeof source !== 'string' || !source.trim())) {
|
|
170
|
+
throw new InputError('Skill package design requires evidence sources');
|
|
171
|
+
}
|
|
172
|
+
receipt.status = 'reviewed';
|
|
173
|
+
receipt.review = { status: 'passed', checks: ['package target matches task', 'package files are scoped and unique', 'entry and Markdown links are replayable'] };
|
|
174
|
+
saveReceipt(root, receipt);
|
|
175
|
+
return receipt;
|
|
176
|
+
}
|
|
177
|
+
const baseline = object(draft.baseline, 'Skill design baseline');
|
|
178
|
+
const entry = resolve(requireText(baseline.path, 'Skill design baseline path'));
|
|
179
|
+
if (!task.target.entry || entry.replaceAll('\\', '/') !== resolve(root, task.target.entry).replaceAll('\\', '/')) {
|
|
180
|
+
throw new InputError('Skill design target does not match its task');
|
|
181
|
+
}
|
|
182
|
+
const priority = draft.priority;
|
|
183
|
+
if (priority !== 'high' && priority !== 'normal' && priority !== 'low') {
|
|
184
|
+
throw new InputError('Invalid Skill design priority');
|
|
185
|
+
}
|
|
186
|
+
const regenerated = draftSkillAddition({
|
|
187
|
+
entry,
|
|
188
|
+
priority,
|
|
189
|
+
instruction: requireText(draft.instruction, 'Skill design instruction'),
|
|
190
|
+
sources: stringList(draft.sources, 'Skill design sources'),
|
|
191
|
+
when: draft.when === undefined ? undefined : requireText(draft.when, 'Skill design trigger'),
|
|
192
|
+
});
|
|
193
|
+
if (regenerated.id !== draft.id || regenerated.baseline.sha256 !== baseline.sha256 ||
|
|
194
|
+
JSON.stringify(regenerated.changes) !== JSON.stringify(draft.changes)) {
|
|
195
|
+
throw new InputError('Skill design draft does not reproduce from its target baseline');
|
|
196
|
+
}
|
|
197
|
+
receipt.status = 'reviewed';
|
|
198
|
+
receipt.review = { status: 'passed', checks: ['target matches task', 'draft reproduces from baseline', 'evidence is present'] };
|
|
199
|
+
saveReceipt(root, receipt);
|
|
200
|
+
return receipt;
|
|
201
|
+
}
|
|
202
|
+
export function replaySkillDesign(root, designId, options) {
|
|
203
|
+
const receipt = readReceipt(root, designId);
|
|
204
|
+
if (receipt.status !== 'reviewed' && receipt.status !== 'replayed') {
|
|
205
|
+
throw new InputError('Review the Skill design before replay');
|
|
206
|
+
}
|
|
207
|
+
const replay = (receipt.design.draft.mode === 'package'
|
|
208
|
+
? replaySkillPackage(root, receipt.design.draft, options)
|
|
209
|
+
: replaySkillAddition(root, receipt.design.draft, options));
|
|
210
|
+
receipt.status = 'replayed';
|
|
211
|
+
receipt.replay_receipt_id = requireText(replay.id, 'replay receipt ID');
|
|
212
|
+
saveReceipt(root, receipt);
|
|
213
|
+
return { ...receipt, replay };
|
|
214
|
+
}
|
|
215
|
+
export function applySkillDesign(root, designId, rollback = false) {
|
|
216
|
+
const receipt = readReceipt(root, designId);
|
|
217
|
+
if (!receipt.replay_receipt_id)
|
|
218
|
+
throw new InputError('Replay the Skill design before applying it');
|
|
219
|
+
if (!rollback && receipt.status !== 'replayed' && receipt.status !== 'applied') {
|
|
220
|
+
throw new InputError('Skill design is not ready for application');
|
|
221
|
+
}
|
|
222
|
+
const result = changeSkillVersion(root, receipt.replay_receipt_id, rollback);
|
|
223
|
+
receipt.status = rollback ? 'rolled_back' : 'applied';
|
|
224
|
+
saveReceipt(root, receipt);
|
|
225
|
+
return { ...result, design_id: designId, replay_receipt_id: receipt.replay_receipt_id };
|
|
226
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { type KnowledgeReadsReceipt } from './knowledge-reads.js';
|
|
2
|
+
interface Observation {
|
|
3
|
+
passed: boolean;
|
|
4
|
+
loaded: Array<{
|
|
5
|
+
path: string;
|
|
6
|
+
sha256: string;
|
|
7
|
+
}>;
|
|
8
|
+
knowledgeReads?: KnowledgeReadsReceipt;
|
|
9
|
+
}
|
|
10
|
+
export declare function replaySkillAddition(root: string, data: unknown, options: {
|
|
11
|
+
runner: string;
|
|
12
|
+
scenarios: unknown;
|
|
13
|
+
}): {
|
|
14
|
+
mode?: "addition" | "package";
|
|
15
|
+
base: string;
|
|
16
|
+
candidate: string;
|
|
17
|
+
entry: string;
|
|
18
|
+
package_path?: string;
|
|
19
|
+
files: string[];
|
|
20
|
+
sources: string[];
|
|
21
|
+
runnerSha256: string;
|
|
22
|
+
scenarios: Array<{
|
|
23
|
+
id: string;
|
|
24
|
+
inputSha256: string;
|
|
25
|
+
baseline: Observation;
|
|
26
|
+
candidate: Observation;
|
|
27
|
+
}>;
|
|
28
|
+
id: string;
|
|
29
|
+
};
|
|
30
|
+
export declare function replaySkillPackage(root: string, data: unknown, options: {
|
|
31
|
+
runner: string;
|
|
32
|
+
scenarios: unknown;
|
|
33
|
+
}): {
|
|
34
|
+
mode?: "addition" | "package";
|
|
35
|
+
base: string;
|
|
36
|
+
candidate: string;
|
|
37
|
+
entry: string;
|
|
38
|
+
package_path?: string;
|
|
39
|
+
files: string[];
|
|
40
|
+
sources: string[];
|
|
41
|
+
runnerSha256: string;
|
|
42
|
+
scenarios: Array<{
|
|
43
|
+
id: string;
|
|
44
|
+
inputSha256: string;
|
|
45
|
+
baseline: Observation;
|
|
46
|
+
candidate: Observation;
|
|
47
|
+
}>;
|
|
48
|
+
id: string;
|
|
49
|
+
};
|
|
50
|
+
export declare function changeSkillVersion(root: string, id: string, rollback?: boolean): {
|
|
51
|
+
id: string;
|
|
52
|
+
commit: string;
|
|
53
|
+
replayed: boolean;
|
|
54
|
+
};
|
|
55
|
+
export {};
|