@tutti-os/agent-gui 0.0.57 → 0.0.59

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.
Files changed (58) hide show
  1. package/dist/agent-conversation/index.d.ts +4 -4
  2. package/dist/agent-conversation/index.js +9 -8
  3. package/dist/agent-conversation/index.js.map +1 -1
  4. package/dist/agent-env/index.d.ts +285 -0
  5. package/dist/agent-env/index.js +360 -0
  6. package/dist/agent-env/index.js.map +1 -0
  7. package/dist/agent-message-center/index.d.ts +2 -2
  8. package/dist/agent-message-center/index.js +11 -11
  9. package/dist/{agentConversationVM-Qbz9GBwR.d.ts → agentConversationVM-DPAgUJlR.d.ts} +1 -1
  10. package/dist/{agentGuiNodeTypes-BRU6P22B.d.ts → agentGuiNodeTypes-CupCLd9p.d.ts} +2 -2
  11. package/dist/app/renderer/agentactivity.css +8 -33
  12. package/dist/{chunk-RGVVHF7Q.js → chunk-2WUDORCV.js} +2 -2
  13. package/dist/{chunk-Z3AAQQFD.js → chunk-5SRRKWE4.js} +2 -2
  14. package/dist/{chunk-DZ76JPCV.js → chunk-BEFNWUOZ.js} +95 -154
  15. package/dist/chunk-BEFNWUOZ.js.map +1 -0
  16. package/dist/{chunk-IMZBRUP3.js → chunk-BT5WEZO5.js} +7 -7
  17. package/dist/{chunk-HFZOXSSQ.js → chunk-CEMXB7LA.js} +5 -5
  18. package/dist/{chunk-S6PCOX3S.js → chunk-HVU46DDA.js} +1 -1
  19. package/dist/chunk-HVU46DDA.js.map +1 -0
  20. package/dist/{chunk-33LWYV6O.js → chunk-IS6JUDDY.js} +9 -1
  21. package/dist/chunk-IS6JUDDY.js.map +1 -0
  22. package/dist/{chunk-VOXUYDQF.js → chunk-N756UO52.js} +11 -7
  23. package/dist/chunk-N756UO52.js.map +1 -0
  24. package/dist/{chunk-N37A5CJH.js → chunk-NX6T3DDS.js} +3 -3
  25. package/dist/{chunk-KOR6UVUJ.js → chunk-OFMORNBO.js} +5 -5
  26. package/dist/{chunk-QFHR527D.js → chunk-OLI2A3EM.js} +2 -2
  27. package/dist/chunk-PSLAWU25.js +145 -0
  28. package/dist/chunk-PSLAWU25.js.map +1 -0
  29. package/dist/{chunk-2VHP7KQ5.js → chunk-SLT5Q37C.js} +6 -6
  30. package/dist/{chunk-SZ7JGCS3.js → chunk-UCCUIUGK.js} +4 -4
  31. package/dist/context-mention-palette/index.js +7 -7
  32. package/dist/i18n/index.d.ts +8 -0
  33. package/dist/i18n/index.js +2 -2
  34. package/dist/index.d.ts +56 -4
  35. package/dist/index.js +739 -115
  36. package/dist/index.js.map +1 -1
  37. package/dist/plan-decision-ops.d.ts +2 -2
  38. package/dist/queued-prompt-runtime.d.ts +3 -3
  39. package/dist/workbench/contribution.js +2 -2
  40. package/dist/workbench/index.js +14 -14
  41. package/dist/workbench/sessionTitle.js +3 -3
  42. package/dist/workspace-agent-generated-files.d.ts +1 -1
  43. package/dist/workspace-agent-generated-files.js +3 -3
  44. package/dist/{workspaceAgentActivityListViewModel-B5viw5Da.d.ts → workspaceAgentActivityListViewModel-DJvAqZso.d.ts} +1 -0
  45. package/package.json +19 -12
  46. package/dist/chunk-33LWYV6O.js.map +0 -1
  47. package/dist/chunk-DZ76JPCV.js.map +0 -1
  48. package/dist/chunk-S6PCOX3S.js.map +0 -1
  49. package/dist/chunk-VOXUYDQF.js.map +0 -1
  50. /package/dist/{chunk-RGVVHF7Q.js.map → chunk-2WUDORCV.js.map} +0 -0
  51. /package/dist/{chunk-Z3AAQQFD.js.map → chunk-5SRRKWE4.js.map} +0 -0
  52. /package/dist/{chunk-IMZBRUP3.js.map → chunk-BT5WEZO5.js.map} +0 -0
  53. /package/dist/{chunk-HFZOXSSQ.js.map → chunk-CEMXB7LA.js.map} +0 -0
  54. /package/dist/{chunk-N37A5CJH.js.map → chunk-NX6T3DDS.js.map} +0 -0
  55. /package/dist/{chunk-KOR6UVUJ.js.map → chunk-OFMORNBO.js.map} +0 -0
  56. /package/dist/{chunk-QFHR527D.js.map → chunk-OLI2A3EM.js.map} +0 -0
  57. /package/dist/{chunk-2VHP7KQ5.js.map → chunk-SLT5Q37C.js.map} +0 -0
  58. /package/dist/{chunk-SZ7JGCS3.js.map → chunk-UCCUIUGK.js.map} +0 -0
