@jiggai/kitchen 0.5.11 → 0.5.12
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 +3 -3
- 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.html +1 -1
- package/.next/server/app/_not-found.rsc +2 -2
- package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- 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/api/cron/add/route.js +1 -1
- package/.next/server/app/api/cron/add/route.js.nft.json +1 -1
- package/.next/server/app/api/cron/bulk/route.js +1 -1
- package/.next/server/app/api/cron/bulk/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/edit/route.js +1 -1
- package/.next/server/app/api/cron/edit/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/cron/worker/route.js +1 -1
- package/.next/server/app/api/cron/worker/route.js.nft.json +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.nft.json +1 -1
- package/.next/server/app/api/goals/route.js.nft.json +1 -1
- package/.next/server/app/api/plugins/[pluginId]/[...path]/route.js.nft.json +1 -1
- package/.next/server/app/api/plugins/[pluginId]/tabs/[tabId]/route.js.nft.json +1 -1
- package/.next/server/app/api/plugins/route.js.nft.json +1 -1
- package/.next/server/app/api/plugins/test/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/delete/route.js +1 -1
- package/.next/server/app/api/recipes/delete/route.js.nft.json +1 -1
- package/.next/server/app/api/teams/[teamId]/tickets/assign/route.js.nft.json +1 -1
- package/.next/server/app/api/teams/[teamId]/tickets/comment/route.js.nft.json +1 -1
- package/.next/server/app/api/teams/[teamId]/tickets/delete/route.js.nft.json +1 -1
- package/.next/server/app/api/teams/[teamId]/tickets/move/route.js.nft.json +1 -1
- package/.next/server/app/api/teams/[teamId]/tickets/move-to-goals/route.js.nft.json +1 -1
- package/.next/server/app/api/teams/orchestrator/route.js.nft.json +1 -1
- package/.next/server/app/api/teams/plugins/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/tickets/assign/route.js.nft.json +1 -1
- package/.next/server/app/api/tickets/assignees/route.js.nft.json +1 -1
- package/.next/server/app/api/tickets/move/route.js.nft.json +1 -1
- package/.next/server/app/channels.html +2 -2
- package/.next/server/app/channels.rsc +2 -2
- package/.next/server/app/channels.segments/_full.segment.rsc +2 -2
- 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/goals/new.html +2 -2
- package/.next/server/app/goals/new.rsc +2 -2
- package/.next/server/app/goals/new.segments/_full.segment.rsc +2 -2
- 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.html +1 -1
- package/.next/server/app/goals.rsc +2 -2
- package/.next/server/app/goals.segments/_full.segment.rsc +2 -2
- 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 +1 -1
- package/.next/server/app/recipes/[id]/page.js.nft.json +1 -1
- package/.next/server/app/settings.html +1 -1
- package/.next/server/app/settings.rsc +2 -2
- package/.next/server/app/settings.segments/_full.segment.rsc +2 -2
- 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]/deliverables/page.js +2 -2
- package/.next/server/app/teams/[teamId]/deliverables/page.js.nft.json +1 -1
- package/.next/server/app/teams/[teamId]/runs/[workflowId]/[runId]/page.js +2 -2
- package/.next/server/app/teams/[teamId]/runs/[workflowId]/[runId]/page.js.nft.json +1 -1
- package/.next/server/app/teams/[teamId]/tickets/[ticket]/page.js.nft.json +1 -1
- package/.next/server/app/teams/[teamId]/tickets/page.js.nft.json +1 -1
- package/.next/server/app/teams/[teamId]/workflows/[workflowId]/page.js +1 -1
- package/.next/server/app/teams/[teamId]/workflows/[workflowId]/page.js.nft.json +1 -1
- package/.next/server/app/teams/[teamId]/workflows/page.js +3 -3
- package/.next/server/app/teams/[teamId]/workflows/page.js.nft.json +1 -1
- package/.next/server/app/tickets/[ticket]/page.js.nft.json +1 -1
- package/.next/server/app/tickets/page.js.nft.json +1 -1
- package/.next/server/chunks/[root-of-the-server]__1331482c._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1331482c._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__24d25a8c._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__24d25a8c._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__3d9c4025._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__3d9c4025._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__83753ef0._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__83753ef0._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__8799df50._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__8799df50._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__a90f7cdc._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__a90f7cdc._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__afde9f7c._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__afde9f7c._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__e3431817._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__e3431817._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__e6ecca08._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__e6ecca08._.js.map +1 -0
- package/.next/server/chunks/{[root-of-the-server]__d0634ad4._.js → [root-of-the-server]__fc511c8f._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__fc511c8f._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__fcde644b._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__fcde644b._.js.map +1 -0
- package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_cb6ddb24.js +2 -2
- package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_cb6ddb24.js.map +1 -1
- package/.next/server/chunks/ssr/{[root-of-the-server]__becf14db._.js → [root-of-the-server]__0a8db855._.js} +2 -2
- package/.next/server/chunks/ssr/[root-of-the-server]__0a8db855._.js.map +1 -0
- package/.next/server/chunks/ssr/{[root-of-the-server]__4d24c088._.js → [root-of-the-server]__18154c9e._.js} +2 -2
- package/.next/server/chunks/ssr/[root-of-the-server]__18154c9e._.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__3b880807._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__3b880807._.js.map +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__52cb8e0e._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__52cb8e0e._.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__7c14561e._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__7c14561e._.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__c97fe9e9._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__c97fe9e9._.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__e9faef37._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__e9faef37._.js.map +1 -0
- package/.next/server/chunks/ssr/_018dfe6b._.js +1 -1
- package/.next/server/chunks/ssr/_018dfe6b._.js.map +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +2 -2
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/.next/server/chunks/[root-of-the-server]__2705b289._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__2705b289._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__28a2e162._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__28a2e162._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__30cd38e9._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__30cd38e9._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__55defc7c._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__55defc7c._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__69c065ce._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__69c065ce._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__6b759340._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__6b759340._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__70a062f7._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__70a062f7._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__783b6b5b._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__783b6b5b._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__9f73c31b._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__9f73c31b._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__d0634ad4._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__f3e3dd8e._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__f3e3dd8e._.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__3f55f975._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__3f55f975._.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__4d24c088._.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__6390ce9c._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__6390ce9c._.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__a2e3966f._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__a2e3966f._.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__becf14db._.js.map +0 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__f59c3144._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__f59c3144._.js.map +0 -1
- /package/.next/static/{LRt6kweldrLHTF1HgLgu2 → p8YaBY0FwA86zQelkOQ-m}/_buildManifest.js +0 -0
- /package/.next/static/{LRt6kweldrLHTF1HgLgu2 → p8YaBY0FwA86zQelkOQ-m}/_clientMiddlewareManifest.json +0 -0
- /package/.next/static/{LRt6kweldrLHTF1HgLgu2 → p8YaBY0FwA86zQelkOQ-m}/_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"))},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},12714,(e,t,r)=>{t.exports=e.x("node:fs/promises",()=>require("node:fs/promises"))},60526,(e,t,r)=>{t.exports=e.x("node:os",()=>require("node:os"))},7367,e=>{"use strict";var t=e.i(12714),r=e.i(60526),n=e.i(50227);async function i(){let e=n.default.join(r.default.homedir(),".openclaw","openclaw.json");return JSON.parse(await t.default.readFile(e,"utf8"))}async function a(){let e=await i(),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 n.default.join(e,"recipes")}async function o(){let e=await a(),r=n.default.join(e,"goals");try{if((await t.default.stat(r)).isDirectory())return r}catch{}return n.default.join(e,"notes","goals")}async function l(e){let t=r.default.homedir();if(!t)throw Error("Could not resolve home directory");return n.default.join(t,".openclaw",`workspace-${e}`)}function u(e,t){return"main"===t?n.default.resolve(e):n.default.resolve(e,"..",`workspace-${t}`)}function d(e){let t=e.replace(/\\/g,"/");if(!t||t.startsWith("/")||t.includes(".."))throw Error("Invalid file name");return t}async function c(){let e=await i(),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 n.default.join(t,"recipes","default")}e.s(["assertSafeRelativeFileName",()=>d,"getBuiltinRecipesDir",()=>c,"getTeamWorkspaceDir",()=>l,"getWorkspaceDir",()=>a,"getWorkspaceGoalsDir",()=>o,"getWorkspaceRecipesDir",()=>s,"readOpenClawConfig",()=>i,"teamDirFromBaseWorkspace",()=>u])},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"))},59494,e=>{"use strict";function t(){let e=globalThis.__clawkitchen_api;if(!e)throw Error("ClawKitchen: OpenClaw plugin API not available. (This should only happen if Kitchen is started outside the gateway process.)");return e}e.s(["getKitchenApi",()=>t])},5003,e=>{"use strict";var t=e.i(59494),r=e.i(74533);let n=(0,e.i(12057).promisify)(r.execFile);function i(e){return"string"==typeof e.stdout?e.stdout:e.stdout&&"object"==typeof e.stdout&&"toString"in e.stdout?String(e.stdout.toString()):""}function a(e,t){return"string"==typeof e.stderr?e.stderr:e.stderr&&"object"==typeof e.stderr&&"toString"in e.stderr?String(e.stderr.toString()):"string"==typeof e.message?e.message:String(t)}function s(e){let t=e.trim();if(!t)return e;let r=t[0];if("["===r||"{"===r||'"'===r)return e;let n=t.split("\n"),i=n.findIndex(e=>/^\s*[[\{"]/.test(e));if(i>0){let e=n.slice(i).join("\n");try{return JSON.parse(e),e}catch{}}return e}async function o(e,t={}){let{sanitizeStdout:r=!0}=t;try{process.platform;let t=await n("openclaw",e,{timeout:12e4,windowsHide:!0,maxBuffer:0xa00000}),i=String(t.stdout??"");return{ok:!0,exitCode:0,stdout:r?s(i):i,stderr:String(t.stderr??"")}}catch(t){let e="number"==typeof t.code?t.code:1;return{ok:!1,exitCode:e,stdout:i(t),stderr:a(t,t)}}}function l(e){let t=e.trim();if(!t)return null;try{return JSON.parse(t)}catch{}let r=t.split("\n"),n=r.findIndex(e=>/^\s*[[\{]/.test(e));if(n>=0){let e=r.slice(n).join("\n");try{return JSON.parse(e)}catch{}}for(let e=r.length-1;e>=0;e--)if(/^\s*[\]}]/.test(r[e])){for(let t=e;t>=0;t--)if(/^\s*[[\{]/.test(r[t]))try{return JSON.parse(r.slice(t,e+1).join("\n"))}catch{}}return null}async function u(e){return o(e,{sanitizeStdout:!1})}async function d(e){if("cron"===e[0]||"recipes"===e[0]&&"workflows"===e[1]&&["runner-once","runner-tick","worker-tick"].includes(e[2]))return o(e);let r=(0,t.getKitchenApi)();try{let t=await r.runtime.system.runCommandWithTimeout(["openclaw",...e],{timeoutMs:12e4}),n=s(String(t.stdout??"")),i=String(t.stderr??""),a="number"==typeof t.exitCode?t.exitCode:"number"==typeof t.code?t.code:"number"==typeof t.status?t.status:0;if(0!==a)return{ok:!1,exitCode:a,stdout:n,stderr:i};return{ok:!0,exitCode:0,stdout:n,stderr:i}}catch(t){let e="number"==typeof t.code?t.code:1;return{ok:!1,exitCode:e,stdout:i(t),stderr:a(t,t)}}}e.s(["extractJson",()=>l,"runOpenClaw",()=>d,"runOpenClawRaw",()=>u])},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),i=e.i(5003),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),i=n.default.parse(r);if(!i?.id)throw Error("Recipe frontmatter must include id");return i.id}async function o(){let e=await (0,i.runOpenClaw)(["recipes","list"]);if(!e.ok)return[];try{return JSON.parse(e.stdout)}catch{return[]}}async function l(e){return(await o()).find(t=>t.id===e)??null}async function u(e){let t="builtin"===e.source?await (0,a.getBuiltinRecipesDir)():await (0,a.getWorkspaceRecipesDir)();return r.default.join(t,`${e.id}.md`)}async function d(e,n){await t.default.mkdir(r.default.dirname(e),{recursive:!0}),await t.default.writeFile(e,n,"utf8")}e.s(["findRecipeById",()=>l,"parseFrontmatterId",()=>s,"resolveRecipePath",()=>u,"writeRecipeFile",()=>d])},68120,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250),i=e.i(59756),a=e.i(61916),s=e.i(74677),o=e.i(69741),l=e.i(16795),u=e.i(87718),d=e.i(95169),c=e.i(47587),p=e.i(66012),f=e.i(70101),h=e.i(74838),w=e.i(10372),m=e.i(93695);e.i(52474);var g=e.i(220),x=e.i(89171),y=e.i(50227),R=e.i(5003),v=e.i(72915),k=e.i(12714);async function C(e,t){let r=[],n=y.default.resolve(e,"..");try{for(let e of(await k.default.readdir(n,{withFileTypes:!0})).filter(e=>e.isDirectory()&&e.name.startsWith("workspace-"))){let i=y.default.join(n,e.name,"team.json");try{let n=await k.default.readFile(i,"utf8"),a=JSON.parse(n);String(a.recipeId??"").trim()===t&&r.push(String(a.teamId??e.name.replace(/^workspace-/,"")).trim()||e.name)}catch{}}}catch{}return r}async function j(e,t){let r=[],n=!1,i=await (0,R.runOpenClaw)(["agents","list","--json"]);if(!i.ok)return{attachedAgents:r,hasSameIdAgent:n};try{let a=JSON.parse(i.stdout);for(let i of(n=a.some(e=>String(e.id??"").trim()===t),a)){let n=String(i.id??"").trim();if(!n)continue;let a=y.default.join(e,"agents",n,"agent.json");try{let e=await k.default.readFile(a,"utf8"),i=JSON.parse(e);String(i.recipeId??"").trim()===t&&r.push(n)}catch{}}}catch{}return{attachedAgents:r,hasSameIdAgent:n}}async function E(e){let t=String((await e.json()).id??"").trim();if(!t)return x.NextResponse.json({ok:!1,error:"id is required"},{status:400});let r=await (0,v.findRecipeById)(t);if(!r)return x.NextResponse.json({ok:!1,error:`Recipe not found: ${t}`},{status:404});if("builtin"===r.source)return x.NextResponse.json({ok:!1,error:`Recipe ${t} is builtin and cannot be deleted`},{status:403});let n=(await (0,R.runOpenClaw)(["config","get","agents.defaults.workspace"]))?.stdout?.trim();if(!n)return x.NextResponse.json({ok:!1,error:"agents.defaults.workspace not set"},{status:500});let i=y.default.resolve(n,"recipes")+y.default.sep,a=await (0,v.resolveRecipePath)(r),s=y.default.resolve(a);if(!s.startsWith(i))return x.NextResponse.json({ok:!1,error:`Refusing to delete non-workspace recipe path: ${s}`},{status:403});let o=r.kind??"team";if("team"===o){let e=await C(n,t);if(e.length)return x.NextResponse.json({ok:!1,error:`Team ${t} is in use by installed team(s): ${e.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:e}},{status:409})}if("agent"===o){let{attachedAgents:e,hasSameIdAgent:r}=await j(n,t);if(r)return x.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(e.length)return x.NextResponse.json({ok:!1,error:`Agent recipe ${t} is in use by active agent(s): ${e.join(", ")}. Delete the agent(s) first, then delete the recipe.`,details:{attachedAgents:e}},{status:409})}return await k.default.rm(s,{force:!0}),x.NextResponse.json({ok:!0,deleted:s})}e.s(["POST",()=>E],90138);var S=e.i(90138);let b=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:S}),{workAsyncStorage:N,workUnitAsyncStorage:O,serverHooks:A}=b;function T(){return(0,n.patchFetch)({workAsyncStorage:N,workUnitAsyncStorage:O})}async function P(e,t,n){b.isDev&&(0,i.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let x="/api/recipes/delete/route";x=x.replace(/\/index$/,"")||"/";let y=await b.prepare(e,t,{srcPage:x,multiZoneDraftMode:!1});if(!y)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:R,params:v,nextConfig:k,parsedUrl:C,isDraftMode:j,prerenderManifest:E,routerServerContext:S,isOnDemandRevalidate:N,revalidateOnlyGenerated:O,resolvedPathname:A,clientReferenceManifest:T,serverActionsManifest:P}=y,q=(0,o.normalizeAppPath)(x),I=!!(E.dynamicRoutes[q]||E.routes[A]),D=async()=>((null==S?void 0:S.render404)?await S.render404(e,t,C,!1):t.end("This page could not be found"),null);if(I&&!j){let e=!!E.routes[A],t=E.dynamicRoutes[q];if(t&&!1===t.fallback&&!e){if(k.experimental.adapterPath)return await D();throw new m.NoFallbackError}}let _=null;!I||b.isDev||j||(_="/index"===(_=A)?"/":_);let $=!0===b.isDev||!I,F=I&&!$;P&&T&&(0,s.setManifestsSingleton)({page:x,clientReferenceManifest:T,serverActionsManifest:P});let H=e.method||"GET",U=(0,a.getTracer)(),M=U.getActiveScopeSpan(),W={params:v,prerenderManifest:E,renderOpts:{experimental:{authInterrupts:!!k.experimental.authInterrupts},cacheComponents:!!k.cacheComponents,supportsDynamicResponse:$,incrementalCache:(0,i.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:k.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,i)=>b.onRequestError(e,t,n,i,S)},sharedContext:{buildId:R}},K=new l.NodeNextRequest(e),B=new l.NodeNextResponse(t),J=u.NextRequestAdapter.fromNodeNextRequest(K,(0,u.signalFromNodeResponse)(t));try{let s=async e=>b.handle(J,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")!==d.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=`${H} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t)}else e.updateName(`${H} ${x}`)}),o=!!(0,i.getRequestMeta)(e,"minimalMode"),l=async i=>{var a,l;let u=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 a=await s(i);e.fetchMetrics=W.renderOpts.fetchMetrics;let l=W.renderOpts.pendingWaitUntil;l&&n.waitUntil&&(n.waitUntil(l),l=void 0);let u=W.renderOpts.collectedTags;if(!I)return await (0,p.sendResponse)(K,B,a,W.renderOpts.pendingWaitUntil),null;{let e=await a.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(a.headers);u&&(t[w.NEXT_CACHE_TAGS_HEADER]=u),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==W.renderOpts.collectedRevalidate&&!(W.renderOpts.collectedRevalidate>=w.INFINITE_CACHE)&&W.renderOpts.collectedRevalidate,n=void 0===W.renderOpts.collectedExpire||W.renderOpts.collectedExpire>=w.INFINITE_CACHE?void 0:W.renderOpts.collectedExpire;return{value:{kind:g.CachedRouteKind.APP_ROUTE,status:a.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await b.onRequestError(e,t,{routerKind:"App Router",routePath:x,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:F,isOnDemandRevalidate:N})},!1,S),t}},d=await b.handleResponse({req:e,nextConfig:k,cacheKey:_,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:E,isRoutePPREnabled:!1,isOnDemandRevalidate:N,revalidateOnlyGenerated:O,responseGenerator:u,waitUntil:n.waitUntil,isMinimalMode:o});if(!I)return null;if((null==d||null==(a=d.value)?void 0:a.kind)!==g.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(l=d.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});o||t.setHeader("x-nextjs-cache",N?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),j&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let m=(0,f.fromNodeOutgoingHttpHeaders)(d.value.headers);return o&&I||m.delete(w.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||m.get("Cache-Control")||m.set("Cache-Control",(0,h.getCacheControlHeader)(d.cacheControl)),await (0,p.sendResponse)(K,B,new Response(d.value.body,{headers:m,status:d.value.status||200})),null};M?await l(M):await U.withPropagatedContext(e.headers,()=>U.trace(d.BaseServerSpan.handleRequest,{spanName:`${H} ${x}`,kind:a.SpanKind.SERVER,attributes:{"http.method":H,"http.target":e.url}},l))}catch(t){if(t instanceof m.NoFallbackError||await b.onRequestError(e,t,{routerKind:"App Router",routePath:q,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:F,isOnDemandRevalidate:N})},!1,S),I)throw t;return await (0,p.sendResponse)(K,B,new Response(null,{status:500})),null}}e.s(["handler",()=>P,"patchFetch",()=>T,"routeModule",()=>b,"serverHooks",()=>A,"workAsyncStorage",()=>N,"workUnitAsyncStorage",()=>O],68120)}];
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__f3e3dd8e._.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/paths.ts","../../../src/lib/kitchen-api.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","../../../src/app/api/recipes/delete/helpers.ts"],"sourcesContent":["import fs from \"node:fs/promises\";\nimport os from \"node:os\";\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 // OpenClaw message routing bindings (used for HITL approvals, etc.)\n bindings?: unknown[];\n};\n\nexport async function readOpenClawConfig(): Promise<OpenClawConfig> {\n const p = path.join(os.homedir(), \".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\n // Back-compat: some installs keep goals at <workspace>/goals.\n // Prefer that when present, otherwise fall back to <workspace>/notes/goals.\n const direct = path.join(ws, \"goals\");\n try {\n const st = await fs.stat(direct);\n if (st.isDirectory()) return direct;\n } catch {\n // ignore\n }\n\n return path.join(ws, \"notes\", \"goals\");\n}\n\nexport async function getTeamWorkspaceDir(teamId: string) {\n const home = os.homedir();\n if (!home) throw new Error(\"Could not resolve home directory\");\n return path.join(home, \".openclaw\", `workspace-${teamId}`);\n}\n\n/** Team workspace dir derived from agents.defaults.workspace (sibling: .. / workspace-{teamId}) */\nexport function teamDirFromBaseWorkspace(baseWorkspace: string, teamId: string) {\n // Special-case: treat \"main\" as the personal workspace (agents.defaults.workspace).\n // This lets Kitchen expose a selectable \"main\" scope without creating a separate\n // ~/.openclaw/workspace-main folder.\n if (teamId === \"main\") return path.resolve(baseWorkspace);\n return path.resolve(baseWorkspace, \"..\", `workspace-${teamId}`);\n}\n\n/** Rejects path traversal and empty names; returns normalized name. */\nexport function assertSafeRelativeFileName(name: string): string {\n const n = name.replace(/\\\\/g, \"/\");\n if (!n || n.startsWith(\"/\") || n.includes(\"..\")) throw new Error(\"Invalid file name\");\n return n;\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","// NOTE: This file is compiled by Next.js.\n// Do not import `openclaw/plugin-sdk` here (it is provided by the gateway runtime, not as an npm dep).\n\ntype KitchenApi = {\n config: unknown;\n runtime: {\n system: { runCommandWithTimeout: (argv: string[], opts: { timeoutMs: number }) => Promise<{ stdout?: string; stderr?: string }> };\n };\n};\n\nexport function getKitchenApi(): KitchenApi {\n const api = (globalThis as unknown as { __clawkitchen_api?: KitchenApi }).__clawkitchen_api;\n if (!api) {\n throw new Error(\n \"ClawKitchen: OpenClaw plugin API not available. (This should only happen if Kitchen is started outside the gateway process.)\",\n );\n }\n return api;\n}\n","import { getKitchenApi } from \"@/lib/kitchen-api\";\nimport { 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\nfunction extractStdout(err: { stdout?: unknown }): string {\n if (typeof err.stdout === \"string\") return err.stdout;\n if (err.stdout && typeof err.stdout === \"object\" && \"toString\" in err.stdout) {\n return String((err.stdout as { toString: () => string }).toString());\n }\n return \"\";\n}\n\nfunction resolveExitCode(res: { exitCode?: unknown; code?: unknown; status?: unknown }): number {\n if (typeof res.exitCode === \"number\") return res.exitCode;\n if (typeof res.code === \"number\") return res.code;\n if (typeof res.status === \"number\") return res.status;\n return 0;\n}\n\nfunction extractStderr(err: { stderr?: unknown; message?: unknown }, fallback: unknown): string {\n if (typeof err.stderr === \"string\") return err.stderr;\n if (err.stderr && typeof err.stderr === \"object\" && \"toString\" in err.stderr) {\n return String((err.stderr as { toString: () => string }).toString());\n }\n if (typeof err.message === \"string\") return err.message;\n return String(fallback);\n}\n\n/**\n * Strip non-JSON diagnostic lines from stdout.\n *\n * OpenClaw may print plugin/doctor/diagnostic lines to stdout before the\n * actual JSON payload (e.g. \"[doctor] ...\", \"[plugins] ...\", \"🦞 OpenClaw ...\").\n * This breaks callers that do JSON.parse(stdout).\n *\n * If stdout looks like it contains a JSON payload with leading noise, strip the\n * noise lines. Otherwise return as-is (non-JSON commands like `config get` may\n * return plain text).\n */\nfunction sanitizeStdout(raw: string): string {\n const trimmed = raw.trim();\n if (!trimmed) return raw;\n\n // Fast path: already starts with JSON\n const firstChar = trimmed[0];\n if (firstChar === \"[\" || firstChar === \"{\" || firstChar === '\"') return raw;\n\n // Look for the first line starting with a JSON token\n const lines = trimmed.split(\"\\n\");\n const jsonStartIdx = lines.findIndex((l) => /^\\s*[[\\{\"]/.test(l));\n if (jsonStartIdx > 0) {\n // Verify the remainder is valid JSON before stripping\n const candidate = lines.slice(jsonStartIdx).join(\"\\n\");\n try {\n JSON.parse(candidate);\n return candidate;\n } catch {\n // Not valid JSON after stripping — return original\n }\n }\n\n return raw;\n}\n\nasync function runOpenClawLocal(args: string[], options: { sanitizeStdout?: boolean } = {}): Promise<OpenClawExecResult> {\n const { sanitizeStdout: shouldSanitize = true } = options;\n \n try {\n const isWindows = process.platform === \"win32\";\n const res = await execFileAsync(\"openclaw\", args, {\n timeout: 120000,\n windowsHide: true,\n maxBuffer: 10 * 1024 * 1024,\n // Windows requires shell:true to resolve executables on PATH via PATHEXT.\n // Without it, execFile throws ENOENT even when openclaw is installed globally.\n ...(isWindows ? { shell: true } : {}),\n });\n\n const rawStdout = String(res.stdout ?? \"\");\n \n return {\n ok: true,\n exitCode: 0,\n stdout: shouldSanitize ? sanitizeStdout(rawStdout) : rawStdout,\n stderr: String(res.stderr ?? \"\"),\n };\n } catch (e: unknown) {\n const err = e as { code?: unknown; stdout?: unknown; stderr?: unknown; message?: unknown };\n const exitCode = typeof err.code === \"number\" ? err.code : 1;\n const stdout = extractStdout(err);\n const stderr = extractStderr(err, e);\n return { ok: false, exitCode, stdout, stderr };\n }\n}\n\n/**\n * Extract a JSON payload from stdout that may contain non-JSON diagnostic lines\n * (e.g. [doctor], [plugins], [recipes] log lines before the actual JSON).\n * Returns the parsed value or null if no JSON found.\n */\nexport function extractJson<T = unknown>(stdout: string): T | null {\n const trimmed = stdout.trim();\n if (!trimmed) return null;\n\n // Fast path: pure JSON\n try {\n return JSON.parse(trimmed) as T;\n } catch {\n // fall through\n }\n\n // Find the first line starting with [ or { (JSON array/object)\n const lines = trimmed.split(\"\\n\");\n const jsonStartIdx = lines.findIndex((l) => /^\\s*[[\\{]/.test(l));\n if (jsonStartIdx >= 0) {\n const jsonSlice = lines.slice(jsonStartIdx).join(\"\\n\");\n try {\n return JSON.parse(jsonSlice) as T;\n } catch {\n // fall through\n }\n }\n\n // Last resort: find the last JSON block (scan from end)\n for (let i = lines.length - 1; i >= 0; i--) {\n if (/^\\s*[\\]}]/.test(lines[i])) {\n // Walk backward to find the matching open\n for (let j = i; j >= 0; j--) {\n if (/^\\s*[[\\{]/.test(lines[j])) {\n try {\n return JSON.parse(lines.slice(j, i + 1).join(\"\\n\")) as T;\n } catch {\n // continue searching\n }\n }\n }\n }\n }\n\n return null;\n}\n\n/**\n * Run OpenClaw without stdout sanitization (for raw text output like recipe markdown)\n */\nexport async function runOpenClawRaw(args: string[]): Promise<OpenClawExecResult> {\n // Always use local exec for raw content to avoid Kitchen runtime restrictions\n return runOpenClawLocal(args, { sanitizeStdout: false });\n}\n\nexport async function runOpenClaw(args: string[]): Promise<OpenClawExecResult> {\n // In some Kitchen runtime contexts, `api.runtime.system.runCommandWithTimeout`\n // is executed with a restricted allowlist that does not include the `cron` tool,\n // causing `openclaw cron ...` to fail with \"Tool not available: cron\".\n //\n // Cron routes need to work in the gateway-run Kitchen environment, so for cron\n // specifically we prefer a local exec (host OpenClaw).\n if (args[0] === \"cron\") return runOpenClawLocal(args);\n\n // Workflow runner/worker commands are long-running orchestration processes that\n // acquire locks and claims. The runtime command wrapper (runCommandWithTimeout)\n // has a 120s hard timeout that can kill these mid-execution, orphaning locks and\n // leaving runs stuck in waiting_workers. Route them through local exec instead.\n if (\n args[0] === \"recipes\" &&\n args[1] === \"workflows\" &&\n [\"runner-once\", \"runner-tick\", \"worker-tick\"].includes(args[2])\n ) {\n return runOpenClawLocal(args);\n }\n\n const api = getKitchenApi();\n try {\n const res = (await api.runtime.system.runCommandWithTimeout([\"openclaw\", ...args], { timeoutMs: 120000 })) as {\n stdout?: unknown;\n stderr?: unknown;\n exitCode?: unknown;\n code?: unknown;\n status?: unknown;\n };\n\n const stdout = sanitizeStdout(String(res.stdout ?? \"\"));\n const stderr = String(res.stderr ?? \"\");\n const exitCode = resolveExitCode(res);\n\n if (exitCode !== 0) return { ok: false, exitCode, stdout, stderr };\n return { ok: true, exitCode: 0, stdout, stderr };\n } catch (e: unknown) {\n const err = e as { code?: unknown; stdout?: unknown; stderr?: unknown; message?: unknown };\n const exitCode = typeof err.code === \"number\" ? err.code : 1;\n const stdout = extractStdout(err);\n const stderr = extractStderr(err, e);\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 { runOpenClaw } from \"./openclaw\";\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\n/** Ensures the frontmatter id field matches the given id. Preserves body. Returns md unchanged if no valid frontmatter. */\nexport function forceFrontmatterId(md: string, id: string): string {\n if (!md.startsWith(\"---\\n\")) return md;\n const end = md.indexOf(\"\\n---\\n\", 4);\n if (end === -1) return md;\n const fm = md.slice(4, end);\n const body = md.slice(end + 5);\n\n const lines = fm.split(\"\\n\");\n let found = false;\n const nextLines = lines.map((line) => {\n if (/^id\\s*:/i.test(line)) {\n found = true;\n return `id: ${id}`;\n }\n return line;\n });\n if (!found) nextLines.unshift(`id: ${id}`);\n\n return `---\\n${nextLines.join(\"\\n\")}\\n---\\n${body}`;\n}\n\n/** Returns display name for a team from recipe list, or null if not found. */\nexport async function getTeamDisplayName(teamId: string): Promise<string | null> {\n const recipes = await listRecipes();\n const match = recipes.find((r) => r.kind === \"team\" && r.id === teamId);\n return match?.name ?? null;\n}\n\n/** Fetches recipe list from openclaw. Returns empty array on failure. */\nexport async function listRecipes(): Promise<RecipeListItem[]> {\n const list = await runOpenClaw([\"recipes\", \"list\"]);\n if (!list.ok) return [];\n try {\n return JSON.parse(list.stdout) as RecipeListItem[];\n } catch {\n return [];\n }\n}\n\n/** Fetches recipe list and returns the item with the given id, or null. */\nexport async function findRecipeById(id: string): Promise<RecipeListItem | null> {\n const recipes = await listRecipes();\n return recipes.find((r) => r.id === id) ?? null;\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 path from \"node:path\";\nimport { runOpenClaw } from \"@/lib/openclaw\";\nimport { findRecipeById, resolveRecipePath } from \"@/lib/recipes\";\nimport fs from \"node:fs/promises\";\nimport { getAttachedTeams, getAttachedAgents } from \"./helpers\";\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 const item = await findRecipeById(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 const workspaceRoot = (await runOpenClaw([\"config\", \"get\", \"agents.defaults.workspace\"]))?.stdout?.trim();\n if (!workspaceRoot) {\n return NextResponse.json({ ok: false, error: \"agents.defaults.workspace 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 if (kind === \"team\") {\n const attachedTeams = await getAttachedTeams(workspaceRoot, id);\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 const { attachedAgents, hasSameIdAgent } = await getAttachedAgents(workspaceRoot, id);\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 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","import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { runOpenClaw } from \"@/lib/openclaw\";\n\nexport async function getAttachedTeams(workspaceRoot: string, recipeId: string): Promise<string[]> {\n const attachedTeams: string[] = [];\n const teamsRoot = path.resolve(workspaceRoot, \"..\");\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\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() === recipeId) {\n attachedTeams.push(\n String(meta.teamId ?? dirent.name.replace(/^workspace-/, \"\")).trim() || dirent.name\n );\n }\n } catch {\n // ignore\n }\n }\n } catch {\n // ignore\n }\n\n return attachedTeams;\n}\n\nexport async function getAttachedAgents(\n workspaceRoot: string,\n recipeId: string\n): Promise<{ attachedAgents: string[]; hasSameIdAgent: boolean }> {\n const attachedAgents: string[] = [];\n let hasSameIdAgent = false;\n\n const agentsRes = await runOpenClaw([\"agents\", \"list\", \"--json\"]);\n if (!agentsRes.ok) return { attachedAgents, hasSameIdAgent };\n\n try {\n const agents = JSON.parse(agentsRes.stdout) as Array<{ id?: unknown }>;\n hasSameIdAgent = agents.some((a) => String(a.id ?? \"\").trim() === recipeId);\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() === recipeId) attachedAgents.push(agentId);\n } catch {\n // ignore\n }\n }\n } catch {\n // ignore\n }\n\n return { attachedAgents, hasSameIdAgent };\n}\n"],"names":[],"mappings":"2sCAAA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAmBO,eAAe,IACpB,IAAM,EAAI,EAAA,OAAI,CAAC,IAAI,CAAC,EAAA,OAAE,CAAC,OAAO,GAAI,YAAa,iBAE/C,OAAO,KAAK,KAAK,CAA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AK,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,CAClC,qBACA,sBACJ,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":[5]}
|
|
@@ -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"))},50227,(a,b,c)=>{b.exports=a.x("node:path",()=>require("node:path"))},12714,(a,b,c)=>{b.exports=a.x("node:fs/promises",()=>require("node:fs/promises"))},60526,(a,b,c)=>{b.exports=a.x("node:os",()=>require("node:os"))},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"))},69264,a=>{a.n(a.i(54832))},50645,a=>{a.n(a.i(27572))},17537,a=>{a.n(a.i(3363))},13718,a=>{a.n(a.i(85523))},18198,a=>{a.n(a.i(45518))},5365,(a,b,c)=>{b.exports=a.x("process",()=>require("process"))},874,(a,b,c)=>{b.exports=a.x("buffer",()=>require("buffer"))},28215,a=>{"use strict";var b=a.i(12714),c=a.i(60526),d=a.i(50227);async function e(){let a=d.default.join(c.default.homedir(),".openclaw","openclaw.json");return JSON.parse(await b.default.readFile(a,"utf8"))}async function f(){let a=await e(),b=a.agents?.defaults?.workspace;if(!b)throw Error("agents.defaults.workspace is not set in ~/.openclaw/openclaw.json");return b}async function g(a){let b=c.default.homedir();if(!b)throw Error("Could not resolve home directory");return d.default.join(b,".openclaw",`workspace-${a}`)}a.s(["getTeamWorkspaceDir",()=>g,"getWorkspaceDir",()=>f])},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);function d(a){return"string"==typeof a.stdout?a.stdout:a.stdout&&"object"==typeof a.stdout&&"toString"in a.stdout?String(a.stdout.toString()):""}function e(a,b){return"string"==typeof a.stderr?a.stderr:a.stderr&&"object"==typeof a.stderr&&"toString"in a.stderr?String(a.stderr.toString()):"string"==typeof a.message?a.message:String(b)}function f(a){let b=a.trim();if(!b)return a;let c=b[0];if("["===c||"{"===c||'"'===c)return a;let d=b.split("\n"),e=d.findIndex(a=>/^\s*[[\{"]/.test(a));if(e>0){let a=d.slice(e).join("\n");try{return JSON.parse(a),a}catch{}}return a}async function g(a,b={}){let{sanitizeStdout:h=!0}=b;try{process.platform;let b=await c("openclaw",a,{timeout:12e4,windowsHide:!0,maxBuffer:0xa00000}),d=String(b.stdout??"");return{ok:!0,exitCode:0,stdout:h?f(d):d,stderr:String(b.stderr??"")}}catch(b){let a="number"==typeof b.code?b.code:1;return{ok:!1,exitCode:a,stdout:d(b),stderr:e(b,b)}}}function h(a){let b=a.trim();if(!b)return null;try{return JSON.parse(b)}catch{}let c=b.split("\n"),d=c.findIndex(a=>/^\s*[[\{]/.test(a));if(d>=0){let a=c.slice(d).join("\n");try{return JSON.parse(a)}catch{}}for(let a=c.length-1;a>=0;a--)if(/^\s*[\]}]/.test(c[a])){for(let b=a;b>=0;b--)if(/^\s*[[\{]/.test(c[b]))try{return JSON.parse(c.slice(b,a+1).join("\n"))}catch{}}return null}async function i(a){return g(a,{sanitizeStdout:!1})}async function j(a){if("cron"===a[0]||"recipes"===a[0]&&"workflows"===a[1]&&["runner-once","runner-tick","worker-tick"].includes(a[2]))return g(a);let b=function(){let a=globalThis.__clawkitchen_api;if(!a)throw Error("ClawKitchen: OpenClaw plugin API not available. (This should only happen if Kitchen is started outside the gateway process.)");return a}();try{let c=await b.runtime.system.runCommandWithTimeout(["openclaw",...a],{timeoutMs:12e4}),d=f(String(c.stdout??"")),e=String(c.stderr??""),g="number"==typeof c.exitCode?c.exitCode:"number"==typeof c.code?c.code:"number"==typeof c.status?c.status:0;if(0!==g)return{ok:!1,exitCode:g,stdout:d,stderr:e};return{ok:!0,exitCode:0,stdout:d,stderr:e}}catch(b){let a="number"==typeof b.code?b.code:1;return{ok:!1,exitCode:a,stdout:d(b),stderr:e(b,b)}}}a.s(["extractJson",()=>h,"runOpenClaw",()=>j,"runOpenClawRaw",()=>i],83643)},88241,9444,a=>{"use strict";var b=a.i(12714),c=a.i(50227),d=a.i(28215);a.s([],9444);let e=c.default.join("shared-context","workflows");function f(a){let b=String(a??"").trim();if(!b)throw Error("workflow id is required");if(!/^[a-z0-9][a-z0-9-]{0,62}$/.test(b))throw Error("Invalid workflow id. Use lowercase letters, numbers, and dashes (max 63 chars), e.g. marketing-cadence-v1");return b}async function g(a){let b=await (0,d.getTeamWorkspaceDir)(a);return c.default.join(b,e)}async function h(a,d){let e=f(d),h=await g(a),i=c.default.join(h,`${e}.workflow.json`),j=JSON.parse(await b.default.readFile(i,"utf8"));return{ok:!0,path:i,workflow:j}}a.s(["assertSafeWorkflowId",()=>f,"readWorkflow",()=>h],88241)},72660,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]/deliverables/deliverables-client.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]/deliverables/deliverables-client.tsx <module evaluation>","default")},93233,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]/deliverables/deliverables-client.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]/deliverables/deliverables-client.tsx","default")},80093,a=>{"use strict";a.i(72660);var b=a.i(93233);a.n(b)},67958,a=>{"use strict";var b=a.i(7997),c=a.i(95936),d=a.i(18558),e=a.i(80093),f=a.i(15629),g=a.i(88241);async function h({params:a}){(0,d.unstable_noStore)();let{teamId:h}=await a,i=await (0,f.getTeamDisplayName)(h),j=process.env.KITCHEN_INTERNAL_URL||"http://localhost:3000",k=await fetch(`${j}/api/teams/workflow-deliverables?teamId=${encodeURIComponent(h)}`,{cache:"no-store"});if(!k.ok)return(0,b.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",children:"Deliverables"}),(0,b.jsxs)("div",{className:"mt-1 text-sm text-[color:var(--ck-text-secondary)]",children:[i||h," · ",(0,b.jsx)("span",{className:"font-mono",children:h})]})]}),(0,b.jsxs)("div",{className:"rounded-3xl border border-red-400/30 bg-red-500/10 p-4",children:[(0,b.jsx)("div",{className:"text-red-50",children:"Failed to load deliverables"}),(0,b.jsxs)("div",{className:"mt-1 text-sm text-red-200",children:["Error: ",k.status," ",k.statusText]})]})]});let l=await k.json();if(!l.ok)return(0,b.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",children:"Deliverables"}),(0,b.jsxs)("div",{className:"mt-1 text-sm text-[color:var(--ck-text-secondary)]",children:[i||h," · ",(0,b.jsx)("span",{className:"font-mono",children:h})]})]}),(0,b.jsxs)("div",{className:"rounded-3xl border border-red-400/30 bg-red-500/10 p-4",children:[(0,b.jsx)("div",{className:"text-red-50",children:"Failed to load deliverables"}),(0,b.jsx)("div",{className:"mt-1 text-sm text-red-200",children:l.error||"Unknown error"})]})]});let m=Array.from(new Set(l.deliverables.map(a=>a.workflowId).filter(Boolean))).sort(),n={};return await Promise.all(m.map(async a=>{try{let{workflow:b}=await (0,g.readWorkflow)(h,a);n[a]={id:b.id,name:b.name}}catch{n[a]={id:a}}})),(0,b.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",children:"Deliverables"}),(0,b.jsxs)("div",{className:"mt-1 text-sm text-[color:var(--ck-text-secondary)]",children:[i||h," · ",(0,b.jsx)("span",{className:"font-mono",children:h})]}),(0,b.jsx)("div",{className:"mt-1 text-xs text-[color:var(--ck-text-tertiary)]",children:"Browse and access outputs from completed workflow runs"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)(c.default,{href:`/teams/${encodeURIComponent(h)}/workflows`,className:"text-sm font-medium text-[color:var(--ck-text-secondary)] hover:underline",children:"Workflows →"}),(0,b.jsx)(c.default,{href:`/runs?team=${encodeURIComponent(h)}`,className:"text-sm font-medium text-[color:var(--ck-text-secondary)] hover:underline",children:"Runs →"})]})]}),(0,b.jsx)(e.default,{teamId:h,deliverables:l.deliverables,workflows:n})]})}a.s(["default",()=>h,"dynamic",0,"force-dynamic","revalidate",0,0])}];
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__3f55f975._.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/paths.ts","../../../../node_modules/next/dist/client/app-dir/link.js/__nextjs-internal-proxy.cjs","../../../../node_modules/next/src/client/app-dir/link.tsx","../../../../node_modules/next/src/client/app-dir/link.react-server.tsx","../../../../src/lib/kitchen-api.ts","../../../../src/lib/openclaw.ts","../../../../src/lib/workflows/storage.ts","../../../../src/lib/workflows/readdir.ts","../../../../src/app/teams/%5BteamId%5D/deliverables/deliverables-client.tsx/__nextjs-internal-proxy.mjs","../../../../src/app/teams/%5BteamId%5D/deliverables/page.tsx"],"sourcesContent":["import fs from \"node:fs/promises\";\nimport os from \"node:os\";\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 // OpenClaw message routing bindings (used for HITL approvals, etc.)\n bindings?: unknown[];\n};\n\nexport async function readOpenClawConfig(): Promise<OpenClawConfig> {\n const p = path.join(os.homedir(), \".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\n // Back-compat: some installs keep goals at <workspace>/goals.\n // Prefer that when present, otherwise fall back to <workspace>/notes/goals.\n const direct = path.join(ws, \"goals\");\n try {\n const st = await fs.stat(direct);\n if (st.isDirectory()) return direct;\n } catch {\n // ignore\n }\n\n return path.join(ws, \"notes\", \"goals\");\n}\n\nexport async function getTeamWorkspaceDir(teamId: string) {\n const home = os.homedir();\n if (!home) throw new Error(\"Could not resolve home directory\");\n return path.join(home, \".openclaw\", `workspace-${teamId}`);\n}\n\n/** Team workspace dir derived from agents.defaults.workspace (sibling: .. / workspace-{teamId}) */\nexport function teamDirFromBaseWorkspace(baseWorkspace: string, teamId: string) {\n // Special-case: treat \"main\" as the personal workspace (agents.defaults.workspace).\n // This lets Kitchen expose a selectable \"main\" scope without creating a separate\n // ~/.openclaw/workspace-main folder.\n if (teamId === \"main\") return path.resolve(baseWorkspace);\n return path.resolve(baseWorkspace, \"..\", `workspace-${teamId}`);\n}\n\n/** Rejects path traversal and empty names; returns normalized name. */\nexport function assertSafeRelativeFileName(name: string): string {\n const n = name.replace(/\\\\/g, \"/\");\n if (!n || n.startsWith(\"/\") || n.includes(\"..\")) throw new Error(\"Invalid file name\");\n return n;\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","// This file is generated by next-core EcmascriptClientReferenceModule.\nconst { createClientModuleProxy } = require(\"react-server-dom-turbopack/server\");\n\n__turbopack_context__.n(createClientModuleProxy(\"[project]/node_modules/next/dist/client/app-dir/link.js\"));\n","'use client'\n\nimport React, { createContext, useContext, useOptimistic, useRef } from 'react'\nimport type { UrlObject } from 'url'\nimport { formatUrl } from '../../shared/lib/router/utils/format-url'\nimport { AppRouterContext } from '../../shared/lib/app-router-context.shared-runtime'\nimport { useMergedRef } from '../use-merged-ref'\nimport { isAbsoluteUrl } from '../../shared/lib/utils'\nimport { addBasePath } from '../add-base-path'\nimport { warnOnce } from '../../shared/lib/utils/warn-once'\nimport type { PENDING_LINK_STATUS } from '../components/links'\nimport {\n IDLE_LINK_STATUS,\n mountLinkInstance,\n onNavigationIntent,\n unmountLinkForCurrentNavigation,\n unmountPrefetchableInstance,\n type LinkInstance,\n} from '../components/links'\nimport { isLocalURL } from '../../shared/lib/router/utils/is-local-url'\nimport {\n FetchStrategy,\n type PrefetchTaskFetchStrategy,\n} from '../components/segment-cache/types'\nimport { errorOnce } from '../../shared/lib/utils/error-once'\n\ntype Url = string | UrlObject\ntype RequiredKeys<T> = {\n [K in keyof T]-?: {} extends Pick<T, K> ? never : K\n}[keyof T]\ntype OptionalKeys<T> = {\n [K in keyof T]-?: {} extends Pick<T, K> ? K : never\n}[keyof T]\n\ntype OnNavigateEventHandler = (event: { preventDefault: () => void }) => void\n\ntype InternalLinkProps = {\n /**\n * **Required**. The path or URL to navigate to. It can also be an object (similar to `URL`).\n *\n * @example\n * ```tsx\n * // Navigate to /dashboard:\n * <Link href=\"/dashboard\">Dashboard</Link>\n *\n * // Navigate to /about?name=test:\n * <Link href={{ pathname: '/about', query: { name: 'test' } }}>\n * About\n * </Link>\n * ```\n *\n * @remarks\n * - For external URLs, use a fully qualified URL such as `https://...`.\n * - In the App Router, dynamic routes must not include bracketed segments in `href`.\n */\n href: Url\n\n /**\n * @deprecated v10.0.0: `href` props pointing to a dynamic route are\n * automatically resolved and no longer require the `as` prop.\n */\n as?: Url\n\n /**\n * Replace the current `history` state instead of adding a new URL into the stack.\n *\n * @defaultValue `false`\n *\n * @example\n * ```tsx\n * <Link href=\"/about\" replace>\n * About (replaces the history state)\n * </Link>\n * ```\n */\n replace?: boolean\n\n /**\n * Whether to override the default scroll behavior. If `true`, Next.js attempts to maintain\n * the scroll position if the newly navigated page is still visible. If not, it scrolls to the top.\n *\n * If `false`, Next.js will not modify the scroll behavior at all.\n *\n * @defaultValue `true`\n *\n * @example\n * ```tsx\n * <Link href=\"/dashboard\" scroll={false}>\n * No auto scroll\n * </Link>\n * ```\n */\n scroll?: boolean\n\n /**\n * Update the path of the current page without rerunning data fetching methods\n * like `getStaticProps`, `getServerSideProps`, or `getInitialProps`.\n *\n * @remarks\n * `shallow` only applies to the Pages Router. For the App Router, see the\n * [following documentation](https://nextjs.org/docs/app/building-your-application/routing/linking-and-navigating#using-the-native-history-api).\n *\n * @defaultValue `false`\n *\n * @example\n * ```tsx\n * <Link href=\"/blog\" shallow>\n * Shallow navigation\n * </Link>\n * ```\n */\n shallow?: boolean\n\n /**\n * Forces `Link` to pass its `href` to the child component. Useful if the child is a custom\n * component that wraps an `<a>` tag, or if you're using certain styling libraries.\n *\n * @defaultValue `false`\n *\n * @example\n * ```tsx\n * <Link href=\"/dashboard\" passHref legacyBehavior>\n * <MyStyledAnchor>Dashboard</MyStyledAnchor>\n * </Link>\n * ```\n */\n passHref?: boolean\n\n /**\n * Prefetch the page in the background.\n * Any `<Link />` that is in the viewport (initially or through scroll) will be prefetched.\n * Prefetch can be disabled by passing `prefetch={false}`.\n *\n * @remarks\n * Prefetching is only enabled in production.\n *\n * - In the **App Router**:\n * - `\"auto\"`, `null`, `undefined` (default): Prefetch behavior depends on static vs dynamic routes:\n * - Static routes: fully prefetched\n * - Dynamic routes: partial prefetch to the nearest segment with a `loading.js`\n * - `true`: Always prefetch the full route and data.\n * - `false`: Disable prefetching on both viewport and hover.\n * - In the **Pages Router**:\n * - `true` (default): Prefetches the route and data in the background on viewport or hover.\n * - `false`: Prefetch only on hover, not on viewport.\n *\n * @defaultValue `true` (Pages Router) or `null` (App Router)\n *\n * @example\n * ```tsx\n * <Link href=\"/dashboard\" prefetch={false}>\n * Dashboard\n * </Link>\n * ```\n */\n prefetch?: boolean | 'auto' | null\n\n /**\n * (unstable) Switch to a full prefetch on hover. Effectively the same as\n * updating the prefetch prop to `true` in a mouse event.\n */\n unstable_dynamicOnHover?: boolean\n\n /**\n * The active locale is automatically prepended in the Pages Router. `locale` allows for providing\n * a different locale, or can be set to `false` to opt out of automatic locale behavior.\n *\n * @remarks\n * Note: locale only applies in the Pages Router and is ignored in the App Router.\n *\n * @example\n * ```tsx\n * // Use the 'fr' locale:\n * <Link href=\"/about\" locale=\"fr\">\n * About (French)\n * </Link>\n *\n * // Disable locale prefix:\n * <Link href=\"/about\" locale={false}>\n * About (no locale prefix)\n * </Link>\n * ```\n */\n locale?: string | false\n\n /**\n * Enable legacy link behavior.\n *\n * @deprecated This will be removed in a future version\n * @defaultValue `false`\n * @see https://github.com/vercel/next.js/commit/489e65ed98544e69b0afd7e0cfc3f9f6c2b803b7\n */\n legacyBehavior?: boolean\n\n /**\n * Optional event handler for when the mouse pointer is moved onto the `<Link>`.\n */\n onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>\n\n /**\n * Optional event handler for when the `<Link>` is touched.\n */\n onTouchStart?: React.TouchEventHandler<HTMLAnchorElement>\n\n /**\n * Optional event handler for when the `<Link>` is clicked.\n */\n onClick?: React.MouseEventHandler<HTMLAnchorElement>\n\n /**\n * Optional event handler for when the `<Link>` is navigated.\n */\n onNavigate?: OnNavigateEventHandler\n}\n\n// TODO-APP: Include the full set of Anchor props\n// adding this to the publicly exported type currently breaks existing apps\n\n// `RouteInferType` is a stub here to avoid breaking `typedRoutes` when the type\n// isn't generated yet. It will be replaced when type generation runs.\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport type LinkProps<RouteInferType = any> = InternalLinkProps\ntype LinkPropsRequired = RequiredKeys<LinkProps>\ntype LinkPropsOptional = OptionalKeys<Omit<InternalLinkProps, 'locale'>>\n\nfunction isModifiedEvent(event: React.MouseEvent): boolean {\n const eventTarget = event.currentTarget as HTMLAnchorElement | SVGAElement\n const target = eventTarget.getAttribute('target')\n return (\n (target && target !== '_self') ||\n event.metaKey ||\n event.ctrlKey ||\n event.shiftKey ||\n event.altKey || // triggers resource download\n (event.nativeEvent && event.nativeEvent.which === 2)\n )\n}\n\nfunction linkClicked(\n e: React.MouseEvent,\n href: string,\n as: string,\n linkInstanceRef: React.RefObject<LinkInstance | null>,\n replace?: boolean,\n scroll?: boolean,\n onNavigate?: OnNavigateEventHandler\n): void {\n if (typeof window !== 'undefined') {\n const { nodeName } = e.currentTarget\n\n // anchors inside an svg have a lowercase nodeName\n const isAnchorNodeName = nodeName.toUpperCase() === 'A'\n if (\n (isAnchorNodeName && isModifiedEvent(e)) ||\n e.currentTarget.hasAttribute('download')\n ) {\n // ignore click for browser’s default behavior\n return\n }\n\n if (!isLocalURL(href)) {\n if (replace) {\n // browser default behavior does not replace the history state\n // so we need to do it manually\n e.preventDefault()\n location.replace(href)\n }\n\n // ignore click for browser’s default behavior\n return\n }\n\n e.preventDefault()\n\n if (onNavigate) {\n let isDefaultPrevented = false\n\n onNavigate({\n preventDefault: () => {\n isDefaultPrevented = true\n },\n })\n\n if (isDefaultPrevented) {\n return\n }\n }\n\n const { dispatchNavigateAction } =\n require('../components/app-router-instance') as typeof import('../components/app-router-instance')\n\n React.startTransition(() => {\n dispatchNavigateAction(\n as || href,\n replace ? 'replace' : 'push',\n scroll ?? true,\n linkInstanceRef.current\n )\n })\n }\n}\n\nfunction formatStringOrUrl(urlObjOrString: UrlObject | string): string {\n if (typeof urlObjOrString === 'string') {\n return urlObjOrString\n }\n\n return formatUrl(urlObjOrString)\n}\n\n/**\n * A React component that extends the HTML `<a>` element to provide\n * [prefetching](https://nextjs.org/docs/app/building-your-application/routing/linking-and-navigating#2-prefetching)\n * and client-side navigation. This is the primary way to navigate between routes in Next.js.\n *\n * @remarks\n * - Prefetching is only enabled in production.\n *\n * @see https://nextjs.org/docs/app/api-reference/components/link\n */\nexport default function LinkComponent(\n props: LinkProps & {\n children: React.ReactNode\n ref: React.Ref<HTMLAnchorElement>\n }\n) {\n const [linkStatus, setOptimisticLinkStatus] = useOptimistic(IDLE_LINK_STATUS)\n\n let children: React.ReactNode\n\n const linkInstanceRef = useRef<LinkInstance | null>(null)\n\n const {\n href: hrefProp,\n as: asProp,\n children: childrenProp,\n prefetch: prefetchProp = null,\n passHref,\n replace,\n shallow,\n scroll,\n onClick,\n onMouseEnter: onMouseEnterProp,\n onTouchStart: onTouchStartProp,\n legacyBehavior = false,\n onNavigate,\n ref: forwardedRef,\n unstable_dynamicOnHover,\n ...restProps\n } = props\n\n children = childrenProp\n\n if (\n legacyBehavior &&\n (typeof children === 'string' || typeof children === 'number')\n ) {\n children = <a>{children}</a>\n }\n\n const router = React.useContext(AppRouterContext)\n\n const prefetchEnabled = prefetchProp !== false\n\n const fetchStrategy =\n prefetchProp !== false\n ? getFetchStrategyFromPrefetchProp(prefetchProp)\n : // TODO: it makes no sense to assign a fetchStrategy when prefetching is disabled.\n FetchStrategy.PPR\n\n if (process.env.NODE_ENV !== 'production') {\n function createPropError(args: {\n key: string\n expected: string\n actual: string\n }) {\n return new Error(\n `Failed prop type: The prop \\`${args.key}\\` expects a ${args.expected} in \\`<Link>\\`, but got \\`${args.actual}\\` instead.` +\n (typeof window !== 'undefined'\n ? \"\\nOpen your browser's console to view the Component stack trace.\"\n : '')\n )\n }\n\n // TypeScript trick for type-guarding:\n const requiredPropsGuard: Record<LinkPropsRequired, true> = {\n href: true,\n } as const\n const requiredProps: LinkPropsRequired[] = Object.keys(\n requiredPropsGuard\n ) as LinkPropsRequired[]\n requiredProps.forEach((key: LinkPropsRequired) => {\n if (key === 'href') {\n if (\n props[key] == null ||\n (typeof props[key] !== 'string' && typeof props[key] !== 'object')\n ) {\n throw createPropError({\n key,\n expected: '`string` or `object`',\n actual: props[key] === null ? 'null' : typeof props[key],\n })\n }\n } else {\n // TypeScript trick for type-guarding:\n const _: never = key\n }\n })\n\n // TypeScript trick for type-guarding:\n const optionalPropsGuard: Record<LinkPropsOptional, true> = {\n as: true,\n replace: true,\n scroll: true,\n shallow: true,\n passHref: true,\n prefetch: true,\n unstable_dynamicOnHover: true,\n onClick: true,\n onMouseEnter: true,\n onTouchStart: true,\n legacyBehavior: true,\n onNavigate: true,\n } as const\n const optionalProps: LinkPropsOptional[] = Object.keys(\n optionalPropsGuard\n ) as LinkPropsOptional[]\n optionalProps.forEach((key: LinkPropsOptional) => {\n const valType = typeof props[key]\n\n if (key === 'as') {\n if (props[key] && valType !== 'string' && valType !== 'object') {\n throw createPropError({\n key,\n expected: '`string` or `object`',\n actual: valType,\n })\n }\n } else if (\n key === 'onClick' ||\n key === 'onMouseEnter' ||\n key === 'onTouchStart' ||\n key === 'onNavigate'\n ) {\n if (props[key] && valType !== 'function') {\n throw createPropError({\n key,\n expected: '`function`',\n actual: valType,\n })\n }\n } else if (\n key === 'replace' ||\n key === 'scroll' ||\n key === 'shallow' ||\n key === 'passHref' ||\n key === 'legacyBehavior' ||\n key === 'unstable_dynamicOnHover'\n ) {\n if (props[key] != null && valType !== 'boolean') {\n throw createPropError({\n key,\n expected: '`boolean`',\n actual: valType,\n })\n }\n } else if (key === 'prefetch') {\n if (\n props[key] != null &&\n valType !== 'boolean' &&\n props[key] !== 'auto'\n ) {\n throw createPropError({\n key,\n expected: '`boolean | \"auto\"`',\n actual: valType,\n })\n }\n } else {\n // TypeScript trick for type-guarding:\n const _: never = key\n }\n })\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (props.locale) {\n warnOnce(\n 'The `locale` prop is not supported in `next/link` while using the `app` router. Read more about app router internalization: https://nextjs.org/docs/app/building-your-application/routing/internationalization'\n )\n }\n if (!asProp) {\n let href: string | undefined\n if (typeof hrefProp === 'string') {\n href = hrefProp\n } else if (\n typeof hrefProp === 'object' &&\n typeof hrefProp.pathname === 'string'\n ) {\n href = hrefProp.pathname\n }\n\n if (href) {\n const hasDynamicSegment = href\n .split('/')\n .some((segment) => segment.startsWith('[') && segment.endsWith(']'))\n\n if (hasDynamicSegment) {\n throw new Error(\n `Dynamic href \\`${href}\\` found in <Link> while using the \\`/app\\` router, this is not supported. Read more: https://nextjs.org/docs/messages/app-dir-dynamic-href`\n )\n }\n }\n }\n }\n\n const { href, as } = React.useMemo(() => {\n const resolvedHref = formatStringOrUrl(hrefProp)\n return {\n href: resolvedHref,\n as: asProp ? formatStringOrUrl(asProp) : resolvedHref,\n }\n }, [hrefProp, asProp])\n\n // This will return the first child, if multiple are provided it will throw an error\n let child: any\n if (legacyBehavior) {\n if ((children as any)?.$$typeof === Symbol.for('react.lazy')) {\n throw new Error(\n `\\`<Link legacyBehavior>\\` received a direct child that is either a Server Component, or JSX that was loaded with React.lazy(). This is not supported. Either remove legacyBehavior, or make the direct child a Client Component that renders the Link's \\`<a>\\` tag.`\n )\n }\n\n if (process.env.NODE_ENV === 'development') {\n if (onClick) {\n console.warn(\n `\"onClick\" was passed to <Link> with \\`href\\` of \\`${hrefProp}\\` but \"legacyBehavior\" was set. The legacy behavior requires onClick be set on the child of next/link`\n )\n }\n if (onMouseEnterProp) {\n console.warn(\n `\"onMouseEnter\" was passed to <Link> with \\`href\\` of \\`${hrefProp}\\` but \"legacyBehavior\" was set. The legacy behavior requires onMouseEnter be set on the child of next/link`\n )\n }\n try {\n child = React.Children.only(children)\n } catch (err) {\n if (!children) {\n throw new Error(\n `No children were passed to <Link> with \\`href\\` of \\`${hrefProp}\\` but one child is required https://nextjs.org/docs/messages/link-no-children`\n )\n }\n throw new Error(\n `Multiple children were passed to <Link> with \\`href\\` of \\`${hrefProp}\\` but only one child is supported https://nextjs.org/docs/messages/link-multiple-children` +\n (typeof window !== 'undefined'\n ? \" \\nOpen your browser's console to view the Component stack trace.\"\n : '')\n )\n }\n } else {\n child = React.Children.only(children)\n }\n } else {\n if (process.env.NODE_ENV === 'development') {\n if ((children as any)?.type === 'a') {\n throw new Error(\n 'Invalid <Link> with <a> child. Please remove <a> or use <Link legacyBehavior>.\\nLearn more: https://nextjs.org/docs/messages/invalid-new-link-with-extra-anchor'\n )\n }\n }\n }\n\n const childRef: any = legacyBehavior\n ? child && typeof child === 'object' && child.ref\n : forwardedRef\n\n // Use a callback ref to attach an IntersectionObserver to the anchor tag on\n // mount. In the future we will also use this to keep track of all the\n // currently mounted <Link> instances, e.g. so we can re-prefetch them after\n // a revalidation or refresh.\n const observeLinkVisibilityOnMount = React.useCallback(\n (element: HTMLAnchorElement | SVGAElement) => {\n if (router !== null) {\n linkInstanceRef.current = mountLinkInstance(\n element,\n href,\n router,\n fetchStrategy,\n prefetchEnabled,\n setOptimisticLinkStatus\n )\n }\n\n return () => {\n if (linkInstanceRef.current) {\n unmountLinkForCurrentNavigation(linkInstanceRef.current)\n linkInstanceRef.current = null\n }\n unmountPrefetchableInstance(element)\n }\n },\n [prefetchEnabled, href, router, fetchStrategy, setOptimisticLinkStatus]\n )\n\n const mergedRef = useMergedRef(observeLinkVisibilityOnMount, childRef)\n\n const childProps: {\n onTouchStart?: React.TouchEventHandler<HTMLAnchorElement>\n onMouseEnter: React.MouseEventHandler<HTMLAnchorElement>\n onClick: React.MouseEventHandler<HTMLAnchorElement>\n href?: string\n ref?: any\n } = {\n ref: mergedRef,\n onClick(e) {\n if (process.env.NODE_ENV !== 'production') {\n if (!e) {\n throw new Error(\n `Component rendered inside next/link has to pass click event to \"onClick\" prop.`\n )\n }\n }\n\n if (!legacyBehavior && typeof onClick === 'function') {\n onClick(e)\n }\n\n if (\n legacyBehavior &&\n child.props &&\n typeof child.props.onClick === 'function'\n ) {\n child.props.onClick(e)\n }\n\n if (!router) {\n return\n }\n if (e.defaultPrevented) {\n return\n }\n linkClicked(e, href, as, linkInstanceRef, replace, scroll, onNavigate)\n },\n onMouseEnter(e) {\n if (!legacyBehavior && typeof onMouseEnterProp === 'function') {\n onMouseEnterProp(e)\n }\n\n if (\n legacyBehavior &&\n child.props &&\n typeof child.props.onMouseEnter === 'function'\n ) {\n child.props.onMouseEnter(e)\n }\n\n if (!router) {\n return\n }\n if (!prefetchEnabled || process.env.NODE_ENV === 'development') {\n return\n }\n\n const upgradeToDynamicPrefetch = unstable_dynamicOnHover === true\n onNavigationIntent(\n e.currentTarget as HTMLAnchorElement | SVGAElement,\n upgradeToDynamicPrefetch\n )\n },\n onTouchStart: process.env.__NEXT_LINK_NO_TOUCH_START\n ? undefined\n : function onTouchStart(e) {\n if (!legacyBehavior && typeof onTouchStartProp === 'function') {\n onTouchStartProp(e)\n }\n\n if (\n legacyBehavior &&\n child.props &&\n typeof child.props.onTouchStart === 'function'\n ) {\n child.props.onTouchStart(e)\n }\n\n if (!router) {\n return\n }\n if (!prefetchEnabled) {\n return\n }\n\n const upgradeToDynamicPrefetch = unstable_dynamicOnHover === true\n onNavigationIntent(\n e.currentTarget as HTMLAnchorElement | SVGAElement,\n upgradeToDynamicPrefetch\n )\n },\n }\n\n // If the url is absolute, we can bypass the logic to prepend the basePath.\n if (isAbsoluteUrl(as)) {\n childProps.href = as\n } else if (\n !legacyBehavior ||\n passHref ||\n (child.type === 'a' && !('href' in child.props))\n ) {\n childProps.href = addBasePath(as)\n }\n\n let link: React.ReactNode\n\n if (legacyBehavior) {\n if (process.env.NODE_ENV === 'development') {\n errorOnce(\n '`legacyBehavior` is deprecated and will be removed in a future ' +\n 'release. A codemod is available to upgrade your components:\\n\\n' +\n 'npx @next/codemod@latest new-link .\\n\\n' +\n 'Learn more: https://nextjs.org/docs/app/building-your-application/upgrading/codemods#remove-a-tags-from-link-components'\n )\n }\n link = React.cloneElement(child, childProps)\n } else {\n link = (\n <a {...restProps} {...childProps}>\n {children}\n </a>\n )\n }\n\n return (\n <LinkStatusContext.Provider value={linkStatus}>\n {link}\n </LinkStatusContext.Provider>\n )\n}\n\nconst LinkStatusContext = createContext<\n typeof PENDING_LINK_STATUS | typeof IDLE_LINK_STATUS\n>(IDLE_LINK_STATUS)\n\nexport const useLinkStatus = () => {\n return useContext(LinkStatusContext)\n}\n\nfunction getFetchStrategyFromPrefetchProp(\n prefetchProp: Exclude<LinkProps['prefetch'], undefined | false>\n): PrefetchTaskFetchStrategy {\n if (process.env.__NEXT_CACHE_COMPONENTS) {\n if (prefetchProp === true) {\n return FetchStrategy.Full\n }\n\n // `null` or `\"auto\"`: this is the default \"auto\" mode, where we will prefetch partially if the link is in the viewport.\n // This will also include invalid prop values that don't match the types specified here.\n // (although those should've been filtered out by prop validation in dev)\n prefetchProp satisfies null | 'auto'\n return FetchStrategy.PPR\n } else {\n return prefetchProp === null || prefetchProp === 'auto'\n ? // We default to PPR, and we'll discover whether or not the route supports it with the initial prefetch.\n FetchStrategy.PPR\n : // In the old implementation without runtime prefetches, `prefetch={true}` forces all dynamic data to be prefetched.\n // To preserve backwards-compatibility, anything other than `false`, `null`, or `\"auto\"` results in a full prefetch.\n // (although invalid values should've been filtered out by prop validation in dev)\n FetchStrategy.Full\n }\n}\n","import type { ComponentProps } from 'react'\nimport ClientLinkComponent, { type LinkProps, useLinkStatus } from './link'\n\nexport default function LinkComponent(\n props: ComponentProps<typeof ClientLinkComponent>\n) {\n const isLegacyBehavior = props.legacyBehavior\n const childIsHostComponent =\n typeof props.children === 'string' ||\n typeof props.children === 'number' ||\n typeof (props.children as any)?.type === 'string'\n const childIsClientComponent =\n (props.children as any)?.type?.$$typeof ===\n Symbol.for('react.client.reference')\n\n if (isLegacyBehavior && !childIsHostComponent && !childIsClientComponent) {\n if ((props.children as any)?.type?.$$typeof === Symbol.for('react.lazy')) {\n console.error(\n `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.`\n )\n } else {\n console.error(\n `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.`\n )\n }\n }\n\n return <ClientLinkComponent {...props} />\n}\n\nexport { type LinkProps, useLinkStatus }\n","// NOTE: This file is compiled by Next.js.\n// Do not import `openclaw/plugin-sdk` here (it is provided by the gateway runtime, not as an npm dep).\n\ntype KitchenApi = {\n config: unknown;\n runtime: {\n system: { runCommandWithTimeout: (argv: string[], opts: { timeoutMs: number }) => Promise<{ stdout?: string; stderr?: string }> };\n };\n};\n\nexport function getKitchenApi(): KitchenApi {\n const api = (globalThis as unknown as { __clawkitchen_api?: KitchenApi }).__clawkitchen_api;\n if (!api) {\n throw new Error(\n \"ClawKitchen: OpenClaw plugin API not available. (This should only happen if Kitchen is started outside the gateway process.)\",\n );\n }\n return api;\n}\n","import { getKitchenApi } from \"@/lib/kitchen-api\";\nimport { 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\nfunction extractStdout(err: { stdout?: unknown }): string {\n if (typeof err.stdout === \"string\") return err.stdout;\n if (err.stdout && typeof err.stdout === \"object\" && \"toString\" in err.stdout) {\n return String((err.stdout as { toString: () => string }).toString());\n }\n return \"\";\n}\n\nfunction resolveExitCode(res: { exitCode?: unknown; code?: unknown; status?: unknown }): number {\n if (typeof res.exitCode === \"number\") return res.exitCode;\n if (typeof res.code === \"number\") return res.code;\n if (typeof res.status === \"number\") return res.status;\n return 0;\n}\n\nfunction extractStderr(err: { stderr?: unknown; message?: unknown }, fallback: unknown): string {\n if (typeof err.stderr === \"string\") return err.stderr;\n if (err.stderr && typeof err.stderr === \"object\" && \"toString\" in err.stderr) {\n return String((err.stderr as { toString: () => string }).toString());\n }\n if (typeof err.message === \"string\") return err.message;\n return String(fallback);\n}\n\n/**\n * Strip non-JSON diagnostic lines from stdout.\n *\n * OpenClaw may print plugin/doctor/diagnostic lines to stdout before the\n * actual JSON payload (e.g. \"[doctor] ...\", \"[plugins] ...\", \"🦞 OpenClaw ...\").\n * This breaks callers that do JSON.parse(stdout).\n *\n * If stdout looks like it contains a JSON payload with leading noise, strip the\n * noise lines. Otherwise return as-is (non-JSON commands like `config get` may\n * return plain text).\n */\nfunction sanitizeStdout(raw: string): string {\n const trimmed = raw.trim();\n if (!trimmed) return raw;\n\n // Fast path: already starts with JSON\n const firstChar = trimmed[0];\n if (firstChar === \"[\" || firstChar === \"{\" || firstChar === '\"') return raw;\n\n // Look for the first line starting with a JSON token\n const lines = trimmed.split(\"\\n\");\n const jsonStartIdx = lines.findIndex((l) => /^\\s*[[\\{\"]/.test(l));\n if (jsonStartIdx > 0) {\n // Verify the remainder is valid JSON before stripping\n const candidate = lines.slice(jsonStartIdx).join(\"\\n\");\n try {\n JSON.parse(candidate);\n return candidate;\n } catch {\n // Not valid JSON after stripping — return original\n }\n }\n\n return raw;\n}\n\nasync function runOpenClawLocal(args: string[], options: { sanitizeStdout?: boolean } = {}): Promise<OpenClawExecResult> {\n const { sanitizeStdout: shouldSanitize = true } = options;\n \n try {\n const isWindows = process.platform === \"win32\";\n const res = await execFileAsync(\"openclaw\", args, {\n timeout: 120000,\n windowsHide: true,\n maxBuffer: 10 * 1024 * 1024,\n // Windows requires shell:true to resolve executables on PATH via PATHEXT.\n // Without it, execFile throws ENOENT even when openclaw is installed globally.\n ...(isWindows ? { shell: true } : {}),\n });\n\n const rawStdout = String(res.stdout ?? \"\");\n \n return {\n ok: true,\n exitCode: 0,\n stdout: shouldSanitize ? sanitizeStdout(rawStdout) : rawStdout,\n stderr: String(res.stderr ?? \"\"),\n };\n } catch (e: unknown) {\n const err = e as { code?: unknown; stdout?: unknown; stderr?: unknown; message?: unknown };\n const exitCode = typeof err.code === \"number\" ? err.code : 1;\n const stdout = extractStdout(err);\n const stderr = extractStderr(err, e);\n return { ok: false, exitCode, stdout, stderr };\n }\n}\n\n/**\n * Extract a JSON payload from stdout that may contain non-JSON diagnostic lines\n * (e.g. [doctor], [plugins], [recipes] log lines before the actual JSON).\n * Returns the parsed value or null if no JSON found.\n */\nexport function extractJson<T = unknown>(stdout: string): T | null {\n const trimmed = stdout.trim();\n if (!trimmed) return null;\n\n // Fast path: pure JSON\n try {\n return JSON.parse(trimmed) as T;\n } catch {\n // fall through\n }\n\n // Find the first line starting with [ or { (JSON array/object)\n const lines = trimmed.split(\"\\n\");\n const jsonStartIdx = lines.findIndex((l) => /^\\s*[[\\{]/.test(l));\n if (jsonStartIdx >= 0) {\n const jsonSlice = lines.slice(jsonStartIdx).join(\"\\n\");\n try {\n return JSON.parse(jsonSlice) as T;\n } catch {\n // fall through\n }\n }\n\n // Last resort: find the last JSON block (scan from end)\n for (let i = lines.length - 1; i >= 0; i--) {\n if (/^\\s*[\\]}]/.test(lines[i])) {\n // Walk backward to find the matching open\n for (let j = i; j >= 0; j--) {\n if (/^\\s*[[\\{]/.test(lines[j])) {\n try {\n return JSON.parse(lines.slice(j, i + 1).join(\"\\n\")) as T;\n } catch {\n // continue searching\n }\n }\n }\n }\n }\n\n return null;\n}\n\n/**\n * Run OpenClaw without stdout sanitization (for raw text output like recipe markdown)\n */\nexport async function runOpenClawRaw(args: string[]): Promise<OpenClawExecResult> {\n // Always use local exec for raw content to avoid Kitchen runtime restrictions\n return runOpenClawLocal(args, { sanitizeStdout: false });\n}\n\nexport async function runOpenClaw(args: string[]): Promise<OpenClawExecResult> {\n // In some Kitchen runtime contexts, `api.runtime.system.runCommandWithTimeout`\n // is executed with a restricted allowlist that does not include the `cron` tool,\n // causing `openclaw cron ...` to fail with \"Tool not available: cron\".\n //\n // Cron routes need to work in the gateway-run Kitchen environment, so for cron\n // specifically we prefer a local exec (host OpenClaw).\n if (args[0] === \"cron\") return runOpenClawLocal(args);\n\n // Workflow runner/worker commands are long-running orchestration processes that\n // acquire locks and claims. The runtime command wrapper (runCommandWithTimeout)\n // has a 120s hard timeout that can kill these mid-execution, orphaning locks and\n // leaving runs stuck in waiting_workers. Route them through local exec instead.\n if (\n args[0] === \"recipes\" &&\n args[1] === \"workflows\" &&\n [\"runner-once\", \"runner-tick\", \"worker-tick\"].includes(args[2])\n ) {\n return runOpenClawLocal(args);\n }\n\n const api = getKitchenApi();\n try {\n const res = (await api.runtime.system.runCommandWithTimeout([\"openclaw\", ...args], { timeoutMs: 120000 })) as {\n stdout?: unknown;\n stderr?: unknown;\n exitCode?: unknown;\n code?: unknown;\n status?: unknown;\n };\n\n const stdout = sanitizeStdout(String(res.stdout ?? \"\"));\n const stderr = String(res.stderr ?? \"\");\n const exitCode = resolveExitCode(res);\n\n if (exitCode !== 0) return { ok: false, exitCode, stdout, stderr };\n return { ok: true, exitCode: 0, stdout, stderr };\n } catch (e: unknown) {\n const err = e as { code?: unknown; stdout?: unknown; stderr?: unknown; message?: unknown };\n const exitCode = typeof err.code === \"number\" ? err.code : 1;\n const stdout = extractStdout(err);\n const stderr = extractStderr(err, e);\n return { ok: false, exitCode, stdout, stderr };\n }\n}\n","import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { getTeamWorkspaceDir } from \"@/lib/paths\";\nimport { readdirFiles } from \"@/lib/workflows/readdir\";\nimport type { WorkflowFileV1 } from \"@/lib/workflows/types\";\n\nconst WORKFLOWS_DIR = path.join(\"shared-context\", \"workflows\");\n\nexport function workflowFileName(workflowId: string) {\n return `${workflowId}.workflow.json`;\n}\n\nexport function assertSafeWorkflowId(workflowId: string) {\n const id = String(workflowId ?? \"\").trim();\n if (!id) throw new Error(\"workflow id is required\");\n if (!/^[a-z0-9][a-z0-9-]{0,62}$/.test(id)) {\n throw new Error(\n \"Invalid workflow id. Use lowercase letters, numbers, and dashes (max 63 chars), e.g. marketing-cadence-v1\"\n );\n }\n return id;\n}\n\nexport async function getTeamWorkflowsDir(teamId: string) {\n const teamDir = await getTeamWorkspaceDir(teamId);\n return path.join(teamDir, WORKFLOWS_DIR);\n}\n\nexport async function listWorkflows(teamId: string) {\n const dir = await getTeamWorkflowsDir(teamId);\n return readdirFiles(dir, \".workflow.json\");\n}\n\nexport async function readWorkflow(teamId: string, workflowId: string) {\n const id = assertSafeWorkflowId(workflowId);\n const dir = await getTeamWorkflowsDir(teamId);\n const p = path.join(dir, workflowFileName(id));\n const raw = await fs.readFile(p, \"utf8\");\n const parsed = JSON.parse(raw) as WorkflowFileV1;\n return { ok: true as const, path: p, workflow: parsed };\n}\n\nexport async function writeWorkflow(teamId: string, workflow: WorkflowFileV1) {\n const id = assertSafeWorkflowId(workflow.id);\n const dir = await getTeamWorkflowsDir(teamId);\n await fs.mkdir(dir, { recursive: true });\n const p = path.join(dir, workflowFileName(id));\n const toWrite: WorkflowFileV1 = {\n ...workflow,\n schema: \"clawkitchen.workflow.v1\",\n id,\n };\n await fs.writeFile(p, JSON.stringify(toWrite, null, 2) + \"\\n\", \"utf8\");\n return { ok: true as const, path: p };\n}\n\nexport async function deleteWorkflow(teamId: string, workflowId: string) {\n const id = assertSafeWorkflowId(workflowId);\n const dir = await getTeamWorkflowsDir(teamId);\n const p = path.join(dir, workflowFileName(id));\n try {\n await fs.unlink(p);\n } catch (err: unknown) {\n if (err && typeof err === \"object\" && (err as { code?: unknown }).code === \"ENOENT\") {\n return { ok: true as const, path: p, existed: false as const };\n }\n throw err;\n }\n return { ok: true as const, path: p, existed: true as const };\n}\n","import fs from \"node:fs/promises\";\n\n/** Reads dir with optional suffix filter and reverse sort. Returns { ok, dir, files } or { ok, dir, files: [] } on ENOENT. */\nexport async function readdirFiles(\n dir: string,\n suffix: string,\n reverse = false\n): Promise<{ ok: true; dir: string; files: string[] }> {\n try {\n const entries = await fs.readdir(dir, { withFileTypes: true });\n let files = entries\n .filter((e) => e.isFile() && e.name.endsWith(suffix))\n .map((e) => e.name)\n .sort();\n if (reverse) files = files.reverse();\n return { ok: true as const, dir, files };\n } catch (err: unknown) {\n if (err && typeof err === \"object\" && (err as { code?: unknown }).code === \"ENOENT\") {\n return { ok: true as const, dir, files: [] as string[] };\n }\n throw err;\n }\n}\n","// This file is generated by next-core EcmascriptClientReferenceModule.\nimport { registerClientReference } from \"react-server-dom-turbopack/server\";\nexport default registerClientReference(\n function() { throw new Error(\"Attempted to call the default export of [project]/src/app/teams/[teamId]/deliverables/deliverables-client.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.\"); },\n \"[project]/src/app/teams/[teamId]/deliverables/deliverables-client.tsx\",\n \"default\",\n);\n","import Link from \"next/link\";\nimport { unstable_noStore as noStore } from \"next/cache\";\n\nimport DeliverablesClient from \"./deliverables-client\";\nimport { getTeamDisplayName } from \"@/lib/recipes\";\nimport { readWorkflow } from \"@/lib/workflows/storage\";\nimport type { WorkflowDeliverablesResponse } from \"@/app/api/teams/workflow-deliverables/route\";\n\nexport const dynamic = \"force-dynamic\";\nexport const revalidate = 0;\n\nexport default async function TeamDeliverablesPage({\n params,\n}: {\n params: Promise<{ teamId: string }>;\n}) {\n noStore();\n\n const { teamId } = await params;\n const teamName = await getTeamDisplayName(teamId);\n\n // Fetch deliverables from our API\n const baseUrl = process.env.KITCHEN_INTERNAL_URL || \"http://localhost:3000\";\n const response = await fetch(`${baseUrl}/api/teams/workflow-deliverables?teamId=${encodeURIComponent(teamId)}`, {\n cache: \"no-store\",\n });\n\n if (!response.ok) {\n return (\n <div className=\"flex flex-col gap-4\">\n <div>\n <h1 className=\"text-2xl font-semibold tracking-tight\">Deliverables</h1>\n <div className=\"mt-1 text-sm text-[color:var(--ck-text-secondary)]\">\n {teamName || teamId} · <span className=\"font-mono\">{teamId}</span>\n </div>\n </div>\n \n <div className=\"rounded-3xl border border-red-400/30 bg-red-500/10 p-4\">\n <div className=\"text-red-50\">Failed to load deliverables</div>\n <div className=\"mt-1 text-sm text-red-200\">\n Error: {response.status} {response.statusText}\n </div>\n </div>\n </div>\n );\n }\n\n const data = await response.json() as WorkflowDeliverablesResponse;\n \n if (!data.ok) {\n return (\n <div className=\"flex flex-col gap-4\">\n <div>\n <h1 className=\"text-2xl font-semibold tracking-tight\">Deliverables</h1>\n <div className=\"mt-1 text-sm text-[color:var(--ck-text-secondary)]\">\n {teamName || teamId} · <span className=\"font-mono\">{teamId}</span>\n </div>\n </div>\n \n <div className=\"rounded-3xl border border-red-400/30 bg-red-500/10 p-4\">\n <div className=\"text-red-50\">Failed to load deliverables</div>\n <div className=\"mt-1 text-sm text-red-200\">\n {(data as { error?: string }).error || \"Unknown error\"}\n </div>\n </div>\n </div>\n );\n }\n\n // Load workflow metadata for better display\n const wfIds = Array.from(new Set(data.deliverables.map((d) => d.workflowId).filter(Boolean))).sort();\n const workflows: Record<string, { id: string; name?: string }> = {};\n await Promise.all(\n wfIds.map(async (id) => {\n try {\n const { workflow } = await readWorkflow(teamId, id);\n workflows[id] = { id: workflow.id, name: workflow.name };\n } catch {\n workflows[id] = { id };\n }\n })\n );\n\n return (\n <div className=\"flex flex-col gap-4\">\n <div className=\"flex flex-wrap items-start justify-between gap-4\">\n <div>\n <h1 className=\"text-2xl font-semibold tracking-tight\">Deliverables</h1>\n <div className=\"mt-1 text-sm text-[color:var(--ck-text-secondary)]\">\n {teamName || teamId} · <span className=\"font-mono\">{teamId}</span>\n </div>\n <div className=\"mt-1 text-xs text-[color:var(--ck-text-tertiary)]\">\n Browse and access outputs from completed workflow runs\n </div>\n </div>\n\n <div className=\"flex items-center gap-3\">\n <Link\n href={`/teams/${encodeURIComponent(teamId)}/workflows`}\n className=\"text-sm font-medium text-[color:var(--ck-text-secondary)] hover:underline\"\n >\n Workflows →\n </Link>\n <Link\n href={`/runs?team=${encodeURIComponent(teamId)}`}\n className=\"text-sm font-medium text-[color:var(--ck-text-secondary)] hover:underline\"\n >\n Runs →\n </Link>\n </div>\n </div>\n\n <DeliverablesClient \n teamId={teamId} \n deliverables={data.deliverables} \n workflows={workflows}\n />\n </div>\n );\n}"],"names":["LinkComponent","useLinkStatus","isModifiedEvent","event","eventTarget","currentTarget","target","getAttribute","metaKey","ctrlKey","shiftKey","altKey","nativeEvent","which","linkClicked","e","href","as","linkInstanceRef","replace","scroll","onNavigate","window","nodeName","isAnchorNodeName","toUpperCase","hasAttribute","isLocalURL","preventDefault","location","isDefaultPrevented","dispatchNavigateAction","require","React","startTransition","current","formatStringOrUrl","urlObjOrString","formatUrl","props","linkStatus","setOptimisticLinkStatus","useOptimistic","IDLE_LINK_STATUS","children","useRef","hrefProp","asProp","childrenProp","prefetch","prefetchProp","passHref","shallow","onClick","onMouseEnter","onMouseEnterProp","onTouchStart","onTouchStartProp","legacyBehavior","ref","forwardedRef","unstable_dynamicOnHover","restProps","a","router","useContext","AppRouterContext","prefetchEnabled","fetchStrategy","getFetchStrategyFromPrefetchProp","FetchStrategy","PPR","process","env","NODE_ENV","createPropError","args","Error","key","expected","actual","requiredPropsGuard","requiredProps","Object","keys","forEach","_","optionalPropsGuard","optionalProps","valType","locale","warnOnce","pathname","hasDynamicSegment","split","some","segment","startsWith","endsWith","useMemo","resolvedHref","child","$$typeof","Symbol","for","console","warn","Children","only","err","type","childRef","observeLinkVisibilityOnMount","useCallback","element","mountLinkInstance","unmountLinkForCurrentNavigation","unmountPrefetchableInstance","mergedRef","useMergedRef","childProps","defaultPrevented","upgradeToDynamicPrefetch","onNavigationIntent","__NEXT_LINK_NO_TOUCH_START","undefined","isAbsoluteUrl","addBasePath","link","errorOnce","cloneElement","LinkStatusContext","Provider","value","createContext","__NEXT_CACHE_COMPONENTS","Full","isLegacyBehavior","childIsHostComponent","childIsClientComponent","error","ClientLinkComponent"],"mappings":"szBAAA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAmBO,eAAe,IACpB,IAAM,EAAI,EAA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AA,CACH,KAAM,CAAC,OAAO,EAAE,mBAAmB,GAAQ,UAAU,CAAC,CACtD,UAAU,qFACX,gBAGD,CAAA,EAAA,EAAA,GAAA,EAAC,EAAA,OAAI,CAAA,CACH,KAAM,CAAC,WAAW,EAAE,mBAAmB,GAAA,CAAS,CAChD,UAAU,qFACX,iBAML,CAAA,EAAA,EAAA,GAAA,EAAC,EAAA,OAAkB,CAAA,CACjB,OAAQ,EACR,aAAc,EAAK,YAAY,CAC/B,UAAW,MAInB,kCA/GuB,+BACG","ignoreList":[1,3,8]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/kitchen-api.ts","../../../../src/lib/openclaw.ts","../../../../src/lib/plugins.ts","../../../../src/app/teams/%5BteamId%5D/workflows/%5BworkflowId%5D/workflows-editor-client.tsx/__nextjs-internal-proxy.mjs","../../../../src/app/teams/%5BteamId%5D/workflows/%5BworkflowId%5D/page.tsx"],"sourcesContent":["// NOTE: This file is compiled by Next.js.\n// Do not import `openclaw/plugin-sdk` here (it is provided by the gateway runtime, not as an npm dep).\n\ntype KitchenApi = {\n config: unknown;\n runtime: {\n system: { runCommandWithTimeout: (argv: string[], opts: { timeoutMs: number }) => Promise<{ stdout?: string; stderr?: string }> };\n };\n};\n\nexport function getKitchenApi(): KitchenApi {\n const api = (globalThis as unknown as { __clawkitchen_api?: KitchenApi }).__clawkitchen_api;\n if (!api) {\n throw new Error(\n \"ClawKitchen: OpenClaw plugin API not available. (This should only happen if Kitchen is started outside the gateway process.)\",\n );\n }\n return api;\n}\n","import { getKitchenApi } from \"@/lib/kitchen-api\";\nimport { 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\nfunction extractStdout(err: { stdout?: unknown }): string {\n if (typeof err.stdout === \"string\") return err.stdout;\n if (err.stdout && typeof err.stdout === \"object\" && \"toString\" in err.stdout) {\n return String((err.stdout as { toString: () => string }).toString());\n }\n return \"\";\n}\n\nfunction resolveExitCode(res: { exitCode?: unknown; code?: unknown; status?: unknown }): number {\n if (typeof res.exitCode === \"number\") return res.exitCode;\n if (typeof res.code === \"number\") return res.code;\n if (typeof res.status === \"number\") return res.status;\n return 0;\n}\n\nfunction extractStderr(err: { stderr?: unknown; message?: unknown }, fallback: unknown): string {\n if (typeof err.stderr === \"string\") return err.stderr;\n if (err.stderr && typeof err.stderr === \"object\" && \"toString\" in err.stderr) {\n return String((err.stderr as { toString: () => string }).toString());\n }\n if (typeof err.message === \"string\") return err.message;\n return String(fallback);\n}\n\n/**\n * Strip non-JSON diagnostic lines from stdout.\n *\n * OpenClaw may print plugin/doctor/diagnostic lines to stdout before the\n * actual JSON payload (e.g. \"[doctor] ...\", \"[plugins] ...\", \"🦞 OpenClaw ...\").\n * This breaks callers that do JSON.parse(stdout).\n *\n * If stdout looks like it contains a JSON payload with leading noise, strip the\n * noise lines. Otherwise return as-is (non-JSON commands like `config get` may\n * return plain text).\n */\nfunction sanitizeStdout(raw: string): string {\n const trimmed = raw.trim();\n if (!trimmed) return raw;\n\n // Fast path: already starts with JSON\n const firstChar = trimmed[0];\n if (firstChar === \"[\" || firstChar === \"{\" || firstChar === '\"') return raw;\n\n // Look for the first line starting with a JSON token\n const lines = trimmed.split(\"\\n\");\n const jsonStartIdx = lines.findIndex((l) => /^\\s*[[\\{\"]/.test(l));\n if (jsonStartIdx > 0) {\n // Verify the remainder is valid JSON before stripping\n const candidate = lines.slice(jsonStartIdx).join(\"\\n\");\n try {\n JSON.parse(candidate);\n return candidate;\n } catch {\n // Not valid JSON after stripping — return original\n }\n }\n\n return raw;\n}\n\nasync function runOpenClawLocal(args: string[], options: { sanitizeStdout?: boolean } = {}): Promise<OpenClawExecResult> {\n const { sanitizeStdout: shouldSanitize = true } = options;\n \n try {\n const isWindows = process.platform === \"win32\";\n const res = await execFileAsync(\"openclaw\", args, {\n timeout: 120000,\n windowsHide: true,\n maxBuffer: 10 * 1024 * 1024,\n // Windows requires shell:true to resolve executables on PATH via PATHEXT.\n // Without it, execFile throws ENOENT even when openclaw is installed globally.\n ...(isWindows ? { shell: true } : {}),\n });\n\n const rawStdout = String(res.stdout ?? \"\");\n \n return {\n ok: true,\n exitCode: 0,\n stdout: shouldSanitize ? sanitizeStdout(rawStdout) : rawStdout,\n stderr: String(res.stderr ?? \"\"),\n };\n } catch (e: unknown) {\n const err = e as { code?: unknown; stdout?: unknown; stderr?: unknown; message?: unknown };\n const exitCode = typeof err.code === \"number\" ? err.code : 1;\n const stdout = extractStdout(err);\n const stderr = extractStderr(err, e);\n return { ok: false, exitCode, stdout, stderr };\n }\n}\n\n/**\n * Extract a JSON payload from stdout that may contain non-JSON diagnostic lines\n * (e.g. [doctor], [plugins], [recipes] log lines before the actual JSON).\n * Returns the parsed value or null if no JSON found.\n */\nexport function extractJson<T = unknown>(stdout: string): T | null {\n const trimmed = stdout.trim();\n if (!trimmed) return null;\n\n // Fast path: pure JSON\n try {\n return JSON.parse(trimmed) as T;\n } catch {\n // fall through\n }\n\n // Find the first line starting with [ or { (JSON array/object)\n const lines = trimmed.split(\"\\n\");\n const jsonStartIdx = lines.findIndex((l) => /^\\s*[[\\{]/.test(l));\n if (jsonStartIdx >= 0) {\n const jsonSlice = lines.slice(jsonStartIdx).join(\"\\n\");\n try {\n return JSON.parse(jsonSlice) as T;\n } catch {\n // fall through\n }\n }\n\n // Last resort: find the last JSON block (scan from end)\n for (let i = lines.length - 1; i >= 0; i--) {\n if (/^\\s*[\\]}]/.test(lines[i])) {\n // Walk backward to find the matching open\n for (let j = i; j >= 0; j--) {\n if (/^\\s*[[\\{]/.test(lines[j])) {\n try {\n return JSON.parse(lines.slice(j, i + 1).join(\"\\n\")) as T;\n } catch {\n // continue searching\n }\n }\n }\n }\n }\n\n return null;\n}\n\n/**\n * Run OpenClaw without stdout sanitization (for raw text output like recipe markdown)\n */\nexport async function runOpenClawRaw(args: string[]): Promise<OpenClawExecResult> {\n // Always use local exec for raw content to avoid Kitchen runtime restrictions\n return runOpenClawLocal(args, { sanitizeStdout: false });\n}\n\nexport async function runOpenClaw(args: string[]): Promise<OpenClawExecResult> {\n // In some Kitchen runtime contexts, `api.runtime.system.runCommandWithTimeout`\n // is executed with a restricted allowlist that does not include the `cron` tool,\n // causing `openclaw cron ...` to fail with \"Tool not available: cron\".\n //\n // Cron routes need to work in the gateway-run Kitchen environment, so for cron\n // specifically we prefer a local exec (host OpenClaw).\n if (args[0] === \"cron\") return runOpenClawLocal(args);\n\n // Workflow runner/worker commands are long-running orchestration processes that\n // acquire locks and claims. The runtime command wrapper (runCommandWithTimeout)\n // has a 120s hard timeout that can kill these mid-execution, orphaning locks and\n // leaving runs stuck in waiting_workers. Route them through local exec instead.\n if (\n args[0] === \"recipes\" &&\n args[1] === \"workflows\" &&\n [\"runner-once\", \"runner-tick\", \"worker-tick\"].includes(args[2])\n ) {\n return runOpenClawLocal(args);\n }\n\n const api = getKitchenApi();\n try {\n const res = (await api.runtime.system.runCommandWithTimeout([\"openclaw\", ...args], { timeoutMs: 120000 })) as {\n stdout?: unknown;\n stderr?: unknown;\n exitCode?: unknown;\n code?: unknown;\n status?: unknown;\n };\n\n const stdout = sanitizeStdout(String(res.stdout ?? \"\"));\n const stderr = String(res.stderr ?? \"\");\n const exitCode = resolveExitCode(res);\n\n if (exitCode !== 0) return { ok: false, exitCode, stdout, stderr };\n return { ok: true, exitCode: 0, stdout, stderr };\n } catch (e: unknown) {\n const err = e as { code?: unknown; stdout?: unknown; stderr?: unknown; message?: unknown };\n const exitCode = typeof err.code === \"number\" ? err.code : 1;\n const stdout = extractStdout(err);\n const stderr = extractStderr(err, e);\n return { ok: false, exitCode, stdout, stderr };\n }\n}\n","import { runOpenClaw } from \"@/lib/openclaw\";\n\nexport type PluginListEntry = {\n id?: unknown;\n enabled?: unknown;\n};\n\nfunction extractPluginEntries(raw: unknown): PluginListEntry[] {\n if (Array.isArray(raw)) return raw as PluginListEntry[];\n if (raw && typeof raw === \"object\" && Array.isArray((raw as { plugins?: unknown }).plugins)) {\n return (raw as { plugins: PluginListEntry[] }).plugins;\n }\n return [];\n}\n\nexport function parseEnabledPluginIds(stdout: string): string[] {\n const parsed = JSON.parse(stdout) as unknown;\n const items = extractPluginEntries(parsed);\n return items\n .filter((p) => Boolean(p) && typeof p === \"object\" && (p as { enabled?: unknown }).enabled === true)\n .map((p) => String(p.id ?? \"\"))\n .filter(Boolean);\n}\n\nexport async function getEnabledPluginIds(): Promise<{ ok: true; ids: string[] } | { ok: false; error: string }> {\n const res = await runOpenClaw([\"plugins\", \"list\", \"--json\", \"--verbose\"]);\n if (!res.ok) {\n const err = res.stderr.trim() || `openclaw plugins list failed (exit=${res.exitCode})`;\n return { ok: false, error: err };\n }\n\n try {\n return { ok: true, ids: parseEnabledPluginIds(res.stdout) };\n } catch {\n return { ok: false, error: \"Failed to parse openclaw plugins list output\" };\n }\n}\n\nexport async function isPluginEnabled(pluginId: string): Promise<boolean> {\n const res = await getEnabledPluginIds();\n if (!res.ok) return false;\n return res.ids.includes(pluginId);\n}\n","// This file is generated by next-core EcmascriptClientReferenceModule.\nimport { registerClientReference } from \"react-server-dom-turbopack/server\";\nexport default registerClientReference(\n function() { throw new Error(\"Attempted to call the default export of [project]/src/app/teams/[teamId]/workflows/[workflowId]/workflows-editor-client.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.\"); },\n \"[project]/src/app/teams/[teamId]/workflows/[workflowId]/workflows-editor-client.tsx\",\n \"default\",\n);\n","import { unstable_noStore as noStore } from \"next/cache\";\nimport WorkflowsEditorClient from \"./workflows-editor-client\";\nimport { isPluginEnabled } from \"@/lib/plugins\";\n\nexport const dynamic = \"force-dynamic\";\nexport const revalidate = 0;\n\nexport default async function WorkflowEditorPage({\n params,\n searchParams,\n}: {\n params: Promise<{ teamId: string; workflowId: string }>;\n searchParams?: Promise<Record<string, string | string[] | undefined>>;\n}) {\n noStore();\n\n const { teamId, workflowId } = await params;\n const sp = (await searchParams) ?? {};\n const draftRaw = sp.draft;\n const draft = Array.isArray(draftRaw) ? draftRaw[0] : draftRaw;\n\n // Full-bleed workflows editor (no extra top row / padding / border).\n return (\n <div className=\"flex h-full min-h-0 flex-col\">\n <WorkflowsEditorClient\n teamId={teamId}\n workflowId={workflowId}\n draft={draft === \"1\"}\n llmTaskEnabled={await isPluginEnabled(\"llm-task\")}\n />\n </div>\n );\n}\n"],"names":[],"mappings":"geCCA,IAAA,EAAA,EAAA,CAAA,CAAA,OAGA,IAAM,EAAgB,CAAA,EAFtB,AAEsB,EAFtB,CAAA,CAAA,OAEsB,SAAA,AAAS,EAAC,EAAA,QAAQ,EASxC,SAAS,EAAc,CAAyB,QAC9C,AAA0B,UAAtB,AAAgC,OAAzB,EAAI,MAAM,CAAsB,EAAI,MAAM,CACjD,EAAI,MAAM,EAA0B,UAAtB,OAAO,EAAI,MAAM,EAAiB,aAAc,EAAI,MAAM,CACnE,CADqE,MAC7D,EAAI,MAAM,CAAgC,QAAQ,IAE5D,EACT,CASA,SAAS,EAAc,CAA4C,CAAE,CAAiB,QACpF,AAA0B,UAAtB,AAAgC,OAAzB,EAAI,MAAM,CAAsB,EAAI,MAAM,CACjD,EAAI,MAAM,EAA0B,UAAtB,OAAO,EAAI,MAAM,EAAiB,aAAc,EAAI,MAAM,CACnE,CADqE,MAC7D,EAAI,MAAM,CAAgC,QAAQ,IAExC,UAAvB,AAAiC,OAA1B,EAAI,OAAO,CAAsB,EAAI,OAAO,CAChD,OAAO,EAChB,CAaA,SAAS,EAAe,CAAW,EACjC,IAAM,EAAU,EAAI,IAAI,GACxB,GAAI,CAAC,EAAS,OAAO,EAGrB,IAAM,EAAY,CAAO,CAAC,EAAE,CAC5B,GAAkB,MAAd,GAAmC,MAAd,GAAmC,MAAd,EAAmB,OAAO,EAGxE,IAAM,EAAQ,EAAQ,KAAK,CAAC,MACtB,EAAe,EAAM,SAAS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,CAAA,EADf,AACe,EADf,CAAA,CAAA,OACe,uBAAA,AAAuB,EAClC,WAAa,MAAM,AAAI,MAAM,2UAA6U,EAC1W,0GACA,gEAHW,CAAA,EAAA,AADf,EAAA,CAAA,CAAA,OACe,uBAAA,AAAuB,EAClC,WAAa,MAAM,AAAI,MAAM,uTAAyT,EACtV,sFACA,8GCLJ,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAKe,eAAe,EAAmB,QAC/C,CAAM,cACN,CAAY,CAIb,EACC,CAAA,EAAA,EAAA,gBAAA,AAAO,IAEP,GAAM,QAAE,CAAM,YAAE,CAAU,CAAE,CAAG,MAAM,EAE/B,EADM,AACK,OADC,GAAiB,EAAC,EAChB,KAAK,CACnB,EAAQ,MAAM,OAAO,CAAC,GAAY,CAAQ,CAAC,EAAE,CAAG,EAGtD,MACE,CAAA,EAAA,EAAA,GAAA,EAAC,MAAA,CAAI,UAAU,wCACb,CAAA,EAAA,EAAA,GAAA,EAAC,EAAA,OAAqB,CAAA,CACpB,OAAQ,EACR,WAAY,EACZ,MAAiB,MAAV,EACP,eAAgB,MAAM,CAAA,EAAA,EAAA,eAAA,AAAe,EAAC,eAI9C,kCA5BuB,+BACG","ignoreList":[3]}
|
|
@@ -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"))},50227,(a,b,c)=>{b.exports=a.x("node:path",()=>require("node:path"))},12714,(a,b,c)=>{b.exports=a.x("node:fs/promises",()=>require("node:fs/promises"))},60526,(a,b,c)=>{b.exports=a.x("node:os",()=>require("node:os"))},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"))},69264,a=>{a.n(a.i(54832))},50645,a=>{a.n(a.i(27572))},17537,a=>{a.n(a.i(3363))},13718,a=>{a.n(a.i(85523))},18198,a=>{a.n(a.i(45518))},5365,(a,b,c)=>{b.exports=a.x("process",()=>require("process"))},874,(a,b,c)=>{b.exports=a.x("buffer",()=>require("buffer"))},28215,a=>{"use strict";var b=a.i(12714),c=a.i(60526),d=a.i(50227);async function e(){let a=d.default.join(c.default.homedir(),".openclaw","openclaw.json");return JSON.parse(await b.default.readFile(a,"utf8"))}async function f(){let a=await e(),b=a.agents?.defaults?.workspace;if(!b)throw Error("agents.defaults.workspace is not set in ~/.openclaw/openclaw.json");return b}async function g(a){let b=c.default.homedir();if(!b)throw Error("Could not resolve home directory");return d.default.join(b,".openclaw",`workspace-${a}`)}a.s(["getTeamWorkspaceDir",()=>g,"getWorkspaceDir",()=>f])},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);function d(a){return"string"==typeof a.stdout?a.stdout:a.stdout&&"object"==typeof a.stdout&&"toString"in a.stdout?String(a.stdout.toString()):""}function e(a,b){return"string"==typeof a.stderr?a.stderr:a.stderr&&"object"==typeof a.stderr&&"toString"in a.stderr?String(a.stderr.toString()):"string"==typeof a.message?a.message:String(b)}function f(a){let b=a.trim();if(!b)return a;let c=b[0];if("["===c||"{"===c||'"'===c)return a;let d=b.split("\n"),e=d.findIndex(a=>/^\s*[[\{"]/.test(a));if(e>0){let a=d.slice(e).join("\n");try{return JSON.parse(a),a}catch{}}return a}async function g(a,b={}){let{sanitizeStdout:h=!0}=b;try{process.platform;let b=await c("openclaw",a,{timeout:12e4,windowsHide:!0,maxBuffer:0xa00000}),d=String(b.stdout??"");return{ok:!0,exitCode:0,stdout:h?f(d):d,stderr:String(b.stderr??"")}}catch(b){let a="number"==typeof b.code?b.code:1;return{ok:!1,exitCode:a,stdout:d(b),stderr:e(b,b)}}}function h(a){let b=a.trim();if(!b)return null;try{return JSON.parse(b)}catch{}let c=b.split("\n"),d=c.findIndex(a=>/^\s*[[\{]/.test(a));if(d>=0){let a=c.slice(d).join("\n");try{return JSON.parse(a)}catch{}}for(let a=c.length-1;a>=0;a--)if(/^\s*[\]}]/.test(c[a])){for(let b=a;b>=0;b--)if(/^\s*[[\{]/.test(c[b]))try{return JSON.parse(c.slice(b,a+1).join("\n"))}catch{}}return null}async function i(a){return g(a,{sanitizeStdout:!1})}async function j(a){if("cron"===a[0]||"recipes"===a[0]&&"workflows"===a[1]&&["runner-once","runner-tick","worker-tick"].includes(a[2]))return g(a);let b=function(){let a=globalThis.__clawkitchen_api;if(!a)throw Error("ClawKitchen: OpenClaw plugin API not available. (This should only happen if Kitchen is started outside the gateway process.)");return a}();try{let c=await b.runtime.system.runCommandWithTimeout(["openclaw",...a],{timeoutMs:12e4}),d=f(String(c.stdout??"")),e=String(c.stderr??""),g="number"==typeof c.exitCode?c.exitCode:"number"==typeof c.code?c.code:"number"==typeof c.status?c.status:0;if(0!==g)return{ok:!1,exitCode:g,stdout:d,stderr:e};return{ok:!0,exitCode:0,stdout:d,stderr:e}}catch(b){let a="number"==typeof b.code?b.code:1;return{ok:!1,exitCode:a,stdout:d(b),stderr:e(b,b)}}}a.s(["extractJson",()=>h,"runOpenClaw",()=>j,"runOpenClawRaw",()=>i],83643)},94510,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/recipes/[id]/RecipeEditor/index.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/recipes/[id]/RecipeEditor/index.tsx <module evaluation>","default")},87732,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/recipes/[id]/RecipeEditor/index.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/recipes/[id]/RecipeEditor/index.tsx","default")},62485,a=>{"use strict";a.i(94510);var b=a.i(87732);a.n(b)},79604,a=>{"use strict";var b=a.i(7997),c=a.i(95936),d=a.i(18558),e=a.i(15629),f=a.i(62485);async function g(a){let b=await (0,e.listRecipes)();return b.find(b=>b.id===a)?.kind??null}async function h({params:a}){(0,d.unstable_noStore)();let{id:e}=await a;return await g(e),(0,b.jsxs)("main",{className:"min-h-screen p-8",children:[(0,b.jsx)("div",{className:"mx-auto mb-4 max-w-6xl",children:(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:"← Back to recipes"})}),(0,b.jsx)(f.default,{recipeId:e})]})}a.s(["default",()=>h,"dynamic",0,"force-dynamic","revalidate",0,0])}];
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__6390ce9c._.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/paths.ts","../../../../node_modules/next/dist/client/app-dir/link.js/__nextjs-internal-proxy.cjs","../../../../node_modules/next/src/client/app-dir/link.tsx","../../../../node_modules/next/src/client/app-dir/link.react-server.tsx","../../../../src/lib/kitchen-api.ts","../../../../src/lib/openclaw.ts","../../../../src/app/recipes/%5Bid%5D/RecipeEditor/index.tsx/__nextjs-internal-proxy.mjs","../../../../src/app/recipes/%5Bid%5D/page.tsx"],"sourcesContent":["import fs from \"node:fs/promises\";\nimport os from \"node:os\";\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 // OpenClaw message routing bindings (used for HITL approvals, etc.)\n bindings?: unknown[];\n};\n\nexport async function readOpenClawConfig(): Promise<OpenClawConfig> {\n const p = path.join(os.homedir(), \".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\n // Back-compat: some installs keep goals at <workspace>/goals.\n // Prefer that when present, otherwise fall back to <workspace>/notes/goals.\n const direct = path.join(ws, \"goals\");\n try {\n const st = await fs.stat(direct);\n if (st.isDirectory()) return direct;\n } catch {\n // ignore\n }\n\n return path.join(ws, \"notes\", \"goals\");\n}\n\nexport async function getTeamWorkspaceDir(teamId: string) {\n const home = os.homedir();\n if (!home) throw new Error(\"Could not resolve home directory\");\n return path.join(home, \".openclaw\", `workspace-${teamId}`);\n}\n\n/** Team workspace dir derived from agents.defaults.workspace (sibling: .. / workspace-{teamId}) */\nexport function teamDirFromBaseWorkspace(baseWorkspace: string, teamId: string) {\n // Special-case: treat \"main\" as the personal workspace (agents.defaults.workspace).\n // This lets Kitchen expose a selectable \"main\" scope without creating a separate\n // ~/.openclaw/workspace-main folder.\n if (teamId === \"main\") return path.resolve(baseWorkspace);\n return path.resolve(baseWorkspace, \"..\", `workspace-${teamId}`);\n}\n\n/** Rejects path traversal and empty names; returns normalized name. */\nexport function assertSafeRelativeFileName(name: string): string {\n const n = name.replace(/\\\\/g, \"/\");\n if (!n || n.startsWith(\"/\") || n.includes(\"..\")) throw new Error(\"Invalid file name\");\n return n;\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","// This file is generated by next-core EcmascriptClientReferenceModule.\nconst { createClientModuleProxy } = require(\"react-server-dom-turbopack/server\");\n\n__turbopack_context__.n(createClientModuleProxy(\"[project]/node_modules/next/dist/client/app-dir/link.js\"));\n","'use client'\n\nimport React, { createContext, useContext, useOptimistic, useRef } from 'react'\nimport type { UrlObject } from 'url'\nimport { formatUrl } from '../../shared/lib/router/utils/format-url'\nimport { AppRouterContext } from '../../shared/lib/app-router-context.shared-runtime'\nimport { useMergedRef } from '../use-merged-ref'\nimport { isAbsoluteUrl } from '../../shared/lib/utils'\nimport { addBasePath } from '../add-base-path'\nimport { warnOnce } from '../../shared/lib/utils/warn-once'\nimport type { PENDING_LINK_STATUS } from '../components/links'\nimport {\n IDLE_LINK_STATUS,\n mountLinkInstance,\n onNavigationIntent,\n unmountLinkForCurrentNavigation,\n unmountPrefetchableInstance,\n type LinkInstance,\n} from '../components/links'\nimport { isLocalURL } from '../../shared/lib/router/utils/is-local-url'\nimport {\n FetchStrategy,\n type PrefetchTaskFetchStrategy,\n} from '../components/segment-cache/types'\nimport { errorOnce } from '../../shared/lib/utils/error-once'\n\ntype Url = string | UrlObject\ntype RequiredKeys<T> = {\n [K in keyof T]-?: {} extends Pick<T, K> ? never : K\n}[keyof T]\ntype OptionalKeys<T> = {\n [K in keyof T]-?: {} extends Pick<T, K> ? K : never\n}[keyof T]\n\ntype OnNavigateEventHandler = (event: { preventDefault: () => void }) => void\n\ntype InternalLinkProps = {\n /**\n * **Required**. The path or URL to navigate to. It can also be an object (similar to `URL`).\n *\n * @example\n * ```tsx\n * // Navigate to /dashboard:\n * <Link href=\"/dashboard\">Dashboard</Link>\n *\n * // Navigate to /about?name=test:\n * <Link href={{ pathname: '/about', query: { name: 'test' } }}>\n * About\n * </Link>\n * ```\n *\n * @remarks\n * - For external URLs, use a fully qualified URL such as `https://...`.\n * - In the App Router, dynamic routes must not include bracketed segments in `href`.\n */\n href: Url\n\n /**\n * @deprecated v10.0.0: `href` props pointing to a dynamic route are\n * automatically resolved and no longer require the `as` prop.\n */\n as?: Url\n\n /**\n * Replace the current `history` state instead of adding a new URL into the stack.\n *\n * @defaultValue `false`\n *\n * @example\n * ```tsx\n * <Link href=\"/about\" replace>\n * About (replaces the history state)\n * </Link>\n * ```\n */\n replace?: boolean\n\n /**\n * Whether to override the default scroll behavior. If `true`, Next.js attempts to maintain\n * the scroll position if the newly navigated page is still visible. If not, it scrolls to the top.\n *\n * If `false`, Next.js will not modify the scroll behavior at all.\n *\n * @defaultValue `true`\n *\n * @example\n * ```tsx\n * <Link href=\"/dashboard\" scroll={false}>\n * No auto scroll\n * </Link>\n * ```\n */\n scroll?: boolean\n\n /**\n * Update the path of the current page without rerunning data fetching methods\n * like `getStaticProps`, `getServerSideProps`, or `getInitialProps`.\n *\n * @remarks\n * `shallow` only applies to the Pages Router. For the App Router, see the\n * [following documentation](https://nextjs.org/docs/app/building-your-application/routing/linking-and-navigating#using-the-native-history-api).\n *\n * @defaultValue `false`\n *\n * @example\n * ```tsx\n * <Link href=\"/blog\" shallow>\n * Shallow navigation\n * </Link>\n * ```\n */\n shallow?: boolean\n\n /**\n * Forces `Link` to pass its `href` to the child component. Useful if the child is a custom\n * component that wraps an `<a>` tag, or if you're using certain styling libraries.\n *\n * @defaultValue `false`\n *\n * @example\n * ```tsx\n * <Link href=\"/dashboard\" passHref legacyBehavior>\n * <MyStyledAnchor>Dashboard</MyStyledAnchor>\n * </Link>\n * ```\n */\n passHref?: boolean\n\n /**\n * Prefetch the page in the background.\n * Any `<Link />` that is in the viewport (initially or through scroll) will be prefetched.\n * Prefetch can be disabled by passing `prefetch={false}`.\n *\n * @remarks\n * Prefetching is only enabled in production.\n *\n * - In the **App Router**:\n * - `\"auto\"`, `null`, `undefined` (default): Prefetch behavior depends on static vs dynamic routes:\n * - Static routes: fully prefetched\n * - Dynamic routes: partial prefetch to the nearest segment with a `loading.js`\n * - `true`: Always prefetch the full route and data.\n * - `false`: Disable prefetching on both viewport and hover.\n * - In the **Pages Router**:\n * - `true` (default): Prefetches the route and data in the background on viewport or hover.\n * - `false`: Prefetch only on hover, not on viewport.\n *\n * @defaultValue `true` (Pages Router) or `null` (App Router)\n *\n * @example\n * ```tsx\n * <Link href=\"/dashboard\" prefetch={false}>\n * Dashboard\n * </Link>\n * ```\n */\n prefetch?: boolean | 'auto' | null\n\n /**\n * (unstable) Switch to a full prefetch on hover. Effectively the same as\n * updating the prefetch prop to `true` in a mouse event.\n */\n unstable_dynamicOnHover?: boolean\n\n /**\n * The active locale is automatically prepended in the Pages Router. `locale` allows for providing\n * a different locale, or can be set to `false` to opt out of automatic locale behavior.\n *\n * @remarks\n * Note: locale only applies in the Pages Router and is ignored in the App Router.\n *\n * @example\n * ```tsx\n * // Use the 'fr' locale:\n * <Link href=\"/about\" locale=\"fr\">\n * About (French)\n * </Link>\n *\n * // Disable locale prefix:\n * <Link href=\"/about\" locale={false}>\n * About (no locale prefix)\n * </Link>\n * ```\n */\n locale?: string | false\n\n /**\n * Enable legacy link behavior.\n *\n * @deprecated This will be removed in a future version\n * @defaultValue `false`\n * @see https://github.com/vercel/next.js/commit/489e65ed98544e69b0afd7e0cfc3f9f6c2b803b7\n */\n legacyBehavior?: boolean\n\n /**\n * Optional event handler for when the mouse pointer is moved onto the `<Link>`.\n */\n onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>\n\n /**\n * Optional event handler for when the `<Link>` is touched.\n */\n onTouchStart?: React.TouchEventHandler<HTMLAnchorElement>\n\n /**\n * Optional event handler for when the `<Link>` is clicked.\n */\n onClick?: React.MouseEventHandler<HTMLAnchorElement>\n\n /**\n * Optional event handler for when the `<Link>` is navigated.\n */\n onNavigate?: OnNavigateEventHandler\n}\n\n// TODO-APP: Include the full set of Anchor props\n// adding this to the publicly exported type currently breaks existing apps\n\n// `RouteInferType` is a stub here to avoid breaking `typedRoutes` when the type\n// isn't generated yet. It will be replaced when type generation runs.\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport type LinkProps<RouteInferType = any> = InternalLinkProps\ntype LinkPropsRequired = RequiredKeys<LinkProps>\ntype LinkPropsOptional = OptionalKeys<Omit<InternalLinkProps, 'locale'>>\n\nfunction isModifiedEvent(event: React.MouseEvent): boolean {\n const eventTarget = event.currentTarget as HTMLAnchorElement | SVGAElement\n const target = eventTarget.getAttribute('target')\n return (\n (target && target !== '_self') ||\n event.metaKey ||\n event.ctrlKey ||\n event.shiftKey ||\n event.altKey || // triggers resource download\n (event.nativeEvent && event.nativeEvent.which === 2)\n )\n}\n\nfunction linkClicked(\n e: React.MouseEvent,\n href: string,\n as: string,\n linkInstanceRef: React.RefObject<LinkInstance | null>,\n replace?: boolean,\n scroll?: boolean,\n onNavigate?: OnNavigateEventHandler\n): void {\n if (typeof window !== 'undefined') {\n const { nodeName } = e.currentTarget\n\n // anchors inside an svg have a lowercase nodeName\n const isAnchorNodeName = nodeName.toUpperCase() === 'A'\n if (\n (isAnchorNodeName && isModifiedEvent(e)) ||\n e.currentTarget.hasAttribute('download')\n ) {\n // ignore click for browser’s default behavior\n return\n }\n\n if (!isLocalURL(href)) {\n if (replace) {\n // browser default behavior does not replace the history state\n // so we need to do it manually\n e.preventDefault()\n location.replace(href)\n }\n\n // ignore click for browser’s default behavior\n return\n }\n\n e.preventDefault()\n\n if (onNavigate) {\n let isDefaultPrevented = false\n\n onNavigate({\n preventDefault: () => {\n isDefaultPrevented = true\n },\n })\n\n if (isDefaultPrevented) {\n return\n }\n }\n\n const { dispatchNavigateAction } =\n require('../components/app-router-instance') as typeof import('../components/app-router-instance')\n\n React.startTransition(() => {\n dispatchNavigateAction(\n as || href,\n replace ? 'replace' : 'push',\n scroll ?? true,\n linkInstanceRef.current\n )\n })\n }\n}\n\nfunction formatStringOrUrl(urlObjOrString: UrlObject | string): string {\n if (typeof urlObjOrString === 'string') {\n return urlObjOrString\n }\n\n return formatUrl(urlObjOrString)\n}\n\n/**\n * A React component that extends the HTML `<a>` element to provide\n * [prefetching](https://nextjs.org/docs/app/building-your-application/routing/linking-and-navigating#2-prefetching)\n * and client-side navigation. This is the primary way to navigate between routes in Next.js.\n *\n * @remarks\n * - Prefetching is only enabled in production.\n *\n * @see https://nextjs.org/docs/app/api-reference/components/link\n */\nexport default function LinkComponent(\n props: LinkProps & {\n children: React.ReactNode\n ref: React.Ref<HTMLAnchorElement>\n }\n) {\n const [linkStatus, setOptimisticLinkStatus] = useOptimistic(IDLE_LINK_STATUS)\n\n let children: React.ReactNode\n\n const linkInstanceRef = useRef<LinkInstance | null>(null)\n\n const {\n href: hrefProp,\n as: asProp,\n children: childrenProp,\n prefetch: prefetchProp = null,\n passHref,\n replace,\n shallow,\n scroll,\n onClick,\n onMouseEnter: onMouseEnterProp,\n onTouchStart: onTouchStartProp,\n legacyBehavior = false,\n onNavigate,\n ref: forwardedRef,\n unstable_dynamicOnHover,\n ...restProps\n } = props\n\n children = childrenProp\n\n if (\n legacyBehavior &&\n (typeof children === 'string' || typeof children === 'number')\n ) {\n children = <a>{children}</a>\n }\n\n const router = React.useContext(AppRouterContext)\n\n const prefetchEnabled = prefetchProp !== false\n\n const fetchStrategy =\n prefetchProp !== false\n ? getFetchStrategyFromPrefetchProp(prefetchProp)\n : // TODO: it makes no sense to assign a fetchStrategy when prefetching is disabled.\n FetchStrategy.PPR\n\n if (process.env.NODE_ENV !== 'production') {\n function createPropError(args: {\n key: string\n expected: string\n actual: string\n }) {\n return new Error(\n `Failed prop type: The prop \\`${args.key}\\` expects a ${args.expected} in \\`<Link>\\`, but got \\`${args.actual}\\` instead.` +\n (typeof window !== 'undefined'\n ? \"\\nOpen your browser's console to view the Component stack trace.\"\n : '')\n )\n }\n\n // TypeScript trick for type-guarding:\n const requiredPropsGuard: Record<LinkPropsRequired, true> = {\n href: true,\n } as const\n const requiredProps: LinkPropsRequired[] = Object.keys(\n requiredPropsGuard\n ) as LinkPropsRequired[]\n requiredProps.forEach((key: LinkPropsRequired) => {\n if (key === 'href') {\n if (\n props[key] == null ||\n (typeof props[key] !== 'string' && typeof props[key] !== 'object')\n ) {\n throw createPropError({\n key,\n expected: '`string` or `object`',\n actual: props[key] === null ? 'null' : typeof props[key],\n })\n }\n } else {\n // TypeScript trick for type-guarding:\n const _: never = key\n }\n })\n\n // TypeScript trick for type-guarding:\n const optionalPropsGuard: Record<LinkPropsOptional, true> = {\n as: true,\n replace: true,\n scroll: true,\n shallow: true,\n passHref: true,\n prefetch: true,\n unstable_dynamicOnHover: true,\n onClick: true,\n onMouseEnter: true,\n onTouchStart: true,\n legacyBehavior: true,\n onNavigate: true,\n } as const\n const optionalProps: LinkPropsOptional[] = Object.keys(\n optionalPropsGuard\n ) as LinkPropsOptional[]\n optionalProps.forEach((key: LinkPropsOptional) => {\n const valType = typeof props[key]\n\n if (key === 'as') {\n if (props[key] && valType !== 'string' && valType !== 'object') {\n throw createPropError({\n key,\n expected: '`string` or `object`',\n actual: valType,\n })\n }\n } else if (\n key === 'onClick' ||\n key === 'onMouseEnter' ||\n key === 'onTouchStart' ||\n key === 'onNavigate'\n ) {\n if (props[key] && valType !== 'function') {\n throw createPropError({\n key,\n expected: '`function`',\n actual: valType,\n })\n }\n } else if (\n key === 'replace' ||\n key === 'scroll' ||\n key === 'shallow' ||\n key === 'passHref' ||\n key === 'legacyBehavior' ||\n key === 'unstable_dynamicOnHover'\n ) {\n if (props[key] != null && valType !== 'boolean') {\n throw createPropError({\n key,\n expected: '`boolean`',\n actual: valType,\n })\n }\n } else if (key === 'prefetch') {\n if (\n props[key] != null &&\n valType !== 'boolean' &&\n props[key] !== 'auto'\n ) {\n throw createPropError({\n key,\n expected: '`boolean | \"auto\"`',\n actual: valType,\n })\n }\n } else {\n // TypeScript trick for type-guarding:\n const _: never = key\n }\n })\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (props.locale) {\n warnOnce(\n 'The `locale` prop is not supported in `next/link` while using the `app` router. Read more about app router internalization: https://nextjs.org/docs/app/building-your-application/routing/internationalization'\n )\n }\n if (!asProp) {\n let href: string | undefined\n if (typeof hrefProp === 'string') {\n href = hrefProp\n } else if (\n typeof hrefProp === 'object' &&\n typeof hrefProp.pathname === 'string'\n ) {\n href = hrefProp.pathname\n }\n\n if (href) {\n const hasDynamicSegment = href\n .split('/')\n .some((segment) => segment.startsWith('[') && segment.endsWith(']'))\n\n if (hasDynamicSegment) {\n throw new Error(\n `Dynamic href \\`${href}\\` found in <Link> while using the \\`/app\\` router, this is not supported. Read more: https://nextjs.org/docs/messages/app-dir-dynamic-href`\n )\n }\n }\n }\n }\n\n const { href, as } = React.useMemo(() => {\n const resolvedHref = formatStringOrUrl(hrefProp)\n return {\n href: resolvedHref,\n as: asProp ? formatStringOrUrl(asProp) : resolvedHref,\n }\n }, [hrefProp, asProp])\n\n // This will return the first child, if multiple are provided it will throw an error\n let child: any\n if (legacyBehavior) {\n if ((children as any)?.$$typeof === Symbol.for('react.lazy')) {\n throw new Error(\n `\\`<Link legacyBehavior>\\` received a direct child that is either a Server Component, or JSX that was loaded with React.lazy(). This is not supported. Either remove legacyBehavior, or make the direct child a Client Component that renders the Link's \\`<a>\\` tag.`\n )\n }\n\n if (process.env.NODE_ENV === 'development') {\n if (onClick) {\n console.warn(\n `\"onClick\" was passed to <Link> with \\`href\\` of \\`${hrefProp}\\` but \"legacyBehavior\" was set. The legacy behavior requires onClick be set on the child of next/link`\n )\n }\n if (onMouseEnterProp) {\n console.warn(\n `\"onMouseEnter\" was passed to <Link> with \\`href\\` of \\`${hrefProp}\\` but \"legacyBehavior\" was set. The legacy behavior requires onMouseEnter be set on the child of next/link`\n )\n }\n try {\n child = React.Children.only(children)\n } catch (err) {\n if (!children) {\n throw new Error(\n `No children were passed to <Link> with \\`href\\` of \\`${hrefProp}\\` but one child is required https://nextjs.org/docs/messages/link-no-children`\n )\n }\n throw new Error(\n `Multiple children were passed to <Link> with \\`href\\` of \\`${hrefProp}\\` but only one child is supported https://nextjs.org/docs/messages/link-multiple-children` +\n (typeof window !== 'undefined'\n ? \" \\nOpen your browser's console to view the Component stack trace.\"\n : '')\n )\n }\n } else {\n child = React.Children.only(children)\n }\n } else {\n if (process.env.NODE_ENV === 'development') {\n if ((children as any)?.type === 'a') {\n throw new Error(\n 'Invalid <Link> with <a> child. Please remove <a> or use <Link legacyBehavior>.\\nLearn more: https://nextjs.org/docs/messages/invalid-new-link-with-extra-anchor'\n )\n }\n }\n }\n\n const childRef: any = legacyBehavior\n ? child && typeof child === 'object' && child.ref\n : forwardedRef\n\n // Use a callback ref to attach an IntersectionObserver to the anchor tag on\n // mount. In the future we will also use this to keep track of all the\n // currently mounted <Link> instances, e.g. so we can re-prefetch them after\n // a revalidation or refresh.\n const observeLinkVisibilityOnMount = React.useCallback(\n (element: HTMLAnchorElement | SVGAElement) => {\n if (router !== null) {\n linkInstanceRef.current = mountLinkInstance(\n element,\n href,\n router,\n fetchStrategy,\n prefetchEnabled,\n setOptimisticLinkStatus\n )\n }\n\n return () => {\n if (linkInstanceRef.current) {\n unmountLinkForCurrentNavigation(linkInstanceRef.current)\n linkInstanceRef.current = null\n }\n unmountPrefetchableInstance(element)\n }\n },\n [prefetchEnabled, href, router, fetchStrategy, setOptimisticLinkStatus]\n )\n\n const mergedRef = useMergedRef(observeLinkVisibilityOnMount, childRef)\n\n const childProps: {\n onTouchStart?: React.TouchEventHandler<HTMLAnchorElement>\n onMouseEnter: React.MouseEventHandler<HTMLAnchorElement>\n onClick: React.MouseEventHandler<HTMLAnchorElement>\n href?: string\n ref?: any\n } = {\n ref: mergedRef,\n onClick(e) {\n if (process.env.NODE_ENV !== 'production') {\n if (!e) {\n throw new Error(\n `Component rendered inside next/link has to pass click event to \"onClick\" prop.`\n )\n }\n }\n\n if (!legacyBehavior && typeof onClick === 'function') {\n onClick(e)\n }\n\n if (\n legacyBehavior &&\n child.props &&\n typeof child.props.onClick === 'function'\n ) {\n child.props.onClick(e)\n }\n\n if (!router) {\n return\n }\n if (e.defaultPrevented) {\n return\n }\n linkClicked(e, href, as, linkInstanceRef, replace, scroll, onNavigate)\n },\n onMouseEnter(e) {\n if (!legacyBehavior && typeof onMouseEnterProp === 'function') {\n onMouseEnterProp(e)\n }\n\n if (\n legacyBehavior &&\n child.props &&\n typeof child.props.onMouseEnter === 'function'\n ) {\n child.props.onMouseEnter(e)\n }\n\n if (!router) {\n return\n }\n if (!prefetchEnabled || process.env.NODE_ENV === 'development') {\n return\n }\n\n const upgradeToDynamicPrefetch = unstable_dynamicOnHover === true\n onNavigationIntent(\n e.currentTarget as HTMLAnchorElement | SVGAElement,\n upgradeToDynamicPrefetch\n )\n },\n onTouchStart: process.env.__NEXT_LINK_NO_TOUCH_START\n ? undefined\n : function onTouchStart(e) {\n if (!legacyBehavior && typeof onTouchStartProp === 'function') {\n onTouchStartProp(e)\n }\n\n if (\n legacyBehavior &&\n child.props &&\n typeof child.props.onTouchStart === 'function'\n ) {\n child.props.onTouchStart(e)\n }\n\n if (!router) {\n return\n }\n if (!prefetchEnabled) {\n return\n }\n\n const upgradeToDynamicPrefetch = unstable_dynamicOnHover === true\n onNavigationIntent(\n e.currentTarget as HTMLAnchorElement | SVGAElement,\n upgradeToDynamicPrefetch\n )\n },\n }\n\n // If the url is absolute, we can bypass the logic to prepend the basePath.\n if (isAbsoluteUrl(as)) {\n childProps.href = as\n } else if (\n !legacyBehavior ||\n passHref ||\n (child.type === 'a' && !('href' in child.props))\n ) {\n childProps.href = addBasePath(as)\n }\n\n let link: React.ReactNode\n\n if (legacyBehavior) {\n if (process.env.NODE_ENV === 'development') {\n errorOnce(\n '`legacyBehavior` is deprecated and will be removed in a future ' +\n 'release. A codemod is available to upgrade your components:\\n\\n' +\n 'npx @next/codemod@latest new-link .\\n\\n' +\n 'Learn more: https://nextjs.org/docs/app/building-your-application/upgrading/codemods#remove-a-tags-from-link-components'\n )\n }\n link = React.cloneElement(child, childProps)\n } else {\n link = (\n <a {...restProps} {...childProps}>\n {children}\n </a>\n )\n }\n\n return (\n <LinkStatusContext.Provider value={linkStatus}>\n {link}\n </LinkStatusContext.Provider>\n )\n}\n\nconst LinkStatusContext = createContext<\n typeof PENDING_LINK_STATUS | typeof IDLE_LINK_STATUS\n>(IDLE_LINK_STATUS)\n\nexport const useLinkStatus = () => {\n return useContext(LinkStatusContext)\n}\n\nfunction getFetchStrategyFromPrefetchProp(\n prefetchProp: Exclude<LinkProps['prefetch'], undefined | false>\n): PrefetchTaskFetchStrategy {\n if (process.env.__NEXT_CACHE_COMPONENTS) {\n if (prefetchProp === true) {\n return FetchStrategy.Full\n }\n\n // `null` or `\"auto\"`: this is the default \"auto\" mode, where we will prefetch partially if the link is in the viewport.\n // This will also include invalid prop values that don't match the types specified here.\n // (although those should've been filtered out by prop validation in dev)\n prefetchProp satisfies null | 'auto'\n return FetchStrategy.PPR\n } else {\n return prefetchProp === null || prefetchProp === 'auto'\n ? // We default to PPR, and we'll discover whether or not the route supports it with the initial prefetch.\n FetchStrategy.PPR\n : // In the old implementation without runtime prefetches, `prefetch={true}` forces all dynamic data to be prefetched.\n // To preserve backwards-compatibility, anything other than `false`, `null`, or `\"auto\"` results in a full prefetch.\n // (although invalid values should've been filtered out by prop validation in dev)\n FetchStrategy.Full\n }\n}\n","import type { ComponentProps } from 'react'\nimport ClientLinkComponent, { type LinkProps, useLinkStatus } from './link'\n\nexport default function LinkComponent(\n props: ComponentProps<typeof ClientLinkComponent>\n) {\n const isLegacyBehavior = props.legacyBehavior\n const childIsHostComponent =\n typeof props.children === 'string' ||\n typeof props.children === 'number' ||\n typeof (props.children as any)?.type === 'string'\n const childIsClientComponent =\n (props.children as any)?.type?.$$typeof ===\n Symbol.for('react.client.reference')\n\n if (isLegacyBehavior && !childIsHostComponent && !childIsClientComponent) {\n if ((props.children as any)?.type?.$$typeof === Symbol.for('react.lazy')) {\n console.error(\n `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.`\n )\n } else {\n console.error(\n `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.`\n )\n }\n }\n\n return <ClientLinkComponent {...props} />\n}\n\nexport { type LinkProps, useLinkStatus }\n","// NOTE: This file is compiled by Next.js.\n// Do not import `openclaw/plugin-sdk` here (it is provided by the gateway runtime, not as an npm dep).\n\ntype KitchenApi = {\n config: unknown;\n runtime: {\n system: { runCommandWithTimeout: (argv: string[], opts: { timeoutMs: number }) => Promise<{ stdout?: string; stderr?: string }> };\n };\n};\n\nexport function getKitchenApi(): KitchenApi {\n const api = (globalThis as unknown as { __clawkitchen_api?: KitchenApi }).__clawkitchen_api;\n if (!api) {\n throw new Error(\n \"ClawKitchen: OpenClaw plugin API not available. (This should only happen if Kitchen is started outside the gateway process.)\",\n );\n }\n return api;\n}\n","import { getKitchenApi } from \"@/lib/kitchen-api\";\nimport { 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\nfunction extractStdout(err: { stdout?: unknown }): string {\n if (typeof err.stdout === \"string\") return err.stdout;\n if (err.stdout && typeof err.stdout === \"object\" && \"toString\" in err.stdout) {\n return String((err.stdout as { toString: () => string }).toString());\n }\n return \"\";\n}\n\nfunction resolveExitCode(res: { exitCode?: unknown; code?: unknown; status?: unknown }): number {\n if (typeof res.exitCode === \"number\") return res.exitCode;\n if (typeof res.code === \"number\") return res.code;\n if (typeof res.status === \"number\") return res.status;\n return 0;\n}\n\nfunction extractStderr(err: { stderr?: unknown; message?: unknown }, fallback: unknown): string {\n if (typeof err.stderr === \"string\") return err.stderr;\n if (err.stderr && typeof err.stderr === \"object\" && \"toString\" in err.stderr) {\n return String((err.stderr as { toString: () => string }).toString());\n }\n if (typeof err.message === \"string\") return err.message;\n return String(fallback);\n}\n\n/**\n * Strip non-JSON diagnostic lines from stdout.\n *\n * OpenClaw may print plugin/doctor/diagnostic lines to stdout before the\n * actual JSON payload (e.g. \"[doctor] ...\", \"[plugins] ...\", \"🦞 OpenClaw ...\").\n * This breaks callers that do JSON.parse(stdout).\n *\n * If stdout looks like it contains a JSON payload with leading noise, strip the\n * noise lines. Otherwise return as-is (non-JSON commands like `config get` may\n * return plain text).\n */\nfunction sanitizeStdout(raw: string): string {\n const trimmed = raw.trim();\n if (!trimmed) return raw;\n\n // Fast path: already starts with JSON\n const firstChar = trimmed[0];\n if (firstChar === \"[\" || firstChar === \"{\" || firstChar === '\"') return raw;\n\n // Look for the first line starting with a JSON token\n const lines = trimmed.split(\"\\n\");\n const jsonStartIdx = lines.findIndex((l) => /^\\s*[[\\{\"]/.test(l));\n if (jsonStartIdx > 0) {\n // Verify the remainder is valid JSON before stripping\n const candidate = lines.slice(jsonStartIdx).join(\"\\n\");\n try {\n JSON.parse(candidate);\n return candidate;\n } catch {\n // Not valid JSON after stripping — return original\n }\n }\n\n return raw;\n}\n\nasync function runOpenClawLocal(args: string[], options: { sanitizeStdout?: boolean } = {}): Promise<OpenClawExecResult> {\n const { sanitizeStdout: shouldSanitize = true } = options;\n \n try {\n const isWindows = process.platform === \"win32\";\n const res = await execFileAsync(\"openclaw\", args, {\n timeout: 120000,\n windowsHide: true,\n maxBuffer: 10 * 1024 * 1024,\n // Windows requires shell:true to resolve executables on PATH via PATHEXT.\n // Without it, execFile throws ENOENT even when openclaw is installed globally.\n ...(isWindows ? { shell: true } : {}),\n });\n\n const rawStdout = String(res.stdout ?? \"\");\n \n return {\n ok: true,\n exitCode: 0,\n stdout: shouldSanitize ? sanitizeStdout(rawStdout) : rawStdout,\n stderr: String(res.stderr ?? \"\"),\n };\n } catch (e: unknown) {\n const err = e as { code?: unknown; stdout?: unknown; stderr?: unknown; message?: unknown };\n const exitCode = typeof err.code === \"number\" ? err.code : 1;\n const stdout = extractStdout(err);\n const stderr = extractStderr(err, e);\n return { ok: false, exitCode, stdout, stderr };\n }\n}\n\n/**\n * Extract a JSON payload from stdout that may contain non-JSON diagnostic lines\n * (e.g. [doctor], [plugins], [recipes] log lines before the actual JSON).\n * Returns the parsed value or null if no JSON found.\n */\nexport function extractJson<T = unknown>(stdout: string): T | null {\n const trimmed = stdout.trim();\n if (!trimmed) return null;\n\n // Fast path: pure JSON\n try {\n return JSON.parse(trimmed) as T;\n } catch {\n // fall through\n }\n\n // Find the first line starting with [ or { (JSON array/object)\n const lines = trimmed.split(\"\\n\");\n const jsonStartIdx = lines.findIndex((l) => /^\\s*[[\\{]/.test(l));\n if (jsonStartIdx >= 0) {\n const jsonSlice = lines.slice(jsonStartIdx).join(\"\\n\");\n try {\n return JSON.parse(jsonSlice) as T;\n } catch {\n // fall through\n }\n }\n\n // Last resort: find the last JSON block (scan from end)\n for (let i = lines.length - 1; i >= 0; i--) {\n if (/^\\s*[\\]}]/.test(lines[i])) {\n // Walk backward to find the matching open\n for (let j = i; j >= 0; j--) {\n if (/^\\s*[[\\{]/.test(lines[j])) {\n try {\n return JSON.parse(lines.slice(j, i + 1).join(\"\\n\")) as T;\n } catch {\n // continue searching\n }\n }\n }\n }\n }\n\n return null;\n}\n\n/**\n * Run OpenClaw without stdout sanitization (for raw text output like recipe markdown)\n */\nexport async function runOpenClawRaw(args: string[]): Promise<OpenClawExecResult> {\n // Always use local exec for raw content to avoid Kitchen runtime restrictions\n return runOpenClawLocal(args, { sanitizeStdout: false });\n}\n\nexport async function runOpenClaw(args: string[]): Promise<OpenClawExecResult> {\n // In some Kitchen runtime contexts, `api.runtime.system.runCommandWithTimeout`\n // is executed with a restricted allowlist that does not include the `cron` tool,\n // causing `openclaw cron ...` to fail with \"Tool not available: cron\".\n //\n // Cron routes need to work in the gateway-run Kitchen environment, so for cron\n // specifically we prefer a local exec (host OpenClaw).\n if (args[0] === \"cron\") return runOpenClawLocal(args);\n\n // Workflow runner/worker commands are long-running orchestration processes that\n // acquire locks and claims. The runtime command wrapper (runCommandWithTimeout)\n // has a 120s hard timeout that can kill these mid-execution, orphaning locks and\n // leaving runs stuck in waiting_workers. Route them through local exec instead.\n if (\n args[0] === \"recipes\" &&\n args[1] === \"workflows\" &&\n [\"runner-once\", \"runner-tick\", \"worker-tick\"].includes(args[2])\n ) {\n return runOpenClawLocal(args);\n }\n\n const api = getKitchenApi();\n try {\n const res = (await api.runtime.system.runCommandWithTimeout([\"openclaw\", ...args], { timeoutMs: 120000 })) as {\n stdout?: unknown;\n stderr?: unknown;\n exitCode?: unknown;\n code?: unknown;\n status?: unknown;\n };\n\n const stdout = sanitizeStdout(String(res.stdout ?? \"\"));\n const stderr = String(res.stderr ?? \"\");\n const exitCode = resolveExitCode(res);\n\n if (exitCode !== 0) return { ok: false, exitCode, stdout, stderr };\n return { ok: true, exitCode: 0, stdout, stderr };\n } catch (e: unknown) {\n const err = e as { code?: unknown; stdout?: unknown; stderr?: unknown; message?: unknown };\n const exitCode = typeof err.code === \"number\" ? err.code : 1;\n const stdout = extractStdout(err);\n const stderr = extractStderr(err, e);\n return { ok: false, exitCode, stdout, stderr };\n }\n}\n","// This file is generated by next-core EcmascriptClientReferenceModule.\nimport { registerClientReference } from \"react-server-dom-turbopack/server\";\nexport default registerClientReference(\n function() { throw new Error(\"Attempted to call the default export of [project]/src/app/recipes/[id]/RecipeEditor/index.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.\"); },\n \"[project]/src/app/recipes/[id]/RecipeEditor/index.tsx\",\n \"default\",\n);\n","import Link from \"next/link\";\nimport { unstable_noStore as noStore } from \"next/cache\";\n\nimport { listRecipes } from \"@/lib/recipes\";\nimport RecipeEditor from \"./RecipeEditor\";\n\nexport const dynamic = \"force-dynamic\";\nexport const revalidate = 0;\n\nasync function getKind(id: string): Promise<\"agent\" | \"team\" | null> {\n const recipes = await listRecipes();\n return recipes.find((r) => r.id === id)?.kind ?? null;\n}\n\nexport default async function RecipePage({ params }: { params: Promise<{ id: string }> }) {\n noStore();\n\n const { id } = await params;\n await getKind(id); // Resolved for future redirect logic; kept for cache consistency\n\n // NOTE: We do NOT redirect team recipes to /teams/<id>.\n // /recipes/<id> is the recipe editor/preview surface; /teams/<id> is the installed team editor.\n\n return (\n <main className=\"min-h-screen p-8\">\n <div className=\"mx-auto mb-4 max-w-6xl\">\n <Link\n href=\"/recipes\"\n className=\"text-sm font-medium text-[color:var(--ck-text-secondary)] transition-colors hover:text-[color:var(--ck-text-primary)]\"\n >\n ← Back to recipes\n </Link>\n </div>\n <RecipeEditor recipeId={id} />\n </main>\n );\n}\n"],"names":["LinkComponent","useLinkStatus","isModifiedEvent","event","eventTarget","currentTarget","target","getAttribute","metaKey","ctrlKey","shiftKey","altKey","nativeEvent","which","linkClicked","e","href","as","linkInstanceRef","replace","scroll","onNavigate","window","nodeName","isAnchorNodeName","toUpperCase","hasAttribute","isLocalURL","preventDefault","location","isDefaultPrevented","dispatchNavigateAction","require","React","startTransition","current","formatStringOrUrl","urlObjOrString","formatUrl","props","linkStatus","setOptimisticLinkStatus","useOptimistic","IDLE_LINK_STATUS","children","useRef","hrefProp","asProp","childrenProp","prefetch","prefetchProp","passHref","shallow","onClick","onMouseEnter","onMouseEnterProp","onTouchStart","onTouchStartProp","legacyBehavior","ref","forwardedRef","unstable_dynamicOnHover","restProps","a","router","useContext","AppRouterContext","prefetchEnabled","fetchStrategy","getFetchStrategyFromPrefetchProp","FetchStrategy","PPR","process","env","NODE_ENV","createPropError","args","Error","key","expected","actual","requiredPropsGuard","requiredProps","Object","keys","forEach","_","optionalPropsGuard","optionalProps","valType","locale","warnOnce","pathname","hasDynamicSegment","split","some","segment","startsWith","endsWith","useMemo","resolvedHref","child","$$typeof","Symbol","for","console","warn","Children","only","err","type","childRef","observeLinkVisibilityOnMount","useCallback","element","mountLinkInstance","unmountLinkForCurrentNavigation","unmountPrefetchableInstance","mergedRef","useMergedRef","childProps","defaultPrevented","upgradeToDynamicPrefetch","onNavigationIntent","__NEXT_LINK_NO_TOUCH_START","undefined","isAbsoluteUrl","addBasePath","link","errorOnce","cloneElement","LinkStatusContext","Provider","value","createContext","__NEXT_CACHE_COMPONENTS","Full","isLegacyBehavior","childIsHostComponent","childIsClientComponent","error","ClientLinkComponent"],"mappings":"szBAAA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAmBO,eAAe,IACpB,IAAM,EAAI,EAAA,OAAI,CAAC,IAAI,CAAC,EAAA,OAAE,CAAC,OAAO,GAAI,YAAa,iBAE/C,OAAO,KAAK,KAAK,CAAC,AADL,MAAM,EAAA,OA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