@open-mercato/ai-assistant 0.5.1-develop.3036.f02c281f23 → 0.5.1-develop.3045.b4b3320cc2
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/.turbo/turbo-build.log +1 -1
- package/AGENTS.md +361 -0
- package/README.md +5 -0
- package/dist/index.js +154 -0
- package/dist/index.js.map +2 -2
- package/dist/modules/ai_assistant/__integration__/TC-AI-002-agent-policy.spec.js +73 -0
- package/dist/modules/ai_assistant/__integration__/TC-AI-002-agent-policy.spec.js.map +7 -0
- package/dist/modules/ai_assistant/__integration__/TC-AI-AGENT-SETTINGS-005-settings-page.spec.js +484 -0
- package/dist/modules/ai_assistant/__integration__/TC-AI-AGENT-SETTINGS-005-settings-page.spec.js.map +7 -0
- package/dist/modules/ai_assistant/__integration__/TC-AI-PLAYGROUND-004-playground.spec.js +251 -0
- package/dist/modules/ai_assistant/__integration__/TC-AI-PLAYGROUND-004-playground.spec.js.map +7 -0
- package/dist/modules/ai_assistant/__integration__/TC-INT-AI-TOOLS.spec.js +91 -0
- package/dist/modules/ai_assistant/__integration__/TC-INT-AI-TOOLS.spec.js.map +7 -0
- package/dist/modules/ai_assistant/ai-tools/attachments-pack.js +202 -0
- package/dist/modules/ai_assistant/ai-tools/attachments-pack.js.map +7 -0
- package/dist/modules/ai_assistant/ai-tools/meta-pack.js +121 -0
- package/dist/modules/ai_assistant/ai-tools/meta-pack.js.map +7 -0
- package/dist/modules/ai_assistant/ai-tools/search-pack.js +94 -0
- package/dist/modules/ai_assistant/ai-tools/search-pack.js.map +7 -0
- package/dist/modules/ai_assistant/ai-tools.js +14 -0
- package/dist/modules/ai_assistant/ai-tools.js.map +7 -0
- package/dist/modules/ai_assistant/api/ai/actions/[id]/cancel/route.js +175 -0
- package/dist/modules/ai_assistant/api/ai/actions/[id]/cancel/route.js.map +7 -0
- package/dist/modules/ai_assistant/api/ai/actions/[id]/confirm/route.js +174 -0
- package/dist/modules/ai_assistant/api/ai/actions/[id]/confirm/route.js.map +7 -0
- package/dist/modules/ai_assistant/api/ai/actions/[id]/route.js +101 -0
- package/dist/modules/ai_assistant/api/ai/actions/[id]/route.js.map +7 -0
- package/dist/modules/ai_assistant/api/ai/agents/[agentId]/mutation-policy/route.js +311 -0
- package/dist/modules/ai_assistant/api/ai/agents/[agentId]/mutation-policy/route.js.map +7 -0
- package/dist/modules/ai_assistant/api/ai/agents/[agentId]/prompt-override/route.js +246 -0
- package/dist/modules/ai_assistant/api/ai/agents/[agentId]/prompt-override/route.js.map +7 -0
- package/dist/modules/ai_assistant/api/ai/agents/route.js +94 -0
- package/dist/modules/ai_assistant/api/ai/agents/route.js.map +7 -0
- package/dist/modules/ai_assistant/api/ai/chat/route.js +173 -0
- package/dist/modules/ai_assistant/api/ai/chat/route.js.map +7 -0
- package/dist/modules/ai_assistant/api/ai/run-object/route.js +167 -0
- package/dist/modules/ai_assistant/api/ai/run-object/route.js.map +7 -0
- package/dist/modules/ai_assistant/backend/config/ai-assistant/agents/AiAgentSettingsPageClient.js +1111 -0
- package/dist/modules/ai_assistant/backend/config/ai-assistant/agents/AiAgentSettingsPageClient.js.map +7 -0
- package/dist/modules/ai_assistant/backend/config/ai-assistant/agents/page.js +10 -0
- package/dist/modules/ai_assistant/backend/config/ai-assistant/agents/page.js.map +7 -0
- package/dist/modules/ai_assistant/backend/config/ai-assistant/agents/page.meta.js +28 -0
- package/dist/modules/ai_assistant/backend/config/ai-assistant/agents/page.meta.js.map +7 -0
- package/dist/modules/ai_assistant/backend/config/ai-assistant/legacy/page.js +10 -0
- package/dist/modules/ai_assistant/backend/config/ai-assistant/legacy/page.js.map +7 -0
- package/dist/modules/ai_assistant/backend/config/ai-assistant/legacy/page.meta.js +30 -0
- package/dist/modules/ai_assistant/backend/config/ai-assistant/legacy/page.meta.js.map +7 -0
- package/dist/modules/ai_assistant/backend/config/ai-assistant/page.js +4 -6
- package/dist/modules/ai_assistant/backend/config/ai-assistant/page.js.map +2 -2
- package/dist/modules/ai_assistant/backend/config/ai-assistant/page.meta.js +1 -21
- package/dist/modules/ai_assistant/backend/config/ai-assistant/page.meta.js.map +2 -2
- package/dist/modules/ai_assistant/backend/config/ai-assistant/playground/AiPlaygroundPageClient.js +462 -0
- package/dist/modules/ai_assistant/backend/config/ai-assistant/playground/AiPlaygroundPageClient.js.map +7 -0
- package/dist/modules/ai_assistant/backend/config/ai-assistant/playground/page.js +10 -0
- package/dist/modules/ai_assistant/backend/config/ai-assistant/playground/page.js.map +7 -0
- package/dist/modules/ai_assistant/backend/config/ai-assistant/playground/page.meta.js +28 -0
- package/dist/modules/ai_assistant/backend/config/ai-assistant/playground/page.meta.js.map +7 -0
- package/dist/modules/ai_assistant/cli.js +78 -12
- package/dist/modules/ai_assistant/cli.js.map +2 -2
- package/dist/modules/ai_assistant/data/entities/AiAgentMutationPolicyOverride.js +5 -0
- package/dist/modules/ai_assistant/data/entities/AiAgentMutationPolicyOverride.js.map +7 -0
- package/dist/modules/ai_assistant/data/entities/AiAgentPromptOverride.js +5 -0
- package/dist/modules/ai_assistant/data/entities/AiAgentPromptOverride.js.map +7 -0
- package/dist/modules/ai_assistant/data/entities/AiPendingAction.js +5 -0
- package/dist/modules/ai_assistant/data/entities/AiPendingAction.js.map +7 -0
- package/dist/modules/ai_assistant/data/entities.js +228 -0
- package/dist/modules/ai_assistant/data/entities.js.map +7 -0
- package/dist/modules/ai_assistant/data/repositories/AiAgentMutationPolicyOverrideRepository.js +95 -0
- package/dist/modules/ai_assistant/data/repositories/AiAgentMutationPolicyOverrideRepository.js.map +7 -0
- package/dist/modules/ai_assistant/data/repositories/AiAgentPromptOverrideRepository.js +95 -0
- package/dist/modules/ai_assistant/data/repositories/AiAgentPromptOverrideRepository.js.map +7 -0
- package/dist/modules/ai_assistant/data/repositories/AiPendingActionRepository.js +223 -0
- package/dist/modules/ai_assistant/data/repositories/AiPendingActionRepository.js.map +7 -0
- package/dist/modules/ai_assistant/events.js +33 -0
- package/dist/modules/ai_assistant/events.js.map +7 -0
- package/dist/modules/ai_assistant/i18n/de.json +252 -0
- package/dist/modules/ai_assistant/i18n/en.json +252 -0
- package/dist/modules/ai_assistant/i18n/es.json +252 -0
- package/dist/modules/ai_assistant/i18n/pl.json +252 -0
- package/dist/modules/ai_assistant/lib/agent-policy.js +168 -0
- package/dist/modules/ai_assistant/lib/agent-policy.js.map +7 -0
- package/dist/modules/ai_assistant/lib/agent-registry.js +195 -0
- package/dist/modules/ai_assistant/lib/agent-registry.js.map +7 -0
- package/dist/modules/ai_assistant/lib/agent-runtime.js +451 -0
- package/dist/modules/ai_assistant/lib/agent-runtime.js.map +7 -0
- package/dist/modules/ai_assistant/lib/agent-tools.js +223 -0
- package/dist/modules/ai_assistant/lib/agent-tools.js.map +7 -0
- package/dist/modules/ai_assistant/lib/agent-transport.js +25 -0
- package/dist/modules/ai_assistant/lib/agent-transport.js.map +7 -0
- package/dist/modules/ai_assistant/lib/ai-agent-definition.js +11 -0
- package/dist/modules/ai_assistant/lib/ai-agent-definition.js.map +7 -0
- package/dist/modules/ai_assistant/lib/ai-agents-generated.d.js +1 -0
- package/dist/modules/ai_assistant/lib/ai-agents-generated.d.js.map +7 -0
- package/dist/modules/ai_assistant/lib/ai-api-operation-runner.js +239 -0
- package/dist/modules/ai_assistant/lib/ai-api-operation-runner.js.map +7 -0
- package/dist/modules/ai_assistant/lib/ai-overrides.js +189 -0
- package/dist/modules/ai_assistant/lib/ai-overrides.js.map +7 -0
- package/dist/modules/ai_assistant/lib/ai-tool-definition.js +7 -0
- package/dist/modules/ai_assistant/lib/ai-tool-definition.js.map +7 -0
- package/dist/modules/ai_assistant/lib/ai-tools-generated.d.js +1 -0
- package/dist/modules/ai_assistant/lib/ai-tools-generated.d.js.map +7 -0
- package/dist/modules/ai_assistant/lib/api-backed-tool.js +48 -0
- package/dist/modules/ai_assistant/lib/api-backed-tool.js.map +7 -0
- package/dist/modules/ai_assistant/lib/attachment-bridge-types.js +1 -0
- package/dist/modules/ai_assistant/lib/attachment-bridge-types.js.map +7 -0
- package/dist/modules/ai_assistant/lib/attachment-parts.js +276 -0
- package/dist/modules/ai_assistant/lib/attachment-parts.js.map +7 -0
- package/dist/modules/ai_assistant/lib/model-factory.js +68 -0
- package/dist/modules/ai_assistant/lib/model-factory.js.map +7 -0
- package/dist/modules/ai_assistant/lib/pending-action-cancel.js +86 -0
- package/dist/modules/ai_assistant/lib/pending-action-cancel.js.map +7 -0
- package/dist/modules/ai_assistant/lib/pending-action-client.js +35 -0
- package/dist/modules/ai_assistant/lib/pending-action-client.js.map +7 -0
- package/dist/modules/ai_assistant/lib/pending-action-executor.js +243 -0
- package/dist/modules/ai_assistant/lib/pending-action-executor.js.map +7 -0
- package/dist/modules/ai_assistant/lib/pending-action-recheck.js +246 -0
- package/dist/modules/ai_assistant/lib/pending-action-recheck.js.map +7 -0
- package/dist/modules/ai_assistant/lib/pending-action-types.js +70 -0
- package/dist/modules/ai_assistant/lib/pending-action-types.js.map +7 -0
- package/dist/modules/ai_assistant/lib/prepare-mutation.js +315 -0
- package/dist/modules/ai_assistant/lib/prepare-mutation.js.map +7 -0
- package/dist/modules/ai_assistant/lib/prompt-composition-types.js +7 -0
- package/dist/modules/ai_assistant/lib/prompt-composition-types.js.map +7 -0
- package/dist/modules/ai_assistant/lib/prompt-override-merge.js +175 -0
- package/dist/modules/ai_assistant/lib/prompt-override-merge.js.map +7 -0
- package/dist/modules/ai_assistant/lib/schema-utils.js +5 -1
- package/dist/modules/ai_assistant/lib/schema-utils.js.map +2 -2
- package/dist/modules/ai_assistant/lib/tool-executor.js +13 -2
- package/dist/modules/ai_assistant/lib/tool-executor.js.map +2 -2
- package/dist/modules/ai_assistant/lib/tool-loader.js +86 -11
- package/dist/modules/ai_assistant/lib/tool-loader.js.map +2 -2
- package/dist/modules/ai_assistant/lib/tool-test-fixtures.js +120 -0
- package/dist/modules/ai_assistant/lib/tool-test-fixtures.js.map +7 -0
- package/dist/modules/ai_assistant/lib/tool-test-runner.js +418 -0
- package/dist/modules/ai_assistant/lib/tool-test-runner.js.map +7 -0
- package/dist/modules/ai_assistant/migrations/Migration20260419100521.js +17 -0
- package/dist/modules/ai_assistant/migrations/Migration20260419100521.js.map +7 -0
- package/dist/modules/ai_assistant/migrations/Migration20260419132948.js +16 -0
- package/dist/modules/ai_assistant/migrations/Migration20260419132948.js.map +7 -0
- package/dist/modules/ai_assistant/migrations/Migration20260419134235.js +17 -0
- package/dist/modules/ai_assistant/migrations/Migration20260419134235.js.map +7 -0
- package/dist/modules/ai_assistant/setup.js +36 -0
- package/dist/modules/ai_assistant/setup.js.map +2 -2
- package/dist/modules/ai_assistant/workers/ai-pending-action-cleanup.js +161 -0
- package/dist/modules/ai_assistant/workers/ai-pending-action-cleanup.js.map +7 -0
- package/generated/entities/ai_agent_mutation_policy_override/index.ts +9 -0
- package/generated/entities/ai_agent_prompt_override/index.ts +10 -0
- package/generated/entities/ai_pending_action/index.ts +24 -0
- package/generated/entities.ids.generated.ts +13 -0
- package/generated/entity-fields-registry.ts +57 -0
- package/jest.config.cjs +7 -0
- package/package.json +4 -4
- package/src/index.ts +215 -0
- package/src/modules/ai_assistant/__integration__/README.md +5 -0
- package/src/modules/ai_assistant/__integration__/TC-AI-002-agent-policy.spec.ts +115 -0
- package/src/modules/ai_assistant/__integration__/TC-AI-AGENT-SETTINGS-005-settings-page.spec.ts +574 -0
- package/src/modules/ai_assistant/__integration__/TC-AI-PLAYGROUND-004-playground.spec.ts +333 -0
- package/src/modules/ai_assistant/__integration__/TC-INT-AI-TOOLS.spec.ts +135 -0
- package/src/modules/ai_assistant/__tests__/events.test.ts +145 -0
- package/src/modules/ai_assistant/__tests__/integration/pending-action-contract.test.ts +1015 -0
- package/src/modules/ai_assistant/__tests__/integration/ws-c-attachment-bridge.test.ts +235 -0
- package/src/modules/ai_assistant/__tests__/integration/ws-c-policy-and-tools.test.ts +330 -0
- package/src/modules/ai_assistant/__tests__/integration/ws-c-tool-pack-coverage.test.ts +285 -0
- package/src/modules/ai_assistant/ai-tools/__tests__/attachments-pack.test.ts +322 -0
- package/src/modules/ai_assistant/ai-tools/__tests__/meta-pack.test.ts +218 -0
- package/src/modules/ai_assistant/ai-tools/__tests__/search-pack.test.ts +192 -0
- package/src/modules/ai_assistant/ai-tools/attachments-pack.ts +269 -0
- package/src/modules/ai_assistant/ai-tools/meta-pack.ts +140 -0
- package/src/modules/ai_assistant/ai-tools/search-pack.ts +122 -0
- package/src/modules/ai_assistant/ai-tools.ts +21 -0
- package/src/modules/ai_assistant/api/ai/actions/[id]/__tests__/route.test.ts +222 -0
- package/src/modules/ai_assistant/api/ai/actions/[id]/cancel/__tests__/route.test.ts +286 -0
- package/src/modules/ai_assistant/api/ai/actions/[id]/cancel/route.ts +237 -0
- package/src/modules/ai_assistant/api/ai/actions/[id]/confirm/__tests__/route.test.ts +339 -0
- package/src/modules/ai_assistant/api/ai/actions/[id]/confirm/route.ts +229 -0
- package/src/modules/ai_assistant/api/ai/actions/[id]/route.ts +142 -0
- package/src/modules/ai_assistant/api/ai/agents/[agentId]/mutation-policy/__tests__/route.test.ts +367 -0
- package/src/modules/ai_assistant/api/ai/agents/[agentId]/mutation-policy/route.ts +380 -0
- package/src/modules/ai_assistant/api/ai/agents/[agentId]/prompt-override/__tests__/route.test.ts +333 -0
- package/src/modules/ai_assistant/api/ai/agents/[agentId]/prompt-override/route.ts +307 -0
- package/src/modules/ai_assistant/api/ai/agents/route.ts +107 -0
- package/src/modules/ai_assistant/api/ai/chat/__tests__/route.test.ts +282 -0
- package/src/modules/ai_assistant/api/ai/chat/route.ts +207 -0
- package/src/modules/ai_assistant/api/ai/run-object/__tests__/route.test.ts +282 -0
- package/src/modules/ai_assistant/api/ai/run-object/route.ts +204 -0
- package/src/modules/ai_assistant/backend/config/ai-assistant/agents/AiAgentSettingsPageClient.tsx +1419 -0
- package/src/modules/ai_assistant/backend/config/ai-assistant/agents/page.meta.ts +26 -0
- package/src/modules/ai_assistant/backend/config/ai-assistant/agents/page.tsx +12 -0
- package/src/modules/ai_assistant/backend/config/ai-assistant/legacy/page.meta.ts +28 -0
- package/src/modules/ai_assistant/backend/config/ai-assistant/legacy/page.tsx +12 -0
- package/src/modules/ai_assistant/backend/config/ai-assistant/page.meta.ts +8 -23
- package/src/modules/ai_assistant/backend/config/ai-assistant/page.tsx +15 -10
- package/src/modules/ai_assistant/backend/config/ai-assistant/playground/AiPlaygroundPageClient.tsx +604 -0
- package/src/modules/ai_assistant/backend/config/ai-assistant/playground/page.meta.ts +26 -0
- package/src/modules/ai_assistant/backend/config/ai-assistant/playground/page.tsx +12 -0
- package/src/modules/ai_assistant/cli.ts +99 -24
- package/src/modules/ai_assistant/data/__tests__/schema-unique-indexes.test.ts +69 -0
- package/src/modules/ai_assistant/data/entities/AiAgentMutationPolicyOverride.ts +7 -0
- package/src/modules/ai_assistant/data/entities/AiAgentPromptOverride.ts +7 -0
- package/src/modules/ai_assistant/data/entities/AiPendingAction.ts +7 -0
- package/src/modules/ai_assistant/data/entities.ts +270 -0
- package/src/modules/ai_assistant/data/repositories/AiAgentMutationPolicyOverrideRepository.ts +129 -0
- package/src/modules/ai_assistant/data/repositories/AiAgentPromptOverrideRepository.ts +132 -0
- package/src/modules/ai_assistant/data/repositories/AiPendingActionRepository.ts +334 -0
- package/src/modules/ai_assistant/data/repositories/__tests__/AiAgentMutationPolicyOverrideRepository.test.ts +195 -0
- package/src/modules/ai_assistant/data/repositories/__tests__/AiAgentPromptOverrideRepository.test.ts +197 -0
- package/src/modules/ai_assistant/data/repositories/__tests__/AiPendingActionRepository.test.ts +357 -0
- package/src/modules/ai_assistant/events.ts +112 -0
- package/src/modules/ai_assistant/i18n/de.json +252 -0
- package/src/modules/ai_assistant/i18n/en.json +252 -0
- package/src/modules/ai_assistant/i18n/es.json +252 -0
- package/src/modules/ai_assistant/i18n/pl.json +252 -0
- package/src/modules/ai_assistant/lib/__tests__/agent-policy.mutation-override.test.ts +203 -0
- package/src/modules/ai_assistant/lib/__tests__/agent-policy.test.ts +385 -0
- package/src/modules/ai_assistant/lib/__tests__/agent-registry.test.ts +217 -0
- package/src/modules/ai_assistant/lib/__tests__/agent-runtime-object.test.ts +329 -0
- package/src/modules/ai_assistant/lib/__tests__/agent-runtime-parity.test.ts +573 -0
- package/src/modules/ai_assistant/lib/__tests__/agent-runtime.test.ts +291 -0
- package/src/modules/ai_assistant/lib/__tests__/agent-tools.test.ts +172 -0
- package/src/modules/ai_assistant/lib/__tests__/agent-transport.test.ts +41 -0
- package/src/modules/ai_assistant/lib/__tests__/ai-agent-definition.test.ts +183 -0
- package/src/modules/ai_assistant/lib/__tests__/ai-api-operation-runner.test.ts +432 -0
- package/src/modules/ai_assistant/lib/__tests__/ai-overrides.test.ts +308 -0
- package/src/modules/ai_assistant/lib/__tests__/api-backed-tool.test.ts +302 -0
- package/src/modules/ai_assistant/lib/__tests__/attachment-bridge-and-prompt-types.test.ts +188 -0
- package/src/modules/ai_assistant/lib/__tests__/attachment-parts.test.ts +531 -0
- package/src/modules/ai_assistant/lib/__tests__/max-steps-budget.integration.test.ts +263 -0
- package/src/modules/ai_assistant/lib/__tests__/model-factory.integration.test.ts +183 -0
- package/src/modules/ai_assistant/lib/__tests__/model-factory.test.ts +168 -0
- package/src/modules/ai_assistant/lib/__tests__/pending-action-cancel.test.ts +235 -0
- package/src/modules/ai_assistant/lib/__tests__/pending-action-client.test.ts +148 -0
- package/src/modules/ai_assistant/lib/__tests__/pending-action-executor.test.ts +348 -0
- package/src/modules/ai_assistant/lib/__tests__/pending-action-recheck.test.ts +378 -0
- package/src/modules/ai_assistant/lib/__tests__/phase-0-additive-contract.test.ts +299 -0
- package/src/modules/ai_assistant/lib/__tests__/prepare-mutation.test.ts +610 -0
- package/src/modules/ai_assistant/lib/__tests__/prompt-override-merge.test.ts +136 -0
- package/src/modules/ai_assistant/lib/__tests__/tool-loader.test.ts +125 -0
- package/src/modules/ai_assistant/lib/agent-policy.ts +270 -0
- package/src/modules/ai_assistant/lib/agent-registry.ts +277 -0
- package/src/modules/ai_assistant/lib/agent-runtime.ts +751 -0
- package/src/modules/ai_assistant/lib/agent-tools.ts +396 -0
- package/src/modules/ai_assistant/lib/agent-transport.ts +51 -0
- package/src/modules/ai_assistant/lib/ai-agent-definition.ts +86 -0
- package/src/modules/ai_assistant/lib/ai-agents-generated.d.ts +18 -0
- package/src/modules/ai_assistant/lib/ai-api-operation-runner.ts +333 -0
- package/src/modules/ai_assistant/lib/ai-overrides.ts +389 -0
- package/src/modules/ai_assistant/lib/ai-tool-definition.ts +7 -0
- package/src/modules/ai_assistant/lib/ai-tools-generated.d.ts +7 -0
- package/src/modules/ai_assistant/lib/api-backed-tool.ts +85 -0
- package/src/modules/ai_assistant/lib/attachment-bridge-types.ts +24 -0
- package/src/modules/ai_assistant/lib/attachment-parts.ts +433 -0
- package/src/modules/ai_assistant/lib/model-factory.ts +212 -0
- package/src/modules/ai_assistant/lib/pending-action-cancel.ts +179 -0
- package/src/modules/ai_assistant/lib/pending-action-client.ts +126 -0
- package/src/modules/ai_assistant/lib/pending-action-executor.ts +424 -0
- package/src/modules/ai_assistant/lib/pending-action-recheck.ts +410 -0
- package/src/modules/ai_assistant/lib/pending-action-types.ts +194 -0
- package/src/modules/ai_assistant/lib/prepare-mutation.ts +448 -0
- package/src/modules/ai_assistant/lib/prompt-composition-types.ts +24 -0
- package/src/modules/ai_assistant/lib/prompt-override-merge.ts +253 -0
- package/src/modules/ai_assistant/lib/schema-utils.ts +14 -2
- package/src/modules/ai_assistant/lib/tool-executor.ts +25 -3
- package/src/modules/ai_assistant/lib/tool-loader.ts +159 -13
- package/src/modules/ai_assistant/lib/tool-test-fixtures.ts +160 -0
- package/src/modules/ai_assistant/lib/tool-test-runner.ts +596 -0
- package/src/modules/ai_assistant/lib/types.ts +105 -2
- package/src/modules/ai_assistant/migrations/.snapshot-open-mercato.json +871 -0
- package/src/modules/ai_assistant/migrations/Migration20260419100521.ts +17 -0
- package/src/modules/ai_assistant/migrations/Migration20260419132948.ts +16 -0
- package/src/modules/ai_assistant/migrations/Migration20260419134235.ts +17 -0
- package/src/modules/ai_assistant/setup.ts +53 -0
- package/src/modules/ai_assistant/workers/__tests__/ai-pending-action-cleanup.test.ts +333 -0
- package/src/modules/ai_assistant/workers/ai-pending-action-cleanup.ts +269 -0
package/dist/modules/ai_assistant/backend/config/ai-assistant/playground/AiPlaygroundPageClient.js
ADDED
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { useQuery } from "@tanstack/react-query";
|
|
5
|
+
import { AlertCircle, Bot, BookOpen, Loader2, Play, RefreshCcw } from "lucide-react";
|
|
6
|
+
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
7
|
+
import { Alert, AlertDescription, AlertTitle } from "@open-mercato/ui/primitives/alert";
|
|
8
|
+
import { Button } from "@open-mercato/ui/primitives/button";
|
|
9
|
+
import { IconButton } from "@open-mercato/ui/primitives/icon-button";
|
|
10
|
+
import { Label } from "@open-mercato/ui/primitives/label";
|
|
11
|
+
import { Switch } from "@open-mercato/ui/primitives/switch";
|
|
12
|
+
import { Tabs, TabsList, TabsTrigger, TabsContent } from "@open-mercato/ui/primitives/tabs";
|
|
13
|
+
import { Textarea } from "@open-mercato/ui/primitives/textarea";
|
|
14
|
+
import { EmptyState } from "@open-mercato/ui/backend/EmptyState";
|
|
15
|
+
import { apiCall, apiCallOrThrow } from "@open-mercato/ui/backend/utils/apiCall";
|
|
16
|
+
import { AiChat, createAiUiPartRegistry, useAiShortcuts } from "@open-mercato/ui/ai";
|
|
17
|
+
async function fetchAgents() {
|
|
18
|
+
const { result, status } = await apiCallOrThrow(
|
|
19
|
+
"/api/ai_assistant/ai/agents",
|
|
20
|
+
{ method: "GET", credentials: "include" },
|
|
21
|
+
{ errorMessage: "Failed to load agents" }
|
|
22
|
+
);
|
|
23
|
+
if (!result) throw new Error(`Failed to load agents (${status})`);
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
26
|
+
function PlaygroundLoading({ message }) {
|
|
27
|
+
return /* @__PURE__ */ jsxs(
|
|
28
|
+
"div",
|
|
29
|
+
{
|
|
30
|
+
className: "flex items-center gap-2 rounded-lg border border-border bg-background p-4 text-sm text-muted-foreground",
|
|
31
|
+
role: "status",
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ jsx(Loader2, { className: "size-4 animate-spin", "aria-hidden": true }),
|
|
34
|
+
/* @__PURE__ */ jsx("span", { children: message })
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
function PlaygroundNoAgents() {
|
|
40
|
+
const t = useT();
|
|
41
|
+
return /* @__PURE__ */ jsx(
|
|
42
|
+
EmptyState,
|
|
43
|
+
{
|
|
44
|
+
icon: /* @__PURE__ */ jsx(Bot, { className: "size-6", "aria-hidden": true }),
|
|
45
|
+
title: t(
|
|
46
|
+
"ai_assistant.playground.empty.title",
|
|
47
|
+
"No AI agents are registered for your role yet."
|
|
48
|
+
),
|
|
49
|
+
description: t(
|
|
50
|
+
"ai_assistant.playground.empty.description",
|
|
51
|
+
"Declare agents inside `packages/<module>/src/modules/<module>/ai-agents.ts`, run `yarn generate`, and ensure the caller holds the agent's required features."
|
|
52
|
+
),
|
|
53
|
+
children: /* @__PURE__ */ jsxs("div", { className: "mt-2 inline-flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
54
|
+
/* @__PURE__ */ jsx(BookOpen, { className: "size-3", "aria-hidden": true }),
|
|
55
|
+
/* @__PURE__ */ jsx("span", { children: t(
|
|
56
|
+
"ai_assistant.playground.empty.docLabel",
|
|
57
|
+
"See packages/ai-assistant/AGENTS.md for the agent definition reference."
|
|
58
|
+
) })
|
|
59
|
+
] })
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
function AgentDetails({ agent }) {
|
|
64
|
+
const t = useT();
|
|
65
|
+
return /* @__PURE__ */ jsxs("div", { className: "rounded-md border border-border bg-muted/30 p-3 text-sm", children: [
|
|
66
|
+
/* @__PURE__ */ jsx("div", { className: "font-semibold", children: agent.label }),
|
|
67
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: agent.description }),
|
|
68
|
+
/* @__PURE__ */ jsxs("dl", { className: "mt-3 grid grid-cols-2 gap-2 text-xs", children: [
|
|
69
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
70
|
+
/* @__PURE__ */ jsx("dt", { className: "font-medium text-muted-foreground", children: t("ai_assistant.playground.meta.module", "Module") }),
|
|
71
|
+
/* @__PURE__ */ jsx("dd", { className: "font-mono", children: agent.moduleId })
|
|
72
|
+
] }),
|
|
73
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
74
|
+
/* @__PURE__ */ jsx("dt", { className: "font-medium text-muted-foreground", children: t("ai_assistant.playground.meta.executionMode", "Execution mode") }),
|
|
75
|
+
/* @__PURE__ */ jsx("dd", { className: "font-mono", children: agent.executionMode })
|
|
76
|
+
] }),
|
|
77
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
78
|
+
/* @__PURE__ */ jsx("dt", { className: "font-medium text-muted-foreground", children: t("ai_assistant.playground.meta.mutationPolicy", "Mutation policy") }),
|
|
79
|
+
/* @__PURE__ */ jsx("dd", { className: "font-mono", children: agent.mutationPolicy })
|
|
80
|
+
] }),
|
|
81
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
82
|
+
/* @__PURE__ */ jsx("dt", { className: "font-medium text-muted-foreground", children: t("ai_assistant.playground.meta.tools", "Allowed tools") }),
|
|
83
|
+
/* @__PURE__ */ jsx("dd", { className: "font-mono", children: agent.allowedTools.length })
|
|
84
|
+
] })
|
|
85
|
+
] })
|
|
86
|
+
] });
|
|
87
|
+
}
|
|
88
|
+
function buildDebugTools(agent) {
|
|
89
|
+
if (agent.tools && agent.tools.length > 0) {
|
|
90
|
+
return agent.tools.map((tool) => ({
|
|
91
|
+
name: tool.name,
|
|
92
|
+
displayName: tool.displayName ?? tool.name,
|
|
93
|
+
isMutation: Boolean(tool.isMutation),
|
|
94
|
+
requiredFeatures: tool.requiredFeatures ?? []
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
97
|
+
return agent.allowedTools.map((toolName) => ({ name: toolName }));
|
|
98
|
+
}
|
|
99
|
+
function buildDebugPromptSections(agent) {
|
|
100
|
+
const sections = [];
|
|
101
|
+
if (agent.systemPrompt) {
|
|
102
|
+
sections.push({ id: "role", source: "default", text: agent.systemPrompt });
|
|
103
|
+
}
|
|
104
|
+
const placeholderIds = [
|
|
105
|
+
"scope",
|
|
106
|
+
"data",
|
|
107
|
+
"tools",
|
|
108
|
+
"attachments",
|
|
109
|
+
"mutationPolicy",
|
|
110
|
+
"responseStyle",
|
|
111
|
+
"overrides"
|
|
112
|
+
];
|
|
113
|
+
for (const id of placeholderIds) {
|
|
114
|
+
sections.push({ id, source: "placeholder" });
|
|
115
|
+
}
|
|
116
|
+
return sections;
|
|
117
|
+
}
|
|
118
|
+
function readPlaygroundUiPartSeeds() {
|
|
119
|
+
if (typeof window === "undefined") return [];
|
|
120
|
+
try {
|
|
121
|
+
const params = new URLSearchParams(window.location.search);
|
|
122
|
+
const componentId = params.get("uiPart");
|
|
123
|
+
if (!componentId) return [];
|
|
124
|
+
const pendingActionId = params.get("pendingActionId") ?? void 0;
|
|
125
|
+
return [{ componentId, pendingActionId }];
|
|
126
|
+
} catch {
|
|
127
|
+
return [];
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function ChatLane({ agent, debug }) {
|
|
131
|
+
const t = useT();
|
|
132
|
+
const registry = React.useMemo(
|
|
133
|
+
() => createAiUiPartRegistry({ seedLiveApprovalCards: true }),
|
|
134
|
+
[]
|
|
135
|
+
);
|
|
136
|
+
const debugTools = React.useMemo(() => buildDebugTools(agent), [agent]);
|
|
137
|
+
const debugPromptSections = React.useMemo(
|
|
138
|
+
() => buildDebugPromptSections(agent),
|
|
139
|
+
[agent]
|
|
140
|
+
);
|
|
141
|
+
const [uiParts, setUiParts] = React.useState([]);
|
|
142
|
+
React.useEffect(() => {
|
|
143
|
+
const seeds = readPlaygroundUiPartSeeds();
|
|
144
|
+
if (seeds.length > 0) setUiParts(seeds);
|
|
145
|
+
}, []);
|
|
146
|
+
if (agent.executionMode !== "chat") {
|
|
147
|
+
return /* @__PURE__ */ jsxs(Alert, { variant: "info", "data-ai-playground-unsupported": "chat", children: [
|
|
148
|
+
/* @__PURE__ */ jsx(AlertTitle, { children: t(
|
|
149
|
+
"ai_assistant.playground.chat.notSupportedTitle",
|
|
150
|
+
"Chat mode is not available for this agent."
|
|
151
|
+
) }),
|
|
152
|
+
/* @__PURE__ */ jsx(AlertDescription, { children: t(
|
|
153
|
+
"ai_assistant.playground.chat.notSupportedBody",
|
|
154
|
+
'Pick an agent whose execution mode is "chat", or switch to the object-mode tab.'
|
|
155
|
+
) })
|
|
156
|
+
] });
|
|
157
|
+
}
|
|
158
|
+
return /* @__PURE__ */ jsx(
|
|
159
|
+
AiChat,
|
|
160
|
+
{
|
|
161
|
+
agent: agent.id,
|
|
162
|
+
pageContext: { source: "playground", pageId: "ai_assistant.playground" },
|
|
163
|
+
debug,
|
|
164
|
+
registry,
|
|
165
|
+
className: "min-h-[360px]",
|
|
166
|
+
debugTools,
|
|
167
|
+
debugPromptSections,
|
|
168
|
+
uiParts
|
|
169
|
+
},
|
|
170
|
+
agent.id
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
function ObjectLane({ agent }) {
|
|
174
|
+
const t = useT();
|
|
175
|
+
const [prompt, setPrompt] = React.useState("");
|
|
176
|
+
const [isRunning, setIsRunning] = React.useState(false);
|
|
177
|
+
const [result, setResult] = React.useState(null);
|
|
178
|
+
const [error, setError] = React.useState(null);
|
|
179
|
+
const [lastRequest, setLastRequest] = React.useState(null);
|
|
180
|
+
const isSupported = agent.executionMode === "object";
|
|
181
|
+
const canRun = isSupported && prompt.trim().length > 0 && !isRunning;
|
|
182
|
+
const runObject = React.useCallback(async () => {
|
|
183
|
+
if (!canRun) return;
|
|
184
|
+
const body = {
|
|
185
|
+
agent: agent.id,
|
|
186
|
+
messages: [{ role: "user", content: prompt }],
|
|
187
|
+
pageContext: { source: "playground", pageId: "ai_assistant.playground" }
|
|
188
|
+
};
|
|
189
|
+
setLastRequest(body);
|
|
190
|
+
setIsRunning(true);
|
|
191
|
+
setResult(null);
|
|
192
|
+
setError(null);
|
|
193
|
+
try {
|
|
194
|
+
const { ok, status, result: result2 } = await apiCall(
|
|
195
|
+
"/api/ai_assistant/ai/run-object",
|
|
196
|
+
{
|
|
197
|
+
method: "POST",
|
|
198
|
+
headers: { "content-type": "application/json" },
|
|
199
|
+
credentials: "include",
|
|
200
|
+
body: JSON.stringify(body)
|
|
201
|
+
}
|
|
202
|
+
);
|
|
203
|
+
if (!ok) {
|
|
204
|
+
const payload = result2 ?? { error: `HTTP ${status}` };
|
|
205
|
+
setError(payload);
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
setResult(result2 ?? { object: null });
|
|
209
|
+
} catch (err) {
|
|
210
|
+
setError({
|
|
211
|
+
error: err instanceof Error ? err.message : String(err),
|
|
212
|
+
code: "network_error"
|
|
213
|
+
});
|
|
214
|
+
} finally {
|
|
215
|
+
setIsRunning(false);
|
|
216
|
+
}
|
|
217
|
+
}, [agent.id, canRun, prompt]);
|
|
218
|
+
const { handleKeyDown } = useAiShortcuts({
|
|
219
|
+
onSubmit: () => {
|
|
220
|
+
void runObject();
|
|
221
|
+
},
|
|
222
|
+
onCancel: () => {
|
|
223
|
+
setError(null);
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
if (!isSupported) {
|
|
227
|
+
return /* @__PURE__ */ jsxs(Alert, { variant: "info", "data-ai-playground-unsupported": "object", children: [
|
|
228
|
+
/* @__PURE__ */ jsx(AlertTitle, { children: t(
|
|
229
|
+
"ai_assistant.playground.object.notSupportedTitle",
|
|
230
|
+
"Object mode is not available for this agent."
|
|
231
|
+
) }),
|
|
232
|
+
/* @__PURE__ */ jsx(AlertDescription, { children: t(
|
|
233
|
+
"ai_assistant.playground.object.notSupportedBody",
|
|
234
|
+
'This agent declares executionMode = "chat". Pick an object-mode agent to preview structured output, or switch to the chat tab.'
|
|
235
|
+
) })
|
|
236
|
+
] });
|
|
237
|
+
}
|
|
238
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", "data-ai-playground-object": true, children: [
|
|
239
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
240
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "ai-playground-object-input", children: t("ai_assistant.playground.object.inputLabel", "Prompt") }),
|
|
241
|
+
/* @__PURE__ */ jsx(
|
|
242
|
+
Textarea,
|
|
243
|
+
{
|
|
244
|
+
id: "ai-playground-object-input",
|
|
245
|
+
rows: 4,
|
|
246
|
+
value: prompt,
|
|
247
|
+
placeholder: t(
|
|
248
|
+
"ai_assistant.playground.object.inputPlaceholder",
|
|
249
|
+
"Describe what the agent should produce..."
|
|
250
|
+
),
|
|
251
|
+
onChange: (event) => setPrompt(event.target.value),
|
|
252
|
+
onKeyDown: handleKeyDown,
|
|
253
|
+
className: "resize-none",
|
|
254
|
+
"aria-label": t("ai_assistant.playground.object.inputLabel", "Prompt")
|
|
255
|
+
}
|
|
256
|
+
),
|
|
257
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
258
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t(
|
|
259
|
+
"ai_assistant.playground.object.shortcutHint",
|
|
260
|
+
"Press Cmd/Ctrl+Enter to run."
|
|
261
|
+
) }),
|
|
262
|
+
/* @__PURE__ */ jsxs(
|
|
263
|
+
Button,
|
|
264
|
+
{
|
|
265
|
+
type: "button",
|
|
266
|
+
size: "sm",
|
|
267
|
+
onClick: () => void runObject(),
|
|
268
|
+
disabled: !canRun,
|
|
269
|
+
"data-ai-playground-object-run": true,
|
|
270
|
+
children: [
|
|
271
|
+
isRunning ? /* @__PURE__ */ jsx(Loader2, { className: "size-4 animate-spin", "aria-hidden": true }) : /* @__PURE__ */ jsx(Play, { className: "size-4", "aria-hidden": true }),
|
|
272
|
+
/* @__PURE__ */ jsx("span", { children: t("ai_assistant.playground.object.run", "Run object") })
|
|
273
|
+
]
|
|
274
|
+
}
|
|
275
|
+
)
|
|
276
|
+
] })
|
|
277
|
+
] }),
|
|
278
|
+
error ? /* @__PURE__ */ jsxs(Alert, { variant: "destructive", "data-ai-playground-object-error": error.code ?? "unknown", children: [
|
|
279
|
+
/* @__PURE__ */ jsx(AlertTitle, { children: t("ai_assistant.playground.object.errorTitle", "Object run failed") }),
|
|
280
|
+
/* @__PURE__ */ jsxs(AlertDescription, { children: [
|
|
281
|
+
error.code ? /* @__PURE__ */ jsx("span", { className: "mr-2 font-mono text-xs", children: error.code }) : null,
|
|
282
|
+
error.error
|
|
283
|
+
] })
|
|
284
|
+
] }) : null,
|
|
285
|
+
result ? /* @__PURE__ */ jsxs(
|
|
286
|
+
"section",
|
|
287
|
+
{
|
|
288
|
+
className: "rounded-md border border-border bg-muted/30 p-3",
|
|
289
|
+
"data-ai-playground-object-result": true,
|
|
290
|
+
children: [
|
|
291
|
+
/* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold", children: t("ai_assistant.playground.object.resultTitle", "Generated object") }),
|
|
292
|
+
/* @__PURE__ */ jsx("pre", { className: "mt-2 max-h-96 overflow-auto rounded bg-background p-2 text-xs font-mono", children: JSON.stringify(result.object, null, 2) }),
|
|
293
|
+
result.usage || result.finishReason ? /* @__PURE__ */ jsxs("dl", { className: "mt-3 grid grid-cols-3 gap-2 text-xs", children: [
|
|
294
|
+
result.finishReason ? /* @__PURE__ */ jsxs("div", { children: [
|
|
295
|
+
/* @__PURE__ */ jsx("dt", { className: "text-muted-foreground", children: t("ai_assistant.playground.object.finishReason", "Finish reason") }),
|
|
296
|
+
/* @__PURE__ */ jsx("dd", { className: "font-mono", children: result.finishReason })
|
|
297
|
+
] }) : null,
|
|
298
|
+
result.usage?.inputTokens !== void 0 ? /* @__PURE__ */ jsxs("div", { children: [
|
|
299
|
+
/* @__PURE__ */ jsx("dt", { className: "text-muted-foreground", children: t("ai_assistant.playground.object.inputTokens", "Input tokens") }),
|
|
300
|
+
/* @__PURE__ */ jsx("dd", { className: "font-mono", children: result.usage.inputTokens })
|
|
301
|
+
] }) : null,
|
|
302
|
+
result.usage?.outputTokens !== void 0 ? /* @__PURE__ */ jsxs("div", { children: [
|
|
303
|
+
/* @__PURE__ */ jsx("dt", { className: "text-muted-foreground", children: t("ai_assistant.playground.object.outputTokens", "Output tokens") }),
|
|
304
|
+
/* @__PURE__ */ jsx("dd", { className: "font-mono", children: result.usage.outputTokens })
|
|
305
|
+
] }) : null
|
|
306
|
+
] }) : null
|
|
307
|
+
]
|
|
308
|
+
}
|
|
309
|
+
) : null,
|
|
310
|
+
lastRequest && (error || result) ? /* @__PURE__ */ jsxs(
|
|
311
|
+
"details",
|
|
312
|
+
{
|
|
313
|
+
className: "rounded-md border border-border bg-muted/20 p-2 text-xs",
|
|
314
|
+
"data-ai-playground-object-debug": true,
|
|
315
|
+
children: [
|
|
316
|
+
/* @__PURE__ */ jsx("summary", { className: "cursor-pointer font-semibold", children: t("ai_assistant.playground.object.debugTitle", "Last request payload") }),
|
|
317
|
+
/* @__PURE__ */ jsx("pre", { className: "mt-2 max-h-64 overflow-auto whitespace-pre-wrap font-mono", children: JSON.stringify(lastRequest, null, 2) })
|
|
318
|
+
]
|
|
319
|
+
}
|
|
320
|
+
) : null
|
|
321
|
+
] });
|
|
322
|
+
}
|
|
323
|
+
function AiPlaygroundPageClient() {
|
|
324
|
+
const t = useT();
|
|
325
|
+
const [selectedAgentId, setSelectedAgentId] = React.useState(null);
|
|
326
|
+
const [debugEnabled, setDebugEnabled] = React.useState(false);
|
|
327
|
+
const [tab, setTab] = React.useState("chat");
|
|
328
|
+
const { data, isLoading, isError, error, refetch, isFetching } = useQuery({
|
|
329
|
+
queryKey: ["ai_assistant", "playground", "agents"],
|
|
330
|
+
queryFn: fetchAgents
|
|
331
|
+
});
|
|
332
|
+
const agents = React.useMemo(() => data?.agents ?? [], [data]);
|
|
333
|
+
React.useEffect(() => {
|
|
334
|
+
if (!agents.length) {
|
|
335
|
+
if (selectedAgentId !== null) setSelectedAgentId(null);
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
if (!selectedAgentId || !agents.some((agent) => agent.id === selectedAgentId)) {
|
|
339
|
+
setSelectedAgentId(agents[0].id);
|
|
340
|
+
}
|
|
341
|
+
}, [agents, selectedAgentId]);
|
|
342
|
+
const selectedAgent = React.useMemo(() => {
|
|
343
|
+
if (!selectedAgentId) return null;
|
|
344
|
+
return agents.find((agent) => agent.id === selectedAgentId) ?? null;
|
|
345
|
+
}, [agents, selectedAgentId]);
|
|
346
|
+
if (isLoading) {
|
|
347
|
+
return /* @__PURE__ */ jsx(
|
|
348
|
+
PlaygroundLoading,
|
|
349
|
+
{
|
|
350
|
+
message: t("ai_assistant.playground.loadingAgents", "Loading AI agents...")
|
|
351
|
+
}
|
|
352
|
+
);
|
|
353
|
+
}
|
|
354
|
+
if (isError) {
|
|
355
|
+
return /* @__PURE__ */ jsxs(Alert, { variant: "destructive", "data-ai-playground-error": true, children: [
|
|
356
|
+
/* @__PURE__ */ jsx(AlertCircle, { className: "size-4", "aria-hidden": true }),
|
|
357
|
+
/* @__PURE__ */ jsx(AlertTitle, { children: t("ai_assistant.playground.loadErrorTitle", "Failed to load AI agents") }),
|
|
358
|
+
/* @__PURE__ */ jsxs(AlertDescription, { children: [
|
|
359
|
+
/* @__PURE__ */ jsx("span", { children: error instanceof Error ? error.message : String(error) }),
|
|
360
|
+
/* @__PURE__ */ jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsxs(
|
|
361
|
+
Button,
|
|
362
|
+
{
|
|
363
|
+
type: "button",
|
|
364
|
+
size: "sm",
|
|
365
|
+
variant: "outline",
|
|
366
|
+
onClick: () => {
|
|
367
|
+
void refetch();
|
|
368
|
+
},
|
|
369
|
+
children: [
|
|
370
|
+
/* @__PURE__ */ jsx(RefreshCcw, { className: "size-4", "aria-hidden": true }),
|
|
371
|
+
/* @__PURE__ */ jsx("span", { children: t("ai_assistant.playground.retry", "Retry") })
|
|
372
|
+
]
|
|
373
|
+
}
|
|
374
|
+
) })
|
|
375
|
+
] })
|
|
376
|
+
] });
|
|
377
|
+
}
|
|
378
|
+
if (!agents.length) {
|
|
379
|
+
return /* @__PURE__ */ jsx(PlaygroundNoAgents, {});
|
|
380
|
+
}
|
|
381
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", "data-ai-playground": true, children: [
|
|
382
|
+
/* @__PURE__ */ jsxs("header", { className: "flex flex-col gap-1", children: [
|
|
383
|
+
/* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold tracking-tight", children: t("ai_assistant.playground.title", "AI Playground") }),
|
|
384
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t(
|
|
385
|
+
"ai_assistant.playground.subtitle",
|
|
386
|
+
"Exercise every registered AI agent end-to-end. Use the debug panel to inspect request and response payloads, and the object-mode tab to preview structured output."
|
|
387
|
+
) })
|
|
388
|
+
] }),
|
|
389
|
+
/* @__PURE__ */ jsxs("section", { className: "flex flex-col gap-3 rounded-lg border border-border bg-background p-3", children: [
|
|
390
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between", children: [
|
|
391
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 sm:flex-1", children: [
|
|
392
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "ai-playground-agent-picker", children: t("ai_assistant.playground.agentPickerLabel", "Agent") }),
|
|
393
|
+
/* @__PURE__ */ jsx(
|
|
394
|
+
"select",
|
|
395
|
+
{
|
|
396
|
+
id: "ai-playground-agent-picker",
|
|
397
|
+
"data-ai-playground-agent-picker": true,
|
|
398
|
+
className: "h-9 rounded-md border border-input bg-background px-3 text-sm",
|
|
399
|
+
value: selectedAgentId ?? "",
|
|
400
|
+
onChange: (event) => setSelectedAgentId(event.target.value),
|
|
401
|
+
children: agents.map((agent) => /* @__PURE__ */ jsxs("option", { value: agent.id, children: [
|
|
402
|
+
agent.label,
|
|
403
|
+
" (",
|
|
404
|
+
agent.id,
|
|
405
|
+
")"
|
|
406
|
+
] }, agent.id))
|
|
407
|
+
}
|
|
408
|
+
)
|
|
409
|
+
] }),
|
|
410
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 sm:flex-shrink-0", children: [
|
|
411
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "ai-playground-debug", className: "text-sm", children: t("ai_assistant.playground.debugToggle", "Debug panel") }),
|
|
412
|
+
/* @__PURE__ */ jsx(
|
|
413
|
+
Switch,
|
|
414
|
+
{
|
|
415
|
+
id: "ai-playground-debug",
|
|
416
|
+
checked: debugEnabled,
|
|
417
|
+
onCheckedChange: (next) => setDebugEnabled(next),
|
|
418
|
+
"aria-label": t("ai_assistant.playground.debugToggle", "Debug panel"),
|
|
419
|
+
"data-ai-playground-debug-toggle": true
|
|
420
|
+
}
|
|
421
|
+
),
|
|
422
|
+
/* @__PURE__ */ jsx(
|
|
423
|
+
IconButton,
|
|
424
|
+
{
|
|
425
|
+
type: "button",
|
|
426
|
+
variant: "ghost",
|
|
427
|
+
size: "sm",
|
|
428
|
+
onClick: () => {
|
|
429
|
+
void refetch();
|
|
430
|
+
},
|
|
431
|
+
"aria-label": t("ai_assistant.playground.refresh", "Refresh agents"),
|
|
432
|
+
disabled: isFetching,
|
|
433
|
+
children: /* @__PURE__ */ jsx(RefreshCcw, { className: "size-4", "aria-hidden": true })
|
|
434
|
+
}
|
|
435
|
+
)
|
|
436
|
+
] })
|
|
437
|
+
] }),
|
|
438
|
+
selectedAgent ? /* @__PURE__ */ jsx(AgentDetails, { agent: selectedAgent }) : null
|
|
439
|
+
] }),
|
|
440
|
+
selectedAgent ? /* @__PURE__ */ jsxs(
|
|
441
|
+
Tabs,
|
|
442
|
+
{
|
|
443
|
+
value: tab,
|
|
444
|
+
onValueChange: (next) => setTab(next === "object" ? "object" : "chat"),
|
|
445
|
+
children: [
|
|
446
|
+
/* @__PURE__ */ jsxs(TabsList, { children: [
|
|
447
|
+
/* @__PURE__ */ jsx(TabsTrigger, { value: "chat", children: t("ai_assistant.playground.tabs.chat", "Chat") }),
|
|
448
|
+
/* @__PURE__ */ jsx(TabsTrigger, { value: "object", children: t("ai_assistant.playground.tabs.object", "Object mode") })
|
|
449
|
+
] }),
|
|
450
|
+
/* @__PURE__ */ jsx(TabsContent, { value: "chat", children: /* @__PURE__ */ jsx(ChatLane, { agent: selectedAgent, debug: debugEnabled }) }),
|
|
451
|
+
/* @__PURE__ */ jsx(TabsContent, { value: "object", children: /* @__PURE__ */ jsx(ObjectLane, { agent: selectedAgent }) })
|
|
452
|
+
]
|
|
453
|
+
}
|
|
454
|
+
) : null
|
|
455
|
+
] });
|
|
456
|
+
}
|
|
457
|
+
var AiPlaygroundPageClient_default = AiPlaygroundPageClient;
|
|
458
|
+
export {
|
|
459
|
+
AiPlaygroundPageClient,
|
|
460
|
+
AiPlaygroundPageClient_default as default
|
|
461
|
+
};
|
|
462
|
+
//# sourceMappingURL=AiPlaygroundPageClient.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../src/modules/ai_assistant/backend/config/ai-assistant/playground/AiPlaygroundPageClient.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { useQuery } from '@tanstack/react-query'\nimport { AlertCircle, Bot, BookOpen, Loader2, Play, RefreshCcw } from 'lucide-react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { Alert, AlertDescription, AlertTitle } from '@open-mercato/ui/primitives/alert'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { IconButton } from '@open-mercato/ui/primitives/icon-button'\nimport { Label } from '@open-mercato/ui/primitives/label'\nimport { Switch } from '@open-mercato/ui/primitives/switch'\nimport { Tabs, TabsList, TabsTrigger, TabsContent } from '@open-mercato/ui/primitives/tabs'\nimport { Textarea } from '@open-mercato/ui/primitives/textarea'\nimport { EmptyState } from '@open-mercato/ui/backend/EmptyState'\nimport { apiCall, apiCallOrThrow } from '@open-mercato/ui/backend/utils/apiCall'\nimport { AiChat, createAiUiPartRegistry, useAiShortcuts } from '@open-mercato/ui/ai'\nimport type { AiChatDebugPromptSection, AiChatDebugTool } from '@open-mercato/ui/ai'\n\ntype PlaygroundAgentTool = {\n name: string\n displayName?: string\n isMutation?: boolean\n registered?: boolean\n requiredFeatures?: string[]\n}\n\ntype PlaygroundAgent = {\n id: string\n moduleId: string\n label: string\n description: string\n executionMode: 'chat' | 'object'\n mutationPolicy: string\n allowedTools: string[]\n requiredFeatures: string[]\n acceptedMediaTypes: string[]\n hasOutputSchema: boolean\n systemPrompt?: string\n readOnly?: boolean\n maxSteps?: number | null\n tools?: PlaygroundAgentTool[]\n}\n\ntype AgentsResponse = {\n agents: PlaygroundAgent[]\n total: number\n}\n\ntype RunObjectResponse = {\n object: unknown\n finishReason?: string\n usage?: { inputTokens?: number; outputTokens?: number }\n}\n\ntype RunObjectError = {\n error: string\n code?: string\n issues?: unknown\n}\n\nasync function fetchAgents(): Promise<AgentsResponse> {\n const { result, status } = await apiCallOrThrow<AgentsResponse>(\n '/api/ai_assistant/ai/agents',\n { method: 'GET', credentials: 'include' },\n { errorMessage: 'Failed to load agents' },\n )\n if (!result) throw new Error(`Failed to load agents (${status})`)\n return result\n}\n\nfunction PlaygroundLoading({ message }: { message: string }) {\n return (\n <div\n className=\"flex items-center gap-2 rounded-lg border border-border bg-background p-4 text-sm text-muted-foreground\"\n role=\"status\"\n >\n <Loader2 className=\"size-4 animate-spin\" aria-hidden />\n <span>{message}</span>\n </div>\n )\n}\n\nfunction PlaygroundNoAgents() {\n const t = useT()\n return (\n <EmptyState\n icon={<Bot className=\"size-6\" aria-hidden />}\n title={t(\n 'ai_assistant.playground.empty.title',\n 'No AI agents are registered for your role yet.',\n )}\n description={t(\n 'ai_assistant.playground.empty.description',\n 'Declare agents inside `packages/<module>/src/modules/<module>/ai-agents.ts`, run `yarn generate`, and ensure the caller holds the agent\\'s required features.',\n )}\n >\n <div className=\"mt-2 inline-flex items-center gap-2 text-xs text-muted-foreground\">\n <BookOpen className=\"size-3\" aria-hidden />\n <span>\n {t(\n 'ai_assistant.playground.empty.docLabel',\n 'See packages/ai-assistant/AGENTS.md for the agent definition reference.',\n )}\n </span>\n </div>\n </EmptyState>\n )\n}\n\nfunction AgentDetails({ agent }: { agent: PlaygroundAgent }) {\n const t = useT()\n return (\n <div className=\"rounded-md border border-border bg-muted/30 p-3 text-sm\">\n <div className=\"font-semibold\">{agent.label}</div>\n <p className=\"mt-1 text-xs text-muted-foreground\">{agent.description}</p>\n <dl className=\"mt-3 grid grid-cols-2 gap-2 text-xs\">\n <div>\n <dt className=\"font-medium text-muted-foreground\">\n {t('ai_assistant.playground.meta.module', 'Module')}\n </dt>\n <dd className=\"font-mono\">{agent.moduleId}</dd>\n </div>\n <div>\n <dt className=\"font-medium text-muted-foreground\">\n {t('ai_assistant.playground.meta.executionMode', 'Execution mode')}\n </dt>\n <dd className=\"font-mono\">{agent.executionMode}</dd>\n </div>\n <div>\n <dt className=\"font-medium text-muted-foreground\">\n {t('ai_assistant.playground.meta.mutationPolicy', 'Mutation policy')}\n </dt>\n <dd className=\"font-mono\">{agent.mutationPolicy}</dd>\n </div>\n <div>\n <dt className=\"font-medium text-muted-foreground\">\n {t('ai_assistant.playground.meta.tools', 'Allowed tools')}\n </dt>\n <dd className=\"font-mono\">{agent.allowedTools.length}</dd>\n </div>\n </dl>\n </div>\n )\n}\n\nfunction buildDebugTools(agent: PlaygroundAgent): AiChatDebugTool[] {\n if (agent.tools && agent.tools.length > 0) {\n return agent.tools.map((tool) => ({\n name: tool.name,\n displayName: tool.displayName ?? tool.name,\n isMutation: Boolean(tool.isMutation),\n requiredFeatures: tool.requiredFeatures ?? [],\n }))\n }\n return agent.allowedTools.map((toolName) => ({ name: toolName }))\n}\n\nfunction buildDebugPromptSections(agent: PlaygroundAgent): AiChatDebugPromptSection[] {\n const sections: AiChatDebugPromptSection[] = []\n if (agent.systemPrompt) {\n sections.push({ id: 'role', source: 'default', text: agent.systemPrompt })\n }\n const placeholderIds = [\n 'scope',\n 'data',\n 'tools',\n 'attachments',\n 'mutationPolicy',\n 'responseStyle',\n 'overrides',\n ] as const\n for (const id of placeholderIds) {\n sections.push({ id, source: 'placeholder' })\n }\n return sections\n}\n\ntype PlaygroundUiPartSeed = {\n componentId: string\n pendingActionId?: string\n payload?: unknown\n}\n\nfunction readPlaygroundUiPartSeeds(): PlaygroundUiPartSeed[] {\n if (typeof window === 'undefined') return []\n try {\n const params = new URLSearchParams(window.location.search)\n const componentId = params.get('uiPart')\n if (!componentId) return []\n const pendingActionId = params.get('pendingActionId') ?? undefined\n return [{ componentId, pendingActionId }]\n } catch {\n return []\n }\n}\n\nfunction ChatLane({ agent, debug }: { agent: PlaygroundAgent; debug: boolean }) {\n const t = useT()\n // Scoped registry so repeated mounts do not share state with other pages.\n // Step 5.10: opt in to the LIVE mutation-approval cards so the playground\n // exercises the real cards when the chat response surfaces a pending\n // action (via the `?uiPart=...` debug seed for Playwright).\n const registry = React.useMemo(\n () => createAiUiPartRegistry({ seedLiveApprovalCards: true }),\n [],\n )\n const debugTools = React.useMemo(() => buildDebugTools(agent), [agent])\n const debugPromptSections = React.useMemo(\n () => buildDebugPromptSections(agent),\n [agent],\n )\n const [uiParts, setUiParts] = React.useState<PlaygroundUiPartSeed[]>([])\n\n // Step 5.10: the dispatcher does not yet surface `AiUiPart` entries through\n // the plain-text stream consumed by `useAiChat`. For now the playground\n // reads a `?uiPart=<componentId>&pendingActionId=...` seed from the URL\n // so Playwright + operator debug flows can render the approval cards\n // against a stubbed `/api/ai_assistant/ai/actions/:id` endpoint. When the\n // dispatcher switches to the UIMessageChunk format this effect swaps over\n // to the streamed `uiParts` payload.\n React.useEffect(() => {\n const seeds = readPlaygroundUiPartSeeds()\n if (seeds.length > 0) setUiParts(seeds)\n }, [])\n\n if (agent.executionMode !== 'chat') {\n return (\n <Alert variant=\"info\" data-ai-playground-unsupported=\"chat\">\n <AlertTitle>\n {t(\n 'ai_assistant.playground.chat.notSupportedTitle',\n 'Chat mode is not available for this agent.',\n )}\n </AlertTitle>\n <AlertDescription>\n {t(\n 'ai_assistant.playground.chat.notSupportedBody',\n 'Pick an agent whose execution mode is \"chat\", or switch to the object-mode tab.',\n )}\n </AlertDescription>\n </Alert>\n )\n }\n\n return (\n <AiChat\n key={agent.id}\n agent={agent.id}\n pageContext={{ source: 'playground', pageId: 'ai_assistant.playground' }}\n debug={debug}\n registry={registry}\n className=\"min-h-[360px]\"\n debugTools={debugTools}\n debugPromptSections={debugPromptSections}\n uiParts={uiParts}\n />\n )\n}\n\nfunction ObjectLane({ agent }: { agent: PlaygroundAgent }) {\n const t = useT()\n const [prompt, setPrompt] = React.useState('')\n const [isRunning, setIsRunning] = React.useState(false)\n const [result, setResult] = React.useState<RunObjectResponse | null>(null)\n const [error, setError] = React.useState<RunObjectError | null>(null)\n const [lastRequest, setLastRequest] = React.useState<unknown>(null)\n\n const isSupported = agent.executionMode === 'object'\n const canRun = isSupported && prompt.trim().length > 0 && !isRunning\n\n const runObject = React.useCallback(async () => {\n if (!canRun) return\n const body = {\n agent: agent.id,\n messages: [{ role: 'user' as const, content: prompt }],\n pageContext: { source: 'playground', pageId: 'ai_assistant.playground' },\n }\n setLastRequest(body)\n setIsRunning(true)\n setResult(null)\n setError(null)\n try {\n const { ok, status, result } = await apiCall<RunObjectResponse | RunObjectError>(\n '/api/ai_assistant/ai/run-object',\n {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n credentials: 'include',\n body: JSON.stringify(body),\n },\n )\n if (!ok) {\n const payload = (result as RunObjectError | null) ?? { error: `HTTP ${status}` }\n setError(payload)\n return\n }\n setResult((result as RunObjectResponse | null) ?? { object: null })\n } catch (err) {\n setError({\n error: err instanceof Error ? err.message : String(err),\n code: 'network_error',\n })\n } finally {\n setIsRunning(false)\n }\n }, [agent.id, canRun, prompt])\n\n const { handleKeyDown } = useAiShortcuts({\n onSubmit: () => {\n void runObject()\n },\n onCancel: () => {\n setError(null)\n },\n })\n\n if (!isSupported) {\n return (\n <Alert variant=\"info\" data-ai-playground-unsupported=\"object\">\n <AlertTitle>\n {t(\n 'ai_assistant.playground.object.notSupportedTitle',\n 'Object mode is not available for this agent.',\n )}\n </AlertTitle>\n <AlertDescription>\n {t(\n 'ai_assistant.playground.object.notSupportedBody',\n 'This agent declares executionMode = \"chat\". Pick an object-mode agent to preview structured output, or switch to the chat tab.',\n )}\n </AlertDescription>\n </Alert>\n )\n }\n\n return (\n <div className=\"flex flex-col gap-3\" data-ai-playground-object>\n <div className=\"flex flex-col gap-2\">\n <Label htmlFor=\"ai-playground-object-input\">\n {t('ai_assistant.playground.object.inputLabel', 'Prompt')}\n </Label>\n <Textarea\n id=\"ai-playground-object-input\"\n rows={4}\n value={prompt}\n placeholder={t(\n 'ai_assistant.playground.object.inputPlaceholder',\n 'Describe what the agent should produce...',\n )}\n onChange={(event) => setPrompt(event.target.value)}\n onKeyDown={handleKeyDown}\n className=\"resize-none\"\n aria-label={t('ai_assistant.playground.object.inputLabel', 'Prompt')}\n />\n <div className=\"flex items-center justify-between\">\n <p className=\"text-xs text-muted-foreground\">\n {t(\n 'ai_assistant.playground.object.shortcutHint',\n 'Press Cmd/Ctrl+Enter to run.',\n )}\n </p>\n <Button\n type=\"button\"\n size=\"sm\"\n onClick={() => void runObject()}\n disabled={!canRun}\n data-ai-playground-object-run\n >\n {isRunning ? (\n <Loader2 className=\"size-4 animate-spin\" aria-hidden />\n ) : (\n <Play className=\"size-4\" aria-hidden />\n )}\n <span>{t('ai_assistant.playground.object.run', 'Run object')}</span>\n </Button>\n </div>\n </div>\n\n {error ? (\n <Alert variant=\"destructive\" data-ai-playground-object-error={error.code ?? 'unknown'}>\n <AlertTitle>\n {t('ai_assistant.playground.object.errorTitle', 'Object run failed')}\n </AlertTitle>\n <AlertDescription>\n {error.code ? <span className=\"mr-2 font-mono text-xs\">{error.code}</span> : null}\n {error.error}\n </AlertDescription>\n </Alert>\n ) : null}\n\n {result ? (\n <section\n className=\"rounded-md border border-border bg-muted/30 p-3\"\n data-ai-playground-object-result\n >\n <h3 className=\"text-sm font-semibold\">\n {t('ai_assistant.playground.object.resultTitle', 'Generated object')}\n </h3>\n <pre className=\"mt-2 max-h-96 overflow-auto rounded bg-background p-2 text-xs font-mono\">\n {JSON.stringify(result.object, null, 2)}\n </pre>\n {result.usage || result.finishReason ? (\n <dl className=\"mt-3 grid grid-cols-3 gap-2 text-xs\">\n {result.finishReason ? (\n <div>\n <dt className=\"text-muted-foreground\">\n {t('ai_assistant.playground.object.finishReason', 'Finish reason')}\n </dt>\n <dd className=\"font-mono\">{result.finishReason}</dd>\n </div>\n ) : null}\n {result.usage?.inputTokens !== undefined ? (\n <div>\n <dt className=\"text-muted-foreground\">\n {t('ai_assistant.playground.object.inputTokens', 'Input tokens')}\n </dt>\n <dd className=\"font-mono\">{result.usage.inputTokens}</dd>\n </div>\n ) : null}\n {result.usage?.outputTokens !== undefined ? (\n <div>\n <dt className=\"text-muted-foreground\">\n {t('ai_assistant.playground.object.outputTokens', 'Output tokens')}\n </dt>\n <dd className=\"font-mono\">{result.usage.outputTokens}</dd>\n </div>\n ) : null}\n </dl>\n ) : null}\n </section>\n ) : null}\n\n {lastRequest && (error || result) ? (\n <details\n className=\"rounded-md border border-border bg-muted/20 p-2 text-xs\"\n data-ai-playground-object-debug\n >\n <summary className=\"cursor-pointer font-semibold\">\n {t('ai_assistant.playground.object.debugTitle', 'Last request payload')}\n </summary>\n <pre className=\"mt-2 max-h-64 overflow-auto whitespace-pre-wrap font-mono\">\n {JSON.stringify(lastRequest, null, 2)}\n </pre>\n </details>\n ) : null}\n </div>\n )\n}\n\nexport function AiPlaygroundPageClient() {\n const t = useT()\n const [selectedAgentId, setSelectedAgentId] = React.useState<string | null>(null)\n const [debugEnabled, setDebugEnabled] = React.useState(false)\n const [tab, setTab] = React.useState<'chat' | 'object'>('chat')\n\n const { data, isLoading, isError, error, refetch, isFetching } = useQuery<AgentsResponse>({\n queryKey: ['ai_assistant', 'playground', 'agents'],\n queryFn: fetchAgents,\n })\n\n const agents = React.useMemo<PlaygroundAgent[]>(() => data?.agents ?? [], [data])\n\n React.useEffect(() => {\n if (!agents.length) {\n if (selectedAgentId !== null) setSelectedAgentId(null)\n return\n }\n if (!selectedAgentId || !agents.some((agent) => agent.id === selectedAgentId)) {\n setSelectedAgentId(agents[0].id)\n }\n }, [agents, selectedAgentId])\n\n const selectedAgent = React.useMemo<PlaygroundAgent | null>(() => {\n if (!selectedAgentId) return null\n return agents.find((agent) => agent.id === selectedAgentId) ?? null\n }, [agents, selectedAgentId])\n\n if (isLoading) {\n return (\n <PlaygroundLoading\n message={t('ai_assistant.playground.loadingAgents', 'Loading AI agents...')}\n />\n )\n }\n\n if (isError) {\n return (\n <Alert variant=\"destructive\" data-ai-playground-error>\n <AlertCircle className=\"size-4\" aria-hidden />\n <AlertTitle>\n {t('ai_assistant.playground.loadErrorTitle', 'Failed to load AI agents')}\n </AlertTitle>\n <AlertDescription>\n <span>{error instanceof Error ? error.message : String(error)}</span>\n <div className=\"mt-2\">\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n onClick={() => {\n void refetch()\n }}\n >\n <RefreshCcw className=\"size-4\" aria-hidden />\n <span>{t('ai_assistant.playground.retry', 'Retry')}</span>\n </Button>\n </div>\n </AlertDescription>\n </Alert>\n )\n }\n\n if (!agents.length) {\n return <PlaygroundNoAgents />\n }\n\n return (\n <div className=\"flex flex-col gap-4\" data-ai-playground>\n <header className=\"flex flex-col gap-1\">\n <h1 className=\"text-2xl font-bold tracking-tight\">\n {t('ai_assistant.playground.title', 'AI Playground')}\n </h1>\n <p className=\"text-sm text-muted-foreground\">\n {t(\n 'ai_assistant.playground.subtitle',\n 'Exercise every registered AI agent end-to-end. Use the debug panel to inspect request and response payloads, and the object-mode tab to preview structured output.',\n )}\n </p>\n </header>\n\n <section className=\"flex flex-col gap-3 rounded-lg border border-border bg-background p-3\">\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between\">\n <div className=\"flex flex-col gap-2 sm:flex-1\">\n <Label htmlFor=\"ai-playground-agent-picker\">\n {t('ai_assistant.playground.agentPickerLabel', 'Agent')}\n </Label>\n <select\n id=\"ai-playground-agent-picker\"\n data-ai-playground-agent-picker\n className=\"h-9 rounded-md border border-input bg-background px-3 text-sm\"\n value={selectedAgentId ?? ''}\n onChange={(event) => setSelectedAgentId(event.target.value)}\n >\n {agents.map((agent) => (\n <option key={agent.id} value={agent.id}>\n {agent.label} ({agent.id})\n </option>\n ))}\n </select>\n </div>\n <div className=\"flex items-center gap-3 sm:flex-shrink-0\">\n <Label htmlFor=\"ai-playground-debug\" className=\"text-sm\">\n {t('ai_assistant.playground.debugToggle', 'Debug panel')}\n </Label>\n <Switch\n id=\"ai-playground-debug\"\n checked={debugEnabled}\n onCheckedChange={(next: boolean) => setDebugEnabled(next)}\n aria-label={t('ai_assistant.playground.debugToggle', 'Debug panel')}\n data-ai-playground-debug-toggle\n />\n <IconButton\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => {\n void refetch()\n }}\n aria-label={t('ai_assistant.playground.refresh', 'Refresh agents')}\n disabled={isFetching}\n >\n <RefreshCcw className=\"size-4\" aria-hidden />\n </IconButton>\n </div>\n </div>\n {selectedAgent ? <AgentDetails agent={selectedAgent} /> : null}\n </section>\n\n {selectedAgent ? (\n <Tabs\n value={tab}\n onValueChange={(next: string) => setTab(next === 'object' ? 'object' : 'chat')}\n >\n <TabsList>\n <TabsTrigger value=\"chat\">\n {t('ai_assistant.playground.tabs.chat', 'Chat')}\n </TabsTrigger>\n <TabsTrigger value=\"object\">\n {t('ai_assistant.playground.tabs.object', 'Object mode')}\n </TabsTrigger>\n </TabsList>\n <TabsContent value=\"chat\">\n <ChatLane agent={selectedAgent} debug={debugEnabled} />\n </TabsContent>\n <TabsContent value=\"object\">\n <ObjectLane agent={selectedAgent} />\n </TabsContent>\n </Tabs>\n ) : null}\n </div>\n )\n}\n\nexport default AiPlaygroundPageClient\n"],
|
|
5
|
+
"mappings": ";AAwEI,SAIE,KAJF;AAtEJ,YAAY,WAAW;AACvB,SAAS,gBAAgB;AACzB,SAAS,aAAa,KAAK,UAAU,SAAS,MAAM,kBAAkB;AACtE,SAAS,YAAY;AACrB,SAAS,OAAO,kBAAkB,kBAAkB;AACpD,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAC3B,SAAS,aAAa;AACtB,SAAS,cAAc;AACvB,SAAS,MAAM,UAAU,aAAa,mBAAmB;AACzD,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,SAAS,SAAS,sBAAsB;AACxC,SAAS,QAAQ,wBAAwB,sBAAsB;AA6C/D,eAAe,cAAuC;AACpD,QAAM,EAAE,QAAQ,OAAO,IAAI,MAAM;AAAA,IAC/B;AAAA,IACA,EAAE,QAAQ,OAAO,aAAa,UAAU;AAAA,IACxC,EAAE,cAAc,wBAAwB;AAAA,EAC1C;AACA,MAAI,CAAC,OAAQ,OAAM,IAAI,MAAM,0BAA0B,MAAM,GAAG;AAChE,SAAO;AACT;AAEA,SAAS,kBAAkB,EAAE,QAAQ,GAAwB;AAC3D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MACV,MAAK;AAAA,MAEL;AAAA,4BAAC,WAAQ,WAAU,uBAAsB,eAAW,MAAC;AAAA,QACrD,oBAAC,UAAM,mBAAQ;AAAA;AAAA;AAAA,EACjB;AAEJ;AAEA,SAAS,qBAAqB;AAC5B,QAAM,IAAI,KAA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,CAAC,SAAkB,gBAAgB,IAAI;AAAA,cACxD,cAAY,EAAE,uCAAuC,aAAa;AAAA,cAClE,mCAA+B;AAAA;AAAA,UACjC;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,MAAK;AAAA,cACL,SAAQ;AAAA,cACR,MAAK;AAAA,cACL,SAAS,MAAM;AACb,qBAAK,QAAQ;AAAA,cACf;AAAA,cACA,cAAY,EAAE,mCAAmC,gBAAgB;AAAA,cACjE,UAAU;AAAA,cAEV,8BAAC,cAAW,WAAU,UAAS,eAAW,MAAC;AAAA;AAAA,UAC7C;AAAA,WACF;AAAA,SACF;AAAA,MACC,gBAAgB,oBAAC,gBAAa,OAAO,eAAe,IAAK;AAAA,OAC5D;AAAA,IAEC,gBACC;AAAA,MAAC;AAAA;AAAA,QACC,OAAO;AAAA,QACP,eAAe,CAAC,SAAiB,OAAO,SAAS,WAAW,WAAW,MAAM;AAAA,QAE7E;AAAA,+BAAC,YACC;AAAA,gCAAC,eAAY,OAAM,QAChB,YAAE,qCAAqC,MAAM,GAChD;AAAA,YACA,oBAAC,eAAY,OAAM,UAChB,YAAE,uCAAuC,aAAa,GACzD;AAAA,aACF;AAAA,UACA,oBAAC,eAAY,OAAM,QACjB,8BAAC,YAAS,OAAO,eAAe,OAAO,cAAc,GACvD;AAAA,UACA,oBAAC,eAAY,OAAM,UACjB,8BAAC,cAAW,OAAO,eAAe,GACpC;AAAA;AAAA;AAAA,IACF,IACE;AAAA,KACN;AAEJ;AAEA,IAAO,iCAAQ;",
|
|
6
|
+
"names": ["result"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Page, PageBody } from "@open-mercato/ui/backend/Page";
|
|
3
|
+
import { AiPlaygroundPageClient } from "./AiPlaygroundPageClient.js";
|
|
4
|
+
async function AiAssistantPlaygroundPage() {
|
|
5
|
+
return /* @__PURE__ */ jsx(Page, { children: /* @__PURE__ */ jsx(PageBody, { children: /* @__PURE__ */ jsx(AiPlaygroundPageClient, {}) }) });
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
AiAssistantPlaygroundPage as default
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=page.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../src/modules/ai_assistant/backend/config/ai-assistant/playground/page.tsx"],
|
|
4
|
+
"sourcesContent": ["import { Page, PageBody } from '@open-mercato/ui/backend/Page'\nimport { AiPlaygroundPageClient } from './AiPlaygroundPageClient'\n\nexport default async function AiAssistantPlaygroundPage() {\n return (\n <Page>\n <PageBody>\n <AiPlaygroundPageClient />\n </PageBody>\n </Page>\n )\n}\n"],
|
|
5
|
+
"mappings": "AAOQ;AAPR,SAAS,MAAM,gBAAgB;AAC/B,SAAS,8BAA8B;AAEvC,eAAO,4BAAmD;AACxD,SACE,oBAAC,QACC,8BAAC,YACC,8BAAC,0BAAuB,GAC1B,GACF;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
const playgroundIcon = React.createElement(
|
|
3
|
+
"svg",
|
|
4
|
+
{ width: 16, height: 16, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" },
|
|
5
|
+
React.createElement("path", { d: "M14 4h6v6" }),
|
|
6
|
+
React.createElement("path", { d: "M10 20H4v-6" }),
|
|
7
|
+
React.createElement("path", { d: "M20 4 14 10" }),
|
|
8
|
+
React.createElement("path", { d: "m4 20 6-6" })
|
|
9
|
+
);
|
|
10
|
+
const metadata = {
|
|
11
|
+
requireAuth: true,
|
|
12
|
+
requireFeatures: ["ai_assistant.settings.manage"],
|
|
13
|
+
pageTitle: "AI Playground",
|
|
14
|
+
pageTitleKey: "ai_assistant.playground.navTitle",
|
|
15
|
+
pageGroup: "Module Configs",
|
|
16
|
+
pageGroupKey: "settings.sections.moduleConfigs",
|
|
17
|
+
pageOrder: 431,
|
|
18
|
+
icon: playgroundIcon,
|
|
19
|
+
pageContext: "settings",
|
|
20
|
+
breadcrumb: [
|
|
21
|
+
{ label: "AI Agents", labelKey: "ai_assistant.agents.navTitle" },
|
|
22
|
+
{ label: "Playground", labelKey: "ai_assistant.playground.navTitle" }
|
|
23
|
+
]
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
metadata
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=page.meta.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../src/modules/ai_assistant/backend/config/ai-assistant/playground/page.meta.ts"],
|
|
4
|
+
"sourcesContent": ["import React from 'react'\n\nconst playgroundIcon = React.createElement(\n 'svg',\n { width: 16, height: 16, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 2, strokeLinecap: 'round', strokeLinejoin: 'round' },\n React.createElement('path', { d: 'M14 4h6v6' }),\n React.createElement('path', { d: 'M10 20H4v-6' }),\n React.createElement('path', { d: 'M20 4 14 10' }),\n React.createElement('path', { d: 'm4 20 6-6' }),\n)\n\nexport const metadata = {\n requireAuth: true,\n requireFeatures: ['ai_assistant.settings.manage'],\n pageTitle: 'AI Playground',\n pageTitleKey: 'ai_assistant.playground.navTitle',\n pageGroup: 'Module Configs',\n pageGroupKey: 'settings.sections.moduleConfigs',\n pageOrder: 431,\n icon: playgroundIcon,\n pageContext: 'settings' as const,\n breadcrumb: [\n { label: 'AI Agents', labelKey: 'ai_assistant.agents.navTitle' },\n { label: 'Playground', labelKey: 'ai_assistant.playground.navTitle' },\n ],\n} as const\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,WAAW;AAElB,MAAM,iBAAiB,MAAM;AAAA,EAC3B;AAAA,EACA,EAAE,OAAO,IAAI,QAAQ,IAAI,SAAS,aAAa,MAAM,QAAQ,QAAQ,gBAAgB,aAAa,GAAG,eAAe,SAAS,gBAAgB,QAAQ;AAAA,EACrJ,MAAM,cAAc,QAAQ,EAAE,GAAG,YAAY,CAAC;AAAA,EAC9C,MAAM,cAAc,QAAQ,EAAE,GAAG,cAAc,CAAC;AAAA,EAChD,MAAM,cAAc,QAAQ,EAAE,GAAG,cAAc,CAAC;AAAA,EAChD,MAAM,cAAc,QAAQ,EAAE,GAAG,YAAY,CAAC;AAChD;AAEO,MAAM,WAAW;AAAA,EACtB,aAAa;AAAA,EACb,iBAAiB,CAAC,8BAA8B;AAAA,EAChD,WAAW;AAAA,EACX,cAAc;AAAA,EACd,WAAW;AAAA,EACX,cAAc;AAAA,EACd,WAAW;AAAA,EACX,MAAM;AAAA,EACN,aAAa;AAAA,EACb,YAAY;AAAA,IACV,EAAE,OAAO,aAAa,UAAU,+BAA+B;AAAA,IAC/D,EAAE,OAAO,cAAc,UAAU,mCAAmC;AAAA,EACtE;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|