@@ -2,10 +2,10 @@ import * as react from 'react';
2
2
  import { ReactNode, JSX } from 'react';
3
3
  import { W as WorkspaceLinkAction } from '../workspaceLinkActions-Bjy_XfBm.js';
4
4
  import { A as AgentMessageMarkdownWorkspaceAppIcon } from '../AgentMessageMarkdown-DeYPURtF.js';
5
- import { c as AgentConversationVM, W as WorkspaceAgentSessionDetailViewModel } from '../agentConversationVM-Qbz9GBwR.js';
6
- export { B as BuildWorkspaceAgentSessionDetailInput, d as buildWorkspaceAgentSessionDetailViewModel } from '../agentConversationVM-Qbz9GBwR.js';
7
- import { d as AgentGUIProviderSkillOption } from '../agentGuiNodeTypes-BRU6P22B.js';
8
- export { W as WorkspaceAgentActivityCard, n as WorkspaceAgentActivitySession, q as WorkspaceAgentActivityTimelineItem } from '../workspaceAgentActivityListViewModel-B5viw5Da.js';
5
+ import { c as AgentConversationVM, W as WorkspaceAgentSessionDetailViewModel } from '../agentConversationVM-DPAgUJlR.js';
6
+ export { B as BuildWorkspaceAgentSessionDetailInput, d as buildWorkspaceAgentSessionDetailViewModel } from '../agentConversationVM-DPAgUJlR.js';
7
+ import { d as AgentGUIProviderSkillOption } from '../agentGuiNodeTypes-CupCLd9p.js';
8
+ export { W as WorkspaceAgentActivityCard, n as WorkspaceAgentActivitySession, q as WorkspaceAgentActivityTimelineItem } from '../workspaceAgentActivityListViewModel-DJvAqZso.js';
9
9
  import '@tutti-os/workspace-issue-manager/core';
10
10
  import '@tutti-os/agent-activity-core';
11
11
  import '../types-BsHvTjIZ.js';
@@ -6,19 +6,20 @@ import {
6
6
  projectAgentConversationVM,
7
7
  reconcileProjectedAgentConversationVM,
8
8
  useProjectedAgentConversation
9
- } from "../chunk-DZ76JPCV.js";
10
- import "../chunk-2VHP7KQ5.js";
11
- import "../chunk-N37A5CJH.js";
9
+ } from "../chunk-BEFNWUOZ.js";
10
+ import "../chunk-SLT5Q37C.js";
11
+ import "../chunk-PSLAWU25.js";
12
+ import "../chunk-NX6T3DDS.js";
12
13
  import "../chunk-Y35GDLP2.js";
13
14
  import "../chunk-LUGELG5V.js";
14
- import "../chunk-S6PCOX3S.js";
15
+ import "../chunk-HVU46DDA.js";
15
16
  import "../chunk-TYGL25EL.js";
16
- import "../chunk-PJP5BUU6.js";
17
- import "../chunk-MTFSQWZ6.js";
18
17
  import {
19
18
  translate
20
- } from "../chunk-Z3AAQQFD.js";
21
- import "../chunk-33LWYV6O.js";
19
+ } from "../chunk-5SRRKWE4.js";
20
+ import "../chunk-PJP5BUU6.js";
21
+ import "../chunk-MTFSQWZ6.js";
22
+ import "../chunk-IS6JUDDY.js";
22
23
 
23
24
  // shared/WorkspaceAgentSessionDetail.tsx
