@jiggai/kitchen 0.5.5 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +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/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/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]/workflows/[workflowId]/page_client-reference-manifest.js +1 -1
- 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]__3b880807._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__3b880807._.js.map +1 -1
- package/.next/server/chunks/ssr/b1a17_app_teams_[teamId]_workflows_[workflowId]_workflows-editor-client_tsx_5e714aa2._.js +1 -1
- package/.next/server/chunks/ssr/b1a17_app_teams_[teamId]_workflows_[workflowId]_workflows-editor-client_tsx_5e714aa2._.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/.next/static/chunks/5c57ff602f968cc5.js +7 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/.next/static/chunks/37d8bbefc2b9da30.js +0 -7
- /package/.next/static/{iZOOye5pShZJT7JeIxbfB → BJ8seYB13fvzcJU-s9qJE}/_buildManifest.js +0 -0
- /package/.next/static/{iZOOye5pShZJT7JeIxbfB → BJ8seYB13fvzcJU-s9qJE}/_clientMiddlewareManifest.json +0 -0
- /package/.next/static/{iZOOye5pShZJT7JeIxbfB → BJ8seYB13fvzcJU-s9qJE}/_ssgManifest.js +0 -0
package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_cb6ddb24.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/app/api/cron/worker/route.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { NextResponse } from \"next/server\";\nimport { runOpenClaw } from \"@/lib/openclaw\";\nimport { getTeamWorkspaceDir } from \"@/lib/paths\";\nimport { errorMessage } from \"@/lib/errors\";\n\nasync function cronJobExists(id: string): Promise<boolean> {\n const cronId = String(id ?? \"\").trim();\n if (!cronId) return false;\n const res = await runOpenClaw([\"cron\", \"list\", \"--json\"]);\n if (!res.ok) return false;\n try {\n const parsed = JSON.parse(String(res.stdout ?? \"{}\")) as { jobs?: Array<{ id?: unknown }> } | Array<{ id?: unknown }>;\n const jobs = Array.isArray(parsed) ? parsed : Array.isArray(parsed?.jobs) ? parsed.jobs : [];\n return jobs.some((job) => String(job?.id ?? \"\").trim() === cronId);\n } catch {\n return false;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Provenance format — matches ClawRecipes CronMappingStateV1 so both systems\n// read/write the same file and never create duplicates.\n// ---------------------------------------------------------------------------\ntype MappingStateV1 = {\n version: 1;\n entries: Record<string, {\n installedCronId: string;\n specHash?: string;\n orphaned?: boolean;\n updatedAtMs?: number;\n }>;\n};\n\n/**\n * Provenance key — matches the format used by ClawRecipes cron-utils.cronKey()\n * for team-scoped cron jobs. Using the same key format means recipe-installed\n * crons and Kitchen-installed crons share a single namespace and cannot collide.\n */\nfunction workerKey(teamId: string, agentId: string) {\n return `team:${teamId}:recipe:workflow-worker:cron:${agentId}`;\n}\n\nfunction runnerKey(teamId: string) {\n return `team:${teamId}:recipe:workflow-runner:cron:main`;\n}\n\nfunction cronName(teamId: string, agentId: string) {\n return `workflow-worker:${teamId}:${agentId}`;\n}\n\nfunction buildWorkerMessage(teamId: string, agentId: string) {\n return `Workflow worker tick (${agentId}).\\n\\nRun exactly one shell command using the exec tool.\\n\\nCommand:\\nbash -lc 'openclaw recipes workflows worker-tick --team-id ${teamId} --agent-id ${agentId} --limit 5 --worker-id cron'\\n\\nRules:\\n- Execute with exec and wait for completion.\\n- If it succeeds, respond exactly: NO_REPLY\\n- If it fails, respond with one short error line.`;\n}\n\n/**\n * Optional model override for all workflow crons installed by Kitchen.\n *\n * Defaults to the gateway's configured default model (by omitting the\n * `--model` flag entirely). Set `KITCHEN_WORKFLOW_CRON_MODEL` in the gateway\n * env (e.g. `openai/gpt-5.4`, `anthropic/claude-sonnet-4-5`) to pin a\n * specific model for every workflow-worker and workflow-runner cron Kitchen\n * creates.\n */\nfunction modelFlagArgs(): string[] {\n const override = String(process.env.KITCHEN_WORKFLOW_CRON_MODEL ?? \"\").trim();\n return override ? [\"--model\", override] : [];\n}\n\n/**\n * Cron schedule used by all Kitchen-installed workflow crons.\n *\n * Defaults to every 5 minutes, matching the runner/worker tick cadence used\n * in production deployments. Override with `KITCHEN_WORKFLOW_CRON_SCHEDULE`\n * if you need a lighter interval such as every 10 or 15 minutes.\n */\nfunction workflowCronSchedule(): string {\n const override = String(process.env.KITCHEN_WORKFLOW_CRON_SCHEDULE ?? \"\").trim();\n return override || \"*/5 * * * *\";\n}\n\n// ---------------------------------------------------------------------------\n// Single provenance file: <teamDir>/notes/cron-jobs.json\n// ---------------------------------------------------------------------------\n\nasync function readMapping(mappingPath: string): Promise<MappingStateV1> {\n try {\n const raw = await fs.readFile(mappingPath, \"utf8\");\n const parsed = JSON.parse(raw) as MappingStateV1;\n if (!parsed || parsed.version !== 1 || !parsed.entries) return { version: 1, entries: {} };\n return parsed;\n } catch {\n return { version: 1, entries: {} };\n }\n}\n\nasync function writeMapping(mappingPath: string, mapping: MappingStateV1): Promise<void> {\n await fs.mkdir(path.dirname(mappingPath), { recursive: true });\n await fs.writeFile(mappingPath, JSON.stringify(mapping, null, 2) + \"\\n\", \"utf8\");\n}\n\nfunction teamMappingPath(teamDir: string): string {\n return path.join(teamDir, \"notes\", \"cron-jobs.json\");\n}\n\nasync function listTeamWorkflowAgentIds(teamId: string): Promise<string[]> {\n const teamDir = await getTeamWorkspaceDir(teamId);\n const workflowsDir = path.join(teamDir, \"shared-context\", \"workflows\");\n let files: string[] = [];\n try {\n files = (await fs.readdir(workflowsDir)).filter((f) => f.endsWith(\".workflow.json\"));\n } catch {\n return [];\n }\n\n const agentIds: string[] = [];\n for (const f of files) {\n try {\n const raw = await fs.readFile(path.join(workflowsDir, f), \"utf8\");\n const wf = JSON.parse(raw) as { nodes?: Array<{ type?: unknown; config?: unknown }> };\n const nodes = Array.isArray(wf.nodes) ? wf.nodes : [];\n for (const n of nodes) {\n const t = String((n as { type?: unknown }).type ?? \"\");\n if (t === \"start\" || t === \"end\") continue;\n const cfg = (n as { config?: unknown }).config;\n const o = cfg && typeof cfg === \"object\" && !Array.isArray(cfg) ? (cfg as Record<string, unknown>) : {};\n const agentId = String(o.agentId ?? \"\").trim();\n if (agentId) agentIds.push(agentId);\n }\n } catch {\n // ignore invalid workflow files\n }\n }\n return Array.from(new Set(agentIds));\n}\n\nasync function installWorkerCron(teamId: string, agentId: string): Promise<{\n alreadyInstalled: boolean;\n installedCronId: string;\n mappingPath: string;\n key: string;\n}> {\n const teamDir = await getTeamWorkspaceDir(teamId);\n const mp = teamMappingPath(teamDir);\n const key = workerKey(teamId, agentId);\n const now = Date.now();\n\n const mapping = await readMapping(mp);\n const existing = mapping.entries[key];\n if (existing && existing.installedCronId && !existing.orphaned) {\n const existingId = String(existing.installedCronId);\n if (await cronJobExists(existingId)) {\n await runOpenClaw([\"cron\", \"enable\", existingId]);\n return { alreadyInstalled: true, installedCronId: existingId, mappingPath: mp, key };\n }\n delete mapping.entries[key];\n await writeMapping(mp, mapping);\n }\n\n const name = cronName(teamId, agentId);\n const description = \"Workflow worker cron (Kitchen)\";\n const message = buildWorkerMessage(teamId, agentId);\n\n // Worker crons must run as agentId \"main\" so they have exec tool access\n // to invoke the CLI. The --agent-id flag in the worker-tick command itself\n // determines which agent's queue is drained.\n const add = await runOpenClaw([\n \"cron\",\n \"add\",\n \"--agent\",\n \"main\",\n \"--session\",\n \"isolated\",\n \"--cron\",\n workflowCronSchedule(),\n \"--timeout-seconds\",\n \"120\",\n \"--name\",\n name,\n \"--description\",\n description,\n \"--message\",\n message,\n ...modelFlagArgs(),\n \"--no-deliver\",\n \"--json\",\n ]);\n if (!add.ok) throw new Error(add.stderr || add.stdout || \"Failed to add cron\");\n\n const parsed = JSON.parse(String(add.stdout ?? \"{}\")) as { id?: unknown; job?: { id?: unknown } };\n const installedCronId = String(parsed?.id ?? parsed?.job?.id ?? \"\").trim();\n if (!installedCronId) throw new Error(\"Cron add succeeded but did not return id\");\n\n mapping.entries[key] = { installedCronId, updatedAtMs: now };\n await writeMapping(mp, mapping);\n\n return { alreadyInstalled: false, installedCronId, mappingPath: mp, key };\n}\n\nasync function installRunnerCron(teamId: string): Promise<{\n alreadyInstalled: boolean;\n installedCronId: string;\n mappingPath: string;\n key: string;\n}> {\n const teamDir = await getTeamWorkspaceDir(teamId);\n const mp = teamMappingPath(teamDir);\n const key = runnerKey(teamId);\n const mapping = await readMapping(mp);\n\n // Check if already installed\n const existing = mapping.entries[key];\n if (existing && !existing.orphaned) {\n const existingId = String(existing.installedCronId ?? \"\").trim();\n if (await cronJobExists(existingId)) {\n return { alreadyInstalled: true, installedCronId: existingId, mappingPath: mp, key };\n }\n delete mapping.entries[key];\n await writeMapping(mp, mapping);\n }\n\n // Install new runner-tick cron\n const cronName = `workflow-runner-tick:${teamId}`;\n const message = `Runner tick (workflow executor): openclaw recipes workflows runner-tick --team-id ${teamId} --concurrency 4 --lease-seconds 900`;\n\n const result = await runOpenClaw([\n \"cron\", \"add\",\n \"--name\", cronName,\n \"--agent\", \"main\",\n \"--session\", \"isolated\",\n \"--cron\", workflowCronSchedule(),\n \"--tz\", \"America/New_York\",\n \"--no-deliver\",\n \"--message\", message,\n ...modelFlagArgs(),\n \"--timeout-seconds\", \"900\",\n \"--json\"\n ]);\n\n const cronData = JSON.parse(result.stdout) as { id: string };\n const installedCronId = cronData.id;\n const now = Date.now();\n\n mapping.entries[key] = { installedCronId, updatedAtMs: now };\n await writeMapping(mp, mapping);\n\n return { alreadyInstalled: false, installedCronId, mappingPath: mp, key };\n}\n\nexport async function POST(req: Request) {\n try {\n const body = (await req.json()) as { action?: string; teamId?: string; agentId?: string };\n const action = String(body.action ?? \"\").trim();\n const teamId = String(body.teamId ?? \"\").trim();\n const agentId = String(body.agentId ?? \"\").trim();\n\n if (!teamId) return NextResponse.json({ ok: false, error: \"teamId is required\" }, { status: 400 });\n\n if (action === \"install\") {\n if (!agentId) return NextResponse.json({ ok: false, error: \"agentId is required\" }, { status: 400 });\n const res = await installWorkerCron(teamId, agentId);\n return NextResponse.json({ ok: true, action, teamId, agentId, ...res });\n }\n\n if (action === \"reconcile\") {\n const teamDir = await getTeamWorkspaceDir(teamId);\n const mp = teamMappingPath(teamDir);\n const requiredAgentIds = await listTeamWorkflowAgentIds(teamId);\n\n // Install worker-tick crons for each agent\n const installed: Array<{ agentId: string; installedCronId: string; alreadyInstalled: boolean }> = [];\n for (const a of requiredAgentIds) {\n const res = await installWorkerCron(teamId, a);\n installed.push({ agentId: a, installedCronId: res.installedCronId, alreadyInstalled: res.alreadyInstalled });\n }\n\n // Install runner-tick cron for the team (only if there are workflows with agents)\n let runnerInstalled = null;\n if (requiredAgentIds.length > 0) {\n const runnerRes = await installRunnerCron(teamId);\n runnerInstalled = {\n agentId: \"main\",\n installedCronId: runnerRes.installedCronId,\n alreadyInstalled: runnerRes.alreadyInstalled\n };\n }\n\n // Disable orphaned entries for this team in the single team mapping.\n const disabled: Array<{ agentId: string; installedCronId: string; key: string }> = [];\n const mapping = await readMapping(mp);\n const keyPrefix = `team:${teamId}:recipe:workflow-worker:cron:`;\n let changed = false;\n for (const [k, v] of Object.entries(mapping.entries)) {\n if (!k.startsWith(keyPrefix)) continue;\n const agentInKey = k.slice(keyPrefix.length);\n if (requiredAgentIds.includes(agentInKey)) continue;\n if (v && !v.orphaned) {\n const id = String(v.installedCronId ?? \"\").trim();\n if (id) await runOpenClaw([\"cron\", \"disable\", id]);\n mapping.entries[k] = { ...v, orphaned: true, updatedAtMs: Date.now() };\n disabled.push({ agentId: agentInKey, installedCronId: id, key: k });\n changed = true;\n }\n }\n if (changed) await writeMapping(mp, mapping);\n\n return NextResponse.json({ \n ok: true, \n action, \n teamId, \n requiredAgentIds, \n installed, \n runnerInstalled,\n disabled \n });\n }\n\n return NextResponse.json({ ok: false, error: \"action must be install|reconcile\" }, { status: 400 });\n } catch (e: unknown) {\n return NextResponse.json({ ok: false, error: errorMessage(e) }, { status: 500 });\n }\n}\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"standalone\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/cron/worker/route\",\n pathname: \"/api/cron/worker\",\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/cron/worker/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/cron/worker/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.experimental.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, 'incrementalCache'),\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const isMinimalMode = Boolean(process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode'));\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (activeSpan) {\n await handleResponse(activeSpan);\n } else {\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse));\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n"],"names":[],"mappings":"uCCAA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,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AAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAChC,IAAI,SAAS,EAAW,KAAK,CAAC,IAAI,CAAE,SAChC,EACA,OAAQ,EAAW,KAAK,CAAC,MAAM,EAAI,GACvC,IACO,IACX,EAGI,EACA,MAAM,EAAe,EADT,CAGZ,MAAM,EAAO,qBAAqB,CAAC,EAAI,OAAO,CAAE,IAAI,EAAO,KAAK,CAAC,EAAA,cAAc,CAAC,aAAa,CAAE,CACvF,SAAU,CAAA,EAAG,EAAO,CAAC,EAAE,EAAA,CAAS,CAChC,KAAM,EAAA,QAAQ,CAAC,MAAM,CACrB,WAAY,CACR,cAAe,EACf,cAAe,EAAI,GAAG,AAC1B,CACJ,EAAG,GAEf,CAAE,MAAO,EAAK,CAeV,GAdM,aAAe,EAAA,eAAe,EAEhC,CAFmC,KAE7B,EAAY,cAAc,CAAC,EAAK,EAAK,CACvC,WAAY,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,oBAClC,uBACA,CACJ,EACJ,GATmB,AAShB,EAAY,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,EAEA,qCAAqC","ignoreList":[1]}
|
|
1
|
+
{"version":3,"sources":["../../../src/app/api/cron/worker/route.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { NextResponse } from \"next/server\";\nimport { runOpenClaw } from \"@/lib/openclaw\";\nimport { getTeamWorkspaceDir } from \"@/lib/paths\";\nimport { errorMessage } from \"@/lib/errors\";\n\nasync function cronJobExists(id: string): Promise<boolean> {\n const cronId = String(id ?? \"\").trim();\n if (!cronId) return false;\n const res = await runOpenClaw([\"cron\", \"list\", \"--json\"]);\n if (!res.ok) return false;\n try {\n const parsed = JSON.parse(String(res.stdout ?? \"{}\")) as { jobs?: Array<{ id?: unknown }> } | Array<{ id?: unknown }>;\n const jobs = Array.isArray(parsed) ? parsed : Array.isArray(parsed?.jobs) ? parsed.jobs : [];\n return jobs.some((job) => String(job?.id ?? \"\").trim() === cronId);\n } catch {\n return false;\n }\n}\n\n/**\n * Schema version for the cron payload shape Kitchen installs.\n *\n * v1 = agentTurn message only (broad LLM context, all tools allowed).\n * LLM sometimes hallucinated the CLI path or skipped the exec, leaving\n * workflow queues to drain unreliably.\n * v2 = agentTurn + --light-context + --tools exec. The LLM now loads a\n * minimal bootstrap context and can only invoke the exec tool, which\n * dramatically narrows the failure surface for worker/runner ticks.\n *\n * Bump this when the install shape changes so reconcile can detect stale\n * crons and re-install them.\n */\nconst PAYLOAD_SCHEMA_VERSION = 2;\n\n/**\n * Extra cron-add flags used for every Kitchen-installed workflow cron.\n *\n * - --light-context: skip heavy bootstrap (agent identity, skills, etc.).\n * The worker-tick / runner-tick commands do not need that context.\n * - --tools exec: restrict the LLM session to the exec tool only. It cannot\n * wander into Read/Write/Search and cannot invent alternative workflows.\n */\nconst WORKFLOW_CRON_NARROW_SCOPE_ARGS: string[] = [\"--light-context\", \"--tools\", \"exec\"];\n\n// ---------------------------------------------------------------------------\n// Provenance format — matches ClawRecipes CronMappingStateV1 so both systems\n// read/write the same file and never create duplicates.\n// ---------------------------------------------------------------------------\ntype MappingStateV1 = {\n version: 1;\n entries: Record<string, {\n installedCronId: string;\n specHash?: string;\n orphaned?: boolean;\n updatedAtMs?: number;\n /**\n * Payload schema version the cron was installed with. Missing or older\n * values mean the cron predates a shape change and should be removed +\n * re-installed on the next reconcile.\n */\n payloadSchemaVersion?: number;\n }>;\n};\n\n/**\n * Provenance key — matches the format used by ClawRecipes cron-utils.cronKey()\n * for team-scoped cron jobs. Using the same key format means recipe-installed\n * crons and Kitchen-installed crons share a single namespace and cannot collide.\n */\nfunction workerKey(teamId: string, agentId: string) {\n return `team:${teamId}:recipe:workflow-worker:cron:${agentId}`;\n}\n\nfunction runnerKey(teamId: string) {\n return `team:${teamId}:recipe:workflow-runner:cron:main`;\n}\n\nfunction cronName(teamId: string, agentId: string) {\n return `workflow-worker:${teamId}:${agentId}`;\n}\n\nfunction buildWorkerMessage(teamId: string, agentId: string) {\n return `Workflow worker tick (${agentId}).\\n\\nRun exactly one shell command using the exec tool.\\n\\nCommand:\\nbash -lc 'openclaw recipes workflows worker-tick --team-id ${teamId} --agent-id ${agentId} --limit 5 --worker-id cron'\\n\\nRules:\\n- Execute with exec and wait for completion.\\n- If it succeeds, respond exactly: NO_REPLY\\n- If it fails, respond with one short error line.`;\n}\n\n/**\n * Optional model override for all workflow crons installed by Kitchen.\n *\n * Defaults to the gateway's configured default model (by omitting the\n * `--model` flag entirely). Set `KITCHEN_WORKFLOW_CRON_MODEL` in the gateway\n * env (e.g. `openai/gpt-5.4`, `anthropic/claude-sonnet-4-5`) to pin a\n * specific model for every workflow-worker and workflow-runner cron Kitchen\n * creates.\n */\nfunction modelFlagArgs(): string[] {\n const override = String(process.env.KITCHEN_WORKFLOW_CRON_MODEL ?? \"\").trim();\n return override ? [\"--model\", override] : [];\n}\n\n/**\n * Cron schedule used by all Kitchen-installed workflow crons.\n *\n * Defaults to every 5 minutes, matching the runner/worker tick cadence used\n * in production deployments. Override with `KITCHEN_WORKFLOW_CRON_SCHEDULE`\n * if you need a lighter interval such as every 10 or 15 minutes.\n */\nfunction workflowCronSchedule(): string {\n const override = String(process.env.KITCHEN_WORKFLOW_CRON_SCHEDULE ?? \"\").trim();\n return override || \"*/5 * * * *\";\n}\n\n// ---------------------------------------------------------------------------\n// Single provenance file: <teamDir>/notes/cron-jobs.json\n// ---------------------------------------------------------------------------\n\nasync function readMapping(mappingPath: string): Promise<MappingStateV1> {\n try {\n const raw = await fs.readFile(mappingPath, \"utf8\");\n const parsed = JSON.parse(raw) as MappingStateV1;\n if (!parsed || parsed.version !== 1 || !parsed.entries) return { version: 1, entries: {} };\n return parsed;\n } catch {\n return { version: 1, entries: {} };\n }\n}\n\nasync function writeMapping(mappingPath: string, mapping: MappingStateV1): Promise<void> {\n await fs.mkdir(path.dirname(mappingPath), { recursive: true });\n await fs.writeFile(mappingPath, JSON.stringify(mapping, null, 2) + \"\\n\", \"utf8\");\n}\n\nfunction teamMappingPath(teamDir: string): string {\n return path.join(teamDir, \"notes\", \"cron-jobs.json\");\n}\n\nasync function listTeamWorkflowAgentIds(teamId: string): Promise<string[]> {\n const teamDir = await getTeamWorkspaceDir(teamId);\n const workflowsDir = path.join(teamDir, \"shared-context\", \"workflows\");\n let files: string[] = [];\n try {\n files = (await fs.readdir(workflowsDir)).filter((f) => f.endsWith(\".workflow.json\"));\n } catch {\n return [];\n }\n\n const agentIds: string[] = [];\n for (const f of files) {\n try {\n const raw = await fs.readFile(path.join(workflowsDir, f), \"utf8\");\n const wf = JSON.parse(raw) as { nodes?: Array<{ type?: unknown; config?: unknown }> };\n const nodes = Array.isArray(wf.nodes) ? wf.nodes : [];\n for (const n of nodes) {\n const t = String((n as { type?: unknown }).type ?? \"\");\n if (t === \"start\" || t === \"end\") continue;\n const cfg = (n as { config?: unknown }).config;\n const o = cfg && typeof cfg === \"object\" && !Array.isArray(cfg) ? (cfg as Record<string, unknown>) : {};\n const agentId = String(o.agentId ?? \"\").trim();\n if (agentId) agentIds.push(agentId);\n }\n } catch {\n // ignore invalid workflow files\n }\n }\n return Array.from(new Set(agentIds));\n}\n\nasync function installWorkerCron(teamId: string, agentId: string): Promise<{\n alreadyInstalled: boolean;\n installedCronId: string;\n mappingPath: string;\n key: string;\n}> {\n const teamDir = await getTeamWorkspaceDir(teamId);\n const mp = teamMappingPath(teamDir);\n const key = workerKey(teamId, agentId);\n const now = Date.now();\n\n const mapping = await readMapping(mp);\n const existing = mapping.entries[key];\n if (existing && existing.installedCronId && !existing.orphaned) {\n const existingId = String(existing.installedCronId);\n const existingSchema = existing.payloadSchemaVersion ?? 1;\n const isStale = existingSchema < PAYLOAD_SCHEMA_VERSION;\n if (await cronJobExists(existingId) && !isStale) {\n await runOpenClaw([\"cron\", \"enable\", existingId]);\n return { alreadyInstalled: true, installedCronId: existingId, mappingPath: mp, key };\n }\n if (isStale) await runOpenClaw([\"cron\", \"rm\", existingId]);\n delete mapping.entries[key];\n await writeMapping(mp, mapping);\n }\n\n const name = cronName(teamId, agentId);\n const description = \"Workflow worker cron (Kitchen)\";\n const message = buildWorkerMessage(teamId, agentId);\n\n // Worker crons must run as agentId \"main\" so they have exec tool access\n // to invoke the CLI. The --agent-id flag in the worker-tick command itself\n // determines which agent's queue is drained.\n const add = await runOpenClaw([\n \"cron\",\n \"add\",\n \"--agent\",\n \"main\",\n \"--session\",\n \"isolated\",\n \"--cron\",\n workflowCronSchedule(),\n \"--timeout-seconds\",\n \"120\",\n \"--name\",\n name,\n \"--description\",\n description,\n \"--message\",\n message,\n ...WORKFLOW_CRON_NARROW_SCOPE_ARGS,\n ...modelFlagArgs(),\n \"--no-deliver\",\n \"--json\",\n ]);\n if (!add.ok) throw new Error(add.stderr || add.stdout || \"Failed to add cron\");\n\n const parsed = JSON.parse(String(add.stdout ?? \"{}\")) as { id?: unknown; job?: { id?: unknown } };\n const installedCronId = String(parsed?.id ?? parsed?.job?.id ?? \"\").trim();\n if (!installedCronId) throw new Error(\"Cron add succeeded but did not return id\");\n\n mapping.entries[key] = {\n installedCronId,\n updatedAtMs: now,\n payloadSchemaVersion: PAYLOAD_SCHEMA_VERSION,\n };\n await writeMapping(mp, mapping);\n\n return { alreadyInstalled: false, installedCronId, mappingPath: mp, key };\n}\n\nasync function installRunnerCron(teamId: string): Promise<{\n alreadyInstalled: boolean;\n installedCronId: string;\n mappingPath: string;\n key: string;\n}> {\n const teamDir = await getTeamWorkspaceDir(teamId);\n const mp = teamMappingPath(teamDir);\n const key = runnerKey(teamId);\n const mapping = await readMapping(mp);\n\n // Check if already installed\n const existing = mapping.entries[key];\n if (existing && !existing.orphaned) {\n const existingId = String(existing.installedCronId ?? \"\").trim();\n const existingSchema = existing.payloadSchemaVersion ?? 1;\n const isStale = existingSchema < PAYLOAD_SCHEMA_VERSION;\n if (await cronJobExists(existingId) && !isStale) {\n return { alreadyInstalled: true, installedCronId: existingId, mappingPath: mp, key };\n }\n if (isStale && existingId) await runOpenClaw([\"cron\", \"rm\", existingId]);\n delete mapping.entries[key];\n await writeMapping(mp, mapping);\n }\n\n // Install new runner-tick cron\n const cronName = `workflow-runner-tick:${teamId}`;\n const message = `Runner tick (workflow executor): openclaw recipes workflows runner-tick --team-id ${teamId} --concurrency 4 --lease-seconds 900`;\n\n const result = await runOpenClaw([\n \"cron\", \"add\",\n \"--name\", cronName,\n \"--agent\", \"main\",\n \"--session\", \"isolated\",\n \"--cron\", workflowCronSchedule(),\n \"--tz\", \"America/New_York\",\n \"--no-deliver\",\n \"--message\", message,\n ...WORKFLOW_CRON_NARROW_SCOPE_ARGS,\n ...modelFlagArgs(),\n \"--timeout-seconds\", \"900\",\n \"--json\"\n ]);\n\n const cronData = JSON.parse(result.stdout) as { id: string };\n const installedCronId = cronData.id;\n const now = Date.now();\n\n mapping.entries[key] = {\n installedCronId,\n updatedAtMs: now,\n payloadSchemaVersion: PAYLOAD_SCHEMA_VERSION,\n };\n await writeMapping(mp, mapping);\n\n return { alreadyInstalled: false, installedCronId, mappingPath: mp, key };\n}\n\nexport async function POST(req: Request) {\n try {\n const body = (await req.json()) as { action?: string; teamId?: string; agentId?: string };\n const action = String(body.action ?? \"\").trim();\n const teamId = String(body.teamId ?? \"\").trim();\n const agentId = String(body.agentId ?? \"\").trim();\n\n if (!teamId) return NextResponse.json({ ok: false, error: \"teamId is required\" }, { status: 400 });\n\n if (action === \"install\") {\n if (!agentId) return NextResponse.json({ ok: false, error: \"agentId is required\" }, { status: 400 });\n const res = await installWorkerCron(teamId, agentId);\n return NextResponse.json({ ok: true, action, teamId, agentId, ...res });\n }\n\n if (action === \"reconcile\") {\n const teamDir = await getTeamWorkspaceDir(teamId);\n const mp = teamMappingPath(teamDir);\n const requiredAgentIds = await listTeamWorkflowAgentIds(teamId);\n\n // Install worker-tick crons for each agent\n const installed: Array<{ agentId: string; installedCronId: string; alreadyInstalled: boolean }> = [];\n for (const a of requiredAgentIds) {\n const res = await installWorkerCron(teamId, a);\n installed.push({ agentId: a, installedCronId: res.installedCronId, alreadyInstalled: res.alreadyInstalled });\n }\n\n // Install runner-tick cron for the team (only if there are workflows with agents)\n let runnerInstalled = null;\n if (requiredAgentIds.length > 0) {\n const runnerRes = await installRunnerCron(teamId);\n runnerInstalled = {\n agentId: \"main\",\n installedCronId: runnerRes.installedCronId,\n alreadyInstalled: runnerRes.alreadyInstalled\n };\n }\n\n // Disable orphaned entries for this team in the single team mapping.\n const disabled: Array<{ agentId: string; installedCronId: string; key: string }> = [];\n const mapping = await readMapping(mp);\n const keyPrefix = `team:${teamId}:recipe:workflow-worker:cron:`;\n let changed = false;\n for (const [k, v] of Object.entries(mapping.entries)) {\n if (!k.startsWith(keyPrefix)) continue;\n const agentInKey = k.slice(keyPrefix.length);\n if (requiredAgentIds.includes(agentInKey)) continue;\n if (v && !v.orphaned) {\n const id = String(v.installedCronId ?? \"\").trim();\n if (id) await runOpenClaw([\"cron\", \"disable\", id]);\n mapping.entries[k] = { ...v, orphaned: true, updatedAtMs: Date.now() };\n disabled.push({ agentId: agentInKey, installedCronId: id, key: k });\n changed = true;\n }\n }\n if (changed) await writeMapping(mp, mapping);\n\n return NextResponse.json({ \n ok: true, \n action, \n teamId, \n requiredAgentIds, \n installed, \n runnerInstalled,\n disabled \n });\n }\n\n return NextResponse.json({ ok: false, error: \"action must be install|reconcile\" }, { status: 400 });\n } catch (e: unknown) {\n return NextResponse.json({ ok: false, error: errorMessage(e) }, { status: 500 });\n }\n}\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"standalone\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/cron/worker/route\",\n pathname: \"/api/cron/worker\",\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/cron/worker/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/cron/worker/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.experimental.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, 'incrementalCache'),\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const isMinimalMode = Boolean(process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode'));\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (activeSpan) {\n await handleResponse(activeSpan);\n } else {\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse));\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n"],"names":[],"mappings":"uCCAA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA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AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,EAEA,qCAAqC","ignoreList":[1]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[4730,a=>{a.v({name:"@jiggai/kitchen",version:"0.5.
|
|
1
|
+
module.exports=[4730,a=>{a.v({name:"@jiggai/kitchen",version:"0.5.7",main:"openclaw/index.ts",description:"ClawKitchen - Web-based dashboard for OpenClaw agent teams, workflows, and automation",author:"@rjdjohnston · rjdjohnston",license:"Apache-2.0",repository:{type:"git",url:"https://github.com/JIGGAI/clawkitchen.git"},keywords:["openclaw","clawkitchen","dashboard","agents","workflows","plugin"],openclaw:{extensions:["./openclaw/index.ts"],compat:{pluginApi:">=1.0.0",pluginApiRange:">=2026.3"},build:{openclawVersion:"2026.3.28"}},scripts:{dev:"next dev",build:"rm -rf .next && NODE_ENV=production next build",postbuild:"node scripts/copy-standalone-static.mjs",start:"next start",lint:"eslint",test:"vitest","test:run":"vitest run",coverage:"vitest run --coverage",check:"npm run lint && npm run test:run","dup:check":"jscpd src --min-tokens 50 --min-lines 10 --reporters html,console","refactor:report":"node scripts/refactor-report.mjs","smoke:goals":"node scripts/goals-smoke.mjs",prepare:"husky || true",prepack:"npm run -s sync:plugin-version && npm run -s check:plugin-version","sync:plugin-version":"node scripts/sync-openclaw-plugin-version.mjs","check:plugin-version":"node scripts/check-openclaw-plugin-version.mjs",prepublishOnly:"npm run -s sync:plugin-version && npm run -s check:plugin-version"},publishConfig:{access:"public"},files:["openclaw/","openclaw.plugin.json","README.md","LICENSE","next.config.ts","next-env.d.ts","tsconfig.json","public/",".next/BUILD_ID",".next/server/",".next/static/",".next/required-server-files.json",".next/required-server-files.js",".next/routes-manifest.json",".next/prerender-manifest.json",".next/build-manifest.json",".next/app-path-routes-manifest.json",".next/package.json"],dependencies:{"better-sqlite3":"^12.8.0","drizzle-kit":"^0.31.10","drizzle-orm":"^0.45.2",next:"16.1.6",react:"19.2.3","react-dom":"19.2.3","react-markdown":"^10.1.0","remark-gfm":"^4.0.1",yaml:"^2.8.2"},devDependencies:{"@tailwindcss/postcss":"^4","@testing-library/dom":"^10.4.1","@testing-library/react":"^16.3.2","@types/better-sqlite3":"^7.6.13","@types/node":"^20","@types/react":"^19","@types/react-dom":"^19","@vitejs/plugin-react":"^5.1.4","@vitest/coverage-v8":"^4.0.18",eslint:"^9","eslint-config-next":"16.1.6","eslint-plugin-sonarjs":"^4.0.0",husky:"^9.1.7",jscpd:"^4.0.8",jsdom:"^28.1.0","lint-staged":"^16.2.7",tailwindcss:"^4",typescript:"5.9.3","vite-tsconfig-paths":"^6.1.1",vitest:"^4.0.18"},"lint-staged":{"*.{ts,tsx}":"eslint --fix"}})},21133,a=>{"use strict";let b=String(a.i(4730).default.version??"");function c(){let a=b.trim();return a?`ClawKitchen (${a}-beta)`:"ClawKitchen"}a.s(["APP_VERSION",0,b,"getAppTitle",()=>c])},89578,a=>{a.v({className:"geist_a71539c9-module__T19VSG__className",variable:"geist_a71539c9-module__T19VSG__variable"})},35214,a=>{a.v({className:"geist_mono_8d43a2aa-module__8Li5zG__className",variable:"geist_mono_8d43a2aa-module__8Li5zG__variable"})},17917,a=>{"use strict";a.s(["AppShell",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call AppShell() from the server but AppShell is 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/components/AppShell.tsx <module evaluation>","AppShell")},43297,a=>{"use strict";a.s(["AppShell",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call AppShell() from the server but AppShell is 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/components/AppShell.tsx","AppShell")},56935,a=>{"use strict";a.i(17917);var b=a.i(43297);a.n(b)},27572,a=>{"use strict";var b=a.i(7997),c=a.i(21133),d=a.i(89578);let e={className:d.default.className,style:{fontFamily:"'Geist', 'Geist Fallback'",fontStyle:"normal"}};null!=d.default.variable&&(e.variable=d.default.variable);var f=a.i(35214);let g={className:f.default.className,style:{fontFamily:"'Geist Mono', 'Geist Mono Fallback'",fontStyle:"normal"}};null!=f.default.variable&&(g.variable=f.default.variable);var h=a.i(56935);async function i(){return{title:(0,c.getAppTitle)(),description:"Local-first UI for authoring ClawRecipes recipes and scaffolding agents/teams.",icons:{icon:[{url:"/favicon.ico",sizes:"any"},{url:"/favicon-16x16.png",sizes:"16x16",type:"image/png"},{url:"/favicon-32x32.png",sizes:"32x32",type:"image/png"}],apple:"/apple-touch-icon.png"}}}function j({children:a}){return(0,b.jsxs)("html",{lang:"en","data-theme":"dark",suppressHydrationWarning:!0,children:[(0,b.jsx)("head",{}),(0,b.jsx)("body",{suppressHydrationWarning:!0,className:`${e.variable} ${g.variable} antialiased`,children:(0,b.jsx)(h.AppShell,{children:a})})]})}a.s(["default",()=>j,"generateMetadata",()=>i],27572)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=%5Broot-of-the-server%5D__3b880807._.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["turbopack:///[project]/package.json","../../../../src/lib/app-info.ts","turbopack:///[next]/internal/font/google/geist_a71539c9.module.css [app-rsc] (css module)","turbopack:///[next]/internal/font/google/geist_mono_8d43a2aa.module.css [app-rsc] (css module)","../../../../src/components/AppShell.tsx/__nextjs-internal-proxy.mjs","../../../../src/app/layout.tsx","turbopack:///[next]/internal/font/google/geist_a71539c9.js","turbopack:///[next]/internal/font/google/geist_mono_8d43a2aa.js"],"sourcesContent":["{\"name\":\"@jiggai/kitchen\",\"version\":\"0.5.
|
|
1
|
+
{"version":3,"sources":["turbopack:///[project]/package.json","../../../../src/lib/app-info.ts","turbopack:///[next]/internal/font/google/geist_a71539c9.module.css [app-rsc] (css module)","turbopack:///[next]/internal/font/google/geist_mono_8d43a2aa.module.css [app-rsc] (css module)","../../../../src/components/AppShell.tsx/__nextjs-internal-proxy.mjs","../../../../src/app/layout.tsx","turbopack:///[next]/internal/font/google/geist_a71539c9.js","turbopack:///[next]/internal/font/google/geist_mono_8d43a2aa.js"],"sourcesContent":["{\"name\":\"@jiggai/kitchen\",\"version\":\"0.5.7\",\"main\":\"openclaw/index.ts\",\"description\":\"ClawKitchen - Web-based dashboard for OpenClaw agent teams, workflows, and automation\",\"author\":\"@rjdjohnston · rjdjohnston\",\"license\":\"Apache-2.0\",\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/JIGGAI/clawkitchen.git\"},\"keywords\":[\"openclaw\",\"clawkitchen\",\"dashboard\",\"agents\",\"workflows\",\"plugin\"],\"openclaw\":{\"extensions\":[\"./openclaw/index.ts\"],\"compat\":{\"pluginApi\":\">=1.0.0\",\"pluginApiRange\":\">=2026.3\"},\"build\":{\"openclawVersion\":\"2026.3.28\"}},\"scripts\":{\"dev\":\"next dev\",\"build\":\"rm -rf .next && NODE_ENV=production next build\",\"postbuild\":\"node scripts/copy-standalone-static.mjs\",\"start\":\"next start\",\"lint\":\"eslint\",\"test\":\"vitest\",\"test:run\":\"vitest run\",\"coverage\":\"vitest run --coverage\",\"check\":\"npm run lint && npm run test:run\",\"dup:check\":\"jscpd src --min-tokens 50 --min-lines 10 --reporters html,console\",\"refactor:report\":\"node scripts/refactor-report.mjs\",\"smoke:goals\":\"node scripts/goals-smoke.mjs\",\"prepare\":\"husky || true\",\"prepack\":\"npm run -s sync:plugin-version && npm run -s check:plugin-version\",\"sync:plugin-version\":\"node scripts/sync-openclaw-plugin-version.mjs\",\"check:plugin-version\":\"node scripts/check-openclaw-plugin-version.mjs\",\"prepublishOnly\":\"npm run -s sync:plugin-version && npm run -s check:plugin-version\"},\"publishConfig\":{\"access\":\"public\"},\"files\":[\"openclaw/\",\"openclaw.plugin.json\",\"README.md\",\"LICENSE\",\"next.config.ts\",\"next-env.d.ts\",\"tsconfig.json\",\"public/\",\".next/BUILD_ID\",\".next/server/\",\".next/static/\",\".next/required-server-files.json\",\".next/required-server-files.js\",\".next/routes-manifest.json\",\".next/prerender-manifest.json\",\".next/build-manifest.json\",\".next/app-path-routes-manifest.json\",\".next/package.json\"],\"dependencies\":{\"better-sqlite3\":\"^12.8.0\",\"drizzle-kit\":\"^0.31.10\",\"drizzle-orm\":\"^0.45.2\",\"next\":\"16.1.6\",\"react\":\"19.2.3\",\"react-dom\":\"19.2.3\",\"react-markdown\":\"^10.1.0\",\"remark-gfm\":\"^4.0.1\",\"yaml\":\"^2.8.2\"},\"devDependencies\":{\"@tailwindcss/postcss\":\"^4\",\"@testing-library/dom\":\"^10.4.1\",\"@testing-library/react\":\"^16.3.2\",\"@types/better-sqlite3\":\"^7.6.13\",\"@types/node\":\"^20\",\"@types/react\":\"^19\",\"@types/react-dom\":\"^19\",\"@vitejs/plugin-react\":\"^5.1.4\",\"@vitest/coverage-v8\":\"^4.0.18\",\"eslint\":\"^9\",\"eslint-config-next\":\"16.1.6\",\"eslint-plugin-sonarjs\":\"^4.0.0\",\"husky\":\"^9.1.7\",\"jscpd\":\"^4.0.8\",\"jsdom\":\"^28.1.0\",\"lint-staged\":\"^16.2.7\",\"tailwindcss\":\"^4\",\"typescript\":\"5.9.3\",\"vite-tsconfig-paths\":\"^6.1.1\",\"vitest\":\"^4.0.18\"},\"lint-staged\":{\"*.{ts,tsx}\":\"eslint --fix\"}}","import pkg from \"../../package.json\";\n\n// Loaded once at module init (cached by Node/Next). Avoids per-render disk reads.\nexport const APP_VERSION = String((pkg as { version?: string }).version ?? \"\");\n\nexport function getAppTitle(): string {\n const v = APP_VERSION.trim();\n return v ? `ClawKitchen (${v}-beta)` : \"ClawKitchen\";\n}\n","__turbopack_context__.v({\n \"className\": \"geist_a71539c9-module__T19VSG__className\",\n \"variable\": \"geist_a71539c9-module__T19VSG__variable\",\n});\n","__turbopack_context__.v({\n \"className\": \"geist_mono_8d43a2aa-module__8Li5zG__className\",\n \"variable\": \"geist_mono_8d43a2aa-module__8Li5zG__variable\",\n});\n","// This file is generated by next-core EcmascriptClientReferenceModule.\nimport { registerClientReference } from \"react-server-dom-turbopack/server\";\nexport const AppShell = registerClientReference(\n function() { throw new Error(\"Attempted to call AppShell() from the server but AppShell is 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/components/AppShell.tsx\",\n \"AppShell\",\n);\n","import type { Metadata } from \"next\";\nimport { getAppTitle } from \"@/lib/app-info\";\nimport { Geist, Geist_Mono } from \"next/font/google\";\nimport \"./globals.css\";\nimport { AppShell } from \"@/components/AppShell\";\n\nconst geistSans = Geist({\n variable: \"--font-geist-sans\",\n subsets: [\"latin\"],\n});\n\nconst geistMono = Geist_Mono({\n variable: \"--font-geist-mono\",\n subsets: [\"latin\"],\n});\n\nexport async function generateMetadata(): Promise<Metadata> {\n return {\n title: getAppTitle(),\n description: \"Local-first UI for authoring ClawRecipes recipes and scaffolding agents/teams.\",\n icons: {\n icon: [\n { url: \"/favicon.ico\", sizes: \"any\" },\n { url: \"/favicon-16x16.png\", sizes: \"16x16\", type: \"image/png\" },\n { url: \"/favicon-32x32.png\", sizes: \"32x32\", type: \"image/png\" },\n ],\n apple: \"/apple-touch-icon.png\",\n },\n };\n}\n\nexport default function RootLayout({\n children,\n}: Readonly<{\n children: React.ReactNode;\n}>) {\n return (\n <html lang=\"en\" data-theme=\"dark\" suppressHydrationWarning>\n <head />\n <body\n suppressHydrationWarning\n className={`${geistSans.variable} ${geistMono.variable} antialiased`}\n >\n <AppShell>{children}</AppShell>\n </body>\n </html>\n );\n}\n","import cssModule from \"@vercel/turbopack-next/internal/font/google/cssmodule.module.css?{%22path%22:%22layout.tsx%22,%22import%22:%22Geist%22,%22arguments%22:[{%22variable%22:%22--font-geist-sans%22,%22subsets%22:[%22latin%22]}],%22variableName%22:%22geistSans%22}\";\nconst fontData = {\n className: cssModule.className,\n style: {\n fontFamily: \"'Geist', 'Geist Fallback'\",\n fontStyle: \"normal\",\n\n },\n};\n\nif (cssModule.variable != null) {\n fontData.variable = cssModule.variable;\n}\n\nexport default fontData;\n","import cssModule from \"@vercel/turbopack-next/internal/font/google/cssmodule.module.css?{%22path%22:%22layout.tsx%22,%22import%22:%22Geist_Mono%22,%22arguments%22:[{%22variable%22:%22--font-geist-mono%22,%22subsets%22:[%22latin%22]}],%22variableName%22:%22geistMono%22}\";\nconst fontData = {\n className: cssModule.className,\n style: {\n fontFamily: \"'Geist Mono', 'Geist Mono Fallback'\",\n fontStyle: \"normal\",\n\n },\n};\n\nif (cssModule.variable != null) {\n fontData.variable = cssModule.variable;\n}\n\nexport default fontData;\n"],"names":[],"mappings":"yBAAA,EAAA,CAAA,CAAA,CAAA,KAAA,kBAAA,QAAA,QAAA,KAAA,oBAAA,YAAA,wFAAA,OAAA,6BAAA,QAAA,aAAA,WAAA,CAAA,KAAA,MAAA,IAAA,2CAAA,EAAA,SAAA,CAAA,WAAA,cAAA,YAAA,SAAA,YAAA,SAAA,CAAA,SAAA,CAAA,WAAA,CAAA,sBAAA,CAAA,OAAA,CAAA,UAAA,UAAA,eAAA,UAAA,EAAA,MAAA,CAAA,gBAAA,WAAA,CAAA,EAAA,QAAA,CAAA,IAAA,WAAA,MAAA,iDAAA,UAAA,0CAAA,MAAA,aAAA,KAAA,SAAA,KAAA,SAAA,WAAA,aAAA,SAAA,wBAAA,MAAA,mCAAA,YAAA,oEAAA,kBAAA,mCAAA,cAAA,+BAAA,QAAA,gBAAA,QAAA,oEAAA,sBAAA,gDAAA,uBAAA,iDAAA,eAAA,mEAAA,EAAA,cAAA,CAAA,OAAA,QAAA,EAAA,MAAA,CAAA,YAAA,uBAAA,YAAA,UAAA,iBAAA,gBAAA,gBAAA,UAAA,iBAAA,gBAAA,gBAAA,mCAAA,iCAAA,6BAAA,gCAAA,4BAAA,sCAAA,qBAAA,CAAA,aAAA,CAAA,iBAAA,UAAA,cAAA,WAAA,cAAA,UAAA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