@jiggai/kitchen 0.1.3 → 0.1.7
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/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +0 -24
- package/.next/server/app/_global-error/page.js +1 -1
- package/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/.next/server/app/_global-error.html +2 -2
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page.js +1 -1
- package/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +1 -1
- package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/agents/[agentId]/page.js +1 -1
- package/.next/server/app/agents/[agentId]/page.js.nft.json +1 -1
- package/.next/server/app/agents/[agentId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/api/agents/[id]/route.js +1 -1
- package/.next/server/app/api/agents/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/agents/add/route.js +1 -1
- package/.next/server/app/api/agents/add/route.js.nft.json +1 -1
- package/.next/server/app/api/agents/file/route.js +1 -1
- package/.next/server/app/api/agents/file/route.js.nft.json +1 -1
- package/.next/server/app/api/agents/files/route.js +1 -1
- package/.next/server/app/api/agents/files/route.js.nft.json +1 -1
- package/.next/server/app/api/agents/identity/route.js +1 -1
- package/.next/server/app/api/agents/identity/route.js.nft.json +1 -1
- package/.next/server/app/api/agents/route.js +1 -1
- package/.next/server/app/api/agents/route.js.nft.json +1 -1
- package/.next/server/app/api/agents/skills/install/route.js +1 -1
- package/.next/server/app/api/agents/skills/install/route.js.nft.json +1 -1
- package/.next/server/app/api/agents/skills/route.js +1 -1
- package/.next/server/app/api/agents/skills/route.js.nft.json +1 -1
- package/.next/server/app/api/agents/update/route.js +1 -1
- package/.next/server/app/api/agents/update/route.js.nft.json +1 -1
- package/.next/server/app/api/channels/bindings/route.js +1 -1
- package/.next/server/app/api/channels/bindings/route.js.nft.json +1 -1
- package/.next/server/app/api/cron/delete/route.js +1 -1
- package/.next/server/app/api/cron/delete/route.js.nft.json +1 -1
- package/.next/server/app/api/cron/job/route.js +1 -1
- package/.next/server/app/api/cron/job/route.js.nft.json +1 -1
- package/.next/server/app/api/cron/jobs/route.js +1 -1
- package/.next/server/app/api/cron/jobs/route.js.nft.json +1 -1
- package/.next/server/app/api/cron/recipe-installed/route.js +1 -1
- package/.next/server/app/api/cron/recipe-installed/route.js.nft.json +1 -1
- package/.next/server/app/api/gateway/restart/route.js +1 -1
- package/.next/server/app/api/gateway/restart/route.js.nft.json +1 -1
- package/.next/server/app/api/goals/[id]/promote/route.js +1 -1
- package/.next/server/app/api/goals/[id]/promote/route.js.nft.json +1 -1
- package/.next/server/app/api/goals/[id]/route.js +1 -1
- package/.next/server/app/api/goals/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/goals/route.js +1 -1
- package/.next/server/app/api/goals/route.js.nft.json +1 -1
- package/.next/server/app/api/ids/check/route.js +1 -1
- package/.next/server/app/api/ids/check/route.js.nft.json +1 -1
- package/.next/server/app/api/marketplace/recipes/[slug]/route.js +1 -1
- package/.next/server/app/api/marketplace/recipes/[slug]/route.js.nft.json +1 -1
- package/.next/server/app/api/marketplace/recipes/route.js +1 -1
- package/.next/server/app/api/marketplace/recipes/route.js.nft.json +1 -1
- package/.next/server/app/api/recipes/[id]/route.js +1 -1
- package/.next/server/app/api/recipes/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/recipes/clone/route.js +1 -1
- package/.next/server/app/api/recipes/clone/route.js.nft.json +1 -1
- package/.next/server/app/api/recipes/delete/route.js +1 -1
- package/.next/server/app/api/recipes/delete/route.js.nft.json +1 -1
- package/.next/server/app/api/recipes/route.js +1 -1
- package/.next/server/app/api/recipes/route.js.nft.json +1 -1
- package/.next/server/app/api/recipes/team-agents/route.js +1 -1
- package/.next/server/app/api/recipes/team-agents/route.js.nft.json +1 -1
- package/.next/server/app/api/scaffold/route.js +2 -2
- package/.next/server/app/api/scaffold/route.js.nft.json +1 -1
- package/.next/server/app/api/settings/cron-installation/route.js +1 -1
- package/.next/server/app/api/settings/cron-installation/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/available/route.js +1 -1
- package/.next/server/app/api/skills/available/route.js.nft.json +1 -1
- package/.next/server/app/api/teams/file/route.js +1 -1
- package/.next/server/app/api/teams/file/route.js.nft.json +1 -1
- package/.next/server/app/api/teams/files/route.js +1 -1
- package/.next/server/app/api/teams/files/route.js.nft.json +1 -1
- package/.next/server/app/api/teams/meta/route.js +1 -1
- package/.next/server/app/api/teams/meta/route.js.nft.json +1 -1
- package/.next/server/app/api/teams/remove-team/route.js +1 -1
- package/.next/server/app/api/teams/remove-team/route.js.nft.json +1 -1
- package/.next/server/app/api/teams/skills/install/route.js +1 -1
- package/.next/server/app/api/teams/skills/install/route.js.nft.json +1 -1
- package/.next/server/app/api/teams/skills/route.js +1 -1
- package/.next/server/app/api/teams/skills/route.js.nft.json +1 -1
- package/.next/server/app/api/tickets/move/route.js +1 -1
- package/.next/server/app/api/tickets/move/route.js.nft.json +1 -1
- package/.next/server/app/channels/page.js +1 -1
- package/.next/server/app/channels/page.js.nft.json +1 -1
- package/.next/server/app/channels.html +2 -2
- package/.next/server/app/channels.rsc +1 -1
- package/.next/server/app/channels.segments/_full.segment.rsc +1 -1
- package/.next/server/app/channels.segments/_head.segment.rsc +1 -1
- package/.next/server/app/channels.segments/_index.segment.rsc +1 -1
- package/.next/server/app/channels.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/channels.segments/channels/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/channels.segments/channels.segment.rsc +1 -1
- package/.next/server/app/cron-jobs/page.js +1 -1
- package/.next/server/app/cron-jobs/page.js.nft.json +1 -1
- package/.next/server/app/cron-jobs.html +1 -1
- package/.next/server/app/cron-jobs.rsc +1 -1
- package/.next/server/app/cron-jobs.segments/_full.segment.rsc +1 -1
- package/.next/server/app/cron-jobs.segments/_head.segment.rsc +1 -1
- package/.next/server/app/cron-jobs.segments/_index.segment.rsc +1 -1
- package/.next/server/app/cron-jobs.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/cron-jobs.segments/cron-jobs/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/cron-jobs.segments/cron-jobs.segment.rsc +1 -1
- package/.next/server/app/goals/[id]/page.js +1 -1
- package/.next/server/app/goals/[id]/page.js.nft.json +1 -1
- package/.next/server/app/goals/new/page.js +1 -1
- package/.next/server/app/goals/new/page.js.nft.json +1 -1
- package/.next/server/app/goals/new.html +2 -2
- package/.next/server/app/goals/new.rsc +1 -1
- package/.next/server/app/goals/new.segments/_full.segment.rsc +1 -1
- package/.next/server/app/goals/new.segments/_head.segment.rsc +1 -1
- package/.next/server/app/goals/new.segments/_index.segment.rsc +1 -1
- package/.next/server/app/goals/new.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/goals/new.segments/goals/new/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/goals/new.segments/goals/new.segment.rsc +1 -1
- package/.next/server/app/goals/new.segments/goals.segment.rsc +1 -1
- package/.next/server/app/goals/page.js +1 -1
- package/.next/server/app/goals/page.js.nft.json +1 -1
- package/.next/server/app/goals.html +1 -1
- package/.next/server/app/goals.rsc +1 -1
- package/.next/server/app/goals.segments/_full.segment.rsc +1 -1
- package/.next/server/app/goals.segments/_head.segment.rsc +1 -1
- package/.next/server/app/goals.segments/_index.segment.rsc +1 -1
- package/.next/server/app/goals.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/goals.segments/goals/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/goals.segments/goals.segment.rsc +1 -1
- package/.next/server/app/page.js +3 -3
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/recipes/[id]/page.js +4 -3
- package/.next/server/app/recipes/[id]/page.js.nft.json +1 -1
- package/.next/server/app/recipes/page.js +4 -3
- package/.next/server/app/recipes/page.js.nft.json +1 -1
- package/.next/server/app/recipes/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings/page.js +1 -1
- package/.next/server/app/settings/page.js.nft.json +1 -1
- package/.next/server/app/settings.html +1 -1
- package/.next/server/app/settings.rsc +1 -1
- package/.next/server/app/settings.segments/_full.segment.rsc +1 -1
- package/.next/server/app/settings.segments/_head.segment.rsc +1 -1
- package/.next/server/app/settings.segments/_index.segment.rsc +1 -1
- package/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/settings.segments/settings.segment.rsc +1 -1
- package/.next/server/app/teams/[teamId]/page.js +3 -3
- package/.next/server/app/teams/[teamId]/page.js.nft.json +1 -1
- package/.next/server/app/tickets/[ticket]/page.js +2 -2
- package/.next/server/app/tickets/[ticket]/page.js.nft.json +1 -1
- package/.next/server/app/tickets/page.js +2 -2
- package/.next/server/app/tickets/page.js.nft.json +1 -1
- package/.next/server/app/tickets.html +1 -1
- package/.next/server/app/tickets.rsc +2 -2
- package/.next/server/app/tickets.segments/_full.segment.rsc +2 -2
- package/.next/server/app/tickets.segments/_head.segment.rsc +1 -1
- package/.next/server/app/tickets.segments/_index.segment.rsc +1 -1
- package/.next/server/app/tickets.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/tickets.segments/tickets/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/tickets.segments/tickets.segment.rsc +1 -1
- package/.next/server/chunks/[root-of-the-server]__055885ce._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__055885ce._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__0c01c5c7._.js +10 -0
- package/.next/server/chunks/[root-of-the-server]__0c01c5c7._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__1398a33a._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1398a33a._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__159c002b._.js +8 -0
- package/.next/server/chunks/[root-of-the-server]__159c002b._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__20c60fb7._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__20c60fb7._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__2588560d._.js +6 -0
- package/.next/server/chunks/[root-of-the-server]__2588560d._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__27293e91._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__27293e91._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__29c85a51._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__29c85a51._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__29fa8108._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__29fa8108._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__2bd44067._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__2bd44067._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__2dd1afff._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__2dd1afff._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__401ab759._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__401ab759._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__422c7160._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__422c7160._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__4670294e._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__4670294e._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__4898071c._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__4898071c._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__4eda99a9._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__4eda99a9._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__54478298._.js +8 -0
- package/.next/server/chunks/[root-of-the-server]__54478298._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__6dbdb384._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__6dbdb384._.js.map +1 -0
- package/.next/server/chunks/{[root-of-the-server]__dc6c67a5._.js → [root-of-the-server]__74b80ca4._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__94d68aa3._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__94d68aa3._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__9ecbb339._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__9ecbb339._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__a27f8405._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__a27f8405._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__a6ac3ddf._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__a6ac3ddf._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__b11231a9._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__b11231a9._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__b59b3cdd._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__b59b3cdd._.js.map +1 -0
- package/.next/server/chunks/{[root-of-the-server]__94ebcd84._.js → [root-of-the-server]__b5c2b370._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__b955e35a._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__b955e35a._.js.map +1 -0
- package/.next/server/chunks/{[root-of-the-server]__920d7db4._.js → [root-of-the-server]__be5f57b2._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__c4ff0427._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__c4ff0427._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__c4ffbb03._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__c4ffbb03._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__d737ca42._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__d737ca42._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__df7df3ac._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__df7df3ac._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__dfca6557._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__dfca6557._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__e6184ba3._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__e6184ba3._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__ed0323e9._.js +8 -0
- package/.next/server/chunks/[root-of-the-server]__ed0323e9._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__f585823b._.js +6 -0
- package/.next/server/chunks/[root-of-the-server]__f585823b._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__ff940674._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__ff940674._.js.map +1 -0
- package/.next/server/chunks/src_lib_d2210cbf._.js +3 -0
- package/.next/server/chunks/src_lib_d2210cbf._.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__4393e897._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__4393e897._.js.map +1 -0
- package/.next/server/chunks/ssr/{[root-of-the-server]__ae77070e._.js → [root-of-the-server]__4c6cc96d._.js} +2 -2
- package/.next/server/chunks/ssr/[root-of-the-server]__4c6cc96d._.js.map +1 -0
- package/.next/server/chunks/ssr/{[root-of-the-server]__b6de1782._.js → [root-of-the-server]__507d2fc9._.js} +2 -2
- package/.next/server/chunks/ssr/{[root-of-the-server]__c72e7548._.js → [root-of-the-server]__7180d770._.js} +2 -2
- package/.next/server/chunks/ssr/[root-of-the-server]__7180d770._.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__82ce3aee._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__82ce3aee._.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__8d24c9c3._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__8d24c9c3._.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__bc3b27b0._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__bc3b27b0._.js.map +1 -0
- package/.next/server/chunks/ssr/{[root-of-the-server]__72721a7e._.js → [root-of-the-server]__f75a61bf._.js} +2 -2
- package/.next/server/chunks/ssr/_1aad1d9b._.js +24 -0
- package/.next/server/chunks/ssr/_1aad1d9b._.js.map +1 -0
- package/.next/server/chunks/ssr/{node_modules_next_aefa2538._.js → _da6f800e._.js} +2 -2
- package/.next/server/chunks/ssr/_da6f800e._.js.map +1 -0
- package/.next/server/chunks/ssr/src_app_agents_[agentId]_agent-editor_tsx_f85bbe65._.js +1 -1
- package/.next/server/chunks/ssr/src_app_agents_[agentId]_agent-editor_tsx_f85bbe65._.js.map +1 -1
- package/.next/server/chunks/ssr/src_app_recipes_recipes-client_tsx_8ed3ca94._.js +1 -1
- package/.next/server/chunks/ssr/src_app_recipes_recipes-client_tsx_8ed3ca94._.js.map +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +2 -2
- package/.next/static/chunks/{a33f8641aafb9e7f.js → 54beb791bcc086ae.js} +1 -1
- package/.next/static/chunks/55866d57aa2c7a9c.js +1 -0
- package/openclaw/index.ts +4 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/src/app/agents/[agentId]/agent-editor.tsx +66 -23
- package/src/app/api/agents/[id]/route.ts +37 -0
- package/src/app/api/agents/add/route.ts +7 -7
- package/src/app/api/agents/files/route.ts +3 -1
- package/src/app/api/agents/skills/install/route.ts +27 -3
- package/src/app/api/agents/skills/route.ts +28 -12
- package/src/app/api/goals/[id]/promote/route.ts +12 -18
- package/src/app/api/recipes/team-agents/route.ts +1 -1
- package/src/app/api/teams/skills/install/route.ts +3 -1
- package/src/app/api/tickets/move/route.ts +3 -4
- package/src/app/recipes/[id]/page.tsx +7 -0
- package/src/app/recipes/page.tsx +7 -0
- package/src/app/recipes/recipes-client.tsx +0 -5
- package/src/lib/agent-workspace.ts +14 -0
- package/src/lib/gateway.ts +5 -8
- package/src/lib/kitchen-api.ts +19 -0
- package/src/lib/openclaw.ts +28 -26
- package/src/lib/paths.ts +4 -3
- package/src/proxy.ts +2 -2
- package/.next/server/app/recipes.html +0 -1
- package/.next/server/app/recipes.meta +0 -15
- package/.next/server/app/recipes.rsc +0 -21
- package/.next/server/app/recipes.segments/_full.segment.rsc +0 -21
- package/.next/server/app/recipes.segments/_head.segment.rsc +0 -6
- package/.next/server/app/recipes.segments/_index.segment.rsc +0 -6
- package/.next/server/app/recipes.segments/_tree.segment.rsc +0 -4
- package/.next/server/app/recipes.segments/recipes/__PAGE__.segment.rsc +0 -10
- package/.next/server/app/recipes.segments/recipes.segment.rsc +0 -4
- package/.next/server/chunks/[root-of-the-server]__02ebb205._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__02ebb205._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__0761ac0a._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0761ac0a._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__0a87d140._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0a87d140._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__13e03a23._.js +0 -8
- package/.next/server/chunks/[root-of-the-server]__13e03a23._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__16252fca._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__16252fca._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__1ab15cc6._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1ab15cc6._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__1cb96385._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1cb96385._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__20cb8aee._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__20cb8aee._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__22a29d25._.js +0 -6
- package/.next/server/chunks/[root-of-the-server]__22a29d25._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__2369d373._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__2369d373._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__24fa7b94._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__24fa7b94._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__2c9b0df9._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__2c9b0df9._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__2ffbbf0e._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__2ffbbf0e._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__394097c4._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__394097c4._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__457a879e._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__457a879e._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__4ae35c7d._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__4ae35c7d._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__4d1845bd._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__4d1845bd._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__593499ba._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__593499ba._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__69bcd4b9._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__69bcd4b9._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__7f23701b._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__7f23701b._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__8f127b48._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__8f127b48._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__93e05771._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__93e05771._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__9a65704e._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__9a65704e._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__b76a826e._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__b76a826e._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__baf1631b._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__baf1631b._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__bfd1044e._.js +0 -8
- package/.next/server/chunks/[root-of-the-server]__bfd1044e._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__c4a25b8f._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__c4a25b8f._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__c4e76686._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__c4e76686._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__c6906128._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__c6906128._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__c8eb444c._.js +0 -8
- package/.next/server/chunks/[root-of-the-server]__c8eb444c._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__e28b8399._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__e28b8399._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__e31f8972._.js +0 -10
- package/.next/server/chunks/[root-of-the-server]__e31f8972._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__fee3f59e._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__fee3f59e._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__fff0b9c4._.js +0 -6
- package/.next/server/chunks/[root-of-the-server]__fff0b9c4._.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__277a8350._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__277a8350._.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__7458e8cf._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__7458e8cf._.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__8aa0b951._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__8aa0b951._.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__91b2c698._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__91b2c698._.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__ae77070e._.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__c72e7548._.js.map +0 -1
- package/.next/server/chunks/ssr/node_modules_next_aefa2538._.js.map +0 -1
- package/.next/static/chunks/4fb7740933125c6a.js +0 -1
- /package/.next/server/chunks/{[root-of-the-server]__dc6c67a5._.js.map → [root-of-the-server]__74b80ca4._.js.map} +0 -0
- /package/.next/server/chunks/{[root-of-the-server]__94ebcd84._.js.map → [root-of-the-server]__b5c2b370._.js.map} +0 -0
- /package/.next/server/chunks/{[root-of-the-server]__920d7db4._.js.map → [root-of-the-server]__be5f57b2._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{[root-of-the-server]__b6de1782._.js.map → [root-of-the-server]__507d2fc9._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{[root-of-the-server]__72721a7e._.js.map → [root-of-the-server]__f75a61bf._.js.map} +0 -0
- /package/.next/static/{8pxUnfVjZMQrso_jWABg7 → uZkSG3UgZ81MwaAQa74zD}/_buildManifest.js +0 -0
- /package/.next/static/{8pxUnfVjZMQrso_jWABg7 → uZkSG3UgZ81MwaAQa74zD}/_clientMiddlewareManifest.json +0 -0
- /package/.next/static/{8pxUnfVjZMQrso_jWABg7 → uZkSG3UgZ81MwaAQa74zD}/_ssgManifest.js +0 -0
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
module.exports=[70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},12714,(e,t,r)=>{t.exports=e.x("node:fs/promises",()=>require("node:fs/promises"))},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},7367,e=>{"use strict";var t=e.i(12714),r=e.i(50227);async function n(){let e=r.default.join(process.env.HOME||"",".openclaw","openclaw.json");return JSON.parse(await t.default.readFile(e,"utf8"))}async function a(){let e=await n(),t=e.agents?.defaults?.workspace;if(!t)throw Error("agents.defaults.workspace is not set in ~/.openclaw/openclaw.json");return t}async function s(){let e=await a();return r.default.join(e,"recipes")}async function i(){let e=await a();return r.default.join(e,"notes","goals")}async function o(e){let t=process.env.HOME||"";if(!t)throw Error("HOME is not set");return r.default.join(t,".openclaw",`workspace-${e}`)}async function l(){let e=await n(),t=e.plugins?.installs?.recipes?.installPath||e.plugins?.installs?.recipes?.sourcePath||e.plugins?.load?.paths?.[0];if(!t)throw Error("Could not determine recipes plugin install path from ~/.openclaw/openclaw.json");return r.default.join(t,"recipes","default")}e.s(["getBuiltinRecipesDir",()=>l,"getTeamWorkspaceDir",()=>o,"getWorkspaceDir",()=>a,"getWorkspaceGoalsDir",()=>i,"getWorkspaceRecipesDir",()=>s,"readOpenClawConfig",()=>n])},74533,(e,t,r)=>{t.exports=e.x("node:child_process",()=>require("node:child_process"))},12057,(e,t,r)=>{t.exports=e.x("node:util",()=>require("node:util"))},5003,e=>{"use strict";var t=e.i(74533);let r=(0,e.i(12057).promisify)(t.execFile);async function n(e){try{let{stdout:t,stderr:n}=await r("openclaw",e,{maxBuffer:0xa00000,env:process.env});return{ok:!0,exitCode:0,stdout:t?.toString()??"",stderr:n?.toString()??""}}catch(t){let e="number"==typeof t.code?t.code:1;return{ok:!1,exitCode:e,stdout:"string"==typeof t.stdout?t.stdout:t.stdout&&"object"==typeof t.stdout&&"toString"in t.stdout?String(t.stdout.toString()):"",stderr:"string"==typeof t.stderr?t.stderr:t.stderr&&"object"==typeof t.stderr&&"toString"in t.stderr?String(t.stderr.toString()):"string"==typeof t.message?t.message:String(t)}}}e.s(["runOpenClaw",()=>n])},5365,(e,t,r)=>{t.exports=e.x("process",()=>require("process"))},874,(e,t,r)=>{t.exports=e.x("buffer",()=>require("buffer"))},72915,e=>{"use strict";var t=e.i(12714),r=e.i(50227),n=e.i(23008),a=e.i(7367);function s(e){if(!e.startsWith("---\n"))throw Error("Recipe markdown must start with YAML frontmatter (---)");let t=e.indexOf("\n---\n",4);if(-1===t)throw Error("Recipe frontmatter not terminated (---)");let r=e.slice(4,t+1),a=n.default.parse(r);if(!a?.id)throw Error("Recipe frontmatter must include id");return a.id}async function i(e){let t="builtin"===e.source?await (0,a.getBuiltinRecipesDir)():await (0,a.getWorkspaceRecipesDir)();return r.default.join(t,`${e.id}.md`)}async function o(e,n){await t.default.mkdir(r.default.dirname(e),{recursive:!0}),await t.default.writeFile(e,n,"utf8")}e.s(["parseFrontmatterId",()=>s,"resolveRecipePath",()=>i,"writeRecipeFile",()=>o])},68120,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250),a=e.i(59756),s=e.i(61916),i=e.i(74677),o=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),p=e.i(47587),c=e.i(66012),f=e.i(70101),h=e.i(26937),g=e.i(10372),w=e.i(93695);e.i(52474);var x=e.i(220),m=e.i(89171),R=e.i(5003),v=e.i(72915),y=e.i(12714),k=e.i(50227);async function E(e){let t=String((await e.json()).id??"").trim();if(!t)return m.NextResponse.json({ok:!1,error:"id is required"},{status:400});let r=await (0,R.runOpenClaw)(["recipes","list"]);if(!r.ok)return m.NextResponse.json({ok:!1,error:r.stderr.trim()||"Failed to list recipes"},{status:500});let n=[];try{n=JSON.parse(r.stdout)}catch{return m.NextResponse.json({ok:!1,error:"Failed to parse recipes list"},{status:500})}let a=n.find(e=>e.id===t);if(!a)return m.NextResponse.json({ok:!1,error:`Recipe not found: ${t}`},{status:404});if("builtin"===a.source)return m.NextResponse.json({ok:!1,error:`Recipe ${t} is builtin and cannot be deleted`},{status:403});let s=(await (0,R.runOpenClaw)(["config","get","agents.defaults.workspace"]))?.stdout?.trim();if(!s)return m.NextResponse.json({ok:!1,error:"agents.defaults.workspace is not set"},{status:500});let i=k.default.resolve(s,"recipes")+k.default.sep,o=await (0,v.resolveRecipePath)(a),l=k.default.resolve(o);if(!l.startsWith(i))return m.NextResponse.json({ok:!1,error:`Refusing to delete non-workspace recipe path: ${l}`},{status:403});let d=a.kind??"team";if("team"===d){let e=k.default.resolve(s,".."),r=[];try{for(let n of(await y.default.readdir(e,{withFileTypes:!0})).filter(e=>e.isDirectory()&&e.name.startsWith("workspace-"))){let a=k.default.join(e,n.name,"team.json");try{let e=await y.default.readFile(a,"utf8"),s=JSON.parse(e);String(s.recipeId??"").trim()===t&&r.push(String(s.teamId??n.name.replace(/^workspace-/,"")).trim()||n.name)}catch{}}}catch{}if(r.length)return m.NextResponse.json({ok:!1,error:`Team ${t} is in use by installed team(s): ${r.join(", ")}. Remove the team(s) first, then delete the recipe. If no team is shown, you still have a .openclaw/workspace-${t} folder. Please remove the folder to delete this recipe.`,details:{attachedTeams:r}},{status:409})}if("agent"===d){let e=await (0,R.runOpenClaw)(["agents","list","--json"]),r=[],n=!1;if(e.ok)try{let a=JSON.parse(e.stdout);for(let e of(n=a.some(e=>String(e.id??"").trim()===t),a)){let n=String(e.id??"").trim();if(!n)continue;let a=k.default.join(s,"agents",n,"agent.json");try{let e=await y.default.readFile(a,"utf8"),s=JSON.parse(e);String(s.recipeId??"").trim()===t&&r.push(n)}catch{}}}catch{}if(n)return m.NextResponse.json({ok:!1,error:`Agent recipe ${t} cannot be deleted because an active agent exists with the same id: ${t}. Delete the agent first, then delete the recipe.`,details:{agentId:t}},{status:409});if(r.length)return m.NextResponse.json({ok:!1,error:`Agent recipe ${t} is in use by active agent(s): ${r.join(", ")}. Delete the agent(s) first, then delete the recipe.`,details:{attachedAgents:r}},{status:409})}return await y.default.rm(l,{force:!0}),m.NextResponse.json({ok:!0,deleted:l})}e.s(["POST",()=>E],90138);var j=e.i(90138);let C=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/recipes/delete/route",pathname:"/api/recipes/delete",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/recipes/delete/route.ts",nextConfigOutput:"standalone",userland:j}),{workAsyncStorage:b,workUnitAsyncStorage:S,serverHooks:N}=C;function O(){return(0,n.patchFetch)({workAsyncStorage:b,workUnitAsyncStorage:S})}async function A(e,t,n){C.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let m="/api/recipes/delete/route";m=m.replace(/\/index$/,"")||"/";let R=await C.prepare(e,t,{srcPage:m,multiZoneDraftMode:!1});if(!R)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:v,params:y,nextConfig:k,parsedUrl:E,isDraftMode:j,prerenderManifest:b,routerServerContext:S,isOnDemandRevalidate:N,revalidateOnlyGenerated:O,resolvedPathname:A,clientReferenceManifest:P,serverActionsManifest:T}=R,q=(0,o.normalizeAppPath)(m),D=!!(b.dynamicRoutes[q]||b.routes[A]),_=async()=>((null==S?void 0:S.render404)?await S.render404(e,t,E,!1):t.end("This page could not be found"),null);if(D&&!j){let e=!!b.routes[A],t=b.dynamicRoutes[q];if(t&&!1===t.fallback&&!e){if(k.experimental.adapterPath)return await _();throw new w.NoFallbackError}}let I=null;!D||C.isDev||j||(I="/index"===(I=A)?"/":I);let $=!0===C.isDev||!D,H=D&&!$;T&&P&&(0,i.setManifestsSingleton)({page:m,clientReferenceManifest:P,serverActionsManifest:T});let F=e.method||"GET",M=(0,s.getTracer)(),U=M.getActiveScopeSpan(),W={params:y,prerenderManifest:b,renderOpts:{experimental:{authInterrupts:!!k.experimental.authInterrupts},cacheComponents:!!k.cacheComponents,supportsDynamicResponse:$,incrementalCache:(0,a.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:k.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,a)=>C.onRequestError(e,t,n,a,S)},sharedContext:{buildId:v}},B=new l.NodeNextRequest(e),K=new l.NodeNextResponse(t),L=d.NextRequestAdapter.fromNodeNextRequest(B,(0,d.signalFromNodeResponse)(t));try{let i=async e=>C.handle(L,W).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=M.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=r.get("next.route");if(n){let t=`${F} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t)}else e.updateName(`${F} ${m}`)}),o=!!(0,a.getRequestMeta)(e,"minimalMode"),l=async a=>{var s,l;let d=async({previousCacheEntry:r})=>{try{if(!o&&N&&O&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await i(a);e.fetchMetrics=W.renderOpts.fetchMetrics;let l=W.renderOpts.pendingWaitUntil;l&&n.waitUntil&&(n.waitUntil(l),l=void 0);let d=W.renderOpts.collectedTags;if(!D)return await (0,c.sendResponse)(B,K,s,W.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(s.headers);d&&(t[g.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==W.renderOpts.collectedRevalidate&&!(W.renderOpts.collectedRevalidate>=g.INFINITE_CACHE)&&W.renderOpts.collectedRevalidate,n=void 0===W.renderOpts.collectedExpire||W.renderOpts.collectedExpire>=g.INFINITE_CACHE?void 0:W.renderOpts.collectedExpire;return{value:{kind:x.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await C.onRequestError(e,t,{routerKind:"App Router",routePath:m,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:N})},!1,S),t}},u=await C.handleResponse({req:e,nextConfig:k,cacheKey:I,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:b,isRoutePPREnabled:!1,isOnDemandRevalidate:N,revalidateOnlyGenerated:O,responseGenerator:d,waitUntil:n.waitUntil,isMinimalMode:o});if(!D)return null;if((null==u||null==(s=u.value)?void 0:s.kind)!==x.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(l=u.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});o||t.setHeader("x-nextjs-cache",N?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),j&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let w=(0,f.fromNodeOutgoingHttpHeaders)(u.value.headers);return o&&D||w.delete(g.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||w.get("Cache-Control")||w.set("Cache-Control",(0,h.getCacheControlHeader)(u.cacheControl)),await (0,c.sendResponse)(B,K,new Response(u.value.body,{headers:w,status:u.value.status||200})),null};U?await l(U):await M.withPropagatedContext(e.headers,()=>M.trace(u.BaseServerSpan.handleRequest,{spanName:`${F} ${m}`,kind:s.SpanKind.SERVER,attributes:{"http.method":F,"http.target":e.url}},l))}catch(t){if(t instanceof w.NoFallbackError||await C.onRequestError(e,t,{routerKind:"App Router",routePath:q,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:N})},!1,S),D)throw t;return await (0,c.sendResponse)(B,K,new Response(null,{status:500})),null}}e.s(["handler",()=>A,"patchFetch",()=>O,"routeModule",()=>C,"serverHooks",()=>N,"workAsyncStorage",()=>b,"workUnitAsyncStorage",()=>S],68120)}];
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__e28b8399._.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/paths.ts","../../../src/lib/openclaw.ts","../../../src/lib/recipes.ts","../../../src/app/api/recipes/delete/route.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import fs from \"node:fs/promises\";\nimport path from \"node:path\";\n\ntype OpenClawConfig = {\n agents?: { defaults?: { workspace?: string } };\n gateway?: { port?: number; auth?: { token?: string } };\n tools?: {\n agentToAgent?: {\n enabled?: boolean;\n allow?: string[];\n };\n };\n plugins?: {\n installs?: { recipes?: { installPath?: string; sourcePath?: string } };\n load?: { paths?: string[] };\n };\n};\n\nexport async function readOpenClawConfig(): Promise<OpenClawConfig> {\n const p = path.join(process.env.HOME || \"\", \".openclaw\", \"openclaw.json\");\n const text = await fs.readFile(p, \"utf8\");\n return JSON.parse(text) as OpenClawConfig;\n}\n\nexport async function getWorkspaceDir() {\n const cfg = await readOpenClawConfig();\n const ws = cfg.agents?.defaults?.workspace;\n if (!ws) throw new Error(\"agents.defaults.workspace is not set in ~/.openclaw/openclaw.json\");\n return ws;\n}\n\nexport async function getWorkspaceRecipesDir() {\n const ws = await getWorkspaceDir();\n return path.join(ws, \"recipes\");\n}\n\nexport async function getWorkspaceGoalsDir() {\n const ws = await getWorkspaceDir();\n return path.join(ws, \"notes\", \"goals\");\n}\n\nexport async function getTeamWorkspaceDir(teamId: string) {\n const home = process.env.HOME || \"\";\n if (!home) throw new Error(\"HOME is not set\");\n return path.join(home, \".openclaw\", `workspace-${teamId}`);\n}\n\nexport async function getBuiltinRecipesDir() {\n const cfg = await readOpenClawConfig();\n const p =\n cfg.plugins?.installs?.recipes?.installPath ||\n cfg.plugins?.installs?.recipes?.sourcePath ||\n cfg.plugins?.load?.paths?.[0];\n if (!p) throw new Error(\"Could not determine recipes plugin install path from ~/.openclaw/openclaw.json\");\n return path.join(p, \"recipes\", \"default\");\n}\n","import { execFile } from \"node:child_process\";\nimport { promisify } from \"node:util\";\n\nconst execFileAsync = promisify(execFile);\n\nexport type OpenClawExecResult = {\n ok: boolean;\n exitCode: number;\n stdout: string;\n stderr: string;\n};\n\nexport async function runOpenClaw(args: string[]): Promise<OpenClawExecResult> {\n // Use execFile (no shell) for safety.\n try {\n const { stdout, stderr } = await execFileAsync(\"openclaw\", args, {\n maxBuffer: 10 * 1024 * 1024,\n env: process.env,\n });\n return { ok: true, exitCode: 0, stdout: stdout?.toString() ?? \"\", stderr: stderr?.toString() ?? \"\" };\n } catch (e: unknown) {\n // execFile throws on non-zero exit; it often includes stdout/stderr.\n const err = e as { code?: unknown; stdout?: unknown; stderr?: unknown; message?: unknown };\n const exitCode = typeof err.code === \"number\" ? err.code : 1;\n\n const stdout =\n typeof err.stdout === \"string\" ? err.stdout : err.stdout && typeof err.stdout === \"object\" && \"toString\" in err.stdout\n ? String((err.stdout as { toString: () => string }).toString())\n : \"\";\n\n const stderr =\n typeof err.stderr === \"string\"\n ? err.stderr\n : err.stderr && typeof err.stderr === \"object\" && \"toString\" in err.stderr\n ? String((err.stderr as { toString: () => string }).toString())\n : typeof err.message === \"string\"\n ? err.message\n : String(e);\n\n return { ok: false, exitCode, stdout, stderr };\n }\n}\n","import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport YAML from \"yaml\";\nimport { getBuiltinRecipesDir, getWorkspaceRecipesDir } from \"./paths\";\n\nexport type RecipeListItem = {\n id: string;\n name: string;\n kind: \"agent\" | \"team\";\n source: \"builtin\" | \"workspace\";\n};\n\nexport type RecipeDetail = RecipeListItem & {\n content: string;\n filePath: string | null;\n};\n\nexport function parseFrontmatterId(md: string): string {\n if (!md.startsWith(\"---\\n\")) throw new Error(\"Recipe markdown must start with YAML frontmatter (---)\");\n const end = md.indexOf(\"\\n---\\n\", 4);\n if (end === -1) throw new Error(\"Recipe frontmatter not terminated (---)\");\n const yamlText = md.slice(4, end + 1);\n const fm = YAML.parse(yamlText) as { id?: string };\n if (!fm?.id) throw new Error(\"Recipe frontmatter must include id\");\n return fm.id;\n}\n\nexport async function resolveRecipePath(item: RecipeListItem): Promise<string> {\n const dir = item.source === \"builtin\" ? await getBuiltinRecipesDir() : await getWorkspaceRecipesDir();\n // Current convention: <id>.md in the directory.\n return path.join(dir, `${item.id}.md`);\n}\n\nexport async function readRecipe(item: RecipeListItem, contentFromCli: string): Promise<RecipeDetail> {\n // Prefer CLI-provided markdown, but also compute path for saving.\n let filePath: string | null = null;\n try {\n filePath = await resolveRecipePath(item);\n } catch {\n filePath = null;\n }\n return { ...item, content: contentFromCli, filePath };\n}\n\nexport async function writeRecipeFile(filePath: string, md: string) {\n await fs.mkdir(path.dirname(filePath), { recursive: true });\n await fs.writeFile(filePath, md, \"utf8\");\n}\n","import { NextResponse } from \"next/server\";\nimport { runOpenClaw } from \"@/lib/openclaw\";\nimport { resolveRecipePath, type RecipeListItem } from \"@/lib/recipes\";\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\n\nexport async function POST(req: Request) {\n const body = (await req.json()) as { id?: string };\n const id = String(body.id ?? \"\").trim();\n if (!id) return NextResponse.json({ ok: false, error: \"id is required\" }, { status: 400 });\n\n // Look up recipe source/path.\n const list = await runOpenClaw([\"recipes\", \"list\"]);\n if (!list.ok) {\n return NextResponse.json({ ok: false, error: list.stderr.trim() || \"Failed to list recipes\" }, { status: 500 });\n }\n\n let recipes: RecipeListItem[] = [];\n try {\n recipes = JSON.parse(list.stdout) as RecipeListItem[];\n } catch {\n return NextResponse.json({ ok: false, error: \"Failed to parse recipes list\" }, { status: 500 });\n }\n\n const item = recipes.find((r) => r.id === id);\n if (!item) return NextResponse.json({ ok: false, error: `Recipe not found: ${id}` }, { status: 404 });\n if (item.source === \"builtin\") {\n return NextResponse.json({ ok: false, error: `Recipe ${id} is builtin and cannot be deleted` }, { status: 403 });\n }\n\n // Safety: only allow deleting files inside the workspace recipes directory.\n const workspaceRoot = (await runOpenClaw([\"config\", \"get\", \"agents.defaults.workspace\"]))?.stdout?.trim();\n if (!workspaceRoot) {\n return NextResponse.json({ ok: false, error: \"agents.defaults.workspace is not set\" }, { status: 500 });\n }\n const allowedDir = path.resolve(workspaceRoot, \"recipes\") + path.sep;\n\n const filePath = await resolveRecipePath(item);\n const resolved = path.resolve(filePath);\n if (!resolved.startsWith(allowedDir)) {\n return NextResponse.json({ ok: false, error: `Refusing to delete non-workspace recipe path: ${resolved}` }, { status: 403 });\n }\n\n const kind = (item.kind ?? \"team\") as \"team\" | \"agent\";\n\n // Block deletion if this recipe appears in use.\n if (kind === \"team\") {\n // A team recipe can scaffold many teams with different teamIds.\n // We treat any workspace-*/team.json referencing this recipe as \"in use\".\n const teamsRoot = path.resolve(workspaceRoot, \"..\");\n const attachedTeams: string[] = [];\n\n try {\n const entries = await fs.readdir(teamsRoot, { withFileTypes: true });\n const workspaceDirs = entries.filter((e) => e.isDirectory() && e.name.startsWith(\"workspace-\"));\n for (const dirent of workspaceDirs) {\n const metaPath = path.join(teamsRoot, dirent.name, \"team.json\");\n try {\n const raw = await fs.readFile(metaPath, \"utf8\");\n const meta = JSON.parse(raw) as { recipeId?: unknown; teamId?: unknown };\n if (String(meta.recipeId ?? \"\").trim() === id) {\n attachedTeams.push(String(meta.teamId ?? dirent.name.replace(/^workspace-/, \"\")).trim() || dirent.name);\n }\n } catch {\n // ignore missing/unparseable\n }\n }\n } catch {\n // ignore\n }\n\n if (attachedTeams.length) {\n return NextResponse.json(\n {\n ok: false,\n error: `Team ${id} is in use by installed team(s): ${attachedTeams.join(\", \")}. Remove the team(s) first, then delete the recipe. If no team is shown, you still have a .openclaw/workspace-${id} folder. Please remove the folder to delete this recipe.`, \n details: { attachedTeams },\n },\n { status: 409 },\n );\n }\n }\n\n if (kind === \"agent\") {\n // Agent recipes can scaffold many agents with different agentIds.\n // We treat any agents/<agentId>/agent.json referencing this recipe as \"in use\".\n // Additionally, if an active agent exists with the SAME id as the recipe, we must block deletion\n // (older installs may not have agent.json provenance yet).\n const agentsRes = await runOpenClaw([\"agents\", \"list\", \"--json\"]);\n const attachedAgents: string[] = [];\n let hasSameIdAgent = false;\n\n if (agentsRes.ok) {\n try {\n const agents = JSON.parse(agentsRes.stdout) as Array<{ id?: unknown }>;\n hasSameIdAgent = agents.some((a) => String(a.id ?? \"\").trim() === id);\n\n for (const a of agents) {\n const agentId = String(a.id ?? \"\").trim();\n if (!agentId) continue;\n const metaPath = path.join(workspaceRoot, \"agents\", agentId, \"agent.json\");\n try {\n const raw = await fs.readFile(metaPath, \"utf8\");\n const meta = JSON.parse(raw) as { recipeId?: unknown };\n if (String(meta.recipeId ?? \"\").trim() === id) attachedAgents.push(agentId);\n } catch {\n // ignore missing/unparseable\n }\n }\n } catch {\n // ignore\n }\n }\n\n if (hasSameIdAgent) {\n return NextResponse.json(\n {\n ok: false,\n error: `Agent recipe ${id} cannot be deleted because an active agent exists with the same id: ${id}. Delete the agent first, then delete the recipe.`,\n details: { agentId: id },\n },\n { status: 409 },\n );\n }\n\n if (attachedAgents.length) {\n return NextResponse.json(\n {\n ok: false,\n error: `Agent recipe ${id} is in use by active agent(s): ${attachedAgents.join(\", \")}. Delete the agent(s) first, then delete the recipe.`,\n details: { attachedAgents },\n },\n { status: 409 },\n );\n }\n }\n\n await fs.rm(resolved, { force: true });\n return NextResponse.json({ ok: true, deleted: resolved });\n}\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"standalone\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/recipes/delete/route\",\n pathname: \"/api/recipes/delete\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/src/app/api/recipes/delete/route.ts\",\n nextConfigOutput,\n userland\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/recipes/delete/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.experimental.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, 'incrementalCache'),\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const isMinimalMode = Boolean(process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode'));\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (activeSpan) {\n await handleResponse(activeSpan);\n } else {\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse));\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n"],"names":[],"mappings":"0oCAAA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAiBO,eAAe,IACpB,IAAM,EAAI,EAAA,OAAI,CAAC,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,EAAI,GAAI,YAAa,iBAEzD,OAAO,KAAK,KAAK,CAAC,AADL,MAAM,EAAA,OAAE,CAAC,QAAQ,CAAC,EAAG,QAEpC,CAEO,eAAe,IACpB,IAAM,EAAM,MAAM,IACZ,EAAK,EAAI,MAAM,EAAE,UAAU,UACjC,GAAI,CAAC,EAAI,MAAM,AAAI,MAAM,qEACzB,OAAO,CACT,CAEO,eAAe,IACpB,IAAM,EAAK,MAAM,IACjB,OAAO,EAAA,OAAI,CAAC,IAAI,CAAC,EAAI,UACvB,CAEO,eAAe,IACpB,IAAM,EAAK,MAAM,IACjB,OAAO,EAAA,OAAI,CAAC,IAAI,CAAC,EAAI,QAAS,QAChC,CAEO,eAAe,EAAoB,CAAc,EACtD,IAAM,EAAO,QAAQ,GAAG,CAAC,IAAI,EAAI,GACjC,GAAI,CAAC,EAAM,MAAM,AAAI,MAAM,mBAC3B,OAAO,EAAA,OAAI,CAAC,IAAI,CAAC,EAAM,YAAa,CAAC,UAAU,EAAE,EAAA,CAAQ,CAC3D,CAEO,eAAe,IACpB,IAAM,EAAM,MAAM,IACZ,EACJ,EAAI,OAAO,EAA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,AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,EAEA,qCAAqC","ignoreList":[4]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
module.exports=[70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},12714,(e,t,r)=>{t.exports=e.x("node:fs/promises",()=>require("node:fs/promises"))},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},74533,(e,t,r)=>{t.exports=e.x("node:child_process",()=>require("node:child_process"))},12057,(e,t,r)=>{t.exports=e.x("node:util",()=>require("node:util"))},47407,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),n=e.i(59756),i=e.i(61916),s=e.i(74677),o=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),p=e.i(47587),c=e.i(66012),m=e.i(70101),x=e.i(26937),h=e.i(10372),g=e.i(93695);e.i(52474);var f=e.i(220),w=e.i(74533),v=e.i(12714),R=e.i(50227),E=e.i(12057),y=e.i(89171);let C=(0,E.promisify)(w.execFile);async function A(e){try{let t=await e.json(),r=function(e){let t=e.trim();if(!t)throw Error("agent id is required");if(!/^[a-z0-9][a-z0-9-]{0,62}$/i.test(t))throw Error("agent id must match /^[a-z0-9][a-z0-9-]{0,62}$/i");return t}(String(t.newAgentId??t.agentId??"")),a=!!t.overwrite,n=R.default.join(process.env.HOME||"",".openclaw","openclaw.json");if(!process.env.HOME)return y.NextResponse.json({ok:!1,error:"HOME is not set"},{status:500});let i=await v.default.readFile(n,"utf8"),s=JSON.parse(i),o=String(s?.agents?.defaults?.workspace??"").trim();if(!o)return y.NextResponse.json({ok:!1,error:"agents.defaults.workspace not set"},{status:500});let l=R.default.resolve(o,"..",`workspace-${r}`),d=Array.isArray(s?.agents?.list)?s.agents?.list:[],u=d.some(e=>String(e?.id??"").toLowerCase()===r.toLowerCase());if(u&&!a)return y.NextResponse.json({ok:!1,error:`Agent already exists: ${r}`},{status:409});let p={id:r,workspace:l,...t.model?{model:t.model}:{},identity:{..."string"==typeof t.name&&t.name.trim()?{name:t.name.trim()}:{},..."string"==typeof t.theme&&t.theme.trim()?{theme:t.theme.trim()}:{},..."string"==typeof t.emoji&&t.emoji.trim()?{emoji:t.emoji.trim()}:{},..."string"==typeof t.avatar&&t.avatar.trim()?{avatar:t.avatar.trim()}:{}}},c=u?d.map(e=>String(e?.id??"").toLowerCase()===r.toLowerCase()?p:e):[...d,p];await v.default.mkdir(l,{recursive:!0});let m=`# IDENTITY.md
|
|
2
|
-
|
|
3
|
-
- **Name:** ${String(t.name??"").trim()||r}
|
|
4
|
-
- **Creature:**
|
|
5
|
-
- **Vibe:**
|
|
6
|
-
- **Emoji:** ${String(t.emoji??"").trim()}
|
|
7
|
-
- **Avatar:** ${String(t.avatar??"").trim()}
|
|
8
|
-
`;await v.default.writeFile(R.default.join(l,"IDENTITY.md"),m,"utf8");let x={...s,agents:{...s.agents??{},list:c}},h=`${n}.tmp`,g=`${n}.bak.${new Date().toISOString().replace(/[:.]/g,"-")}`;return await v.default.writeFile(h,JSON.stringify(x,null,2)+"\n","utf8"),await v.default.copyFile(n,g).catch(()=>{}),await v.default.rename(h,n),await C("openclaw",["gateway","restart"],{timeout:12e4}),y.NextResponse.json({ok:!0,agentId:r,workspace:l,restarted:!0})}catch(r){let e=r instanceof Error?r.message:String(r),t=/required|match \//i.test(e)?400:500;return y.NextResponse.json({ok:!1,error:e},{status:t})}}e.s(["POST",()=>A],85539);var k=e.i(85539);let N=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/agents/add/route",pathname:"/api/agents/add",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/agents/add/route.ts",nextConfigOutput:"standalone",userland:k}),{workAsyncStorage:j,workUnitAsyncStorage:S,serverHooks:b}=N;function T(){return(0,a.patchFetch)({workAsyncStorage:j,workUnitAsyncStorage:S})}async function O(e,t,a){N.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let w="/api/agents/add/route";w=w.replace(/\/index$/,"")||"/";let v=await N.prepare(e,t,{srcPage:w,multiZoneDraftMode:!1});if(!v)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:R,params:E,nextConfig:y,parsedUrl:C,isDraftMode:A,prerenderManifest:k,routerServerContext:j,isOnDemandRevalidate:S,revalidateOnlyGenerated:b,resolvedPathname:T,clientReferenceManifest:O,serverActionsManifest:q}=v,P=(0,o.normalizeAppPath)(w),I=!!(k.dynamicRoutes[P]||k.routes[T]),_=async()=>((null==j?void 0:j.render404)?await j.render404(e,t,C,!1):t.end("This page could not be found"),null);if(I&&!A){let e=!!k.routes[T],t=k.dynamicRoutes[P];if(t&&!1===t.fallback&&!e){if(y.experimental.adapterPath)return await _();throw new g.NoFallbackError}}let H=null;!I||N.isDev||A||(H="/index"===(H=T)?"/":H);let $=!0===N.isDev||!I,D=I&&!$;q&&O&&(0,s.setManifestsSingleton)({page:w,clientReferenceManifest:O,serverActionsManifest:q});let U=e.method||"GET",M=(0,i.getTracer)(),F=M.getActiveScopeSpan(),L={params:E,prerenderManifest:k,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts},cacheComponents:!!y.cacheComponents,supportsDynamicResponse:$,incrementalCache:(0,n.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:y.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>N.onRequestError(e,t,a,n,j)},sharedContext:{buildId:R}},K=new l.NodeNextRequest(e),z=new l.NodeNextResponse(t),B=d.NextRequestAdapter.fromNodeNextRequest(K,(0,d.signalFromNodeResponse)(t));try{let s=async e=>N.handle(B,L).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=M.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route");if(a){let t=`${U} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t)}else e.updateName(`${U} ${w}`)}),o=!!(0,n.getRequestMeta)(e,"minimalMode"),l=async n=>{var i,l;let d=async({previousCacheEntry:r})=>{try{if(!o&&S&&b&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let i=await s(n);e.fetchMetrics=L.renderOpts.fetchMetrics;let l=L.renderOpts.pendingWaitUntil;l&&a.waitUntil&&(a.waitUntil(l),l=void 0);let d=L.renderOpts.collectedTags;if(!I)return await (0,c.sendResponse)(K,z,i,L.renderOpts.pendingWaitUntil),null;{let e=await i.blob(),t=(0,m.toNodeOutgoingHttpHeaders)(i.headers);d&&(t[h.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==L.renderOpts.collectedRevalidate&&!(L.renderOpts.collectedRevalidate>=h.INFINITE_CACHE)&&L.renderOpts.collectedRevalidate,a=void 0===L.renderOpts.collectedExpire||L.renderOpts.collectedExpire>=h.INFINITE_CACHE?void 0:L.renderOpts.collectedExpire;return{value:{kind:f.CachedRouteKind.APP_ROUTE,status:i.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await N.onRequestError(e,t,{routerKind:"App Router",routePath:w,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:S})},!1,j),t}},u=await N.handleResponse({req:e,nextConfig:y,cacheKey:H,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:k,isRoutePPREnabled:!1,isOnDemandRevalidate:S,revalidateOnlyGenerated:b,responseGenerator:d,waitUntil:a.waitUntil,isMinimalMode:o});if(!I)return null;if((null==u||null==(i=u.value)?void 0:i.kind)!==f.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(l=u.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});o||t.setHeader("x-nextjs-cache",S?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),A&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let g=(0,m.fromNodeOutgoingHttpHeaders)(u.value.headers);return o&&I||g.delete(h.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||g.get("Cache-Control")||g.set("Cache-Control",(0,x.getCacheControlHeader)(u.cacheControl)),await (0,c.sendResponse)(K,z,new Response(u.value.body,{headers:g,status:u.value.status||200})),null};F?await l(F):await M.withPropagatedContext(e.headers,()=>M.trace(u.BaseServerSpan.handleRequest,{spanName:`${U} ${w}`,kind:i.SpanKind.SERVER,attributes:{"http.method":U,"http.target":e.url}},l))}catch(t){if(t instanceof g.NoFallbackError||await N.onRequestError(e,t,{routerKind:"App Router",routePath:P,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:S})},!1,j),I)throw t;return await (0,c.sendResponse)(K,z,new Response(null,{status:500})),null}}e.s(["handler",()=>O,"patchFetch",()=>T,"routeModule",()=>N,"serverHooks",()=>b,"workAsyncStorage",()=>j,"workUnitAsyncStorage",()=>S],47407)}];
|
|
9
|
-
|
|
10
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__e31f8972._.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/app/api/agents/add/route.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import { execFile } from \"node:child_process\";\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { promisify } from \"node:util\";\n\nimport { NextResponse } from \"next/server\";\n\nconst execFileAsync = promisify(execFile);\n\nfunction normalizeAgentId(id: string) {\n const s = id.trim();\n if (!s) throw new Error(\"agent id is required\");\n if (!/^[a-z0-9][a-z0-9-]{0,62}$/i.test(s)) {\n throw new Error(\"agent id must match /^[a-z0-9][a-z0-9-]{0,62}$/i\");\n }\n return s;\n}\n\nexport async function POST(req: Request) {\n try {\n const body = (await req.json()) as {\n newAgentId?: string;\n agentId?: string; // legacy/compat: some callers send agentId\n name?: string;\n emoji?: string;\n theme?: string;\n avatar?: string;\n model?: string;\n overwrite?: boolean;\n };\n\n const newAgentId = normalizeAgentId(String(body.newAgentId ?? body.agentId ?? \"\"));\n const overwrite = Boolean(body.overwrite);\n\n const configPath = path.join(process.env.HOME || \"\", \".openclaw\", \"openclaw.json\");\n if (!process.env.HOME) {\n return NextResponse.json({ ok: false, error: \"HOME is not set\" }, { status: 500 });\n }\n\n const raw = await fs.readFile(configPath, \"utf8\");\n const cfg = JSON.parse(raw) as {\n agents?: { defaults?: { workspace?: string }; list?: Array<Record<string, unknown>> };\n };\n\n const baseWorkspace = String(cfg?.agents?.defaults?.workspace ?? \"\").trim();\n if (!baseWorkspace) {\n return NextResponse.json({ ok: false, error: \"agents.defaults.workspace not set\" }, { status: 500 });\n }\n\n const newWorkspace = path.resolve(baseWorkspace, \"..\", `workspace-${newAgentId}`);\n\n const agentsList: Array<Record<string, unknown>> = Array.isArray(cfg?.agents?.list)\n ? (cfg.agents?.list as Array<Record<string, unknown>>)\n : [];\n const exists = agentsList.some((a) => String(a?.id ?? \"\").toLowerCase() === newAgentId.toLowerCase());\n if (exists && !overwrite) {\n return NextResponse.json({ ok: false, error: `Agent already exists: ${newAgentId}` }, { status: 409 });\n }\n\n const nextEntry: Record<string, unknown> = {\n id: newAgentId,\n workspace: newWorkspace,\n ...(body.model ? { model: body.model } : {}),\n identity: {\n ...(typeof body.name === \"string\" && body.name.trim() ? { name: body.name.trim() } : {}),\n ...(typeof body.theme === \"string\" && body.theme.trim() ? { theme: body.theme.trim() } : {}),\n ...(typeof body.emoji === \"string\" && body.emoji.trim() ? { emoji: body.emoji.trim() } : {}),\n ...(typeof body.avatar === \"string\" && body.avatar.trim() ? { avatar: body.avatar.trim() } : {}),\n },\n };\n\n const nextList = exists\n ? agentsList.map((a) => (String(a?.id ?? \"\").toLowerCase() === newAgentId.toLowerCase() ? nextEntry : a))\n : [...agentsList, nextEntry];\n\n // Ensure workspace directory exists and seed IDENTITY.md for clarity.\n await fs.mkdir(newWorkspace, { recursive: true });\n const identityMd = `# IDENTITY.md\\n\\n- **Name:** ${String(body.name ?? \"\").trim() || newAgentId}\\n- **Creature:**\\n- **Vibe:**\\n- **Emoji:** ${String(body.emoji ?? \"\").trim()}\\n- **Avatar:** ${String(body.avatar ?? \"\").trim()}\\n`;\n await fs.writeFile(path.join(newWorkspace, \"IDENTITY.md\"), identityMd, \"utf8\");\n\n // Persist to ~/.openclaw/openclaw.json\n const nextCfg = {\n ...cfg,\n agents: {\n ...(cfg.agents ?? {}),\n list: nextList,\n },\n };\n\n // Write atomically.\n const tmpPath = `${configPath}.tmp`;\n const bakPath = `${configPath}.bak.${new Date().toISOString().replace(/[:.]/g, \"-\")}`;\n await fs.writeFile(tmpPath, JSON.stringify(nextCfg, null, 2) + \"\\n\", \"utf8\");\n await fs.copyFile(configPath, bakPath).catch(() => {});\n await fs.rename(tmpPath, configPath);\n\n // Restart gateway so the new agent is live.\n await execFileAsync(\"openclaw\", [\"gateway\", \"restart\"], { timeout: 120000 });\n\n return NextResponse.json({ ok: true, agentId: newAgentId, workspace: newWorkspace, restarted: true });\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n // Prefer 400 for validation/input errors; otherwise 500.\n const status = /required|match \\//i.test(msg) ? 400 : 500;\n return NextResponse.json({ ok: false, error: msg }, { status });\n }\n}\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"standalone\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/agents/add/route\",\n pathname: \"/api/agents/add\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/src/app/api/agents/add/route.ts\",\n nextConfigOutput,\n userland\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/agents/add/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.experimental.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, 'incrementalCache'),\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const isMinimalMode = Boolean(process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode'));\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (activeSpan) {\n await handleResponse(activeSpan);\n } else {\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse));\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n"],"names":[],"mappings":"uyCCAA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,CAAA,CAAA,OAAA,IAAA,EAAA,EAAA,CAAA,CAAA,KDhBA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAEA,EAAA,EAAA,CAAA,CAAA,OAEA,IAAM,EAAgB,CAAA,EAAA,EAAA,SAAA,AAAS,EAAC,EAAA,QAAQ,EAWjC,eAAe,EAAK,CAAY,EACrC,GAAI,CACF,IAAM,EAAQ,M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AAM,CACrB,WAAY,CACR,cAAe,EACf,cAAe,EAAI,GACvB,AAD0B,CAE9B,EAAG,GAEf,CAAE,MAAO,EAAK,CAeV,GAdM,aAAe,EAAA,eAAe,EAEhC,CAFmC,KAE7B,EAAY,cAAc,CAAC,EAAK,EAAK,CACvC,WAAY,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,oBAClC,uBACA,CACJ,EACJ,GAAG,AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,EAEA,qCAAqC","ignoreList":[1]}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
module.exports=[70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},74533,(e,t,r)=>{t.exports=e.x("node:child_process",()=>require("node:child_process"))},12057,(e,t,r)=>{t.exports=e.x("node:util",()=>require("node:util"))},5003,e=>{"use strict";var t=e.i(74533);let r=(0,e.i(12057).promisify)(t.execFile);async function n(e){try{let{stdout:t,stderr:n}=await r("openclaw",e,{maxBuffer:0xa00000,env:process.env});return{ok:!0,exitCode:0,stdout:t?.toString()??"",stderr:n?.toString()??""}}catch(t){let e="number"==typeof t.code?t.code:1;return{ok:!1,exitCode:e,stdout:"string"==typeof t.stdout?t.stdout:t.stdout&&"object"==typeof t.stdout&&"toString"in t.stdout?String(t.stdout.toString()):"",stderr:"string"==typeof t.stderr?t.stderr:t.stderr&&"object"==typeof t.stderr&&"toString"in t.stderr?String(t.stderr.toString()):"string"==typeof t.message?t.message:String(t)}}}e.s(["runOpenClaw",()=>n])},60232,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250),a=e.i(59756),s=e.i(61916),o=e.i(74677),i=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),p=e.i(47587),c=e.i(66012),x=e.i(70101),g=e.i(26937),h=e.i(10372),R=e.i(93695);e.i(52474);var f=e.i(220),v=e.i(89171),m=e.i(5003);async function w(e){let t=await e.json(),r=String(t.agentId??"").trim(),n=String(t.skill??"").trim();if(!r)return v.NextResponse.json({ok:!1,error:"agentId is required"},{status:400});if(!n)return v.NextResponse.json({ok:!1,error:"skill is required"},{status:400});let a=["recipes","install-skill",n,"--agent-id",r,"--yes"],s=await (0,m.runOpenClaw)(a);return s.ok?v.NextResponse.json({ok:!0,agentId:r,skill:n,stdout:s.stdout,stderr:s.stderr}):v.NextResponse.json({ok:!1,error:s.stderr.trim()||`openclaw ${a.join(" ")} failed (exit=${s.exitCode})`,stdout:s.stdout,stderr:s.stderr},{status:500})}e.s(["POST",()=>w],29357);var y=e.i(29357);let E=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/agents/skills/install/route",pathname:"/api/agents/skills/install",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/agents/skills/install/route.ts",nextConfigOutput:"standalone",userland:y}),{workAsyncStorage:C,workUnitAsyncStorage:k,serverHooks:S}=E;function b(){return(0,n.patchFetch)({workAsyncStorage:C,workUnitAsyncStorage:k})}async function A(e,t,n){E.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let v="/api/agents/skills/install/route";v=v.replace(/\/index$/,"")||"/";let m=await E.prepare(e,t,{srcPage:v,multiZoneDraftMode:!1});if(!m)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:w,params:y,nextConfig:C,parsedUrl:k,isDraftMode:S,prerenderManifest:b,routerServerContext:A,isOnDemandRevalidate:N,revalidateOnlyGenerated:j,resolvedPathname:T,clientReferenceManifest:q,serverActionsManifest:O}=m,P=(0,i.normalizeAppPath)(v),_=!!(b.dynamicRoutes[P]||b.routes[T]),H=async()=>((null==A?void 0:A.render404)?await A.render404(e,t,k,!1):t.end("This page could not be found"),null);if(_&&!S){let e=!!b.routes[T],t=b.dynamicRoutes[P];if(t&&!1===t.fallback&&!e){if(C.experimental.adapterPath)return await H();throw new R.NoFallbackError}}let I=null;!_||E.isDev||S||(I="/index"===(I=T)?"/":I);let U=!0===E.isDev||!_,D=_&&!U;O&&q&&(0,o.setManifestsSingleton)({page:v,clientReferenceManifest:q,serverActionsManifest:O});let M=e.method||"GET",$=(0,s.getTracer)(),F=$.getActiveScopeSpan(),K={params:y,prerenderManifest:b,renderOpts:{experimental:{authInterrupts:!!C.experimental.authInterrupts},cacheComponents:!!C.cacheComponents,supportsDynamicResponse:U,incrementalCache:(0,a.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:C.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,a)=>E.onRequestError(e,t,n,a,A)},sharedContext:{buildId:w}},B=new l.NodeNextRequest(e),L=new l.NodeNextResponse(t),G=d.NextRequestAdapter.fromNodeNextRequest(B,(0,d.signalFromNodeResponse)(t));try{let o=async e=>E.handle(G,K).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=$.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=r.get("next.route");if(n){let t=`${M} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t)}else e.updateName(`${M} ${v}`)}),i=!!(0,a.getRequestMeta)(e,"minimalMode"),l=async a=>{var s,l;let d=async({previousCacheEntry:r})=>{try{if(!i&&N&&j&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await o(a);e.fetchMetrics=K.renderOpts.fetchMetrics;let l=K.renderOpts.pendingWaitUntil;l&&n.waitUntil&&(n.waitUntil(l),l=void 0);let d=K.renderOpts.collectedTags;if(!_)return await (0,c.sendResponse)(B,L,s,K.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,x.toNodeOutgoingHttpHeaders)(s.headers);d&&(t[h.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==K.renderOpts.collectedRevalidate&&!(K.renderOpts.collectedRevalidate>=h.INFINITE_CACHE)&&K.renderOpts.collectedRevalidate,n=void 0===K.renderOpts.collectedExpire||K.renderOpts.collectedExpire>=h.INFINITE_CACHE?void 0:K.renderOpts.collectedExpire;return{value:{kind:f.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await E.onRequestError(e,t,{routerKind:"App Router",routePath:v,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:N})},!1,A),t}},u=await E.handleResponse({req:e,nextConfig:C,cacheKey:I,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:b,isRoutePPREnabled:!1,isOnDemandRevalidate:N,revalidateOnlyGenerated:j,responseGenerator:d,waitUntil:n.waitUntil,isMinimalMode:i});if(!_)return null;if((null==u||null==(s=u.value)?void 0:s.kind)!==f.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(l=u.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});i||t.setHeader("x-nextjs-cache",N?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),S&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let R=(0,x.fromNodeOutgoingHttpHeaders)(u.value.headers);return i&&_||R.delete(h.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||R.get("Cache-Control")||R.set("Cache-Control",(0,g.getCacheControlHeader)(u.cacheControl)),await (0,c.sendResponse)(B,L,new Response(u.value.body,{headers:R,status:u.value.status||200})),null};F?await l(F):await $.withPropagatedContext(e.headers,()=>$.trace(u.BaseServerSpan.handleRequest,{spanName:`${M} ${v}`,kind:s.SpanKind.SERVER,attributes:{"http.method":M,"http.target":e.url}},l))}catch(t){if(t instanceof R.NoFallbackError||await E.onRequestError(e,t,{routerKind:"App Router",routePath:P,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:N})},!1,A),_)throw t;return await (0,c.sendResponse)(B,L,new Response(null,{status:500})),null}}e.s(["handler",()=>A,"patchFetch",()=>b,"routeModule",()=>E,"serverHooks",()=>S,"workAsyncStorage",()=>C,"workUnitAsyncStorage",()=>k],60232)}];
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__fee3f59e._.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/openclaw.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js","../../../src/app/api/agents/skills/install/route.ts"],"sourcesContent":["import { execFile } from \"node:child_process\";\nimport { promisify } from \"node:util\";\n\nconst execFileAsync = promisify(execFile);\n\nexport type OpenClawExecResult = {\n ok: boolean;\n exitCode: number;\n stdout: string;\n stderr: string;\n};\n\nexport async function runOpenClaw(args: string[]): Promise<OpenClawExecResult> {\n // Use execFile (no shell) for safety.\n try {\n const { stdout, stderr } = await execFileAsync(\"openclaw\", args, {\n maxBuffer: 10 * 1024 * 1024,\n env: process.env,\n });\n return { ok: true, exitCode: 0, stdout: stdout?.toString() ?? \"\", stderr: stderr?.toString() ?? \"\" };\n } catch (e: unknown) {\n // execFile throws on non-zero exit; it often includes stdout/stderr.\n const err = e as { code?: unknown; stdout?: unknown; stderr?: unknown; message?: unknown };\n const exitCode = typeof err.code === \"number\" ? err.code : 1;\n\n const stdout =\n typeof err.stdout === \"string\" ? err.stdout : err.stdout && typeof err.stdout === \"object\" && \"toString\" in err.stdout\n ? String((err.stdout as { toString: () => string }).toString())\n : \"\";\n\n const stderr =\n typeof err.stderr === \"string\"\n ? err.stderr\n : err.stderr && typeof err.stderr === \"object\" && \"toString\" in err.stderr\n ? String((err.stderr as { toString: () => string }).toString())\n : typeof err.message === \"string\"\n ? err.message\n : String(e);\n\n return { ok: false, exitCode, stdout, stderr };\n }\n}\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"standalone\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/agents/skills/install/route\",\n pathname: \"/api/agents/skills/install\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/src/app/api/agents/skills/install/route.ts\",\n nextConfigOutput,\n userland\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/agents/skills/install/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.experimental.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, 'incrementalCache'),\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const isMinimalMode = Boolean(process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode'));\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (activeSpan) {\n await handleResponse(activeSpan);\n } else {\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse));\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n","import { NextResponse } from \"next/server\";\nimport { runOpenClaw } from \"@/lib/openclaw\";\n\nexport async function POST(req: Request) {\n const body = (await req.json()) as { agentId?: string; skill?: string };\n const agentId = String(body.agentId ?? \"\").trim();\n const skill = String(body.skill ?? \"\").trim();\n\n if (!agentId) return NextResponse.json({ ok: false, error: \"agentId is required\" }, { status: 400 });\n if (!skill) return NextResponse.json({ ok: false, error: \"skill is required\" }, { status: 400 });\n\n const args = [\"recipes\", \"install-skill\", skill, \"--agent-id\", agentId, \"--yes\"];\n const res = await runOpenClaw(args);\n if (!res.ok) {\n return NextResponse.json(\n { ok: false, error: res.stderr.trim() || `openclaw ${args.join(\" \")} failed (exit=${res.exitCode})`, stdout: res.stdout, stderr: res.stderr },\n { status: 500 },\n );\n }\n\n return NextResponse.json({ ok: true, agentId,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gBAAiB,CAAA,EAAA,EAAA,qBAAA,AAAqB,EAAC,EAAW,YAAY,GAE9E,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAChC,IAAI,SAAS,EAAW,KAAK,CAAC,IAAI,CAAE,SAChC,EACA,OAAQ,EAAW,KAAK,CAAC,MAAM,EAAI,GACvC,IACO,IACX,EAGI,EACA,MAAM,EAAe,EADT,CAGZ,MAAM,EAAO,qBAAqB,CAAC,EAAI,OAAO,CAAE,IAAI,EAAO,KAAK,CAAC,EAAA,cAAc,CAAC,aAAa,CAAE,CACvF,SAAU,CAAA,EAAG,EAAO,CAAC,EAAE,EAAA,CAAS,CAChC,KAAM,EAAA,QAAQ,CAAC,MAAM,CACrB,WAAY,CACR,cAAe,EACf,cAAe,EAAI,GAAG,AAC1B,CACJ,EAAG,GAEf,CAAE,MAAO,EAAK,CAeV,GAdM,aAAe,EAAA,eAAe,EAEhC,CAFmC,KAE7B,EAAY,cAAc,CAAC,EAAK,EAAK,CACvC,WAAY,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,oBAClC,uBACA,CACJ,EACJ,GAAG,AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,EAEA,qCAAqC","ignoreList":[1]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
module.exports=[70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},12714,(e,t,r)=>{t.exports=e.x("node:fs/promises",()=>require("node:fs/promises"))},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},7367,e=>{"use strict";var t=e.i(12714),r=e.i(50227);async function n(){let e=r.default.join(process.env.HOME||"",".openclaw","openclaw.json");return JSON.parse(await t.default.readFile(e,"utf8"))}async function a(){let e=await n(),t=e.agents?.defaults?.workspace;if(!t)throw Error("agents.defaults.workspace is not set in ~/.openclaw/openclaw.json");return t}async function i(){let e=await a();return r.default.join(e,"recipes")}async function s(){let e=await a();return r.default.join(e,"notes","goals")}async function o(e){let t=process.env.HOME||"";if(!t)throw Error("HOME is not set");return r.default.join(t,".openclaw",`workspace-${e}`)}async function l(){let e=await n(),t=e.plugins?.installs?.recipes?.installPath||e.plugins?.installs?.recipes?.sourcePath||e.plugins?.load?.paths?.[0];if(!t)throw Error("Could not determine recipes plugin install path from ~/.openclaw/openclaw.json");return r.default.join(t,"recipes","default")}e.s(["getBuiltinRecipesDir",()=>l,"getTeamWorkspaceDir",()=>o,"getWorkspaceDir",()=>a,"getWorkspaceGoalsDir",()=>s,"getWorkspaceRecipesDir",()=>i,"readOpenClawConfig",()=>n])},74533,(e,t,r)=>{t.exports=e.x("node:child_process",()=>require("node:child_process"))},12057,(e,t,r)=>{t.exports=e.x("node:util",()=>require("node:util"))},5003,e=>{"use strict";var t=e.i(74533);let r=(0,e.i(12057).promisify)(t.execFile);async function n(e){try{let{stdout:t,stderr:n}=await r("openclaw",e,{maxBuffer:0xa00000,env:process.env});return{ok:!0,exitCode:0,stdout:t?.toString()??"",stderr:n?.toString()??""}}catch(t){let e="number"==typeof t.code?t.code:1;return{ok:!1,exitCode:e,stdout:"string"==typeof t.stdout?t.stdout:t.stdout&&"object"==typeof t.stdout&&"toString"in t.stdout?String(t.stdout.toString()):"",stderr:"string"==typeof t.stderr?t.stderr:t.stderr&&"object"==typeof t.stderr&&"toString"in t.stderr?String(t.stderr.toString()):"string"==typeof t.message?t.message:String(t)}}}e.s(["runOpenClaw",()=>n])},5365,(e,t,r)=>{t.exports=e.x("process",()=>require("process"))},874,(e,t,r)=>{t.exports=e.x("buffer",()=>require("buffer"))},94845,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250),a=e.i(59756),i=e.i(61916),s=e.i(74677),o=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),p=e.i(47587),c=e.i(66012),f=e.i(70101),g=e.i(26937),h=e.i(10372),m=e.i(93695);e.i(52474);var x=e.i(220),w=e.i(12714),R=e.i(50227),v=e.i(23008),y=e.i(89171),E=e.i(7367),S=e.i(5003);function k(e){let t=e.trim();if(!t)throw Error("role is required");if(!/^[a-z][a-z0-9-]{0,62}$/i.test(t))throw Error("role must be alphanumeric/dash");return t}async function b(e){let t=await e.json(),r=String(t.recipeId??"").trim(),n=t.op;if(!r)return y.NextResponse.json({ok:!1,error:"recipeId is required"},{status:400});if("add"!==n&&"remove"!==n&&"addLike"!==n)return y.NextResponse.json({ok:!1,error:"op must be add|remove|addLike"},{status:400});let a="string"==typeof t.name?t.name.trim():"",i=await (0,E.getWorkspaceRecipesDir)(),s=R.default.join(i,`${r}.md`),{yamlText:o,rest:l}=function(e){if(!e.startsWith("---\n"))throw Error("Recipe markdown must start with YAML frontmatter (---)");let t=e.indexOf("\n---\n",4);if(-1===t)throw Error("Recipe frontmatter not terminated (---)");return{yamlText:e.slice(4,t+1),rest:e.slice(t+5)}}(await w.default.readFile(s,"utf8")),d=v.default.parse(o)??{},u=String(d.kind??"");if(u&&"team"!==u)return y.NextResponse.json({ok:!1,error:`recipe kind must be team (got ${u})`},{status:400});let p=d.agents,c=Array.isArray(p)?p:[],f=c.slice(),g=d.templates,h=g&&"object"==typeof g&&!Array.isArray(g)?g:{},m={...h};if("remove"===n){let e=k(String(t.role??""));for(let t of(f=f.filter(t=>String(t.role??"")!==e),Object.keys(m)))t.startsWith(`${e}.`)&&delete m[t]}else if("add"===n){let e=k(String(t.role??"")),r={...c.find(t=>String(t.role??"")===e),role:e,...a?{name:a}:{}},n=f.findIndex(t=>String(t.role??"")===e);-1===n?f.push(r):f[n]=r}else{let e=k(String(t.baseRole??"")),r=c.find(t=>String(t.role??"")===e);if(!r)return y.NextResponse.json({ok:!1,error:`baseRole not found in recipe: ${e}`},{status:400});let n=new Set(f.map(e=>String(e.role??"").trim()).filter(Boolean)),i=1;for(let t of n){t===e&&(i=Math.max(i,1));let r=t.match(RegExp(`^${e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}-([0-9]+)$`));if(r){let e=Number(r[1]);Number.isFinite(e)&&(i=Math.max(i,e))}}let s=String(t.teamId??"").trim(),o=new Set;if(s)try{let e=await (0,S.runOpenClaw)(["agents","list","--json"]);if(e.ok){let t=JSON.parse(e.stdout);o=new Set(t.map(e=>String(e.id??"").trim()).filter(Boolean))}}catch{}function x(e){if(n.has(e))return!0;if(s){let t=`${s}-${e}`;if(o.has(t))return!0}return!1}let l=e;if(x(l)){let t=Math.max(2,i+1);for(;x(`${e}-${t}`);)t++;l=`${e}-${t}`}let d="string"==typeof r.name?String(r.name):"",u=l===e?"":String(l.slice(e.length+1)),p=a||(d?`${d}${u?` ${u}`:""}`:""),g={...r,role:l,...p?{name:p}:{}};for(let[t,r]of(f.push(g),Object.entries(h))){if(!t.startsWith(`${e}.`))continue;let n=t.slice(e.length),a=`${l}${n}`;void 0===m[a]&&(m[a]=r)}}f.sort((e,t)=>String(e.role??"").localeCompare(String(t.role??"")));let b={...d,agents:f,...Object.keys(m).length?{templates:m}:{}},C=v.default.stringify(b).trimEnd(),j=`---
|
|
2
|
-
${C}
|
|
3
|
-
---
|
|
4
|
-
${l}`;await w.default.writeFile(s,j,"utf8");let $=null;"add"===n&&($=k(String(t.role??""))),"addLike"===n&&($=String(f[f.length-1]?.role??"").trim()||null);let A="string"==typeof t.teamId?t.teamId.trim():"",O=A&&$?`${A}-${$}`:null;return y.NextResponse.json({ok:!0,recipeId:r,filePath:s,agents:f,content:j,addedRole:$,addedAgentId:O})}e.s(["POST",()=>b],15079);var C=e.i(15079);let j=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/recipes/team-agents/route",pathname:"/api/recipes/team-agents",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/recipes/team-agents/route.ts",nextConfigOutput:"standalone",userland:C}),{workAsyncStorage:$,workUnitAsyncStorage:A,serverHooks:O}=j;function N(){return(0,n.patchFetch)({workAsyncStorage:$,workUnitAsyncStorage:A})}async function q(e,t,n){j.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let w="/api/recipes/team-agents/route";w=w.replace(/\/index$/,"")||"/";let R=await j.prepare(e,t,{srcPage:w,multiZoneDraftMode:!1});if(!R)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:v,params:y,nextConfig:E,parsedUrl:S,isDraftMode:k,prerenderManifest:b,routerServerContext:C,isOnDemandRevalidate:$,revalidateOnlyGenerated:A,resolvedPathname:O,clientReferenceManifest:N,serverActionsManifest:q}=R,T=(0,o.normalizeAppPath)(w),P=!!(b.dynamicRoutes[T]||b.routes[O]),_=async()=>((null==C?void 0:C.render404)?await C.render404(e,t,S,!1):t.end("This page could not be found"),null);if(P&&!k){let e=!!b.routes[O],t=b.dynamicRoutes[T];if(t&&!1===t.fallback&&!e){if(E.experimental.adapterPath)return await _();throw new m.NoFallbackError}}let I=null;!P||j.isDev||k||(I="/index"===(I=O)?"/":I);let H=!0===j.isDev||!P,D=P&&!H;q&&N&&(0,s.setManifestsSingleton)({page:w,clientReferenceManifest:N,serverActionsManifest:q});let M=e.method||"GET",U=(0,i.getTracer)(),F=U.getActiveScopeSpan(),W={params:y,prerenderManifest:b,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts},cacheComponents:!!E.cacheComponents,supportsDynamicResponse:H,incrementalCache:(0,a.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:E.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,a)=>j.onRequestError(e,t,n,a,C)},sharedContext:{buildId:v}},B=new l.NodeNextRequest(e),L=new l.NodeNextResponse(t),K=d.NextRequestAdapter.fromNodeNextRequest(B,(0,d.signalFromNodeResponse)(t));try{let s=async e=>j.handle(K,W).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=U.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=r.get("next.route");if(n){let t=`${M} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t)}else e.updateName(`${M} ${w}`)}),o=!!(0,a.getRequestMeta)(e,"minimalMode"),l=async a=>{var i,l;let d=async({previousCacheEntry:r})=>{try{if(!o&&$&&A&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let i=await s(a);e.fetchMetrics=W.renderOpts.fetchMetrics;let l=W.renderOpts.pendingWaitUntil;l&&n.waitUntil&&(n.waitUntil(l),l=void 0);let d=W.renderOpts.collectedTags;if(!P)return await (0,c.sendResponse)(B,L,i,W.renderOpts.pendingWaitUntil),null;{let e=await i.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(i.headers);d&&(t[h.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==W.renderOpts.collectedRevalidate&&!(W.renderOpts.collectedRevalidate>=h.INFINITE_CACHE)&&W.renderOpts.collectedRevalidate,n=void 0===W.renderOpts.collectedExpire||W.renderOpts.collectedExpire>=h.INFINITE_CACHE?void 0:W.renderOpts.collectedExpire;return{value:{kind:x.CachedRouteKind.APP_ROUTE,status:i.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await j.onRequestError(e,t,{routerKind:"App Router",routePath:w,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:$})},!1,C),t}},u=await j.handleResponse({req:e,nextConfig:E,cacheKey:I,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:b,isRoutePPREnabled:!1,isOnDemandRevalidate:$,revalidateOnlyGenerated:A,responseGenerator:d,waitUntil:n.waitUntil,isMinimalMode:o});if(!P)return null;if((null==u||null==(i=u.value)?void 0:i.kind)!==x.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(l=u.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});o||t.setHeader("x-nextjs-cache",$?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),k&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let m=(0,f.fromNodeOutgoingHttpHeaders)(u.value.headers);return o&&P||m.delete(h.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||m.get("Cache-Control")||m.set("Cache-Control",(0,g.getCacheControlHeader)(u.cacheControl)),await (0,c.sendResponse)(B,L,new Response(u.value.body,{headers:m,status:u.value.status||200})),null};F?await l(F):await U.withPropagatedContext(e.headers,()=>U.trace(u.BaseServerSpan.handleRequest,{spanName:`${M} ${w}`,kind:i.SpanKind.SERVER,attributes:{"http.method":M,"http.target":e.url}},l))}catch(t){if(t instanceof m.NoFallbackError||await j.onRequestError(e,t,{routerKind:"App Router",routePath:T,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:$})},!1,C),P)throw t;return await (0,c.sendResponse)(B,L,new Response(null,{status:500})),null}}e.s(["handler",()=>q,"patchFetch",()=>N,"routeModule",()=>j,"serverHooks",()=>O,"workAsyncStorage",()=>$,"workUnitAsyncStorage",()=>A],94845)}];
|
|
5
|
-
|
|
6
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__fff0b9c4._.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/paths.ts","../../../src/lib/openclaw.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js","../../../src/app/api/recipes/team-agents/route.ts"],"sourcesContent":["import fs from \"node:fs/promises\";\nimport path from \"node:path\";\n\ntype OpenClawConfig = {\n agents?: { defaults?: { workspace?: string } };\n gateway?: { port?: number; auth?: { token?: string } };\n tools?: {\n agentToAgent?: {\n enabled?: boolean;\n allow?: string[];\n };\n };\n plugins?: {\n installs?: { recipes?: { installPath?: string; sourcePath?: string } };\n load?: { paths?: string[] };\n };\n};\n\nexport async function readOpenClawConfig(): Promise<OpenClawConfig> {\n const p = path.join(process.env.HOME || \"\", \".openclaw\", \"openclaw.json\");\n const text = await fs.readFile(p, \"utf8\");\n return JSON.parse(text) as OpenClawConfig;\n}\n\nexport async function getWorkspaceDir() {\n const cfg = await readOpenClawConfig();\n const ws = cfg.agents?.defaults?.workspace;\n if (!ws) throw new Error(\"agents.defaults.workspace is not set in ~/.openclaw/openclaw.json\");\n return ws;\n}\n\nexport async function getWorkspaceRecipesDir() {\n const ws = await getWorkspaceDir();\n return path.join(ws, \"recipes\");\n}\n\nexport async function getWorkspaceGoalsDir() {\n const ws = await getWorkspaceDir();\n return path.join(ws, \"notes\", \"goals\");\n}\n\nexport async function getTeamWorkspaceDir(teamId: string) {\n const home = process.env.HOME || \"\";\n if (!home) throw new Error(\"HOME is not set\");\n return path.join(home, \".openclaw\", `workspace-${teamId}`);\n}\n\nexport async function getBuiltinRecipesDir() {\n const cfg = await readOpenClawConfig();\n const p =\n cfg.plugins?.installs?.recipes?.installPath ||\n cfg.plugins?.installs?.recipes?.sourcePath ||\n cfg.plugins?.load?.paths?.[0];\n if (!p) throw new Error(\"Could not determine recipes plugin install path from ~/.openclaw/openclaw.json\");\n return path.join(p, \"recipes\", \"default\");\n}\n","import { execFile } from \"node:child_process\";\nimport { promisify } from \"node:util\";\n\nconst execFileAsync = promisify(execFile);\n\nexport type OpenClawExecResult = {\n ok: boolean;\n exitCode: number;\n stdout: string;\n stderr: string;\n};\n\nexport async function runOpenClaw(args: string[]): Promise<OpenClawExecResult> {\n // Use execFile (no shell) for safety.\n try {\n const { stdout, stderr } = await execFileAsync(\"openclaw\", args, {\n maxBuffer: 10 * 1024 * 1024,\n env: process.env,\n });\n return { ok: true, exitCode: 0, stdout: stdout?.toString() ?? \"\", stderr: stderr?.toString() ?? \"\" };\n } catch (e: unknown) {\n // execFile throws on non-zero exit; it often includes stdout/stderr.\n const err = e as { code?: unknown; stdout?: unknown; stderr?: unknown; message?: unknown };\n const exitCode = typeof err.code === \"number\" ? err.code : 1;\n\n const stdout =\n typeof err.stdout === \"string\" ? err.stdout : err.stdout && typeof err.stdout === \"object\" && \"toString\" in err.stdout\n ? String((err.stdout as { toString: () => string }).toString())\n : \"\";\n\n const stderr =\n typeof err.stderr === \"string\"\n ? err.stderr\n : err.stderr && typeof err.stderr === \"object\" && \"toString\" in err.stderr\n ? String((err.stderr as { toString: () => string }).toString())\n : typeof err.message === \"string\"\n ? err.message\n : String(e);\n\n return { ok: false, exitCode, stdout, stderr };\n }\n}\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"standalone\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/recipes/team-agents/route\",\n pathname: \"/api/recipes/team-agents\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/src/app/api/recipes/team-agents/route.ts\",\n nextConfigOutput,\n userland\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/recipes/team-agents/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.experimental.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, 'incrementalCache'),\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const isMinimalMode = Boolean(process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode'));\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (activeSpan) {\n await handleResponse(activeSpan);\n } else {\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse));\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n","import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport YAML from \"yaml\";\nimport { NextResponse } from \"next/server\";\nimport { getWorkspaceRecipesDir } from \"@/lib/paths\";\nimport { runOpenClaw } from \"@/lib/openclaw\";\n\nfunction splitFrontmatter(md: string) {\n if (!md.startsWith(\"---\\n\")) throw new Error(\"Recipe markdown must start with YAML frontmatter (---)\");\n const end = md.indexOf(\"\\n---\\n\", 4);\n if (end === -1) throw new Error(\"Recipe frontmatter not terminated (---)\");\n const yamlText = md.slice(4, end + 1);\n const rest = md.slice(end + 5);\n return { yamlText, rest };\n}\n\nfunction normalizeRole(role: string) {\n const r = role.trim();\n if (!r) throw new Error(\"role is required\");\n if (!/^[a-z][a-z0-9-]{0,62}$/i.test(r)) throw new Error(\"role must be alphanumeric/dash\");\n return r;\n}\n\nexport async function POST(req: Request) {\n const body = (await req.json()) as {\n recipeId?: string;\n op?: \"add\" | \"remove\" | \"addLike\";\n role?: string;\n baseRole?: string;\n teamId?: string;\n name?: string;\n };\n\n const recipeId = String(body.recipeId ?? \"\").trim();\n const op = body.op;\n if (!recipeId) return NextResponse.json({ ok: false, error: \"recipeId is required\" }, { status: 400 });\n if (op !== \"add\" && op !== \"remove\" && op !== \"addLike\") {\n return NextResponse.json({ ok: false, error: \"op must be add|remove|addLike\" }, { status: 400 });\n }\n\n const name = typeof body.name === \"string\" ? body.name.trim() : \"\";\n\n const dir = await getWorkspaceRecipesDir();\n const filePath = path.join(dir, `${recipeId}.md`);\n\n const md = await fs.readFile(filePath, \"utf8\");\n const { yamlText, rest } = splitFrontmatter(md);\n const fm = (YAML.parse(yamlText) ?? {}) as Record<string, unknown>;\n\n const kind = String(fm.kind ?? \"\");\n if (kind && kind !== \"team\") {\n return NextResponse.json({ ok: false, error: `recipe kind must be team (got ${kind})` }, { status: 400 });\n }\n\n const agentsRaw = fm.agents;\n const agents: Array<Record<string, unknown>> = Array.isArray(agentsRaw)\n ? (agentsRaw as Array<Record<string, unknown>>)\n : [];\n\n let nextAgents = agents.slice();\n\n // Templates are optional, but if present we must keep them consistent with role duplication.\n const templatesRaw = fm.templates;\n const templates: Record<string, unknown> =\n templatesRaw && typeof templatesRaw === \"object\" && !Array.isArray(templatesRaw)\n ? (templatesRaw as Record<string, unknown>)\n : {};\n let nextTemplates: Record<string, unknown> = { ...templates };\n\n if (op === \"remove\") {\n const role = normalizeRole(String(body.role ?? \"\"));\n nextAgents = nextAgents.filter((a) => String(a.role ?? \"\") !== role);\n\n // Best-effort: remove templates for this role as well.\n for (const k of Object.keys(nextTemplates)) {\n if (k.startsWith(`${role}.`)) delete nextTemplates[k];\n }\n } else if (op === \"add\") {\n const role = normalizeRole(String(body.role ?? \"\"));\n // add or update by role\n const next = {\n ...agents.find((a) => String(a.role ?? \"\") === role),\n role,\n ...(name ? { name } : {}),\n };\n const idx = nextAgents.findIndex((a) => String(a.role ?? \"\") === role);\n if (idx === -1) nextAgents.push(next);\n else nextAgents[idx] = next;\n } else {\n // addLike: create a *new* role entry based on an existing role's capabilities AND templates.\n const baseRole = normalizeRole(String(body.baseRole ?? \"\"));\n const base = agents.find((a) => String(a.role ?? \"\") === baseRole);\n if (!base) {\n return NextResponse.json({ ok: false, error: `baseRole not found in recipe: ${baseRole}` }, { status: 400 });\n }\n\n const usedRoles = new Set(nextAgents.map((a) => String(a.role ?? \"\").trim()).filter(Boolean));\n\n // Find next suffix: baseRole, baseRole-2, baseRole-3, ...\n let n = 1;\n for (const r of usedRoles) {\n if (r === baseRole) n = Math.max(n, 1);\n const m = r.match(new RegExp(`^${baseRole.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, \"\\\\$&\")}-([0-9]+)$`));\n if (m) {\n const k = Number(m[1]);\n if (Number.isFinite(k)) n = Math.max(n, k);\n }\n }\n\n const teamId = String(body.teamId ?? \"\").trim();\n let existingAgentIds = new Set<string>();\n if (teamId) {\n try {\n const res = await runOpenClaw([\"agents\", \"list\", \"--json\"]);\n if (res.ok) {\n const items = JSON.parse(res.stdout) as Array<{ id?: unknown }>;\n existingAgentIds = new Set(items.map((a) => String(a.id ?? \"\").trim()).filter(Boolean));\n }\n } catch {\n // ignore\n }\n }\n\n function isTaken(role: string) {\n if (usedRoles.has(role)) return true;\n if (teamId) {\n const agentId = `${teamId}-${role}`;\n if (existingAgentIds.has(agentId)) return true;\n }\n return false;\n }\n\n let nextRole = baseRole;\n if (isTaken(nextRole)) {\n let i = Math.max(2, n + 1);\n while (isTaken(`${baseRole}-${i}`)) i++;\n nextRole = `${baseRole}-${i}`;\n }\n\n const baseName = typeof (base as { name?: unknown }).name === \"string\" ? String((base as { name?: unknown }).name) : \"\";\n const autoSuffix = nextRole === baseRole ? \"\" : String(nextRole.slice(baseRole.length + 1));\n const nextName = name || (baseName ? `${baseName}${autoSuffix ? ` ${autoSuffix}` : \"\"}` : \"\");\n\n const clone = { ...base, role: nextRole, ...(nextName ? { name: nextName } : {}) };\n nextAgents.push(clone);\n\n // Duplicate templates: templates.<baseRole>.* => templates.<nextRole>.*\n // This is required so scaffold-team can generate role files for the duplicated role.\n for (const [k, v] of Object.entries(templates)) {\n if (!k.startsWith(`${baseRole}.`)) continue;\n const suffix = k.slice(baseRole.length); // includes leading '.'\n const nextKey = `${nextRole}${suffix}`;\n if (nextTemplates[nextKey] === undefined) nextTemplates[nextKey] = v;\n }\n }\n\n // Keep stable order by role.\n nextAgents.sort((a, b) => String(a.role ?? \"\").localeCompare(String(b.role ?? \"\")));\n\n const nextFm = { ...fm, agents: nextAgents, ...(Object.keys(nextTemplates).length ? { templates: nextTemplates } : {}) };\n const nextYaml = YAML.stringify(nextFm).trimEnd();\n const nextMd = `---\\n${nextYaml}\\n---\\n${rest}`;\n\n await fs.writeFile(filePath, nextMd, \"utf8\");\n\n // Best-effort: return the last-added role so the client can install immediately.\n let addedRole: string | null = null;\n if (op === \"add\") addedRole = normalizeRole(String(body.role ?? \"\"));\n if (op === \"addLike\") {\n // In addLike we pushed a clone as the last entry.\n addedRole = String((nextAgents[nextAgents.length - 1] as { role?: unknown } | undefined)?.role ?? \"\").trim() || null;\n }\n\n const teamId = typeof body.teamId === \"string\" ? body.teamId.trim() : \"\";\n const addedAgentId = teamId && addedRole ? `${teamId}-${addedRole}` : null;\n\n return NextResponse.json({ ok: true, recipeId, filePath, agents: nextAgents, content: nextMd, addedRole, addedAgentId });\n}\n"],"names":[],"mappings":"0oCAAA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAiBO,eAAe,IACpB,IAAM,EAAI,EAAA,OAAI,CAAC,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,EAAI,GAAI,YAAa,iBAEzD,OAAO,KAAK,KAAK,CADJ,AACK,MADC,EAAA,OAAE,CAAC,QAAQ,CAAC,EAAG,QAEpC,CAEO,eAAe,IACpB,IAAM,EAAM,MAAM,IACZ,EAAK,EAAI,MAAM,EAAE,UAAU,UACjC,GAAI,CAAC,EAAI,MAAM,AAAI,MAAM,qEACzB,OAAO,CACT,CAEO,eAAe,IACpB,IAAM,EAAK,MAAM,IACjB,OAAO,EAAA,OAAI,CAAC,IAAI,CAAC,EAAI,UACvB,CAEO,eAAe,IACpB,IAAM,EAAK,MAAM,IACjB,OAAO,EAAA,OAAI,CAAC,IAAI,CAAC,EAAI,QAAS,QAChC,CAEO,eAAe,EAAoB,CAAc,EACtD,IAAM,EAAO,QAAQ,GAAG,CAAC,IAAI,EAAI,GACjC,GAAI,CAAC,EAAM,MAAU,AAAJ,MAAU,mBAC3B,OAAO,EAAA,OAAI,CAAC,IAAI,CAAC,EAAM,YAAa,CAAC,UAAU,EAAE,EAAA,CAAQ,CAC3D,CAEO,eAAe,IACpB,IAAM,EAAM,MAAM,IACZ,EACJ,EAAI,OAAO,EAAE,UAAU,SAAS,aAChC,EAAI,OAAO,EAAE,UAAU,SAAS,YAChC,EAAI,OAAO,EAAE,MAAM,OAAO,CAAC,EAAE,CAC/B,GAAI,CAAC,EAAG,MAAM,AAAI,MAAM,kFACxB,OAAO,EAAA,OAAI,CAAC,IAAI,CAAC,EAAG,UAAW,UACjC,mWCvDA,IAAA,EAAA,EAAA,CAAA,CAAA,OAGA,IAAM,EAAgB,CAAA,EAAA,AAFtB,EAAA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,CAAE,IAAI,EAAO,KAAK,CAAC,EAAA,cAAc,CAAC,aAAa,CAAE,CACvF,SAAU,CAAA,EAAG,EAAO,CAAC,EAAE,EAAA,CAAS,CAChC,KAAM,EAAA,QAAQ,CAAC,MAAM,CACrB,WAAY,CACR,cAAe,EACf,cAAe,EAAI,GAAG,AAC1B,CACJ,EAAG,GAEf,CAAE,MAAO,EAAK,CAeV,GAdM,aAAe,EAAA,eAAe,EAEhC,CAFmC,KAE7B,EAAY,cAAc,CAAC,EAAK,EAAK,CACvC,WAAY,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,oBAClC,uBACA,CACJ,EACJ,GAAG,AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,EAEA,qCAAqC","ignoreList":[2]}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
module.exports=[93695,(a,b,c)=>{b.exports=a.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},74533,(a,b,c)=>{b.exports=a.x("node:child_process",()=>require("node:child_process"))},12057,(a,b,c)=>{b.exports=a.x("node:util",()=>require("node:util"))},50645,a=>{a.n(a.i(27572))},43619,a=>{a.n(a.i(79962))},13718,a=>{a.n(a.i(85523))},18198,a=>{a.n(a.i(45518))},62212,a=>{a.n(a.i(66114))},790,(a,b,c)=>{let{createClientModuleProxy:d}=a.r(11857);a.n(d("[project]/node_modules/next/dist/client/app-dir/link.js <module evaluation>"))},84707,(a,b,c)=>{let{createClientModuleProxy:d}=a.r(11857);a.n(d("[project]/node_modules/next/dist/client/app-dir/link.js"))},97647,a=>{"use strict";a.i(790);var b=a.i(84707);a.n(b)},95936,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});var d={default:function(){return i},useLinkStatus:function(){return h.useLinkStatus}};for(var e in d)Object.defineProperty(c,e,{enumerable:!0,get:d[e]});let f=a.r(64240),g=a.r(7997),h=f._(a.r(97647));function i(a){let b=a.legacyBehavior,c="string"==typeof a.children||"number"==typeof a.children||"string"==typeof a.children?.type,d=a.children?.type?.$$typeof===Symbol.for("react.client.reference");return!b||c||d||(a.children?.type?.$$typeof===Symbol.for("react.lazy")?console.error("Using a Lazy Component as a direct child of `<Link legacyBehavior>` from a Server Component is not supported. If you need legacyBehavior, wrap your Lazy Component in a Client Component that renders the Link's `<a>` tag."):console.error("Using a Server Component as a direct child of `<Link legacyBehavior>` is not supported. If you need legacyBehavior, wrap your Server Component in a Client Component that renders the Link's `<a>` tag.")),(0,g.jsx)(h.default,{...a})}("function"==typeof c.default||"object"==typeof c.default&&null!==c.default)&&void 0===c.default.__esModule&&(Object.defineProperty(c.default,"__esModule",{value:!0}),Object.assign(c.default,c),b.exports=c.default)},83643,a=>{"use strict";var b=a.i(74533);let c=(0,a.i(12057).promisify)(b.execFile);async function d(a){try{let{stdout:b,stderr:d}=await c("openclaw",a,{maxBuffer:0xa00000,env:process.env});return{ok:!0,exitCode:0,stdout:b?.toString()??"",stderr:d?.toString()??""}}catch(b){let a="number"==typeof b.code?b.code:1;return{ok:!1,exitCode:a,stdout:"string"==typeof b.stdout?b.stdout:b.stdout&&"object"==typeof b.stdout&&"toString"in b.stdout?String(b.stdout.toString()):"",stderr:"string"==typeof b.stderr?b.stderr:b.stderr&&"object"==typeof b.stderr&&"toString"in b.stderr?String(b.stderr.toString()):"string"==typeof b.message?b.message:String(b)}}}a.s(["runOpenClaw",()=>d])},15464,a=>{"use strict";a.s(["default",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call the default export of [project]/src/app/teams/[teamId]/team-editor.tsx <module evaluation> from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/app/teams/[teamId]/team-editor.tsx <module evaluation>","default")},26270,a=>{"use strict";a.s(["default",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call the default export of [project]/src/app/teams/[teamId]/team-editor.tsx from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/app/teams/[teamId]/team-editor.tsx","default")},6536,a=>{"use strict";a.i(15464);var b=a.i(26270);a.n(b)},33201,a=>{"use strict";var b=a.i(7997),c=a.i(95936),d=a.i(18558),e=a.i(83643),f=a.i(6536);async function g(a){let b=await (0,e.runOpenClaw)(["recipes","list"]);if(!b.ok)return null;try{let c=JSON.parse(b.stdout).find(b=>"team"===b.kind&&b.id===a);return c?.name??null}catch{return null}}async function h({params:a}){(0,d.unstable_noStore)();let{teamId:e}=await a,h=await g(e);return(0,b.jsxs)("main",{className:"min-h-screen p-8",children:[(0,b.jsxs)("div",{className:"mx-auto mb-4 flex max-w-6xl items-start justify-between gap-4",children:[(0,b.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,b.jsx)(c.default,{href:"/",className:"text-sm font-medium text-[color:var(--ck-text-secondary)] transition-colors hover:text-[color:var(--ck-text-primary)]",children:"← Home"}),(0,b.jsx)(c.default,{href:"/recipes",className:"text-sm font-medium text-[color:var(--ck-text-secondary)] transition-colors hover:text-[color:var(--ck-text-primary)]",children:"← Recipes"})]}),(0,b.jsxs)("div",{className:"text-right",children:[(0,b.jsx)("div",{className:"text-sm font-medium text-[color:var(--ck-text-primary)]",children:h||e}),(0,b.jsx)("div",{className:"text-xs text-[color:var(--ck-text-tertiary)]",children:e})]})]}),(0,b.jsx)("div",{className:"mx-auto mb-4 flex max-w-6xl items-center justify-end",children:(0,b.jsx)(c.default,{href:`/goals?team=${encodeURIComponent(e)}`,className:"text-sm font-medium text-[color:var(--ck-text-secondary)] hover:underline",children:"View goals for this team →"})}),(0,b.jsx)(f.default,{teamId:e})]})}a.s(["default",()=>h,"dynamic",0,"force-dynamic","revalidate",0,0])}];
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__277a8350._.js.map
|