/** * FlowDrop Playground Module * * Provides the Playground feature for interactive workflow testing with * chat interface, session management, and real-time execution logs. * * @module playground * * @example Using mountPlayground for vanilla JS / Drupal / IIFE: * ```typescript * import { mountPlayground, createEndpointConfig } from "@flowdrop/flowdrop/playground"; * * const app = await mountPlayground( * document.getElementById("playground-container"), * { * workflowId: "wf-123", * endpointConfig: createEndpointConfig("/api/flowdrop"), * mode: "standalone" * } * ); * * // Later, to cleanup: * app.destroy(); * ``` * * @example Drupal Behaviors integration: * ```javascript * (function (Drupal, FlowDrop) { * Drupal.behaviors.flowdropPlayground = { * attach: function (context, settings) { * var container = document.getElementById("playground-container"); * if (!container || container.dataset.initialized) return; * container.dataset.initialized = "true"; * * FlowDrop.mountPlayground(container, { * workflowId: settings.flowdrop.workflowId, * endpointConfig: FlowDrop.createEndpointConfig(settings.flowdrop.apiBaseUrl), * mode: "standalone" * }).then(function (app) { * container._flowdropApp = app; * }); * }, * detach: function (context, settings, trigger) { * if (trigger === "unload") { * var container = document.getElementById("playground-container"); * if (container && container._flowdropApp) { * container._flowdropApp.destroy(); * } * } * } * }; * })(Drupal, window.FlowDrop); * ``` * * @example In Svelte (Standalone mode): * ```svelte * * * * ``` * * @example In Svelte (Embedded mode): * ```svelte * * * {#if showPlayground} * showPlayground = false} * /> * {/if} * ``` * * @example In Svelte (Modal mode): * ```svelte * * * showPlayground = false} * /> * ``` * * @example Using mountPlayground with modal mode: * ```typescript * import { mountPlayground, createEndpointConfig } from "@flowdrop/flowdrop/playground"; * * const app = await mountPlayground( * document.getElementById("playground-container"), * { * workflowId: "wf-123", * endpointConfig: createEndpointConfig("/api/flowdrop"), * mode: "modal", * onClose: () => { * app.destroy(); * } * } * ); * ``` */ export { default as Playground } from '../components/playground/Playground.svelte'; export { default as PlaygroundStudio } from '../components/playground/PlaygroundStudio.svelte'; export { default as PlaygroundApp } from '../components/playground/PlaygroundApp.svelte'; export { default as PlaygroundModal } from '../components/playground/PlaygroundModal.svelte'; export { default as ChatPanel } from '../components/playground/ChatPanel.svelte'; export { default as MessageStream } from '../components/playground/MessageStream.svelte'; export { default as ChatInput } from '../components/playground/ChatInput.svelte'; export { default as ExecutionConsole } from '../components/playground/ExecutionConsole.svelte'; export { default as ControlPanel } from '../components/playground/ControlPanel.svelte'; export { default as PipelinePanel } from '../components/playground/PipelinePanel.svelte'; export { default as ExecutionList } from '../components/playground/ExecutionList.svelte'; export { default as SessionManager } from '../components/playground/SessionManager.svelte'; export { default as InputCollector } from '../components/playground/InputCollector.svelte'; export { default as ExecutionLogs } from '../components/playground/ExecutionLogs.svelte'; export { default as MessageBubble } from '../components/playground/MessageBubble.svelte'; export { InterruptBubble, ConfirmationPrompt, ChoicePrompt, TextInputPrompt, FormPrompt, ReviewPrompt } from '../components/interrupt/index.js'; export { PlaygroundService, playgroundService } from '../services/playgroundService.js'; export { InterruptService, interruptService } from '../services/interruptService.js'; export { getCurrentSession, getSessions, getMessages, getIsExecuting, getCanSendMessage, getIsLoading, getError as getPlaygroundError, getCurrentWorkflow, getLastPollSequenceNumber, getSessionStatus, getMessageCount, getChatMessages, getLogMessages, getLatestMessage, getInputFields, getHasChatInput, getSessionCount, getActiveExecutionId, getPinnedExecutionId, getLatestExecutionId, getShowLogs, playgroundActions, applyServerResponse, subscribeToSessionStatus, getCurrentSessionId, isSessionSelected, getMessagesSnapshot, getLatestSequenceNumber } from '../stores/playgroundStore.svelte.js'; export { getPipelinePanelOpen, pipelinePanelActions } from '../stores/pipelinePanelStore.svelte.js'; export type { PlaygroundSession, PlaygroundMessage, PlaygroundInputField, PlaygroundMessageRequest, PlaygroundMessagesResult, PlaygroundConfig, PlaygroundMode, PlaygroundSessionStatus, PlaygroundMessageRole, PlaygroundMessageLevel, PlaygroundMessageMetadata, PlaygroundApiResponse, PlaygroundSessionsResponse, PlaygroundSessionResponse, PlaygroundMessageResponse, PlaygroundMessagesApiResponse, PlaygroundExecution } from '../types/playground.js'; export { isChatInputNode, CHAT_INPUT_PATTERNS, defaultShouldStopPolling, defaultIsTerminalStatus, DEFAULT_STOP_POLLING_STATUSES, DEFAULT_TERMINAL_STATUSES } from '../types/playground.js'; export type { InterruptType, InterruptStatus, Interrupt, InterruptChoice, InterruptConfig, ConfirmationConfig, ChoiceConfig, TextConfig, FormConfig, ReviewConfig, ReviewChange, ReviewFieldDecision, ReviewResolution, InterruptResolution, InterruptApiResponse, InterruptListResponse, InterruptResponse, InterruptMessageMetadata, InterruptPollingConfig } from '../types/interrupt.js'; export { isInterruptMetadata, extractInterruptMetadata, metadataToInterrupt, defaultInterruptPollingConfig } from '../types/interrupt.js'; export { getInterruptsMap, getPendingInterruptIds, getPendingInterrupts, getPendingInterruptCount, getResolvedInterrupts, getIsAnySubmitting, interruptActions, getInterrupt, isInterruptPending, isInterruptSubmitting, getInterruptError, getInterruptByMessageId, interruptHasError } from '../stores/interruptStore.svelte.js'; export type { InterruptWithState } from '../stores/interruptStore.svelte.js'; export { mountPlayground, unmountPlayground, mountPlaygroundStudio, mountPlaygroundApp, type PlaygroundMountOptions, type PlaygroundStudioMountOptions, type PlaygroundAppMountOptions, type MountedPlayground } from './mount.js'; export type { PipelineViewDef, PipelineViewProps } from '../types/index.js'; export { createEndpointConfig, defaultEndpointConfig, buildEndpointUrl, type EndpointConfig } from '../config/endpoints.js';