@agent-spaces/server 0.3.64 → 0.3.67
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.js +4 -0
- package/dist/adapters/claude-code-runtime/index.js +68 -2
- package/dist/adapters/claude-code-runtime/message-format.js +26 -0
- package/dist/adapters/claude-code-runtime/sdk-config.js +12 -0
- package/dist/adapters/codex-function-tool-bridge.js +144 -0
- package/dist/adapters/codex-runtime.js +23 -4
- package/dist/adapters/git.js +25 -7
- package/dist/adapters/hermes-runtime.js +210 -0
- package/dist/agents/agent-message-parts.js +1 -1
- package/dist/agents/commit-agent.js +4 -2
- package/dist/agents/issue-task-controller.js +75 -4
- package/dist/agents/pull-request-agent.js +115 -0
- package/dist/agents/scheduler-agent.js +1 -1
- package/dist/app.js +12 -70
- package/dist/middleware/auth.js +1 -1
- package/dist/package.json +2 -1
- package/dist/routes/agent-sse.js +2 -0
- package/dist/routes/agent.js +3 -0
- package/dist/routes/database.js +1 -0
- package/dist/routes/git.js +197 -317
- package/dist/routes/issue.js +1 -1
- package/dist/routes/notification.js +10 -0
- package/dist/routes/robot-account.js +68 -0
- package/dist/routes/version.js +94 -0
- package/dist/routes/worktree.js +93 -0
- package/dist/services/agent.js +37 -3
- package/dist/services/builtin-tools/kanban-tools.js +4 -0
- package/dist/services/git-operation-log.js +40 -0
- package/dist/services/global-wechat-qr.js +72 -0
- package/dist/services/hook-engine.js +175 -17
- package/dist/services/notification-center.js +9 -0
- package/dist/services/notification-hub/bot-agent.js +3 -1
- package/dist/services/notification-hub/service.js +12 -2
- package/dist/services/robot-account.js +34 -0
- package/dist/services/version.js +59 -0
- package/dist/services/workflow-command-runner.js +23 -0
- package/dist/services/workflow.js +25 -8
- package/dist/services/workspace.js +25 -1
- package/dist/services/worktree.js +207 -0
- package/dist/storage/robot-account-store.js +39 -0
- package/dist/storage/worktree-store.js +33 -0
- package/dist/web/404.html +1 -1
- package/dist/web/__next.__PAGE__.txt +4 -4
- package/dist/web/__next._full.txt +23 -25
- 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/{0n6_4so_afuwk.js → 0-92u-tiuy40a.js} +4 -4
- package/dist/web/_next/static/chunks/{0vbqaynjq8ga..js → 0-yizd8osmas2.js} +1 -1
- package/dist/web/_next/static/chunks/0.ln~3mnv8.69.js +1 -0
- package/dist/web/_next/static/chunks/{0iuf30t0rjsjv.js → 01y3e9pemva7b.js} +10 -10
- package/dist/web/_next/static/chunks/02802taez976w.js +67 -0
- package/dist/web/_next/static/chunks/02l~tmzrgny.~.js +1 -0
- package/dist/web/_next/static/chunks/033.awk90g6eh.js +1 -0
- package/dist/web/_next/static/chunks/03f1bwuynjdmk.js +1 -0
- package/dist/web/_next/static/chunks/04cb4kc9r2pd1.js +1 -0
- package/dist/web/_next/static/chunks/04de6ha5_e3pp.js +1 -0
- package/dist/web/_next/static/chunks/06.kdsa9rr2h1.js +1 -0
- package/dist/web/_next/static/chunks/09he0p79ov1rn.js +1 -0
- package/dist/web/_next/static/chunks/09vpocs4zuc8h.js +1 -0
- package/dist/web/_next/static/chunks/0_o2exgr0e_nh.js +1 -0
- package/dist/web/_next/static/chunks/{0xbaakj0dfc0..js → 0_y9nskc-xt2k.js} +1 -1
- package/dist/web/_next/static/chunks/0clnj-1fi6u8j.js +3 -0
- package/dist/web/_next/static/chunks/0gv40by0zzxs_.js +1 -0
- package/dist/web/_next/static/chunks/0iusr8y88.kjg.js +1 -0
- package/dist/web/_next/static/chunks/{04a4vsq2wknm4.js → 0j-8418fxvkd1.js} +1 -1
- package/dist/web/_next/static/chunks/0j-l7l_k9jt45.js +1 -0
- package/dist/web/_next/static/chunks/0j.wxxyoclma5.js +1 -0
- package/dist/web/_next/static/chunks/0jq.16sozqik..js +3 -0
- package/dist/web/_next/static/chunks/0jw8xdk_fpnp0.css +1 -0
- package/dist/web/_next/static/chunks/0l1lkd-wcotma.js +1 -0
- package/dist/web/_next/static/chunks/0ncxf_zr4n839.js +1 -0
- package/dist/web/_next/static/chunks/0ndo7um~v7vco.js +1 -0
- package/dist/web/_next/static/chunks/0ngk.~kan8wq_.js +1 -0
- package/dist/web/_next/static/chunks/0p3h-h3zj5ujg.js +30 -0
- package/dist/web/_next/static/chunks/0pm-un~-sy3rl.js +1 -0
- package/dist/web/_next/static/chunks/0rt9bofnn6qvn.js +1 -0
- package/dist/web/_next/static/chunks/0t64.9jd00hio.js +3 -0
- package/dist/web/_next/static/chunks/0taui9--5n6-5.js +1 -0
- package/dist/web/_next/static/chunks/0ty39169lh~z3.js +1 -0
- package/dist/web/_next/static/chunks/0uxzi~9b~k4mn.js +31 -0
- package/dist/web/_next/static/chunks/0v8nof~waedlu.js +1 -0
- package/dist/web/_next/static/chunks/{0ctg5qmw7uu.1.js → 0vcfoagnpf.aw.js} +3 -3
- package/dist/web/_next/static/chunks/{08ckpwmmwlors.js → 0wwwq.gyyz0vg.js} +3 -3
- package/dist/web/_next/static/chunks/0x5lak8yz7pm7.js +1 -0
- package/dist/web/_next/static/chunks/0xon_.4-o0_zq.js +7 -0
- package/dist/web/_next/static/chunks/0zjnrbt7inime.js +1 -0
- package/dist/web/_next/static/chunks/0zncg76rgtbm-.js +1 -0
- package/dist/web/_next/static/chunks/0zwebpitvpuv1.js +1 -0
- package/dist/web/_next/static/chunks/0~02o4g-o6n~m.js +1 -0
- package/dist/web/_next/static/chunks/{10l-9myrdo3x9.js → 0~fjezp.k4qk3.js} +1 -1
- package/dist/web/_next/static/chunks/0~sh93re1-_rp.js +1 -0
- package/dist/web/_next/static/chunks/10_niiq0k6o-p.js +5 -0
- package/dist/web/_next/static/chunks/12tjr0_2ccrtq.js +2 -0
- package/dist/web/_next/static/chunks/12x5.go_x9mfk.js +1 -0
- package/dist/web/_next/static/chunks/{1442stwa0gbxe.js → 12~5dk9i9d16t.js} +2 -2
- package/dist/web/_next/static/chunks/13iye4rv5p31b.js +1 -0
- package/dist/web/_next/static/chunks/{01~quun6sefgl.js → 13~y-b.b9rrw4.js} +1 -1
- package/dist/web/_next/static/chunks/151wzhb5q0lo5.js +1 -0
- package/dist/web/_next/static/chunks/18c7g84y01mj0.js +1 -0
- package/dist/web/_next/static/chunks/{turbopack-0ndm2zc_pdptk.js → turbopack-11qjwlynmfc-n.js} +1 -1
- package/dist/web/_not-found/__next._full.txt +30 -29
- 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 +30 -29
- package/dist/web/index.html +1 -1
- package/dist/web/index.txt +23 -25
- package/dist/web/login/__next._full.txt +28 -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 +28 -28
- package/dist/web/settings/__next._full.txt +33 -32
- 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 +24 -24
- 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 +24 -24
- package/dist/web/settings/mcps/__next._full.txt +24 -24
- 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 +24 -24
- package/dist/web/settings/models/__next._full.txt +24 -24
- 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 +24 -24
- package/dist/web/settings/output-styles/__next._full.txt +24 -24
- package/dist/web/settings/output-styles/__next._head.txt +4 -4
- package/dist/web/settings/output-styles/__next._index.txt +13 -13
- package/dist/web/settings/output-styles/__next._tree.txt +2 -2
- package/dist/web/settings/output-styles/__next.settings.output-styles.__PAGE__.txt +4 -4
- package/dist/web/settings/output-styles/__next.settings.output-styles.txt +3 -3
- package/dist/web/settings/output-styles/__next.settings.txt +5 -5
- package/dist/web/settings/output-styles.html +1 -1
- package/dist/web/settings/output-styles.txt +24 -24
- package/dist/web/settings/prompts/__next._full.txt +24 -24
- 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 +24 -24
- package/dist/web/settings/providers/__next._full.txt +24 -24
- 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 +24 -24
- package/dist/web/settings/skills/__next._full.txt +24 -24
- 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 +24 -24
- package/dist/web/settings/tools/__next._full.txt +24 -24
- package/dist/web/settings/tools/__next._head.txt +4 -4
- package/dist/web/settings/tools/__next._index.txt +13 -13
- package/dist/web/settings/tools/__next._tree.txt +2 -2
- package/dist/web/settings/tools/__next.settings.tools.__PAGE__.txt +4 -4
- package/dist/web/settings/tools/__next.settings.tools.txt +3 -3
- package/dist/web/settings/tools/__next.settings.txt +5 -5
- package/dist/web/settings/tools.html +1 -1
- package/dist/web/settings/tools.txt +24 -24
- package/dist/web/settings.html +1 -1
- package/dist/web/settings.txt +33 -32
- package/dist/web/workflows/__next._full.txt +31 -33
- 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 +31 -33
- package/dist/web/workspace/_/__next._full.txt +28 -29
- 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 -2
- package/dist/web/workspace/_/__next.workspace.$d$id.__PAGE__.txt +3 -3
- 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 +28 -29
- package/dist/web/workspaces/__next._full.txt +29 -31
- 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 +29 -31
- package/dist/ws/agent-prompt.js +32 -3
- package/dist/ws/agent-runner.js +83 -6
- package/package.json +11 -11
- package/dist/web/_next/static/chunks/0-9194nbxy_6d.js +0 -1
- package/dist/web/_next/static/chunks/0.n~yfwf4~6w-.js +0 -1
- package/dist/web/_next/static/chunks/02mf61htij8g0.js +0 -31
- package/dist/web/_next/static/chunks/04dg4l4hv11q2.js +0 -3
- package/dist/web/_next/static/chunks/04fxddw-y20~-.js +0 -7
- package/dist/web/_next/static/chunks/04w7~5ooz_pwm.js +0 -1
- package/dist/web/_next/static/chunks/05oc21sj24wtq.js +0 -1
- package/dist/web/_next/static/chunks/08kfx8on9oty~.js +0 -1
- package/dist/web/_next/static/chunks/08k~meqbd8d6v.js +0 -1
- package/dist/web/_next/static/chunks/099h96wjsdb25.js +0 -2
- package/dist/web/_next/static/chunks/09h23logvq65m.js +0 -1
- package/dist/web/_next/static/chunks/0a5y-vhf4i5id.js +0 -3
- package/dist/web/_next/static/chunks/0ake2f3x2uan4.js +0 -24
- package/dist/web/_next/static/chunks/0ck8dw_9-1cdx.js +0 -1
- package/dist/web/_next/static/chunks/0ewceguykiut5.js +0 -1
- package/dist/web/_next/static/chunks/0f7cb9li~3jra.js +0 -67
- package/dist/web/_next/static/chunks/0ghs9on7wodrm.js +0 -1
- package/dist/web/_next/static/chunks/0ghx3j_.-gdyd.js +0 -1
- package/dist/web/_next/static/chunks/0h9cu-k6z5o08.js +0 -1
- package/dist/web/_next/static/chunks/0jb4~3qqkw2ps.js +0 -1
- package/dist/web/_next/static/chunks/0nb8.iteznuvx.js +0 -1
- package/dist/web/_next/static/chunks/0os58q93stt7j.js +0 -3
- package/dist/web/_next/static/chunks/0s9lmk8iauou3.js +0 -1
- package/dist/web/_next/static/chunks/0sp_zbx~w0am7.js +0 -1
- package/dist/web/_next/static/chunks/0tel~zsv4z8l_.js +0 -1
- package/dist/web/_next/static/chunks/0twamv4wr_dbv.js +0 -1
- package/dist/web/_next/static/chunks/0uhol5wafdbl~.js +0 -1
- package/dist/web/_next/static/chunks/0v3a_x4vt42kx.js +0 -5
- package/dist/web/_next/static/chunks/0v7q4mys.mnm..css +0 -1
- package/dist/web/_next/static/chunks/0xt-8wk21gs7g.js +0 -1
- package/dist/web/_next/static/chunks/0z~vqzbm_q371.js +0 -1
- package/dist/web/_next/static/chunks/0~3xm80~j9ddg.js +0 -1
- package/dist/web/_next/static/chunks/14s37n6h0_q3x.js +0 -16
- package/dist/web/_next/static/chunks/161ik5kfyuwtd.js +0 -1
- package/dist/web/_next/static/chunks/17k~zbv0_4rep.js +0 -1
- package/public/output-styles/carmack-mode.md +0 -381
- package/public/output-styles/codex-rigor-mode.md +0 -114
- package/public/output-styles/dhh-mode.md +0 -265
- package/public/output-styles/evan-you-mode.md +0 -539
- package/public/output-styles/index.json +0 -37
- package/public/output-styles/jobs-mode.md +0 -369
- package/public/output-styles/linus-mode.md +0 -135
- package/public/output-styles/uncle-bob-mode.md +0 -221
- package/public/prompt/andrej-karpathy-skills.md +0 -65
- package/public/prompt/claude-token-efficient-coding.md +0 -35
- package/public/prompt/index.json +0 -12
- package/public/skills/index.json +0 -92
- package/public/skills/planning-with-files/planning-with-files-zh/SKILL.md +0 -243
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/check-complete.ps1 +0 -44
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/check-complete.sh +0 -46
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/init-session.ps1 +0 -124
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/init-session.sh +0 -124
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/session-catchup.py +0 -438
- package/public/skills/planning-with-files/planning-with-files-zh/templates/findings.md +0 -29
- package/public/skills/planning-with-files/planning-with-files-zh/templates/progress.md +0 -40
- package/public/skills/planning-with-files/planning-with-files-zh/templates/task_plan.md +0 -58
- package/public/skills/superpowers/brainstorming/SKILL.md +0 -164
- package/public/skills/superpowers/brainstorming/scripts/frame-template.html +0 -214
- package/public/skills/superpowers/brainstorming/scripts/helper.js +0 -88
- package/public/skills/superpowers/brainstorming/scripts/server.cjs +0 -354
- package/public/skills/superpowers/brainstorming/scripts/start-server.sh +0 -148
- package/public/skills/superpowers/brainstorming/scripts/stop-server.sh +0 -56
- package/public/skills/superpowers/brainstorming/spec-document-reviewer-prompt.md +0 -49
- package/public/skills/superpowers/brainstorming/visual-companion.md +0 -287
- package/public/skills/superpowers/dispatching-parallel-agents/SKILL.md +0 -182
- package/public/skills/superpowers/executing-plans/SKILL.md +0 -70
- package/public/skills/superpowers/finishing-a-development-branch/SKILL.md +0 -251
- package/public/skills/superpowers/receiving-code-review/SKILL.md +0 -213
- package/public/skills/superpowers/requesting-code-review/SKILL.md +0 -103
- package/public/skills/superpowers/requesting-code-review/code-reviewer.md +0 -168
- package/public/skills/superpowers/subagent-driven-development/SKILL.md +0 -279
- package/public/skills/superpowers/subagent-driven-development/code-quality-reviewer-prompt.md +0 -25
- package/public/skills/superpowers/subagent-driven-development/implementer-prompt.md +0 -113
- package/public/skills/superpowers/subagent-driven-development/spec-reviewer-prompt.md +0 -61
- package/public/skills/superpowers/systematic-debugging/CREATION-LOG.md +0 -119
- package/public/skills/superpowers/systematic-debugging/SKILL.md +0 -296
- package/public/skills/superpowers/systematic-debugging/condition-based-waiting-example.ts +0 -158
- package/public/skills/superpowers/systematic-debugging/condition-based-waiting.md +0 -115
- package/public/skills/superpowers/systematic-debugging/defense-in-depth.md +0 -122
- package/public/skills/superpowers/systematic-debugging/find-polluter.sh +0 -63
- package/public/skills/superpowers/systematic-debugging/root-cause-tracing.md +0 -169
- package/public/skills/superpowers/systematic-debugging/test-academic.md +0 -14
- package/public/skills/superpowers/systematic-debugging/test-pressure-1.md +0 -58
- package/public/skills/superpowers/systematic-debugging/test-pressure-2.md +0 -68
- package/public/skills/superpowers/systematic-debugging/test-pressure-3.md +0 -69
- package/public/skills/superpowers/test-driven-development/SKILL.md +0 -371
- package/public/skills/superpowers/test-driven-development/testing-anti-patterns.md +0 -299
- package/public/skills/superpowers/using-git-worktrees/SKILL.md +0 -215
- package/public/skills/superpowers/using-superpowers/SKILL.md +0 -117
- package/public/skills/superpowers/using-superpowers/references/codex-tools.md +0 -59
- package/public/skills/superpowers/using-superpowers/references/copilot-tools.md +0 -42
- package/public/skills/superpowers/using-superpowers/references/gemini-tools.md +0 -51
- package/public/skills/superpowers/verification-before-completion/SKILL.md +0 -139
- package/public/skills/superpowers/writing-plans/SKILL.md +0 -152
- package/public/skills/superpowers/writing-plans/plan-document-reviewer-prompt.md +0 -49
- package/public/skills/superpowers/writing-skills/SKILL.md +0 -655
- package/public/skills/superpowers/writing-skills/anthropic-best-practices.md +0 -1150
- package/public/skills/superpowers/writing-skills/examples/CLAUDE_MD_TESTING.md +0 -189
- package/public/skills/superpowers/writing-skills/graphviz-conventions.dot +0 -172
- package/public/skills/superpowers/writing-skills/persuasion-principles.md +0 -187
- package/public/skills/superpowers/writing-skills/render-graphs.js +0 -168
- package/public/skills/superpowers/writing-skills/testing-skills-with-subagents.md +0 -384
- /package/dist/web/_next/static/{e8w3vd9Eov_LDYWj_0zsE → rGXyAK8rgod1NjF3bLZAY}/_buildManifest.js +0 -0
- /package/dist/web/_next/static/{e8w3vd9Eov_LDYWj_0zsE → rGXyAK8rgod1NjF3bLZAY}/_clientMiddlewareManifest.js +0 -0
- /package/dist/web/_next/static/{e8w3vd9Eov_LDYWj_0zsE → rGXyAK8rgod1NjF3bLZAY}/_ssgManifest.js +0 -0
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { ClaudeCodeRuntime } from './claude-code-runtime/index.js';
|
|
5
5
|
import { CodexRuntime } from './codex-runtime.js';
|
|
6
|
+
import { HermesRuntime } from './hermes-runtime.js';
|
|
6
7
|
import { LangChainRuntime } from './langchain-runtime.js';
|
|
7
8
|
import { OpenAgentSdkRuntime } from './open-agent-sdk-runtime.js';
|
|
8
9
|
export { ClaudeCodeRuntime } from './claude-code-runtime/index.js';
|
|
9
10
|
export { CodexRuntime } from './codex-runtime.js';
|
|
11
|
+
export { HermesRuntime } from './hermes-runtime.js';
|
|
10
12
|
export { LangChainRuntime } from './langchain-runtime.js';
|
|
11
13
|
export { OpenAgentSdkRuntime } from './open-agent-sdk-runtime.js';
|
|
12
14
|
export function createAgentRuntime(configOrProvider = {}, model) {
|
|
@@ -22,6 +24,8 @@ export function createAgentRuntime(configOrProvider = {}, model) {
|
|
|
22
24
|
return new CodexRuntime(config);
|
|
23
25
|
case 'langchain':
|
|
24
26
|
return new LangChainRuntime(config);
|
|
27
|
+
case 'hermes':
|
|
28
|
+
return new HermesRuntime(config);
|
|
25
29
|
}
|
|
26
30
|
}
|
|
27
31
|
//# sourceMappingURL=agent-runtime.js.map
|
|
@@ -4,7 +4,7 @@ import { summarizeResult } from '../agent-runtime-types.js';
|
|
|
4
4
|
import { prepareClaudeOutputStyleFile } from '../../services/output-style.js';
|
|
5
5
|
import { normalizeAdditionalDirectories, normalizePermissionMode, normalizeSkillNames, prepareConfigDir, resolveBundledClaudeExecutable, buildEnv, normalizeMcpServers } from './sdk-config.js';
|
|
6
6
|
import { startClaudeAdapterIfNeeded, getClaudeCodeModel } from './adapter-pool.js';
|
|
7
|
-
import { extractThinkingEvents, extractToolUseEvents, extractToolResultEvent, logToolDebug, formatMessage, isAskUserQuestionAutoResult, countUsageTokens, formatUsageLine, normalizeUsage } from './message-format.js';
|
|
7
|
+
import { extractClaudeHookEvents, extractThinkingEvents, extractToolUseEvents, extractToolResultEvent, logToolDebug, formatMessage, isAskUserQuestionAutoResult, countUsageTokens, formatUsageLine, normalizeUsage } from './message-format.js';
|
|
8
8
|
export class ClaudeCodeRuntime {
|
|
9
9
|
config;
|
|
10
10
|
abortController = null;
|
|
@@ -39,7 +39,33 @@ export class ClaudeCodeRuntime {
|
|
|
39
39
|
d(`prompt: ${prompt.slice(0, 300)}${prompt.length > 300 ? '...' : ''}`);
|
|
40
40
|
d(`sdk mcp servers | ${sdkMcpServerNames.join(',') || '-'}`);
|
|
41
41
|
const stderrLines = [];
|
|
42
|
+
let sessionId = options?.resumeSessionId;
|
|
43
|
+
const emitHook = (event, matcher = '*', payload) => {
|
|
44
|
+
options?.onEvent?.({ type: 'hook_event', event, matcher, payload });
|
|
45
|
+
};
|
|
42
46
|
try {
|
|
47
|
+
emitHook('SessionStart', '*', {
|
|
48
|
+
cwd,
|
|
49
|
+
model,
|
|
50
|
+
provider: this.config.provider,
|
|
51
|
+
baseURL,
|
|
52
|
+
permissionMode,
|
|
53
|
+
configDir,
|
|
54
|
+
sandboxDirs: additionalDirectories,
|
|
55
|
+
resumeSessionId: options?.resumeSessionId,
|
|
56
|
+
});
|
|
57
|
+
const hookUserPrompt = options?.userPrompt ?? prompt;
|
|
58
|
+
emitHook('UserPromptSubmit', '*', {
|
|
59
|
+
prompt: hookUserPrompt,
|
|
60
|
+
message: hookUserPrompt,
|
|
61
|
+
userMessage: hookUserPrompt,
|
|
62
|
+
fullPrompt: prompt,
|
|
63
|
+
cwd,
|
|
64
|
+
configDir,
|
|
65
|
+
});
|
|
66
|
+
if (/CLAUDE\.md|AGENTS\.md|\.claude\/rules\//.test(prompt)) {
|
|
67
|
+
emitHook('InstructionsLoaded', '*', { source: 'prompt', promptPreview: prompt.slice(0, 1000) });
|
|
68
|
+
}
|
|
43
69
|
const queryOptions = {
|
|
44
70
|
cwd,
|
|
45
71
|
model,
|
|
@@ -76,11 +102,13 @@ export class ClaudeCodeRuntime {
|
|
|
76
102
|
let usageLine = null;
|
|
77
103
|
let usage;
|
|
78
104
|
let costUsd;
|
|
79
|
-
let sessionId = options?.resumeSessionId;
|
|
80
105
|
let sawResult = false;
|
|
81
106
|
const pendingAskUserQuestionToolIds = new Set();
|
|
82
107
|
let waitingForUserAnswer = false;
|
|
83
108
|
for await (const message of this.activeQuery) {
|
|
109
|
+
for (const hookEvent of extractClaudeHookEvents(message)) {
|
|
110
|
+
emitHook(hookEvent.event, hookEvent.matcher, hookEvent.payload);
|
|
111
|
+
}
|
|
84
112
|
const nextSessionId = readSessionId(message);
|
|
85
113
|
if (nextSessionId && nextSessionId !== sessionId) {
|
|
86
114
|
sessionId = nextSessionId;
|
|
@@ -145,6 +173,17 @@ export class ClaudeCodeRuntime {
|
|
|
145
173
|
const elapsed = Date.now() - startTime;
|
|
146
174
|
if (waitingForUserAnswer) {
|
|
147
175
|
d(`waiting for user answer ${elapsed}ms | turns=${turns} tokens=${tokenCount}`);
|
|
176
|
+
const message = resultText || output.at(-1) || 'Waiting for user answer';
|
|
177
|
+
emitHook('Stop', '*', {
|
|
178
|
+
status: 'waiting_for_user_answer',
|
|
179
|
+
message,
|
|
180
|
+
finalMessage: message,
|
|
181
|
+
output,
|
|
182
|
+
elapsedMs: elapsed,
|
|
183
|
+
turns,
|
|
184
|
+
tokenCount,
|
|
185
|
+
sessionId,
|
|
186
|
+
});
|
|
148
187
|
if (usageLine)
|
|
149
188
|
output.push(usageLine);
|
|
150
189
|
return {
|
|
@@ -161,6 +200,7 @@ export class ClaudeCodeRuntime {
|
|
|
161
200
|
const runtimeError = extractRuntimeError([...stderrLines, ...output])
|
|
162
201
|
|| 'Claude Code execution stopped before reporting a final result';
|
|
163
202
|
d(`failed ${elapsed}ms | turns=${turns} tokens=${tokenCount} | ${runtimeError}`);
|
|
203
|
+
emitHook('StopFailure', '*', { error: runtimeError, elapsedMs: elapsed, turns, tokenCount, sessionId, stderr: stderrLines });
|
|
164
204
|
appendUnique(output, stderrLines);
|
|
165
205
|
appendUnique(output, [runtimeError]);
|
|
166
206
|
return {
|
|
@@ -176,6 +216,17 @@ export class ClaudeCodeRuntime {
|
|
|
176
216
|
}
|
|
177
217
|
if (waitingForUserAnswer && (!error || isAskUserQuestionAutoResult(error))) {
|
|
178
218
|
d(`waiting for user answer ${elapsed}ms | turns=${turns} tokens=${tokenCount}`);
|
|
219
|
+
const message = resultText || output.at(-1) || 'Waiting for user answer';
|
|
220
|
+
emitHook('Stop', '*', {
|
|
221
|
+
status: 'waiting_for_user_answer',
|
|
222
|
+
message,
|
|
223
|
+
finalMessage: message,
|
|
224
|
+
output,
|
|
225
|
+
elapsedMs: elapsed,
|
|
226
|
+
turns,
|
|
227
|
+
tokenCount,
|
|
228
|
+
sessionId,
|
|
229
|
+
});
|
|
179
230
|
if (usageLine)
|
|
180
231
|
output.push(usageLine);
|
|
181
232
|
return {
|
|
@@ -191,6 +242,7 @@ export class ClaudeCodeRuntime {
|
|
|
191
242
|
if (error) {
|
|
192
243
|
const runtimeError = extractRuntimeError([error, ...stderrLines, ...output]) || error;
|
|
193
244
|
d(`failed ${elapsed}ms | turns=${turns} tokens=${tokenCount} | ${runtimeError}`);
|
|
245
|
+
emitHook('StopFailure', '*', { error: runtimeError, elapsedMs: elapsed, turns, tokenCount, sessionId, stderr: stderrLines });
|
|
194
246
|
appendUnique(output, stderrLines);
|
|
195
247
|
if (usageLine)
|
|
196
248
|
output.push(usageLine);
|
|
@@ -213,6 +265,18 @@ export class ClaudeCodeRuntime {
|
|
|
213
265
|
const finalOutput = resultText && !output.includes(resultText) ? [...output, resultText] : output;
|
|
214
266
|
if (usageLine && !finalOutput.includes(usageLine))
|
|
215
267
|
finalOutput.push(usageLine);
|
|
268
|
+
emitHook('Stop', '*', {
|
|
269
|
+
status: 'success',
|
|
270
|
+
message: text,
|
|
271
|
+
finalMessage: text,
|
|
272
|
+
output: finalOutput,
|
|
273
|
+
elapsedMs: elapsed,
|
|
274
|
+
turns,
|
|
275
|
+
tokenCount,
|
|
276
|
+
sessionId,
|
|
277
|
+
usage,
|
|
278
|
+
costUsd,
|
|
279
|
+
});
|
|
216
280
|
return {
|
|
217
281
|
success: true,
|
|
218
282
|
summary: summarizeResult(text),
|
|
@@ -230,11 +294,13 @@ export class ClaudeCodeRuntime {
|
|
|
230
294
|
d(`failed ${elapsed}ms | ${runtimeError}`);
|
|
231
295
|
if (err instanceof Error && err.stack)
|
|
232
296
|
console.error(err.stack);
|
|
297
|
+
emitHook('StopFailure', '*', { error: runtimeError, elapsedMs: elapsed, stderr: stderrLines, stack: err instanceof Error ? err.stack : undefined });
|
|
233
298
|
appendUnique(output, stderrLines);
|
|
234
299
|
appendUnique(output, [runtimeError]);
|
|
235
300
|
return { success: false, summary: 'Claude Code execution failed', artifacts: [], error: runtimeError, output, sessionId: options?.resumeSessionId };
|
|
236
301
|
}
|
|
237
302
|
finally {
|
|
303
|
+
emitHook('SessionEnd', '*', { cwd, sessionId });
|
|
238
304
|
this.activeQuery?.close();
|
|
239
305
|
this.activeQuery = null;
|
|
240
306
|
await this.adapterRun?.release();
|
|
@@ -95,6 +95,32 @@ export function extractToolResultEvent(message) {
|
|
|
95
95
|
}
|
|
96
96
|
return null;
|
|
97
97
|
}
|
|
98
|
+
export function extractClaudeHookEvents(message) {
|
|
99
|
+
const events = [];
|
|
100
|
+
if (message.type === 'system') {
|
|
101
|
+
if (message.subtype === 'task_started') {
|
|
102
|
+
events.push({ event: 'SubagentStart', matcher: '*', payload: message });
|
|
103
|
+
}
|
|
104
|
+
else if (message.subtype === 'task_notification') {
|
|
105
|
+
events.push({ event: 'Notification', matcher: '*', payload: message });
|
|
106
|
+
}
|
|
107
|
+
else if (message.subtype === 'local_command_output') {
|
|
108
|
+
events.push({ event: 'Notification', matcher: 'local_command_output', payload: message });
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (message.type === 'tool_use_summary') {
|
|
112
|
+
events.push({ event: 'PostToolBatch', matcher: '*', payload: message });
|
|
113
|
+
}
|
|
114
|
+
for (const toolUse of extractToolUseEvents(message)) {
|
|
115
|
+
if (toolUse.name === 'TaskCreate') {
|
|
116
|
+
events.push({ event: 'TaskCreated', matcher: toolUse.name, payload: toolUse });
|
|
117
|
+
}
|
|
118
|
+
if (toolUse.name === 'TaskCompleted') {
|
|
119
|
+
events.push({ event: 'TaskCompleted', matcher: toolUse.name, payload: toolUse });
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return events;
|
|
123
|
+
}
|
|
98
124
|
export function logToolDebug(message, d, options = {}) {
|
|
99
125
|
switch (message.type) {
|
|
100
126
|
case 'assistant':
|
|
@@ -5,6 +5,7 @@ import { join } from 'node:path';
|
|
|
5
5
|
import { createSdkMcpServer, tool } from '@anthropic-ai/claude-agent-sdk';
|
|
6
6
|
import { isAnthropicBridgeProvider } from './types.js';
|
|
7
7
|
const require = createRequire(import.meta.url);
|
|
8
|
+
const CLAUDE_BUILT_IN_DIRS = ['agents', 'commands'];
|
|
8
9
|
export function buildEnv(config, configDir, override) {
|
|
9
10
|
const usesAnthropicBridge = isAnthropicBridgeProvider(config.provider);
|
|
10
11
|
return {
|
|
@@ -132,6 +133,7 @@ export function prepareConfigDir(configDir, agentDir) {
|
|
|
132
133
|
mkdirSync(configDir, { recursive: true });
|
|
133
134
|
if (!agentDir)
|
|
134
135
|
return;
|
|
136
|
+
copyClaudeBuiltInDirs(agentDir, configDir);
|
|
135
137
|
const sourceSkillsDir = join(agentDir, 'skills');
|
|
136
138
|
const targetSkillsDir = join(configDir, 'skills');
|
|
137
139
|
rmSync(targetSkillsDir, { recursive: true, force: true });
|
|
@@ -163,6 +165,16 @@ export function prepareConfigDir(configDir, agentDir) {
|
|
|
163
165
|
copyFileSync(source, join(targetSkillsDir, `${skillName}.md`));
|
|
164
166
|
}
|
|
165
167
|
}
|
|
168
|
+
function copyClaudeBuiltInDirs(agentDir, configDir) {
|
|
169
|
+
for (const dir of CLAUDE_BUILT_IN_DIRS) {
|
|
170
|
+
const sourceDir = join(agentDir, dir);
|
|
171
|
+
const targetDir = join(configDir, dir);
|
|
172
|
+
rmSync(targetDir, { recursive: true, force: true });
|
|
173
|
+
if (!existsSync(sourceDir) || !statSync(sourceDir).isDirectory())
|
|
174
|
+
continue;
|
|
175
|
+
cpSync(sourceDir, targetDir, { recursive: true, force: true });
|
|
176
|
+
}
|
|
177
|
+
}
|
|
166
178
|
function hasSkillContent(skill, configDir) {
|
|
167
179
|
if (!configDir)
|
|
168
180
|
return true;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { createServer } from 'node:http';
|
|
3
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
4
|
+
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
5
|
+
import { CallToolRequestSchema, ErrorCode, ListToolsRequestSchema, McpError, } from '@modelcontextprotocol/sdk/types.js';
|
|
6
|
+
const AGENT_SPACES_MCP_SERVER_NAME = 'agent-spaces';
|
|
7
|
+
export async function startCodexFunctionToolBridge(functionTools, log) {
|
|
8
|
+
if (!functionTools?.length)
|
|
9
|
+
return undefined;
|
|
10
|
+
const toolsByName = new Map(functionTools.map((functionTool) => [functionTool.name, functionTool]));
|
|
11
|
+
const mcpServer = new Server({ name: AGENT_SPACES_MCP_SERVER_NAME, version: '0.1.0' }, {
|
|
12
|
+
capabilities: {
|
|
13
|
+
tools: { listChanged: false },
|
|
14
|
+
},
|
|
15
|
+
instructions: 'Agent Spaces built-in runtime tools for workspace data.',
|
|
16
|
+
});
|
|
17
|
+
const transport = new StreamableHTTPServerTransport({
|
|
18
|
+
sessionIdGenerator: randomUUID,
|
|
19
|
+
enableJsonResponse: true,
|
|
20
|
+
});
|
|
21
|
+
mcpServer.setRequestHandler(ListToolsRequestSchema, () => ({
|
|
22
|
+
tools: functionTools.map(toMcpTool),
|
|
23
|
+
}));
|
|
24
|
+
mcpServer.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
25
|
+
const functionTool = toolsByName.get(request.params.name);
|
|
26
|
+
if (!functionTool) {
|
|
27
|
+
throw new McpError(ErrorCode.InvalidParams, `Tool ${request.params.name} not found`);
|
|
28
|
+
}
|
|
29
|
+
const result = await functionTool.execute(request.params.arguments ?? {});
|
|
30
|
+
return {
|
|
31
|
+
content: [
|
|
32
|
+
{
|
|
33
|
+
type: 'text',
|
|
34
|
+
text: stringifyToolResult(result),
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
...(isRecord(result) ? { structuredContent: result } : {}),
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
await mcpServer.connect(transport);
|
|
41
|
+
const httpServer = createServer(async (req, res) => {
|
|
42
|
+
try {
|
|
43
|
+
const url = new URL(req.url ?? '/', 'http://127.0.0.1');
|
|
44
|
+
if (url.pathname !== '/mcp') {
|
|
45
|
+
res.writeHead(404).end('Not found');
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
await transport.handleRequest(req, res);
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
52
|
+
log?.(`function tool bridge request failed | ${message}`);
|
|
53
|
+
if (!res.headersSent)
|
|
54
|
+
res.writeHead(500, { 'content-type': 'text/plain; charset=utf-8' });
|
|
55
|
+
if (!res.writableEnded)
|
|
56
|
+
res.end(message);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
await listen(httpServer);
|
|
60
|
+
const address = httpServer.address();
|
|
61
|
+
if (!address || typeof address === 'string') {
|
|
62
|
+
await closeHttpServer(httpServer);
|
|
63
|
+
await mcpServer.close();
|
|
64
|
+
throw new Error('Failed to start Codex function tool bridge');
|
|
65
|
+
}
|
|
66
|
+
const url = `http://127.0.0.1:${address.port}/mcp`;
|
|
67
|
+
log?.(`function tool bridge started | url=${url} tools=${functionTools.map((tool) => tool.name).join(',')}`);
|
|
68
|
+
return {
|
|
69
|
+
name: AGENT_SPACES_MCP_SERVER_NAME,
|
|
70
|
+
url,
|
|
71
|
+
close: async () => {
|
|
72
|
+
await mcpServer.close();
|
|
73
|
+
await closeHttpServer(httpServer);
|
|
74
|
+
log?.('function tool bridge stopped');
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function toMcpTool(functionTool) {
|
|
79
|
+
return {
|
|
80
|
+
name: functionTool.name,
|
|
81
|
+
description: functionTool.description,
|
|
82
|
+
inputSchema: normalizeToolInputSchema(functionTool.inputSchema),
|
|
83
|
+
annotations: toMcpToolAnnotations(functionTool),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function normalizeToolInputSchema(schema) {
|
|
87
|
+
if (schema.type === 'object')
|
|
88
|
+
return schema;
|
|
89
|
+
return {
|
|
90
|
+
type: 'object',
|
|
91
|
+
properties: normalizeSchemaProperties(schema.properties),
|
|
92
|
+
required: Array.isArray(schema.required) ? schema.required.map(String) : [],
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function toMcpToolAnnotations(functionTool) {
|
|
96
|
+
if (!functionTool.annotations)
|
|
97
|
+
return undefined;
|
|
98
|
+
return {
|
|
99
|
+
readOnlyHint: functionTool.annotations.readOnly,
|
|
100
|
+
destructiveHint: functionTool.annotations.destructive,
|
|
101
|
+
openWorldHint: functionTool.annotations.openWorld,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
function stringifyToolResult(result) {
|
|
105
|
+
if (result === undefined)
|
|
106
|
+
return 'null';
|
|
107
|
+
return JSON.stringify(result, null, 2) ?? String(result);
|
|
108
|
+
}
|
|
109
|
+
function normalizeSchemaProperties(properties) {
|
|
110
|
+
if (!isRecord(properties))
|
|
111
|
+
return {};
|
|
112
|
+
return Object.fromEntries(Object.entries(properties).filter((entry) => isRecord(entry[1])));
|
|
113
|
+
}
|
|
114
|
+
function listen(server) {
|
|
115
|
+
return new Promise((resolve, reject) => {
|
|
116
|
+
const onError = (err) => {
|
|
117
|
+
server.off('listening', onListening);
|
|
118
|
+
reject(err);
|
|
119
|
+
};
|
|
120
|
+
const onListening = () => {
|
|
121
|
+
server.off('error', onError);
|
|
122
|
+
resolve();
|
|
123
|
+
};
|
|
124
|
+
server.once('error', onError);
|
|
125
|
+
server.once('listening', onListening);
|
|
126
|
+
server.listen(0, '127.0.0.1');
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
function closeHttpServer(server) {
|
|
130
|
+
if (!server.listening)
|
|
131
|
+
return Promise.resolve();
|
|
132
|
+
return new Promise((resolve, reject) => {
|
|
133
|
+
server.close((err) => {
|
|
134
|
+
if (err)
|
|
135
|
+
reject(err);
|
|
136
|
+
else
|
|
137
|
+
resolve();
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
function isRecord(value) {
|
|
142
|
+
return Boolean(value && typeof value === 'object' && !Array.isArray(value));
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=codex-function-tool-bridge.js.map
|
|
@@ -2,6 +2,7 @@ import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, wri
|
|
|
2
2
|
import { basename, extname, join } from 'node:path';
|
|
3
3
|
import { Codex } from '@openai/codex-sdk';
|
|
4
4
|
import { appendOutputStyleToPrompt, summarizeResult } from './agent-runtime-types.js';
|
|
5
|
+
import { startCodexFunctionToolBridge } from './codex-function-tool-bridge.js';
|
|
5
6
|
/**
|
|
6
7
|
* Runtime backed by OpenAI's Codex SDK.
|
|
7
8
|
* Spawns the bundled Codex CLI and consumes its structured JSONL event stream.
|
|
@@ -23,12 +24,15 @@ export class CodexRuntime {
|
|
|
23
24
|
if (codexHome)
|
|
24
25
|
prepareCodexHome(codexHome, agentDir);
|
|
25
26
|
const skillNames = normalizeSkillNames(options?.skills, codexHome);
|
|
26
|
-
const configOverrides = buildCodexConfig(this.config, options, skillNames);
|
|
27
27
|
const sandboxMode = normalizeSandboxMode(this.config.permissionMode);
|
|
28
28
|
const approvalPolicy = normalizeApprovalPolicy(this.config.permissionMode);
|
|
29
|
-
|
|
29
|
+
let functionToolBridge;
|
|
30
|
+
d(`starting | cwd=${cwd} model=${this.config.model ?? 'default'} sandboxMode=${sandboxMode} approvalPolicy=${approvalPolicy} maxTurns=${options?.maxTurns ?? '∞'} mcpServers=${Object.keys(options?.mcpServers ?? {}).join(',') || '-'} functionTools=${options?.functionTools?.map((tool) => tool.name).join(',') || '-'} skills=${skillNames.join(',') || '-'} codexHome=${codexHome ?? 'default'} sandboxDirs=${options?.sandboxDirs?.join(',') ?? '-'}`);
|
|
30
31
|
d(`prompt: ${prompt.slice(0, 300)}${prompt.length > 300 ? '...' : ''}`);
|
|
31
32
|
try {
|
|
33
|
+
functionToolBridge = await startCodexFunctionToolBridge(options?.functionTools, d);
|
|
34
|
+
const mcpServers = withFunctionToolBridge(options?.mcpServers, functionToolBridge);
|
|
35
|
+
const configOverrides = buildCodexConfig(this.config, mcpServers, skillNames);
|
|
32
36
|
const codex = new Codex({
|
|
33
37
|
apiKey: this.config.apiKey,
|
|
34
38
|
baseUrl: shouldUseCodexOpenAIBaseUrl(this.config) ? this.config.baseURL : undefined,
|
|
@@ -127,6 +131,13 @@ export class CodexRuntime {
|
|
|
127
131
|
return { success: false, summary: 'Codex execution failed', artifacts: [], error: message, output, sessionId: options?.resumeSessionId };
|
|
128
132
|
}
|
|
129
133
|
finally {
|
|
134
|
+
try {
|
|
135
|
+
await functionToolBridge?.close();
|
|
136
|
+
}
|
|
137
|
+
catch (err) {
|
|
138
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
139
|
+
d(`function tool bridge close failed | ${message}`);
|
|
140
|
+
}
|
|
130
141
|
this.abortController = null;
|
|
131
142
|
}
|
|
132
143
|
}
|
|
@@ -143,13 +154,13 @@ function buildEnv(config, codexHome) {
|
|
|
143
154
|
CODEX_INTERNAL_ORIGINATOR_OVERRIDE: process.env.CODEX_INTERNAL_ORIGINATOR_OVERRIDE || 'agent-spaces/server',
|
|
144
155
|
});
|
|
145
156
|
}
|
|
146
|
-
function buildCodexConfig(runtimeConfig,
|
|
157
|
+
function buildCodexConfig(runtimeConfig, rawMcpServers, skillNames) {
|
|
147
158
|
const config = {};
|
|
148
159
|
Object.assign(config, buildCodexProviderConfig(runtimeConfig));
|
|
149
160
|
if (runtimeConfig.thinkingEnabled !== false) {
|
|
150
161
|
config.model_reasoning_effort = runtimeConfig.thinkingEffort ?? 'medium';
|
|
151
162
|
}
|
|
152
|
-
const mcpServers = normalizeMcpServers(
|
|
163
|
+
const mcpServers = normalizeMcpServers(rawMcpServers);
|
|
153
164
|
if (mcpServers)
|
|
154
165
|
config.mcp_servers = mcpServers;
|
|
155
166
|
if (skillNames.length > 0) {
|
|
@@ -157,6 +168,14 @@ function buildCodexConfig(runtimeConfig, options, skillNames) {
|
|
|
157
168
|
}
|
|
158
169
|
return removeUndefined(config);
|
|
159
170
|
}
|
|
171
|
+
function withFunctionToolBridge(mcpServers, bridge) {
|
|
172
|
+
if (!bridge)
|
|
173
|
+
return mcpServers;
|
|
174
|
+
return {
|
|
175
|
+
...(mcpServers ?? {}),
|
|
176
|
+
[bridge.name]: { url: bridge.url },
|
|
177
|
+
};
|
|
178
|
+
}
|
|
160
179
|
function buildCodexProviderConfig(runtimeConfig) {
|
|
161
180
|
if (!runtimeConfig.baseURL || shouldUseCodexOpenAIBaseUrl(runtimeConfig))
|
|
162
181
|
return {};
|
package/dist/adapters/git.js
CHANGED
|
@@ -78,18 +78,20 @@ function mapStatus(raw) {
|
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
80
|
async function getUpstreamRef(git, branch) {
|
|
81
|
+
const refExists = async (ref) => {
|
|
82
|
+
return git.raw(['rev-parse', '--verify', '--quiet', ref])
|
|
83
|
+
.then(() => true)
|
|
84
|
+
.catch(() => false);
|
|
85
|
+
};
|
|
81
86
|
const upstream = await git.raw(['rev-parse', '--abbrev-ref', '--symbolic-full-name', '@{u}'])
|
|
82
87
|
.then(v => v.trim())
|
|
83
88
|
.catch(() => '');
|
|
84
|
-
if (upstream)
|
|
89
|
+
if (upstream && await refExists(upstream))
|
|
85
90
|
return upstream;
|
|
86
91
|
if (!branch || branch === 'HEAD')
|
|
87
92
|
return null;
|
|
88
93
|
const originBranch = `origin/${branch}`;
|
|
89
|
-
|
|
90
|
-
.then(() => true)
|
|
91
|
-
.catch(() => false);
|
|
92
|
-
return hasOriginBranch ? originBranch : null;
|
|
94
|
+
return await refExists(originBranch) ? originBranch : null;
|
|
93
95
|
}
|
|
94
96
|
function splitConflictSides(content) {
|
|
95
97
|
const left = [];
|
|
@@ -168,6 +170,12 @@ export async function gitStatus(workspaceId) {
|
|
|
168
170
|
try {
|
|
169
171
|
const upstream = await getUpstreamRef(git, result.branch);
|
|
170
172
|
if (upstream) {
|
|
173
|
+
const counts = await git.raw(['rev-list', '--left-right', '--count', `HEAD...${upstream}`]);
|
|
174
|
+
const [ahead, behind] = counts.trim().split(/\s+/).map((value) => Number(value));
|
|
175
|
+
if (Number.isFinite(ahead))
|
|
176
|
+
result.ahead = ahead;
|
|
177
|
+
if (Number.isFinite(behind))
|
|
178
|
+
result.behind = behind;
|
|
171
179
|
const remoteHeadHash = await git.revparse(['--short', upstream]);
|
|
172
180
|
result.remoteHeadHash = remoteHeadHash.trim();
|
|
173
181
|
}
|
|
@@ -266,7 +274,12 @@ export async function gitLog(workspaceId, maxCount = 50) {
|
|
|
266
274
|
const upstream = await getUpstreamRef(git, status.current || 'HEAD');
|
|
267
275
|
const refs = upstream ? ['HEAD', upstream] : ['HEAD'];
|
|
268
276
|
const pretty = '%H%x1f%s%x1f%an%x1f%aI%x1e';
|
|
269
|
-
const
|
|
277
|
+
const logArgs = ['log', `--max-count=${maxCount}`, `--pretty=format:${pretty}`];
|
|
278
|
+
const raw = await git.raw([...logArgs, ...refs]).catch((err) => {
|
|
279
|
+
if (!upstream)
|
|
280
|
+
throw err;
|
|
281
|
+
return git.raw([...logArgs, 'HEAD']);
|
|
282
|
+
});
|
|
270
283
|
return raw.split('\x1e')
|
|
271
284
|
.map(record => record.trim())
|
|
272
285
|
.filter(Boolean)
|
|
@@ -369,7 +382,7 @@ export async function gitPush(workspaceId) {
|
|
|
369
382
|
const remotes = await git.getRemotes(true);
|
|
370
383
|
if (!remotes.length)
|
|
371
384
|
throw new Error('No remote repository configured. Please add a remote first.');
|
|
372
|
-
await git.push('origin', branch);
|
|
385
|
+
await git.push('origin', branch, ['--set-upstream']);
|
|
373
386
|
}
|
|
374
387
|
export async function gitFetch(workspaceId) {
|
|
375
388
|
const ws = getWorkspace(workspaceId);
|
|
@@ -385,6 +398,11 @@ export async function gitPull(workspaceId) {
|
|
|
385
398
|
const git = getGit(ws);
|
|
386
399
|
const status = await git.status();
|
|
387
400
|
const branch = status.current || 'HEAD';
|
|
401
|
+
const upstream = await getUpstreamRef(git, branch);
|
|
402
|
+
if (upstream?.startsWith('origin/')) {
|
|
403
|
+
await git.pull('origin', upstream.slice('origin/'.length));
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
388
406
|
await git.pull('origin', branch);
|
|
389
407
|
}
|
|
390
408
|
export async function gitGetRemotes(workspaceId) {
|