@tutti-os/agent-gui 0.0.22 → 0.0.23
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/agent-conversation/index.d.ts +2 -2
- package/dist/agent-conversation/index.js +3 -3
- package/dist/agent-message-center/index.d.ts +1 -1
- package/dist/agent-message-center/index.js +3 -3
- package/dist/{agentConversationVM-BVe64P2E.d.ts → agentConversationVM-CGYkOuOP.d.ts} +1 -0
- package/dist/{chunk-UUGCUPYW.js → chunk-3LVEFR2N.js} +2 -2
- package/dist/{chunk-6TRWLMRE.js → chunk-7Q3JKSQ5.js} +2 -2
- package/dist/{chunk-222YHU5Z.js → chunk-CCI6EK5W.js} +1 -1
- package/dist/chunk-CCI6EK5W.js.map +1 -0
- package/dist/{chunk-KRKC3XXB.js → chunk-MQAGIHYM.js} +61 -13
- package/dist/chunk-MQAGIHYM.js.map +1 -0
- package/dist/{chunk-64FJGJ3F.js → chunk-ZC4E2QJU.js} +3 -3
- package/dist/context-mention-palette/index.js +2 -2
- package/dist/index.d.ts +16 -1
- package/dist/index.js +17 -17
- package/dist/index.js.map +1 -1
- package/dist/plan-decision-ops.d.ts +1 -1
- package/package.json +12 -12
- package/dist/chunk-222YHU5Z.js.map +0 -1
- package/dist/chunk-KRKC3XXB.js.map +0 -1
- /package/dist/{chunk-UUGCUPYW.js.map → chunk-3LVEFR2N.js.map} +0 -0
- /package/dist/{chunk-6TRWLMRE.js.map → chunk-7Q3JKSQ5.js.map} +0 -0
- /package/dist/{chunk-64FJGJ3F.js.map → chunk-ZC4E2QJU.js.map} +0 -0
|
@@ -2,8 +2,8 @@ import * as react from 'react';
|
|
|
2
2
|
import { ReactNode, JSX } from 'react';
|
|
3
3
|
import { W as WorkspaceLinkAction } from '../workspaceLinkActions-CqWZaCY4.js';
|
|
4
4
|
import { A as AgentMessageMarkdownWorkspaceAppIcon } from '../AgentMessageMarkdown-DeYPURtF.js';
|
|
5
|
-
import { a as AgentConversationVM, W as WorkspaceAgentSessionDetailViewModel } from '../agentConversationVM-
|
|
6
|
-
export { B as BuildWorkspaceAgentSessionDetailInput, b as buildWorkspaceAgentSessionDetailViewModel } from '../agentConversationVM-
|
|
5
|
+
import { a as AgentConversationVM, W as WorkspaceAgentSessionDetailViewModel } from '../agentConversationVM-CGYkOuOP.js';
|
|
6
|
+
export { B as BuildWorkspaceAgentSessionDetailInput, b as buildWorkspaceAgentSessionDetailViewModel } from '../agentConversationVM-CGYkOuOP.js';
|
|
7
7
|
export { W as WorkspaceAgentActivityCard, n as WorkspaceAgentActivitySession, p as WorkspaceAgentActivityTimelineItem } from '../workspaceAgentActivityListViewModel-BK_J3aNX.js';
|
|
8
8
|
import '@tutti-os/workspace-issue-manager/core';
|
|
9
9
|
import '@tutti-os/agent-activity-core';
|
|
@@ -6,11 +6,11 @@ import {
|
|
|
6
6
|
projectAgentConversationVM,
|
|
7
7
|
reconcileProjectedAgentConversationVM,
|
|
8
8
|
useProjectedAgentConversation
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import "../chunk-
|
|
9
|
+
} from "../chunk-MQAGIHYM.js";
|
|
10
|
+
import "../chunk-7Q3JKSQ5.js";
|
|
11
11
|
import "../chunk-XAQQN6MP.js";
|
|
12
12
|
import "../chunk-XJ34OIEQ.js";
|
|
13
|
-
import "../chunk-
|
|
13
|
+
import "../chunk-CCI6EK5W.js";
|
|
14
14
|
import "../chunk-TYGL25EL.js";
|
|
15
15
|
import {
|
|
16
16
|
translate
|
|
@@ -4,7 +4,7 @@ import { I18nRuntime } from '@tutti-os/ui-i18n-runtime';
|
|
|
4
4
|
import { useTranslation, AgentGuiI18nLocale, TranslateFn } from '../i18n/index.js';
|
|
5
5
|
import { W as WorkspaceLinkAction } from '../workspaceLinkActions-CqWZaCY4.js';
|
|
6
6
|
import { AgentActivityNeedsAttentionItem, AgentActivitySnapshot } from '@tutti-os/agent-activity-core';
|
|
7
|
-
import { A as AgentConversationPromptVM } from '../agentConversationVM-
|
|
7
|
+
import { A as AgentConversationPromptVM } from '../agentConversationVM-CGYkOuOP.js';
|
|
8
8
|
import { o as WorkspaceAgentActivityStatus } from '../workspaceAgentActivityListViewModel-BK_J3aNX.js';
|
|
9
9
|
export { PLAN_IMPLEMENTATION_ACTION_IMPLEMENT, PLAN_IMPLEMENTATION_PROMPT } from '../plan-decision-ops.js';
|
|
10
10
|
import '@tutti-os/workspace-issue-manager/core';
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
approvalOptionDisplayLabel,
|
|
4
4
|
getPromptToolDetails,
|
|
5
5
|
isPromptRequestIdTitle
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-ZC4E2QJU.js";
|
|
7
7
|
import {
|
|
8
8
|
PLAN_IMPLEMENTATION_ACTION_IMPLEMENT,
|
|
9
9
|
PLAN_IMPLEMENTATION_PROMPT,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
cn,
|
|
17
17
|
extractAgentMcpToolTarget,
|
|
18
18
|
normalizeAskUserQuestions
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-7Q3JKSQ5.js";
|
|
20
20
|
import {
|
|
21
21
|
managedAgentRoundedIconUrl,
|
|
22
22
|
userAvatarPlaceholderUrl,
|
|
@@ -26,7 +26,7 @@ import "../chunk-MTFSQWZ6.js";
|
|
|
26
26
|
import {
|
|
27
27
|
resolveWorkspaceAgentSessionSortTimeUnixMs
|
|
28
28
|
} from "../chunk-IBIMGLCD.js";
|
|
29
|
-
import "../chunk-
|
|
29
|
+
import "../chunk-CCI6EK5W.js";
|
|
30
30
|
import {
|
|
31
31
|
workspaceAgentProviderLabel
|
|
32
32
|
} from "../chunk-TYGL25EL.js";
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-XAQQN6MP.js";
|
|
10
10
|
import {
|
|
11
11
|
getOptionalAgentHostApi
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-CCI6EK5W.js";
|
|
13
13
|
import {
|
|
14
14
|
AGENT_CONTEXT_MENTION_PROVIDER_IDS
|
|
15
15
|
} from "./chunk-JM24HADP.js";
|
|
@@ -2134,4 +2134,4 @@ export {
|
|
|
2134
2134
|
AgentFileMentionPalette,
|
|
2135
2135
|
AgentContextMentionPalette
|
|
2136
2136
|
};
|
|
2137
|
-
//# sourceMappingURL=chunk-
|
|
2137
|
+
//# sourceMappingURL=chunk-3LVEFR2N.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getOptionalAgentHostApi,
|
|
3
3
|
useOptionalAgentHostApi
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CCI6EK5W.js";
|
|
5
5
|
import {
|
|
6
6
|
useTranslation
|
|
7
7
|
} from "./chunk-GLDKFIWM.js";
|
|
@@ -2587,4 +2587,4 @@ export {
|
|
|
2587
2587
|
CustomScrollArea,
|
|
2588
2588
|
MessageSquareMoreIcon
|
|
2589
2589
|
};
|
|
2590
|
-
//# sourceMappingURL=chunk-
|
|
2590
|
+
//# sourceMappingURL=chunk-7Q3JKSQ5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../agentActivityRuntime.tsx","../agentActivityHost.tsx","../host/agentHostApi.ts"],"sourcesContent":["import {\n createContext,\n useContext,\n useSyncExternalStore,\n type JSX,\n type PropsWithChildren\n} from \"react\";\nimport type {\n AgentActivityCancelSessionInput,\n AgentActivityCancelSessionResult,\n AgentActivityCreateSessionInput,\n AgentActivityDeleteSessionInput,\n AgentActivityDeleteSessionResult,\n AgentActivityMessageOrder,\n AgentActivityMessagePage,\n AgentActivitySendInput,\n AgentActivitySession,\n AgentActivitySnapshot,\n AgentActivitySnapshotListener,\n AgentActivitySubmitInteractiveInput\n} from \"@tutti-os/agent-activity-core\";\nimport type {\n AgentHostAgentSessionComposerSettings,\n AgentHostActivateAgentSessionResult,\n AgentHostRuntimeOpenclawGatewayWarmupResult,\n AgentHostUpdateAgentSessionSettingsResult,\n AgentHostUnactivateAgentSessionResult,\n AgentHostAgentSessionState\n} from \"./shared/contracts/dto\";\n\nexport interface AgentActivityRuntimeListSessionMessagesInput {\n afterVersion?: number;\n beforeVersion?: number;\n agentSessionId: string;\n limit?: number;\n order?: AgentActivityMessageOrder;\n signal?: AbortSignal;\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeListGeneratedFilesInput {\n limit?: number;\n query?: string;\n sessionCwd?: string;\n signal?: AbortSignal;\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeGeneratedFile {\n label: string;\n path: string;\n}\n\nexport interface AgentActivityRuntimeGeneratedFileList {\n entries: AgentActivityRuntimeGeneratedFile[];\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeEnsureSessionSynchronizedInput {\n afterVersion?: number;\n agentSessionId: string;\n onError?: (error: unknown) => void;\n workspaceId: string;\n}\n\nexport type AgentActivityRuntimeRetainSessionEventsInput =\n AgentActivityRuntimeEnsureSessionSynchronizedInput;\n\nexport interface AgentActivityRuntimeSetSessionPinnedInput {\n agentSessionId: string;\n pinned: boolean;\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeTrackSettingsProjectChangeInput {\n action: \"clear\" | \"create_new\" | \"select_existing\";\n agentSessionId: string;\n provider?: string | null;\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeGetSessionControlStateInput {\n agentSessionId: string;\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeGetComposerOptionsInput {\n cwd?: string | null;\n force?: boolean;\n provider?: string;\n settings?: AgentHostAgentSessionComposerSettings | null;\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeUpdateSessionSettingsInput {\n agentSessionId: string;\n settings: AgentHostAgentSessionComposerSettings;\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeTrackDraftComposerSettingsChangeInput {\n nextSettings: AgentHostAgentSessionComposerSettings;\n previousSettings: AgentHostAgentSessionComposerSettings;\n provider: string;\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeWarmupOpenclawGatewayInput {\n workspaceId?: string | null;\n}\n\nexport interface AgentActivityRuntimeDiagnosticInput {\n details?: Record<string, unknown>;\n event: string;\n level?: \"debug\" | \"info\" | \"warn\" | \"error\";\n source?: string;\n workspaceId?: string | null;\n}\n\nexport interface AgentActivityRuntimeActivateSessionInput {\n agentSessionId: string;\n cwd?: string;\n initialContent?: AgentActivitySendInput[\"content\"];\n /** 仅展示用首轮文本(bundle 折叠成一个 chip);initialContent 仍带展开后的文件。 */\n initialDisplayPrompt?: string | null;\n mode: \"existing\" | \"new\";\n openclawGatewayReady?: boolean;\n provider?: string;\n settings?: AgentHostAgentSessionComposerSettings;\n title?: string;\n visible?: boolean;\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeUnactivateSessionInput {\n agentSessionId: string;\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeReadSessionAttachmentInput {\n agentSessionId: string;\n attachmentId: string;\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeReadPromptAssetInput {\n agentSessionId?: string | null;\n mimeType: string;\n name?: string | null;\n path?: string | null;\n sha256?: string | null;\n workspaceId: string;\n}\n\nexport type AgentActivityRuntimePromptContentBlock =\n AgentActivitySendInput[\"content\"][number] & {\n path?: string;\n };\n\nexport interface AgentActivityRuntimeUploadPromptContentInput {\n content: AgentActivityRuntimePromptContentBlock[];\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeUploadPromptContentResult {\n content: AgentActivityRuntimePromptContentBlock[];\n}\n\nexport interface AgentActivityRuntimeSessionAttachment {\n attachmentId: string;\n mimeType: string;\n name?: string;\n data: string;\n}\n\nexport interface AgentActivityRuntimePromptAsset {\n mimeType: string;\n name?: string;\n path: string;\n data: string;\n}\n\nexport interface AgentActivityRuntime {\n cancelSession(\n input: AgentActivityCancelSessionInput\n ): Promise<AgentActivityCancelSessionResult>;\n createSession(\n input: AgentActivityCreateSessionInput\n ): Promise<AgentActivitySession>;\n deleteSession(\n input: AgentActivityDeleteSessionInput\n ): Promise<AgentActivityDeleteSessionResult>;\n activateSession(\n input: AgentActivityRuntimeActivateSessionInput\n ): Promise<AgentHostActivateAgentSessionResult>;\n getSession(\n workspaceId: string,\n agentSessionId: string\n ): Promise<AgentActivitySession>;\n getComposerOptions(\n input: AgentActivityRuntimeGetComposerOptionsInput\n ): Promise<unknown>;\n updateSessionSettings(\n input: AgentActivityRuntimeUpdateSessionSettingsInput\n ): Promise<AgentHostUpdateAgentSessionSettingsResult>;\n warmupOpenclawGateway?(\n input?: AgentActivityRuntimeWarmupOpenclawGatewayInput\n ): Promise<AgentHostRuntimeOpenclawGatewayWarmupResult>;\n getSessionControlState(\n input: AgentActivityRuntimeGetSessionControlStateInput\n ): Promise<AgentHostAgentSessionState>;\n getSnapshot(workspaceId: string): AgentActivitySnapshot;\n listSessionMessages(\n input: AgentActivityRuntimeListSessionMessagesInput\n ): Promise<AgentActivityMessagePage>;\n listAgentGeneratedFiles?(\n input: AgentActivityRuntimeListGeneratedFilesInput\n ): Promise<AgentActivityRuntimeGeneratedFileList>;\n load(\n workspaceId: string,\n signal?: AbortSignal\n ): Promise<AgentActivitySnapshot>;\n ensureSessionSynchronized?(\n input: AgentActivityRuntimeEnsureSessionSynchronizedInput\n ): () => void;\n /** @deprecated Use ensureSessionSynchronized. */\n retainSessionEvents(\n input: AgentActivityRuntimeRetainSessionEventsInput\n ): () => void;\n sendInput(input: AgentActivitySendInput): Promise<AgentActivitySession>;\n uploadPromptContent?(\n input: AgentActivityRuntimeUploadPromptContentInput\n ): Promise<AgentActivityRuntimeUploadPromptContentResult>;\n readSessionAttachment?(\n input: AgentActivityRuntimeReadSessionAttachmentInput\n ): Promise<AgentActivityRuntimeSessionAttachment>;\n readPromptAsset?(\n input: AgentActivityRuntimeReadPromptAssetInput\n ): Promise<AgentActivityRuntimePromptAsset>;\n setSessionPinned(\n input: AgentActivityRuntimeSetSessionPinnedInput\n ): Promise<AgentActivitySession>;\n trackSettingsProjectChange?(\n input: AgentActivityRuntimeTrackSettingsProjectChangeInput\n ): Promise<void>;\n trackDraftComposerSettingsChange?(\n input: AgentActivityRuntimeTrackDraftComposerSettingsChangeInput\n ): Promise<void>;\n reportDiagnostic?(\n input: AgentActivityRuntimeDiagnosticInput\n ): Promise<void> | void;\n unactivateSession(\n input: AgentActivityRuntimeUnactivateSessionInput\n ): Promise<AgentHostUnactivateAgentSessionResult>;\n submitInteractive(\n input: AgentActivitySubmitInteractiveInput\n ): Promise<unknown>;\n subscribeSessionEvents(\n workspaceId: string,\n listener: (event: unknown) => void\n ): () => void;\n subscribe(\n workspaceId: string,\n listener: AgentActivitySnapshotListener\n ): () => void;\n}\n\nconst AgentActivityRuntimeContext = createContext<AgentActivityRuntime | null>(\n null\n);\n\nlet currentAgentActivityRuntime: AgentActivityRuntime | null = null;\n\nexport interface AgentActivityRuntimeProviderProps extends PropsWithChildren {\n runtime?: AgentActivityRuntime | null;\n}\n\nexport function AgentActivityRuntimeProvider({\n children,\n runtime\n}: AgentActivityRuntimeProviderProps): JSX.Element {\n currentAgentActivityRuntime = runtime ?? null;\n return (\n <AgentActivityRuntimeContext.Provider value={runtime ?? null}>\n {children}\n </AgentActivityRuntimeContext.Provider>\n );\n}\n\nexport function useAgentActivityRuntime(): AgentActivityRuntime {\n const runtime =\n useContext(AgentActivityRuntimeContext) ?? getTestAgentActivityRuntime();\n if (!runtime) {\n throw new Error(\n \"AgentActivityRuntimeProvider is missing an AgentActivityRuntime instance.\"\n );\n }\n return runtime;\n}\n\nexport function useOptionalAgentActivityRuntime(): AgentActivityRuntime | null {\n return (\n useContext(AgentActivityRuntimeContext) ?? getTestAgentActivityRuntime()\n );\n}\n\nexport function useAgentActivitySnapshot(\n workspaceId: string\n): AgentActivitySnapshot {\n const runtime = useAgentActivityRuntime();\n const normalizedWorkspaceId = workspaceId.trim();\n return useSyncExternalStore(\n (listener) => runtime.subscribe(normalizedWorkspaceId, listener),\n () => runtime.getSnapshot(normalizedWorkspaceId),\n () => runtime.getSnapshot(normalizedWorkspaceId)\n );\n}\n\nexport function getAgentActivityRuntime(): AgentActivityRuntime {\n const runtime =\n getExplicitWindowTestAgentActivityRuntime() ??\n currentAgentActivityRuntime ??\n getTestAgentActivityRuntime();\n if (!runtime) {\n throw new Error(\n \"AgentActivityRuntimeProvider is missing an AgentActivityRuntime instance.\"\n );\n }\n return runtime;\n}\n\nexport function getOptionalAgentActivityRuntime(): AgentActivityRuntime | null {\n return (\n getExplicitWindowTestAgentActivityRuntime() ??\n currentAgentActivityRuntime ??\n getTestAgentActivityRuntime()\n );\n}\n\nexport function resetAgentActivityRuntimeForTests(): void {\n if (process.env.NODE_ENV === \"test\") {\n currentAgentActivityRuntime = null;\n }\n}\n\nexport function setAgentActivityRuntimeForTests(\n runtime: AgentActivityRuntime | null\n): void {\n if (process.env.NODE_ENV === \"test\") {\n currentAgentActivityRuntime = runtime;\n }\n}\n\nfunction getTestAgentActivityRuntime(): AgentActivityRuntime | null {\n if (process.env.NODE_ENV !== \"test\") {\n return null;\n }\n if (typeof window === \"undefined\") {\n return null;\n }\n const explicitRuntime = getExplicitWindowTestAgentActivityRuntime();\n if (explicitRuntime) {\n return explicitRuntime;\n }\n if (currentAgentActivityRuntime) {\n return currentAgentActivityRuntime;\n }\n const testRuntime = (\n window as unknown as Window & {\n agentActivityRuntime?: AgentActivityRuntime;\n }\n ).agentActivityRuntime;\n return testRuntime ?? null;\n}\n\nfunction getExplicitWindowTestAgentActivityRuntime(): AgentActivityRuntime | null {\n if (process.env.NODE_ENV !== \"test\" || typeof window === \"undefined\") {\n return null;\n }\n const testDescriptor = Object.getOwnPropertyDescriptor(\n window,\n \"agentActivityRuntime\"\n );\n if (!testDescriptor || !(\"value\" in testDescriptor)) {\n return null;\n }\n return (testDescriptor.value as AgentActivityRuntime | undefined) ?? null;\n}\n","import {\n createContext,\n useContext,\n useMemo,\n type JSX,\n type PropsWithChildren\n} from \"react\";\nimport {\n toAgentHostRuntimeApi,\n type AgentHostInputApi,\n type AgentHostRuntimeApi\n} from \"./host/agentHostApi\";\nimport {\n AgentActivityRuntimeProvider,\n type AgentActivityRuntime\n} from \"./agentActivityRuntime\";\n\nconst AgentActivityHostContext = createContext<AgentHostRuntimeApi | null>(\n null\n);\n\nlet currentAgentHostApi: AgentHostRuntimeApi | null = null;\n\nexport interface AgentActivityHostProviderProps extends PropsWithChildren {\n agentActivityRuntime?: AgentActivityRuntime | null;\n agentHostApi?: AgentHostInputApi | null;\n}\n\nexport function AgentActivityHostProvider({\n agentActivityRuntime,\n agentHostApi,\n children\n}: AgentActivityHostProviderProps): JSX.Element {\n const resolvedAgentHostApi = useMemo(\n () => (agentHostApi ? toAgentHostRuntimeApi(agentHostApi) : null),\n [agentHostApi]\n );\n currentAgentHostApi = resolvedAgentHostApi;\n return (\n <AgentActivityRuntimeProvider runtime={agentActivityRuntime}>\n <AgentActivityHostContext.Provider value={resolvedAgentHostApi}>\n {children}\n </AgentActivityHostContext.Provider>\n </AgentActivityRuntimeProvider>\n );\n}\n\nexport function useAgentHostApi(): AgentHostRuntimeApi {\n const agentHostApi =\n useContext(AgentActivityHostContext) ?? getTestAgentHostApi();\n if (!agentHostApi) {\n throw new Error(\n \"AgentActivityHostProvider is missing an agentHostApi instance.\"\n );\n }\n return agentHostApi;\n}\n\nexport function useOptionalAgentHostApi(): AgentHostRuntimeApi | null {\n return useContext(AgentActivityHostContext) ?? getTestAgentHostApi();\n}\n\nexport function getAgentHostApi(): AgentHostRuntimeApi {\n const agentHostApi =\n getExplicitWindowTestAgentHostApi() ??\n currentAgentHostApi ??\n getTestAgentHostApi();\n if (!agentHostApi) {\n throw new Error(\n \"AgentActivityHostProvider is missing an agentHostApi instance.\"\n );\n }\n return agentHostApi;\n}\n\nexport function getOptionalAgentHostApi(): AgentHostRuntimeApi | null {\n return (\n getExplicitWindowTestAgentHostApi() ??\n currentAgentHostApi ??\n getTestAgentHostApi()\n );\n}\n\nexport function resetAgentHostApiForTests(): void {\n if (process.env.NODE_ENV === \"test\") {\n currentAgentHostApi = null;\n }\n}\n\nexport function setAgentHostApiForTests(\n agentHostApi: AgentHostInputApi | AgentHostRuntimeApi | null\n): void {\n if (process.env.NODE_ENV === \"test\") {\n currentAgentHostApi = agentHostApi\n ? toAgentHostRuntimeApi(agentHostApi)\n : null;\n }\n}\n\nfunction getTestAgentHostApi(): AgentHostRuntimeApi | null {\n if (process.env.NODE_ENV !== \"test\") {\n return null;\n }\n if (typeof window === \"undefined\") {\n return null;\n }\n const explicitAgentHostApi = getExplicitWindowTestAgentHostApi();\n if (explicitAgentHostApi) {\n return explicitAgentHostApi;\n }\n if (currentAgentHostApi) {\n return currentAgentHostApi;\n }\n const testAgentHostApi = (\n window as unknown as Window & {\n agentHostApi?: AgentHostInputApi | AgentHostRuntimeApi;\n }\n ).agentHostApi;\n return testAgentHostApi ? toAgentHostRuntimeApi(testAgentHostApi) : null;\n}\n\nfunction getExplicitWindowTestAgentHostApi(): AgentHostRuntimeApi | null {\n if (process.env.NODE_ENV !== \"test\" || typeof window === \"undefined\") {\n return null;\n }\n const testDescriptor = Object.getOwnPropertyDescriptor(\n window,\n \"agentHostApi\"\n );\n if (!testDescriptor || !(\"value\" in testDescriptor)) {\n return null;\n }\n const testAgentHostApi = testDescriptor.value as\n | AgentHostInputApi\n | AgentHostRuntimeApi\n | undefined;\n return testAgentHostApi ? toAgentHostRuntimeApi(testAgentHostApi) : null;\n}\n","import type {\n AgentHostBatchUserInfoInput,\n AgentHostBatchUserInfoResult,\n AgentHostDeleteWorkspaceAgentSessionInput,\n AgentHostWorkspaceAgentListInput as AgentHostListWorkspaceAgentsInput,\n AgentHostListWorkspaceAgentProbesInput,\n AgentHostWorkspaceAgentSessionMessages,\n AgentHostWorkspaceAgentSessionMessagesInput,\n AgentHostWorkspaceAgentSessionSummary,\n AgentHostWorkspaceAgentSessionSummaryInput,\n AgentHostWorkspaceAgentProbesResult,\n AgentHostWorkspaceAgentSnapshot,\n ReadWorkspaceFileResult as AgentHostReadWorkspaceFileResult\n} from \"../shared/contracts/dto\";\nimport type { WorkspaceUserProjectService } from \"@tutti-os/workspace-user-project/contracts\";\n\ntype AgentHostAsyncResult<T = any> = Promise<T>;\ntype AgentHostRecord = Record<string, unknown>;\ntype AgentHostUnsubscribe = () => void;\ntype AgentHostWorkspaceScopedInput<\n T extends {\n workspaceId?: string | null;\n }\n> = Omit<T, \"workspaceId\"> & {\n workspaceId: string;\n};\ntype AgentHostWorkspaceAgentsListInput =\n AgentHostWorkspaceScopedInput<AgentHostListWorkspaceAgentsInput>;\ntype AgentHostWorkspaceAgentSessionMessagesRuntimeInput =\n AgentHostWorkspaceScopedInput<AgentHostWorkspaceAgentSessionMessagesInput>;\ntype AgentHostWorkspaceAgentSessionSummaryRuntimeInput =\n AgentHostWorkspaceScopedInput<AgentHostWorkspaceAgentSessionSummaryInput>;\ntype AgentHostDeleteWorkspaceAgentSessionRuntimeInput =\n AgentHostWorkspaceScopedInput<AgentHostDeleteWorkspaceAgentSessionInput>;\n\nexport type AgentHostClipboardApi = {\n writeText: (text: string) => AgentHostAsyncResult<void>;\n};\n\nexport type AgentHostDebugApi = {\n logRuntimeDiagnostics: (\n payload: unknown\n ) => AgentHostAsyncResult<void> | void;\n logTerminalDiagnostics?: (\n payload: unknown\n ) => AgentHostAsyncResult<void> | void;\n};\n\nexport type AgentHostFilesystemApi = AgentHostRecord & {\n readFileText: (payload: {\n path?: string;\n uri?: string;\n }) => AgentHostAsyncResult<{\n content: string;\n name?: string;\n path?: string;\n }>;\n};\n\nexport type AgentHostMetaApi = AgentHostRecord & {\n appVersion?: string | null;\n isPackaged?: boolean;\n isTest?: boolean;\n mainPid?: number | null;\n platform?: string;\n workspaceId?: string;\n};\n\nexport type AgentHostEnvironmentApi = AgentHostRecord & {\n getBaseUrl?: () => AgentHostAsyncResult<string>;\n warmupOpenclawGateway?: (input?: unknown) => AgentHostAsyncResult<unknown>;\n};\n\nexport interface AgentHostSelectedFile {\n name?: string;\n path: string;\n}\n\nexport type AgentHostWorkspaceApi = AgentHostRecord & {\n copyPath?: (input: { path: string }) => AgentHostAsyncResult<void>;\n ensureDirectory: (input: { path: string }) => AgentHostAsyncResult<void>;\n getPathForFile: (file: File) => string;\n readFile: (input: {\n path: string;\n }) => AgentHostAsyncResult<AgentHostReadWorkspaceFileResult>;\n selectContextEntries?: () => AgentHostAsyncResult<{ entries: unknown[] }>;\n selectDirectory: () => AgentHostAsyncResult<{ path: string } | null>;\n selectFiles: () => AgentHostAsyncResult<AgentHostSelectedFile[]>;\n writeFileText: (input: {\n content: string;\n path: string;\n }) => AgentHostAsyncResult<unknown>;\n};\n\nexport interface AgentHostInputApi {\n account?: AgentHostAccountApi;\n agentGuiBatch?: AgentHostAgentGuiBatchApi;\n agentSessions?: AgentHostAgentSessionsApi;\n clipboard: AgentHostClipboardApi;\n debug?: AgentHostDebugApi;\n filesystem: AgentHostFilesystemApi;\n meta?: AgentHostMetaApi;\n onHostEvent?: (listener: (event: any) => void) => AgentHostUnsubscribe;\n runtime?: AgentHostEnvironmentApi;\n userProjects?: AgentHostUserProjectsApi;\n workspace: AgentHostWorkspaceApi;\n workspaceAgentProbes?: AgentHostWorkspaceAgentProbesApi;\n workspaceAgents?: AgentHostWorkspaceAgentsApi;\n}\n\nexport type AgentHostApi = AgentHostInputApi;\n\nexport type AgentHostAccountApi = AgentHostRecord & {\n batchGetUserInfo: (\n input: AgentHostBatchUserInfoInput\n ) => AgentHostAsyncResult<AgentHostBatchUserInfoResult>;\n ensureProfiles?: (input: any) => AgentHostAsyncResult<any>;\n};\n\nexport type AgentHostAgentGuiBatchApi = AgentHostRecord & {\n exportRun: (input: any) => AgentHostAsyncResult<any>;\n};\n\nexport type AgentHostWorkspaceAgentProbesApi = AgentHostRecord & {\n list: (\n input: AgentHostListWorkspaceAgentProbesInput\n ) => AgentHostAsyncResult<AgentHostWorkspaceAgentProbesResult>;\n};\n\nexport type AgentProviderProbeListInput =\n AgentHostListWorkspaceAgentProbesInput;\nexport type AgentProviderProbeListResult = AgentHostWorkspaceAgentProbesResult;\n\nexport interface AgentHostUserProject {\n id: string;\n path: string;\n label: string;\n createdAtUnixMs?: number;\n updatedAtUnixMs?: number;\n lastUsedAtUnixMs?: number;\n}\n\nexport type AgentHostUserProjectsApi = AgentHostRecord & {\n service?: WorkspaceUserProjectService;\n checkPath?: (input: { path: string }) => AgentHostAsyncResult<{\n exists: boolean;\n isDirectory: boolean;\n path: string;\n }>;\n create?: (input: {\n name: string;\n }) => AgentHostAsyncResult<AgentHostUserProject>;\n getDefaultSelection?: () => AgentHostAsyncResult<{\n path: string | null;\n } | null>;\n list: () => AgentHostAsyncResult<{\n projects: AgentHostUserProject[];\n }>;\n subscribe?: (listener: () => void) => AgentHostUnsubscribe;\n prepareSelection?: (input: {\n projectLocked: boolean;\n selectedPath: string | null;\n }) => AgentHostAsyncResult<{\n isSelectedPathMissing: boolean;\n projects: AgentHostUserProject[];\n selection:\n | {\n kind: \"clear\";\n suppressedPath: string;\n }\n | {\n kind: \"none\";\n }\n | {\n kind: \"select\";\n path: string;\n };\n }>;\n remove?: (input: { path: string }) => AgentHostAsyncResult<void>;\n isNoProjectPath?: (input: { path: string }) => boolean;\n rememberDefaultSelection?: (input: {\n path: string | null;\n }) => AgentHostAsyncResult<void>;\n use: (input: { path: string }) => AgentHostAsyncResult<AgentHostUserProject>;\n};\n\nexport type AgentHostAgentSessionsApi = AgentHostRecord & {\n activate: (input: any) => AgentHostAsyncResult<any>;\n /**\n * @deprecated AgentGUI production writes must use AgentActivityRuntime.cancelSession.\n */\n cancel: (input: any) => AgentHostAsyncResult<any>;\n /**\n * @deprecated AgentGUI production writes must use AgentActivityRuntime.sendInput.\n */\n exec: (input: any) => AgentHostAsyncResult<any>;\n getComposerOptions?: (input: any) => AgentHostAsyncResult<any>;\n getState: (input: any) => AgentHostAsyncResult<any>;\n onEvent?: (listener: (event: any) => void) => AgentHostUnsubscribe;\n /**\n * @deprecated AgentGUI production writes must use AgentActivityRuntime.setSessionPinned.\n */\n pinSession?: (input: any) => AgentHostAsyncResult<any>;\n /**\n * @deprecated AgentGUI production sync must use AgentActivityRuntime.ensureSessionSynchronized.\n */\n releaseEventStream?: (input?: any) => AgentHostAsyncResult;\n /**\n * @deprecated AgentGUI production sync must use AgentActivityRuntime.ensureSessionSynchronized.\n */\n retainEventStream?: (input: any) => AgentHostAsyncResult;\n /**\n * @deprecated AgentGUI production writes must use AgentActivityRuntime.submitInteractive.\n */\n submitInteractive: (input: any) => AgentHostAsyncResult<any>;\n /**\n * @deprecated AgentGUI production UI must derive events from AgentActivityRuntime snapshots.\n */\n trackSettingsProjectChange?: (input: {\n action: \"clear\" | \"create_new\" | \"select_existing\";\n agentSessionId: string;\n provider?: string | null;\n }) => AgentHostAsyncResult<void>;\n subscribeEvents: (\n input: any,\n listener: (event: any) => void\n ) => AgentHostUnsubscribe;\n unactivate: (input: any) => AgentHostAsyncResult<any>;\n updateSettings: (input: any) => AgentHostAsyncResult<any>;\n};\n\n/**\n * @deprecated Legacy host DTO projection. AgentGUI production reads and writes\n * must use AgentActivityRuntime and AgentActivity* models.\n */\nexport type AgentHostWorkspaceAgentsApi = AgentHostRecord & {\n /**\n * @deprecated Use AgentActivityRuntime.deleteSession.\n */\n deleteSession: (\n input: AgentHostDeleteWorkspaceAgentSessionRuntimeInput\n ) => AgentHostAsyncResult<any>;\n /**\n * @deprecated Derive summaries from AgentActivitySnapshot/session messages.\n */\n getSessionSummary: (\n input: AgentHostWorkspaceAgentSessionSummaryRuntimeInput\n ) => AgentHostAsyncResult<AgentHostWorkspaceAgentSessionSummary>;\n /**\n * @deprecated Use AgentActivityRuntime.load/getSnapshot.\n */\n list: (\n input: string | AgentHostWorkspaceAgentsListInput\n ) => AgentHostAsyncResult<AgentHostWorkspaceAgentSnapshot>;\n /**\n * @deprecated Use AgentActivityRuntime.listSessionMessages.\n */\n listSessionMessages: (\n input: AgentHostWorkspaceAgentSessionMessagesRuntimeInput\n ) => AgentHostAsyncResult<AgentHostWorkspaceAgentSessionMessages>;\n};\n\nexport interface AgentHostRuntimeApi {\n account?: AgentHostAccountApi;\n agentGuiBatch: AgentHostAgentGuiBatchApi;\n clipboard: AgentHostClipboardApi;\n debug?: AgentHostDebugApi;\n filesystem: AgentHostFilesystemApi;\n meta?: AgentHostMetaApi;\n onHostEvent?: (listener: (event: any) => void) => AgentHostUnsubscribe;\n runtime?: AgentHostEnvironmentApi;\n userProjects?: AgentHostUserProjectsApi;\n workspace: AgentHostWorkspaceApi;\n workspaceAgentProbes?: AgentHostWorkspaceAgentProbesApi;\n}\n\nexport function toAgentHostRuntimeApi(\n hostApi: AgentHostInputApi | AgentHostRuntimeApi\n): AgentHostRuntimeApi {\n return {\n account: hostApi.account,\n agentGuiBatch: hostApi.agentGuiBatch ?? ({} as AgentHostAgentGuiBatchApi),\n clipboard: hostApi.clipboard,\n debug: hostApi.debug,\n filesystem: hostApi.filesystem,\n meta: hostApi.meta,\n onHostEvent: hostApi.onHostEvent,\n runtime: hostApi.runtime,\n userProjects: hostApi.userProjects,\n workspace: hostApi.workspace,\n workspaceAgentProbes: hostApi.workspaceAgentProbes\n };\n}\n"],"mappings":"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","names":["createContext","useContext","jsx","createContext","useContext"]}
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
resolveWorkspaceFileLinkAction,
|
|
11
11
|
resolveWorkspaceFilePathCandidate,
|
|
12
12
|
resolveWorkspaceLinkAction
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-7Q3JKSQ5.js";
|
|
14
14
|
import {
|
|
15
15
|
attrsToMentionItem,
|
|
16
16
|
createAgentFileMentionExtension,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
import {
|
|
25
25
|
getOptionalAgentActivityRuntime,
|
|
26
26
|
useOptionalAgentHostApi
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-CCI6EK5W.js";
|
|
28
28
|
import {
|
|
29
29
|
workspaceAgentProviderLabel
|
|
30
30
|
} from "./chunk-TYGL25EL.js";
|
|
@@ -4368,13 +4368,14 @@ function projectUserMessageContentParts(message, turnId, workspaceId) {
|
|
|
4368
4368
|
body: "",
|
|
4369
4369
|
contentKind: "image-grid",
|
|
4370
4370
|
images: imageBlocks.map((image, index) => ({
|
|
4371
|
-
id: image.attachmentId || `${message.id}:image:0:${index}`,
|
|
4371
|
+
id: image.path || image.attachmentId || `${message.id}:image:0:${index}`,
|
|
4372
4372
|
workspaceId: image.workspaceId,
|
|
4373
4373
|
agentSessionId: image.agentSessionId,
|
|
4374
4374
|
attachmentId: image.attachmentId,
|
|
4375
4375
|
mimeType: image.mimeType,
|
|
4376
4376
|
name: image.name,
|
|
4377
|
-
data: image.data
|
|
4377
|
+
data: image.data,
|
|
4378
|
+
path: image.path
|
|
4378
4379
|
})),
|
|
4379
4380
|
occurredAtUnixMs: message.occurredAtUnixMs ?? null,
|
|
4380
4381
|
sourceTimelineItems: message.sourceTimelineItems
|
|
@@ -4448,7 +4449,8 @@ function userPromptContentBlocks(message, fallbackWorkspaceId) {
|
|
|
4448
4449
|
attachmentId: typeof block.attachmentId === "string" && block.attachmentId.trim() ? block.attachmentId.trim() : null,
|
|
4449
4450
|
mimeType,
|
|
4450
4451
|
name: typeof block.name === "string" && block.name.trim() ? block.name.trim() : null,
|
|
4451
|
-
data: typeof block.data === "string" && block.data.trim() ? block.data.trim() : null
|
|
4452
|
+
data: typeof block.data === "string" && block.data.trim() ? block.data.trim() : null,
|
|
4453
|
+
path: typeof block.path === "string" && block.path.trim() ? block.path.trim() : null
|
|
4452
4454
|
}
|
|
4453
4455
|
];
|
|
4454
4456
|
});
|
|
@@ -4661,7 +4663,7 @@ import {
|
|
|
4661
4663
|
useMemo,
|
|
4662
4664
|
useState as useState5
|
|
4663
4665
|
} from "react";
|
|
4664
|
-
import { ChevronRight as ChevronRight3 } from "lucide-react";
|
|
4666
|
+
import { ChevronRight as ChevronRight3, LoaderCircle } from "lucide-react";
|
|
4665
4667
|
import { CheckIcon, CopyIcon } from "@tutti-os/ui-system/icons";
|
|
4666
4668
|
|
|
4667
4669
|
// app/renderer/components/ui/button.tsx
|
|
@@ -6519,7 +6521,7 @@ function AgentUserImageGrid({
|
|
|
6519
6521
|
}) {
|
|
6520
6522
|
"use memo";
|
|
6521
6523
|
const images = message.images ?? [];
|
|
6522
|
-
const loadedImages = useAgentMessageImageSources(images);
|
|
6524
|
+
const { loadingIds, sources: loadedImages } = useAgentMessageImageSources(images);
|
|
6523
6525
|
const columnCount = Math.min(Math.max(images.length, 1), 4);
|
|
6524
6526
|
return /* @__PURE__ */ jsx12(
|
|
6525
6527
|
"div",
|
|
@@ -6528,6 +6530,7 @@ function AgentUserImageGrid({
|
|
|
6528
6530
|
style: { gridTemplateColumns: `repeat(${columnCount}, 80px)` },
|
|
6529
6531
|
children: images.map((image) => {
|
|
6530
6532
|
const src = loadedImages.get(image.id) ?? imageDataUrl(image);
|
|
6533
|
+
const loading = !src && loadingIds.has(image.id);
|
|
6531
6534
|
return /* @__PURE__ */ jsx12(
|
|
6532
6535
|
"div",
|
|
6533
6536
|
{
|
|
@@ -6540,6 +6543,20 @@ function AgentUserImageGrid({
|
|
|
6540
6543
|
className: "size-full object-cover",
|
|
6541
6544
|
draggable: false
|
|
6542
6545
|
}
|
|
6546
|
+
) : loading ? /* @__PURE__ */ jsx12(
|
|
6547
|
+
"div",
|
|
6548
|
+
{
|
|
6549
|
+
className: "flex size-full items-center justify-center bg-[color-mix(in_srgb,var(--text-primary)_6%,transparent)]",
|
|
6550
|
+
"data-testid": "agent-gui-message-image-loading",
|
|
6551
|
+
children: /* @__PURE__ */ jsx12(
|
|
6552
|
+
LoaderCircle,
|
|
6553
|
+
{
|
|
6554
|
+
"aria-hidden": "true",
|
|
6555
|
+
className: "size-5 animate-spin text-[color-mix(in_srgb,var(--text-primary)_45%,transparent)]",
|
|
6556
|
+
strokeWidth: 2
|
|
6557
|
+
}
|
|
6558
|
+
)
|
|
6559
|
+
}
|
|
6543
6560
|
) : /* @__PURE__ */ jsx12("div", { className: "size-full animate-pulse bg-[color-mix(in_srgb,var(--text-primary)_8%,transparent)]" })
|
|
6544
6561
|
},
|
|
6545
6562
|
image.id
|
|
@@ -6551,23 +6568,42 @@ function AgentUserImageGrid({
|
|
|
6551
6568
|
function useAgentMessageImageSources(images) {
|
|
6552
6569
|
const runtime = getOptionalAgentActivityRuntime();
|
|
6553
6570
|
const [sources, setSources] = useState5(() => /* @__PURE__ */ new Map());
|
|
6571
|
+
const [loadingIds, setLoadingIds] = useState5(() => /* @__PURE__ */ new Set());
|
|
6554
6572
|
const missingImages = useMemo(
|
|
6555
6573
|
() => images.filter(
|
|
6556
|
-
(image) => !imageDataUrl(image) && !sources.has(image.id) && image.workspaceId && image.agentSessionId && image.attachmentId
|
|
6574
|
+
(image) => !imageDataUrl(image) && !sources.has(image.id) && image.workspaceId && image.agentSessionId && (image.attachmentId || image.path)
|
|
6557
6575
|
),
|
|
6558
6576
|
[images, sources]
|
|
6559
6577
|
);
|
|
6560
6578
|
useEffect4(() => {
|
|
6561
|
-
if (!runtime?.readSessionAttachment || missingImages.length === 0) {
|
|
6579
|
+
if (!runtime?.readSessionAttachment && !runtime?.readPromptAsset || missingImages.length === 0) {
|
|
6562
6580
|
return;
|
|
6563
6581
|
}
|
|
6564
6582
|
let canceled = false;
|
|
6565
6583
|
for (const image of missingImages) {
|
|
6566
|
-
|
|
6584
|
+
const readImage = image.attachmentId ? runtime.readSessionAttachment?.({
|
|
6567
6585
|
workspaceId: image.workspaceId ?? "",
|
|
6568
6586
|
agentSessionId: image.agentSessionId,
|
|
6569
6587
|
attachmentId: image.attachmentId ?? ""
|
|
6570
|
-
}).
|
|
6588
|
+
}) : runtime.readPromptAsset?.({
|
|
6589
|
+
workspaceId: image.workspaceId ?? "",
|
|
6590
|
+
agentSessionId: image.agentSessionId,
|
|
6591
|
+
mimeType: image.mimeType,
|
|
6592
|
+
name: image.name,
|
|
6593
|
+
path: image.path
|
|
6594
|
+
});
|
|
6595
|
+
if (!readImage) {
|
|
6596
|
+
continue;
|
|
6597
|
+
}
|
|
6598
|
+
setLoadingIds((current) => {
|
|
6599
|
+
if (current.has(image.id)) {
|
|
6600
|
+
return current;
|
|
6601
|
+
}
|
|
6602
|
+
const next = new Set(current);
|
|
6603
|
+
next.add(image.id);
|
|
6604
|
+
return next;
|
|
6605
|
+
});
|
|
6606
|
+
void readImage.then((attachment) => {
|
|
6571
6607
|
if (canceled) {
|
|
6572
6608
|
return;
|
|
6573
6609
|
}
|
|
@@ -6583,13 +6619,25 @@ function useAgentMessageImageSources(images) {
|
|
|
6583
6619
|
return next;
|
|
6584
6620
|
});
|
|
6585
6621
|
}).catch(() => {
|
|
6622
|
+
}).finally(() => {
|
|
6623
|
+
if (canceled) {
|
|
6624
|
+
return;
|
|
6625
|
+
}
|
|
6626
|
+
setLoadingIds((current) => {
|
|
6627
|
+
if (!current.has(image.id)) {
|
|
6628
|
+
return current;
|
|
6629
|
+
}
|
|
6630
|
+
const next = new Set(current);
|
|
6631
|
+
next.delete(image.id);
|
|
6632
|
+
return next;
|
|
6633
|
+
});
|
|
6586
6634
|
});
|
|
6587
6635
|
}
|
|
6588
6636
|
return () => {
|
|
6589
6637
|
canceled = true;
|
|
6590
6638
|
};
|
|
6591
6639
|
}, [missingImages, runtime]);
|
|
6592
|
-
return sources;
|
|
6640
|
+
return { loadingIds, sources };
|
|
6593
6641
|
}
|
|
6594
6642
|
function imageDataUrl(image) {
|
|
6595
6643
|
const data = image.data?.trim() ?? "";
|
|
@@ -12234,4 +12282,4 @@ export {
|
|
|
12234
12282
|
AgentConversationFlow,
|
|
12235
12283
|
useProjectedAgentConversation
|
|
12236
12284
|
};
|
|
12237
|
-
//# sourceMappingURL=chunk-
|
|
12285
|
+
//# sourceMappingURL=chunk-MQAGIHYM.js.map
|