@jaimevalasek/aioson 1.3.0 → 1.5.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.
- package/CHANGELOG.md +31 -1
- package/LICENSE +661 -21
- package/README.md +22 -3
- package/docs/en/squad-dashboard.md +372 -0
- package/docs/openclaw-bridge.md +308 -0
- package/docs/pt/README.md +62 -2
- package/docs/pt/advisor-spec.md +5 -5
- package/docs/pt/agentes-customizados.md +670 -0
- package/docs/pt/agentes.md +235 -23
- package/docs/pt/automacao-squads.md +407 -0
- package/docs/pt/cenarios.md +49 -5
- package/docs/pt/clientes-ai.md +62 -0
- package/docs/pt/comandos-cli.md +226 -17
- package/docs/pt/deyvin.md +115 -0
- package/docs/pt/genome-3.0-spec.md +11 -11
- package/docs/pt/inicio-rapido.md +63 -2
- package/docs/pt/memoria-contexto.md +255 -0
- package/docs/pt/output-strategy-delivery.md +655 -0
- package/docs/pt/profiler-system.md +17 -17
- package/docs/pt/runtime-observability.md +5 -1
- package/docs/pt/skills.md +175 -0
- package/docs/pt/squad-dashboard.md +373 -0
- package/docs/pt/{squad-genoma.md → squad-genome.md} +81 -75
- package/docs/testing/genome-2.0-matrix.md +5 -5
- package/docs/testing/genome-2.0-rollout.md +10 -10
- package/package.json +4 -4
- package/src/agents.js +21 -5
- package/src/backup-local.js +74 -0
- package/src/backup-provider.js +303 -0
- package/src/cli.js +276 -2
- package/src/commands/agents.js +22 -4
- package/src/commands/backup-local-cmd.js +25 -0
- package/src/commands/backup.js +533 -0
- package/src/commands/cloud.js +17 -17
- package/src/commands/context-pack.js +45 -0
- package/src/commands/implementation-plan.js +340 -0
- package/src/commands/learning.js +134 -0
- package/src/commands/live.js +1583 -0
- package/src/commands/runtime.js +1075 -2
- package/src/commands/scan-project.js +288 -24
- package/src/commands/setup-context.js +30 -2
- package/src/commands/skill.js +558 -0
- package/src/commands/squad-agent-create.js +788 -0
- package/src/commands/squad-daemon.js +209 -0
- package/src/commands/squad-dashboard.js +39 -0
- package/src/commands/squad-deploy.js +64 -0
- package/src/commands/squad-doctor.js +103 -1
- package/src/commands/squad-investigate.js +261 -0
- package/src/commands/squad-learning.js +209 -0
- package/src/commands/squad-mcp.js +270 -0
- package/src/commands/squad-pipeline.js +247 -1
- package/src/commands/squad-plan.js +329 -0
- package/src/commands/squad-processes.js +56 -0
- package/src/commands/squad-recovery.js +42 -0
- package/src/commands/squad-roi.js +291 -0
- package/src/commands/squad-score.js +250 -0
- package/src/commands/squad-status.js +38 -2
- package/src/commands/squad-validate.js +118 -1
- package/src/commands/squad-webhook.js +160 -0
- package/src/commands/squad-worker.js +191 -0
- package/src/commands/squad-worktrees.js +75 -0
- package/src/commands/test-agents.js +6 -1
- package/src/commands/web-map.js +70 -0
- package/src/commands/web-scrape.js +71 -0
- package/src/commands/workflow-next.js +8 -1
- package/src/commands/workflow-status.js +250 -0
- package/src/constants.js +88 -16
- package/src/context-memory.js +837 -0
- package/src/context-writer.js +47 -1
- package/src/delivery-runner.js +319 -0
- package/src/genome-files.js +1 -1
- package/src/genome-format.js +1 -1
- package/src/i18n/messages/en.js +333 -8
- package/src/i18n/messages/es.js +240 -6
- package/src/i18n/messages/fr.js +239 -5
- package/src/i18n/messages/pt-BR.js +330 -12
- package/src/installer.js +30 -2
- package/src/lib/genomes/compat.js +1 -1
- package/src/lib/webhook-server.js +328 -0
- package/src/mcp-connectors/registry.js +602 -0
- package/src/runtime-store.js +1037 -42
- package/src/session-handoff.js +77 -0
- package/src/squad/external-session.js +180 -0
- package/src/squad/inter-squad.js +74 -0
- package/src/squad/recovery-context.js +201 -0
- package/src/squad/worktree-manager.js +114 -0
- package/src/squad-daemon.js +490 -0
- package/src/squad-dashboard/api.js +223 -0
- package/src/squad-dashboard/attachment-handler.js +93 -0
- package/src/squad-dashboard/context-monitor.js +157 -0
- package/src/squad-dashboard/execution-logs.js +115 -0
- package/src/squad-dashboard/hunk-review.js +209 -0
- package/src/squad-dashboard/metrics.js +133 -0
- package/src/squad-dashboard/process-monitor.js +125 -0
- package/src/squad-dashboard/renderer.js +858 -0
- package/src/squad-dashboard/server.js +232 -0
- package/src/squad-dashboard/styles.js +525 -0
- package/src/squad-dashboard/token-tracker.js +99 -0
- package/src/web.js +284 -0
- package/src/worker-runner.js +339 -0
- package/template/.aioson/agents/analyst.md +40 -9
- package/template/.aioson/agents/architect.md +24 -5
- package/template/.aioson/agents/dev.md +254 -25
- package/template/.aioson/agents/deyvin.md +174 -0
- package/template/.aioson/agents/discovery-design-doc.md +25 -1
- package/template/.aioson/agents/{genoma.md → genome.md} +20 -20
- package/template/.aioson/agents/neo.md +152 -0
- package/template/.aioson/agents/orache.md +388 -0
- package/template/.aioson/agents/orchestrator.md +63 -2
- package/template/.aioson/agents/pair.md +5 -0
- package/template/.aioson/agents/pm.md +17 -5
- package/template/.aioson/agents/product.md +113 -29
- package/template/.aioson/agents/profiler-enricher.md +1 -1
- package/template/.aioson/agents/profiler-forge.md +9 -9
- package/template/.aioson/agents/profiler-researcher.md +1 -1
- package/template/.aioson/agents/qa.md +18 -5
- package/template/.aioson/agents/setup.md +138 -18
- package/template/.aioson/agents/sheldon.md +603 -0
- package/template/.aioson/agents/squad.md +866 -28
- package/template/.aioson/agents/tester.md +254 -0
- package/template/.aioson/agents/ux-ui.md +289 -34
- package/template/.aioson/config.md +181 -0
- package/template/.aioson/context/spec.md.template +17 -0
- package/template/.aioson/genomes/.gitkeep +0 -0
- package/template/.aioson/installed-skills/.gitkeep +0 -0
- package/template/.aioson/locales/en/agents/analyst.md +34 -4
- package/template/.aioson/locales/en/agents/architect.md +18 -0
- package/template/.aioson/locales/en/agents/dev.md +155 -11
- package/template/.aioson/locales/en/agents/deyvin.md +137 -0
- package/template/.aioson/locales/en/agents/{genoma.md → genome.md} +14 -14
- package/template/.aioson/locales/en/agents/neo.md +8 -0
- package/template/.aioson/locales/en/agents/orchestrator.md +62 -2
- package/template/.aioson/locales/en/agents/pair.md +5 -0
- package/template/.aioson/locales/en/agents/pm.md +7 -0
- package/template/.aioson/locales/en/agents/product.md +35 -17
- package/template/.aioson/locales/en/agents/qa.md +56 -0
- package/template/.aioson/locales/en/agents/setup.md +53 -6
- package/template/.aioson/locales/en/agents/sheldon.md +340 -0
- package/template/.aioson/locales/en/agents/squad.md +203 -15
- package/template/.aioson/locales/en/agents/ux-ui.md +383 -35
- package/template/.aioson/locales/es/agents/analyst.md +24 -4
- package/template/.aioson/locales/es/agents/architect.md +18 -0
- package/template/.aioson/locales/es/agents/dev.md +136 -9
- package/template/.aioson/locales/es/agents/deyvin.md +97 -0
- package/template/.aioson/locales/es/agents/{genoma.md → genome.md} +13 -13
- package/template/.aioson/locales/es/agents/neo.md +48 -0
- package/template/.aioson/locales/es/agents/orache.md +103 -0
- package/template/.aioson/locales/es/agents/orchestrator.md +62 -2
- package/template/.aioson/locales/es/agents/pair.md +5 -0
- package/template/.aioson/locales/es/agents/pm.md +7 -0
- package/template/.aioson/locales/es/agents/product.md +13 -3
- package/template/.aioson/locales/es/agents/qa.md +33 -0
- package/template/.aioson/locales/es/agents/setup.md +30 -6
- package/template/.aioson/locales/es/agents/sheldon.md +192 -0
- package/template/.aioson/locales/es/agents/squad.md +284 -15
- package/template/.aioson/locales/es/agents/ux-ui.md +34 -25
- package/template/.aioson/locales/fr/agents/analyst.md +24 -4
- package/template/.aioson/locales/fr/agents/architect.md +18 -0
- package/template/.aioson/locales/fr/agents/dev.md +136 -9
- package/template/.aioson/locales/fr/agents/deyvin.md +97 -0
- package/template/.aioson/locales/fr/agents/{genoma.md → genome.md} +7 -7
- package/template/.aioson/locales/fr/agents/neo.md +48 -0
- package/template/.aioson/locales/fr/agents/orache.md +104 -0
- package/template/.aioson/locales/fr/agents/orchestrator.md +62 -2
- package/template/.aioson/locales/fr/agents/pair.md +5 -0
- package/template/.aioson/locales/fr/agents/pm.md +7 -0
- package/template/.aioson/locales/fr/agents/product.md +13 -3
- package/template/.aioson/locales/fr/agents/qa.md +33 -0
- package/template/.aioson/locales/fr/agents/setup.md +30 -6
- package/template/.aioson/locales/fr/agents/sheldon.md +192 -0
- package/template/.aioson/locales/fr/agents/squad.md +279 -10
- package/template/.aioson/locales/fr/agents/ux-ui.md +34 -25
- package/template/.aioson/locales/pt-BR/agents/analyst.md +45 -4
- package/template/.aioson/locales/pt-BR/agents/architect.md +29 -0
- package/template/.aioson/locales/pt-BR/agents/dev.md +167 -15
- package/template/.aioson/locales/pt-BR/agents/deyvin.md +137 -0
- package/template/.aioson/locales/pt-BR/agents/{genoma.md → genome.md} +49 -49
- package/template/.aioson/locales/pt-BR/agents/neo.md +147 -0
- package/template/.aioson/locales/pt-BR/agents/orache.md +137 -0
- package/template/.aioson/locales/pt-BR/agents/orchestrator.md +62 -2
- package/template/.aioson/locales/pt-BR/agents/pair.md +5 -0
- package/template/.aioson/locales/pt-BR/agents/pm.md +7 -0
- package/template/.aioson/locales/pt-BR/agents/product.md +43 -20
- package/template/.aioson/locales/pt-BR/agents/qa.md +67 -0
- package/template/.aioson/locales/pt-BR/agents/setup.md +53 -6
- package/template/.aioson/locales/pt-BR/agents/sheldon.md +192 -0
- package/template/.aioson/locales/pt-BR/agents/squad.md +591 -47
- package/template/.aioson/locales/pt-BR/agents/ux-ui.md +369 -22
- package/template/.aioson/my-agents/.gitkeep +0 -0
- package/template/.aioson/rules/.gitkeep +0 -0
- package/template/.aioson/rules/squad/.gitkeep +0 -0
- package/template/.aioson/rules/squad/README.md +50 -0
- package/template/.aioson/schemas/genome-meta.schema.json +1 -1
- package/template/.aioson/schemas/genome.schema.json +1 -1
- package/template/.aioson/schemas/squad-blueprint.schema.json +32 -0
- package/template/.aioson/schemas/squad-manifest.schema.json +434 -1
- package/template/.aioson/skills/design/bold-editorial-ui/SKILL.md +205 -0
- package/template/.aioson/skills/design/bold-editorial-ui/references/art-direction.md +338 -0
- package/template/.aioson/skills/design/bold-editorial-ui/references/components.md +977 -0
- package/template/.aioson/skills/design/bold-editorial-ui/references/dashboards.md +218 -0
- package/template/.aioson/skills/design/bold-editorial-ui/references/design-tokens.md +326 -0
- package/template/.aioson/skills/design/bold-editorial-ui/references/motion.md +461 -0
- package/template/.aioson/skills/design/bold-editorial-ui/references/patterns.md +293 -0
- package/template/.aioson/skills/design/bold-editorial-ui/references/websites.md +352 -0
- package/template/.aioson/skills/design/clean-saas-ui/SKILL.md +210 -0
- package/template/.aioson/skills/design/clean-saas-ui/references/art-direction.md +319 -0
- package/template/.aioson/skills/design/clean-saas-ui/references/components.md +365 -0
- package/template/.aioson/skills/design/clean-saas-ui/references/dashboards.md +196 -0
- package/template/.aioson/skills/design/clean-saas-ui/references/design-tokens.md +244 -0
- package/template/.aioson/skills/design/clean-saas-ui/references/motion.md +235 -0
- package/template/.aioson/skills/design/clean-saas-ui/references/patterns.md +215 -0
- package/template/.aioson/skills/design/clean-saas-ui/references/websites.md +295 -0
- package/template/.aioson/skills/design/cognitive-core-ui/SKILL.md +203 -0
- package/template/.aioson/skills/design/cognitive-core-ui/references/art-direction.md +339 -0
- package/template/.aioson/skills/design/cognitive-core-ui/references/components.md +407 -0
- package/template/.aioson/skills/design/cognitive-core-ui/references/dashboards.md +272 -0
- package/template/.aioson/skills/design/cognitive-core-ui/references/design-tokens.md +524 -0
- package/template/.aioson/skills/design/cognitive-core-ui/references/motion.md +277 -0
- package/template/.aioson/skills/design/cognitive-core-ui/references/patterns.md +289 -0
- package/template/.aioson/skills/design/cognitive-core-ui/references/websites.md +437 -0
- package/template/.aioson/skills/design/interface-design/SKILL.md +47 -0
- package/template/.aioson/skills/design/interface-design/references/components-and-states.md +105 -0
- package/template/.aioson/skills/design/interface-design/references/design-directions.md +101 -0
- package/template/.aioson/skills/design/interface-design/references/handoff-and-quality.md +71 -0
- package/template/.aioson/skills/design/interface-design/references/intent-and-domain.md +74 -0
- package/template/.aioson/skills/design/interface-design/references/tokens-and-depth.md +173 -0
- package/template/.aioson/skills/design/premium-command-center-ui/SKILL.md +62 -0
- package/template/.aioson/skills/design/premium-command-center-ui/references/operations.md +74 -0
- package/template/.aioson/skills/design/premium-command-center-ui/references/patterns.md +116 -0
- package/template/.aioson/skills/design/premium-command-center-ui/references/validation.md +47 -0
- package/template/.aioson/skills/design/premium-command-center-ui/references/visual-system.md +215 -0
- package/template/.aioson/skills/design/warm-craft-ui/SKILL.md +209 -0
- package/template/.aioson/skills/design/warm-craft-ui/references/art-direction.md +324 -0
- package/template/.aioson/skills/design/warm-craft-ui/references/components.md +508 -0
- package/template/.aioson/skills/design/warm-craft-ui/references/dashboards.md +223 -0
- package/template/.aioson/skills/design/warm-craft-ui/references/design-tokens.md +374 -0
- package/template/.aioson/skills/design/warm-craft-ui/references/motion.md +356 -0
- package/template/.aioson/skills/design/warm-craft-ui/references/patterns.md +288 -0
- package/template/.aioson/skills/design/warm-craft-ui/references/websites.md +289 -0
- package/template/.aioson/skills/design-system/SKILL.md +92 -0
- package/template/.aioson/skills/design-system/cognitive-core-ui.skill +0 -0
- package/template/.aioson/skills/design-system/components/SKILL.md +274 -0
- package/template/.aioson/skills/design-system/components/SKILL.md:Zone.Identifier +0 -0
- package/template/.aioson/skills/design-system/dashboards/SKILL.md +184 -0
- package/template/.aioson/skills/design-system/dashboards/SKILL.md:Zone.Identifier +0 -0
- package/template/.aioson/skills/design-system/foundations/SKILL.md +250 -0
- package/template/.aioson/skills/design-system/foundations/SKILL.md:Zone.Identifier +0 -0
- package/template/.aioson/skills/design-system/motion/SKILL.md +197 -0
- package/template/.aioson/skills/design-system/motion/SKILL.md:Zone.Identifier +0 -0
- package/template/.aioson/skills/design-system/patterns/SKILL.md +231 -0
- package/template/.aioson/skills/design-system/patterns/SKILL.md:Zone.Identifier +0 -0
- package/template/.aioson/skills/premium-visual-design/SKILL.md +83 -0
- package/template/.aioson/skills/premium-visual-design/components/agent-badge.md +92 -0
- package/template/.aioson/skills/premium-visual-design/components/dependency-node.md +102 -0
- package/template/.aioson/skills/premium-visual-design/components/mention-autocomplete.md +136 -0
- package/template/.aioson/skills/premium-visual-design/components/notification-center.md +136 -0
- package/template/.aioson/skills/premium-visual-design/components/review-action-bar.md +188 -0
- package/template/.aioson/skills/premium-visual-design/components/team-switcher.md +131 -0
- package/template/.aioson/skills/premium-visual-design/patterns/agent-message-thread.md +198 -0
- package/template/.aioson/skills/premium-visual-design/patterns/notification-panel.md +275 -0
- package/template/.aioson/skills/premium-visual-design/patterns/review-workflow-ui.md +234 -0
- package/template/.aioson/skills/premium-visual-design/patterns/task-dependency-graph.md +147 -0
- package/template/.aioson/skills/premium-visual-design/tokens/status-extended.md +142 -0
- package/template/.aioson/skills/squad/SKILL.md +58 -0
- package/template/.aioson/skills/squad/domains/.gitkeep +0 -0
- package/template/.aioson/skills/squad/formats/.gitkeep +0 -0
- package/template/.aioson/skills/squad/formats/catalog.json +15 -0
- package/template/.aioson/skills/squad/formats/content/blog-post.md +47 -0
- package/template/.aioson/skills/squad/formats/content/newsletter.md +47 -0
- package/template/.aioson/skills/squad/formats/creative/podcast-script.md +43 -0
- package/template/.aioson/skills/squad/formats/creative/video-script.md +41 -0
- package/template/.aioson/skills/squad/formats/social/instagram-feed.md +42 -0
- package/template/.aioson/skills/squad/formats/social/linkedin-post.md +42 -0
- package/template/.aioson/skills/squad/formats/social/tiktok.md +39 -0
- package/template/.aioson/skills/squad/formats/social/twitter-thread.md +39 -0
- package/template/.aioson/skills/squad/formats/social/youtube-long.md +47 -0
- package/template/.aioson/skills/squad/formats/social/youtube-shorts.md +39 -0
- package/template/.aioson/skills/squad/patterns/.gitkeep +0 -0
- package/template/.aioson/skills/squad/patterns/multi-platform-pattern.md +108 -0
- package/template/.aioson/skills/squad/patterns/persona-based-pattern.md +98 -0
- package/template/.aioson/skills/squad/patterns/pipeline-pattern.md +106 -0
- package/template/.aioson/skills/squad/patterns/review-loop-pattern.md +81 -0
- package/template/.aioson/skills/squad/references/.gitkeep +0 -0
- package/template/.aioson/skills/squad/references/checklist-templates.md +122 -0
- package/template/.aioson/skills/squad/references/executor-archetypes.md +123 -0
- package/template/.aioson/skills/squad/references/workflow-templates.md +169 -0
- package/template/.aioson/skills/static/debugging-protocol.md +42 -0
- package/template/.aioson/skills/static/git-worktrees.md +36 -0
- package/template/.aioson/tasks/implementation-plan.md +307 -0
- package/template/.aioson/tasks/squad-create.md +1 -1
- package/template/.aioson/tasks/squad-design.md +28 -0
- package/template/.aioson/tasks/squad-execution-plan.md +279 -0
- package/template/.aioson/tasks/squad-export.md +1 -1
- package/template/.aioson/tasks/squad-investigate.md +44 -0
- package/template/.aioson/tasks/squad-learning-review.md +44 -0
- package/template/.aioson/tasks/squad-output-config.md +177 -0
- package/template/.aioson/tasks/squad-profile.md +48 -0
- package/template/.aioson/tasks/squad-review.md +61 -0
- package/template/.aioson/tasks/squad-task-decompose.md +66 -0
- package/template/.aioson/tasks/squad-validate.md +1 -1
- package/template/.claude/commands/aioson/agent/deyvin.md +5 -0
- package/template/.claude/commands/aioson/agent/discovery-design-doc.md +5 -0
- package/template/.claude/commands/aioson/agent/genome.md +5 -0
- package/template/.claude/commands/aioson/agent/neo.md +5 -0
- package/template/.claude/commands/aioson/agent/product.md +5 -0
- package/template/.claude/commands/aioson/agent/profiler-enricher.md +5 -0
- package/template/.claude/commands/aioson/agent/profiler-forge.md +5 -0
- package/template/.claude/commands/aioson/agent/profiler-researcher.md +5 -0
- package/template/.claude/commands/aioson/agent/squad.md +5 -0
- package/template/.claude/commands/aioson/agent/tester.md +5 -0
- package/template/.gemini/GEMINI.md +3 -0
- package/template/.gemini/commands/aios-deyvin.toml +6 -0
- package/template/.gemini/commands/aios-neo.toml +4 -0
- package/template/.gemini/commands/aios-pair.toml +6 -0
- package/template/.gemini/commands/aios-tester.toml +6 -0
- package/template/AGENTS.md +37 -6
- package/template/CLAUDE.md +34 -4
- package/template/OPENCODE.md +8 -2
- package/template/squad-searches/.gitkeep +0 -0
- package/template/.aioson/skills/static/interface-design.md +0 -372
- package/template/.aioson/skills/static/premium-command-center-ui.md +0 -190
- /package/template/.aioson/{genomas → docs}/.gitkeep +0 -0
- /package/template/.claude/commands/aioson/{analyst.md → agent/analyst.md} +0 -0
- /package/template/.claude/commands/aioson/{architect.md → agent/architect.md} +0 -0
- /package/template/.claude/commands/aioson/{dev.md → agent/dev.md} +0 -0
- /package/template/.claude/commands/aioson/{orchestrator.md → agent/orchestrator.md} +0 -0
- /package/template/.claude/commands/aioson/{pm.md → agent/pm.md} +0 -0
- /package/template/.claude/commands/aioson/{qa.md → agent/qa.md} +0 -0
- /package/template/.claude/commands/aioson/{setup.md → agent/setup.md} +0 -0
- /package/template/.claude/commands/aioson/{ux-ui.md → agent/ux-ui.md} +0 -0
package/src/context-writer.js
CHANGED
|
@@ -63,6 +63,8 @@ function renderProjectContext(data) {
|
|
|
63
63
|
const language = data.conversationLanguage || 'en';
|
|
64
64
|
const codeCommentLanguage = data.codeCommentLanguage || language;
|
|
65
65
|
const generatedAt = data.generatedAt || new Date().toISOString();
|
|
66
|
+
const designSkill = data.designSkill || '';
|
|
67
|
+
const testRunner = data.testRunner || '';
|
|
66
68
|
const web3Enabled = Boolean(data.web3Enabled);
|
|
67
69
|
const web3Networks = data.web3Networks || '';
|
|
68
70
|
const contractFramework = data.contractFramework || '';
|
|
@@ -79,6 +81,8 @@ framework: "${data.framework}"
|
|
|
79
81
|
framework_installed: ${data.frameworkInstalled ? 'true' : 'false'}
|
|
80
82
|
classification: "${data.classification}"
|
|
81
83
|
conversation_language: "${language}"
|
|
84
|
+
design_skill: "${designSkill}"
|
|
85
|
+
test_runner: "${testRunner}"
|
|
82
86
|
web3_enabled: ${web3Enabled ? 'true' : 'false'}
|
|
83
87
|
web3_networks: "${web3Networks}"
|
|
84
88
|
contract_framework: "${contractFramework}"
|
|
@@ -137,6 +141,47 @@ async function writeProjectContext(targetDir, content) {
|
|
|
137
141
|
return filePath;
|
|
138
142
|
}
|
|
139
143
|
|
|
144
|
+
async function renderSquadApiSection(projectDir) {
|
|
145
|
+
const squadsDir = path.join(projectDir, '.aioson', 'squads');
|
|
146
|
+
let slugs = [];
|
|
147
|
+
try {
|
|
148
|
+
const entries = await fs.readdir(squadsDir, { withFileTypes: true });
|
|
149
|
+
slugs = entries.filter(e => e.isDirectory()).map(e => e.name);
|
|
150
|
+
} catch {
|
|
151
|
+
return '';
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const endpointRows = [];
|
|
155
|
+
for (const slug of slugs) {
|
|
156
|
+
let squadJson = null;
|
|
157
|
+
try {
|
|
158
|
+
const raw = await fs.readFile(path.join(squadsDir, slug, 'squad.json'), 'utf8');
|
|
159
|
+
squadJson = JSON.parse(raw);
|
|
160
|
+
} catch { continue; }
|
|
161
|
+
|
|
162
|
+
if (!Array.isArray(squadJson?.api_endpoints) || squadJson.api_endpoints.length === 0) continue;
|
|
163
|
+
for (const ep of squadJson.api_endpoints) {
|
|
164
|
+
endpointRows.push(
|
|
165
|
+
`| ${slug} | \`${ep.method || 'POST'} http://localhost:${squadJson.port || '?'}/api${ep.path}\` | ${ep.description || ''} |`
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (endpointRows.length === 0) return '';
|
|
171
|
+
|
|
172
|
+
return [
|
|
173
|
+
'## Squad API Endpoints',
|
|
174
|
+
'',
|
|
175
|
+
'Endpoints HTTP expostos pelos squad-daemons para chamadas do frontend.',
|
|
176
|
+
'',
|
|
177
|
+
'| Squad | Endpoint | Descrição |',
|
|
178
|
+
'|-------|----------|-----------|',
|
|
179
|
+
...endpointRows,
|
|
180
|
+
'',
|
|
181
|
+
'Use estes endpoints ao implementar componentes frontend que precisam consultar dados dos squads.',
|
|
182
|
+
].join('\n');
|
|
183
|
+
}
|
|
184
|
+
|
|
140
185
|
module.exports = {
|
|
141
186
|
toPositiveInt,
|
|
142
187
|
scoreUserTypes,
|
|
@@ -146,5 +191,6 @@ module.exports = {
|
|
|
146
191
|
classificationFromScore,
|
|
147
192
|
normalizeBoolean,
|
|
148
193
|
renderProjectContext,
|
|
149
|
-
writeProjectContext
|
|
194
|
+
writeProjectContext,
|
|
195
|
+
renderSquadApiSection
|
|
150
196
|
};
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('node:fs/promises');
|
|
4
|
+
const path = require('node:path');
|
|
5
|
+
const { spawn } = require('node:child_process');
|
|
6
|
+
|
|
7
|
+
const MAX_RETRIES = 3;
|
|
8
|
+
const RETRY_DELAYS = [1000, 3000, 8000]; // ms — exponential-ish backoff
|
|
9
|
+
|
|
10
|
+
function resolveEnvPlaceholders(value) {
|
|
11
|
+
return String(value || '').replace(/\{\{ENV:(\w+)\}\}/g, (_, varName) => {
|
|
12
|
+
return process.env[varName] || '';
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function nowIso() {
|
|
17
|
+
return new Date().toISOString().replace('T', ' ').replace(/\.\d+Z$/, '');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function logDelivery(db, entry) {
|
|
21
|
+
db.prepare(`
|
|
22
|
+
INSERT INTO delivery_log (squad_slug, content_key, webhook_slug, trigger_type, url, status_code, response_body, error_message, attempt, created_at)
|
|
23
|
+
VALUES (@squad_slug, @content_key, @webhook_slug, @trigger_type, @url, @status_code, @response_body, @error_message, @attempt, @created_at)
|
|
24
|
+
`).run({
|
|
25
|
+
squad_slug: entry.squadSlug,
|
|
26
|
+
content_key: entry.contentKey || null,
|
|
27
|
+
webhook_slug: entry.webhookSlug || null,
|
|
28
|
+
trigger_type: entry.triggerType,
|
|
29
|
+
url: entry.url,
|
|
30
|
+
status_code: entry.statusCode ?? null,
|
|
31
|
+
response_body: entry.responseBody ? String(entry.responseBody).slice(0, 2000) : null,
|
|
32
|
+
error_message: entry.errorMessage || null,
|
|
33
|
+
attempt: entry.attempt || 1,
|
|
34
|
+
created_at: nowIso()
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function sleep(ms) {
|
|
39
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function executeWebhookHttp(url, headers, payload) {
|
|
43
|
+
const body = JSON.stringify(payload);
|
|
44
|
+
const controller = new AbortController();
|
|
45
|
+
const timeout = setTimeout(() => controller.abort(), 15000);
|
|
46
|
+
|
|
47
|
+
try {
|
|
48
|
+
const response = await fetch(url, {
|
|
49
|
+
method: 'POST',
|
|
50
|
+
headers: { 'Content-Type': 'application/json', ...headers },
|
|
51
|
+
body,
|
|
52
|
+
signal: controller.signal
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const responseBody = await response.text().catch(() => '');
|
|
56
|
+
return {
|
|
57
|
+
statusCode: response.status,
|
|
58
|
+
responseBody,
|
|
59
|
+
ok: response.status >= 200 && response.status < 300
|
|
60
|
+
};
|
|
61
|
+
} catch (err) {
|
|
62
|
+
return {
|
|
63
|
+
statusCode: null,
|
|
64
|
+
responseBody: null,
|
|
65
|
+
ok: false,
|
|
66
|
+
errorMessage: err.name === 'AbortError' ? 'Request timeout (15s)' : err.message
|
|
67
|
+
};
|
|
68
|
+
} finally {
|
|
69
|
+
clearTimeout(timeout);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function executeWorkerScript(workerPath, payload) {
|
|
74
|
+
return new Promise((resolve) => {
|
|
75
|
+
const child = spawn('python3', [workerPath], {
|
|
76
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
77
|
+
timeout: 30000,
|
|
78
|
+
env: { ...process.env }
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
let stdout = '';
|
|
82
|
+
let stderr = '';
|
|
83
|
+
child.stdout.on('data', (data) => { stdout += data; });
|
|
84
|
+
child.stderr.on('data', (data) => { stderr += data; });
|
|
85
|
+
|
|
86
|
+
child.stdin.write(JSON.stringify(payload));
|
|
87
|
+
child.stdin.end();
|
|
88
|
+
|
|
89
|
+
child.on('close', (code) => {
|
|
90
|
+
resolve({
|
|
91
|
+
statusCode: code === 0 ? 200 : 500,
|
|
92
|
+
responseBody: stdout.slice(0, 2000),
|
|
93
|
+
ok: code === 0,
|
|
94
|
+
errorMessage: code !== 0 ? (stderr.slice(0, 500) || `Worker exited with code ${code}`) : null
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
child.on('error', (err) => {
|
|
99
|
+
resolve({
|
|
100
|
+
statusCode: null,
|
|
101
|
+
responseBody: null,
|
|
102
|
+
ok: false,
|
|
103
|
+
errorMessage: err.message
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function isRetryable(result) {
|
|
110
|
+
if (result.errorMessage) return true; // network error, timeout
|
|
111
|
+
if (!result.statusCode) return true;
|
|
112
|
+
// Retry on 5xx and 429 (rate limit)
|
|
113
|
+
return result.statusCode >= 500 || result.statusCode === 429;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
async function deliverWebhook(db, { squadSlug, contentKey, webhook, triggerType, payload, projectDir }) {
|
|
117
|
+
const resolvedUrl = resolveEnvPlaceholders(webhook.url);
|
|
118
|
+
if (!resolvedUrl) {
|
|
119
|
+
logDelivery(db, {
|
|
120
|
+
squadSlug,
|
|
121
|
+
contentKey,
|
|
122
|
+
webhookSlug: webhook.slug,
|
|
123
|
+
triggerType,
|
|
124
|
+
url: webhook.url || '(empty)',
|
|
125
|
+
errorMessage: 'URL resolved to empty — check ENV variable',
|
|
126
|
+
attempt: 1
|
|
127
|
+
});
|
|
128
|
+
return { ok: false, error: 'URL resolved to empty' };
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const resolvedHeaders = {};
|
|
132
|
+
if (webhook.headers && typeof webhook.headers === 'object') {
|
|
133
|
+
for (const [key, value] of Object.entries(webhook.headers)) {
|
|
134
|
+
resolvedHeaders[key] = resolveEnvPlaceholders(value);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Decide execution path: worker script or direct HTTP
|
|
139
|
+
const hasWorker = webhook.worker && typeof webhook.worker === 'string';
|
|
140
|
+
let workerAbsPath = null;
|
|
141
|
+
if (hasWorker) {
|
|
142
|
+
workerAbsPath = path.resolve(projectDir, webhook.worker);
|
|
143
|
+
try {
|
|
144
|
+
await fs.access(workerAbsPath);
|
|
145
|
+
} catch {
|
|
146
|
+
workerAbsPath = null; // Worker not found, fall back to HTTP
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
let lastResult = null;
|
|
151
|
+
|
|
152
|
+
for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
|
|
153
|
+
if (attempt > 1) {
|
|
154
|
+
await sleep(RETRY_DELAYS[attempt - 2] || 8000);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (workerAbsPath) {
|
|
158
|
+
lastResult = await executeWorkerScript(workerAbsPath, payload);
|
|
159
|
+
} else {
|
|
160
|
+
lastResult = await executeWebhookHttp(resolvedUrl, resolvedHeaders, payload);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
logDelivery(db, {
|
|
164
|
+
squadSlug,
|
|
165
|
+
contentKey,
|
|
166
|
+
webhookSlug: webhook.slug,
|
|
167
|
+
triggerType,
|
|
168
|
+
url: resolvedUrl,
|
|
169
|
+
statusCode: lastResult.statusCode,
|
|
170
|
+
responseBody: lastResult.responseBody,
|
|
171
|
+
errorMessage: lastResult.errorMessage || null,
|
|
172
|
+
attempt
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
if (lastResult.ok) {
|
|
176
|
+
return { ok: true, statusCode: lastResult.statusCode, attempts: attempt };
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (!isRetryable(lastResult)) {
|
|
180
|
+
return { ok: false, statusCode: lastResult.statusCode, error: lastResult.errorMessage, attempts: attempt };
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return {
|
|
185
|
+
ok: false,
|
|
186
|
+
statusCode: lastResult?.statusCode ?? null,
|
|
187
|
+
error: lastResult?.errorMessage || `Failed after ${MAX_RETRIES} attempts`,
|
|
188
|
+
attempts: MAX_RETRIES
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
async function readSquadManifestJson(projectDir, squadSlug) {
|
|
193
|
+
const paths = [
|
|
194
|
+
path.join(projectDir, '.aioson', 'squads', squadSlug, 'squad.manifest.json'),
|
|
195
|
+
path.join(projectDir, 'agents', squadSlug, 'squad.manifest.json')
|
|
196
|
+
];
|
|
197
|
+
|
|
198
|
+
for (const manifestPath of paths) {
|
|
199
|
+
try {
|
|
200
|
+
const raw = await fs.readFile(manifestPath, 'utf8');
|
|
201
|
+
return JSON.parse(raw);
|
|
202
|
+
} catch {
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return null;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function getOutputStrategy(manifest) {
|
|
211
|
+
if (manifest.outputStrategy && typeof manifest.outputStrategy === 'object') {
|
|
212
|
+
return manifest.outputStrategy;
|
|
213
|
+
}
|
|
214
|
+
return null;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function getWebhooksForTrigger(outputStrategy, triggerType) {
|
|
218
|
+
if (!outputStrategy || !outputStrategy.delivery) return [];
|
|
219
|
+
const webhooks = Array.isArray(outputStrategy.delivery.webhooks) ? outputStrategy.delivery.webhooks : [];
|
|
220
|
+
return webhooks.filter((wh) => wh.trigger === triggerType || wh.trigger === 'on-create');
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Main entry point — called after content item is upserted.
|
|
225
|
+
* Checks if auto-publish is enabled and fires matching webhooks.
|
|
226
|
+
*/
|
|
227
|
+
async function runAutoDelivery(db, { projectDir, squadSlug, contentKey, contentPayload }) {
|
|
228
|
+
const manifest = await readSquadManifestJson(projectDir, squadSlug);
|
|
229
|
+
if (!manifest) return { delivered: false, reason: 'no_manifest' };
|
|
230
|
+
|
|
231
|
+
const strategy = getOutputStrategy(manifest);
|
|
232
|
+
if (!strategy) return { delivered: false, reason: 'no_output_strategy' };
|
|
233
|
+
|
|
234
|
+
const delivery = strategy.delivery && typeof strategy.delivery === 'object' ? strategy.delivery : {};
|
|
235
|
+
if (!delivery.autoPublish) return { delivered: false, reason: 'auto_publish_disabled' };
|
|
236
|
+
|
|
237
|
+
const webhooks = getWebhooksForTrigger(strategy, 'on-publish');
|
|
238
|
+
if (webhooks.length === 0) return { delivered: false, reason: 'no_matching_webhooks' };
|
|
239
|
+
|
|
240
|
+
const payload = {
|
|
241
|
+
squadSlug,
|
|
242
|
+
contentKey,
|
|
243
|
+
timestamp: new Date().toISOString(),
|
|
244
|
+
content: contentPayload || null
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
const results = [];
|
|
248
|
+
for (const webhook of webhooks) {
|
|
249
|
+
const result = await deliverWebhook(db, {
|
|
250
|
+
squadSlug,
|
|
251
|
+
contentKey,
|
|
252
|
+
webhook,
|
|
253
|
+
triggerType: 'auto',
|
|
254
|
+
payload,
|
|
255
|
+
projectDir
|
|
256
|
+
});
|
|
257
|
+
results.push({ webhookSlug: webhook.slug, ...result });
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
return {
|
|
261
|
+
delivered: true,
|
|
262
|
+
results,
|
|
263
|
+
allOk: results.every((r) => r.ok)
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Manual delivery — triggered by CLI command or dashboard action.
|
|
269
|
+
* Fires all webhooks matching the given trigger type for a content item.
|
|
270
|
+
*/
|
|
271
|
+
async function runManualDelivery(db, { projectDir, squadSlug, contentKey, triggerType = 'manual', contentPayload }) {
|
|
272
|
+
const manifest = await readSquadManifestJson(projectDir, squadSlug);
|
|
273
|
+
if (!manifest) return { delivered: false, reason: 'no_manifest' };
|
|
274
|
+
|
|
275
|
+
const strategy = getOutputStrategy(manifest);
|
|
276
|
+
if (!strategy) return { delivered: false, reason: 'no_output_strategy' };
|
|
277
|
+
|
|
278
|
+
const delivery = strategy.delivery && typeof strategy.delivery === 'object' ? strategy.delivery : {};
|
|
279
|
+
const webhooks = Array.isArray(delivery.webhooks) ? delivery.webhooks : [];
|
|
280
|
+
|
|
281
|
+
const matching = triggerType === 'manual'
|
|
282
|
+
? webhooks
|
|
283
|
+
: webhooks.filter((wh) => wh.trigger === triggerType);
|
|
284
|
+
|
|
285
|
+
if (matching.length === 0) return { delivered: false, reason: 'no_matching_webhooks' };
|
|
286
|
+
|
|
287
|
+
const payload = {
|
|
288
|
+
squadSlug,
|
|
289
|
+
contentKey,
|
|
290
|
+
timestamp: new Date().toISOString(),
|
|
291
|
+
content: contentPayload || null
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
const results = [];
|
|
295
|
+
for (const webhook of matching) {
|
|
296
|
+
const result = await deliverWebhook(db, {
|
|
297
|
+
squadSlug,
|
|
298
|
+
contentKey,
|
|
299
|
+
webhook,
|
|
300
|
+
triggerType,
|
|
301
|
+
payload,
|
|
302
|
+
projectDir
|
|
303
|
+
});
|
|
304
|
+
results.push({ webhookSlug: webhook.slug, ...result });
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
return {
|
|
308
|
+
delivered: true,
|
|
309
|
+
results,
|
|
310
|
+
allOk: results.every((r) => r.ok)
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
module.exports = {
|
|
315
|
+
runAutoDelivery,
|
|
316
|
+
runManualDelivery,
|
|
317
|
+
deliverWebhook,
|
|
318
|
+
resolveEnvPlaceholders
|
|
319
|
+
};
|
package/src/genome-files.js
CHANGED
|
@@ -12,7 +12,7 @@ const { assertValidGenome, assertValidGenomeMeta } = require('./genome-schema');
|
|
|
12
12
|
const { ensureDir, exists } = require('./utils');
|
|
13
13
|
|
|
14
14
|
function getGenomeDir(projectRoot) {
|
|
15
|
-
return path.join(projectRoot, '.aioson', '
|
|
15
|
+
return path.join(projectRoot, '.aioson', 'genomes');
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
function getGenomeMarkdownPath(projectRoot, slug) {
|
package/src/genome-format.js
CHANGED