24
25
  import { useMemo } from "react";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../shared/WorkspaceAgentSessionDetail.tsx"],"sourcesContent":["import { useMemo, type JSX } from \"react\";\nimport type { WorkspaceLinkAction } from \"../contexts/workspace/presentation/renderer/actions/workspaceLinkActions\";\nimport { translate } from \"../i18n/index\";\nimport { AgentConversationFlow } from \"./agentConversation/components/AgentConversationFlow\";\nimport { useProjectedAgentConversation } from \"./agentConversation/projection/useProjectedAgentConversation\";\nimport type { WorkspaceAgentSessionDetailViewModel } from \"./workspaceAgentSessionDetailViewModel\";\n\ninterface WorkspaceAgentSessionDetailProps {\n detail: WorkspaceAgentSessionDetailViewModel;\n avoidGroupingEdits?: boolean;\n isLoading: boolean;\n timelineItemCount: number;\n onLinkAction?: (action: WorkspaceLinkAction) => void;\n toolCallsLabel: (count: number) => string;\n thinkingLabel?: string;\n loadingLabel?: string;\n rawTimelineJsonLabel?: string;\n showRawTimelineJson?: boolean;\n}\n\nexport function WorkspaceAgentSessionDetail({\n detail,\n avoidGroupingEdits = false,\n isLoading,\n timelineItemCount,\n onLinkAction,\n toolCallsLabel,\n thinkingLabel = translate(\"agentHost.workspaceAgentSessionDetailThinking\"),\n loadingLabel = translate(\"common.loading\"),\n rawTimelineJsonLabel,\n showRawTimelineJson = false\n}: WorkspaceAgentSessionDetailProps): JSX.Element {\n const conversation = useProjectedAgentConversation({\n detail,\n avoidGroupingEdits\n });\n const showLoadingSkeleton =\n detail.turns.length === 0 &&\n (isLoading ||\n detail.activity.status === \"waiting\" ||\n detail.activity.status === \"working\");\n const emptySummary =\n detail.activity.latestActivitySummary ||\n (timelineItemCount > 0\n ? translate(\"agentHost.workspaceAgentSessionDetailEmptyWithTimeline\")\n : translate(\"agentHost.workspaceAgentSessionDetailEmptyNoTimeline\"));\n const flowLabels = useMemo(\n () => ({\n thinkingLabel,\n toolCallsLabel,\n processing: translate(\"agentHost.agentGui.processing\"),\n turnSummary: translate(\"agentHost.agentGui.turnSummary\"),\n rawTimelineJson: rawTimelineJsonLabel\n }),\n [rawTimelineJsonLabel, thinkingLabel, toolCallsLabel]\n );\n const emptyState = useMemo(\n () => (\n <div className=\"workspace-agents-status-panel__detail-empty\">\n {emptySummary}\n </div>\n ),\n [emptySummary]\n );\n\n return (\n <div className=\"workspace-agents-status-panel__detail\">\n <AgentConversationFlow\n conversation={detail.turns.length > 0 ? conversation : null}\n isLoading={showLoadingSkeleton}\n loadingLabel={loadingLabel}\n empty={emptyState}\n onLinkAction={onLinkAction}\n showRawTimelineJson={showRawTimelineJson}\n labels={flowLabels}\n />\n </div>\n );\n}\n\nexport function WorkspaceAgentSessionDetailSkeleton({\n loading = true,\n loadingLabel = translate(\"common.loading\")\n}: {\n loading?: boolean;\n loadingLabel?: string;\n}): JSX.Element {\n const flowLabels = useMemo(\n () => ({\n thinkingLabel: translate(\"agentHost.workspaceAgentSessionDetailThinking\"),\n toolCallsLabel: (count: number) =>\n translate(\"agentHost.workspaceAgentSessionDetailToolCalls\", { count }),\n processing: translate(\"agentHost.agentGui.processing\"),\n turnSummary: translate(\"agentHost.agentGui.turnSummary\")\n }),\n []\n );\n\n if (!loading) {\n return <></>;\n }\n\n return (\n <div\n className=\"workspace-agents-status-panel__detail-skeleton\"\n data-testid=\"workspace-agents-status-panel-detail-skeleton\"\n role=\"status\"\n aria-busy=\"true\"\n aria-label={loadingLabel}\n >\n <AgentConversationFlow\n conversation={null}\n isLoading\n loadingLabel={loadingLabel}\n loadingTestId=\"workspace-agents-status-panel-detail-skeleton\"\n empty={null}\n labels={flowLabels}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,eAAyB;AA0D5B,SAyCK,UAzCL;AAtCC,SAAS,4BAA4B;AAAA,EAC1C;AAAA,EACA,qBAAqB;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAgB,UAAU,+CAA+C;AAAA,EACzE,eAAe,UAAU,gBAAgB;AAAA,EACzC;AAAA,EACA,sBAAsB;AACxB,GAAkD;AAChD,QAAM,eAAe,8BAA8B;AAAA,IACjD;AAAA,IACA;AAAA,EACF,CAAC;AACD,QAAM,sBACJ,OAAO,MAAM,WAAW,MACvB,aACC,OAAO,SAAS,WAAW,aAC3B,OAAO,SAAS,WAAW;AAC/B,QAAM,eACJ,OAAO,SAAS,0BACf,oBAAoB,IACjB,UAAU,wDAAwD,IAClE,UAAU,sDAAsD;AACtE,QAAM,aAAa;AAAA,IACjB,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,YAAY,UAAU,+BAA+B;AAAA,MACrD,aAAa,UAAU,gCAAgC;AAAA,MACvD,iBAAiB;AAAA,IACnB;AAAA,IACA,CAAC,sBAAsB,eAAe,cAAc;AAAA,EACtD;AACA,QAAM,aAAa;AAAA,IACjB,MACE,oBAAC,SAAI,WAAU,+CACZ,wBACH;AAAA,IAEF,CAAC,YAAY;AAAA,EACf;AAEA,SACE,oBAAC,SAAI,WAAU,yCACb;AAAA,IAAC;AAAA;AAAA,MACC,cAAc,OAAO,MAAM,SAAS,IAAI,eAAe;AAAA,MACvD,WAAW;AAAA,MACX;AAAA,MACA,OAAO;AAAA,MACP;AAAA,MACA;AAAA,MACA,QAAQ;AAAA;AAAA,EACV,GACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../shared/WorkspaceAgentSessionDetail.tsx"],"sourcesContent":["import { useMemo, type JSX } from \"react\";\nimport type { WorkspaceLinkAction } from \"../contexts/workspace/presentation/renderer/actions/workspaceLinkActions\";\nimport { translate } from \"../i18n/index\";\nimport { AgentConversationFlow } from \"./agentConversation/components/AgentConversationFlow\";\nimport { useProjectedAgentConversation } from \"./agentConversation/projection/useProjectedAgentConversation\";\nimport type { WorkspaceAgentSessionDetailViewModel } from \"./workspaceAgentSessionDetailViewModel\";\n\ninterface WorkspaceAgentSessionDetailProps {\n detail: WorkspaceAgentSessionDetailViewModel;\n avoidGroupingEdits?: boolean;\n isLoading: boolean;\n timelineItemCount: number;\n onLinkAction?: (action: WorkspaceLinkAction) => void;\n toolCallsLabel: (count: number) => string;\n thinkingLabel?: string;\n loadingLabel?: string;\n rawTimelineJsonLabel?: string;\n showRawTimelineJson?: boolean;\n}\n\nexport function WorkspaceAgentSessionDetail({\n detail,\n avoidGroupingEdits = false,\n isLoading,\n timelineItemCount,\n onLinkAction,\n toolCallsLabel,\n thinkingLabel = translate(\"agentHost.workspaceAgentSessionDetailThinking\"),\n loadingLabel = translate(\"common.loading\"),\n rawTimelineJsonLabel,\n showRawTimelineJson = false\n}: WorkspaceAgentSessionDetailProps): JSX.Element {\n const conversation = useProjectedAgentConversation({\n detail,\n avoidGroupingEdits\n });\n const showLoadingSkeleton =\n detail.turns.length === 0 &&\n (isLoading ||\n detail.activity.status === \"waiting\" ||\n detail.activity.status === \"working\");\n const emptySummary =\n detail.activity.latestActivitySummary ||\n (timelineItemCount > 0\n ? translate(\"agentHost.workspaceAgentSessionDetailEmptyWithTimeline\")\n : translate(\"agentHost.workspaceAgentSessionDetailEmptyNoTimeline\"));\n const flowLabels = useMemo(\n () => ({\n thinkingLabel,\n toolCallsLabel,\n processing: translate(\"agentHost.agentGui.processing\"),\n turnSummary: translate(\"agentHost.agentGui.turnSummary\"),\n rawTimelineJson: rawTimelineJsonLabel\n }),\n [rawTimelineJsonLabel, thinkingLabel, toolCallsLabel]\n );\n const emptyState = useMemo(\n () => (\n <div className=\"workspace-agents-status-panel__detail-empty\">\n {emptySummary}\n </div>\n ),\n [emptySummary]\n );\n\n return (\n <div className=\"workspace-agents-status-panel__detail\">\n <AgentConversationFlow\n conversation={detail.turns.length > 0 ? conversation : null}\n isLoading={showLoadingSkeleton}\n loadingLabel={loadingLabel}\n empty={emptyState}\n onLinkAction={onLinkAction}\n showRawTimelineJson={showRawTimelineJson}\n labels={flowLabels}\n />\n </div>\n );\n}\n\nexport function WorkspaceAgentSessionDetailSkeleton({\n loading = true,\n loadingLabel = translate(\"common.loading\")\n}: {\n loading?: boolean;\n loadingLabel?: string;\n}): JSX.Element {\n const flowLabels = useMemo(\n () => ({\n thinkingLabel: translate(\"agentHost.workspaceAgentSessionDetailThinking\"),\n toolCallsLabel: (count: number) =>\n translate(\"agentHost.workspaceAgentSessionDetailToolCalls\", { count }),\n processing: translate(\"agentHost.agentGui.processing\"),\n turnSummary: translate(\"agentHost.agentGui.turnSummary\")\n }),\n []\n );\n\n if (!loading) {\n return <></>;\n }\n\n return (\n <div\n className=\"workspace-agents-status-panel__detail-skeleton\"\n data-testid=\"workspace-agents-status-panel-detail-skeleton\"\n role=\"status\"\n aria-busy=\"true\"\n aria-label={loadingLabel}\n >\n <AgentConversationFlow\n conversation={null}\n isLoading\n loadingLabel={loadingLabel}\n loadingTestId=\"workspace-agents-status-panel-detail-skeleton\"\n empty={null}\n labels={flowLabels}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,eAAyB;AA0D5B,SAyCK,UAzCL;AAtCC,SAAS,4BAA4B;AAAA,EAC1C;AAAA,EACA,qBAAqB;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAgB,UAAU,+CAA+C;AAAA,EACzE,eAAe,UAAU,gBAAgB;AAAA,EACzC;AAAA,EACA,sBAAsB;AACxB,GAAkD;AAChD,QAAM,eAAe,8BAA8B;AAAA,IACjD;AAAA,IACA;AAAA,EACF,CAAC;AACD,QAAM,sBACJ,OAAO,MAAM,WAAW,MACvB,aACC,OAAO,SAAS,WAAW,aAC3B,OAAO,SAAS,WAAW;AAC/B,QAAM,eACJ,OAAO,SAAS,0BACf,oBAAoB,IACjB,UAAU,wDAAwD,IAClE,UAAU,sDAAsD;AACtE,QAAM,aAAa;AAAA,IACjB,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,YAAY,UAAU,+BAA+B;AAAA,MACrD,aAAa,UAAU,gCAAgC;AAAA,MACvD,iBAAiB;AAAA,IACnB;AAAA,IACA,CAAC,sBAAsB,eAAe,cAAc;AAAA,EACtD;AACA,QAAM,aAAa;AAAA,IACjB,MACE,oBAAC,SAAI,WAAU,+CACZ,wBACH;AAAA,IAEF,CAAC,YAAY;AAAA,EACf;AAEA,SACE,oBAAC,SAAI,WAAU,yCACb;AAAA,IAAC;AAAA;AAAA,MACC,cAAc,OAAO,MAAM,SAAS,IAAI,eAAe;AAAA,MACvD,WAAW;AAAA,MACX;AAAA,MACA,OAAO;AAAA,MACP;AAAA,MACA;AAAA,MACA,QAAQ;AAAA;AAAA,EACV,GACF;AAEJ;","names":[]}
