@jiggai/kitchen 0.3.1 → 0.3.3
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/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 +1 -1
- package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/channels.html +2 -2
- package/.next/server/app/channels.rsc +1 -1
- package/.next/server/app/channels.segments/_full.segment.rsc +1 -1
- package/.next/server/app/channels.segments/_head.segment.rsc +1 -1
- package/.next/server/app/channels.segments/_index.segment.rsc +1 -1
- package/.next/server/app/channels.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/channels.segments/channels/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/channels.segments/channels.segment.rsc +1 -1
- package/.next/server/app/cron-jobs.html +1 -1
- package/.next/server/app/cron-jobs.rsc +1 -1
- package/.next/server/app/cron-jobs.segments/_full.segment.rsc +1 -1
- package/.next/server/app/cron-jobs.segments/_head.segment.rsc +1 -1
- package/.next/server/app/cron-jobs.segments/_index.segment.rsc +1 -1
- package/.next/server/app/cron-jobs.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/cron-jobs.segments/cron-jobs/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/cron-jobs.segments/cron-jobs.segment.rsc +1 -1
- package/.next/server/app/goals/new.html +2 -2
- package/.next/server/app/goals/new.rsc +1 -1
- package/.next/server/app/goals/new.segments/_full.segment.rsc +1 -1
- package/.next/server/app/goals/new.segments/_head.segment.rsc +1 -1
- package/.next/server/app/goals/new.segments/_index.segment.rsc +1 -1
- package/.next/server/app/goals/new.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/goals/new.segments/goals/new/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/goals/new.segments/goals/new.segment.rsc +1 -1
- package/.next/server/app/goals/new.segments/goals.segment.rsc +1 -1
- package/.next/server/app/goals.html +1 -1
- package/.next/server/app/goals.rsc +1 -1
- package/.next/server/app/goals.segments/_full.segment.rsc +1 -1
- package/.next/server/app/goals.segments/_head.segment.rsc +1 -1
- package/.next/server/app/goals.segments/_index.segment.rsc +1 -1
- package/.next/server/app/goals.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/goals.segments/goals/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/goals.segments/goals.segment.rsc +1 -1
- package/.next/server/app/settings.html +1 -1
- package/.next/server/app/settings.rsc +1 -1
- package/.next/server/app/settings.segments/_full.segment.rsc +1 -1
- package/.next/server/app/settings.segments/_head.segment.rsc +1 -1
- package/.next/server/app/settings.segments/_index.segment.rsc +1 -1
- package/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/settings.segments/settings.segment.rsc +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +2 -2
- package/package.json +1 -2
- package/src/app/HomeClient.tsx +0 -207
- package/src/app/agents/[agentId]/agent-editor-tabs.tsx +0 -298
- package/src/app/agents/[agentId]/agent-editor.tsx +0 -468
- package/src/app/agents/[agentId]/page.tsx +0 -32
- package/src/app/api/__tests__/agents-add-route.test.ts +0 -143
- package/src/app/api/__tests__/agents-file-route.test.ts +0 -117
- package/src/app/api/__tests__/agents-files-route.test.ts +0 -61
- package/src/app/api/__tests__/agents-id-route.test.ts +0 -104
- package/src/app/api/__tests__/agents-identity-route.test.ts +0 -92
- package/src/app/api/__tests__/agents-route.test.ts +0 -54
- package/src/app/api/__tests__/agents-skills-install-route.test.ts +0 -131
- package/src/app/api/__tests__/agents-skills-route.test.ts +0 -64
- package/src/app/api/__tests__/agents-update-route.test.ts +0 -95
- package/src/app/api/__tests__/channels-bindings-route.test.ts +0 -143
- package/src/app/api/__tests__/cron-delete-route.test.ts +0 -93
- package/src/app/api/__tests__/cron-job-route.test.ts +0 -78
- package/src/app/api/__tests__/cron-jobs-route.test.ts +0 -116
- package/src/app/api/__tests__/cron-recipe-installed-route.test.ts +0 -114
- package/src/app/api/__tests__/gateway-restart-route.test.ts +0 -36
- package/src/app/api/__tests__/goals-promote-route.test.ts +0 -200
- package/src/app/api/__tests__/goals-route.test.ts +0 -184
- package/src/app/api/__tests__/ids-check-route.test.ts +0 -188
- package/src/app/api/__tests__/marketplace-recipes-route.test.ts +0 -123
- package/src/app/api/__tests__/recipes-clone-route.test.ts +0 -221
- package/src/app/api/__tests__/recipes-delete-route.test.ts +0 -248
- package/src/app/api/__tests__/recipes-id-route.test.ts +0 -166
- package/src/app/api/__tests__/recipes-route.test.ts +0 -57
- package/src/app/api/__tests__/recipes-team-agents-route.test.ts +0 -135
- package/src/app/api/__tests__/scaffold-route.test.ts +0 -173
- package/src/app/api/__tests__/settings-cron-installation-route.test.ts +0 -82
- package/src/app/api/__tests__/skills-available-route.test.ts +0 -47
- package/src/app/api/__tests__/swarms-start-route.test.ts +0 -79
- package/src/app/api/__tests__/swarms-status-route.test.ts +0 -42
- package/src/app/api/__tests__/teams-file-route.test.ts +0 -129
- package/src/app/api/__tests__/teams-files-route.test.ts +0 -57
- package/src/app/api/__tests__/teams-meta-route.test.ts +0 -113
- package/src/app/api/__tests__/teams-orchestrator-install-route.test.ts +0 -66
- package/src/app/api/__tests__/teams-orchestrator-route.test.ts +0 -59
- package/src/app/api/__tests__/teams-remove-team-route.test.ts +0 -122
- package/src/app/api/__tests__/teams-skills-install-route.test.ts +0 -78
- package/src/app/api/__tests__/teams-skills-route.test.ts +0 -73
- package/src/app/api/__tests__/teams-workflow-runs-route.test.ts +0 -85
- package/src/app/api/__tests__/teams-workflows-route.test.ts +0 -110
- package/src/app/api/__tests__/tickets-move-route.test.ts +0 -60
- package/src/app/api/agents/[id]/route.ts +0 -83
- package/src/app/api/agents/add/route.ts +0 -114
- package/src/app/api/agents/file/route.ts +0 -45
- package/src/app/api/agents/files/route.ts +0 -23
- package/src/app/api/agents/identity/route.ts +0 -41
- package/src/app/api/agents/route.ts +0 -22
- package/src/app/api/agents/skills/install/route.ts +0 -34
- package/src/app/api/agents/skills/route.ts +0 -39
- package/src/app/api/agents/update/route.ts +0 -52
- package/src/app/api/channels/bindings/route.ts +0 -63
- package/src/app/api/cron/__tests__/helpers.test.ts +0 -164
- package/src/app/api/cron/delete/route.ts +0 -23
- package/src/app/api/cron/helpers.ts +0 -172
- package/src/app/api/cron/job/route.ts +0 -22
- package/src/app/api/cron/jobs/route.ts +0 -52
- package/src/app/api/cron/recipe-installed/route.ts +0 -65
- package/src/app/api/gateway/restart/route.ts +0 -20
- package/src/app/api/goals/[id]/promote/route.ts +0 -119
- package/src/app/api/goals/[id]/route.ts +0 -54
- package/src/app/api/goals/route.ts +0 -44
- package/src/app/api/ids/check/route.ts +0 -113
- package/src/app/api/marketplace/recipes/[slug]/route.ts +0 -16
- package/src/app/api/marketplace/recipes/route.ts +0 -22
- package/src/app/api/recipes/[id]/route.ts +0 -62
- package/src/app/api/recipes/clone/route.ts +0 -106
- package/src/app/api/recipes/custom-team/route.ts +0 -193
- package/src/app/api/recipes/delete/helpers.ts +0 -65
- package/src/app/api/recipes/delete/route.ts +0 -73
- package/src/app/api/recipes/route.ts +0 -21
- package/src/app/api/recipes/team-agents/__tests__/helpers.test.ts +0 -156
- package/src/app/api/recipes/team-agents/helpers.ts +0 -151
- package/src/app/api/recipes/team-agents/route.ts +0 -80
- package/src/app/api/scaffold/__tests__/helpers.test.ts +0 -186
- package/src/app/api/scaffold/helpers.ts +0 -214
- package/src/app/api/scaffold/route.ts +0 -95
- package/src/app/api/settings/cron-installation/route.ts +0 -58
- package/src/app/api/skills/available/route.ts +0 -23
- package/src/app/api/swarms/start/route.ts +0 -100
- package/src/app/api/swarms/status/route.ts +0 -31
- package/src/app/api/teams/[teamId]/tickets/assign/route.ts +0 -105
- package/src/app/api/teams/[teamId]/tickets/assignees/route.ts +0 -27
- package/src/app/api/teams/[teamId]/tickets/delete/route.ts +0 -55
- package/src/app/api/teams/[teamId]/tickets/move/route.ts +0 -70
- package/src/app/api/teams/[teamId]/tickets/move-to-goals/route.ts +0 -56
- package/src/app/api/teams/file/route.ts +0 -46
- package/src/app/api/teams/files/route.ts +0 -63
- package/src/app/api/teams/memory/route.ts +0 -250
- package/src/app/api/teams/meta/route.ts +0 -43
- package/src/app/api/teams/orchestrator/install/route.ts +0 -129
- package/src/app/api/teams/orchestrator/route.ts +0 -216
- package/src/app/api/teams/remove-team/route.ts +0 -37
- package/src/app/api/teams/skills/install/route.ts +0 -18
- package/src/app/api/teams/skills/route.ts +0 -25
- package/src/app/api/teams/workflow-runs/route.ts +0 -534
- package/src/app/api/teams/workflow-templates/route.ts +0 -71
- package/src/app/api/teams/workflows/route.ts +0 -55
- package/src/app/api/tickets/assign/route.ts +0 -94
- package/src/app/api/tickets/assignees/route.ts +0 -24
- package/src/app/api/tickets/move/route.ts +0 -69
- package/src/app/channels/channels-client.tsx +0 -271
- package/src/app/channels/page.tsx +0 -5
- package/src/app/cron-jobs/cron-jobs-client.tsx +0 -243
- package/src/app/cron-jobs/page.tsx +0 -34
- package/src/app/favicon.ico +0 -0
- package/src/app/global-error.tsx +0 -50
- package/src/app/globals.css +0 -153
- package/src/app/goals/[id]/goal-editor.tsx +0 -162
- package/src/app/goals/[id]/page.tsx +0 -6
- package/src/app/goals/goals-client.tsx +0 -201
- package/src/app/goals/new/page.tsx +0 -81
- package/src/app/goals/page.tsx +0 -10
- package/src/app/layout.tsx +0 -53
- package/src/app/manifest.ts +0 -15
- package/src/app/not-found.tsx +0 -8
- package/src/app/page.tsx +0 -33
- package/src/app/recipes/CreateAgentModal.tsx +0 -156
- package/src/app/recipes/CreateCustomTeamModal.tsx +0 -375
- package/src/app/recipes/CreateModalShell.tsx +0 -55
- package/src/app/recipes/CreateTeamModal.tsx +0 -91
- package/src/app/recipes/[id]/RecipeEditor/RecipeEditorCreateModal.tsx +0 -72
- package/src/app/recipes/[id]/RecipeEditor/RecipeEditorPanel.tsx +0 -216
- package/src/app/recipes/[id]/RecipeEditor/index.tsx +0 -271
- package/src/app/recipes/[id]/RecipeEditor/recipe-editor-utils.ts +0 -46
- package/src/app/recipes/[id]/RecipeEditor/types.ts +0 -52
- package/src/app/recipes/[id]/page.tsx +0 -37
- package/src/app/recipes/page.tsx +0 -101
- package/src/app/recipes/recipes-client.tsx +0 -620
- package/src/app/settings/page.tsx +0 -26
- package/src/app/settings/settings-client.tsx +0 -91
- package/src/app/teams/[teamId]/CloneTeamModal.tsx +0 -116
- package/src/app/teams/[teamId]/OrchestratorPanel.tsx +0 -255
- package/src/app/teams/[teamId]/OrchestratorSetupModal.tsx +0 -184
- package/src/app/teams/[teamId]/PublishChangesModal.tsx +0 -43
- package/src/app/teams/[teamId]/page.tsx +0 -49
- package/src/app/teams/[teamId]/team-editor/TeamAgentsTab.tsx +0 -145
- package/src/app/teams/[teamId]/team-editor/TeamCronTab.tsx +0 -72
- package/src/app/teams/[teamId]/team-editor/TeamFilesTab.tsx +0 -74
- package/src/app/teams/[teamId]/team-editor/TeamMemoryTab.tsx +0 -349
- package/src/app/teams/[teamId]/team-editor/TeamRecipeTab.tsx +0 -151
- package/src/app/teams/[teamId]/team-editor/TeamSkillsTab.tsx +0 -68
- package/src/app/teams/[teamId]/team-editor/index.tsx +0 -558
- package/src/app/teams/[teamId]/team-editor/team-editor-data.ts +0 -255
- package/src/app/teams/[teamId]/team-editor/team-editor-utils.ts +0 -78
- package/src/app/teams/[teamId]/team-editor/types.ts +0 -34
- package/src/app/teams/[teamId]/tickets/[ticket]/page.tsx +0 -35
- package/src/app/teams/[teamId]/tickets/page.tsx +0 -15
- package/src/app/teams/[teamId]/workflows/[workflowId]/WorkflowCanvas.tsx +0 -111
- package/src/app/teams/[teamId]/workflows/[workflowId]/page.tsx +0 -27
- package/src/app/teams/[teamId]/workflows/[workflowId]/workflows-editor-client.tsx +0 -1608
- package/src/app/teams/[teamId]/workflows/page.tsx +0 -40
- package/src/app/teams/[teamId]/workflows/workflows-client.tsx +0 -494
- package/src/app/tickets/TicketDetailClient.tsx +0 -147
- package/src/app/tickets/TicketsBoardClient.tsx +0 -200
- package/src/app/tickets/[ticket]/TicketAssignControl.tsx +0 -112
- package/src/app/tickets/[ticket]/page.tsx +0 -36
- package/src/app/tickets/page.tsx +0 -10
- package/src/components/AppShell.tsx +0 -286
- package/src/components/ConfirmationModal.tsx +0 -81
- package/src/components/DeleteEntityModal.tsx +0 -41
- package/src/components/ErrorBoundary.tsx +0 -70
- package/src/components/FileListWithOptionalToggle.tsx +0 -86
- package/src/components/GoalFormFields.tsx +0 -163
- package/src/components/ScaffoldOverlay.tsx +0 -78
- package/src/components/ThemeToggle.tsx +0 -53
- package/src/components/ToastProvider.tsx +0 -163
- package/src/components/__tests__/ConfirmationModal.test.tsx +0 -109
- package/src/components/__tests__/ErrorBoundary.test.tsx +0 -39
- package/src/components/__tests__/FileListWithOptionalToggle.test.tsx +0 -109
- package/src/components/__tests__/GoalFormFields.test.tsx +0 -117
- package/src/components/delete-modals.tsx +0 -59
- package/src/components/icons.tsx +0 -48
- package/src/lib/__tests__/agent-workspace.test.ts +0 -44
- package/src/lib/__tests__/agents.test.ts +0 -36
- package/src/lib/__tests__/api-route-helpers.test.ts +0 -188
- package/src/lib/__tests__/cron.test.ts +0 -45
- package/src/lib/__tests__/editor-utils.test.ts +0 -38
- package/src/lib/__tests__/errors.test.ts +0 -15
- package/src/lib/__tests__/exec.test.ts +0 -13
- package/src/lib/__tests__/fetch-json.test.ts +0 -118
- package/src/lib/__tests__/gateway.test.ts +0 -234
- package/src/lib/__tests__/goal-promote.test.ts +0 -39
- package/src/lib/__tests__/goals-client.test.ts +0 -26
- package/src/lib/__tests__/goals.test.ts +0 -275
- package/src/lib/__tests__/json.test.ts +0 -15
- package/src/lib/__tests__/kitchen-api.test.ts +0 -32
- package/src/lib/__tests__/marketplace.test.ts +0 -116
- package/src/lib/__tests__/openclaw.test.ts +0 -129
- package/src/lib/__tests__/paths.test.ts +0 -136
- package/src/lib/__tests__/poll.test.ts +0 -26
- package/src/lib/__tests__/recipe-clone.test.ts +0 -85
- package/src/lib/__tests__/recipe-team-agents.test.ts +0 -70
- package/src/lib/__tests__/recipes.test.ts +0 -199
- package/src/lib/__tests__/scaffold-client.test.ts +0 -106
- package/src/lib/__tests__/scaffold.test.ts +0 -64
- package/src/lib/__tests__/slugify.test.ts +0 -23
- package/src/lib/__tests__/tickets.test.ts +0 -158
- package/src/lib/__tests__/type-guards.test.ts +0 -18
- package/src/lib/__tests__/use-slugified-id.test.tsx +0 -120
- package/src/lib/agent-workspace.ts +0 -14
- package/src/lib/agents.ts +0 -17
- package/src/lib/api-route-helpers.ts +0 -157
- package/src/lib/cron.ts +0 -40
- package/src/lib/editor-utils.ts +0 -18
- package/src/lib/errors.ts +0 -7
- package/src/lib/exec.ts +0 -4
- package/src/lib/fetch-json.ts +0 -29
- package/src/lib/gateway.ts +0 -100
- package/src/lib/goal-promote.ts +0 -27
- package/src/lib/goals-client.ts +0 -69
- package/src/lib/goals.ts +0 -171
- package/src/lib/json.ts +0 -10
- package/src/lib/kitchen-api.ts +0 -19
- package/src/lib/marketplace.ts +0 -46
- package/src/lib/openclaw.ts +0 -59
- package/src/lib/paths.ts +0 -69
- package/src/lib/poll.ts +0 -18
- package/src/lib/recipe-clone.ts +0 -42
- package/src/lib/recipe-team-agents.ts +0 -30
- package/src/lib/recipes.ts +0 -95
- package/src/lib/scaffold-client.ts +0 -31
- package/src/lib/scaffold.ts +0 -37
- package/src/lib/slugify.ts +0 -25
- package/src/lib/swarms.ts +0 -25
- package/src/lib/tickets.ts +0 -192
- package/src/lib/type-guards.ts +0 -3
- package/src/lib/use-slugified-id.ts +0 -35
- package/src/lib/workflows/README.md +0 -11
- package/src/lib/workflows/__tests__/storage.test.ts +0 -129
- package/src/lib/workflows/__tests__/validate.test.ts +0 -92
- package/src/lib/workflows/api-handlers.ts +0 -35
- package/src/lib/workflows/readdir.ts +0 -23
- package/src/lib/workflows/runs-storage.ts +0 -59
- package/src/lib/workflows/runs-types.ts +0 -42
- package/src/lib/workflows/storage.ts +0 -70
- package/src/lib/workflows/templates/index.ts +0 -1
- package/src/lib/workflows/templates/marketing-cadence-v1.ts +0 -142
- package/src/lib/workflows/types.ts +0 -48
- package/src/lib/workflows/validate.ts +0 -92
- package/src/proxy.ts +0 -28
- /package/.next/static/{z86RoqzzXXrWnpi229zP6 → Jrrrm9HH5bKkSrQhe1j93}/_buildManifest.js +0 -0
- /package/.next/static/{z86RoqzzXXrWnpi229zP6 → Jrrrm9HH5bKkSrQhe1j93}/_clientMiddlewareManifest.json +0 -0
- /package/.next/static/{z86RoqzzXXrWnpi229zP6 → Jrrrm9HH5bKkSrQhe1j93}/_ssgManifest.js +0 -0
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
import { errorMessage } from "@/lib/errors";
|
|
2
|
-
import { fetchAll, fetchJson } from "@/lib/fetch-json";
|
|
3
|
-
import type { RecipeListItem, TeamAgentEntry, TeamTabSetters } from "./types";
|
|
4
|
-
import { safeParseJson } from "./team-editor-utils";
|
|
5
|
-
|
|
6
|
-
async function fetchRecipesAndMeta(teamId: string) {
|
|
7
|
-
const [recipesData, metaRes] = await Promise.all([
|
|
8
|
-
fetchJson<{ recipes?: RecipeListItem[] }>("/api/recipes", { cache: "no-store" }),
|
|
9
|
-
fetch(`/api/teams/meta?teamId=${encodeURIComponent(teamId)}`, { cache: "no-store" }),
|
|
10
|
-
]);
|
|
11
|
-
return { recipesData, metaRes };
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const TEAM_TAB_URLS = (teamId: string) => [
|
|
15
|
-
`/api/teams/files?teamId=${encodeURIComponent(teamId)}`,
|
|
16
|
-
`/api/cron/jobs?teamId=${encodeURIComponent(teamId)}`,
|
|
17
|
-
"/api/agents",
|
|
18
|
-
`/api/teams/skills?teamId=${encodeURIComponent(teamId)}`,
|
|
19
|
-
"/api/skills/available",
|
|
20
|
-
];
|
|
21
|
-
|
|
22
|
-
async function fetchTeamTabResponses(teamId: string) {
|
|
23
|
-
const responses = await fetchAll(TEAM_TAB_URLS(teamId));
|
|
24
|
-
const texts = await Promise.all(responses.map((r) => r.text()));
|
|
25
|
-
return { responses, texts };
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export async function loadTeamTabData(teamId: string, setters: TeamTabSetters): Promise<void> {
|
|
29
|
-
setters.setTeamFilesLoading(true);
|
|
30
|
-
setters.setCronLoading(true);
|
|
31
|
-
setters.setTeamAgentsLoading(true);
|
|
32
|
-
setters.setSkillsLoading(true);
|
|
33
|
-
try {
|
|
34
|
-
const { responses, texts } = await fetchTeamTabResponses(teamId);
|
|
35
|
-
const [filesRes, cronRes, agentsRes, skillsRes, availableSkillsRes] = responses;
|
|
36
|
-
const [filesText, cronText, agentsText, skillsText, availableText] = texts;
|
|
37
|
-
|
|
38
|
-
const filesJson = safeParseJson<{ ok?: boolean; files?: unknown[] }>(filesText, {});
|
|
39
|
-
if (filesRes.ok && filesJson.ok && Array.isArray(filesJson.files)) {
|
|
40
|
-
setters.setTeamFiles(
|
|
41
|
-
filesJson.files.map((f) => {
|
|
42
|
-
const entry = f as { name?: unknown; missing?: unknown; required?: unknown; rationale?: unknown };
|
|
43
|
-
return {
|
|
44
|
-
name: String(entry.name ?? ""),
|
|
45
|
-
missing: Boolean(entry.missing),
|
|
46
|
-
required: Boolean(entry.required),
|
|
47
|
-
rationale: typeof entry.rationale === "string" ? entry.rationale : undefined,
|
|
48
|
-
};
|
|
49
|
-
}),
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const cronJson = safeParseJson<{ ok?: boolean; jobs?: unknown[] }>(cronText, {});
|
|
54
|
-
if (cronRes.ok && cronJson.ok && Array.isArray(cronJson.jobs)) setters.setCronJobs(cronJson.jobs);
|
|
55
|
-
|
|
56
|
-
const agentsJson = safeParseJson<{ agents?: unknown[] }>(agentsText, {});
|
|
57
|
-
if (agentsRes.ok && Array.isArray(agentsJson.agents)) {
|
|
58
|
-
const filtered = agentsJson.agents.filter((a) => String((a as { id?: unknown }).id ?? "").startsWith(`${teamId}-`));
|
|
59
|
-
setters.setTeamAgents(
|
|
60
|
-
filtered.map((a) => {
|
|
61
|
-
const agent = a as { id?: unknown; identityName?: unknown };
|
|
62
|
-
return { id: String(agent.id ?? ""), identityName: typeof agent.identityName === "string" ? agent.identityName : undefined };
|
|
63
|
-
}),
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const skillsJson = safeParseJson<{ ok?: boolean; skills?: unknown[] }>(skillsText, {});
|
|
68
|
-
if (skillsRes.ok && skillsJson.ok && Array.isArray(skillsJson.skills)) setters.setSkillsList(skillsJson.skills as string[]);
|
|
69
|
-
|
|
70
|
-
const availableJson = safeParseJson<{ ok?: boolean; skills?: unknown[] }>(availableText, {});
|
|
71
|
-
if (availableSkillsRes.ok && availableJson.ok && Array.isArray(availableJson.skills)) {
|
|
72
|
-
const list = availableJson.skills as string[];
|
|
73
|
-
setters.setAvailableSkills(list);
|
|
74
|
-
setters.setSelectedSkill((prev) => {
|
|
75
|
-
const p = String(prev ?? "").trim();
|
|
76
|
-
if (p && list.includes(p)) return p;
|
|
77
|
-
return list[0] ?? "";
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
} finally {
|
|
81
|
-
setters.setTeamFilesLoading(false);
|
|
82
|
-
setters.setCronLoading(false);
|
|
83
|
-
setters.setTeamAgentsLoading(false);
|
|
84
|
-
setters.setSkillsLoading(false);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export type LoadTeamEditorInitialSetters = TeamTabSetters & {
|
|
89
|
-
setRecipes: (r: RecipeListItem[]) => void;
|
|
90
|
-
setLockedFromId: (v: string | null) => void;
|
|
91
|
-
setLockedFromName: (v: string | null) => void;
|
|
92
|
-
setProvenanceMissing: (v: boolean) => void;
|
|
93
|
-
setFromId: (v: string) => void;
|
|
94
|
-
setTeamMetaRecipeHash: (v: string | null) => void;
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
export async function loadTeamEditorInitial(teamId: string, setters: LoadTeamEditorInitialSetters): Promise<void> {
|
|
98
|
-
const initialData = await fetchRecipesAndMeta(teamId);
|
|
99
|
-
setters.setRecipes((initialData.recipesData.recipes ?? []) as RecipeListItem[]);
|
|
100
|
-
|
|
101
|
-
let locked: { recipeId: string; recipeName?: string } | null = null;
|
|
102
|
-
try {
|
|
103
|
-
const metaJson = await initialData.metaRes.json();
|
|
104
|
-
const meta = metaJson.meta as { recipeId?: unknown; recipeName?: unknown; recipeHash?: unknown } | undefined;
|
|
105
|
-
if (initialData.metaRes.ok && metaJson.ok && meta?.recipeId) {
|
|
106
|
-
locked = {
|
|
107
|
-
recipeId: String(meta.recipeId),
|
|
108
|
-
recipeName: typeof meta.recipeName === "string" ? meta.recipeName : undefined,
|
|
109
|
-
};
|
|
110
|
-
setters.setTeamMetaRecipeHash(typeof meta.recipeHash === "string" ? meta.recipeHash : null);
|
|
111
|
-
} else {
|
|
112
|
-
setters.setTeamMetaRecipeHash(null);
|
|
113
|
-
}
|
|
114
|
-
} catch {
|
|
115
|
-
setters.setTeamMetaRecipeHash(null);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if (locked) {
|
|
119
|
-
setters.setLockedFromId(locked.recipeId);
|
|
120
|
-
setters.setLockedFromName(locked.recipeName ?? null);
|
|
121
|
-
setters.setProvenanceMissing(false);
|
|
122
|
-
setters.setFromId(locked.recipeId);
|
|
123
|
-
} else {
|
|
124
|
-
setters.setLockedFromId(null);
|
|
125
|
-
setters.setLockedFromName(null);
|
|
126
|
-
setters.setProvenanceMissing(true);
|
|
127
|
-
const list = (initialData.recipesData.recipes ?? []) as RecipeListItem[];
|
|
128
|
-
const preferred = list.find((r) => r.kind === "team" && r.id === teamId);
|
|
129
|
-
const fallback = list.find((r) => r.kind === "team");
|
|
130
|
-
const pick = preferred ?? fallback;
|
|
131
|
-
if (pick) setters.setFromId(pick.id);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
await loadTeamTabData(teamId, {
|
|
135
|
-
setTeamFiles: setters.setTeamFiles,
|
|
136
|
-
setCronJobs: setters.setCronJobs,
|
|
137
|
-
setTeamAgents: setters.setTeamAgents,
|
|
138
|
-
setSkillsList: setters.setSkillsList,
|
|
139
|
-
setAvailableSkills: setters.setAvailableSkills,
|
|
140
|
-
setSelectedSkill: setters.setSelectedSkill,
|
|
141
|
-
setTeamFilesLoading: setters.setTeamFilesLoading,
|
|
142
|
-
setCronLoading: setters.setCronLoading,
|
|
143
|
-
setTeamAgentsLoading: setters.setTeamAgentsLoading,
|
|
144
|
-
setSkillsLoading: setters.setSkillsLoading,
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
export async function fetchTeamAgentsOnce(teamId: string): Promise<{ ok: boolean; agents: TeamAgentEntry[] }> {
|
|
149
|
-
try {
|
|
150
|
-
const agentsJson = await fetchJson<{ agents?: unknown[] }>("/api/agents", { cache: "no-store" });
|
|
151
|
-
const all = Array.isArray(agentsJson.agents) ? agentsJson.agents : [];
|
|
152
|
-
const filtered = all.filter((a) => String((a as { id?: unknown }).id ?? "").startsWith(`${teamId}-`));
|
|
153
|
-
const mapped = filtered.map((a) => {
|
|
154
|
-
const agent = a as { id?: unknown; identityName?: unknown };
|
|
155
|
-
return { id: String(agent.id ?? ""), identityName: typeof agent.identityName === "string" ? agent.identityName : undefined };
|
|
156
|
-
});
|
|
157
|
-
return { ok: true, agents: mapped };
|
|
158
|
-
} catch {
|
|
159
|
-
return { ok: false, agents: [] };
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
async function applyScaffoldAfterTeamAgentsChange(
|
|
164
|
-
teamId: string,
|
|
165
|
-
toId: string,
|
|
166
|
-
flashMessage: (msg: string, kind: "success" | "error") => void
|
|
167
|
-
): Promise<void> {
|
|
168
|
-
try {
|
|
169
|
-
await fetchJson("/api/scaffold", {
|
|
170
|
-
method: "POST",
|
|
171
|
-
headers: { "content-type": "application/json" },
|
|
172
|
-
body: JSON.stringify({
|
|
173
|
-
kind: "team",
|
|
174
|
-
recipeId: toId.trim(),
|
|
175
|
-
teamId,
|
|
176
|
-
applyConfig: true,
|
|
177
|
-
overwrite: false,
|
|
178
|
-
allowExisting: true,
|
|
179
|
-
cronInstallChoice: "no",
|
|
180
|
-
}),
|
|
181
|
-
});
|
|
182
|
-
} catch (e: unknown) {
|
|
183
|
-
flashMessage(errorMessage(e), "error");
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
async function pollTeamAgentsUntil(
|
|
188
|
-
teamId: string,
|
|
189
|
-
expectedAgentId: string,
|
|
190
|
-
setTeamAgents: (a: TeamAgentEntry[]) => void,
|
|
191
|
-
maxMs: number
|
|
192
|
-
): Promise<boolean> {
|
|
193
|
-
const start = Date.now();
|
|
194
|
-
while (Date.now() - start < maxMs) {
|
|
195
|
-
try {
|
|
196
|
-
const r = await fetchTeamAgentsOnce(teamId);
|
|
197
|
-
if (r.ok) {
|
|
198
|
-
setTeamAgents(r.agents);
|
|
199
|
-
const hasExpected = expectedAgentId ? r.agents.some((a) => a.id === expectedAgentId) : false;
|
|
200
|
-
if (!expectedAgentId || hasExpected) return true;
|
|
201
|
-
}
|
|
202
|
-
} catch {
|
|
203
|
-
// ignore
|
|
204
|
-
}
|
|
205
|
-
await new Promise((res) => setTimeout(res, 500));
|
|
206
|
-
}
|
|
207
|
-
return false;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
export async function handleAddAgentToTeam(opts: {
|
|
211
|
-
teamId: string;
|
|
212
|
-
toId: string;
|
|
213
|
-
newRole: string;
|
|
214
|
-
derivedRole: string;
|
|
215
|
-
newRoleName: string;
|
|
216
|
-
content: string;
|
|
217
|
-
setContent: (c: string) => void;
|
|
218
|
-
setTeamAgents: (a: TeamAgentEntry[]) => void;
|
|
219
|
-
flashMessage: (msg: string, kind: "success" | "error") => void;
|
|
220
|
-
ensureCustomRecipeExists: (args: { overwrite: boolean }) => Promise<unknown>;
|
|
221
|
-
}): Promise<void> {
|
|
222
|
-
const { teamId, toId, newRole, derivedRole, newRoleName, content, setContent, setTeamAgents, flashMessage, ensureCustomRecipeExists } =
|
|
223
|
-
opts;
|
|
224
|
-
try {
|
|
225
|
-
await ensureCustomRecipeExists({ overwrite: false });
|
|
226
|
-
} catch (e: unknown) {
|
|
227
|
-
const msg = errorMessage(e);
|
|
228
|
-
if (!/Recipe id already exists:/i.test(msg)) throw e;
|
|
229
|
-
}
|
|
230
|
-
const json = await fetchJson<{ ok?: boolean; content?: string; addedAgentId?: string }>("/api/recipes/team-agents", {
|
|
231
|
-
method: "POST",
|
|
232
|
-
headers: { "content-type": "application/json" },
|
|
233
|
-
body: JSON.stringify(
|
|
234
|
-
newRole === "__custom__"
|
|
235
|
-
? { recipeId: toId.trim(), op: "add", role: derivedRole, name: newRoleName }
|
|
236
|
-
: { recipeId: toId.trim(), op: "addLike", baseRole: derivedRole, teamId, name: newRoleName },
|
|
237
|
-
),
|
|
238
|
-
});
|
|
239
|
-
if (!json.ok) throw new Error("Failed updating agents list");
|
|
240
|
-
setContent(String(json.content ?? content));
|
|
241
|
-
|
|
242
|
-
await applyScaffoldAfterTeamAgentsChange(teamId, toId, flashMessage);
|
|
243
|
-
|
|
244
|
-
const expectedAgentId = typeof json.addedAgentId === "string" ? json.addedAgentId : "";
|
|
245
|
-
const appeared = await pollTeamAgentsUntil(teamId, expectedAgentId, setTeamAgents, 5000);
|
|
246
|
-
if (!appeared && expectedAgentId) {
|
|
247
|
-
try {
|
|
248
|
-
void fetch("/api/gateway/restart", { method: "POST" });
|
|
249
|
-
} catch {
|
|
250
|
-
// ignore
|
|
251
|
-
}
|
|
252
|
-
await pollTeamAgentsUntil(teamId, expectedAgentId, setTeamAgents, 10000);
|
|
253
|
-
}
|
|
254
|
-
flashMessage(`Updated agents list in ${toId}`, "success");
|
|
255
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
export function safeParseJson<T>(text: string, def: T): T {
|
|
2
|
-
try {
|
|
3
|
-
return JSON.parse(text) as T;
|
|
4
|
-
} catch {
|
|
5
|
-
return def;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function replaceOrAddIdInLines(lines: string[], id: string): string[] {
|
|
10
|
-
let found = false;
|
|
11
|
-
const next = lines.map((line) => {
|
|
12
|
-
if (/^id\s*:/i.test(line)) {
|
|
13
|
-
found = true;
|
|
14
|
-
return `id: ${id}`;
|
|
15
|
-
}
|
|
16
|
-
return line;
|
|
17
|
-
});
|
|
18
|
-
if (!found) next.unshift(`id: ${id}`);
|
|
19
|
-
return next;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function forceFrontmatterId(md: string, id: string): string {
|
|
23
|
-
if (!md.startsWith("---\n")) return md;
|
|
24
|
-
const end = md.indexOf("\n---\n", 4);
|
|
25
|
-
if (end === -1) return md;
|
|
26
|
-
const fm = md.slice(4, end);
|
|
27
|
-
const body = md.slice(end + 5);
|
|
28
|
-
const nextLines = replaceOrAddIdInLines(fm.split("\n"), id);
|
|
29
|
-
return `---\n${nextLines.join("\n")}\n---\n${body}`;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function patchTeamIdInLines(
|
|
33
|
-
lines: string[],
|
|
34
|
-
teamId: string
|
|
35
|
-
): { next: string[]; sawTeamBlock: boolean; patched: boolean } {
|
|
36
|
-
const next: string[] = [];
|
|
37
|
-
let inTeam = false;
|
|
38
|
-
let sawTeamBlock = false;
|
|
39
|
-
let patched = false;
|
|
40
|
-
|
|
41
|
-
for (const line of lines) {
|
|
42
|
-
if (/^team\s*:\s*$/i.test(line)) {
|
|
43
|
-
inTeam = true;
|
|
44
|
-
sawTeamBlock = true;
|
|
45
|
-
next.push(line);
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
if (inTeam && /^\S/.test(line)) inTeam = false;
|
|
49
|
-
if (inTeam && /^\s+teamId\s*:/i.test(line)) {
|
|
50
|
-
next.push(` teamId: ${teamId}`);
|
|
51
|
-
patched = true;
|
|
52
|
-
continue;
|
|
53
|
-
}
|
|
54
|
-
next.push(line);
|
|
55
|
-
}
|
|
56
|
-
return { next, sawTeamBlock, patched };
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export function forceFrontmatterTeamTeamId(md: string, teamId: string): string {
|
|
60
|
-
if (!md.startsWith("---\n")) return md;
|
|
61
|
-
const end = md.indexOf("\n---\n", 4);
|
|
62
|
-
if (end === -1) return md;
|
|
63
|
-
|
|
64
|
-
const fm = md.slice(4, end);
|
|
65
|
-
const body = md.slice(end + 5);
|
|
66
|
-
const lines = fm.split("\n");
|
|
67
|
-
const { next, sawTeamBlock, patched } = patchTeamIdInLines(lines, teamId);
|
|
68
|
-
|
|
69
|
-
if (sawTeamBlock && !patched) {
|
|
70
|
-
const out: string[] = [];
|
|
71
|
-
for (const line of next) {
|
|
72
|
-
out.push(line);
|
|
73
|
-
if (/^team\s*:\s*$/i.test(line)) out.push(` teamId: ${teamId}`);
|
|
74
|
-
}
|
|
75
|
-
return `---\n${out.join("\n")}\n---\n${body}`;
|
|
76
|
-
}
|
|
77
|
-
return `---\n${next.join("\n")}\n---\n${body}`;
|
|
78
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export type RecipeListItem = {
|
|
2
|
-
id: string;
|
|
3
|
-
name: string;
|
|
4
|
-
kind: "agent" | "team";
|
|
5
|
-
source: "builtin" | "workspace";
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export type RecipeDetail = RecipeListItem & {
|
|
9
|
-
content: string;
|
|
10
|
-
filePath: string | null;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export type TeamFileEntry = {
|
|
14
|
-
name: string;
|
|
15
|
-
missing: boolean;
|
|
16
|
-
required?: boolean;
|
|
17
|
-
rationale?: string;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export type TeamAgentEntry = { id: string; identityName?: string };
|
|
21
|
-
|
|
22
|
-
/** Setters used by loadTeamTabData and passed through from loadTeamEditorInitial. */
|
|
23
|
-
export type TeamTabSetters = {
|
|
24
|
-
setTeamFiles: (f: TeamFileEntry[]) => void;
|
|
25
|
-
setCronJobs: (j: unknown[]) => void;
|
|
26
|
-
setTeamAgents: (a: TeamAgentEntry[]) => void;
|
|
27
|
-
setSkillsList: (s: string[]) => void;
|
|
28
|
-
setAvailableSkills: (s: string[]) => void;
|
|
29
|
-
setSelectedSkill: (fn: (prev: string) => string) => void;
|
|
30
|
-
setTeamFilesLoading: (v: boolean) => void;
|
|
31
|
-
setCronLoading: (v: boolean) => void;
|
|
32
|
-
setTeamAgentsLoading: (v: boolean) => void;
|
|
33
|
-
setSkillsLoading: (v: boolean) => void;
|
|
34
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { TicketDetailClient } from "@/app/tickets/TicketDetailClient";
|
|
2
|
-
import { getTicketMarkdown } from "@/lib/tickets";
|
|
3
|
-
|
|
4
|
-
export const dynamic = "force-dynamic";
|
|
5
|
-
|
|
6
|
-
export default async function TeamTicketDetailPage({
|
|
7
|
-
params,
|
|
8
|
-
}: {
|
|
9
|
-
params: Promise<{ teamId: string; ticket: string }>;
|
|
10
|
-
}) {
|
|
11
|
-
const { teamId, ticket } = await params;
|
|
12
|
-
const data = await getTicketMarkdown(teamId, ticket);
|
|
13
|
-
|
|
14
|
-
if (!data) {
|
|
15
|
-
return (
|
|
16
|
-
<div className="ck-glass p-6">
|
|
17
|
-
<h1 className="text-xl font-semibold tracking-tight">Ticket not found</h1>
|
|
18
|
-
<p className="mt-3 text-sm text-[color:var(--ck-text-secondary)]">
|
|
19
|
-
Couldn’t locate “{ticket}” in backlog/in-progress/testing/done for team “{teamId}”.
|
|
20
|
-
</p>
|
|
21
|
-
</div>
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<TicketDetailClient
|
|
27
|
-
teamId={teamId}
|
|
28
|
-
ticketId={data.id}
|
|
29
|
-
file={data.file}
|
|
30
|
-
markdown={data.markdown}
|
|
31
|
-
backHref={`/teams/${encodeURIComponent(teamId)}/tickets`}
|
|
32
|
-
currentOwner={data.owner}
|
|
33
|
-
/>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { TicketsBoardClient } from "@/app/tickets/TicketsBoardClient";
|
|
2
|
-
import { listTickets } from "@/lib/tickets";
|
|
3
|
-
|
|
4
|
-
export const dynamic = "force-dynamic";
|
|
5
|
-
|
|
6
|
-
export default async function TeamTicketsPage({
|
|
7
|
-
params,
|
|
8
|
-
}: {
|
|
9
|
-
params: Promise<{ teamId: string }>;
|
|
10
|
-
}) {
|
|
11
|
-
const { teamId } = await params;
|
|
12
|
-
const tickets = await listTickets(teamId);
|
|
13
|
-
|
|
14
|
-
return <TicketsBoardClient tickets={tickets} basePath={`/teams/${encodeURIComponent(teamId)}/tickets`} />;
|
|
15
|
-
}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { useRef, useState } from "react";
|
|
4
|
-
import type { WorkflowFileV1 } from "@/lib/workflows/types";
|
|
5
|
-
|
|
6
|
-
export function WorkflowCanvas({
|
|
7
|
-
wf,
|
|
8
|
-
selectedNodeId,
|
|
9
|
-
onSelectNode,
|
|
10
|
-
onWorkflowChange,
|
|
11
|
-
}: {
|
|
12
|
-
wf: WorkflowFileV1 | null;
|
|
13
|
-
selectedNodeId: string;
|
|
14
|
-
onSelectNode: (id: string) => void;
|
|
15
|
-
onWorkflowChange: (next: WorkflowFileV1) => void;
|
|
16
|
-
}) {
|
|
17
|
-
const canvasRef = useRef<HTMLDivElement | null>(null);
|
|
18
|
-
const [dragging, setDragging] = useState<null | {
|
|
19
|
-
nodeId: string;
|
|
20
|
-
dx: number;
|
|
21
|
-
dy: number;
|
|
22
|
-
left: number;
|
|
23
|
-
top: number;
|
|
24
|
-
}>(null);
|
|
25
|
-
|
|
26
|
-
const nodes = wf?.nodes ?? [];
|
|
27
|
-
const edges = wf?.edges ?? [];
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<div
|
|
31
|
-
ref={canvasRef}
|
|
32
|
-
className="relative h-full min-h-0 w-full flex-1 overflow-auto rounded-[var(--ck-radius-sm)] border border-white/10 bg-black/20"
|
|
33
|
-
>
|
|
34
|
-
<div className="relative h-[1200px] w-[2200px]">
|
|
35
|
-
<svg className="absolute inset-0" width={2200} height={1200}>
|
|
36
|
-
{edges.map((e) => {
|
|
37
|
-
const a = nodes.find((n) => n.id === e.from);
|
|
38
|
-
const b = nodes.find((n) => n.id === e.to);
|
|
39
|
-
if (!a || !b || !wf) return null;
|
|
40
|
-
const ax = (typeof a.x === "number" ? a.x : 80) + 90;
|
|
41
|
-
const ay = (typeof a.y === "number" ? a.y : 80) + 24;
|
|
42
|
-
const bx = (typeof b.x === "number" ? b.x : 80) + 90;
|
|
43
|
-
const by = (typeof b.y === "number" ? b.y : 80) + 24;
|
|
44
|
-
return (
|
|
45
|
-
<line
|
|
46
|
-
key={e.id}
|
|
47
|
-
x1={ax}
|
|
48
|
-
y1={ay}
|
|
49
|
-
x2={bx}
|
|
50
|
-
y2={by}
|
|
51
|
-
stroke="rgba(255,255,255,0.18)"
|
|
52
|
-
strokeWidth={2}
|
|
53
|
-
/>
|
|
54
|
-
);
|
|
55
|
-
})}
|
|
56
|
-
</svg>
|
|
57
|
-
|
|
58
|
-
{nodes.map((n, idx) => {
|
|
59
|
-
const x = typeof n.x === "number" ? n.x : 80 + idx * 220;
|
|
60
|
-
const y = typeof n.y === "number" ? n.y : 80;
|
|
61
|
-
const selected = selectedNodeId === n.id;
|
|
62
|
-
return (
|
|
63
|
-
<div
|
|
64
|
-
key={n.id}
|
|
65
|
-
role="button"
|
|
66
|
-
tabIndex={0}
|
|
67
|
-
onClick={() => onSelectNode(n.id)}
|
|
68
|
-
onPointerDown={(e) => {
|
|
69
|
-
if (e.button !== 0) return;
|
|
70
|
-
const el = canvasRef.current;
|
|
71
|
-
if (!el) return;
|
|
72
|
-
const rect = el.getBoundingClientRect();
|
|
73
|
-
onSelectNode(n.id);
|
|
74
|
-
setDragging({
|
|
75
|
-
nodeId: n.id,
|
|
76
|
-
dx: e.clientX - rect.left - x,
|
|
77
|
-
dy: e.clientY - rect.top - y,
|
|
78
|
-
left: rect.left,
|
|
79
|
-
top: rect.top,
|
|
80
|
-
});
|
|
81
|
-
}}
|
|
82
|
-
onPointerUp={() => setDragging(null)}
|
|
83
|
-
onPointerMove={(e) => {
|
|
84
|
-
if (!dragging || dragging.nodeId !== n.id || !wf) return;
|
|
85
|
-
const el = canvasRef.current;
|
|
86
|
-
if (!el) return;
|
|
87
|
-
const nextX = e.clientX - dragging.left - dragging.dx;
|
|
88
|
-
const nextY = e.clientY - dragging.top - dragging.dy;
|
|
89
|
-
const nextNodes = wf.nodes.map((node) =>
|
|
90
|
-
node.id === n.id ? { ...node, x: nextX, y: nextY } : node
|
|
91
|
-
);
|
|
92
|
-
onWorkflowChange({ ...wf, nodes: nextNodes });
|
|
93
|
-
}}
|
|
94
|
-
className={
|
|
95
|
-
selected
|
|
96
|
-
? "absolute cursor-grab rounded-[var(--ck-radius-sm)] border border-white/25 bg-white/10 px-3 py-2 text-xs text-[color:var(--ck-text-primary)] shadow-[var(--ck-shadow-1)]"
|
|
97
|
-
: "absolute cursor-grab rounded-[var(--ck-radius-sm)] border border-white/10 bg-white/5 px-3 py-2 text-xs text-[color:var(--ck-text-secondary)] hover:bg-white/10"
|
|
98
|
-
}
|
|
99
|
-
style={{ left: x, top: y, width: 180 }}
|
|
100
|
-
>
|
|
101
|
-
<div className="font-medium text-[color:var(--ck-text-primary)]">{n.name || n.id}</div>
|
|
102
|
-
<div className="mt-0.5 text-[10px] uppercase tracking-wide text-[color:var(--ck-text-tertiary)]">
|
|
103
|
-
{n.type}
|
|
104
|
-
</div>
|
|
105
|
-
</div>
|
|
106
|
-
);
|
|
107
|
-
})}
|
|
108
|
-
</div>
|
|
109
|
-
</div>
|
|
110
|
-
);
|
|
111
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { unstable_noStore as noStore } from "next/cache";
|
|
2
|
-
import WorkflowsEditorClient from "./workflows-editor-client";
|
|
3
|
-
|
|
4
|
-
export const dynamic = "force-dynamic";
|
|
5
|
-
export const revalidate = 0;
|
|
6
|
-
|
|
7
|
-
export default async function WorkflowEditorPage({
|
|
8
|
-
params,
|
|
9
|
-
searchParams,
|
|
10
|
-
}: {
|
|
11
|
-
params: Promise<{ teamId: string; workflowId: string }>;
|
|
12
|
-
searchParams?: Promise<Record<string, string | string[] | undefined>>;
|
|
13
|
-
}) {
|
|
14
|
-
noStore();
|
|
15
|
-
|
|
16
|
-
const { teamId, workflowId } = await params;
|
|
17
|
-
const sp = (await searchParams) ?? {};
|
|
18
|
-
const draftRaw = sp.draft;
|
|
19
|
-
const draft = Array.isArray(draftRaw) ? draftRaw[0] : draftRaw;
|
|
20
|
-
|
|
21
|
-
// Full-bleed workflows editor (no extra top row / padding / border).
|
|
22
|
-
return (
|
|
23
|
-
<div className="flex h-full min-h-0 flex-col">
|
|
24
|
-
<WorkflowsEditorClient teamId={teamId} workflowId={workflowId} draft={draft === "1"} />
|
|
25
|
-
</div>
|
|
26
|
-
);
|
|
27
|
-
}
|