@agent-native/core 0.22.44 → 0.23.0
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/dist/a2a/artifact-response.js +1 -1
- package/dist/a2a/artifact-response.js.map +1 -1
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +12 -4
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/cli/app-skill.d.ts +139 -0
- package/dist/cli/app-skill.d.ts.map +1 -0
- package/dist/cli/app-skill.js +960 -0
- package/dist/cli/app-skill.js.map +1 -0
- package/dist/cli/create.d.ts.map +1 -1
- package/dist/cli/create.js +13 -4
- package/dist/cli/create.js.map +1 -1
- package/dist/cli/index.js +24 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/skills.d.ts +39 -0
- package/dist/cli/skills.d.ts.map +1 -0
- package/dist/cli/skills.js +363 -0
- package/dist/cli/skills.js.map +1 -0
- package/dist/cli/templates-meta.d.ts.map +1 -1
- package/dist/cli/templates-meta.js +9 -6
- package/dist/cli/templates-meta.js.map +1 -1
- package/dist/cli/workspace-dev.d.ts.map +1 -1
- package/dist/cli/workspace-dev.js +2 -0
- package/dist/cli/workspace-dev.js.map +1 -1
- package/dist/client/AgentPanel.d.ts +2 -0
- package/dist/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +2 -2
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/AssistantChat.d.ts +9 -0
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +15 -7
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
- package/dist/client/MultiTabAssistantChat.js +15 -0
- package/dist/client/MultiTabAssistantChat.js.map +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/use-chat-threads.d.ts +5 -1
- package/dist/client/use-chat-threads.d.ts.map +1 -1
- package/dist/client/use-chat-threads.js +14 -3
- package/dist/client/use-chat-threads.js.map +1 -1
- package/dist/collab/client.d.ts.map +1 -1
- package/dist/collab/client.js +20 -1
- package/dist/collab/client.js.map +1 -1
- package/dist/collab/routes.d.ts.map +1 -1
- package/dist/collab/routes.js +16 -2
- package/dist/collab/routes.js.map +1 -1
- package/dist/collab/storage.d.ts +8 -0
- package/dist/collab/storage.d.ts.map +1 -1
- package/dist/collab/storage.js +55 -7
- package/dist/collab/storage.js.map +1 -1
- package/dist/collab/ydoc-manager.d.ts.map +1 -1
- package/dist/collab/ydoc-manager.js +121 -69
- package/dist/collab/ydoc-manager.js.map +1 -1
- package/dist/deploy/workspace-deploy.js +6 -0
- package/dist/deploy/workspace-deploy.js.map +1 -1
- package/dist/mcp-client/index.d.ts +1 -1
- package/dist/mcp-client/index.d.ts.map +1 -1
- package/dist/mcp-client/index.js +1 -1
- package/dist/mcp-client/index.js.map +1 -1
- package/dist/mcp-client/routes.d.ts +1 -0
- package/dist/mcp-client/routes.d.ts.map +1 -1
- package/dist/mcp-client/routes.js +52 -0
- package/dist/mcp-client/routes.js.map +1 -1
- package/dist/mcp-client/workspace-servers.d.ts +15 -0
- package/dist/mcp-client/workspace-servers.d.ts.map +1 -0
- package/dist/mcp-client/workspace-servers.js +297 -0
- package/dist/mcp-client/workspace-servers.js.map +1 -0
- package/dist/resources/handlers.d.ts.map +1 -1
- package/dist/resources/handlers.js +38 -25
- package/dist/resources/handlers.js.map +1 -1
- package/dist/resources/store.d.ts +11 -3
- package/dist/resources/store.d.ts.map +1 -1
- package/dist/resources/store.js +220 -9
- package/dist/resources/store.js.map +1 -1
- package/dist/scripts/call-agent.js +1 -1
- package/dist/scripts/call-agent.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +21 -6
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-discovery.d.ts.map +1 -1
- package/dist/server/agent-discovery.js +34 -9
- package/dist/server/agent-discovery.js.map +1 -1
- package/dist/server/auth-marketing.d.ts.map +1 -1
- package/dist/server/auth-marketing.js +8 -5
- package/dist/server/auth-marketing.js.map +1 -1
- package/dist/templates/default/AGENTS.md +12 -4
- package/dist/templates/default/DEVELOPING.md +7 -5
- package/dist/templates/workspace-core/AGENTS.md +7 -0
- package/dist/templates/workspace-root/AGENTS.md +6 -0
- package/docs/content/creating-templates.md +14 -9
- package/docs/content/database.md +44 -17
- package/docs/content/deployment.md +15 -7
- package/docs/content/dispatch.md +7 -1
- package/docs/content/embedding-sdk.md +79 -0
- package/docs/content/key-concepts.md +15 -17
- package/docs/content/mcp-clients.md +30 -0
- package/docs/content/multi-app-workspace.md +3 -2
- package/docs/content/multi-tenancy.md +4 -4
- package/docs/content/server.md +10 -7
- package/docs/content/skills-guide.md +75 -0
- package/docs/content/template-analytics.md +1 -1
- package/docs/content/template-assets.md +130 -0
- package/docs/content/template-dispatch.md +3 -2
- package/docs/content/template-slides.md +2 -2
- package/docs/content/workspace-management.md +2 -2
- package/docs/content/workspace.md +11 -9
- package/package.json +1 -1
- package/src/templates/default/AGENTS.md +12 -4
- package/src/templates/default/DEVELOPING.md +7 -5
- package/src/templates/workspace-core/AGENTS.md +7 -0
- package/src/templates/workspace-root/AGENTS.md +6 -0
- package/docs/content/template-images.md +0 -55
package/dist/client/index.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export { createAgentChatAdapter } from "./agent-chat-adapter.js";
|
|
|
40
40
|
export { AgentComposerFrame, type AgentComposerFrameProps, PromptComposer, AGENT_PROMPT_MAX_INLINE_IMAGE_BYTES, AGENT_PROMPT_MAX_INLINE_TEXT_CHARS, escapePromptAttachmentAttribute, formatPromptWithAttachments, isInlineableAgentPromptFile, readAgentPromptAttachment, type PromptComposerProps, type PromptComposerFile, type PromptComposerSubmitOptions, type AgentPromptAttachment, type ReadAgentPromptAttachmentOptions, type AgentComposerLayoutVariant, type SlashCommand, type SkillResult, } from "./composer/index.js";
|
|
41
41
|
export type { TiptapComposerHandle } from "./composer/TiptapComposer.js";
|
|
42
42
|
export { GuidedQuestionFlow, useGuidedQuestionFlow, formatGuidedAnswerValue, formatGuidedAnswersForAgent, getOtherGuidedAnswerText, hasGuidedAnswer, isOtherGuidedAnswer, makeOtherGuidedAnswer, normalizeGuidedAnswers, type GuidedQuestion, type GuidedQuestionAnswers, type GuidedQuestionFlowProps, type GuidedQuestionOption, type GuidedQuestionPayload, type GuidedQuestionType, type UseGuidedQuestionFlowOptions, } from "./guided-questions.js";
|
|
43
|
-
export { useChatThreads, type ChatThreadScope, type ChatThreadSummary, type ChatThreadData, } from "./use-chat-threads.js";
|
|
43
|
+
export { useChatThreads, type ChatThreadScope, type ChatThreadSummary, type ChatThreadData, type UseChatThreadsOptions, } from "./use-chat-threads.js";
|
|
44
44
|
export { AgentChatSurface, AgentPanel, AgentSidebar, AgentToggleButton, focusAgentChat, type AgentChatSurfaceMode, type AgentChatSurfaceProps, type AgentPanelProps, type AgentSidebarProps, } from "./AgentPanel.js";
|
|
45
45
|
export { SIDEBAR_STATE_CHANGE_EVENT, type AgentSidebarStateChangeDetail, type AgentSidebarStateMode, type AgentSidebarStateSource, } from "./agent-sidebar-state.js";
|
|
46
46
|
export { AgentNativeIcon } from "./components/icons/AgentNativeIcon.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,eAAe,EACf,aAAa,EACb,KAAK,gBAAgB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EACL,eAAe,EACf,UAAU,EACV,WAAW,EACX,OAAO,GACR,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,+BAA+B,EAC/B,iBAAiB,EACjB,iBAAiB,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2BAA2B,GACjC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EACL,kBAAkB,EAClB,KAAK,uBAAuB,EAC5B,cAAc,EACd,mCAAmC,EACnC,kCAAkC,EAClC,+BAA+B,EAC/B,2BAA2B,EAC3B,2BAA2B,EAC3B,yBAAyB,EACzB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EAChC,KAAK,qBAAqB,EAC1B,KAAK,gCAAgC,EACrC,KAAK,0BAA0B,EAC/B,KAAK,YAAY,EACjB,KAAK,WAAW,GACjB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,uBAAuB,EACvB,2BAA2B,EAC3B,wBAAwB,EACxB,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,4BAA4B,GAClC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,cAAc,EACd,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,eAAe,EACf,aAAa,EACb,KAAK,gBAAgB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EACL,eAAe,EACf,UAAU,EACV,WAAW,EACX,OAAO,GACR,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,+BAA+B,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KAAK,eAAe,EACpB,KAAK,cAAc,GACpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,KAAK,cAAc,GACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EACL,WAAW,EACX,WAAW,EACX,eAAe,EACf,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,GAC1B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,YAAY,EACZ,cAAc,EACd,2BAA2B,EAC3B,KAAK,oBAAoB,GAC1B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,sBAAsB,EACtB,cAAc,GACf,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,WAAW,EACX,KAAK,gBAAgB,GACtB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,iBAAiB,EACjB,KAAK,sBAAsB,GAC5B,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EACjC,KAAK,2BAA2B,GACjC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,yBAAyB,EAAE,CAAC;AAE5B,OAAO,EACL,eAAe,EACf,aAAa,GAEd,MAAM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,kBAAkB,EAClB,YAAY,EACZ,yBAAyB,EACzB,YAAY,EACZ,0BAA0B,GAS3B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,cAAc,EACd,iBAAiB,GAElB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAA4B,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EACL,WAAW,EACX,WAAW,EACX,eAAe,GAIhB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,YAAY,EACZ,cAAc,EACd,2BAA2B,GAE5B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,sBAAsB,EACtB,cAAc,GACf,MAAM,0BAA0B,CAAC;AAClC,yBAAyB;AACzB,OAAO,EACL,WAAW,GAEZ,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,iBAAiB,GAElB,MAAM,mCAAmC,CAAC;AAC3C,sCAAsC;AACtC,OAAO,EACL,mBAAmB,EACnB,qBAAqB,GAKtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC","sourcesContent":["import { installRouteChunkRecovery } from \"./route-chunk-recovery.js\";\n\ninstallRouteChunkRecovery();\n\nexport {\n sendToAgentChat,\n generateTabId,\n type AgentChatMessage,\n} from \"./agent-chat.js\";\nexport { useAgentChatGenerating } from \"./use-agent-chat.js\";\nexport { useDevMode } from \"./use-dev-mode.js\";\nexport {\n agentNativePath,\n appApiPath,\n appBasePath,\n appPath,\n} from \"./api-path.js\";\nexport {\n ensureEmbedAuthFetchInterceptor,\n getEmbedAuthToken,\n isEmbedAuthActive,\n isEmbedMcpChatBridgeActive,\n} from \"./embed-auth.js\";\nexport {\n codeAgentTranscriptEventsToContent,\n createCodeAgentChatAdapter,\n type CodeAgentChatController,\n type CodeAgentChatControlResult,\n type CodeAgentChatFollowUpMode,\n type CodeAgentChatTranscriptEvent,\n type CreateCodeAgentChatAdapterOptions,\n} from \"./code-agent-chat-adapter.js\";\nexport {\n buildRepositoryFromCodeAgentTranscript,\n type BuildRepositoryFromCodeAgentTranscriptOptions,\n type CodeAgentThreadTranscriptEvent,\n} from \"../agent/thread-data-builder.js\";\nexport {\n compareCodeAgentTranscriptEvents,\n getCodeAgentTranscriptSeq,\n isCodeAgentRunActive,\n mergeCodeAgentTranscriptEvents,\n type CodeAgentRunStateLike,\n type CodeAgentTranscriptOrderEvent,\n} from \"../code-agents/transcript-order.js\";\nexport { useSendToAgentChat } from \"./use-send-to-agent-chat.js\";\nexport {\n useChatModels,\n type UseChatModelsResult,\n type EngineModelGroup,\n} from \"./use-chat-models.js\";\nexport {\n CodeRequiredDialog,\n type CodeRequiredDialogProps,\n} from \"./components/CodeRequiredDialog.js\";\nexport {\n AgentConversation,\n AgentConversationMessageView,\n normalizeCodeAgentTranscriptForConversation,\n useNearBottomAutoscroll,\n type CodeAgentConversationTranscriptEvent,\n type CodeAgentConversationTranscriptEventType,\n type NormalizeCodeAgentTranscriptOptions,\n type AgentConversationArtifact,\n type AgentConversationAttachment,\n type AgentConversationMessage,\n type AgentConversationMessagePart,\n type AgentConversationMessageRole,\n type AgentConversationNotice,\n type AgentConversationNoticeTone,\n type AgentConversationToolCall,\n type AgentConversationToolState,\n} from \"./conversation/index.js\";\nexport { McpAppRenderer } from \"./mcp-apps/McpAppRenderer.js\";\nexport {\n AGENT_NATIVE_MCP_APP_HOST_MESSAGE_TYPES,\n getMcpAppHostContext,\n openMcpAppHostLink,\n requestMcpAppDisplayMode,\n sendMcpAppHostMessage,\n updateMcpAppModelContext,\n useMcpAppHostContext,\n type AgentNativeMcpAppHostMessageType,\n type McpAppDisplayMode,\n type McpAppHostChatMessage,\n type McpAppHostCapabilities,\n type McpAppHostContext,\n type McpAppHostContextSnapshot,\n type McpAppModelContextContentPart,\n type McpAppModelContextUpdate,\n} from \"./mcp-app-host.js\";\nexport {\n CodeAgentIndicator,\n type CodeAgentIndicatorProps,\n} from \"./components/CodeAgentIndicator.js\";\nexport {\n useDbSync,\n useFileWatcher,\n useScreenRefreshKey,\n} from \"./use-db-sync.js\";\nexport {\n useChangeVersion,\n useChangeVersions,\n getChangeVersion,\n bumpChangeVersion,\n} from \"./use-change-version.js\";\nexport {\n buildDynamicAgentSuggestions,\n dedupeSuggestions,\n mergeAgentSuggestions,\n normalizeAgentDynamicSuggestionsConfig,\n useAgentDynamicSuggestions,\n type AgentDynamicSuggestionContext,\n type AgentDynamicSuggestionsConfig,\n type AgentDynamicSuggestionsOption,\n} from \"./dynamic-suggestions.js\";\nexport { cn } from \"./utils.js\";\nexport { ApiKeySettings } from \"./components/ApiKeySettings.js\";\nexport { useSession, type AuthSession } from \"./use-session.js\";\nexport {\n sendToFrame,\n onFrameMessage,\n requestUserInfo,\n getFrameOrigin,\n getCallbackOrigin,\n oauthRedirectUri,\n isInFrame,\n enterStyleEditing,\n enterTextEditing,\n exitSelectionMode,\n type UserInfo,\n} from \"./frame.js\";\nexport {\n getBuilderParentOrigin,\n isInBuilderFrame,\n sendToBuilderChat,\n type BuilderChatMessage,\n} from \"./builder-frame.js\";\nexport {\n AgentNative,\n useAgentNativeScreenContext,\n type AgentNativeCommandCallback,\n type AgentNativeCommandCallbackInfo,\n type AgentNativeProps,\n} from \"./AgentNative.js\";\nexport {\n AgentNativeEmbedded,\n useAgentNativeEmbeddedBrowserSession,\n type AgentNativeEmbeddedBrowserSessionOptions,\n type AgentNativeEmbeddedCommandCallback,\n type AgentNativeEmbeddedCommandCallbackInfo,\n type AgentNativeEmbeddedProps,\n type UseAgentNativeEmbeddedBrowserSessionOptions,\n} from \"./AgentNativeEmbedded.js\";\nexport {\n defineClientAction,\n type AgentNativeClientActionDefinition,\n type AgentNativeClientActionRunner,\n} from \"./client-action.js\";\nexport {\n AgentNativeFrame,\n type AgentNativeFrameProps,\n} from \"./AgentNativeFrame.js\";\nexport {\n AgentNativeExtensionFrame,\n AgentNativeExtensionSlot,\n type AgentNativeExtensionFrameProps,\n type AgentNativeExtensionPermissionList,\n type AgentNativeExtensionSlotProps,\n type AgentNativeExtensionStorageScopeList,\n} from \"./extensions/AgentNativeExtensionFrame.js\";\nexport {\n AGENT_NATIVE_EXTENSION_MESSAGE_TYPES,\n buildAgentNativeExtensionHtml,\n createHttpAgentNativeExtensionStorage,\n createLocalStorageAgentNativeExtensionStorage,\n getAgentNativeExtensionManifest,\n isAgentNativeExtensionAllowedInSlot,\n normalizeAgentNativeExtensionSandbox,\n type AgentNativeExtensionDefinition,\n type AgentNativeExtensionManifest,\n type AgentNativeExtensionMessageType,\n type AgentNativeExtensionStorage,\n type AgentNativeExtensionStorageContext,\n type AgentNativeExtensionStorageOptions,\n type AgentNativeExtensionStorageRow,\n type AgentNativeExtensionStorageScope,\n type BuildAgentNativeExtensionHtmlOptions,\n type CreateHttpAgentNativeExtensionStorageOptions,\n} from \"./extensions/portable-extension.js\";\nexport {\n AGENT_NATIVE_HOST_BRIDGE_VERSION,\n AGENT_NATIVE_HOST_MESSAGE_TYPES,\n announceAgentNativeFrameReady,\n createAgentNativeHostBridge,\n defaultAgentNativeHostCommands,\n onAgentNativeHostInit,\n readAgentNativeScreenContext,\n requestAgentNativeHostActions,\n requestAgentNativeHostContext,\n runAgentNativeHostAction,\n sendAgentNativeHostCommand,\n type AgentNativeActionAvailability,\n type AgentNativeActionManifestEntry,\n type AgentNativeClientAction,\n type AgentNativeClientActionApprovalConfig,\n type AgentNativeClientActionGetter,\n type AgentNativeClientActionRuntime,\n type AgentNativeClientActions,\n type AgentNativeHostAuth,\n type AgentNativeHostAuthPayload,\n type AgentNativeHostBridge,\n type AgentNativeHostBridgeEvent,\n type AgentNativeHostBridgeOptions,\n type AgentNativeHostCapabilities,\n type AgentNativeHostCommandHandler,\n type AgentNativeHostCommandHandlers,\n type AgentNativeHostCommandRequest,\n type AgentNativeHostContext,\n type AgentNativeHostContextGetter,\n type AgentNativeHostInit,\n type AgentNativeHostMessageType,\n type AgentNativeHostRequestOptions,\n type AgentNativeHostResourceContext,\n type AgentNativeHostRouteContext,\n type AgentNativeHostSelectionContext,\n type AgentNativeHostSession,\n type AgentNativeJsonSchema,\n type AgentNativeScreenSnapshot,\n type AgentNativeScreenSnapshotOptions,\n type BuiltInAgentNativeHostCommand,\n} from \"./host-bridge.js\";\nexport {\n AGENT_NATIVE_HOST_TOOL_NAMES,\n createAgentNativeHostTools,\n type AgentNativeHostToolDefinition,\n type AgentNativeHostToolName,\n type AgentNativeHostToolParameters,\n type AgentNativeHostToolSet,\n type CreateAgentNativeHostToolsOptions,\n type RunAgentNativeHostActionToolInput,\n type SendAgentNativeHostCommandToolInput,\n} from \"./host-tools.js\";\nexport {\n createAgentNativeBrowserSessionBridge,\n startAgentNativeBrowserSessionBridge,\n type AgentNativeBrowserSessionBridge,\n type AgentNativeBrowserSessionBridgeOptions,\n} from \"./browser-session-bridge.js\";\nexport type {\n AgentNativeBrowserSession,\n AgentNativeBrowserSessionAction,\n AgentNativeBrowserSessionRecord,\n AgentNativeBrowserSessionRequest,\n AgentNativeBrowserSessionRequestStatus,\n AgentNativeBrowserSessionRequestType,\n CreateAgentNativeBrowserSessionRequestInput,\n RegisterAgentNativeBrowserSessionInput,\n} from \"../browser-sessions/types.js\";\nexport {\n NewWorkspaceAppFlow,\n type NewWorkspaceAppFlowProps,\n type VaultSecretOption,\n} from \"./NewWorkspaceAppFlow.js\";\nexport {\n AssistantChat,\n clearChatStorage,\n type AssistantChatProps,\n type AssistantChatHandle,\n} from \"./AssistantChat.js\";\nexport {\n MultiTabAssistantChat,\n type MultiTabAssistantChatProps,\n type MultiTabAssistantChatHeaderProps,\n} from \"./MultiTabAssistantChat.js\";\nexport { RunStuckBanner, type RunStuckBannerProps } from \"./RunStuckBanner.js\";\nexport {\n useRunStuckDetection,\n useAbortRun,\n type RunStuckState,\n type UseRunStuckDetectionOptions,\n} from \"./use-run-stuck-detection.js\";\nexport { createAgentChatAdapter } from \"./agent-chat-adapter.js\";\nexport {\n AgentComposerFrame,\n type AgentComposerFrameProps,\n PromptComposer,\n AGENT_PROMPT_MAX_INLINE_IMAGE_BYTES,\n AGENT_PROMPT_MAX_INLINE_TEXT_CHARS,\n escapePromptAttachmentAttribute,\n formatPromptWithAttachments,\n isInlineableAgentPromptFile,\n readAgentPromptAttachment,\n type PromptComposerProps,\n type PromptComposerFile,\n type PromptComposerSubmitOptions,\n type AgentPromptAttachment,\n type ReadAgentPromptAttachmentOptions,\n type AgentComposerLayoutVariant,\n type SlashCommand,\n type SkillResult,\n} from \"./composer/index.js\";\nexport type { TiptapComposerHandle } from \"./composer/TiptapComposer.js\";\nexport {\n GuidedQuestionFlow,\n useGuidedQuestionFlow,\n formatGuidedAnswerValue,\n formatGuidedAnswersForAgent,\n getOtherGuidedAnswerText,\n hasGuidedAnswer,\n isOtherGuidedAnswer,\n makeOtherGuidedAnswer,\n normalizeGuidedAnswers,\n type GuidedQuestion,\n type GuidedQuestionAnswers,\n type GuidedQuestionFlowProps,\n type GuidedQuestionOption,\n type GuidedQuestionPayload,\n type GuidedQuestionType,\n type UseGuidedQuestionFlowOptions,\n} from \"./guided-questions.js\";\nexport {\n useChatThreads,\n type ChatThreadScope,\n type ChatThreadSummary,\n type ChatThreadData,\n} from \"./use-chat-threads.js\";\nexport {\n AgentChatSurface,\n AgentPanel,\n AgentSidebar,\n AgentToggleButton,\n focusAgentChat,\n type AgentChatSurfaceMode,\n type AgentChatSurfaceProps,\n type AgentPanelProps,\n type AgentSidebarProps,\n} from \"./AgentPanel.js\";\nexport {\n SIDEBAR_STATE_CHANGE_EVENT,\n type AgentSidebarStateChangeDetail,\n type AgentSidebarStateMode,\n type AgentSidebarStateSource,\n} from \"./agent-sidebar-state.js\";\nexport { AgentNativeIcon } from \"./components/icons/AgentNativeIcon.js\";\nexport { SettingsPanel, type SettingsPanelProps } from \"./settings/index.js\";\nexport { useBuilderStatus } from \"./settings/useBuilderStatus.js\";\nexport {\n openBuilderConnectPopup,\n useBuilderConnectFlow,\n type BuilderConnectFlow,\n type BuilderConnectFlowOptions,\n type OpenBuilderConnectPopupOptions,\n} from \"./settings/useBuilderStatus.js\";\n// Deprecated — use AgentSidebar + AgentToggleButton instead\nexport {\n ProductionAgentPanel,\n type ProductionAgentPanelProps,\n} from \"./ProductionAgentPanel.js\";\nexport {\n useProductionAgent,\n type ProductionAgentMessage,\n type UseProductionAgentOptions,\n type UseProductionAgentResult,\n} from \"./useProductionAgent.js\";\nexport { Turnstile, type TurnstileProps } from \"./Turnstile.js\";\nexport {\n OpenSourceBadge,\n PoweredByBadge,\n type OpenSourceBadgeProps,\n type PoweredByBadgeProps,\n} from \"./PoweredByBadge.js\";\nexport {\n StarfieldBackground,\n type StarfieldBackgroundProps,\n} from \"./StarfieldBackground.js\";\nexport { FeedbackButton, type FeedbackButtonProps } from \"./FeedbackButton.js\";\nexport { ErrorBoundary } from \"./ErrorBoundary.js\";\nexport { installRouteChunkRecovery } from \"./route-chunk-recovery.js\";\nexport { ClientOnly } from \"./ClientOnly.js\";\nexport { DefaultSpinner } from \"./DefaultSpinner.js\";\nexport {\n getThemeInitScript,\n themeInitScript,\n type ThemePreference,\n} from \"./theme.js\";\nexport {\n APPEARANCE_PRESETS,\n applyAppearance,\n getStoredAppearance,\n useAppearance,\n useAppearanceSync,\n type AppearancePresetId,\n} from \"./appearance.js\";\nexport {\n AppearancePicker,\n type AppearancePickerProps,\n} from \"./AppearancePicker.js\";\nexport { AgentTerminal, type AgentTerminalProps } from \"./terminal/index.js\";\nexport {\n trackEvent,\n trackSessionStatus,\n configureTracking,\n setSentryUser,\n captureError,\n captureClientException,\n type ClientCaptureContext,\n} from \"./analytics.js\";\nexport {\n useCollaborativeDoc,\n emailToColor,\n emailToName,\n type UseCollaborativeDocOptions,\n type UseCollaborativeDocResult,\n type CollabUser,\n} from \"../collab/client.js\";\nexport {\n ResourcesPanel,\n ResourceTree,\n ResourceEditor,\n useResources,\n useResourceTree,\n useResource,\n useCreateResource,\n useUpdateResource,\n useDeleteResource,\n useUploadResource,\n type Resource,\n type ResourceMeta,\n type TreeNode,\n type ResourceScope,\n type ResourceTreeProps,\n type ResourceEditorProps,\n} from \"./resources/index.js\";\nexport type {\n AppToFrameMessage,\n FrameToAppMessage,\n FrameMessage,\n CodeCompleteMessage,\n ChatRunningMessage,\n} from \"./frame-protocol.js\";\nexport {\n CommandMenu,\n useCommandMenuShortcut,\n openAgentSidebar,\n submitToAgent,\n type CommandMenuProps,\n type CommandGroupProps,\n type CommandItemProps,\n type CommandShortcutProps,\n} from \"./CommandMenu.js\";\nexport {\n DevOverlay,\n useDevOverlayShortcut,\n registerDevPanel,\n unregisterDevPanel,\n listDevPanels,\n subscribeDevPanels,\n useDevOption,\n clearAllDevOverlayStorage,\n devOptionKey,\n DEV_OVERLAY_STORAGE_PREFIX,\n type DevOverlayProps,\n type DevPanel,\n type DevOption,\n type DevBooleanOption,\n type DevSelectOption,\n type DevStringOption,\n type DevActionOption,\n type DevOptionValue,\n} from \"./dev-overlay/index.js\";\nexport {\n useActionQuery,\n useActionMutation,\n type ActionRegistry,\n} from \"./use-action.js\";\nexport { usePinchZoom, type UsePinchZoomOptions } from \"./use-pinch-zoom.js\";\nexport {\n ShareButton,\n ShareDialog,\n VisibilityBadge,\n type ShareButtonProps,\n type ShareDialogProps,\n type VisibilityBadgeProps,\n} from \"./sharing/index.js\";\nexport {\n postNavigate,\n isInAgentEmbed,\n AGENT_NAVIGATE_MESSAGE_TYPE,\n type AgentNavigateMessage,\n} from \"./embed.js\";\nexport { IframeEmbed, parseEmbedBody } from \"./IframeEmbed.js\";\nexport {\n useAvatarUrl,\n uploadAvatar,\n invalidateAvatarCache,\n} from \"./use-avatar.js\";\nexport {\n ObservabilityDashboard,\n ThumbsFeedback,\n} from \"./observability/index.js\";\n// Presence UI components\nexport {\n PresenceBar,\n type PresenceBarProps,\n} from \"./components/PresenceBar.js\";\nexport {\n AgentPresenceChip,\n type AgentPresenceChipProps,\n} from \"./components/AgentPresenceChip.js\";\n// Structured data collaboration hooks\nexport {\n useCollaborativeMap,\n useCollaborativeArray,\n type UseCollaborativeMapOptions,\n type UseCollaborativeMapResult,\n type UseCollaborativeArrayOptions,\n type UseCollaborativeArrayResult,\n} from \"../collab/client-struct.js\";\nexport { NotificationsBell } from \"./notifications/index.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,yBAAyB,EAAE,CAAC;AAE5B,OAAO,EACL,eAAe,EACf,aAAa,GAEd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EACL,eAAe,EACf,UAAU,EACV,WAAW,EACX,OAAO,GACR,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,+BAA+B,EAC/B,iBAAiB,EACjB,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,kCAAkC,EAClC,0BAA0B,GAM3B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,sCAAsC,GAGvC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,gCAAgC,EAChC,yBAAyB,EACzB,oBAAoB,EACpB,8BAA8B,GAG/B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EACL,aAAa,GAGd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,kBAAkB,GAEnB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,iBAAiB,EACjB,4BAA4B,EAC5B,2CAA2C,EAC3C,uBAAuB,GAaxB,MAAM,yBAAyB,CAAC;AACjC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AiB,EAAE,MAAM,0BAA0B,CAAC","sourcesContent":["import { installRouteChunkRecovery } from \"./route-chunk-recovery.js\";\n\ninstallRouteChunkRecovery();\n\nexport {\n sendToAgentChat,\n generateTabId,\n type AgentChatMessage,\n} from \"./agent-chat.js\";\nexport { useAgentChatGenerating } from \"./use-agent-chat.js\";\nexport { useDevMode } from \"./use-dev-mode.js\";\nexport {\n agentNativePath,\n appApiPath,\n appBasePath,\n appPath,\n} from \"./api-path.js\";\nexport {\n ensureEmbedAuthFetchInterceptor,\n getEmbedAuthToken,\n isEmbedAuthActive,\n isEmbedMcpChatBridgeActive,\n} from \"./embed-auth.js\";\nexport {\n codeAgentTranscriptEventsToContent,\n createCodeAgentChatAdapter,\n type CodeAgentChatController,\n type CodeAgentChatControlResult,\n type CodeAgentChatFollowUpMode,\n type CodeAgentChatTranscriptEvent,\n type CreateCodeAgentChatAdapterOptions,\n} from \"./code-agent-chat-adapter.js\";\nexport {\n buildRepositoryFromCodeAgentTranscript,\n type BuildRepositoryFromCodeAgentTranscriptOptions,\n type CodeAgentThreadTranscriptEvent,\n} from \"../agent/thread-data-builder.js\";\nexport {\n compareCodeAgentTranscriptEvents,\n getCodeAgentTranscriptSeq,\n isCodeAgentRunActive,\n mergeCodeAgentTranscriptEvents,\n type CodeAgentRunStateLike,\n type CodeAgentTranscriptOrderEvent,\n} from \"../code-agents/transcript-order.js\";\nexport { useSendToAgentChat } from \"./use-send-to-agent-chat.js\";\nexport {\n useChatModels,\n type UseChatModelsResult,\n type EngineModelGroup,\n} from \"./use-chat-models.js\";\nexport {\n CodeRequiredDialog,\n type CodeRequiredDialogProps,\n} from \"./components/CodeRequiredDialog.js\";\nexport {\n AgentConversation,\n AgentConversationMessageView,\n normalizeCodeAgentTranscriptForConversation,\n useNearBottomAutoscroll,\n type CodeAgentConversationTranscriptEvent,\n type CodeAgentConversationTranscriptEventType,\n type NormalizeCodeAgentTranscriptOptions,\n type AgentConversationArtifact,\n type AgentConversationAttachment,\n type AgentConversationMessage,\n type AgentConversationMessagePart,\n type AgentConversationMessageRole,\n type AgentConversationNotice,\n type AgentConversationNoticeTone,\n type AgentConversationToolCall,\n type AgentConversationToolState,\n} from \"./conversation/index.js\";\nexport { McpAppRenderer } from \"./mcp-apps/McpAppRenderer.js\";\nexport {\n AGENT_NATIVE_MCP_APP_HOST_MESSAGE_TYPES,\n getMcpAppHostContext,\n openMcpAppHostLink,\n requestMcpAppDisplayMode,\n sendMcpAppHostMessage,\n updateMcpAppModelContext,\n useMcpAppHostContext,\n type AgentNativeMcpAppHostMessageType,\n type McpAppDisplayMode,\n type McpAppHostChatMessage,\n type McpAppHostCapabilities,\n type McpAppHostContext,\n type McpAppHostContextSnapshot,\n type McpAppModelContextContentPart,\n type McpAppModelContextUpdate,\n} from \"./mcp-app-host.js\";\nexport {\n CodeAgentIndicator,\n type CodeAgentIndicatorProps,\n} from \"./components/CodeAgentIndicator.js\";\nexport {\n useDbSync,\n useFileWatcher,\n useScreenRefreshKey,\n} from \"./use-db-sync.js\";\nexport {\n useChangeVersion,\n useChangeVersions,\n getChangeVersion,\n bumpChangeVersion,\n} from \"./use-change-version.js\";\nexport {\n buildDynamicAgentSuggestions,\n dedupeSuggestions,\n mergeAgentSuggestions,\n normalizeAgentDynamicSuggestionsConfig,\n useAgentDynamicSuggestions,\n type AgentDynamicSuggestionContext,\n type AgentDynamicSuggestionsConfig,\n type AgentDynamicSuggestionsOption,\n} from \"./dynamic-suggestions.js\";\nexport { cn } from \"./utils.js\";\nexport { ApiKeySettings } from \"./components/ApiKeySettings.js\";\nexport { useSession, type AuthSession } from \"./use-session.js\";\nexport {\n sendToFrame,\n onFrameMessage,\n requestUserInfo,\n getFrameOrigin,\n getCallbackOrigin,\n oauthRedirectUri,\n isInFrame,\n enterStyleEditing,\n enterTextEditing,\n exitSelectionMode,\n type UserInfo,\n} from \"./frame.js\";\nexport {\n getBuilderParentOrigin,\n isInBuilderFrame,\n sendToBuilderChat,\n type BuilderChatMessage,\n} from \"./builder-frame.js\";\nexport {\n AgentNative,\n useAgentNativeScreenContext,\n type AgentNativeCommandCallback,\n type AgentNativeCommandCallbackInfo,\n type AgentNativeProps,\n} from \"./AgentNative.js\";\nexport {\n AgentNativeEmbedded,\n useAgentNativeEmbeddedBrowserSession,\n type AgentNativeEmbeddedBrowserSessionOptions,\n type AgentNativeEmbeddedCommandCallback,\n type AgentNativeEmbeddedCommandCallbackInfo,\n type AgentNativeEmbeddedProps,\n type UseAgentNativeEmbeddedBrowserSessionOptions,\n} from \"./AgentNativeEmbedded.js\";\nexport {\n defineClientAction,\n type AgentNativeClientActionDefinition,\n type AgentNativeClientActionRunner,\n} from \"./client-action.js\";\nexport {\n AgentNativeFrame,\n type AgentNativeFrameProps,\n} from \"./AgentNativeFrame.js\";\nexport {\n AgentNativeExtensionFrame,\n AgentNativeExtensionSlot,\n type AgentNativeExtensionFrameProps,\n type AgentNativeExtensionPermissionList,\n type AgentNativeExtensionSlotProps,\n type AgentNativeExtensionStorageScopeList,\n} from \"./extensions/AgentNativeExtensionFrame.js\";\nexport {\n AGENT_NATIVE_EXTENSION_MESSAGE_TYPES,\n buildAgentNativeExtensionHtml,\n createHttpAgentNativeExtensionStorage,\n createLocalStorageAgentNativeExtensionStorage,\n getAgentNativeExtensionManifest,\n isAgentNativeExtensionAllowedInSlot,\n normalizeAgentNativeExtensionSandbox,\n type AgentNativeExtensionDefinition,\n type AgentNativeExtensionManifest,\n type AgentNativeExtensionMessageType,\n type AgentNativeExtensionStorage,\n type AgentNativeExtensionStorageContext,\n type AgentNativeExtensionStorageOptions,\n type AgentNativeExtensionStorageRow,\n type AgentNativeExtensionStorageScope,\n type BuildAgentNativeExtensionHtmlOptions,\n type CreateHttpAgentNativeExtensionStorageOptions,\n} from \"./extensions/portable-extension.js\";\nexport {\n AGENT_NATIVE_HOST_BRIDGE_VERSION,\n AGENT_NATIVE_HOST_MESSAGE_TYPES,\n announceAgentNativeFrameReady,\n createAgentNativeHostBridge,\n defaultAgentNativeHostCommands,\n onAgentNativeHostInit,\n readAgentNativeScreenContext,\n requestAgentNativeHostActions,\n requestAgentNativeHostContext,\n runAgentNativeHostAction,\n sendAgentNativeHostCommand,\n type AgentNativeActionAvailability,\n type AgentNativeActionManifestEntry,\n type AgentNativeClientAction,\n type AgentNativeClientActionApprovalConfig,\n type AgentNativeClientActionGetter,\n type AgentNativeClientActionRuntime,\n type AgentNativeClientActions,\n type AgentNativeHostAuth,\n type AgentNativeHostAuthPayload,\n type AgentNativeHostBridge,\n type AgentNativeHostBridgeEvent,\n type AgentNativeHostBridgeOptions,\n type AgentNativeHostCapabilities,\n type AgentNativeHostCommandHandler,\n type AgentNativeHostCommandHandlers,\n type AgentNativeHostCommandRequest,\n type AgentNativeHostContext,\n type AgentNativeHostContextGetter,\n type AgentNativeHostInit,\n type AgentNativeHostMessageType,\n type AgentNativeHostRequestOptions,\n type AgentNativeHostResourceContext,\n type AgentNativeHostRouteContext,\n type AgentNativeHostSelectionContext,\n type AgentNativeHostSession,\n type AgentNativeJsonSchema,\n type AgentNativeScreenSnapshot,\n type AgentNativeScreenSnapshotOptions,\n type BuiltInAgentNativeHostCommand,\n} from \"./host-bridge.js\";\nexport {\n AGENT_NATIVE_HOST_TOOL_NAMES,\n createAgentNativeHostTools,\n type AgentNativeHostToolDefinition,\n type AgentNativeHostToolName,\n type AgentNativeHostToolParameters,\n type AgentNativeHostToolSet,\n type CreateAgentNativeHostToolsOptions,\n type RunAgentNativeHostActionToolInput,\n type SendAgentNativeHostCommandToolInput,\n} from \"./host-tools.js\";\nexport {\n createAgentNativeBrowserSessionBridge,\n startAgentNativeBrowserSessionBridge,\n type AgentNativeBrowserSessionBridge,\n type AgentNativeBrowserSessionBridgeOptions,\n} from \"./browser-session-bridge.js\";\nexport type {\n AgentNativeBrowserSession,\n AgentNativeBrowserSessionAction,\n AgentNativeBrowserSessionRecord,\n AgentNativeBrowserSessionRequest,\n AgentNativeBrowserSessionRequestStatus,\n AgentNativeBrowserSessionRequestType,\n CreateAgentNativeBrowserSessionRequestInput,\n RegisterAgentNativeBrowserSessionInput,\n} from \"../browser-sessions/types.js\";\nexport {\n NewWorkspaceAppFlow,\n type NewWorkspaceAppFlowProps,\n type VaultSecretOption,\n} from \"./NewWorkspaceAppFlow.js\";\nexport {\n AssistantChat,\n clearChatStorage,\n type AssistantChatProps,\n type AssistantChatHandle,\n} from \"./AssistantChat.js\";\nexport {\n MultiTabAssistantChat,\n type MultiTabAssistantChatProps,\n type MultiTabAssistantChatHeaderProps,\n} from \"./MultiTabAssistantChat.js\";\nexport { RunStuckBanner, type RunStuckBannerProps } from \"./RunStuckBanner.js\";\nexport {\n useRunStuckDetection,\n useAbortRun,\n type RunStuckState,\n type UseRunStuckDetectionOptions,\n} from \"./use-run-stuck-detection.js\";\nexport { createAgentChatAdapter } from \"./agent-chat-adapter.js\";\nexport {\n AgentComposerFrame,\n type AgentComposerFrameProps,\n PromptComposer,\n AGENT_PROMPT_MAX_INLINE_IMAGE_BYTES,\n AGENT_PROMPT_MAX_INLINE_TEXT_CHARS,\n escapePromptAttachmentAttribute,\n formatPromptWithAttachments,\n isInlineableAgentPromptFile,\n readAgentPromptAttachment,\n type PromptComposerProps,\n type PromptComposerFile,\n type PromptComposerSubmitOptions,\n type AgentPromptAttachment,\n type ReadAgentPromptAttachmentOptions,\n type AgentComposerLayoutVariant,\n type SlashCommand,\n type SkillResult,\n} from \"./composer/index.js\";\nexport type { TiptapComposerHandle } from \"./composer/TiptapComposer.js\";\nexport {\n GuidedQuestionFlow,\n useGuidedQuestionFlow,\n formatGuidedAnswerValue,\n formatGuidedAnswersForAgent,\n getOtherGuidedAnswerText,\n hasGuidedAnswer,\n isOtherGuidedAnswer,\n makeOtherGuidedAnswer,\n normalizeGuidedAnswers,\n type GuidedQuestion,\n type GuidedQuestionAnswers,\n type GuidedQuestionFlowProps,\n type GuidedQuestionOption,\n type GuidedQuestionPayload,\n type GuidedQuestionType,\n type UseGuidedQuestionFlowOptions,\n} from \"./guided-questions.js\";\nexport {\n useChatThreads,\n type ChatThreadScope,\n type ChatThreadSummary,\n type ChatThreadData,\n type UseChatThreadsOptions,\n} from \"./use-chat-threads.js\";\nexport {\n AgentChatSurface,\n AgentPanel,\n AgentSidebar,\n AgentToggleButton,\n focusAgentChat,\n type AgentChatSurfaceMode,\n type AgentChatSurfaceProps,\n type AgentPanelProps,\n type AgentSidebarProps,\n} from \"./AgentPanel.js\";\nexport {\n SIDEBAR_STATE_CHANGE_EVENT,\n type AgentSidebarStateChangeDetail,\n type AgentSidebarStateMode,\n type AgentSidebarStateSource,\n} from \"./agent-sidebar-state.js\";\nexport { AgentNativeIcon } from \"./components/icons/AgentNativeIcon.js\";\nexport { SettingsPanel, type SettingsPanelProps } from \"./settings/index.js\";\nexport { useBuilderStatus } from \"./settings/useBuilderStatus.js\";\nexport {\n openBuilderConnectPopup,\n useBuilderConnectFlow,\n type BuilderConnectFlow,\n type BuilderConnectFlowOptions,\n type OpenBuilderConnectPopupOptions,\n} from \"./settings/useBuilderStatus.js\";\n// Deprecated — use AgentSidebar + AgentToggleButton instead\nexport {\n ProductionAgentPanel,\n type ProductionAgentPanelProps,\n} from \"./ProductionAgentPanel.js\";\nexport {\n useProductionAgent,\n type ProductionAgentMessage,\n type UseProductionAgentOptions,\n type UseProductionAgentResult,\n} from \"./useProductionAgent.js\";\nexport { Turnstile, type TurnstileProps } from \"./Turnstile.js\";\nexport {\n OpenSourceBadge,\n PoweredByBadge,\n type OpenSourceBadgeProps,\n type PoweredByBadgeProps,\n} from \"./PoweredByBadge.js\";\nexport {\n StarfieldBackground,\n type StarfieldBackgroundProps,\n} from \"./StarfieldBackground.js\";\nexport { FeedbackButton, type FeedbackButtonProps } from \"./FeedbackButton.js\";\nexport { ErrorBoundary } from \"./ErrorBoundary.js\";\nexport { installRouteChunkRecovery } from \"./route-chunk-recovery.js\";\nexport { ClientOnly } from \"./ClientOnly.js\";\nexport { DefaultSpinner } from \"./DefaultSpinner.js\";\nexport {\n getThemeInitScript,\n themeInitScript,\n type ThemePreference,\n} from \"./theme.js\";\nexport {\n APPEARANCE_PRESETS,\n applyAppearance,\n getStoredAppearance,\n useAppearance,\n useAppearanceSync,\n type AppearancePresetId,\n} from \"./appearance.js\";\nexport {\n AppearancePicker,\n type AppearancePickerProps,\n} from \"./AppearancePicker.js\";\nexport { AgentTerminal, type AgentTerminalProps } from \"./terminal/index.js\";\nexport {\n trackEvent,\n trackSessionStatus,\n configureTracking,\n setSentryUser,\n captureError,\n captureClientException,\n type ClientCaptureContext,\n} from \"./analytics.js\";\nexport {\n useCollaborativeDoc,\n emailToColor,\n emailToName,\n type UseCollaborativeDocOptions,\n type UseCollaborativeDocResult,\n type CollabUser,\n} from \"../collab/client.js\";\nexport {\n ResourcesPanel,\n ResourceTree,\n ResourceEditor,\n useResources,\n useResourceTree,\n useResource,\n useCreateResource,\n useUpdateResource,\n useDeleteResource,\n useUploadResource,\n type Resource,\n type ResourceMeta,\n type TreeNode,\n type ResourceScope,\n type ResourceTreeProps,\n type ResourceEditorProps,\n} from \"./resources/index.js\";\nexport type {\n AppToFrameMessage,\n FrameToAppMessage,\n FrameMessage,\n CodeCompleteMessage,\n ChatRunningMessage,\n} from \"./frame-protocol.js\";\nexport {\n CommandMenu,\n useCommandMenuShortcut,\n openAgentSidebar,\n submitToAgent,\n type CommandMenuProps,\n type CommandGroupProps,\n type CommandItemProps,\n type CommandShortcutProps,\n} from \"./CommandMenu.js\";\nexport {\n DevOverlay,\n useDevOverlayShortcut,\n registerDevPanel,\n unregisterDevPanel,\n listDevPanels,\n subscribeDevPanels,\n useDevOption,\n clearAllDevOverlayStorage,\n devOptionKey,\n DEV_OVERLAY_STORAGE_PREFIX,\n type DevOverlayProps,\n type DevPanel,\n type DevOption,\n type DevBooleanOption,\n type DevSelectOption,\n type DevStringOption,\n type DevActionOption,\n type DevOptionValue,\n} from \"./dev-overlay/index.js\";\nexport {\n useActionQuery,\n useActionMutation,\n type ActionRegistry,\n} from \"./use-action.js\";\nexport { usePinchZoom, type UsePinchZoomOptions } from \"./use-pinch-zoom.js\";\nexport {\n ShareButton,\n ShareDialog,\n VisibilityBadge,\n type ShareButtonProps,\n type ShareDialogProps,\n type VisibilityBadgeProps,\n} from \"./sharing/index.js\";\nexport {\n postNavigate,\n isInAgentEmbed,\n AGENT_NAVIGATE_MESSAGE_TYPE,\n type AgentNavigateMessage,\n} from \"./embed.js\";\nexport { IframeEmbed, parseEmbedBody } from \"./IframeEmbed.js\";\nexport {\n useAvatarUrl,\n uploadAvatar,\n invalidateAvatarCache,\n} from \"./use-avatar.js\";\nexport {\n ObservabilityDashboard,\n ThumbsFeedback,\n} from \"./observability/index.js\";\n// Presence UI components\nexport {\n PresenceBar,\n type PresenceBarProps,\n} from \"./components/PresenceBar.js\";\nexport {\n AgentPresenceChip,\n type AgentPresenceChipProps,\n} from \"./components/AgentPresenceChip.js\";\n// Structured data collaboration hooks\nexport {\n useCollaborativeMap,\n useCollaborativeArray,\n type UseCollaborativeMapOptions,\n type UseCollaborativeMapResult,\n type UseCollaborativeArrayOptions,\n type UseCollaborativeArrayResult,\n} from \"../collab/client-struct.js\";\nexport { NotificationsBell } from \"./notifications/index.js\";\n"]}
|
|
@@ -29,7 +29,11 @@ export interface ChatThreadSnapshot {
|
|
|
29
29
|
preview: string;
|
|
30
30
|
messageCount: number;
|
|
31
31
|
}
|
|
32
|
-
export
|
|
32
|
+
export interface UseChatThreadsOptions {
|
|
33
|
+
/** Create an optimistic empty thread on mount when no active thread exists. */
|
|
34
|
+
autoCreate?: boolean;
|
|
35
|
+
}
|
|
36
|
+
export declare function useChatThreads(apiUrl?: string, storageKey?: string, scope?: ChatThreadScope | null, options?: UseChatThreadsOptions): {
|
|
33
37
|
threads: ChatThreadSummary[];
|
|
34
38
|
activeThreadId: string;
|
|
35
39
|
isLoading: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-chat-threads.d.ts","sourceRoot":"","sources":["../../src/client/use-chat-threads.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;CAC/B;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;CAC/B;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;CACtB;
|
|
1
|
+
{"version":3,"file":"use-chat-threads.d.ts","sourceRoot":"","sources":["../../src/client/use-chat-threads.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAA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AG,OAAO,CAAC,iBAAiB,EAAE,CAAC;;sBAhO9C,MAAM;EAkQd"}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { useState, useEffect, useCallback, useRef, useMemo } from "react";
|
|
2
2
|
import { agentNativePath } from "./api-path.js";
|
|
3
3
|
const ACTIVE_THREAD_KEY = "agent-chat-active-thread";
|
|
4
|
+
const THREADS_UPDATED_EVENT = "agent-chat:threads-updated";
|
|
5
|
+
function emitThreadsUpdated() {
|
|
6
|
+
if (typeof window === "undefined")
|
|
7
|
+
return;
|
|
8
|
+
window.dispatchEvent(new CustomEvent(THREADS_UPDATED_EVENT));
|
|
9
|
+
}
|
|
4
10
|
function scopeKeySegment(scope) {
|
|
5
11
|
if (!scope)
|
|
6
12
|
return "";
|
|
@@ -25,7 +31,8 @@ function threadCanStayVisibleInScope(threadScope, currentScope) {
|
|
|
25
31
|
return true;
|
|
26
32
|
return scopesMatch(threadScope, currentScope);
|
|
27
33
|
}
|
|
28
|
-
export function useChatThreads(apiUrl = agentNativePath("/_agent-native/agent-chat"), storageKey, scope) {
|
|
34
|
+
export function useChatThreads(apiUrl = agentNativePath("/_agent-native/agent-chat"), storageKey, scope, options) {
|
|
35
|
+
const autoCreate = options?.autoCreate !== false;
|
|
29
36
|
// Each (storageKey, scope) pair gets its own active-thread localStorage key
|
|
30
37
|
// for chats that belong to a resource. General chats keep using the unscoped
|
|
31
38
|
// key even while the user is looking at a resource, so clicking into a deck,
|
|
@@ -282,7 +289,7 @@ export function useChatThreads(apiUrl = agentNativePath("/_agent-native/agent-ch
|
|
|
282
289
|
// activeThreadId already === savedId from the localStorage
|
|
283
290
|
// initializer; nothing else to set.
|
|
284
291
|
}
|
|
285
|
-
else if (!savedId) {
|
|
292
|
+
else if (!savedId && autoCreate) {
|
|
286
293
|
if (typeof crypto !== "undefined" && crypto.randomUUID) {
|
|
287
294
|
// Brand new surface — synthesize a local id so the composer has a
|
|
288
295
|
// target. No POST: the server creates the row on first send.
|
|
@@ -294,7 +301,7 @@ export function useChatThreads(apiUrl = agentNativePath("/_agent-native/agent-ch
|
|
|
294
301
|
}
|
|
295
302
|
setIsLoading(false);
|
|
296
303
|
})();
|
|
297
|
-
}, [fetchThreads, addOptimisticThread]);
|
|
304
|
+
}, [fetchThreads, addOptimisticThread, autoCreate]);
|
|
298
305
|
const createThread = useCallback((preferredId) => {
|
|
299
306
|
// Generate ID client-side for instant UI response. No POST — the
|
|
300
307
|
// server creates the row when the user actually sends a message,
|
|
@@ -319,6 +326,7 @@ export function useChatThreads(apiUrl = agentNativePath("/_agent-native/agent-ch
|
|
|
319
326
|
});
|
|
320
327
|
setThreads((prev) => prev.map((t) => (t.id === threadId ? { ...t, scope: null } : t)));
|
|
321
328
|
optimisticThreadScopesRef.current.set(threadId, null);
|
|
329
|
+
emitThreadsUpdated();
|
|
322
330
|
}
|
|
323
331
|
catch { }
|
|
324
332
|
}, [apiUrl]);
|
|
@@ -331,6 +339,7 @@ export function useChatThreads(apiUrl = agentNativePath("/_agent-native/agent-ch
|
|
|
331
339
|
await fetch(`${apiUrl}/threads/${encodeURIComponent(id)}`, {
|
|
332
340
|
method: "DELETE",
|
|
333
341
|
});
|
|
342
|
+
emitThreadsUpdated();
|
|
334
343
|
}
|
|
335
344
|
catch { }
|
|
336
345
|
optimisticThreadScopesRef.current.delete(id);
|
|
@@ -363,6 +372,7 @@ export function useChatThreads(apiUrl = agentNativePath("/_agent-native/agent-ch
|
|
|
363
372
|
headers: { "Content-Type": "application/json" },
|
|
364
373
|
body: JSON.stringify({ ...data, scope: localScope }),
|
|
365
374
|
});
|
|
375
|
+
emitThreadsUpdated();
|
|
366
376
|
// Update local thread list metadata. If the thread isn't in our
|
|
367
377
|
// local list yet (an optimistic-only thread that the server just
|
|
368
378
|
// created via persistSubmittedUserMessage), add it so HistoryPopover
|
|
@@ -495,6 +505,7 @@ export function useChatThreads(apiUrl = agentNativePath("/_agent-native/agent-ch
|
|
|
495
505
|
},
|
|
496
506
|
...prev,
|
|
497
507
|
]);
|
|
508
|
+
emitThreadsUpdated();
|
|
498
509
|
return thread.id;
|
|
499
510
|
}
|
|
500
511
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-chat-threads.js","sourceRoot":"","sources":["../../src/client/use-chat-threads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAyChD,MAAM,iBAAiB,GAAG,0BAA0B,CAAC;AAErD,SAAS,eAAe,CAAC,KAA8B;IACrD,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IACtB,OAAO,UAAU,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,EAAE,EAAE,CAAC;AAC5C,CAAC;AAED,SAAS,sBAAsB,CAC7B,UAAmB,EACnB,KAA8B;IAE9B,MAAM,SAAS,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;IACzC,OAAO,UAAU;QACf,CAAC,CAAC,GAAG,iBAAiB,IAAI,UAAU,GAAG,SAAS,EAAE;QAClD,CAAC,CAAC,GAAG,iBAAiB,GAAG,SAAS,EAAE,CAAC;AACzC,CAAC;AAED,SAAS,0BAA0B,CAAC,eAAuB;IACzD,OAAO,GAAG,eAAe,OAAO,CAAC;AACnC,CAAC;AAED,SAAS,WAAW,CAClB,CAA0B,EAC1B,CAA0B;IAE1B,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IAC3B,OAAO,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC;AAC5C,CAAC;AAED,SAAS,2BAA2B,CAClC,WAAmC,EACnC,YAAqC;IAErC,IAAI,CAAC,WAAW;QAAE,OAAO,IAAI,CAAC;IAC9B,OAAO,WAAW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,CAAC,CAAC;YACH,OAAO,MAAM,CAAC,EAAE,CAAC;QACnB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,yBAAyB,QAAQ,GAAG,EAAE,GAAG,CAAC,CAAC;YACzD,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC,EACD,CAAC,MAAM,CAAC,CACT,CAAC;IAEF,MAAM,aAAa,GAAG,WAAW,CAC/B,KAAK,EAAE,KAAa,EAAgC,EAAE;QACpD,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,KAAK,CACrB,GAAG,MAAM,cAAc,kBAAkB,CAAC,KAAK,CAAC,EAAE,CACnD,CAAC;YACF,IAAI,CAAC,GAAG,CAAC,EAAE;gBAAE,OAAO,EAAE,CAAC;YACvB,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;YAC9B,OAAO,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;QAC5B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC,EACD,CAAC,MAAM,CAAC,CACT,CAAC;IAEF,MAAM,cAAc,GAAG,WAAW,CAAC,GAAG,EAAE;QACtC,YAAY,EAAE,CAAC;IACjB,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,OAAO;QACL,OAAO;QACP,cAAc;QACd,SAAS;QACT,YAAY;QACZ,YAAY;QACZ,YAAY,EAAE,YAAY;QAC1B,YAAY;QACZ,UAAU;QACV,cAAc;QACd,aAAa;QACb,aAAa;QACb,cAAc;QACd,WAAW;KACZ,CAAC;AACJ,CAAC","sourcesContent":["import { useState, useEffect, useCallback, useRef, useMemo } from \"react\";\nimport { agentNativePath } from \"./api-path.js\";\n\nexport interface ChatThreadScope {\n type: string;\n id: string;\n label?: string;\n}\n\nexport interface ChatThreadSummary {\n id: string;\n title: string;\n preview: string;\n messageCount: number;\n createdAt: number;\n updatedAt: number;\n scope: ChatThreadScope | null;\n}\n\nexport interface ChatThreadData {\n id: string;\n ownerEmail: string;\n title: string;\n preview: string;\n threadData: string;\n messageCount: number;\n createdAt: number;\n updatedAt: number;\n scope: ChatThreadScope | null;\n}\n\nexport interface ChatThreadSnapshot {\n threadData: string;\n title: string;\n preview: string;\n messageCount: number;\n}\n\ninterface ForkSnapshotWithScope extends ChatThreadSnapshot {\n scope: ChatThreadScope | null;\n}\n\nconst ACTIVE_THREAD_KEY = \"agent-chat-active-thread\";\n\nfunction scopeKeySegment(scope?: ChatThreadScope | null): string {\n if (!scope) return \"\";\n return `:scope:${scope.type}:${scope.id}`;\n}\n\nfunction activeThreadStorageKey(\n storageKey?: string,\n scope?: ChatThreadScope | null,\n): string {\n const scopePart = scopeKeySegment(scope);\n return storageKey\n ? `${ACTIVE_THREAD_KEY}:${storageKey}${scopePart}`\n : `${ACTIVE_THREAD_KEY}${scopePart}`;\n}\n\nfunction activeThreadSeenStorageKey(activeThreadKey: string): string {\n return `${activeThreadKey}:seen`;\n}\n\nfunction scopesMatch(\n a?: ChatThreadScope | null,\n b?: ChatThreadScope | null,\n): boolean {\n if (!a || !b) return false;\n return a.type === b.type && a.id === b.id;\n}\n\nfunction threadCanStayVisibleInScope(\n threadScope: ChatThreadScope | null,\n currentScope?: ChatThreadScope | null,\n): boolean {\n if (!threadScope) return true;\n return scopesMatch(threadScope, currentScope);\n}\n\nexport function useChatThreads(\n apiUrl = agentNativePath(\"/_agent-native/agent-chat\"),\n storageKey?: string,\n scope?: ChatThreadScope | null,\n) {\n // Each (storageKey, scope) pair gets its own active-thread localStorage key\n // for chats that belong to a resource. General chats keep using the unscoped\n // key even while the user is looking at a resource, so clicking into a deck,\n // design, form, etc. doesn't make a global conversation vanish.\n const activeThreadKey = useMemo(() => {\n return activeThreadStorageKey(storageKey, scope);\n }, [storageKey, scope?.type, scope?.id]);\n // Companion key recording when the saved active thread was last live in\n // this client. A revived orphan tab (id in localStorage but not on the\n // server and not created this session) must keep its real last-seen time\n // so the 12h stale-tab cleanup can age it out — stamping it `Date.now()`\n // on every mount (the old behaviour) reset the clock forever, so\n // abandoned empty tabs never got pruned.\n const activeThreadSeenKey = useMemo(\n () => activeThreadSeenStorageKey(activeThreadKey),\n [activeThreadKey],\n );\n const [threads, setThreads] = useState<ChatThreadSummary[]>([]);\n const threadsRef = useRef<ChatThreadSummary[]>(threads);\n threadsRef.current = threads;\n\n // IDs we generated client-side this session — consumers use this to know\n // whether to skip the per-thread restore skeleton, and we use it to\n // protect the optimistic-only thread from being yanked out of local\n // state when the server's threads list (which never sees it) loads.\n const newlyCreatedRef = useRef<Set<string>>(new Set());\n const optimisticThreadScopesRef = useRef<Map<string, ChatThreadScope | null>>(\n new Map(),\n );\n\n // Latest scope as a ref so `createThread` (a useCallback that we don't\n // want to depend on scope identity) reads the current value at call\n // time. The scope a new chat inherits is the one in effect when the +\n // button is clicked, not when the hook first mounted.\n const scopeRef = useRef<ChatThreadScope | null | undefined>(scope);\n scopeRef.current = scope;\n\n const readKnownThreadScope = useCallback(\n (id: string): ChatThreadScope | null | undefined => {\n const thread = threadsRef.current.find((t) => t.id === id);\n if (thread) return thread.scope ?? null;\n if (optimisticThreadScopesRef.current.has(id)) {\n return optimisticThreadScopesRef.current.get(id) ?? null;\n }\n return undefined;\n },\n [],\n );\n\n // Restore the saved active thread synchronously on mount so the chat shell\n // can paint immediately. We do NOT synthesize a fresh UUID here when no\n // saved id exists — that flow was creating empty `chat_threads` rows on\n // every page load via the optimistic POST, even if the user never chatted.\n // (Steve's account had 127 threads; 112 had message_count=0 and zero\n // agent_runs — pure ghosts.) When localStorage is empty, the initial\n // useEffect picks the most-recent server thread, or synthesizes a brand\n // new id only when there are no server threads at all.\n const [activeThreadId, setActiveThreadId] = useState<string | null>(() => {\n if (typeof window === \"undefined\") return null;\n try {\n return localStorage.getItem(activeThreadKey);\n } catch {\n return null;\n }\n });\n const [isLoading, setIsLoading] = useState(true);\n const fetchedRef = useRef(false);\n const activeThreadIdRef = useRef(activeThreadId);\n activeThreadIdRef.current = activeThreadId;\n\n // Persist active thread ID — and rehydrate on scope flips. When the user\n // navigates from deck A to deck B, `activeThreadKey` changes; we re-read B's\n // scoped thread only if the currently visible chat is itself scoped to a\n // different resource. Unscoped chats are global and stay visible.\n const persistedKeyRef = useRef(activeThreadKey);\n useEffect(() => {\n if (persistedKeyRef.current !== activeThreadKey) {\n const currentId = activeThreadIdRef.current;\n if (currentId) {\n const currentThreadScope = readKnownThreadScope(currentId);\n // Thread metadata not yet loaded from the server — we can't tell\n // whether the visible chat is general (stays) or scoped-elsewhere\n // (swaps). Defer until `threads` resolves and this effect re-runs;\n // we intentionally do NOT update `persistedKeyRef` so the next\n // render gets another shot. Without this guard, navigating into a\n // resource before `GET /threads` resolves silently dropped the\n // active general chat the user was just in.\n if (currentThreadScope === undefined) {\n return;\n }\n if (threadCanStayVisibleInScope(currentThreadScope, scopeRef.current)) {\n persistedKeyRef.current = activeThreadKey;\n return;\n }\n }\n persistedKeyRef.current = activeThreadKey;\n try {\n setActiveThreadId(localStorage.getItem(activeThreadKey));\n } catch {\n setActiveThreadId(null);\n }\n return;\n }\n try {\n if (activeThreadId) {\n const threadScope = readKnownThreadScope(activeThreadId);\n if (threadScope === undefined) return;\n const targetKey = activeThreadStorageKey(storageKey, threadScope);\n localStorage.setItem(targetKey, activeThreadId);\n localStorage.setItem(\n activeThreadSeenStorageKey(targetKey),\n String(Date.now()),\n );\n } else {\n localStorage.removeItem(activeThreadKey);\n localStorage.removeItem(activeThreadSeenKey);\n }\n } catch {}\n }, [\n activeThreadId,\n activeThreadKey,\n activeThreadSeenKey,\n readKnownThreadScope,\n storageKey,\n threads,\n ]);\n\n const fetchThreads = useCallback(async () => {\n try {\n const res = await fetch(`${apiUrl}/threads`);\n if (!res.ok) return;\n const data = await res.json();\n setThreads((prev) => {\n const loaded = (data.threads ?? []) as ChatThreadSummary[];\n const loadedIds = new Set(loaded.map((t) => t.id));\n // Preserve any optimistic threads we've created this session that\n // haven't shown up in the server list yet — the server only learns\n // about a thread when the user actually sends a message and the\n // agent run's `persistSubmittedUserMessage` writes the row.\n const optimisticOnly = prev.filter(\n (t) => newlyCreatedRef.current.has(t.id) && !loadedIds.has(t.id),\n );\n // Reconcile each server thread against our local copy. If the local\n // copy has a newer updatedAt or higher messageCount, keep those\n // fields — the server probably hasn't observed the user's latest\n // send yet, and naively replacing makes the recent-chats list\n // visibly jump back to older timestamps right after a send.\n const merged = loaded.map((server) => {\n const local = prev.find((t) => t.id === server.id);\n if (!local) return server;\n const next = { ...server };\n if (local.updatedAt > server.updatedAt) {\n next.updatedAt = local.updatedAt;\n }\n if (local.messageCount > server.messageCount) {\n next.messageCount = local.messageCount;\n if (local.preview) next.preview = local.preview;\n if (local.title) next.title = local.title;\n }\n // Preserve optimistic scope: when the server creates the row\n // on first message it does so without scope, and the next PUT\n // (saveThreadData) writes the local scope back. In the brief\n // window between those, the server list returns scope: null\n // while the user is clearly working inside a deck — keep the\n // local value so the tab bar doesn't blink unscoped.\n if (local.scope && !server.scope) {\n next.scope = local.scope;\n }\n return next;\n });\n return [...optimisticOnly, ...merged];\n });\n return data.threads as ChatThreadSummary[];\n } catch {\n return undefined;\n }\n }, [apiUrl]);\n\n // Add a client-generated thread to the local list optimistically.\n //\n // Critically, this does NOT `POST /threads` to the server — that path was\n // creating an empty row in `chat_threads` (message_count=0, no\n // agent_runs) on every page mount and every \"+\" click. The server\n // already creates the row idempotently the moment the user actually\n // sends their first message (`persistSubmittedUserMessage` →\n // `createThread`), so the client doesn't need to pre-create it. This\n // makes the threads table reflect real conversations only.\n const addOptimisticThread = useCallback(\n (\n id: string,\n threadScope: ChatThreadScope | null,\n // When reviving a tab the user left open in a prior session, pass the\n // persisted last-seen time so the 12h stale-tab cleanup can still age\n // it out. Omit for genuinely new tabs (defaults to now).\n seedAt?: number,\n ) => {\n const stamp =\n typeof seedAt === \"number\" && Number.isFinite(seedAt)\n ? seedAt\n : Date.now();\n const optimistic: ChatThreadSummary = {\n id,\n title: \"\",\n preview: \"\",\n messageCount: 0,\n createdAt: stamp,\n updatedAt: stamp,\n scope: threadScope,\n };\n optimisticThreadScopesRef.current.set(id, threadScope);\n setThreads((prev) =>\n prev.some((t) => t.id === id) ? prev : [optimistic, ...prev],\n );\n },\n [],\n );\n\n // Initial load: load threads from server, then reconcile against the\n // saved active thread.\n //\n // - savedId in loadedThreads → keep it (user's last conversation).\n // - savedId in newlyCreatedRef (we just created it this session) → keep\n // it; the server hasn't seen it yet because there's no POST anymore,\n // the row gets written when the user sends a message.\n // - savedId is set but neither on the server nor newly created here →\n // it's an empty tab the user left open. A never-messaged tab is never\n // POSTed (that was the 127-ghost-threads problem), and the only record\n // that it's a deliberately-open tab — newlyCreatedRef — is wiped by the\n // reload. So on refresh we can't tell it apart from a stale ghost.\n // Keep it exactly as the user left it: re-register it as an optimistic\n // empty tab rather than resurrecting an unrelated old conversation. The\n // composer is fully functional with this id (the server writes the row\n // on first message, same as any new tab), so there's no 404 to avoid.\n // This is what makes \"the state you left is the state you see on\n // refresh\" hold — stale (>12h) tabs are still cleared downstream.\n // - No savedId → synthesize a fresh local id (no POST; server creates the\n // row on first message). The server may contain chats from another\n // branch, preview, or project that shares the same user/database, so\n // auto-opening the latest server thread here leaks unrelated context into\n // a fresh surface. Existing threads remain available in History.\n useEffect(() => {\n if (fetchedRef.current) return;\n fetchedRef.current = true;\n\n (async () => {\n setIsLoading(true);\n const loadedThreads = await fetchThreads();\n const savedId = activeThreadIdRef.current;\n\n if (\n savedId &&\n !newlyCreatedRef.current.has(savedId) &&\n !(loadedThreads ?? []).some((t) => t.id === savedId)\n ) {\n // The tab the user left open isn't a server thread and we didn't\n // create it this session (newlyCreatedRef was wiped by the\n // reload). Treat it as the empty tab it is — keep its id and\n // surface it as an optimistic thread so the tab bar restores it\n // verbatim instead of yanking in the most-recent old chat.\n newlyCreatedRef.current.add(savedId);\n // Seed from the persisted last-seen time (not now) so a tab the\n // user abandoned >12h ago is correctly recognized as stale and\n // pruned by the downstream cleanup instead of living forever.\n let seenAt: number | undefined;\n try {\n const raw = localStorage.getItem(activeThreadSeenKey);\n const parsed = raw ? Number.parseInt(raw, 10) : NaN;\n if (Number.isFinite(parsed)) seenAt = parsed;\n } catch {\n // localStorage unavailable — fall back to now (current behaviour).\n }\n addOptimisticThread(savedId, scopeRef.current ?? null, seenAt);\n // activeThreadId already === savedId from the localStorage\n // initializer; nothing else to set.\n } else if (!savedId) {\n if (typeof crypto !== \"undefined\" && crypto.randomUUID) {\n // Brand new surface — synthesize a local id so the composer has a\n // target. No POST: the server creates the row on first send.\n const id = crypto.randomUUID();\n newlyCreatedRef.current.add(id);\n addOptimisticThread(id, scopeRef.current ?? null);\n setActiveThreadId(id);\n }\n }\n setIsLoading(false);\n })();\n }, [fetchThreads, addOptimisticThread]);\n\n const createThread = useCallback(\n (preferredId?: string): Promise<string | null> => {\n // Generate ID client-side for instant UI response. No POST — the\n // server creates the row when the user actually sends a message,\n // which prevents accumulation of empty thread rows when the user\n // clicks \"+\" but never chats.\n const id = preferredId || crypto.randomUUID();\n newlyCreatedRef.current.add(id);\n addOptimisticThread(id, scopeRef.current ?? null);\n setActiveThreadId(id);\n return Promise.resolve(id);\n },\n [addOptimisticThread],\n );\n\n // Drop a thread's scope so it becomes a general (cross-resource) chat.\n // This is the \"Detach from <deck>\" escape hatch in the UI. The PUT\n // also bumps the thread's updatedAt so it surfaces in the All Chats\n // list right away.\n const detachThread = useCallback(\n async (threadId: string): Promise<void> => {\n try {\n await fetch(`${apiUrl}/threads/${encodeURIComponent(threadId)}`, {\n method: \"PUT\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ scope: null }),\n });\n setThreads((prev) =>\n prev.map((t) => (t.id === threadId ? { ...t, scope: null } : t)),\n );\n optimisticThreadScopesRef.current.set(threadId, null);\n } catch {}\n },\n [apiUrl],\n );\n\n const isNewThread = useCallback(\n (id: string) => newlyCreatedRef.current.has(id),\n [],\n );\n\n const switchThread = useCallback((id: string) => {\n setActiveThreadId(id);\n }, []);\n\n const removeThread = useCallback(\n async (id: string) => {\n try {\n await fetch(`${apiUrl}/threads/${encodeURIComponent(id)}`, {\n method: \"DELETE\",\n });\n } catch {}\n optimisticThreadScopesRef.current.delete(id);\n setThreads((prev) => {\n const next = prev.filter((t) => t.id !== id);\n if (id === activeThreadId) {\n // Switch to the next available thread, or create new if empty\n if (next.length > 0) {\n setActiveThreadId(next[0].id);\n } else {\n // Create a new thread\n createThread();\n }\n }\n return next;\n });\n },\n [apiUrl, activeThreadId, createThread],\n );\n\n // Ref to look up the latest scope of a known thread inside\n // saveThreadData without making the callback re-create on every\n // setThreads. The thread's scope is owned by createThread /\n // detachThread / fetchThreads — saveThreadData just mirrors it on\n // every save so the server eventually catches up after\n // persistSubmittedUserMessage creates the row sans scope.\n const saveThreadData = useCallback(\n async (\n id: string,\n data: {\n threadData: string;\n title: string;\n preview: string;\n messageCount?: number;\n },\n ) => {\n try {\n const localScope =\n threadsRef.current.find((t) => t.id === id)?.scope ?? null;\n await fetch(`${apiUrl}/threads/${encodeURIComponent(id)}`, {\n method: \"PUT\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ ...data, scope: localScope }),\n });\n // Update local thread list metadata. If the thread isn't in our\n // local list yet (an optimistic-only thread that the server just\n // created via persistSubmittedUserMessage), add it so HistoryPopover\n // can show it once it has messages.\n setThreads((prev) => {\n const exists = prev.some((t) => t.id === id);\n if (exists) {\n return prev.map((t) =>\n t.id === id\n ? {\n ...t,\n title: data.title,\n preview: data.preview,\n ...(data.messageCount != null && {\n messageCount: data.messageCount,\n }),\n updatedAt: Date.now(),\n }\n : t,\n );\n }\n const now = Date.now();\n return [\n {\n id,\n title: data.title,\n preview: data.preview,\n messageCount: data.messageCount ?? 0,\n createdAt: now,\n updatedAt: now,\n scope: scopeRef.current ?? null,\n },\n ...prev,\n ];\n });\n } catch {}\n },\n [apiUrl],\n );\n\n const generateTitle = useCallback(\n async (threadId: string, message: string): Promise<string | null> => {\n try {\n const res = await fetch(`${apiUrl}/generate-title`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ message }),\n });\n if (!res.ok) return null;\n const data = await res.json();\n const title = data.title;\n if (!title) return null;\n // Update the title in local state\n setThreads((prev) =>\n prev.map((t) => (t.id === threadId ? { ...t, title } : t)),\n );\n return title;\n } catch {\n return null;\n }\n },\n [apiUrl],\n );\n\n const forkThread = useCallback(\n async (\n sourceId: string,\n sourceSnapshot?: ChatThreadSnapshot | null,\n ): Promise<string | null> => {\n const id = crypto.randomUUID();\n const fallbackForkFromSnapshot = async (\n source: ForkSnapshotWithScope,\n ): Promise<ChatThreadSummary | null> => {\n const title = source.title ? `${source.title} (fork)` : \"\";\n const createdAt = Date.now();\n const createRes = await fetch(`${apiUrl}/threads`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n id,\n title,\n ...(source.scope ? { scope: source.scope } : {}),\n }),\n });\n if (!createRes.ok) return null;\n\n const saveRes = await fetch(\n `${apiUrl}/threads/${encodeURIComponent(id)}`,\n {\n method: \"PUT\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n threadData: source.threadData,\n title,\n preview: source.preview,\n messageCount: source.messageCount,\n scope: source.scope,\n }),\n },\n );\n if (!saveRes.ok) return null;\n\n return {\n id,\n title,\n preview: source.preview,\n messageCount: source.messageCount,\n createdAt,\n updatedAt: Date.now(),\n scope: source.scope,\n };\n };\n\n try {\n const localScope =\n threadsRef.current.find((t) => t.id === sourceId)?.scope ?? null;\n const source =\n sourceSnapshot && sourceSnapshot.messageCount > 0\n ? { ...sourceSnapshot, scope: localScope }\n : undefined;\n const res = await fetch(\n `${apiUrl}/threads/${encodeURIComponent(sourceId)}/fork`,\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ id, ...(source ? { source } : {}) }),\n },\n );\n let thread: ChatThreadSummary | null = null;\n if (!res.ok) {\n // Surface failures so a click on the Fork button isn't a silent\n // no-op when the source thread can't be found or auth has lapsed.\n console.error(\n `[chat] fork failed for ${sourceId}: ${res.status} ${res.statusText}`,\n );\n if (source && (res.status === 404 || res.status === 405)) {\n thread = await fallbackForkFromSnapshot(source);\n }\n if (!thread) return null;\n } else {\n thread = await res.json();\n }\n setThreads((prev) => [\n {\n id: thread.id,\n title: thread.title,\n preview: thread.preview,\n messageCount: thread.messageCount,\n createdAt: thread.createdAt,\n updatedAt: thread.updatedAt,\n scope: thread.scope ?? null,\n },\n ...prev,\n ]);\n return thread.id;\n } catch (err) {\n console.error(`[chat] fork threw for ${sourceId}:`, err);\n return null;\n }\n },\n [apiUrl],\n );\n\n const searchThreads = useCallback(\n async (query: string): Promise<ChatThreadSummary[]> => {\n try {\n const res = await fetch(\n `${apiUrl}/threads?q=${encodeURIComponent(query)}`,\n );\n if (!res.ok) return [];\n const data = await res.json();\n return data.threads ?? [];\n } catch {\n return [];\n }\n },\n [apiUrl],\n );\n\n const refreshThreads = useCallback(() => {\n fetchThreads();\n }, [fetchThreads]);\n\n return {\n threads,\n activeThreadId,\n isLoading,\n createThread,\n switchThread,\n deleteThread: removeThread,\n detachThread,\n forkThread,\n saveThreadData,\n generateTitle,\n searchThreads,\n refreshThreads,\n isNewThread,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"use-chat-threads.js","sourceRoot":"","sources":["../../src/client/use-chat-threads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AA8ChD,MAAM,iBAAiB,GAAG,0BAA0B,CAAC;AACrD,MAAM,qBAAqB,GAAG,4BAA4B,CAAC;AAE3D,SAAS,kBAAkB;IACzB,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO;IAC1C,MAAM,CAAC,aAAa,CAAC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,QAAQ,GAAG,EAAE,GAAG,CAAC,CAAC;YACzD,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC,EACD,CAAC,MAAM,CAAC,CACT,CAAC;IAEF,MAAM,aAAa,GAAG,WAAW,CAC/B,KAAK,EAAE,KAAa,EAAgC,EAAE;QACpD,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,KAAK,CACrB,GAAG,MAAM,cAAc,kBAAkB,CAAC,KAAK,CAAC,EAAE,CACnD,CAAC;YACF,IAAI,CAAC,GAAG,CAAC,EAAE;gBAAE,OAAO,EAAE,CAAC;YACvB,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;YAC9B,OAAO,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;QAC5B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC,EACD,CAAC,MAAM,CAAC,CACT,CAAC;IAEF,MAAM,cAAc,GAAG,WAAW,CAAC,GAAG,EAAE;QACtC,YAAY,EAAE,CAAC;IACjB,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,OAAO;QACL,OAAO;QACP,cAAc;QACd,SAAS;QACT,YAAY;QACZ,YAAY;QACZ,YAAY,EAAE,YAAY;QAC1B,YAAY;QACZ,UAAU;QACV,cAAc;QACd,aAAa;QACb,aAAa;QACb,cAAc;QACd,WAAW;KACZ,CAAC;AACJ,CAAC","sourcesContent":["import { useState, useEffect, useCallback, useRef, useMemo } from \"react\";\nimport { agentNativePath } from \"./api-path.js\";\n\nexport interface ChatThreadScope {\n type: string;\n id: string;\n label?: string;\n}\n\nexport interface ChatThreadSummary {\n id: string;\n title: string;\n preview: string;\n messageCount: number;\n createdAt: number;\n updatedAt: number;\n scope: ChatThreadScope | null;\n}\n\nexport interface ChatThreadData {\n id: string;\n ownerEmail: string;\n title: string;\n preview: string;\n threadData: string;\n messageCount: number;\n createdAt: number;\n updatedAt: number;\n scope: ChatThreadScope | null;\n}\n\nexport interface ChatThreadSnapshot {\n threadData: string;\n title: string;\n preview: string;\n messageCount: number;\n}\n\ninterface ForkSnapshotWithScope extends ChatThreadSnapshot {\n scope: ChatThreadScope | null;\n}\n\nexport interface UseChatThreadsOptions {\n /** Create an optimistic empty thread on mount when no active thread exists. */\n autoCreate?: boolean;\n}\n\nconst ACTIVE_THREAD_KEY = \"agent-chat-active-thread\";\nconst THREADS_UPDATED_EVENT = \"agent-chat:threads-updated\";\n\nfunction emitThreadsUpdated() {\n if (typeof window === \"undefined\") return;\n window.dispatchEvent(new CustomEvent(THREADS_UPDATED_EVENT));\n}\n\nfunction scopeKeySegment(scope?: ChatThreadScope | null): string {\n if (!scope) return \"\";\n return `:scope:${scope.type}:${scope.id}`;\n}\n\nfunction activeThreadStorageKey(\n storageKey?: string,\n scope?: ChatThreadScope | null,\n): string {\n const scopePart = scopeKeySegment(scope);\n return storageKey\n ? `${ACTIVE_THREAD_KEY}:${storageKey}${scopePart}`\n : `${ACTIVE_THREAD_KEY}${scopePart}`;\n}\n\nfunction activeThreadSeenStorageKey(activeThreadKey: string): string {\n return `${activeThreadKey}:seen`;\n}\n\nfunction scopesMatch(\n a?: ChatThreadScope | null,\n b?: ChatThreadScope | null,\n): boolean {\n if (!a || !b) return false;\n return a.type === b.type && a.id === b.id;\n}\n\nfunction threadCanStayVisibleInScope(\n threadScope: ChatThreadScope | null,\n currentScope?: ChatThreadScope | null,\n): boolean {\n if (!threadScope) return true;\n return scopesMatch(threadScope, currentScope);\n}\n\nexport function useChatThreads(\n apiUrl = agentNativePath(\"/_agent-native/agent-chat\"),\n storageKey?: string,\n scope?: ChatThreadScope | null,\n options?: UseChatThreadsOptions,\n) {\n const autoCreate = options?.autoCreate !== false;\n // Each (storageKey, scope) pair gets its own active-thread localStorage key\n // for chats that belong to a resource. General chats keep using the unscoped\n // key even while the user is looking at a resource, so clicking into a deck,\n // design, form, etc. doesn't make a global conversation vanish.\n const activeThreadKey = useMemo(() => {\n return activeThreadStorageKey(storageKey, scope);\n }, [storageKey, scope?.type, scope?.id]);\n // Companion key recording when the saved active thread was last live in\n // this client. A revived orphan tab (id in localStorage but not on the\n // server and not created this session) must keep its real last-seen time\n // so the 12h stale-tab cleanup can age it out — stamping it `Date.now()`\n // on every mount (the old behaviour) reset the clock forever, so\n // abandoned empty tabs never got pruned.\n const activeThreadSeenKey = useMemo(\n () => activeThreadSeenStorageKey(activeThreadKey),\n [activeThreadKey],\n );\n const [threads, setThreads] = useState<ChatThreadSummary[]>([]);\n const threadsRef = useRef<ChatThreadSummary[]>(threads);\n threadsRef.current = threads;\n\n // IDs we generated client-side this session — consumers use this to know\n // whether to skip the per-thread restore skeleton, and we use it to\n // protect the optimistic-only thread from being yanked out of local\n // state when the server's threads list (which never sees it) loads.\n const newlyCreatedRef = useRef<Set<string>>(new Set());\n const optimisticThreadScopesRef = useRef<Map<string, ChatThreadScope | null>>(\n new Map(),\n );\n\n // Latest scope as a ref so `createThread` (a useCallback that we don't\n // want to depend on scope identity) reads the current value at call\n // time. The scope a new chat inherits is the one in effect when the +\n // button is clicked, not when the hook first mounted.\n const scopeRef = useRef<ChatThreadScope | null | undefined>(scope);\n scopeRef.current = scope;\n\n const readKnownThreadScope = useCallback(\n (id: string): ChatThreadScope | null | undefined => {\n const thread = threadsRef.current.find((t) => t.id === id);\n if (thread) return thread.scope ?? null;\n if (optimisticThreadScopesRef.current.has(id)) {\n return optimisticThreadScopesRef.current.get(id) ?? null;\n }\n return undefined;\n },\n [],\n );\n\n // Restore the saved active thread synchronously on mount so the chat shell\n // can paint immediately. We do NOT synthesize a fresh UUID here when no\n // saved id exists — that flow was creating empty `chat_threads` rows on\n // every page load via the optimistic POST, even if the user never chatted.\n // (Steve's account had 127 threads; 112 had message_count=0 and zero\n // agent_runs — pure ghosts.) When localStorage is empty, the initial\n // useEffect picks the most-recent server thread, or synthesizes a brand\n // new id only when there are no server threads at all.\n const [activeThreadId, setActiveThreadId] = useState<string | null>(() => {\n if (typeof window === \"undefined\") return null;\n try {\n return localStorage.getItem(activeThreadKey);\n } catch {\n return null;\n }\n });\n const [isLoading, setIsLoading] = useState(true);\n const fetchedRef = useRef(false);\n const activeThreadIdRef = useRef(activeThreadId);\n activeThreadIdRef.current = activeThreadId;\n\n // Persist active thread ID — and rehydrate on scope flips. When the user\n // navigates from deck A to deck B, `activeThreadKey` changes; we re-read B's\n // scoped thread only if the currently visible chat is itself scoped to a\n // different resource. Unscoped chats are global and stay visible.\n const persistedKeyRef = useRef(activeThreadKey);\n useEffect(() => {\n if (persistedKeyRef.current !== activeThreadKey) {\n const currentId = activeThreadIdRef.current;\n if (currentId) {\n const currentThreadScope = readKnownThreadScope(currentId);\n // Thread metadata not yet loaded from the server — we can't tell\n // whether the visible chat is general (stays) or scoped-elsewhere\n // (swaps). Defer until `threads` resolves and this effect re-runs;\n // we intentionally do NOT update `persistedKeyRef` so the next\n // render gets another shot. Without this guard, navigating into a\n // resource before `GET /threads` resolves silently dropped the\n // active general chat the user was just in.\n if (currentThreadScope === undefined) {\n return;\n }\n if (threadCanStayVisibleInScope(currentThreadScope, scopeRef.current)) {\n persistedKeyRef.current = activeThreadKey;\n return;\n }\n }\n persistedKeyRef.current = activeThreadKey;\n try {\n setActiveThreadId(localStorage.getItem(activeThreadKey));\n } catch {\n setActiveThreadId(null);\n }\n return;\n }\n try {\n if (activeThreadId) {\n const threadScope = readKnownThreadScope(activeThreadId);\n if (threadScope === undefined) return;\n const targetKey = activeThreadStorageKey(storageKey, threadScope);\n localStorage.setItem(targetKey, activeThreadId);\n localStorage.setItem(\n activeThreadSeenStorageKey(targetKey),\n String(Date.now()),\n );\n } else {\n localStorage.removeItem(activeThreadKey);\n localStorage.removeItem(activeThreadSeenKey);\n }\n } catch {}\n }, [\n activeThreadId,\n activeThreadKey,\n activeThreadSeenKey,\n readKnownThreadScope,\n storageKey,\n threads,\n ]);\n\n const fetchThreads = useCallback(async () => {\n try {\n const res = await fetch(`${apiUrl}/threads`);\n if (!res.ok) return;\n const data = await res.json();\n setThreads((prev) => {\n const loaded = (data.threads ?? []) as ChatThreadSummary[];\n const loadedIds = new Set(loaded.map((t) => t.id));\n // Preserve any optimistic threads we've created this session that\n // haven't shown up in the server list yet — the server only learns\n // about a thread when the user actually sends a message and the\n // agent run's `persistSubmittedUserMessage` writes the row.\n const optimisticOnly = prev.filter(\n (t) => newlyCreatedRef.current.has(t.id) && !loadedIds.has(t.id),\n );\n // Reconcile each server thread against our local copy. If the local\n // copy has a newer updatedAt or higher messageCount, keep those\n // fields — the server probably hasn't observed the user's latest\n // send yet, and naively replacing makes the recent-chats list\n // visibly jump back to older timestamps right after a send.\n const merged = loaded.map((server) => {\n const local = prev.find((t) => t.id === server.id);\n if (!local) return server;\n const next = { ...server };\n if (local.updatedAt > server.updatedAt) {\n next.updatedAt = local.updatedAt;\n }\n if (local.messageCount > server.messageCount) {\n next.messageCount = local.messageCount;\n if (local.preview) next.preview = local.preview;\n if (local.title) next.title = local.title;\n }\n // Preserve optimistic scope: when the server creates the row\n // on first message it does so without scope, and the next PUT\n // (saveThreadData) writes the local scope back. In the brief\n // window between those, the server list returns scope: null\n // while the user is clearly working inside a deck — keep the\n // local value so the tab bar doesn't blink unscoped.\n if (local.scope && !server.scope) {\n next.scope = local.scope;\n }\n return next;\n });\n return [...optimisticOnly, ...merged];\n });\n return data.threads as ChatThreadSummary[];\n } catch {\n return undefined;\n }\n }, [apiUrl]);\n\n // Add a client-generated thread to the local list optimistically.\n //\n // Critically, this does NOT `POST /threads` to the server — that path was\n // creating an empty row in `chat_threads` (message_count=0, no\n // agent_runs) on every page mount and every \"+\" click. The server\n // already creates the row idempotently the moment the user actually\n // sends their first message (`persistSubmittedUserMessage` →\n // `createThread`), so the client doesn't need to pre-create it. This\n // makes the threads table reflect real conversations only.\n const addOptimisticThread = useCallback(\n (\n id: string,\n threadScope: ChatThreadScope | null,\n // When reviving a tab the user left open in a prior session, pass the\n // persisted last-seen time so the 12h stale-tab cleanup can still age\n // it out. Omit for genuinely new tabs (defaults to now).\n seedAt?: number,\n ) => {\n const stamp =\n typeof seedAt === \"number\" && Number.isFinite(seedAt)\n ? seedAt\n : Date.now();\n const optimistic: ChatThreadSummary = {\n id,\n title: \"\",\n preview: \"\",\n messageCount: 0,\n createdAt: stamp,\n updatedAt: stamp,\n scope: threadScope,\n };\n optimisticThreadScopesRef.current.set(id, threadScope);\n setThreads((prev) =>\n prev.some((t) => t.id === id) ? prev : [optimistic, ...prev],\n );\n },\n [],\n );\n\n // Initial load: load threads from server, then reconcile against the\n // saved active thread.\n //\n // - savedId in loadedThreads → keep it (user's last conversation).\n // - savedId in newlyCreatedRef (we just created it this session) → keep\n // it; the server hasn't seen it yet because there's no POST anymore,\n // the row gets written when the user sends a message.\n // - savedId is set but neither on the server nor newly created here →\n // it's an empty tab the user left open. A never-messaged tab is never\n // POSTed (that was the 127-ghost-threads problem), and the only record\n // that it's a deliberately-open tab — newlyCreatedRef — is wiped by the\n // reload. So on refresh we can't tell it apart from a stale ghost.\n // Keep it exactly as the user left it: re-register it as an optimistic\n // empty tab rather than resurrecting an unrelated old conversation. The\n // composer is fully functional with this id (the server writes the row\n // on first message, same as any new tab), so there's no 404 to avoid.\n // This is what makes \"the state you left is the state you see on\n // refresh\" hold — stale (>12h) tabs are still cleared downstream.\n // - No savedId → synthesize a fresh local id (no POST; server creates the\n // row on first message). The server may contain chats from another\n // branch, preview, or project that shares the same user/database, so\n // auto-opening the latest server thread here leaks unrelated context into\n // a fresh surface. Existing threads remain available in History.\n useEffect(() => {\n if (fetchedRef.current) return;\n fetchedRef.current = true;\n\n (async () => {\n setIsLoading(true);\n const loadedThreads = await fetchThreads();\n const savedId = activeThreadIdRef.current;\n\n if (\n savedId &&\n !newlyCreatedRef.current.has(savedId) &&\n !(loadedThreads ?? []).some((t) => t.id === savedId)\n ) {\n // The tab the user left open isn't a server thread and we didn't\n // create it this session (newlyCreatedRef was wiped by the\n // reload). Treat it as the empty tab it is — keep its id and\n // surface it as an optimistic thread so the tab bar restores it\n // verbatim instead of yanking in the most-recent old chat.\n newlyCreatedRef.current.add(savedId);\n // Seed from the persisted last-seen time (not now) so a tab the\n // user abandoned >12h ago is correctly recognized as stale and\n // pruned by the downstream cleanup instead of living forever.\n let seenAt: number | undefined;\n try {\n const raw = localStorage.getItem(activeThreadSeenKey);\n const parsed = raw ? Number.parseInt(raw, 10) : NaN;\n if (Number.isFinite(parsed)) seenAt = parsed;\n } catch {\n // localStorage unavailable — fall back to now (current behaviour).\n }\n addOptimisticThread(savedId, scopeRef.current ?? null, seenAt);\n // activeThreadId already === savedId from the localStorage\n // initializer; nothing else to set.\n } else if (!savedId && autoCreate) {\n if (typeof crypto !== \"undefined\" && crypto.randomUUID) {\n // Brand new surface — synthesize a local id so the composer has a\n // target. No POST: the server creates the row on first send.\n const id = crypto.randomUUID();\n newlyCreatedRef.current.add(id);\n addOptimisticThread(id, scopeRef.current ?? null);\n setActiveThreadId(id);\n }\n }\n setIsLoading(false);\n })();\n }, [fetchThreads, addOptimisticThread, autoCreate]);\n\n const createThread = useCallback(\n (preferredId?: string): Promise<string | null> => {\n // Generate ID client-side for instant UI response. No POST — the\n // server creates the row when the user actually sends a message,\n // which prevents accumulation of empty thread rows when the user\n // clicks \"+\" but never chats.\n const id = preferredId || crypto.randomUUID();\n newlyCreatedRef.current.add(id);\n addOptimisticThread(id, scopeRef.current ?? null);\n setActiveThreadId(id);\n return Promise.resolve(id);\n },\n [addOptimisticThread],\n );\n\n // Drop a thread's scope so it becomes a general (cross-resource) chat.\n // This is the \"Detach from <deck>\" escape hatch in the UI. The PUT\n // also bumps the thread's updatedAt so it surfaces in the All Chats\n // list right away.\n const detachThread = useCallback(\n async (threadId: string): Promise<void> => {\n try {\n await fetch(`${apiUrl}/threads/${encodeURIComponent(threadId)}`, {\n method: \"PUT\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ scope: null }),\n });\n setThreads((prev) =>\n prev.map((t) => (t.id === threadId ? { ...t, scope: null } : t)),\n );\n optimisticThreadScopesRef.current.set(threadId, null);\n emitThreadsUpdated();\n } catch {}\n },\n [apiUrl],\n );\n\n const isNewThread = useCallback(\n (id: string) => newlyCreatedRef.current.has(id),\n [],\n );\n\n const switchThread = useCallback((id: string) => {\n setActiveThreadId(id);\n }, []);\n\n const removeThread = useCallback(\n async (id: string) => {\n try {\n await fetch(`${apiUrl}/threads/${encodeURIComponent(id)}`, {\n method: \"DELETE\",\n });\n emitThreadsUpdated();\n } catch {}\n optimisticThreadScopesRef.current.delete(id);\n setThreads((prev) => {\n const next = prev.filter((t) => t.id !== id);\n if (id === activeThreadId) {\n // Switch to the next available thread, or create new if empty\n if (next.length > 0) {\n setActiveThreadId(next[0].id);\n } else {\n // Create a new thread\n createThread();\n }\n }\n return next;\n });\n },\n [apiUrl, activeThreadId, createThread],\n );\n\n // Ref to look up the latest scope of a known thread inside\n // saveThreadData without making the callback re-create on every\n // setThreads. The thread's scope is owned by createThread /\n // detachThread / fetchThreads — saveThreadData just mirrors it on\n // every save so the server eventually catches up after\n // persistSubmittedUserMessage creates the row sans scope.\n const saveThreadData = useCallback(\n async (\n id: string,\n data: {\n threadData: string;\n title: string;\n preview: string;\n messageCount?: number;\n },\n ) => {\n try {\n const localScope =\n threadsRef.current.find((t) => t.id === id)?.scope ?? null;\n await fetch(`${apiUrl}/threads/${encodeURIComponent(id)}`, {\n method: \"PUT\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ ...data, scope: localScope }),\n });\n emitThreadsUpdated();\n // Update local thread list metadata. If the thread isn't in our\n // local list yet (an optimistic-only thread that the server just\n // created via persistSubmittedUserMessage), add it so HistoryPopover\n // can show it once it has messages.\n setThreads((prev) => {\n const exists = prev.some((t) => t.id === id);\n if (exists) {\n return prev.map((t) =>\n t.id === id\n ? {\n ...t,\n title: data.title,\n preview: data.preview,\n ...(data.messageCount != null && {\n messageCount: data.messageCount,\n }),\n updatedAt: Date.now(),\n }\n : t,\n );\n }\n const now = Date.now();\n return [\n {\n id,\n title: data.title,\n preview: data.preview,\n messageCount: data.messageCount ?? 0,\n createdAt: now,\n updatedAt: now,\n scope: scopeRef.current ?? null,\n },\n ...prev,\n ];\n });\n } catch {}\n },\n [apiUrl],\n );\n\n const generateTitle = useCallback(\n async (threadId: string, message: string): Promise<string | null> => {\n try {\n const res = await fetch(`${apiUrl}/generate-title`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ message }),\n });\n if (!res.ok) return null;\n const data = await res.json();\n const title = data.title;\n if (!title) return null;\n // Update the title in local state\n setThreads((prev) =>\n prev.map((t) => (t.id === threadId ? { ...t, title } : t)),\n );\n return title;\n } catch {\n return null;\n }\n },\n [apiUrl],\n );\n\n const forkThread = useCallback(\n async (\n sourceId: string,\n sourceSnapshot?: ChatThreadSnapshot | null,\n ): Promise<string | null> => {\n const id = crypto.randomUUID();\n const fallbackForkFromSnapshot = async (\n source: ForkSnapshotWithScope,\n ): Promise<ChatThreadSummary | null> => {\n const title = source.title ? `${source.title} (fork)` : \"\";\n const createdAt = Date.now();\n const createRes = await fetch(`${apiUrl}/threads`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n id,\n title,\n ...(source.scope ? { scope: source.scope } : {}),\n }),\n });\n if (!createRes.ok) return null;\n\n const saveRes = await fetch(\n `${apiUrl}/threads/${encodeURIComponent(id)}`,\n {\n method: \"PUT\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n threadData: source.threadData,\n title,\n preview: source.preview,\n messageCount: source.messageCount,\n scope: source.scope,\n }),\n },\n );\n if (!saveRes.ok) return null;\n\n return {\n id,\n title,\n preview: source.preview,\n messageCount: source.messageCount,\n createdAt,\n updatedAt: Date.now(),\n scope: source.scope,\n };\n };\n\n try {\n const localScope =\n threadsRef.current.find((t) => t.id === sourceId)?.scope ?? null;\n const source =\n sourceSnapshot && sourceSnapshot.messageCount > 0\n ? { ...sourceSnapshot, scope: localScope }\n : undefined;\n const res = await fetch(\n `${apiUrl}/threads/${encodeURIComponent(sourceId)}/fork`,\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ id, ...(source ? { source } : {}) }),\n },\n );\n let thread: ChatThreadSummary | null = null;\n if (!res.ok) {\n // Surface failures so a click on the Fork button isn't a silent\n // no-op when the source thread can't be found or auth has lapsed.\n console.error(\n `[chat] fork failed for ${sourceId}: ${res.status} ${res.statusText}`,\n );\n if (source && (res.status === 404 || res.status === 405)) {\n thread = await fallbackForkFromSnapshot(source);\n }\n if (!thread) return null;\n } else {\n thread = await res.json();\n }\n setThreads((prev) => [\n {\n id: thread.id,\n title: thread.title,\n preview: thread.preview,\n messageCount: thread.messageCount,\n createdAt: thread.createdAt,\n updatedAt: thread.updatedAt,\n scope: thread.scope ?? null,\n },\n ...prev,\n ]);\n emitThreadsUpdated();\n return thread.id;\n } catch (err) {\n console.error(`[chat] fork threw for ${sourceId}:`, err);\n return null;\n }\n },\n [apiUrl],\n );\n\n const searchThreads = useCallback(\n async (query: string): Promise<ChatThreadSummary[]> => {\n try {\n const res = await fetch(\n `${apiUrl}/threads?q=${encodeURIComponent(query)}`,\n );\n if (!res.ok) return [];\n const data = await res.json();\n return data.threads ?? [];\n } catch {\n return [];\n }\n },\n [apiUrl],\n );\n\n const refreshThreads = useCallback(() => {\n fetchThreads();\n }, [fetchThreads]);\n\n return {\n threads,\n activeThreadId,\n isLoading,\n createThread,\n switchThread,\n deleteThread: removeThread,\n detachThread,\n forkThread,\n saveThreadData,\n generateTitle,\n searchThreads,\n refreshThreads,\n isNewThread,\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/collab/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;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1B,6EAA6E;IAC7E,WAAW,EAAE,OAAO,CAAC;IACrB,+EAA+E;IAC/E,YAAY,EAAE,OAAO,CAAC;CACvB;AAgBD,4DAA4D;AAC5D,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMlD;AAED,mDAAmD;AACnD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGjD;AAYD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,UAAU,EAAE,CAY1E;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,uBAAuB,EAAE,GACtC;IAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CA2B3D;AAoBD,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,0BAA0B,GAClC,yBAAyB,CAgU3B"}
|
package/dist/collab/client.js
CHANGED
|
@@ -190,7 +190,7 @@ export function useCollaborativeDoc(options) {
|
|
|
190
190
|
if (data?.state) {
|
|
191
191
|
const binary = base64ToUint8Array(data.state);
|
|
192
192
|
if (binary.length > 4) {
|
|
193
|
-
Y.applyUpdate(ydoc, binary);
|
|
193
|
+
Y.applyUpdate(ydoc, binary, "remote");
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
setIsLoading(false);
|
|
@@ -265,6 +265,25 @@ export function useCollaborativeDoc(options) {
|
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
267
|
pollVersionRef.current = version;
|
|
268
|
+
try {
|
|
269
|
+
// The poll ring buffer is process-local. Fetching a state-vector diff
|
|
270
|
+
// makes collaboration durable across serverless invocations, process
|
|
271
|
+
// restarts, or any missed poll event.
|
|
272
|
+
const stateVector = uint8ArrayToBase64(Y.encodeStateVector(ydoc));
|
|
273
|
+
const stateRes = await fetch(`${baseUrl}/${docId}/state?stateVector=${encodeURIComponent(stateVector)}`);
|
|
274
|
+
if (stateRes.ok) {
|
|
275
|
+
const stateData = (await stateRes.json().catch(() => null));
|
|
276
|
+
if (stateData?.state) {
|
|
277
|
+
const binary = base64ToUint8Array(stateData.state);
|
|
278
|
+
if (binary.length > 2) {
|
|
279
|
+
Y.applyUpdate(ydoc, binary, "remote");
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
catch {
|
|
285
|
+
// The next poll retries; awareness should still sync below.
|
|
286
|
+
}
|
|
268
287
|
// Sync awareness (cursor positions)
|
|
269
288
|
if (awareness) {
|
|
270
289
|
const localState = awareness.getLocalState();
|