@@ -0,0 +1,285 @@
1
+ import { WorkspaceAgentProvider, AgentProviderStatus } from '@tutti-os/client-tuttid-ts';
2
+
3
+ /**
4
+ * Section the Agent Env panel (the片6 Setup Wizard / config panel) should scroll
5
+ * to / emphasise when opened via a deep-link. The error card (片5) maps a domain
6
+ * error code to one of these so the user lands on the relevant remediation.
7
+ */
8
+ type AgentEnvPanelFocus = "detect" | "install" | "repair" | "upgrade" | "auth" | "network" | "registry";
9
+ interface AgentEnvPanelRequest {
10
+ open: boolean;
11
+ provider: string | null;
12
+ focus: AgentEnvPanelFocus | null;
13
+ /**
14
+ * Bumped on every openAgentEnvPanel() call. The host panel watches this to
15
+ * re-run detection even when it is already open (e.g. a second deep-link).
16
+ */
17
+ requestSequence: number;
18
+ }
19
+ interface OpenAgentEnvPanelInput {
20
+ provider?: string | null;
21
+ focus?: AgentEnvPanelFocus | null;
22
+ }
23
+ /**
24
+ * Open the agent environment panel. Safe to call from anywhere in the agent-gui
25
+ * tree (rail footer entry, error-card deep-link). The host renders the actual
26
+ * panel and reacts to this singleton store.
27
+ */
28
+ declare function openAgentEnvPanel(input?: OpenAgentEnvPanelInput): void;
29
+ declare function closeAgentEnvPanel(): void;
30
+ /** Imperative read, mainly for tests. Components should use the hook. */
31
+ declare function getAgentEnvPanelStore(): AgentEnvPanelRequest;
32
+ /** Reactive snapshot of the panel request for the host renderer. */
33
+ declare function useAgentEnvPanelRequest(): AgentEnvPanelRequest;
34
+
35
+ /**
36
+ * Run-failure codes actually emitted by the daemon runtime classifier
37
+ * (packages/agent/daemon/runtime/visible_error.go `visibleFailureCode`). These
38
+ * are the codes the conversation error card really receives — unlike the
39
+ * aspirational `CODEX_*` codes, which the run pipeline never produces.
40
+ *
41
+ * Keep this union aligned with the Go switch in `visibleFailureCode`.
42
+ */
43
+ type AgentRunErrorCode = "auth_required" | "cli_not_found" | "cli_version_unsupported" | "network_error" | "runtime_unavailable" | "request_timed_out" | "provider_config_timeout" | "provider_stream_disconnected" | "provider_concurrency_limit" | "quota_or_rate_limit" | "process_exited" | "provider_error" | "unknown";
44
+ interface AgentErrorPresentation {
45
+ /**
46
+ * i18n key for the one human sentence shown in the card, or null to let the
47
+ * caller fall back to its phase-aware generic title.
48
+ */
49
+ messageKey: string | null;
50
+ /**
51
+ * Env-panel section the remediation button deep-links to, or null when the
52
+ * failure is transient/server-side and the wizard cannot fix it — in which
53
+ * case no call-to-action is shown (showing one would misrepresent reality).
54
+ */
55
+ focus: AgentEnvPanelFocus | null;
56
+ /** i18n key for the remediation button. Only meaningful when `focus` is set. */
57
+ actionKey: string | null;
58
+ }
59
+ /**
60
+ * Resolves the card presentation for a run-failure code. Returns null for codes
61
+ * outside the known vocabulary so the caller renders its plain generic card with
62
+ * no call-to-action.
63
+ */
64
+ declare function resolveAgentErrorPresentation(code: string | null | undefined): AgentErrorPresentation | null;
65
+ /**
66
+ * Some providers (notably Claude Code) report an environment failure — e.g. a
67
+ * dropped login (401) — as a plain failed assistant message rather than a
68
+ * structured visibleError, so it never gets the remediation card. This recovers
69
+ * the env-fixable code from that message's text so the caller can still route the
70
+ * user to the wizard. Returns null when the text isn't a recognized env failure
71
+ * (so transient/unknown failures stay plain).
72
+ */
73
+ declare function classifyFailedAgentMessage(body: string | null | undefined): AgentRunErrorCode | null;
74
+
75
+ /**
76
+ * Frontend contract for the Codex setup progress stream surfaced on the agent
77
+ * provider status snapshot as `activeAction` (片3 progress-flow contract). The
78
+ * backend slice that populates this field has its own source of truth; the
79
+ * generated `AgentProviderStatus` type does not (yet) declare it, so the panel
80
+ * reads it defensively and degrades to detection-only state when it is absent.
81
+ */
82
+ type CodexSetupStepStatus = "pending" | "running" | "ok" | "error" | "skipped";
83
+ interface CodexSetupStep {
84
+ id: string;
85
+ label: string | null;
86
+ status: CodexSetupStepStatus;
87
+ detail: string | null;
88
+ }
89
+ type CodexSetupPhase = "detect" | "install" | "repair" | "verify" | "done" | "error";
90
+ interface CodexSetupActiveActionError {
91
+ code: string | null;
92
+ message: string | null;
93
+ }
94
+ interface CodexSetupActiveAction {
95
+ phase: CodexSetupPhase;
96
+ steps: CodexSetupStep[];
97
+ registry: string | null;
98
+ log: string[];
99
+ error: CodexSetupActiveActionError | null;
100
+ }
101
+ /**
102
+ * Defensively reads the `activeAction` field off an AgentProviderStatus-like
103
+ * object. Returns null when the field is missing or malformed, which the panel
104
+ * treats as "no live setup action in progress".
105
+ */
106
+ declare function readCodexSetupActiveAction(status: unknown): CodexSetupActiveAction | null;
107
+
108
+ type AgentSetupStageId = "detect" | "network" | "install" | "adapter" | "login" | "ready";
109
+ type StageDetailToken = {
110
+ kind: "text";
111
+ text: string;
112
+ } | {
113
+ kind: "version-floor";
114
+ current: string;
115
+ required: string;
116
+ } | {
117
+ kind: "version-mismatch";
118
+ current: string;
119
+ required: string;
120
+ };
121
+ declare function reasonCodeIndicatesCliVersionUnsupported(reasonCode: string | null | undefined): boolean;
122
+ interface AgentSetupStage {
123
+ id: AgentSetupStageId;
124
+ label: string;
125
+ status: CodexSetupStepStatus;
126
+ detail: StageDetailToken | null;
127
+ /**
128
+ * Optional explicit problem token for a blocked stage that can't be inferred
129
+ * from `status` alone. Today only the install stage sets it — when the codex
130
+ * launcher is present but its platform subpackage is missing, the stage is
131
+ * `pending` (the daemon repairs it via the install action) yet needs a distinct
132
+ * "platform package missing" problem rather than the generic "install-missing".
133
+ */
134
+ problem?: StageProblem;
135
+ authMethod?: string | null;
136
+ }
137
+ interface AgentSetupStageLabels {
138
+ detect: string;
139
+ network: string;
140
+ install: string;
141
+ adapter: string;
142
+ login: string;
143
+ ready: string;
144
+ }
145
+ interface DeriveAgentSetupStagesInput {
146
+ detected: boolean;
147
+ cliInstalled: boolean;
148
+ versionTooOld: boolean;
149
+ /**
150
+ * The codex CLI launcher is resolved but its platform-specific optional
151
+ * dependency subpackage (e.g. @openai/codex-darwin-arm64) is missing — the
152
+ * binary spawns ENOENT. The daemon repairs this in place via the install
153
+ * action, so the install stage is `pending` (not `ok`) with a distinct
154
+ * "platform package missing" problem token.
155
+ */
156
+ platformPackageIncomplete?: boolean;
157
+ adapterInstalled: boolean;
158
+ adapterVersionMismatch: boolean;
159
+ authenticated: boolean;
160
+ authRequired: boolean;
161
+ ready: boolean;
162
+ activePhase: CodexSetupPhase | null;
163
+ /**
164
+ * Whether the daemon-driven install action is in flight. This is the
165
+ * authoritative "installing" signal: the adapter (external-registry) installer
166
+ * emits no activeAction phase, so without this an in-progress adapter install
167
+ * would show no spinner.
168
+ */
169
+ installActionPending: boolean;
170
+ loginPending: boolean;
171
+ /**
172
+ * Active connectivity probe verdict: true (reachable), false (offline), or
173
+ * null when the daemon reported no network info (older daemon / not probed) —
174
+ * null is treated as "don't block".
175
+ */
176
+ networkReachable: boolean | null;
177
+ cliVersionDetail: StageDetailToken | null;
178
+ adapterDetail: StageDetailToken | null;
179
+ accountDetail: StageDetailToken | null;
180
+ authMethod: string | null;
181
+ networkDetail: StageDetailToken | null;
182
+ labels: AgentSetupStageLabels;
183
+ }
184
+ /**
185
+ * Maps primitive provider-status flags onto the fixed 5-stage track the wizard
186
+ * renders. Version verification folds into the install (CLI) stage (an
187
+ * unsupported version means install is `error`, not `ok`). The adapter stage
188
+ * covers the ACP adapter, which for some providers (e.g. claude-code) is a
189
+ * separate, slow npm install distinct from the CLI; for providers where the
190
+ * adapter is the CLI itself it simply tracks the CLI. Login `running` is driven
191
+ * by the caller's pending flag because login runs as a terminal action, not via
192
+ * the activeAction phase stream.
193
+ */
194
+ declare function deriveAgentSetupStages(input: DeriveAgentSetupStagesInput): AgentSetupStage[];
195
+ /**
196
+ * Step-by-step reveal: even when prerequisites are already satisfied, the wizard
197
+ * walks a cursor down the track so each stage visibly "checks off" one at a time
198
+ * instead of all flashing complete at once.
199
+ *
200
+ * `revealIndex` is the cursor position. Stages before it show their real status
201
+ * (already revealed). The stage AT the cursor is shown as `running` when its
202
+ * real status is terminal-ok (the brief "working on it" moment before it checks
203
+ * off) and otherwise shows its real status (so a genuinely running install, an
204
+ * error, or a blocked prerequisite are honest). Stages after the cursor are
205
+ * dimmed to `pending`.
206
+ */
207
+ declare function projectRevealedStages(realStages: AgentSetupStage[], revealIndex: number): AgentSetupStage[];
208
+ /**
209
+ * The reveal cursor advances past a stage only once that stage is really done
210
+ * (`ok`/`skipped`). It parks on a stage that is still `running` (a real install
211
+ * in progress), `error`, or `pending` (a blocked prerequisite) — so the
212
+ * animation never races ahead of reality.
213
+ */
214
+ declare function shouldAdvanceReveal(realStages: AgentSetupStage[], revealIndex: number): boolean;
215
+ type StageActionId = "install" | "login" | "redetect";
216
+ /**
217
+ * The problem token a blocked stage represents. The UI maps this to "未xxx"
218
+ * copy; keeping it i18n-agnostic here lets the mapping stay tested without
219
+ * pulling translation strings into the pure flow module.
220
+ */
221
+ type StageProblem = "network-unreachable" | "install-missing" | "install-outdated" | "install-platform-incomplete" | "adapter-missing" | "adapter-mismatch" | "login-missing";
222
+ interface StageRemediation {
223
+ actionId: StageActionId;
224
+ problem: StageProblem;
225
+ }
226
+ /**
227
+ * For a stage the user must act on (idle `pending`/`error`, never `running` or
228
+ * `ok`), returns what is wrong and which action fixes it. `detect`/`ready` never
229
+ * carry their own remediation — they reflect prerequisites, not user actions.
230
+ *
231
+ * `error` means a version problem on the install/adapter stages (the only stages
232
+ * derive marks `error`); `pending` means the step simply has not run yet.
233
+ */
234
+ declare function stageRemediation(stage: AgentSetupStage): StageRemediation | null;
235
+ interface ResolveWizardAutoStartInput {
236
+ focus: AgentEnvPanelFocus | null;
237
+ detected: boolean;
238
+ ready: boolean;
239
+ installPending: boolean;
240
+ loginPending: boolean;
241
+ }
242
+ /**
243
+ * Decides whether opening the wizard with a remediation focus should auto-start
244
+ * an action. Returns the action id to run, or null when nothing should run
245
+ * (non-remediation focus, detection not settled, already ready, or already
246
+ * pending). The caller is responsible for firing this at most once per open.
247
+ */
248
+ declare function resolveWizardAutoStartAction(input: ResolveWizardAutoStartInput): "install" | "login" | null;
249
+
250
+ interface NetworkCheck {
251
+ kind: "registry" | "api" | "proxy";
252
+ reachable: boolean;
253
+ host: string | null;
254
+ configured?: boolean;
255
+ }
256
+ declare function deriveHasAnomaly(stages: AgentSetupStage[], activeActionError: CodexSetupActiveActionError | null): boolean;
257
+ interface AgentEnvWizardViewModelInput {
258
+ provider: WorkspaceAgentProvider;
259
+ status: AgentProviderStatus | null;
260
+ isLoading: boolean;
261
+ activeAction: CodexSetupActiveAction | null;
262
+ installActionPending: boolean;
263
+ loginPending: boolean;
264
+ revealIndex: number;
265
+ stageLabels: AgentSetupStageLabels;
266
+ }
267
+ interface AgentEnvWizardViewModel {
268
+ ready: boolean;
269
+ busy: boolean;
270
+ redetecting: boolean;
271
+ displayStages: AgentSetupStage[];
272
+ blockingStageId: AgentSetupStageId | null;
273
+ networkChecks: NetworkCheck[];
274
+ hasAnomaly: boolean;
275
+ activePhase: CodexSetupPhase | null;
276
+ log: string[];
277
+ registry: string | null;
278
+ error: CodexSetupActiveActionError | null;
279
+ manualCommand: string | null;
280
+ installPending: boolean;
281
+ loginPending: boolean;
282
+ }
283
+ declare function buildAgentEnvWizardViewModel(input: AgentEnvWizardViewModelInput): AgentEnvWizardViewModel;
284
+
285
+ export { type AgentEnvPanelFocus, type AgentEnvPanelRequest, type AgentEnvWizardViewModel, type AgentEnvWizardViewModelInput, type AgentErrorPresentation, type AgentRunErrorCode, type AgentSetupStage, type AgentSetupStageId, type AgentSetupStageLabels, type CodexSetupActiveAction, type CodexSetupActiveActionError, type CodexSetupPhase, type CodexSetupStep, type CodexSetupStepStatus, type DeriveAgentSetupStagesInput, type NetworkCheck, type OpenAgentEnvPanelInput, type ResolveWizardAutoStartInput, type StageActionId, type StageDetailToken, type StageProblem, type StageRemediation, buildAgentEnvWizardViewModel, classifyFailedAgentMessage, closeAgentEnvPanel, deriveAgentSetupStages, deriveHasAnomaly, getAgentEnvPanelStore, openAgentEnvPanel, projectRevealedStages, readCodexSetupActiveAction, reasonCodeIndicatesCliVersionUnsupported, resolveAgentErrorPresentation, resolveWizardAutoStartAction, shouldAdvanceReveal, stageRemediation, useAgentEnvPanelRequest };