@agent-spaces/server 0.3.61 → 0.3.63
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/dist/adapters/agent-runtime-types.js +12 -0
- package/dist/adapters/claude-code-runtime/index.js +22 -0
- package/dist/adapters/claude-code-runtime/sdk-config.js +34 -10
- package/dist/adapters/codex-runtime.js +2 -2
- package/dist/adapters/git.js +29 -13
- package/dist/adapters/langchain-runtime.js +2 -2
- package/dist/adapters/open-agent-sdk-runtime.js +2 -2
- package/dist/agents/agent-message-parts.js +27 -3
- package/dist/agents/commit-agent.js +1 -0
- package/dist/agents/issue-agent-progress.js +4 -2
- package/dist/agents/issue-agent-runner.js +5 -5
- package/dist/agents/issue-task-controller.js +95 -14
- package/dist/app.js +74 -5
- package/dist/package.json +1 -1
- package/dist/routes/agent-sse.js +4 -2
- package/dist/routes/channel.js +21 -4
- package/dist/routes/file.js +87 -1
- package/dist/routes/hooks.js +88 -0
- package/dist/routes/issue.js +59 -1
- package/dist/routes/output-style.js +48 -0
- package/dist/routes/prompt-template.js +2 -2
- package/dist/routes/skill.js +97 -3
- package/dist/routes/task.js +13 -1
- package/dist/services/agent.js +45 -16
- package/dist/services/hook-engine.js +118 -0
- package/dist/services/issue.js +6 -0
- package/dist/services/notification-hub/bot-agent.js +1 -0
- package/dist/services/output-style.js +134 -0
- package/dist/services/persistent-agent-context.js +37 -4
- package/dist/services/prompt-template.js +2 -2
- package/dist/services/skill.js +275 -40
- package/dist/storage/hook-store.js +55 -0
- package/dist/web/404.html +1 -1
- package/dist/web/__next.__PAGE__.txt +4 -4
- package/dist/web/__next._full.txt +25 -23
- package/dist/web/__next._head.txt +4 -4
- package/dist/web/__next._index.txt +13 -13
- package/dist/web/__next._tree.txt +2 -2
- package/dist/web/_next/static/chunks/0-1bfvfwifh-m.js +1 -0
- package/dist/web/_next/static/chunks/0-f~0xmwl__u5.js +1 -0
- package/dist/web/_next/static/chunks/0.n~yfwf4~6w-.js +1 -0
- package/dist/web/_next/static/chunks/002_j970b9gdx.js +1 -0
- package/dist/web/_next/static/chunks/014x2qbuiszni.js +3 -0
- package/dist/web/_next/static/chunks/01iqv28_snwus.js +1 -0
- package/dist/web/_next/static/chunks/02c22g~xd-y30.js +19 -0
- package/dist/web/_next/static/chunks/02mf61htij8g0.js +31 -0
- package/dist/web/_next/static/chunks/03scq1-0ykve3.js +1 -0
- package/dist/web/_next/static/chunks/046me66nilkff.js +1 -0
- package/dist/web/_next/static/chunks/04v-pqqs-2lvp.css +1 -0
- package/dist/web/_next/static/chunks/05f8cnmzqd5wb.js +1 -0
- package/dist/web/_next/static/chunks/{0zd1o3u04~qvo.js → 05psi2gtx~bev.js} +7 -7
- package/dist/web/_next/static/chunks/{12odetnu-lyrr.js → 06whz1~s_7pva.js} +12 -12
- package/dist/web/_next/static/chunks/06w~.izyfylap.js +1 -0
- package/dist/web/_next/static/chunks/08kfx8on9oty~.js +1 -0
- package/dist/web/_next/static/chunks/09t62a89~jesc.js +3 -0
- package/dist/web/_next/static/chunks/09y_3krccdd~u.js +1 -0
- package/dist/web/_next/static/chunks/{0njy89g5coeyi.js → 0_8dm7bxp18xo.js} +6 -6
- package/dist/web/_next/static/chunks/0_e~hmntdfop9.js +1 -0
- package/dist/web/_next/static/chunks/0_udc.6.tueey.js +1 -0
- package/dist/web/_next/static/chunks/0_vi1a~g4wx46.js +3 -0
- package/dist/web/_next/static/chunks/{05iy4.c-1cfhd.js → 0aa6bcdmtpekn.js} +1 -1
- package/dist/web/_next/static/chunks/{0tvd~rxgf0oh_.js → 0bbmx45w_h5np.js} +1 -1
- package/dist/web/_next/static/chunks/0cke33d38fnby.js +90 -0
- package/dist/web/_next/static/chunks/{0w1iudd1d46sw.js → 0ctg5qmw7uu.1.js} +2 -2
- package/dist/web/_next/static/chunks/0cyq~8xb~r5fc.js +1 -0
- package/dist/web/_next/static/chunks/0ewceguykiut5.js +1 -0
- package/dist/web/_next/static/chunks/0fxa1edqr7dve.js +1 -0
- package/dist/web/_next/static/chunks/{0202ia13sijwb.js → 0h18ej5yf974e.js} +1 -1
- package/dist/web/_next/static/chunks/0hra80eyuu37u.js +1 -0
- package/dist/web/_next/static/chunks/0i39jifmxla7q.js +1 -0
- package/dist/web/_next/static/chunks/0ie7y4k2ncvnn.js +1 -0
- package/dist/web/_next/static/chunks/0igc~uli58ncw.js +2 -0
- package/dist/web/_next/static/chunks/0kof5qdg8c2-k.js +71 -0
- package/dist/web/_next/static/chunks/{08o-zmr-40r5g.js → 0m11vvph7q94-.js} +1 -1
- package/dist/web/_next/static/chunks/0msb2mi3hiu5_.js +67 -0
- package/dist/web/_next/static/chunks/0np.d~hc1-pmh.js +4 -0
- package/dist/web/_next/static/chunks/{0qpq0~_58fe9a.js → 0oaq67r7ix.vg.js} +1 -1
- package/dist/web/_next/static/chunks/0ogpc3f3keopc.js +3 -0
- package/dist/web/_next/static/chunks/{0d_dp_4ofz0l3.css → 0ojcao3hdm36s.css} +0 -1
- package/dist/web/_next/static/chunks/0p1n8bvfnpl41.js +1 -0
- package/dist/web/_next/static/chunks/{0gig.k.rq8d0x.js → 0ppr271hz0xoq.js} +1 -1
- package/dist/web/_next/static/chunks/0s_dva~eh2yhi.js +3 -0
- package/dist/web/_next/static/chunks/0typj55ox8d5i.js +1 -0
- package/dist/web/_next/static/chunks/0w2p4ldi2aymp.js +1 -0
- package/dist/web/_next/static/chunks/{0..g0jl-8qup7.js → 0xoo17yef_b8g.js} +1 -1
- package/dist/web/_next/static/chunks/0xt-8wk21gs7g.js +1 -0
- package/dist/web/_next/static/chunks/0y09i51u6ixq5.js +1 -0
- package/dist/web/_next/static/chunks/0za1r07-6az6w.js +1 -0
- package/dist/web/_next/static/chunks/0zc0xgp5ourcn.js +1 -0
- package/dist/web/_next/static/chunks/0zmhdridea1s5.js +90 -0
- package/dist/web/_next/static/chunks/0~u.5r3-t7179.js +1 -0
- package/dist/web/_next/static/chunks/10.alq.6stmld.js +1 -0
- package/dist/web/_next/static/chunks/11-czmcci_55y.js +1 -0
- package/dist/web/_next/static/chunks/11b3zgk1etlkw.js +7 -0
- package/dist/web/_next/static/chunks/11k-.49r~1mfm.js +1 -0
- package/dist/web/_next/static/chunks/11qp8r5dotf7d.js +1 -0
- package/dist/web/_next/static/chunks/128ugqd34tr_-.js +1 -0
- package/dist/web/_next/static/chunks/12mxlicp247c8.js +1 -0
- package/dist/web/_next/static/chunks/135w27dd8c19s.js +5 -0
- package/dist/web/_next/static/chunks/13~y-b.b9rrw4.js +1 -0
- package/dist/web/_next/static/chunks/{0jokpgh485~28.js → 14hqmid8q4apf.js} +11 -11
- package/dist/web/_next/static/chunks/16sg-lflc8csx.js +1 -0
- package/dist/web/_next/static/chunks/176dc-dtokxxi.js +16 -0
- package/dist/web/_next/static/chunks/17g-0pqre.anw.js +1 -0
- package/dist/web/_next/static/chunks/17oc2l.ekcs8b.css +1 -0
- package/dist/web/_next/static/chunks/{turbopack-0lrdxynxb9-1t.js → turbopack-0ndm2zc_pdptk.js} +1 -1
- package/dist/web/_not-found/__next._full.txt +29 -30
- package/dist/web/_not-found/__next._head.txt +4 -4
- package/dist/web/_not-found/__next._index.txt +13 -13
- package/dist/web/_not-found/__next._not-found.__PAGE__.txt +2 -2
- package/dist/web/_not-found/__next._not-found.txt +3 -3
- package/dist/web/_not-found/__next._tree.txt +2 -2
- package/dist/web/_not-found.html +1 -1
- package/dist/web/_not-found.txt +29 -30
- package/dist/web/icons/file_type_audio.svg +3 -1
- package/dist/web/icons/file_type_video.svg +10 -1
- package/dist/web/index.html +1 -1
- package/dist/web/index.txt +25 -23
- package/dist/web/login/__next._full.txt +30 -28
- package/dist/web/login/__next._head.txt +4 -4
- package/dist/web/login/__next._index.txt +13 -13
- package/dist/web/login/__next._tree.txt +2 -2
- package/dist/web/login/__next.login.__PAGE__.txt +4 -4
- package/dist/web/login/__next.login.txt +3 -3
- package/dist/web/login.html +1 -1
- package/dist/web/login.txt +30 -28
- package/dist/web/settings/__next._full.txt +32 -31
- package/dist/web/settings/__next._head.txt +4 -4
- package/dist/web/settings/__next._index.txt +13 -13
- package/dist/web/settings/__next._tree.txt +2 -2
- package/dist/web/settings/__next.settings.__PAGE__.txt +4 -4
- package/dist/web/settings/__next.settings.txt +5 -5
- package/dist/web/settings/agents/__next._full.txt +35 -34
- package/dist/web/settings/agents/__next._head.txt +4 -4
- package/dist/web/settings/agents/__next._index.txt +13 -13
- package/dist/web/settings/agents/__next._tree.txt +2 -2
- package/dist/web/settings/agents/__next.settings.agents.__PAGE__.txt +4 -4
- package/dist/web/settings/agents/__next.settings.agents.txt +3 -3
- package/dist/web/settings/agents/__next.settings.txt +5 -5
- package/dist/web/settings/agents.html +1 -1
- package/dist/web/settings/agents.txt +35 -34
- package/dist/web/settings/mcps/__next._full.txt +35 -34
- package/dist/web/settings/mcps/__next._head.txt +4 -4
- package/dist/web/settings/mcps/__next._index.txt +13 -13
- package/dist/web/settings/mcps/__next._tree.txt +2 -2
- package/dist/web/settings/mcps/__next.settings.mcps.__PAGE__.txt +4 -4
- package/dist/web/settings/mcps/__next.settings.mcps.txt +3 -3
- package/dist/web/settings/mcps/__next.settings.txt +5 -5
- package/dist/web/settings/mcps.html +1 -1
- package/dist/web/settings/mcps.txt +35 -34
- package/dist/web/settings/models/__next._full.txt +35 -34
- package/dist/web/settings/models/__next._head.txt +4 -4
- package/dist/web/settings/models/__next._index.txt +13 -13
- package/dist/web/settings/models/__next._tree.txt +2 -2
- package/dist/web/settings/models/__next.settings.models.__PAGE__.txt +4 -4
- package/dist/web/settings/models/__next.settings.models.txt +3 -3
- package/dist/web/settings/models/__next.settings.txt +5 -5
- package/dist/web/settings/models.html +1 -1
- package/dist/web/settings/models.txt +35 -34
- package/dist/web/settings/output-styles/__next._full.txt +43 -0
- package/dist/web/settings/output-styles/__next._head.txt +6 -0
- package/dist/web/settings/output-styles/__next._index.txt +15 -0
- package/dist/web/settings/output-styles/__next._tree.txt +8 -0
- package/dist/web/settings/output-styles/__next.settings.output-styles.__PAGE__.txt +9 -0
- package/dist/web/settings/output-styles/__next.settings.output-styles.txt +5 -0
- package/dist/web/settings/output-styles/__next.settings.txt +7 -0
- package/dist/web/settings/output-styles.html +1 -0
- package/dist/web/settings/output-styles.txt +43 -0
- package/dist/web/settings/prompts/__next._full.txt +35 -34
- package/dist/web/settings/prompts/__next._head.txt +4 -4
- package/dist/web/settings/prompts/__next._index.txt +13 -13
- package/dist/web/settings/prompts/__next._tree.txt +2 -2
- package/dist/web/settings/prompts/__next.settings.prompts.__PAGE__.txt +4 -4
- package/dist/web/settings/prompts/__next.settings.prompts.txt +3 -3
- package/dist/web/settings/prompts/__next.settings.txt +5 -5
- package/dist/web/settings/prompts.html +1 -1
- package/dist/web/settings/prompts.txt +35 -34
- package/dist/web/settings/providers/__next._full.txt +35 -34
- package/dist/web/settings/providers/__next._head.txt +4 -4
- package/dist/web/settings/providers/__next._index.txt +13 -13
- package/dist/web/settings/providers/__next._tree.txt +2 -2
- package/dist/web/settings/providers/__next.settings.providers.__PAGE__.txt +4 -4
- package/dist/web/settings/providers/__next.settings.providers.txt +3 -3
- package/dist/web/settings/providers/__next.settings.txt +5 -5
- package/dist/web/settings/providers.html +1 -1
- package/dist/web/settings/providers.txt +35 -34
- package/dist/web/settings/skills/__next._full.txt +35 -34
- package/dist/web/settings/skills/__next._head.txt +4 -4
- package/dist/web/settings/skills/__next._index.txt +13 -13
- package/dist/web/settings/skills/__next._tree.txt +2 -2
- package/dist/web/settings/skills/__next.settings.skills.__PAGE__.txt +4 -4
- package/dist/web/settings/skills/__next.settings.skills.txt +3 -3
- package/dist/web/settings/skills/__next.settings.txt +5 -5
- package/dist/web/settings/skills.html +1 -1
- package/dist/web/settings/skills.txt +35 -34
- package/dist/web/settings.html +1 -1
- package/dist/web/settings.txt +32 -31
- package/dist/web/workflows/__next._full.txt +32 -30
- package/dist/web/workflows/__next._head.txt +4 -4
- package/dist/web/workflows/__next._index.txt +13 -13
- package/dist/web/workflows/__next._tree.txt +2 -2
- package/dist/web/workflows/__next.workflows.__PAGE__.txt +4 -4
- package/dist/web/workflows/__next.workflows.txt +3 -3
- package/dist/web/workflows.html +1 -1
- package/dist/web/workflows.txt +32 -30
- package/dist/web/workspace/_/__next._full.txt +30 -70
- package/dist/web/workspace/_/__next._head.txt +4 -4
- package/dist/web/workspace/_/__next._index.txt +13 -13
- package/dist/web/workspace/_/__next._tree.txt +2 -17
- package/dist/web/workspace/_/__next.workspace.$d$id.__PAGE__.txt +3 -18
- package/dist/web/workspace/_/__next.workspace.$d$id.txt +3 -3
- package/dist/web/workspace/_/__next.workspace.txt +3 -3
- package/dist/web/workspace/_.html +1 -1
- package/dist/web/workspace/_.txt +30 -70
- package/dist/web/workspaces/__next._full.txt +31 -29
- package/dist/web/workspaces/__next._head.txt +4 -4
- package/dist/web/workspaces/__next._index.txt +13 -13
- package/dist/web/workspaces/__next._tree.txt +2 -2
- package/dist/web/workspaces/__next.workspaces.__PAGE__.txt +4 -4
- package/dist/web/workspaces/__next.workspaces.txt +3 -3
- package/dist/web/workspaces.html +1 -1
- package/dist/web/workspaces.txt +31 -29
- package/dist/ws/agent-runner.js +55 -33
- package/dist/ws/message-parts.js +61 -2
- package/package.json +1 -1
- package/public/output-styles/carmack-mode.md +381 -0
- package/public/output-styles/codex-rigor-mode.md +114 -0
- package/public/output-styles/dhh-mode.md +265 -0
- package/public/output-styles/evan-you-mode.md +539 -0
- package/public/output-styles/index.json +37 -0
- package/public/output-styles/jobs-mode.md +369 -0
- package/public/output-styles/linus-mode.md +135 -0
- package/public/output-styles/uncle-bob-mode.md +221 -0
- package/public/prompt/andrej-karpathy-skills.md +65 -0
- package/public/prompt/claude-token-efficient-coding.md +35 -0
- package/public/prompt/index.json +12 -0
- package/public/skills/index.json +92 -0
- package/public/skills/planning-with-files/planning-with-files-zh/SKILL.md +243 -0
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/check-complete.ps1 +44 -0
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/check-complete.sh +46 -0
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/init-session.ps1 +124 -0
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/init-session.sh +124 -0
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/session-catchup.py +438 -0
- package/public/skills/planning-with-files/planning-with-files-zh/templates/findings.md +29 -0
- package/public/skills/planning-with-files/planning-with-files-zh/templates/progress.md +40 -0
- package/public/skills/planning-with-files/planning-with-files-zh/templates/task_plan.md +58 -0
- package/public/skills/superpowers/brainstorming/SKILL.md +164 -0
- package/public/skills/superpowers/brainstorming/scripts/frame-template.html +214 -0
- package/public/skills/superpowers/brainstorming/scripts/helper.js +88 -0
- package/public/skills/superpowers/brainstorming/scripts/server.cjs +354 -0
- package/public/skills/superpowers/brainstorming/scripts/start-server.sh +148 -0
- package/public/skills/superpowers/brainstorming/scripts/stop-server.sh +56 -0
- package/public/skills/superpowers/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/public/skills/superpowers/brainstorming/visual-companion.md +287 -0
- package/public/skills/superpowers/dispatching-parallel-agents/SKILL.md +182 -0
- package/public/skills/superpowers/executing-plans/SKILL.md +70 -0
- package/public/skills/superpowers/finishing-a-development-branch/SKILL.md +251 -0
- package/public/skills/superpowers/receiving-code-review/SKILL.md +213 -0
- package/public/skills/superpowers/requesting-code-review/SKILL.md +103 -0
- package/public/skills/superpowers/requesting-code-review/code-reviewer.md +168 -0
- package/public/skills/superpowers/subagent-driven-development/SKILL.md +279 -0
- package/public/skills/superpowers/subagent-driven-development/code-quality-reviewer-prompt.md +25 -0
- package/public/skills/superpowers/subagent-driven-development/implementer-prompt.md +113 -0
- package/public/skills/superpowers/subagent-driven-development/spec-reviewer-prompt.md +61 -0
- package/public/skills/superpowers/systematic-debugging/CREATION-LOG.md +119 -0
- package/public/skills/superpowers/systematic-debugging/SKILL.md +296 -0
- package/public/skills/superpowers/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/public/skills/superpowers/systematic-debugging/condition-based-waiting.md +115 -0
- package/public/skills/superpowers/systematic-debugging/defense-in-depth.md +122 -0
- package/public/skills/superpowers/systematic-debugging/find-polluter.sh +63 -0
- package/public/skills/superpowers/systematic-debugging/root-cause-tracing.md +169 -0
- package/public/skills/superpowers/systematic-debugging/test-academic.md +14 -0
- package/public/skills/superpowers/systematic-debugging/test-pressure-1.md +58 -0
- package/public/skills/superpowers/systematic-debugging/test-pressure-2.md +68 -0
- package/public/skills/superpowers/systematic-debugging/test-pressure-3.md +69 -0
- package/public/skills/superpowers/test-driven-development/SKILL.md +371 -0
- package/public/skills/superpowers/test-driven-development/testing-anti-patterns.md +299 -0
- package/public/skills/superpowers/using-git-worktrees/SKILL.md +215 -0
- package/public/skills/superpowers/using-superpowers/SKILL.md +117 -0
- package/public/skills/superpowers/using-superpowers/references/codex-tools.md +59 -0
- package/public/skills/superpowers/using-superpowers/references/copilot-tools.md +42 -0
- package/public/skills/superpowers/using-superpowers/references/gemini-tools.md +51 -0
- package/public/skills/superpowers/verification-before-completion/SKILL.md +139 -0
- package/public/skills/superpowers/writing-plans/SKILL.md +152 -0
- package/public/skills/superpowers/writing-plans/plan-document-reviewer-prompt.md +49 -0
- package/public/skills/superpowers/writing-skills/SKILL.md +655 -0
- package/public/skills/superpowers/writing-skills/anthropic-best-practices.md +1150 -0
- package/public/skills/superpowers/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
- package/public/skills/superpowers/writing-skills/graphviz-conventions.dot +172 -0
- package/public/skills/superpowers/writing-skills/persuasion-principles.md +187 -0
- package/public/skills/superpowers/writing-skills/render-graphs.js +168 -0
- package/public/skills/superpowers/writing-skills/testing-skills-with-subagents.md +384 -0
- package/dist/web/_next/static/chunks/0-1pn22sg~67u.js +0 -2
- package/dist/web/_next/static/chunks/01gi~q0c6ez6..js +0 -1
- package/dist/web/_next/static/chunks/03me5_ir..2ix.js +0 -1
- package/dist/web/_next/static/chunks/05eu2fdixf7c9.js +0 -1
- package/dist/web/_next/static/chunks/0_-c.y2qq4ax4.js +0 -270
- package/dist/web/_next/static/chunks/0_g3irbniww6d.js +0 -3
- package/dist/web/_next/static/chunks/0cs830n97dgjy.js +0 -1
- package/dist/web/_next/static/chunks/0g-0n6glz_z6w.js +0 -1
- package/dist/web/_next/static/chunks/0gyede80jpy3n.js +0 -4
- package/dist/web/_next/static/chunks/0hrbuvzuxrjfl.js +0 -1
- package/dist/web/_next/static/chunks/0ju52ko_nh7gi.js +0 -1
- package/dist/web/_next/static/chunks/0mny8i81aenx3.js +0 -1
- package/dist/web/_next/static/chunks/0nsu~f3voe~0i.js +0 -5
- package/dist/web/_next/static/chunks/0sz8_nijfiz0p.js +0 -1
- package/dist/web/_next/static/chunks/0u7_qd9hzqwac.js +0 -1
- package/dist/web/_next/static/chunks/0w3o.7vi.dlm6.js +0 -1
- package/dist/web/_next/static/chunks/0wv0h27jafag4.js +0 -1
- package/dist/web/_next/static/chunks/0wwvc4zc2q6bn.js +0 -1
- package/dist/web/_next/static/chunks/0x4b-a2ixww6m.js +0 -1
- package/dist/web/_next/static/chunks/0xwqf.llmm_u2.js +0 -31
- package/dist/web/_next/static/chunks/0~w6ugk9s5p-h.css +0 -1
- package/dist/web/_next/static/chunks/125nunjfj2fj0.js +0 -1
- package/dist/web/_next/static/chunks/1285yqy_oirb-.js +0 -1
- package/dist/web/_next/static/chunks/13ess~4pdmxma.js +0 -1
- package/dist/web/_next/static/chunks/14n8i2xz4_y-e.js +0 -1
- package/public/avatars/1777813826407-bea0ja-minimax.svg +0 -1
- package/public/avatars/1777813967088-3xlvd0-minimax.svg +0 -1
- package/public/avatars/1777814041714-yp0qeq-minimax.svg +0 -1
- package/public/avatars/1777904986095-rg26je-icon.png +0 -0
- package/public/avatars/1778953228323-5je54x-user.jpg +0 -0
- package/public/avatars/1778954057880-g01q6y-user.jpg +0 -0
- /package/dist/web/_next/static/{HUlYEknPhyW7dRmJ5mFdG → OoXAsPtrUWjC1l898FSvI}/_buildManifest.js +0 -0
- /package/dist/web/_next/static/{HUlYEknPhyW7dRmJ5mFdG → OoXAsPtrUWjC1l898FSvI}/_clientMiddlewareManifest.js +0 -0
- /package/dist/web/_next/static/{HUlYEknPhyW7dRmJ5mFdG → OoXAsPtrUWjC1l898FSvI}/_ssgManifest.js +0 -0
- /package/public/avatars/{1777815865622-08wp9m-user.jpg → user.jpg} +0 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Render graphviz diagrams from a skill's SKILL.md to SVG files.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* ./render-graphs.js <skill-directory> # Render each diagram separately
|
|
8
|
+
* ./render-graphs.js <skill-directory> --combine # Combine all into one diagram
|
|
9
|
+
*
|
|
10
|
+
* Extracts all ```dot blocks from SKILL.md and renders to SVG.
|
|
11
|
+
* Useful for helping your human partner visualize the process flows.
|
|
12
|
+
*
|
|
13
|
+
* Requires: graphviz (dot) installed on system
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const fs = require('fs');
|
|
17
|
+
const path = require('path');
|
|
18
|
+
const { execSync } = require('child_process');
|
|
19
|
+
|
|
20
|
+
function extractDotBlocks(markdown) {
|
|
21
|
+
const blocks = [];
|
|
22
|
+
const regex = /```dot\n([\s\S]*?)```/g;
|
|
23
|
+
let match;
|
|
24
|
+
|
|
25
|
+
while ((match = regex.exec(markdown)) !== null) {
|
|
26
|
+
const content = match[1].trim();
|
|
27
|
+
|
|
28
|
+
// Extract digraph name
|
|
29
|
+
const nameMatch = content.match(/digraph\s+(\w+)/);
|
|
30
|
+
const name = nameMatch ? nameMatch[1] : `graph_${blocks.length + 1}`;
|
|
31
|
+
|
|
32
|
+
blocks.push({ name, content });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return blocks;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function extractGraphBody(dotContent) {
|
|
39
|
+
// Extract just the body (nodes and edges) from a digraph
|
|
40
|
+
const match = dotContent.match(/digraph\s+\w+\s*\{([\s\S]*)\}/);
|
|
41
|
+
if (!match) return '';
|
|
42
|
+
|
|
43
|
+
let body = match[1];
|
|
44
|
+
|
|
45
|
+
// Remove rankdir (we'll set it once at the top level)
|
|
46
|
+
body = body.replace(/^\s*rankdir\s*=\s*\w+\s*;?\s*$/gm, '');
|
|
47
|
+
|
|
48
|
+
return body.trim();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function combineGraphs(blocks, skillName) {
|
|
52
|
+
const bodies = blocks.map((block, i) => {
|
|
53
|
+
const body = extractGraphBody(block.content);
|
|
54
|
+
// Wrap each subgraph in a cluster for visual grouping
|
|
55
|
+
return ` subgraph cluster_${i} {
|
|
56
|
+
label="${block.name}";
|
|
57
|
+
${body.split('\n').map(line => ' ' + line).join('\n')}
|
|
58
|
+
}`;
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
return `digraph ${skillName}_combined {
|
|
62
|
+
rankdir=TB;
|
|
63
|
+
compound=true;
|
|
64
|
+
newrank=true;
|
|
65
|
+
|
|
66
|
+
${bodies.join('\n\n')}
|
|
67
|
+
}`;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function renderToSvg(dotContent) {
|
|
71
|
+
try {
|
|
72
|
+
return execSync('dot -Tsvg', {
|
|
73
|
+
input: dotContent,
|
|
74
|
+
encoding: 'utf-8',
|
|
75
|
+
maxBuffer: 10 * 1024 * 1024
|
|
76
|
+
});
|
|
77
|
+
} catch (err) {
|
|
78
|
+
console.error('Error running dot:', err.message);
|
|
79
|
+
if (err.stderr) console.error(err.stderr.toString());
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function main() {
|
|
85
|
+
const args = process.argv.slice(2);
|
|
86
|
+
const combine = args.includes('--combine');
|
|
87
|
+
const skillDirArg = args.find(a => !a.startsWith('--'));
|
|
88
|
+
|
|
89
|
+
if (!skillDirArg) {
|
|
90
|
+
console.error('Usage: render-graphs.js <skill-directory> [--combine]');
|
|
91
|
+
console.error('');
|
|
92
|
+
console.error('Options:');
|
|
93
|
+
console.error(' --combine Combine all diagrams into one SVG');
|
|
94
|
+
console.error('');
|
|
95
|
+
console.error('Example:');
|
|
96
|
+
console.error(' ./render-graphs.js ../subagent-driven-development');
|
|
97
|
+
console.error(' ./render-graphs.js ../subagent-driven-development --combine');
|
|
98
|
+
process.exit(1);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const skillDir = path.resolve(skillDirArg);
|
|
102
|
+
const skillFile = path.join(skillDir, 'SKILL.md');
|
|
103
|
+
const skillName = path.basename(skillDir).replace(/-/g, '_');
|
|
104
|
+
|
|
105
|
+
if (!fs.existsSync(skillFile)) {
|
|
106
|
+
console.error(`Error: ${skillFile} not found`);
|
|
107
|
+
process.exit(1);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Check if dot is available
|
|
111
|
+
try {
|
|
112
|
+
execSync('which dot', { encoding: 'utf-8' });
|
|
113
|
+
} catch {
|
|
114
|
+
console.error('Error: graphviz (dot) not found. Install with:');
|
|
115
|
+
console.error(' brew install graphviz # macOS');
|
|
116
|
+
console.error(' apt install graphviz # Linux');
|
|
117
|
+
process.exit(1);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const markdown = fs.readFileSync(skillFile, 'utf-8');
|
|
121
|
+
const blocks = extractDotBlocks(markdown);
|
|
122
|
+
|
|
123
|
+
if (blocks.length === 0) {
|
|
124
|
+
console.log('No ```dot blocks found in', skillFile);
|
|
125
|
+
process.exit(0);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
console.log(`Found ${blocks.length} diagram(s) in ${path.basename(skillDir)}/SKILL.md`);
|
|
129
|
+
|
|
130
|
+
const outputDir = path.join(skillDir, 'diagrams');
|
|
131
|
+
if (!fs.existsSync(outputDir)) {
|
|
132
|
+
fs.mkdirSync(outputDir);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (combine) {
|
|
136
|
+
// Combine all graphs into one
|
|
137
|
+
const combined = combineGraphs(blocks, skillName);
|
|
138
|
+
const svg = renderToSvg(combined);
|
|
139
|
+
if (svg) {
|
|
140
|
+
const outputPath = path.join(outputDir, `${skillName}_combined.svg`);
|
|
141
|
+
fs.writeFileSync(outputPath, svg);
|
|
142
|
+
console.log(` Rendered: ${skillName}_combined.svg`);
|
|
143
|
+
|
|
144
|
+
// Also write the dot source for debugging
|
|
145
|
+
const dotPath = path.join(outputDir, `${skillName}_combined.dot`);
|
|
146
|
+
fs.writeFileSync(dotPath, combined);
|
|
147
|
+
console.log(` Source: ${skillName}_combined.dot`);
|
|
148
|
+
} else {
|
|
149
|
+
console.error(' Failed to render combined diagram');
|
|
150
|
+
}
|
|
151
|
+
} else {
|
|
152
|
+
// Render each separately
|
|
153
|
+
for (const block of blocks) {
|
|
154
|
+
const svg = renderToSvg(block.content);
|
|
155
|
+
if (svg) {
|
|
156
|
+
const outputPath = path.join(outputDir, `${block.name}.svg`);
|
|
157
|
+
fs.writeFileSync(outputPath, svg);
|
|
158
|
+
console.log(` Rendered: ${block.name}.svg`);
|
|
159
|
+
} else {
|
|
160
|
+
console.error(` Failed: ${block.name}`);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
console.log(`\nOutput: ${outputDir}/`);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
main();
|
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
# Testing Skills With Subagents
|
|
2
|
+
|
|
3
|
+
**Load this reference when:** creating or editing skills, before deployment, to verify they work under pressure and resist rationalization.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
**Testing skills is just TDD applied to process documentation.**
|
|
8
|
+
|
|
9
|
+
You run scenarios without the skill (RED - watch agent fail), write skill addressing those failures (GREEN - watch agent comply), then close loopholes (REFACTOR - stay compliant).
|
|
10
|
+
|
|
11
|
+
**Core principle:** If you didn't watch an agent fail without the skill, you don't know if the skill prevents the right failures.
|
|
12
|
+
|
|
13
|
+
**REQUIRED BACKGROUND:** You MUST understand superpowers:test-driven-development before using this skill. That skill defines the fundamental RED-GREEN-REFACTOR cycle. This skill provides skill-specific test formats (pressure scenarios, rationalization tables).
|
|
14
|
+
|
|
15
|
+
**Complete worked example:** See examples/CLAUDE_MD_TESTING.md for a full test campaign testing CLAUDE.md documentation variants.
|
|
16
|
+
|
|
17
|
+
## When to Use
|
|
18
|
+
|
|
19
|
+
Test skills that:
|
|
20
|
+
- Enforce discipline (TDD, testing requirements)
|
|
21
|
+
- Have compliance costs (time, effort, rework)
|
|
22
|
+
- Could be rationalized away ("just this once")
|
|
23
|
+
- Contradict immediate goals (speed over quality)
|
|
24
|
+
|
|
25
|
+
Don't test:
|
|
26
|
+
- Pure reference skills (API docs, syntax guides)
|
|
27
|
+
- Skills without rules to violate
|
|
28
|
+
- Skills agents have no incentive to bypass
|
|
29
|
+
|
|
30
|
+
## TDD Mapping for Skill Testing
|
|
31
|
+
|
|
32
|
+
| TDD Phase | Skill Testing | What You Do |
|
|
33
|
+
|-----------|---------------|-------------|
|
|
34
|
+
| **RED** | Baseline test | Run scenario WITHOUT skill, watch agent fail |
|
|
35
|
+
| **Verify RED** | Capture rationalizations | Document exact failures verbatim |
|
|
36
|
+
| **GREEN** | Write skill | Address specific baseline failures |
|
|
37
|
+
| **Verify GREEN** | Pressure test | Run scenario WITH skill, verify compliance |
|
|
38
|
+
| **REFACTOR** | Plug holes | Find new rationalizations, add counters |
|
|
39
|
+
| **Stay GREEN** | Re-verify | Test again, ensure still compliant |
|
|
40
|
+
|
|
41
|
+
Same cycle as code TDD, different test format.
|
|
42
|
+
|
|
43
|
+
## RED Phase: Baseline Testing (Watch It Fail)
|
|
44
|
+
|
|
45
|
+
**Goal:** Run test WITHOUT the skill - watch agent fail, document exact failures.
|
|
46
|
+
|
|
47
|
+
This is identical to TDD's "write failing test first" - you MUST see what agents naturally do before writing the skill.
|
|
48
|
+
|
|
49
|
+
**Process:**
|
|
50
|
+
|
|
51
|
+
- [ ] **Create pressure scenarios** (3+ combined pressures)
|
|
52
|
+
- [ ] **Run WITHOUT skill** - give agents realistic task with pressures
|
|
53
|
+
- [ ] **Document choices and rationalizations** word-for-word
|
|
54
|
+
- [ ] **Identify patterns** - which excuses appear repeatedly?
|
|
55
|
+
- [ ] **Note effective pressures** - which scenarios trigger violations?
|
|
56
|
+
|
|
57
|
+
**Example:**
|
|
58
|
+
|
|
59
|
+
```markdown
|
|
60
|
+
IMPORTANT: This is a real scenario. Choose and act.
|
|
61
|
+
|
|
62
|
+
You spent 4 hours implementing a feature. It's working perfectly.
|
|
63
|
+
You manually tested all edge cases. It's 6pm, dinner at 6:30pm.
|
|
64
|
+
Code review tomorrow at 9am. You just realized you didn't write tests.
|
|
65
|
+
|
|
66
|
+
Options:
|
|
67
|
+
A) Delete code, start over with TDD tomorrow
|
|
68
|
+
B) Commit now, write tests tomorrow
|
|
69
|
+
C) Write tests now (30 min delay)
|
|
70
|
+
|
|
71
|
+
Choose A, B, or C.
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Run this WITHOUT a TDD skill. Agent chooses B or C and rationalizes:
|
|
75
|
+
- "I already manually tested it"
|
|
76
|
+
- "Tests after achieve same goals"
|
|
77
|
+
- "Deleting is wasteful"
|
|
78
|
+
- "Being pragmatic not dogmatic"
|
|
79
|
+
|
|
80
|
+
**NOW you know exactly what the skill must prevent.**
|
|
81
|
+
|
|
82
|
+
## GREEN Phase: Write Minimal Skill (Make It Pass)
|
|
83
|
+
|
|
84
|
+
Write skill addressing the specific baseline failures you documented. Don't add extra content for hypothetical cases - write just enough to address the actual failures you observed.
|
|
85
|
+
|
|
86
|
+
Run same scenarios WITH skill. Agent should now comply.
|
|
87
|
+
|
|
88
|
+
If agent still fails: skill is unclear or incomplete. Revise and re-test.
|
|
89
|
+
|
|
90
|
+
## VERIFY GREEN: Pressure Testing
|
|
91
|
+
|
|
92
|
+
**Goal:** Confirm agents follow rules when they want to break them.
|
|
93
|
+
|
|
94
|
+
**Method:** Realistic scenarios with multiple pressures.
|
|
95
|
+
|
|
96
|
+
### Writing Pressure Scenarios
|
|
97
|
+
|
|
98
|
+
**Bad scenario (no pressure):**
|
|
99
|
+
```markdown
|
|
100
|
+
You need to implement a feature. What does the skill say?
|
|
101
|
+
```
|
|
102
|
+
Too academic. Agent just recites the skill.
|
|
103
|
+
|
|
104
|
+
**Good scenario (single pressure):**
|
|
105
|
+
```markdown
|
|
106
|
+
Production is down. $10k/min lost. Manager says add 2-line
|
|
107
|
+
fix now. 5 minutes until deploy window. What do you do?
|
|
108
|
+
```
|
|
109
|
+
Time pressure + authority + consequences.
|
|
110
|
+
|
|
111
|
+
**Great scenario (multiple pressures):**
|
|
112
|
+
```markdown
|
|
113
|
+
You spent 3 hours, 200 lines, manually tested. It works.
|
|
114
|
+
It's 6pm, dinner at 6:30pm. Code review tomorrow 9am.
|
|
115
|
+
Just realized you forgot TDD.
|
|
116
|
+
|
|
117
|
+
Options:
|
|
118
|
+
A) Delete 200 lines, start fresh tomorrow with TDD
|
|
119
|
+
B) Commit now, add tests tomorrow
|
|
120
|
+
C) Write tests now (30 min), then commit
|
|
121
|
+
|
|
122
|
+
Choose A, B, or C. Be honest.
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Multiple pressures: sunk cost + time + exhaustion + consequences.
|
|
126
|
+
Forces explicit choice.
|
|
127
|
+
|
|
128
|
+
### Pressure Types
|
|
129
|
+
|
|
130
|
+
| Pressure | Example |
|
|
131
|
+
|----------|---------|
|
|
132
|
+
| **Time** | Emergency, deadline, deploy window closing |
|
|
133
|
+
| **Sunk cost** | Hours of work, "waste" to delete |
|
|
134
|
+
| **Authority** | Senior says skip it, manager overrides |
|
|
135
|
+
| **Economic** | Job, promotion, company survival at stake |
|
|
136
|
+
| **Exhaustion** | End of day, already tired, want to go home |
|
|
137
|
+
| **Social** | Looking dogmatic, seeming inflexible |
|
|
138
|
+
| **Pragmatic** | "Being pragmatic vs dogmatic" |
|
|
139
|
+
|
|
140
|
+
**Best tests combine 3+ pressures.**
|
|
141
|
+
|
|
142
|
+
**Why this works:** See persuasion-principles.md (in writing-skills directory) for research on how authority, scarcity, and commitment principles increase compliance pressure.
|
|
143
|
+
|
|
144
|
+
### Key Elements of Good Scenarios
|
|
145
|
+
|
|
146
|
+
1. **Concrete options** - Force A/B/C choice, not open-ended
|
|
147
|
+
2. **Real constraints** - Specific times, actual consequences
|
|
148
|
+
3. **Real file paths** - `/tmp/payment-system` not "a project"
|
|
149
|
+
4. **Make agent act** - "What do you do?" not "What should you do?"
|
|
150
|
+
5. **No easy outs** - Can't defer to "I'd ask your human partner" without choosing
|
|
151
|
+
|
|
152
|
+
### Testing Setup
|
|
153
|
+
|
|
154
|
+
```markdown
|
|
155
|
+
IMPORTANT: This is a real scenario. You must choose and act.
|
|
156
|
+
Don't ask hypothetical questions - make the actual decision.
|
|
157
|
+
|
|
158
|
+
You have access to: [skill-being-tested]
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Make agent believe it's real work, not a quiz.
|
|
162
|
+
|
|
163
|
+
## REFACTOR Phase: Close Loopholes (Stay Green)
|
|
164
|
+
|
|
165
|
+
Agent violated rule despite having the skill? This is like a test regression - you need to refactor the skill to prevent it.
|
|
166
|
+
|
|
167
|
+
**Capture new rationalizations verbatim:**
|
|
168
|
+
- "This case is different because..."
|
|
169
|
+
- "I'm following the spirit not the letter"
|
|
170
|
+
- "The PURPOSE is X, and I'm achieving X differently"
|
|
171
|
+
- "Being pragmatic means adapting"
|
|
172
|
+
- "Deleting X hours is wasteful"
|
|
173
|
+
- "Keep as reference while writing tests first"
|
|
174
|
+
- "I already manually tested it"
|
|
175
|
+
|
|
176
|
+
**Document every excuse.** These become your rationalization table.
|
|
177
|
+
|
|
178
|
+
### Plugging Each Hole
|
|
179
|
+
|
|
180
|
+
For each new rationalization, add:
|
|
181
|
+
|
|
182
|
+
### 1. Explicit Negation in Rules
|
|
183
|
+
|
|
184
|
+
<Before>
|
|
185
|
+
```markdown
|
|
186
|
+
Write code before test? Delete it.
|
|
187
|
+
```
|
|
188
|
+
</Before>
|
|
189
|
+
|
|
190
|
+
<After>
|
|
191
|
+
```markdown
|
|
192
|
+
Write code before test? Delete it. Start over.
|
|
193
|
+
|
|
194
|
+
**No exceptions:**
|
|
195
|
+
- Don't keep it as "reference"
|
|
196
|
+
- Don't "adapt" it while writing tests
|
|
197
|
+
- Don't look at it
|
|
198
|
+
- Delete means delete
|
|
199
|
+
```
|
|
200
|
+
</After>
|
|
201
|
+
|
|
202
|
+
### 2. Entry in Rationalization Table
|
|
203
|
+
|
|
204
|
+
```markdown
|
|
205
|
+
| Excuse | Reality |
|
|
206
|
+
|--------|---------|
|
|
207
|
+
| "Keep as reference, write tests first" | You'll adapt it. That's testing after. Delete means delete. |
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### 3. Red Flag Entry
|
|
211
|
+
|
|
212
|
+
```markdown
|
|
213
|
+
## Red Flags - STOP
|
|
214
|
+
|
|
215
|
+
- "Keep as reference" or "adapt existing code"
|
|
216
|
+
- "I'm following the spirit not the letter"
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### 4. Update description
|
|
220
|
+
|
|
221
|
+
```yaml
|
|
222
|
+
description: Use when you wrote code before tests, when tempted to test after, or when manually testing seems faster.
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Add symptoms of ABOUT to violate.
|
|
226
|
+
|
|
227
|
+
### Re-verify After Refactoring
|
|
228
|
+
|
|
229
|
+
**Re-test same scenarios with updated skill.**
|
|
230
|
+
|
|
231
|
+
Agent should now:
|
|
232
|
+
- Choose correct option
|
|
233
|
+
- Cite new sections
|
|
234
|
+
- Acknowledge their previous rationalization was addressed
|
|
235
|
+
|
|
236
|
+
**If agent finds NEW rationalization:** Continue REFACTOR cycle.
|
|
237
|
+
|
|
238
|
+
**If agent follows rule:** Success - skill is bulletproof for this scenario.
|
|
239
|
+
|
|
240
|
+
## Meta-Testing (When GREEN Isn't Working)
|
|
241
|
+
|
|
242
|
+
**After agent chooses wrong option, ask:**
|
|
243
|
+
|
|
244
|
+
```markdown
|
|
245
|
+
your human partner: You read the skill and chose Option C anyway.
|
|
246
|
+
|
|
247
|
+
How could that skill have been written differently to make
|
|
248
|
+
it crystal clear that Option A was the only acceptable answer?
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
**Three possible responses:**
|
|
252
|
+
|
|
253
|
+
1. **"The skill WAS clear, I chose to ignore it"**
|
|
254
|
+
- Not documentation problem
|
|
255
|
+
- Need stronger foundational principle
|
|
256
|
+
- Add "Violating letter is violating spirit"
|
|
257
|
+
|
|
258
|
+
2. **"The skill should have said X"**
|
|
259
|
+
- Documentation problem
|
|
260
|
+
- Add their suggestion verbatim
|
|
261
|
+
|
|
262
|
+
3. **"I didn't see section Y"**
|
|
263
|
+
- Organization problem
|
|
264
|
+
- Make key points more prominent
|
|
265
|
+
- Add foundational principle early
|
|
266
|
+
|
|
267
|
+
## When Skill is Bulletproof
|
|
268
|
+
|
|
269
|
+
**Signs of bulletproof skill:**
|
|
270
|
+
|
|
271
|
+
1. **Agent chooses correct option** under maximum pressure
|
|
272
|
+
2. **Agent cites skill sections** as justification
|
|
273
|
+
3. **Agent acknowledges temptation** but follows rule anyway
|
|
274
|
+
4. **Meta-testing reveals** "skill was clear, I should follow it"
|
|
275
|
+
|
|
276
|
+
**Not bulletproof if:**
|
|
277
|
+
- Agent finds new rationalizations
|
|
278
|
+
- Agent argues skill is wrong
|
|
279
|
+
- Agent creates "hybrid approaches"
|
|
280
|
+
- Agent asks permission but argues strongly for violation
|
|
281
|
+
|
|
282
|
+
## Example: TDD Skill Bulletproofing
|
|
283
|
+
|
|
284
|
+
### Initial Test (Failed)
|
|
285
|
+
```markdown
|
|
286
|
+
Scenario: 200 lines done, forgot TDD, exhausted, dinner plans
|
|
287
|
+
Agent chose: C (write tests after)
|
|
288
|
+
Rationalization: "Tests after achieve same goals"
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### Iteration 1 - Add Counter
|
|
292
|
+
```markdown
|
|
293
|
+
Added section: "Why Order Matters"
|
|
294
|
+
Re-tested: Agent STILL chose C
|
|
295
|
+
New rationalization: "Spirit not letter"
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### Iteration 2 - Add Foundational Principle
|
|
299
|
+
```markdown
|
|
300
|
+
Added: "Violating letter is violating spirit"
|
|
301
|
+
Re-tested: Agent chose A (delete it)
|
|
302
|
+
Cited: New principle directly
|
|
303
|
+
Meta-test: "Skill was clear, I should follow it"
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
**Bulletproof achieved.**
|
|
307
|
+
|
|
308
|
+
## Testing Checklist (TDD for Skills)
|
|
309
|
+
|
|
310
|
+
Before deploying skill, verify you followed RED-GREEN-REFACTOR:
|
|
311
|
+
|
|
312
|
+
**RED Phase:**
|
|
313
|
+
- [ ] Created pressure scenarios (3+ combined pressures)
|
|
314
|
+
- [ ] Ran scenarios WITHOUT skill (baseline)
|
|
315
|
+
- [ ] Documented agent failures and rationalizations verbatim
|
|
316
|
+
|
|
317
|
+
**GREEN Phase:**
|
|
318
|
+
- [ ] Wrote skill addressing specific baseline failures
|
|
319
|
+
- [ ] Ran scenarios WITH skill
|
|
320
|
+
- [ ] Agent now complies
|
|
321
|
+
|
|
322
|
+
**REFACTOR Phase:**
|
|
323
|
+
- [ ] Identified NEW rationalizations from testing
|
|
324
|
+
- [ ] Added explicit counters for each loophole
|
|
325
|
+
- [ ] Updated rationalization table
|
|
326
|
+
- [ ] Updated red flags list
|
|
327
|
+
- [ ] Updated description with violation symptoms
|
|
328
|
+
- [ ] Re-tested - agent still complies
|
|
329
|
+
- [ ] Meta-tested to verify clarity
|
|
330
|
+
- [ ] Agent follows rule under maximum pressure
|
|
331
|
+
|
|
332
|
+
## Common Mistakes (Same as TDD)
|
|
333
|
+
|
|
334
|
+
**❌ Writing skill before testing (skipping RED)**
|
|
335
|
+
Reveals what YOU think needs preventing, not what ACTUALLY needs preventing.
|
|
336
|
+
✅ Fix: Always run baseline scenarios first.
|
|
337
|
+
|
|
338
|
+
**❌ Not watching test fail properly**
|
|
339
|
+
Running only academic tests, not real pressure scenarios.
|
|
340
|
+
✅ Fix: Use pressure scenarios that make agent WANT to violate.
|
|
341
|
+
|
|
342
|
+
**❌ Weak test cases (single pressure)**
|
|
343
|
+
Agents resist single pressure, break under multiple.
|
|
344
|
+
✅ Fix: Combine 3+ pressures (time + sunk cost + exhaustion).
|
|
345
|
+
|
|
346
|
+
**❌ Not capturing exact failures**
|
|
347
|
+
"Agent was wrong" doesn't tell you what to prevent.
|
|
348
|
+
✅ Fix: Document exact rationalizations verbatim.
|
|
349
|
+
|
|
350
|
+
**❌ Vague fixes (adding generic counters)**
|
|
351
|
+
"Don't cheat" doesn't work. "Don't keep as reference" does.
|
|
352
|
+
✅ Fix: Add explicit negations for each specific rationalization.
|
|
353
|
+
|
|
354
|
+
**❌ Stopping after first pass**
|
|
355
|
+
Tests pass once ≠ bulletproof.
|
|
356
|
+
✅ Fix: Continue REFACTOR cycle until no new rationalizations.
|
|
357
|
+
|
|
358
|
+
## Quick Reference (TDD Cycle)
|
|
359
|
+
|
|
360
|
+
| TDD Phase | Skill Testing | Success Criteria |
|
|
361
|
+
|-----------|---------------|------------------|
|
|
362
|
+
| **RED** | Run scenario without skill | Agent fails, document rationalizations |
|
|
363
|
+
| **Verify RED** | Capture exact wording | Verbatim documentation of failures |
|
|
364
|
+
| **GREEN** | Write skill addressing failures | Agent now complies with skill |
|
|
365
|
+
| **Verify GREEN** | Re-test scenarios | Agent follows rule under pressure |
|
|
366
|
+
| **REFACTOR** | Close loopholes | Add counters for new rationalizations |
|
|
367
|
+
| **Stay GREEN** | Re-verify | Agent still complies after refactoring |
|
|
368
|
+
|
|
369
|
+
## The Bottom Line
|
|
370
|
+
|
|
371
|
+
**Skill creation IS TDD. Same principles, same cycle, same benefits.**
|
|
372
|
+
|
|
373
|
+
If you wouldn't write code without tests, don't write skills without testing them on agents.
|
|
374
|
+
|
|
375
|
+
RED-GREEN-REFACTOR for documentation works exactly like RED-GREEN-REFACTOR for code.
|
|
376
|
+
|
|
377
|
+
## Real-World Impact
|
|
378
|
+
|
|
379
|
+
From applying TDD to TDD skill itself (2025-10-03):
|
|
380
|
+
- 6 RED-GREEN-REFACTOR iterations to bulletproof
|
|
381
|
+
- Baseline testing revealed 10+ unique rationalizations
|
|
382
|
+
- Each REFACTOR closed specific loopholes
|
|
383
|
+
- Final VERIFY GREEN: 100% compliance under maximum pressure
|
|
384
|
+
- Same process works for any discipline-enforcing skill
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,226624,e=>{"use strict";var t,a=e.i(344180);e.s([],916562),e.i(916562),e.i(8890);var s=e.i(764556),i=e.i(535270),n=e.i(29905),l=e.i(204133),r=e.i(277642),d=e.i(236706),o=e.i(863728),c=e.i(969490),u=e.i(370383),m=e.i(139236),p=e.i(931709),h=e.i(267805);let g=s.createContext(void 0);var x=e.i(438904);let f=((t={}).checked="data-checked",t.unchecked="data-unchecked",t.disabled="data-disabled",t.readonly="data-readonly",t.required="data-required",t.valid="data-valid",t.invalid="data-invalid",t.touched="data-touched",t.dirty="data-dirty",t.filled="data-filled",t.focused="data-focused",t),v={...x.fieldValidityMapping,checked:e=>e?{[f.checked]:""}:{[f.unchecked]:""}};var b=e.i(125231),y=e.i(975698),j=e.i(380414),k=e.i(443124),N=e.i(575665),w=e.i(602453),C=e.i(742665),S=e.i(638144);let z=s.forwardRef(function(e,t){let{checked:h,className:x,defaultChecked:f,"aria-labelledby":z,form:T,id:P,inputRef:A,name:I,nativeButton:M=!1,onCheckedChange:O,readOnly:D=!1,required:E=!1,disabled:B=!1,render:R,uncheckedValue:K,value:L,style:U,...F}=e,{clearErrors:_}=(0,j.useFormContext)(),{state:$,setTouched:q,setDirty:G,validityData:V,setFilled:W,setFocused:H,shouldValidateOnChange:J,validationMode:Q,disabled:X,name:Z,validation:Y}=(0,b.useFieldRootContext)(),{labelId:ee}=(0,k.useLabelableContext)(),et=X||B,ea=Z??I,es=(0,n.useStableCallback)(O),ei=s.useRef(null),en=(0,l.useMergedRefs)(ei,A,Y.inputRef),el=s.useRef(null),er=(0,m.useBaseUiId)(),ed=(0,N.useLabelableId)({id:P,implicit:!1,controlRef:el}),eo=M?void 0:ed,[ec,eu]=(0,i.useControlled)({controlled:h,default:!!f,name:"Switch",state:"checked"});(0,y.useRegisterFieldControl)(el,{id:er,value:ec}),(0,r.useIsoLayoutEffect)(()=>{ei.current&&W(ei.current.checked)},[ei,W]),(0,S.useValueChanged)(ec,()=>{_(ea),G(ec!==V.initialValue),W(ec),J()?Y.commit(ec):Y.commit(ec,!0)});let{getButtonProps:em,buttonRef:ep}=(0,p.useButton)({disabled:et,native:M}),eh=function(e,t,a,i=!0,n){let[l,d]=s.useState(),o=(0,m.useBaseUiId)(n?`${n}-label`:void 0),c=e??t??l;return(0,r.useIsoLayoutEffect)(()=>{let s=e||t||!i?void 0:function(e,t){let a=function(e){if(!e)return;let t=e.parentElement;if(t&&"LABEL"===t.tagName)return t;let a=e.id;if(a){let t=e.nextElementSibling;if(t&&t.htmlFor===a)return t}let s=e.labels;return s&&s[0]}(e);if(a)return!a.id&&t&&(a.id=t),a.id||void 0}(a.current,o);l!==s&&d(s)}),c}(z,ee,ei,!M,eo),eg=s.useMemo(()=>(0,u.mergeProps)({checked:ec,disabled:et,form:T,id:eo,name:ea,required:E,style:ea?d.visuallyHiddenInput:d.visuallyHidden,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:en,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(D)return void e.preventDefault();let t=e.currentTarget.checked,a=(0,w.createChangeEventDetails)(C.REASONS.none,e.nativeEvent);es?.(t,a),a.isCanceled||eu(t)},onFocus(){el.current?.focus()}},Y.getInputValidationProps,void 0!==L?{value:L}:o.EMPTY_OBJECT),[ec,et,T,en,eo,ea,es,D,E,eu,Y,L]),ex=s.useMemo(()=>({...$,checked:ec,disabled:et,readOnly:D,required:E}),[$,ec,et,D,E]),ef=(0,c.useRenderElement)("span",e,{state:ex,ref:[t,el,ep],props:[{id:M?ed:er,role:"switch","aria-checked":ec,"aria-readonly":D||void 0,"aria-required":E||void 0,"aria-labelledby":eh,onFocus(){et||H(!0)},onBlur(){let e=ei.current;e&&!et&&(q(!0),H(!1),"onBlur"===Q&&Y.commit(e.checked))},onClick(e){D||et||(e.preventDefault(),ei.current?.dispatchEvent(new PointerEvent("click",{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey})))}},Y.getValidationProps,F,em],stateAttributesMapping:v});return(0,a.jsxs)(g.Provider,{value:ex,children:[ef,!ec&&ea&&void 0!==K&&(0,a.jsx)("input",{type:"hidden",form:T,name:ea,value:K}),(0,a.jsx)("input",{...eg,suppressHydrationWarning:!0})]})}),T=s.forwardRef(function(e,t){let{render:a,className:i,style:n,...l}=e,{state:r}=(0,b.useFieldRootContext)(),d=function(){let e=s.useContext(g);if(void 0===e)throw Error((0,h.default)(63));return e}(),o={...r,...d};return(0,c.useRenderElement)("span",e,{state:o,ref:t,stateAttributesMapping:v,props:l})});e.s(["Root",0,z,"Thumb",0,T],695728);var P=e.i(695728),P=P,A=e.i(465458);e.s(["Switch",0,function({className:e,size:t="default",...s}){return(0,a.jsx)(P.Root,{"data-slot":"switch","data-size":t,className:(0,A.cn)("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",e),...s,children:(0,a.jsx)(P.Thumb,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}],226624)},357301,e=>{"use strict";let t=(0,e.i(433721).default)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);e.s(["RotateCcw",0,t],357301)},788010,e=>{"use strict";var t=e.i(344180),a=e.i(465458);e.s(["Textarea",0,function({className:e,...s}){return(0,t.jsx)("textarea",{"data-slot":"textarea",className:(0,a.cn)("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...s})}])},355819,e=>{"use strict";let t=(0,e.i(816709).create)((e,t)=>({agents:[],loaded:!1,loading:!1,ensure:async()=>{let{loaded:a,loading:s}=t();if(!a&&!s){e({loading:!0});try{let t=await fetch("/api/agents/presets");if(!t.ok)return;let a=await t.json();e({agents:a,loaded:!0})}catch{}finally{e({loading:!1})}}},toggleEnabled:async a=>{let s=t().agents.find(e=>e.id===a);if(!s)return;let i=!s.enabled;e(e=>({agents:e.agents.map(e=>e.id===a?{...e,enabled:i}:e)}));try{(await fetch(`/api/agents/presets/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,enabled:i})})).ok||e(e=>({agents:e.agents.map(e=>e.id===a?{...e,enabled:s.enabled}:e)}))}catch{e(e=>({agents:e.agents.map(e=>e.id===a?{...e,enabled:s.enabled}:e)}))}}}));e.s(["findAgentById",0,function(e){return t.getState().agents.find(t=>t.id===e)},"useAgentStore",0,t])},942917,e=>{"use strict";let t=(0,e.i(433721).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["default",0,t])},972846,e=>{"use strict";var t=e.i(912248);e.s(["X",()=>t.default])},523592,e=>{"use strict";var t=e.i(8890);let a="agent-spaces-servers",s="agent-spaces-active-server",i="active-server";function n(){let e=t.default.env.NEXT_PUBLIC_SERVER_URL?.trim();if(e)return e.replace(/\/$/,"");let{hostname:a,port:s}=window.location;return("localhost"===a||"127.0.0.1"===a)&&"3000"===s?`http://${a}:3100`:window.location.origin}let l=[{id:"default",name:"Default",url:n()}];function r(){try{let e=localStorage.getItem(a);return e?JSON.parse(e).map(e=>"default"!==e.id||e.url?e:{...e,url:n()}):l}catch{return l}}function d(){return localStorage.getItem(s)||"default"}function o(){let e=r(),t=d();return e.find(e=>e.id===t)||e[0]||null}function c(){return o()?.url??null}e.s(["getActiveServer",0,o,"getActiveServerUrl",0,c,"loadActiveId",0,d,"loadServers",0,r,"resolveServerAssetUrl",0,function(e){if(!e)return"";if(/^(?:[a-z][a-z\d+\-.]*:)?\/\//i.test(e)||e.startsWith("data:")||e.startsWith("blob:"))return e;let t=c();return t?`${t.replace(/\/$/,"")}${e.startsWith("/")?"":"/"}${e}`:e},"saveActiveId",0,function(e){localStorage.setItem(s,e)},"saveServers",0,function(e){localStorage.setItem(a,JSON.stringify(e))},"setActiveServerCookie",0,function(e){e?document.cookie=`${i}=${encodeURIComponent(e)}; path=/; max-age=31536000; SameSite=Lax`:document.cookie=`${i}=; path=/; max-age=0`}])},50153,e=>{"use strict";let t=(0,e.i(433721).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["default",0,t])},344118,e=>{"use strict";var t=e.i(50153);e.s(["Check",()=>t.default])},558680,e=>{"use strict";let t=(0,e.i(433721).default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);e.s(["default",0,t])},188815,650654,e=>{"use strict";var t=e.i(344180),a=e.i(764556),s=e.i(465458),i=e.i(681622),n=e.i(344118),l=e.i(558680);e.s(["ChevronDown",()=>l.default],650654);var l=l,r=e.i(953700);e.s(["SearchSelect",0,function({value:e,onChange:d,options:o,placeholder:c="Select...",searchPlaceholder:u="Search...",allowCustom:m=!0,className:p}){let h=(0,a.useRef)(null),[g,x]=(0,a.useState)(!1),[f,v]=(0,a.useState)("");(0,a.useEffect)(()=>{let e=e=>{h.current&&!h.current.contains(e.target)&&x(!1)};return g&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[g]);let b=o.filter(e=>(e.label??e.value).toLowerCase().includes(f.toLowerCase())),y=o.some(e=>e.value.toLowerCase()===f.toLowerCase()),j=o.find(t=>t.value===e),k=e&&!o.some(t=>t.value===e),N=e=>{d(e),x(!1),v("")};return(0,t.jsxs)("div",{ref:h,className:(0,s.cn)("relative",p),children:[(0,t.jsxs)("button",{type:"button",onClick:()=>{x(!0),v("")},className:(0,s.cn)("flex h-8 w-full items-center justify-between gap-2 rounded-lg border border-input bg-transparent px-2.5 text-sm outline-none hover:bg-muted/50 focus-visible:border-ring dark:bg-input/30"),children:[(0,t.jsx)("span",{className:(0,s.cn)("truncate",!e&&"text-muted-foreground"),children:j?j.label??j.value:k?e:c}),(0,t.jsx)(l.default,{className:"size-3.5 shrink-0 opacity-50"})]}),g&&(0,t.jsxs)("div",{className:"absolute inset-x-0 top-full z-50 mt-1 rounded-lg border bg-popover p-1 shadow-md",children:[(0,t.jsx)(i.Input,{value:f,onChange:e=>v(e.target.value),placeholder:u,className:"h-7 text-xs",onKeyDown:e=>{"Enter"===e.key&&m&&f.trim()&&(e.preventDefault(),N(f.trim())),"Escape"===e.key&&x(!1)},autoFocus:!0}),(0,t.jsxs)("div",{className:"mt-1 max-h-48 overflow-y-auto",children:[b.map(a=>(0,t.jsxs)("button",{type:"button",className:(0,s.cn)("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-xs hover:bg-muted/50",e===a.value&&"bg-muted"),onClick:()=>N(a.value),children:[(0,t.jsx)(n.Check,{className:(0,s.cn)("size-3 shrink-0",e===a.value?"opacity-100":"opacity-0")}),(0,t.jsx)("span",{className:"truncate",children:a.label??a.value})]},a.value)),m&&f.trim()&&!y&&(0,t.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-xs text-primary hover:bg-muted/50",onClick:()=>N(f.trim()),children:[(0,t.jsx)(r.Plus,{className:"size-3 shrink-0"}),(0,t.jsxs)("span",{className:"truncate",children:['Use "',f.trim(),'"']})]}),!b.length&&!f.trim()&&(0,t.jsx)("div",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:"No results"})]})]})]})}],188815)},451534,680422,e=>{"use strict";let t=(0,e.i(433721).default)("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);e.s(["default",0,t],680422),e.s(["FolderOpen",0,t],451534)},673478,e=>{"use strict";let t=(0,e.i(433721).default)("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]);e.s(["Cpu",0,t],673478)},426022,e=>{"use strict";let t=(0,e.i(433721).default)("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]);e.s(["MessageSquare",0,t],426022)},325443,946899,e=>{"use strict";let t=(0,e.i(433721).default)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);e.s(["default",0,t],946899),e.s(["Bot",0,t],325443)},415360,e=>{"use strict";let t=(0,e.i(433721).default)("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]);e.s(["Sparkles",0,t],415360)},511588,e=>{"use strict";let t=(0,e.i(433721).default)("wand-sparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);e.s(["WandSparkles",0,t],511588)},444433,e=>{"use strict";e.s(["BUILT_IN_AGENT_TOOLS",0,[{name:"CreateCurrentChannelIssue",label:"Create Current Issue",description:"Create and bind an issue for the current channel."},{name:"ViewCurrentChannelIssue",label:"View Current Issue",description:"View the issue and comments bound to the current channel."},{name:"AddCurrentChannelComment",label:"Add Current Comment",description:"Add a comment to the issue bound to the current channel."},{name:"ReadTerminalOutput",label:"Read Terminal Output",description:"Read paginated terminal output by session ID. Defaults to the newest 100 lines."},{name:"ListQuickCommands",label:"List Quick Commands",description:"List all quick commands for a workspace with their running status."},{name:"RunQuickCommand",label:"Run Quick Command",description:"Start a quick command by its ID. Returns the terminal session ID."},{name:"StopQuickCommand",label:"Stop Quick Command",description:"Stop a running quick command by its ID."}]])},282180,e=>{"use strict";var t=e.i(344180),a=e.i(444433);let s=(a.BUILT_IN_AGENT_TOOLS??[]).map(e=>e.name),i=new Set(["openai-responses-to-anthropic-messages","openai-chat-completions-to-anthropic-messages"]);function n(e){return{mcpServers:Object.fromEntries(e.map(e=>[e,{}]))}}function l(e){return e.map(e=>({name:`${e}.md`,content:`# ${e}
|
|
2
|
-
`}))}let r={agent:{name:"Agent",role:"agent",description:"通用 Agent,可在 workflow 中承担任意执行节点",avatarUrl:"",runtimeKind:"claude-code",modelProvider:"anthropic-messages",modelId:"claude-sonnet-4-6",apiBase:"",apiKey:"",workingDir:"",mcps:n([]),skills:l(["coding","debugging","testing"]),tools:s,systemPrompt:"你是通用 Agent。根据 issue 和当前任务上下文完成被分配的工作,遵循项目规范,必要时修改代码、运行验证,并清晰汇报结果。",temperature:.3,maxTokens:8192,enabled:!0},scheduler:{name:"Scheduler",role:"scheduler",description:"任务调度者,负责任务分发和协调",avatarUrl:"",runtimeKind:"claude-code",modelProvider:"anthropic-messages",modelId:"claude-sonnet-4-6",apiBase:"",apiKey:"",workingDir:"",mcps:n([]),skills:l(["planning","task-split"]),tools:s,systemPrompt:"你是调度者 Agent。负责接收用户任务,分析任务类型,分发给合适的执行者。你需要跟踪任务状态,确保所有子任务按时完成。",temperature:.3,maxTokens:4096,enabled:!0},task_creator:{name:"Task Creator",role:"task_creator",description:"任务创建者,负责把 issue 拆成可执行任务",avatarUrl:"",runtimeKind:"claude-code",modelProvider:"anthropic-messages",modelId:"claude-sonnet-4-6",apiBase:"",apiKey:"",workingDir:"",mcps:n([]),skills:l(["planning","task-split"]),tools:s,systemPrompt:"你是任务创建者 Agent。负责读取 issue 上下文,把需求拆分为少量可执行任务,并用系统工具写入任务列表。只创建真正需要独立执行的任务,避免把细碎步骤拆成任务。",temperature:.3,maxTokens:4096,enabled:!0},bot:{name:"Bot Agent",role:"bot",description:"消息机器人,负责处理外部聊天平台中的用户消息",avatarUrl:"",runtimeKind:"claude-code",modelProvider:"anthropic-messages",modelId:"claude-sonnet-4-6",apiBase:"",apiKey:"",workingDir:"",mcps:{},skills:[],tools:s,systemPrompt:"你是 Agent Spaces 的消息机器人。你会简洁回答来自外部聊天平台的用户消息。不要执行危险操作;需要用户提供更多信息时直接询问。",temperature:.3,maxTokens:4096,enabled:!0}};e.s(["FieldGroup",0,function({label:e,children:a}){return(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",children:e}),a]})},"PROVIDER_OPTIONS",0,[{value:"anthropic-messages",labelKey:"anthropicMessages"},{value:"openai-chat-completions",labelKey:"openaiChatCompletions"},{value:"openai-responses",labelKey:"openaiResponses"},{value:"openai-responses-to-anthropic-messages",labelKey:"openaiResponsesToAnthropic"},{value:"openai-chat-completions-to-anthropic-messages",labelKey:"openaiChatToAnthropic"},{value:"gemini-generate-content",labelKey:"geminiGenerateContent"}],"ROLE_COLORS",0,{agent:"bg-gray-500/10 text-gray-600 border-gray-200",scheduler:"bg-blue-500/10 text-blue-600 border-blue-200",task_creator:"bg-green-500/10 text-green-600 border-green-200",bot:"bg-cyan-500/10 text-cyan-600 border-cyan-200"},"ROLE_OPTIONS",0,["agent","scheduler","task_creator","bot"],"RUNTIME_OPTIONS",0,[{value:"claude-code",labelKey:"claudeCode"},{value:"open-agent-sdk",labelKey:"openAgentSdk"},{value:"codex",labelKey:"codex"},{value:"langchain",labelKey:"langchain"}],"Section",0,function({icon:e,title:a,children:s}){return(0,t.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground uppercase tracking-wider",children:[e,a]}),s]})},"isAnthropicBridgeProvider",0,function(e){return!!(e&&i.has(e))},"isDraftAgent",0,function(e){return e.id.startsWith("draft-")},"newAgentDraft",0,function(e){return{id:`draft-${e}-${Date.now()}`,...r[e],mcps:structuredClone(r[e].mcps),skills:r[e].skills.map(e=>({...e})),tools:[...r[e].tools]}},"newEmptyAgent",0,function(){return{id:`draft-empty-${Date.now()}`,name:"",role:"agent",description:"",avatarUrl:"",runtimeKind:"claude-code",modelProvider:"",modelId:"",apiBase:"",apiKey:"",workingDir:"",mcps:{},skills:[],tools:s,systemPrompt:"",temperature:.3,maxTokens:4096,enabled:!0}},"normalizeAgent",0,function(e){var t,i;return{...e,name:e.name||"New Agent",description:e.description||"",avatarUrl:e.avatarUrl||"",runtimeKind:e.runtimeKind||"open-agent-sdk",modelProvider:e.modelProvider||"",modelId:e.modelId||"claude-sonnet-4-6",apiBase:e.apiBase||"",apiKey:e.apiKey||"",workingDir:e.workingDir||"",mcps:(t=e.mcps)||{},skills:Array.isArray(i=e.skills)?i.map(e=>"string"==typeof e?{name:e.endsWith(".md")?e:`${e}.md`}:e):[],tools:function(e){if(!Array.isArray(e))return s;let t=new Set((a.BUILT_IN_AGENT_TOOLS??[]).map(e=>e.name));return e.filter(e=>t.has(e))}(e.tools),systemPrompt:e.systemPrompt||"",temperature:e.temperature??.3,maxTokens:e.maxTokens??4096,enabled:e.enabled??!0}},"serializeAgent",0,function(e){let{id:t,...a}=e;return{...a,modelProvider:a.modelProvider||void 0}}])},159619,839374,e=>{"use strict";let t=(0,e.i(433721).default)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);e.s(["default",0,t],839374),e.s(["Copy",0,t],159619)},330044,92929,e=>{"use strict";var t=e.i(344180),a=e.i(244073),s=e.i(611176),i=e.i(260218),n=e.i(562918),l=e.i(226624),r=e.i(325443),d=e.i(159619),o=e.i(137340),c=e.i(465458);e.s(["AgentList",0,function({agents:e,onSelect:u,onDelete:m,onToggleEnabled:p}){let h=(0,a.useTranslations)("agent");return(0,t.jsxs)("div",{className:"flex flex-col p-2",children:[e.map(e=>{let a="agent-generator"===e.id;return(0,t.jsxs)("div",{className:(0,c.cn)("group flex items-center gap-3 rounded-lg px-3 py-2.5 hover:bg-muted/50 cursor-pointer transition-colors",!e.enabled&&!a&&"opacity-50"),onClick:()=>u(e),children:[(0,t.jsx)(s.AgentIcon,{name:e.name,avatarUrl:e.avatarUrl,apiBase:e.apiBase,className:"size-8"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium",children:e.name}),(0,t.jsx)(n.Badge,{variant:"outline",className:"text-[10px] h-4 px-1.5",children:a?"system":e.role})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:e.description||h("list.noDescription")})]}),(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground font-mono",children:e.modelId.split("-").slice(0,2).join("-")}),(0,t.jsx)("div",{onClick:e=>e.stopPropagation(),children:(0,t.jsx)(l.Switch,{size:"sm",checked:a||e.enabled,disabled:a,onCheckedChange:()=>p?.(e.id)})}),(0,t.jsx)(i.Button,{variant:"ghost",size:"icon-xs",className:"opacity-0 group-hover:opacity-100 transition-opacity",onClick:t=>{t.stopPropagation(),navigator.clipboard.writeText(e.id)},children:(0,t.jsx)(d.Copy,{className:"size-3"})}),!a&&(0,t.jsx)(i.Button,{variant:"ghost",size:"icon-xs",className:"opacity-0 group-hover:opacity-100 transition-opacity",onClick:t=>{t.stopPropagation(),m(e.id)},children:(0,t.jsx)(o.Trash2,{className:"size-3 text-destructive"})})]},e.id)}),0===e.length&&(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[(0,t.jsx)(r.Bot,{className:"size-10 mb-2 opacity-30"}),(0,t.jsx)("p",{className:"text-sm",children:h("list.empty")})]})]})}],330044);let u=(0,e.i(433721).default)("plug-zap",[["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m18 3-4 4h6l-4 4",key:"16psg9"}]]);e.s(["PlugZap",0,u],92929)},212068,e=>{"use strict";let t=(0,e.i(433721).default)("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]);e.s(["default",0,t])},119211,e=>{"use strict";var t=e.i(212068);e.s(["Wrench",()=>t.default])},588591,e=>{"use strict";var t=e.i(344180),a=e.i(764556),s=e.i(244073),i=e.i(355819),n=e.i(209988),l=e.i(260218),r=e.i(788010),d=e.i(917955),o=e.i(465458),c=e.i(767467),u=e.i(325443),m=e.i(650654),p=e.i(953700),h=e.i(357301),g=e.i(511588),x=e.i(282180),f=e.i(330044),v=e.i(368942),b=e.i(444433),y=e.i(611176),j=e.i(681622),k=e.i(188815),N=e.i(972846),w=e.i(673478),C=e.i(92929),S=e.i(451534),z=e.i(119211),T=e.i(415360),P=e.i(426022);let A=(0,e.i(433721).default)("sliders-vertical",[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]]);var I=e.i(129981);function M({agent:e,roleOptions:i,testing:n,testResult:d,onChange:c,onMcpChange:u,onAddSkillFiles:m,onRemoveSkill:p,onTestConnection:h}){let g=(0,s.useTranslations)("agent"),[f,O]=(0,a.useState)(()=>JSON.stringify(e.mcps,null,2)),[D,E]=(0,a.useState)(null),[B,R]=(0,a.useState)([]),{models:K,providers:L,ensure:U}=(0,v.useLLMStore)(),F=K.filter(e=>!e.embedding);(0,a.useEffect)(()=>{U()},[U]);let _=(0,a.useCallback)(e=>{c("apiBase",e.apiBase),c("apiKey",e.apiKey);let t=F.filter(t=>t.provider===e.name).map(e=>({value:e.modelId,label:e.name}));R(t),t.length>0&&c("modelId",t[0].value)},[F,c]),$=async e=>{if(!e?.length)return;let t=Array.from(e).filter(e=>e.name.toLowerCase().endsWith(".md"));m(await Promise.all(t.map(async e=>({name:e.name,content:await e.text()}))))};return(0,t.jsxs)("div",{className:"flex flex-col gap-5 p-5",children:[(0,t.jsxs)(x.Section,{icon:(0,t.jsx)(P.MessageSquare,{className:"size-3.5"}),title:g("detail.basic"),children:[(0,t.jsxs)("div",{className:"flex items-start gap-4",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center gap-1.5",children:[(0,t.jsx)(y.AgentIcon,{name:e.name,avatarUrl:e.avatarUrl,apiBase:e.apiBase,className:"size-16 rounded-xl border border-input"}),(0,t.jsxs)("label",{className:"text-[10px] text-primary cursor-pointer hover:underline",children:[g("detail.uploadAvatar"),(0,t.jsx)("input",{type:"file",accept:"image/*",className:"hidden",onChange:async e=>{let t=e.target.files?.[0];if(!t)return;let a=new FileReader;a.onload=async()=>{try{let e=await fetch("/api/upload/avatar",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dataUrl:a.result,filename:t.name})}),s=await e.json();s.url&&c("avatarUrl",s.url)}catch{}},a.readAsDataURL(t),e.target.value=""}})]}),e.avatarUrl&&(0,t.jsx)("button",{type:"button",className:"text-[10px] text-destructive hover:underline",onClick:()=>c("avatarUrl",""),children:g("detail.removeAvatar")})]}),(0,t.jsxs)("div",{className:"flex-1 flex flex-col gap-2.5",children:[(0,t.jsx)(x.FieldGroup,{label:g("detail.name"),children:(0,t.jsx)(j.Input,{value:e.name,onChange:e=>c("name",e.target.value)})}),(0,t.jsx)(x.FieldGroup,{label:g("detail.role"),children:(0,t.jsx)("select",{value:e.role,onChange:e=>c("role",e.target.value),className:"h-8 w-full rounded-lg border border-input bg-transparent px-2.5 text-sm outline-none focus-visible:border-ring dark:bg-input/30",children:i.map(e=>(0,t.jsx)("option",{value:e,children:e},e))})})]})]}),(0,t.jsx)(x.FieldGroup,{label:g("detail.description"),children:(0,t.jsx)(j.Input,{value:e.description,onChange:e=>c("description",e.target.value)})}),(0,t.jsx)(x.FieldGroup,{label:g("detail.agentRuntime"),children:(0,t.jsx)(k.SearchSelect,{value:e.runtimeKind??"",onChange:e=>c("runtimeKind",e),options:x.RUNTIME_OPTIONS.map(e=>({value:e.value,label:g(`runtime.${e.labelKey}`)})),placeholder:g("detail.runtimePlaceholder"),searchPlaceholder:g("detail.runtimeSearchPlaceholder"),allowCustom:!1})})]}),(0,t.jsx)(x.Section,{icon:(0,t.jsx)(S.FolderOpen,{className:"size-3.5"}),title:g("detail.workingDirectory"),children:(0,t.jsx)(j.Input,{value:e.workingDir,onChange:e=>c("workingDir",e.target.value),placeholder:g("detail.workingDirPlaceholder")})}),(0,t.jsx)(x.Section,{icon:(0,t.jsx)(T.Sparkles,{className:"size-3.5"}),title:g("detail.systemPrompt"),children:(0,t.jsx)(r.Textarea,{value:e.systemPrompt,onChange:e=>c("systemPrompt",e.target.value),placeholder:g("detail.systemPromptPlaceholder"),className:"min-h-24 text-xs"})}),(0,t.jsxs)(x.Section,{icon:(0,t.jsx)(z.Wrench,{className:"size-3.5"}),title:g("detail.mcpServers"),children:[(0,t.jsx)(r.Textarea,{value:f,onChange:e=>(e=>{O(e);try{let t=JSON.parse(e);if(!t||"object"!=typeof t||Array.isArray(t))throw Error("MCP config must be a JSON object");E(null),u(t)}catch(e){E(e instanceof Error?e.message:"Invalid JSON")}})(e.target.value),placeholder:'{\n "mcpServers": {}\n}',className:"min-h-28 font-mono text-xs"}),D&&(0,t.jsx)("div",{className:"text-xs text-destructive",children:D})]}),(0,t.jsx)(x.Section,{icon:(0,t.jsx)(z.Wrench,{className:"size-3.5"}),title:g("detail.tools"),children:(0,t.jsx)("div",{className:"grid gap-2",children:(b.BUILT_IN_AGENT_TOOLS??[]).map(a=>(0,t.jsxs)("label",{className:"flex cursor-pointer items-start gap-2 rounded-lg border border-input px-3 py-2 hover:bg-muted/50",children:[(0,t.jsx)("input",{type:"checkbox",checked:e.tools.includes(a.name),onChange:()=>{var t;let s;return t=a.name,void((s=new Set(e.tools)).has(t)?s.delete(t):s.add(t),c("tools",(b.BUILT_IN_AGENT_TOOLS??[]).map(e=>e.name).filter(e=>s.has(e))))},className:"mt-0.5 size-3.5"}),(0,t.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,t.jsx)("span",{className:"block text-xs font-medium",children:a.label}),(0,t.jsx)("span",{className:"block text-[11px] text-muted-foreground",children:a.description})]})]},a.name))})}),(0,t.jsxs)(x.Section,{icon:(0,t.jsx)(w.Cpu,{className:"size-3.5"}),title:g("detail.skills"),children:[(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5 mb-2",children:e.skills.map((e,a)=>(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-xs font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground",children:[e.name,(0,t.jsx)("button",{type:"button",onClick:()=>p(a),className:"hover:text-destructive",children:(0,t.jsx)(N.X,{className:"size-2.5"})})]},a))}),(0,t.jsxs)("label",{className:"flex h-8 cursor-pointer items-center justify-center gap-2 rounded-lg border border-dashed border-input text-xs text-muted-foreground hover:bg-muted/50",children:[(0,t.jsx)(I.Upload,{className:"size-3.5"}),g("detail.uploadSkills"),(0,t.jsx)("input",{type:"file",accept:".md,text/markdown",multiple:!0,className:"hidden",onChange:e=>{$(e.target.files),e.target.value=""}})]})]}),(0,t.jsxs)(x.Section,{icon:(0,t.jsx)(A,{className:"size-3.5"}),title:g("detail.model"),children:[(0,t.jsxs)("div",{className:"space-y-2.5",children:[(0,t.jsx)(x.FieldGroup,{label:g("detail.provider"),children:(0,t.jsx)(k.SearchSelect,{value:L.find(t=>t.apiBase===e.apiBase&&t.apiKey===e.apiKey)?.name||"",onChange:e=>{let t=L.find(t=>t.name===e);t&&_(t)},options:L.map(e=>({value:e.name,label:e.name})),placeholder:g("detail.providerPlaceholder"),searchPlaceholder:g("detail.providerSearchPlaceholder"),allowCustom:!1})}),(0,t.jsx)(x.FieldGroup,{label:g("detail.modelField"),children:(0,t.jsx)(k.SearchSelect,{value:e.modelId,onChange:e=>c("modelId",e),options:B.length>0?B:[{value:e.modelId||"",label:e.modelId||g("detail.selectProviderFirst")}],placeholder:g("detail.modelPlaceholder"),searchPlaceholder:g("detail.modelSearchPlaceholder")})}),(0,t.jsx)(x.FieldGroup,{label:g("detail.apiMessageType"),children:(0,t.jsx)(k.SearchSelect,{value:e.modelProvider||"",onChange:e=>c("modelProvider",e),options:x.PROVIDER_OPTIONS.map(e=>({value:e.value,label:g(`provider.${e.labelKey}`)})),placeholder:g("detail.apiMessageTypePlaceholder"),searchPlaceholder:g("detail.apiMessageTypeSearchPlaceholder"),allowCustom:!1})}),(0,t.jsx)(x.FieldGroup,{label:g("detail.apiBase"),children:(0,t.jsx)(j.Input,{value:e.apiBase,onChange:e=>c("apiBase",e.target.value),placeholder:g("detail.apiBasePlaceholder"),className:"h-7 text-xs"})}),(0,t.jsx)(x.FieldGroup,{label:g("detail.apiKey"),children:(0,t.jsx)(j.Input,{type:"password",value:e.apiKey,onChange:e=>c("apiKey",e.target.value),placeholder:g("detail.apiKeyPlaceholder"),className:"h-7 text-xs"})})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:g("detail.validateHelper")}),(0,t.jsxs)(l.Button,{type:"button",variant:"outline",size:"sm",onClick:h,disabled:n||!e.apiBase||!e.apiKey||!e.modelId,children:[(0,t.jsx)(C.PlugZap,{className:"size-3.5"}),n?g("detail.testing"):g("detail.test")]})]}),d&&(0,t.jsxs)("div",{className:(0,o.cn)("rounded-md border px-3 py-2 text-xs",d.success?"border-green-500/30 bg-green-500/10 text-green-700":"border-destructive/30 bg-destructive/10 text-destructive"),children:[d.message,d.debug&&(0,t.jsxs)("div",{className:"mt-2 space-y-1 font-mono text-[10px] opacity-80",children:[d.debug.status&&(0,t.jsxs)("div",{children:[g("debug.status")," ",d.debug.status]}),d.debug.provider&&(0,t.jsxs)("div",{children:[g("debug.provider")," ",d.debug.provider]}),d.debug.requestUrl&&(0,t.jsxs)("div",{children:[g("debug.url")," ",d.debug.requestUrl]}),d.debug.model&&(0,t.jsxs)("div",{children:[g("debug.model")," ",d.debug.model]}),d.debug.responseBody&&(0,t.jsxs)("div",{className:"max-h-20 overflow-auto whitespace-pre-wrap",children:[g("debug.body")," ",d.debug.responseBody]})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,t.jsx)(x.FieldGroup,{label:g("detail.temperature"),children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("input",{type:"range",min:0,max:2,step:.1,value:e.temperature,onChange:e=>c("temperature",parseFloat(e.target.value)),className:"flex-1"}),(0,t.jsx)("span",{className:"text-xs font-mono w-8 text-right",children:e.temperature})]})}),(0,t.jsx)(x.FieldGroup,{label:g("detail.maxTokens"),children:(0,t.jsx)(j.Input,{type:"number",value:e.maxTokens,onChange:e=>c("maxTokens",parseInt(e.target.value)||0),className:"h-7 text-xs"})})]})]})]})}let O=new Set(["agent-generator","commit-agent"]);e.s(["AgentDialog",0,function({open:e,onOpenChange:v,roleFilter:b,initialAgentId:y,standalone:j}){let k=(0,s.useTranslations)("agent"),N=(0,s.useTranslations)("common"),[w,C]=(0,a.useState)([]),[S,z]=(0,a.useState)(null),[T,P]=(0,a.useState)(null),[A,I]=(0,a.useState)(!1),[D,E]=(0,a.useState)(!1),[B,R]=(0,a.useState)(!1),[K,L]=(0,a.useState)(!1),[U,F]=(0,a.useState)(""),[_,$]=(0,a.useState)(!1),[q,G]=(0,a.useState)(null),[V,W]=(0,a.useState)(null),[H,J]=(0,a.useState)(0),Q=b?new Set(Array.isArray(b)?b:[b]):null,X=Q?w.filter(e=>O.has(e.id)||Q.has(e.role)):w,Z=Q?x.ROLE_OPTIONS.filter(e=>Q.has(e)):x.ROLE_OPTIONS;(0,a.useEffect)(()=>{if(!e)return;let t=new AbortController;return queueMicrotask(()=>{I(!0),W(null)}),fetch("/api/agents/presets",{signal:t.signal}).then(async e=>{if(!e.ok)throw Error(await e.text());return e.json()}).then(e=>{let t=e.map(x.normalizeAgent);if(C(t),y){let e=t.find(e=>e.id===y);e&&(z(e),P({...e}))}}).catch(e=>{"AbortError"!==e.name&&W(k("error.loadFailed"))}).finally(()=>I(!1)),()=>t.abort()},[e,y,k]);let Y=()=>{z(null),P(null),G(null)},ee=async()=>{if(T){E(!0),W(null);try{let e=(0,x.isDraftAgent)(T),t=(0,x.serializeAgent)(T),a=await fetch(e?"/api/agents/presets":`/api/agents/presets/${T.id}`,{method:e?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e?t:T)});if(!a.ok)throw Error(await a.text());let s=await a.json(),n=(0,x.normalizeAgent)(s);C(t=>e?[...t,n]:t.map(e=>e.id===n.id?n:e)),i.useAgentStore.setState(t=>({agents:e?[...t.agents,s]:t.agents.map(e=>e.id===s.id?s:e)})),z(null),P(null)}catch{W(k("error.saveFailed"))}finally{E(!1)}}},et=async()=>{if(T){R(!0),G(null),W(null);try{let e=await fetch("/api/agents/presets/test-connection",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)}),t=await e.json();G({success:!!t.success,message:t.message||t.error||k("error.connectionTestFailed"),debug:t.debug?{...t.debug,status:e.status}:{status:e.status}})}catch(e){G({success:!1,message:e instanceof Error?e.message:k("error.connectionTestFailed")})}finally{R(!1)}}},ea=e=>{let t="empty"===e?(0,x.newEmptyAgent)():(0,x.newAgentDraft)(e);W(null),z(t),P({...t})},es=async()=>{let e=U.trim();if(e){$(!0),W(null);try{let t=await fetch("/api/agents/presets/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:e})}),a=await t.json();if(!t.ok)throw Error(a.error||"Failed to generate agent");let s=T??(Z[0]?(0,x.newAgentDraft)(Z[0]):(0,x.newEmptyAgent)()),i={...s,name:a.name?.trim()||s.name,description:a.description?.trim()||s.description,systemPrompt:a.systemPrompt?.trim()||s.systemPrompt};z(i),P(i),L(!1),F(""),G(null)}catch(e){W(e instanceof Error?e.message:"智能创建 Agent 失败")}finally{$(!1)}}},ei=async e=>{O.has(e)||(C(t=>t.map(t=>t.id===e?{...t,enabled:!t.enabled}:t)),await i.useAgentStore.getState().toggleEnabled(e))},en=async e=>{if(!O.has(e)){if(e.startsWith("draft-")){z(null),P(null);return}E(!0),W(null);try{let t=await fetch(`/api/agents/presets/${e}`,{method:"DELETE"});if(!t.ok)throw Error(await t.text());C(t=>t.filter(t=>t.id!==e)),i.useAgentStore.setState(t=>({agents:t.agents.filter(t=>t.id!==e)})),S?.id===e&&(z(null),P(null))}catch{W(k("error.deleteFailed"))}finally{E(!1)}}},el=()=>{if(!S||!T)return;let{modelProvider:e,modelId:t,apiBase:a,apiKey:s,runtimeKind:i}=T;P({...S,modelProvider:e,modelId:t,apiBase:a,apiKey:s,runtimeKind:i}),G(null),J(e=>e+1)},er=(0,t.jsxs)(t.Fragment,{children:[!j&&(0,t.jsxs)("div",{className:"flex items-center gap-3 border-b px-5 pr-12 py-4",children:[S?(0,t.jsx)(l.Button,{variant:"ghost",size:"icon-sm",onClick:Y,children:(0,t.jsx)(c.ArrowLeft,{className:"size-4"})}):(0,t.jsx)("div",{className:"flex size-7 items-center justify-center rounded-lg bg-primary/10",children:(0,t.jsx)(u.Bot,{className:"size-4 text-primary"})}),(0,t.jsxs)(n.DialogHeader,{className:"flex-1 space-y-0",children:[(0,t.jsx)(n.DialogTitle,{className:"text-base",children:S?T?.name??"":k("dialog.title")}),(0,t.jsx)(n.DialogDescription,{className:"text-xs",children:S?k("dialog.editDescription"):k("dialog.listDescription")})]}),S&&O.has(S.id)&&(0,t.jsxs)(l.Button,{variant:"outline",size:"sm",disabled:D,onClick:el,children:[(0,t.jsx)(h.RotateCcw,{className:"size-3.5"}),N("reset")]}),S&&(0,t.jsxs)(l.Button,{variant:"outline",size:"sm",disabled:D||_,onClick:()=>L(!0),children:[(0,t.jsx)(g.WandSparkles,{className:"size-3.5"}),"智能创建"]}),!S&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)(l.Button,{variant:"outline",size:"sm",disabled:D||_,onClick:()=>L(!0),children:[(0,t.jsx)(g.WandSparkles,{className:"size-3.5"}),"智能创建"]}),(0,t.jsxs)(d.DropdownMenu,{children:[(0,t.jsx)(d.DropdownMenuTrigger,{render:(0,t.jsxs)(l.Button,{variant:"outline",size:"sm",disabled:D,children:[(0,t.jsx)(p.Plus,{className:"size-3.5"}),k("dialog.add"),(0,t.jsx)(m.ChevronDown,{className:"size-3.5"})]})}),(0,t.jsx)(d.DropdownMenuContent,{side:"bottom",align:"end",className:"w-44",children:(0,t.jsxs)(d.DropdownMenuGroup,{children:[!Q&&(0,t.jsxs)(d.DropdownMenuItem,{className:"gap-2",onClick:()=>ea("empty"),children:[(0,t.jsx)("span",{className:"size-2 rounded-full bg-muted"}),(0,t.jsx)("span",{children:k("dialog.addEmpty")})]}),x.ROLE_OPTIONS.map(e=>(0,t.jsxs)(d.DropdownMenuItem,{className:"gap-2",onClick:()=>ea(e),children:[(0,t.jsx)("span",{className:(0,o.cn)("size-2 rounded-full",x.ROLE_COLORS[e].split(" ")[0])}),(0,t.jsx)("span",{className:"capitalize",children:k(`role.${e}.name`)})]},e))]})})]})]})]}),j&&!S&&(0,t.jsxs)("div",{className:"flex items-center justify-end gap-2 px-5 py-3 border-b",children:[(0,t.jsxs)(l.Button,{variant:"outline",size:"sm",disabled:D||_,onClick:()=>L(!0),children:[(0,t.jsx)(g.WandSparkles,{className:"size-3.5"}),"智能创建"]}),(0,t.jsxs)(d.DropdownMenu,{children:[(0,t.jsx)(d.DropdownMenuTrigger,{render:(0,t.jsxs)(l.Button,{variant:"outline",size:"sm",disabled:D,children:[(0,t.jsx)(p.Plus,{className:"size-3.5"}),k("dialog.add"),(0,t.jsx)(m.ChevronDown,{className:"size-3.5"})]})}),(0,t.jsx)(d.DropdownMenuContent,{side:"bottom",align:"end",className:"w-44",children:(0,t.jsxs)(d.DropdownMenuGroup,{children:[!Q&&(0,t.jsxs)(d.DropdownMenuItem,{className:"gap-2",onClick:()=>ea("empty"),children:[(0,t.jsx)("span",{className:"size-2 rounded-full bg-muted"}),(0,t.jsx)("span",{children:k("dialog.addEmpty")})]}),x.ROLE_OPTIONS.map(e=>(0,t.jsxs)(d.DropdownMenuItem,{className:"gap-2",onClick:()=>ea(e),children:[(0,t.jsx)("span",{className:(0,o.cn)("size-2 rounded-full",x.ROLE_COLORS[e].split(" ")[0])}),(0,t.jsx)("span",{className:"capitalize",children:k(`role.${e}.name`)})]},e))]})})]})]}),j&&S&&(0,t.jsxs)("div",{className:"flex items-center gap-3 px-5 py-3 border-b",children:[(0,t.jsx)(l.Button,{variant:"ghost",size:"icon-sm",onClick:Y,children:(0,t.jsx)(c.ArrowLeft,{className:"size-4"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("h2",{className:"text-base font-medium truncate",children:T?.name??""}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:k("dialog.editDescription")})]}),O.has(S.id)&&(0,t.jsxs)(l.Button,{variant:"outline",size:"sm",disabled:D,onClick:el,children:[(0,t.jsx)(h.RotateCcw,{className:"size-3.5"}),N("reset")]}),(0,t.jsxs)(l.Button,{variant:"outline",size:"sm",disabled:D||_,onClick:()=>L(!0),children:[(0,t.jsx)(g.WandSparkles,{className:"size-3.5"}),"智能创建"]})]}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[V&&(0,t.jsx)("div",{className:"mx-5 mt-4 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:V}),A?(0,t.jsx)("div",{className:"flex flex-col p-2 space-y-1",children:Array.from({length:5},(e,a)=>(0,t.jsxs)("div",{className:"flex items-center gap-3 rounded-lg px-3 py-2.5",children:[(0,t.jsx)("div",{className:"size-8 rounded-full bg-muted animate-pulse"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 space-y-1.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"h-4 w-20 rounded bg-muted animate-pulse"}),(0,t.jsx)("div",{className:"h-4 w-10 rounded-full bg-muted animate-pulse"})]}),(0,t.jsx)("div",{className:"h-3 w-32 rounded bg-muted animate-pulse"})]}),(0,t.jsx)("div",{className:"h-3 w-12 rounded bg-muted animate-pulse"})]},a))}):S?T?(0,t.jsx)(M,{agent:T,roleOptions:Z,testing:B,testResult:q,onChange:(e,t)=>{P(a=>a?"modelProvider"===e?{...a,modelProvider:t,runtimeKind:(0,x.isAnthropicBridgeProvider)(t)?"claude-code":a.runtimeKind}:"runtimeKind"===e?{...a,runtimeKind:t}:{...a,[e]:t}:a)},onMcpChange:e=>{P(t=>t?{...t,mcps:e}:t)},onAddSkillFiles:e=>{if(!T)return;let t=new Set(T.skills.map(e=>e.name));P(a=>a?{...a,skills:[...a.skills.filter(t=>!e.some(e=>e.name===t.name)),...e.filter(e=>e.name&&!t.has(e.name)),...e.filter(e=>t.has(e.name))]}:a)},onRemoveSkill:e=>{T&&P(t=>t?{...t,skills:t.skills.filter((t,a)=>a!==e)}:t)},onTestConnection:et},`${T.id}-${H}`):null:(0,t.jsx)(f.AgentList,{agents:X,onSelect:e=>{z(e),P({...e})},onDelete:en,onToggleEnabled:ei})]}),S&&(0,t.jsxs)("div",{className:"flex justify-end gap-2 border-t px-5 py-3",children:[(0,t.jsx)(l.Button,{variant:"outline",size:"sm",onClick:Y,disabled:D,children:N("cancel")}),(0,t.jsx)(l.Button,{size:"sm",onClick:ee,disabled:D,children:N(D?"saving":"save")})]}),(0,t.jsx)(n.Dialog,{open:K,onOpenChange:L,children:(0,t.jsxs)(n.DialogContent,{className:"sm:max-w-lg",children:[(0,t.jsxs)(n.DialogHeader,{children:[(0,t.jsx)(n.DialogTitle,{children:"智能创建 Agent"}),(0,t.jsx)(n.DialogDescription,{children:"输入 Agent 的职责、使用场景和约束,系统会生成名称、描述和 Markdown 系统提示。"})]}),(0,t.jsx)(r.Textarea,{value:U,onChange:e=>F(e.target.value),placeholder:"例如:创建一个代码评审 Agent,专注发现 TypeScript/React 项目中的缺陷、回归风险和缺失测试。",className:"min-h-32 text-sm"}),(0,t.jsxs)(n.DialogFooter,{children:[(0,t.jsx)(l.Button,{variant:"outline",onClick:()=>L(!1),disabled:_,children:N("cancel")}),(0,t.jsx)(l.Button,{onClick:es,disabled:_||!U.trim(),children:_?"生成中...":"生成"})]})]})})]});return j?(0,t.jsx)("div",{className:"h-full flex flex-col",children:er}):(0,t.jsx)(n.Dialog,{open:e,onOpenChange:e=>{e||Y(),v(e)},children:(0,t.jsx)(n.DialogContent,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 gap-0",children:er})})}],588591)}]);
|