@kortix/ui 0.15.0 → 0.15.1

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 (173) hide show
  1. package/dist/_vendor/kortix-shared.js +233 -130
  2. package/dist/_vendor/shared/code-language.d.ts +2 -2
  3. package/dist/_vendor/shared/html.d.ts +7 -0
  4. package/dist/_vendor/shared/index.d.ts +1 -0
  5. package/dist/_vendor/shared/pixel-mark.d.ts +28 -0
  6. package/dist/_vendor/shared/runtime-versions.d.ts +2 -6
  7. package/dist/_vendor/shared/tool-output/media-path.d.ts +1 -6
  8. package/dist/_vendor/shared/tool-output/scan.d.ts +2 -0
  9. package/dist/_vendor/shared/utils/string.d.ts +6 -0
  10. package/dist/artifacts/artifact-session.js +4 -3
  11. package/dist/customize/agents/agent-page.js +5 -5
  12. package/dist/customize/agents/agent-status.js +1 -1
  13. package/dist/customize/agents/agents-page.js +3 -3
  14. package/dist/customize/connectors/use-agent-access.d.ts +3 -3
  15. package/dist/customize/sections/connectors-view.js +50 -37
  16. package/dist/customize/sections/llm-provider/chatgpt-subscription-connect.js +21 -18
  17. package/dist/customize/sections/llm-provider/device-grant.d.ts +15 -0
  18. package/dist/customize/sections/llm-provider/device-grant.js +27 -0
  19. package/dist/customize/sections/view/agent-editor.d.ts +2 -2
  20. package/dist/customize/sections/view/agent-editor.js +2 -2
  21. package/dist/customize/sections/view/review-center-connected.js +37 -6
  22. package/dist/customize/sections/view/secret-delivery.d.ts +4 -5
  23. package/dist/customize/sections/view/secret-delivery.js +5 -4
  24. package/dist/customize/triggers/schedule/trigger-runs-logic.d.ts +6 -0
  25. package/dist/customize/triggers/schedule/trigger-runs-logic.js +13 -0
  26. package/dist/customize/triggers/schedule/trigger-runs-panel.js +9 -2
  27. package/dist/files/project/api/runtime-files.d.ts +2 -2
  28. package/dist/files/project/api/runtime-files.js +2 -2
  29. package/dist/files/project/components/drive-explorer.js +1 -1
  30. package/dist/files/project/components/drive-grid-view.js +0 -1
  31. package/dist/files/project/components/drive-list-view.js +0 -1
  32. package/dist/files/project/components/file-explorer-page.js +1 -1
  33. package/dist/files/project/hooks/index.d.ts +1 -1
  34. package/dist/files/project/hooks/index.js +1 -1
  35. package/dist/files/project/hooks/use-server-health.d.ts +1 -1
  36. package/dist/files/project/hooks/use-server-health.js +1 -1
  37. package/dist/files/project/search/workspace-search-service.d.ts +1 -1
  38. package/dist/files/project/search/workspace-search-service.js +1 -1
  39. package/dist/files/runtime/hooks/index.d.ts +1 -1
  40. package/dist/files/runtime/hooks/index.js +1 -1
  41. package/dist/files/runtime/hooks/server-health-state.d.ts +2 -2
  42. package/dist/files/runtime/hooks/server-health-state.js +2 -2
  43. package/dist/files/runtime/hooks/system-dir.js +2 -2
  44. package/dist/files/runtime/hooks/use-file-content.d.ts +1 -1
  45. package/dist/files/runtime/hooks/use-file-content.js +1 -1
  46. package/dist/files/runtime/hooks/use-file-list.d.ts +1 -1
  47. package/dist/files/runtime/hooks/use-file-list.js +3 -3
  48. package/dist/files/runtime/hooks/use-server-health.d.ts +2 -2
  49. package/dist/files/runtime/hooks/use-server-health.js +3 -3
  50. package/dist/files/runtime/hooks/use-workspace-search.d.ts +1 -2
  51. package/dist/files/runtime/hooks/use-workspace-search.js +0 -1
  52. package/dist/files/runtime/index.d.ts +2 -2
  53. package/dist/files/runtime/index.js +2 -2
  54. package/dist/files/runtime/path-utils.d.ts +1 -1
  55. package/dist/files/runtime/path-utils.js +1 -1
  56. package/dist/files/runtime/sandbox-explorer-source.d.ts +1 -1
  57. package/dist/files/runtime/sandbox-explorer-source.js +1 -1
  58. package/dist/files/runtime/sandbox-file-explorer.d.ts +1 -1
  59. package/dist/files/runtime/sandbox-file-explorer.js +2 -2
  60. package/dist/files/tree/components/file-tree-item.js +0 -1
  61. package/dist/files/tree/hooks/use-file-events.d.ts +1 -1
  62. package/dist/files/tree/hooks/use-file-events.js +1 -1
  63. package/dist/i18n/en.d.ts +63 -1
  64. package/dist/i18n/en.js +79 -17
  65. package/dist/internal/files/file-read-retry.js +1 -1
  66. package/dist/internal/files/types.d.ts +2 -2
  67. package/dist/internal/files/types.js +2 -2
  68. package/dist/internal/goals/goal-meta.d.ts +33 -14
  69. package/dist/internal/goals/goal-meta.js +55 -13
  70. package/dist/internal/layout/nav-hover-card.d.ts +1 -1
  71. package/dist/internal/layout/nav-hover-card.js +1 -1
  72. package/dist/internal/layout/project-capability-nav.d.ts +1 -1
  73. package/dist/internal/layout/project-capability-nav.js +1 -1
  74. package/dist/internal/lib/browser-error-noise.d.ts +1 -1
  75. package/dist/internal/lib/browser-error-noise.js +1 -1
  76. package/dist/internal/lib/browser-noise/rules/expected-states.js +1 -1
  77. package/dist/internal/lib/browser-noise/rules/injected-scripts.js +18 -0
  78. package/dist/internal/lib/browser-noise/rules/old-browsers.d.ts +1 -0
  79. package/dist/internal/lib/browser-noise/rules/old-browsers.js +1 -1
  80. package/dist/internal/lib/browser-noise/rules/rejections.d.ts +0 -9
  81. package/dist/internal/lib/browser-noise/rules/rejections.js +0 -14
  82. package/dist/internal/lib/delivered-but-disconnected.js +3 -5
  83. package/dist/internal/lib/error-handler.js +8 -3
  84. package/dist/internal/lib/pixel-mark.d.ts +4 -17
  85. package/dist/internal/lib/pixel-mark.js +5 -148
  86. package/dist/internal/lib/sounds.d.ts +4 -4
  87. package/dist/internal/lib/sounds.js +4 -4
  88. package/dist/internal/lib/use-project-feature-flags.js +3 -1
  89. package/dist/internal/stores/composer-prefill-store.js +4 -1
  90. package/dist/internal/stores/sound-store.d.ts +4 -4
  91. package/dist/internal/stores/sound-store.js +10 -0
  92. package/dist/markdown/code/shiki-highlighter.js +14 -5
  93. package/dist/markdown/file-links.js +12 -3
  94. package/dist/markdown/markdown-frontmatter.d.ts +6 -6
  95. package/dist/markdown/markdown-frontmatter.js +3 -3
  96. package/dist/primitives/button.js +2 -1
  97. package/dist/session/agents/held-messages.d.ts +1 -5
  98. package/dist/session/agents/held-messages.js +1 -21
  99. package/dist/session/composer/ComposerAboveCard.d.ts +4 -1
  100. package/dist/session/composer/ComposerAboveCard.js +2 -2
  101. package/dist/session/composer/composer-chat-input.d.ts +1 -1
  102. package/dist/session/composer/composer-chat-input.js +2 -2
  103. package/dist/session/composer/composer.js +16 -1
  104. package/dist/session/composer/hooks/use-file-search.d.ts +15 -15
  105. package/dist/session/composer/hooks/use-file-search.js +16 -16
  106. package/dist/session/composer/menus/mention-controller.js +1 -3
  107. package/dist/session/composer/menus/space-mentions.d.ts +14 -4
  108. package/dist/session/composer/menus/space-mentions.js +17 -1
  109. package/dist/session/composer/use-instant-session-send.js +2 -2
  110. package/dist/session/header/session-goal-indicator.js +4 -4
  111. package/dist/session/panel/easy/plan-card.d.ts +2 -2
  112. package/dist/session/panel/easy/plan-card.js +2 -2
  113. package/dist/session/panel/session-desktop.js +6 -0
  114. package/dist/session/panel/use-session-panel-state.js +2 -2
  115. package/dist/session/status/sandbox-loading-boundary.js +2 -2
  116. package/dist/session/status/session-terminal-state.d.ts +47 -0
  117. package/dist/session/status/session-terminal-state.js +56 -0
  118. package/dist/session/thread/plan-surface.d.ts +1 -1
  119. package/dist/session/thread/plan-surface.js +1 -1
  120. package/dist/session/thread/session-chat.d.ts +1 -1
  121. package/dist/session/thread/session-chat.js +88 -99
  122. package/dist/session/thread/stop-sequence.d.ts +51 -0
  123. package/dist/session/thread/stop-sequence.js +55 -0
  124. package/dist/session/thread/transcript.d.ts +2 -2
  125. package/dist/session/thread/transcript.js +2 -2
  126. package/dist/session/tool/tools/apply-patch-tool.d.ts +1 -1
  127. package/dist/session/tool/tools/apply-patch-tool.js +1 -1
  128. package/dist/session/tool/tools/kortix-action-tool.js +1 -1
  129. package/dist/session/tool/tools/multi-agent-tool-bodies.d.ts +1 -1
  130. package/dist/session/tool/tools/multi-agent-tool-bodies.js +1 -1
  131. package/dist/session/tool/tools/multi-agent-tools.js +1 -1
  132. package/dist/session/tool/tools/pty-kill-tool.d.ts +1 -1
  133. package/dist/session/tool/tools/pty-kill-tool.js +1 -1
  134. package/dist/session/tool/tools/pty-read-tool.d.ts +2 -2
  135. package/dist/session/tool/tools/pty-read-tool.js +2 -2
  136. package/dist/session/tool/tools/pty-spawn-tool.d.ts +1 -1
  137. package/dist/session/tool/tools/pty-spawn-tool.js +1 -1
  138. package/dist/session/tool/tools/pty-write-tool.d.ts +1 -1
  139. package/dist/session/tool/tools/pty-write-tool.js +1 -1
  140. package/dist/session/tool/tools/todo-write-tool.d.ts +1 -1
  141. package/dist/session/tool/tools/todo-write-tool.js +1 -1
  142. package/dist/session/turn/peer-message-row.d.ts +1 -10
  143. package/dist/session/turn/peer-message-row.js +1 -18
  144. package/dist/session/turn/plan-anchor.d.ts +3 -3
  145. package/dist/session/turn/plan-anchor.js +3 -3
  146. package/dist/session/turn/plan-card.d.ts +7 -7
  147. package/dist/session/turn/plan-card.js +7 -7
  148. package/dist/styles.css +1 -1
  149. package/dist/terminal/terminal-card-gate.d.ts +6 -3
  150. package/dist/terminal/terminal-card-gate.js +21 -4
  151. package/dist/workspace/index.d.ts +1 -1
  152. package/dist/workspace/index.js +1 -1
  153. package/dist/workspace/review/review-center.d.ts +8 -2
  154. package/dist/workspace/review/review-center.js +44 -13
  155. package/dist/workspace/review/review-reducer.d.ts +7 -0
  156. package/dist/workspace/review/review-reducer.js +11 -0
  157. package/dist/workspace/sidebar/footer/project-artifacts-nav.d.ts +6 -1
  158. package/dist/workspace/sidebar/footer/project-artifacts-nav.js +47 -4
  159. package/dist/workspace/sidebar/project-nav-items.js +11 -12
  160. package/dist/workspace/spaces/principal-card.d.ts +3 -1
  161. package/dist/workspace/spaces/principal-card.js +3 -3
  162. package/dist/workspace/spaces/space-agent-ask.d.ts +14 -0
  163. package/dist/workspace/spaces/space-agent-ask.js +36 -0
  164. package/dist/workspace/spaces/space-details-dialog.js +1 -1
  165. package/dist/workspace/spaces/space-details-panel.d.ts +2 -1
  166. package/dist/workspace/spaces/space-details-panel.js +62 -8
  167. package/dist/workspace/spaces/space-mention-source.d.ts +3 -2
  168. package/dist/workspace/spaces/space-mention-source.js +12 -19
  169. package/dist/workspace/spaces/space-view.js +3 -2
  170. package/package.json +3 -3
  171. package/skills/kortix-ui/references/modules.md +1 -1
  172. package/dist/session/tool/tools/multi-agent-tool-data.d.ts +0 -63
  173. package/dist/session/tool/tools/multi-agent-tool-data.js +0 -118
@@ -10,7 +10,7 @@ import { resolveComposerAgent, withChannelAgents } from './composer-agent-access
10
10
  import { inheritedModelFor } from './chat-input/chat-input-summary.js';
11
11
  /**
12
12
  * The canonical "compose a first message" input: {@link SessionChatInput}
13
- * pre-wired with the OpenCode model / agent / variant / command selectors (the
13
+ * pre-wired with the model / agent / variant / command selectors (the
14
14
  * four catalog queries + per-session selection state). Used by the home composer
15
15
  * and the instant session shell so neither hand-rolls the selector wiring.
16
16
  *
@@ -24,7 +24,7 @@ export function ComposerChatInput({ onSend, onCommand, sessionId, projectId, isB
24
24
  const { data: providers, isLoading: providersLoading } = useRuntimeProviders();
25
25
  const { data: config } = useRuntimeConfig();
26
26
  const projectConfig = useProjectConfig(projectId);
27
- const startAgent = defaultAgentName || (projectConfig?.default_agent ?? projectConfig?.open_code_default_agent);
27
+ const startAgent = defaultAgentName || projectConfig?.default_agent;
28
28
  const local = useSessionModelSelection({
29
29
  agents,
30
30
  providers,
@@ -8,7 +8,7 @@ import { isImageFile } from '../../internal/lib/utils/file-utils.js';
8
8
  import { useProjectConfig, usePromptAttachments, useRuntimeSessions } from '@kortix/sdk/react';
9
9
  import { useActiveSpace } from '../../internal/stores/active-space-store.js';
10
10
  import { newPastedContentId, splitPastedContent, trimPastedText } from '../../_vendor/kortix-shared.js';
11
- import { memo, useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore, } from 'react';
11
+ import { memo, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore, } from 'react';
12
12
  import { extractClipboardFiles } from './clipboard-files.js';
13
13
  import { mergeFailedSubmissionFiles } from './composer-draft-recovery.js';
14
14
  import { resolveComposerResetOnSend } from './composer-reset.js';
@@ -30,6 +30,7 @@ import { getContextUsage } from './context-ring.js';
30
30
  import { useComposerFocus } from './hooks/use-composer-focus.js';
31
31
  import { useMenuRevalidation } from './hooks/use-file-search.js';
32
32
  import { controlToOpenFor, hostSlashActions, localizedSlashActions, slashActionShown } from './menus/slash-actions.js';
33
+ import { outsideAgentMentions, SpaceMentionContext } from './menus/space-mentions.js';
33
34
  import { promptHistoryEntries, stepPromptHistory } from './prompt-history.js';
34
35
  import { createSubmitLatch } from './submit-latch.js';
35
36
  /**
@@ -120,6 +121,14 @@ function ComposerImpl(props) {
120
121
  const tHardcodedUi = useTranslations('hardcodedUi');
121
122
  const tThreads = useTranslations('threads');
122
123
  const dockId = `composer-slash-dock-${useId().replace(/[^a-zA-Z0-9]/g, '')}`;
124
+ // Inside a space (flag `chat`): the agents a sent message named from outside
125
+ // it. Mentioning one never adds it; the line above the card asks first.
126
+ const spaceMentions = useContext(SpaceMentionContext);
127
+ const spaceMentionsRef = useRef(spaceMentions);
128
+ useEffect(() => {
129
+ spaceMentionsRef.current = spaceMentions;
130
+ }, [spaceMentions]);
131
+ const [outsideAsk, setOutsideAsk] = useState([]);
123
132
  const [attachedFiles, setAttachedFiles] = useState([]);
124
133
  // Synchronous mirror of `attachedFiles`, for the one reader that cannot
125
134
  // wait for a React flush: the submit latch's stash (see `handleSubmit`).
@@ -1202,6 +1211,9 @@ function ComposerImpl(props) {
1202
1211
  // right after the paint (`deliverAfterPaint`), so the next Send never waits
1203
1212
  // behind them. The host releases the uploads after its POST; a send it keeps
1204
1213
  // on screen as failed still holds them for its Retry.
1214
+ const outside = spaceMentionsRef.current ? outsideAgentMentions(spaceMentionsRef.current, trimmed) : [];
1215
+ if (outside.length > 0)
1216
+ setOutsideAsk(outside);
1205
1217
  await runComposerSend({
1206
1218
  submission: attachmentSubmission,
1207
1219
  controller: promptAttachments,
@@ -1522,6 +1534,9 @@ function ComposerImpl(props) {
1522
1534
  quotes,
1523
1535
  quoteListLabels,
1524
1536
  handleRemoveQuote,
1537
+ spaceAsk: outsideAsk.length > 0 && spaceMentions?.renderOutsideAsk
1538
+ ? spaceMentions.renderOutsideAsk(outsideAsk[0], () => setOutsideAsk((list) => list.slice(1)))
1539
+ : null,
1525
1540
  };
1526
1541
  return (_jsxs("div", { className: cn(COMPOSER_SHELL_CLASS,
1527
1542
  // `'below'` docks the `/` menu as an overlay of later siblings
@@ -68,29 +68,29 @@ export declare function isMenuOpenTransition(wasOpen: boolean, isOpen: boolean):
68
68
  * pure function — same reasoning as `isMenuOpenTransition` above — so the
69
69
  * key SELECTION is directly testable, not just asserted by code review.
70
70
  *
71
- * Commands has exactly ONE query-key shape: `useOpenCodeCommands`
72
- * (`use-opencode-sessions/commands.ts`) never branches, so the bare
73
- * `['opencode', 'commands']` prefix always reaches it.
71
+ * Commands has exactly ONE query-key shape: `useRuntimeCommands`
72
+ * (`packages/sdk/src/react/use-runtime-sessions/commands.ts`) never branches,
73
+ * so the bare `[...runtimeKeys.all, 'commands']` prefix always reaches it.
74
74
  *
75
- * Agents does NOT have one shape. `useOpenCodeAgents`
76
- * (`use-opencode-sessions/agents.ts:42-46`) branches on `projectId`:
75
+ * Agents does NOT have one shape. `useRuntimeAgents`
76
+ * (`packages/sdk/src/react/use-runtime-sessions/agents.ts`) branches on
77
+ * `projectId`:
77
78
  *
78
79
  * ```ts
79
80
  * queryKey: projectId
80
81
  * ? [...qk.project.detail(projectId), 'agents'] // ['kx','project',<id>,'detail','agents']
81
82
  * : directory
82
- * ? [...opencodeKeys.agents(), 'dir', directory] // ['opencode','agents',<server>,'dir',<dir>]
83
- * : opencodeKeys.agents() // ['opencode','agents',<server>]
83
+ * ? [...runtimeKeys.agents(), 'dir', directory] // ['runtime','agents',<server>,'dir',<dir>]
84
+ * : runtimeKeys.agents() // ['runtime','agents',<server>]
84
85
  * ```
85
86
  *
86
- * The bare `['opencode', 'agents']` prefix (`runtimeKeys.agents()` minus its
87
+ * The bare `['runtime', 'agents']` prefix (`runtimeKeys.agents()` minus its
87
88
  * trailing server segment) DOES reach the `directory` and no-argument
88
- * branches — both start with `opencodeKeys.agents()`, so it's a genuine
89
+ * branches — both start with `runtimeKeys.agents()`, so it's a genuine
89
90
  * prefix of both. It is DISJOINT AT SEGMENT 0 from the `projectId` branch's
90
91
  * `['kx', 'project', ...]` shape — no amount of prefix-matching bridges
91
- * `'opencode'` and `'kx'`. Every real composer call site passes `projectId`
92
- * (`instant-session-shell.tsx:88`, `composer-chat-input.tsx:108`,
93
- * `session-chat.tsx:1641`), so invalidating only the bare prefix was a
92
+ * `'runtime'` and `'kx'`. Every real composer call site passes `projectId`,
93
+ * so invalidating only the bare prefix was a
94
94
  * SILENT no-op for agents in every actual composer — commands and skills
95
95
  * refreshed, agents did not, and nothing about `invalidateQueries` failing
96
96
  * to match anything ever surfaces an error.
@@ -104,7 +104,7 @@ export declare function isMenuOpenTransition(wasOpen: boolean, isOpen: boolean):
104
104
  * the exact same way `agents.ts` itself builds it, not a hand-typed
105
105
  * `['kx', 'project', ...]` literal — see `use-file-search.test.ts` for the
106
106
  * test that binds this to `qk.project.detail` directly, so a future
107
- * reshuffle of `useOpenCodeAgents`'s branching can't repeat this silently.
107
+ * reshuffle of `useRuntimeAgents`'s branching can't repeat this silently.
108
108
  */
109
109
  export declare function menuRevalidationKeys(projectId?: string | null): QueryKey[];
110
110
  /**
@@ -113,7 +113,7 @@ export declare function menuRevalidationKeys(projectId?: string | null): QueryKe
113
113
  * caching and revalidation, like query revalidate."
114
114
  *
115
115
  * `useRuntimeAgents`/`useRuntimeCommands` (`@kortix/sdk/react`, backed by
116
- * `packages/sdk/src/react/use-opencode-sessions/{agents,commands}.ts`) both
116
+ * `packages/sdk/src/react/use-runtime-sessions/{agents,commands}.ts`) both
117
117
  * set `staleTime: Infinity` — correct for the SDK's other consumers, which
118
118
  * have no equivalent of "the user is about to pick from this list right
119
119
  * now" to hang a refetch off of, so `packages/sdk` is deliberately left
@@ -132,6 +132,6 @@ export declare function menuRevalidationKeys(projectId?: string | null): QueryKe
132
132
  * commands) and 3 with one (agents, commands, project-scoped agents) — MORE
133
133
  * calls than a naive read of "invalidate the agents cache" suggests, and
134
134
  * that is correct: `menuRevalidationKeys`'s own doc comment is the reason
135
- * why one key alone cannot reach every branch `useOpenCodeAgents` can take.
135
+ * why one key alone cannot reach every branch `useRuntimeAgents` can take.
136
136
  */
137
137
  export declare function useMenuRevalidation(isOpen: boolean, projectId?: string | null): void;
@@ -64,7 +64,7 @@ export function useFileSearch(query, enabled) {
64
64
  // hidden tab (see use-composer-focus.ts) would only re-read it when
65
65
  // something else happens to re-render the component. `getActiveServerUrl()`
66
66
  // has the identical gap — it wraps the same read with no subscription of
67
- // its own (see use-opencode-events/index.ts, which pairs it with
67
+ // its own (see use-runtime-events/index.ts, which pairs it with
68
68
  // `useCurrentRuntime` for exactly this reason). `useActiveSandboxProxyContext`
69
69
  // is the SDK's reactive form: it re-renders on every `setCurrentRuntime`
70
70
  // (session switch), so `server` and the sandbox `searchWorkspaceFiles`
@@ -119,29 +119,29 @@ export function isMenuOpenTransition(wasOpen, isOpen) {
119
119
  * pure function — same reasoning as `isMenuOpenTransition` above — so the
120
120
  * key SELECTION is directly testable, not just asserted by code review.
121
121
  *
122
- * Commands has exactly ONE query-key shape: `useOpenCodeCommands`
123
- * (`use-opencode-sessions/commands.ts`) never branches, so the bare
124
- * `['opencode', 'commands']` prefix always reaches it.
122
+ * Commands has exactly ONE query-key shape: `useRuntimeCommands`
123
+ * (`packages/sdk/src/react/use-runtime-sessions/commands.ts`) never branches,
124
+ * so the bare `[...runtimeKeys.all, 'commands']` prefix always reaches it.
125
125
  *
126
- * Agents does NOT have one shape. `useOpenCodeAgents`
127
- * (`use-opencode-sessions/agents.ts:42-46`) branches on `projectId`:
126
+ * Agents does NOT have one shape. `useRuntimeAgents`
127
+ * (`packages/sdk/src/react/use-runtime-sessions/agents.ts`) branches on
128
+ * `projectId`:
128
129
  *
129
130
  * ```ts
130
131
  * queryKey: projectId
131
132
  * ? [...qk.project.detail(projectId), 'agents'] // ['kx','project',<id>,'detail','agents']
132
133
  * : directory
133
- * ? [...opencodeKeys.agents(), 'dir', directory] // ['opencode','agents',<server>,'dir',<dir>]
134
- * : opencodeKeys.agents() // ['opencode','agents',<server>]
134
+ * ? [...runtimeKeys.agents(), 'dir', directory] // ['runtime','agents',<server>,'dir',<dir>]
135
+ * : runtimeKeys.agents() // ['runtime','agents',<server>]
135
136
  * ```
136
137
  *
137
- * The bare `['opencode', 'agents']` prefix (`runtimeKeys.agents()` minus its
138
+ * The bare `['runtime', 'agents']` prefix (`runtimeKeys.agents()` minus its
138
139
  * trailing server segment) DOES reach the `directory` and no-argument
139
- * branches — both start with `opencodeKeys.agents()`, so it's a genuine
140
+ * branches — both start with `runtimeKeys.agents()`, so it's a genuine
140
141
  * prefix of both. It is DISJOINT AT SEGMENT 0 from the `projectId` branch's
141
142
  * `['kx', 'project', ...]` shape — no amount of prefix-matching bridges
142
- * `'opencode'` and `'kx'`. Every real composer call site passes `projectId`
143
- * (`instant-session-shell.tsx:88`, `composer-chat-input.tsx:108`,
144
- * `session-chat.tsx:1641`), so invalidating only the bare prefix was a
143
+ * `'runtime'` and `'kx'`. Every real composer call site passes `projectId`,
144
+ * so invalidating only the bare prefix was a
145
145
  * SILENT no-op for agents in every actual composer — commands and skills
146
146
  * refreshed, agents did not, and nothing about `invalidateQueries` failing
147
147
  * to match anything ever surfaces an error.
@@ -155,7 +155,7 @@ export function isMenuOpenTransition(wasOpen, isOpen) {
155
155
  * the exact same way `agents.ts` itself builds it, not a hand-typed
156
156
  * `['kx', 'project', ...]` literal — see `use-file-search.test.ts` for the
157
157
  * test that binds this to `qk.project.detail` directly, so a future
158
- * reshuffle of `useOpenCodeAgents`'s branching can't repeat this silently.
158
+ * reshuffle of `useRuntimeAgents`'s branching can't repeat this silently.
159
159
  */
160
160
  export function menuRevalidationKeys(projectId) {
161
161
  const keys = [runtimeKeys.agents().slice(0, -1), runtimeKeys.commands().slice(0, -1)];
@@ -170,7 +170,7 @@ export function menuRevalidationKeys(projectId) {
170
170
  * caching and revalidation, like query revalidate."
171
171
  *
172
172
  * `useRuntimeAgents`/`useRuntimeCommands` (`@kortix/sdk/react`, backed by
173
- * `packages/sdk/src/react/use-opencode-sessions/{agents,commands}.ts`) both
173
+ * `packages/sdk/src/react/use-runtime-sessions/{agents,commands}.ts`) both
174
174
  * set `staleTime: Infinity` — correct for the SDK's other consumers, which
175
175
  * have no equivalent of "the user is about to pick from this list right
176
176
  * now" to hang a refetch off of, so `packages/sdk` is deliberately left
@@ -189,7 +189,7 @@ export function menuRevalidationKeys(projectId) {
189
189
  * commands) and 3 with one (agents, commands, project-scoped agents) — MORE
190
190
  * calls than a naive read of "invalidate the agents cache" suggests, and
191
191
  * that is correct: `menuRevalidationKeys`'s own doc comment is the reason
192
- * why one key alone cannot reach every branch `useOpenCodeAgents` can take.
192
+ * why one key alone cannot reach every branch `useRuntimeAgents` can take.
193
193
  */
194
194
  export function useMenuRevalidation(isOpen, projectId) {
195
195
  const queryClient = useQueryClient();
@@ -138,10 +138,8 @@ export function createMentionSuggestion(opts) {
138
138
  ...baseSuggestion('@', MENTION_PLUGIN_KEY, controller),
139
139
  command: ({ editor, range, props: row }) => {
140
140
  editor.chain().focus().deleteRange(range).run();
141
+ // An agent from outside the space only gets named: the composer asks to add it after the send.
141
142
  insertMention(editor, { kind: row.kind, label: row.label, value: row.value });
142
- // An agent mentioned from outside the space joins it.
143
- if (row.addToSpace)
144
- opts.getSpaceMentions?.()?.onAddAgent?.(row.value);
145
143
  },
146
144
  };
147
145
  }
@@ -1,3 +1,4 @@
1
+ import { type ReactNode } from 'react';
1
2
  import type { MentionSection } from './menu-items.js';
2
3
  /**
3
4
  * The `@` menu inside a space (flag `chat`): People, then Agents, nothing
@@ -23,15 +24,19 @@ export interface SpaceMentionAgent {
23
24
  /** The display name ("My Kortix"). */
24
25
  label: string;
25
26
  description?: string | null;
26
- /** False: not in this space yet; picking it adds it (`onAddAgent`). */
27
+ /** False: not in this space. Naming it does not add it: the composer asks after the send (`renderOutsideAsk`). */
27
28
  inSpace: boolean;
28
29
  }
29
30
  export interface SpaceMentionSource {
30
31
  people: SpaceMentionPerson[];
31
32
  agents: SpaceMentionAgent[];
32
- /** Adds an agent to the space when it is mentioned from outside it. Absent: such agents are not offered. */
33
- onAddAgent?: (name: string) => void;
34
- /** Group headings and the "Add to space" line, in the host's words. */
33
+ /**
34
+ * The ask shown above the composer after a send named an agent from outside
35
+ * the space: "Add it?" for a person who may edit the space, else who to ask.
36
+ * `done` dismisses it. Absent: agents outside the space are not offered.
37
+ */
38
+ renderOutsideAsk?: (agent: string, done: () => void) => ReactNode;
39
+ /** Group headings and the "Not in #space" line, in the host's words. */
35
40
  labels: {
36
41
  people: string;
37
42
  agents: string;
@@ -46,3 +51,8 @@ export declare const SpaceMentionContext: import("react").Context<SpaceMentionSo
46
51
  export declare function mentionScore(query: string, fields: readonly (string | null | undefined)[]): number;
47
52
  /** The menu's sections for a space: People, then Agents (the space's own first). */
48
53
  export declare function buildSpaceMentionSections(source: SpaceMentionSource, query: string): MentionSection[];
54
+ /**
55
+ * The agents outside the space that `text` names (`@name`, the token a mention
56
+ * chip sends), in order, each once. The router never hands work to them.
57
+ */
58
+ export declare function outsideAgentMentions(source: SpaceMentionSource, text: string): string[];
@@ -58,7 +58,7 @@ export function buildSpaceMentionSections(source, query) {
58
58
  })),
59
59
  });
60
60
  }
61
- const offered = source.agents.filter((a) => a.inSpace || !!source.onAddAgent);
61
+ const offered = source.agents.filter((a) => a.inSpace || !!source.renderOutsideAsk);
62
62
  // The space's own agents first among equal matches; a miss stays a miss.
63
63
  const agents = ranked(offered, (a) => {
64
64
  const score = mentionScore(query, [a.label, a.name]);
@@ -81,3 +81,19 @@ export function buildSpaceMentionSections(source, query) {
81
81
  }
82
82
  return sections;
83
83
  }
84
+ /**
85
+ * The agents outside the space that `text` names (`@name`, the token a mention
86
+ * chip sends), in order, each once. The router never hands work to them.
87
+ */
88
+ export function outsideAgentMentions(source, text) {
89
+ if (!source.renderOutsideAsk)
90
+ return [];
91
+ const outside = new Map(source.agents.filter((a) => !a.inSpace).map((a) => [a.name.toLowerCase(), a.name]));
92
+ const found = [];
93
+ for (const match of text.matchAll(/(?:^|[^\w@])@([\w.+-]+)/g)) {
94
+ const name = outside.get(match[1].replace(/[.]+$/, '').toLowerCase());
95
+ if (name && !found.includes(name))
96
+ found.push(name);
97
+ }
98
+ return found;
99
+ }
@@ -180,8 +180,8 @@ function useFirstPromptSources({ sessionId, hydrated, promptInbox, submission, }
180
180
  // `readStartStash` covers the canonical SDK stash (written under the route
181
181
  // session id by this shell, the project-home composer, and
182
182
  // `useConfigureThread` — all three producers now share the one canonical
183
- // shape) plus its `opencode_pending_prompt` legacy fallback for any other
184
- // as-yet-unconverted producer.
183
+ // shape) plus the legacy `opencode_pending_prompt` key an older tab may
184
+ // still hold.
185
185
  const text = readStartStash(sessionId)?.prompt;
186
186
  if (!text)
187
187
  return null;
@@ -18,7 +18,7 @@ import { useFeatureFlag, useSessionGoal } from '@kortix/sdk/react';
18
18
  import { TargetIcon } from '@phosphor-icons/react';
19
19
  import { useState } from 'react';
20
20
  import { useSessionIds } from '../../providers/session-ids.js';
21
- import { formatGoalTime, GoalHealthDot, goalHref, goalOpenAsks, goalProgress, GoalStatusBadge, useGoalIssueText, } from '../../internal/goals/goal-meta.js';
21
+ import { formatGoalTime, GoalHealthDot, goalHref, goalLastWake, goalNextWake, goalOpenAsks, goalPaused, goalProgress, GoalStatusBadge, useGoalIssueText, } from '../../internal/goals/goal-meta.js';
22
22
  export function SessionGoalIndicator() {
23
23
  const t = useTranslations('goals');
24
24
  const locale = useLocale();
@@ -35,7 +35,7 @@ export function SessionGoalIndicator() {
35
35
  const asks = goalOpenAsks(doc);
36
36
  const href = goalHref(projectId, goal);
37
37
  const attention = goal.health.state === 'attention';
38
- return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { variant: "ghost", size: "icon", "aria-label": t('sessionChip'), className: "relative", "data-testid": "session-goal-chip", children: [_jsx(TargetIcon, { className: "size-4" }), attention ? _jsx(StatusDot, { tone: "warning", className: "absolute top-1 right-1" }) : null] }) }), _jsxs(PopoverContent, { align: "end", sideOffset: 8, className: "w-80 overflow-hidden p-0", children: [_jsxs("div", { className: "flex flex-col gap-2 border-b px-4 pt-4 pb-3", children: [_jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsx("h3", { className: "text-foreground text-sm font-medium", children: t('sessionChip') }), _jsx(GoalStatusBadge, { status: doc?.status })] }), _jsx("p", { className: "text-foreground line-clamp-2 text-sm", children: doc?.objective ?? goal.slug }), _jsx("p", { className: "text-muted-foreground text-xs", children: t(`sessionRole.${role}`) })] }), _jsxs("div", { className: "flex flex-col gap-2 px-4 py-3 text-xs", children: [_jsxs("div", { className: "flex items-start gap-2", children: [_jsx("span", { className: "mt-1", children: _jsx(GoalHealthDot, { goal: goal }) }), _jsxs("div", { className: "flex min-w-0 flex-col gap-1", children: [_jsx("span", { className: "text-foreground", children: t(`health.${goal.health.state}`) }), goal.health.issues.map((issue) => (_jsx("span", { className: "text-muted-foreground", children: issueText(issue, goal) }, issue)))] })] }), _jsxs("dl", { className: "text-muted-foreground grid grid-cols-[auto_1fr] gap-x-3 gap-y-1", children: [_jsx("dt", { children: t('progress') }), _jsx("dd", { className: "text-foreground tabular-nums", children: t('criteria', { met: progress.met, total: progress.total }) }), goal.health.state !== 'closed' ? (_jsxs(_Fragment, { children: [_jsx("dt", { children: t('heartbeat') }), _jsx("dd", { className: "text-foreground", children: goal.heartbeat?.state === 'active' && goal.heartbeat.next_fire_at
39
- ? t('nextWake', { time: formatGoalTime(goal.heartbeat.next_fire_at, locale, now) })
40
- : t('noWake') })] })) : null, goal.heartbeat?.last_fired_at ? (_jsxs(_Fragment, { children: [_jsx("dt", { children: t('lastWakeLabel') }), _jsx("dd", { className: "text-foreground", children: formatGoalTime(goal.heartbeat.last_fired_at, locale, now) })] })) : null] }), asks.length > 0 ? (_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("span", { className: "text-muted-foreground", children: t('needsYou') }), _jsx("ul", { className: "flex flex-col gap-1", children: asks.map((ask) => (_jsxs("li", { className: "text-foreground flex justify-between gap-2", children: [_jsx("span", { className: "min-w-0 truncate", children: ask.title }), ask.due ? _jsx("span", { className: "text-muted-foreground shrink-0", children: formatGoalTime(ask.due, locale, now) }) : null] }, ask.id))) })] })) : null] }), href ? (_jsx("div", { className: "border-t px-4 py-2", children: _jsx(Button, { asChild: true, variant: "ghost", size: "sm", className: "w-full justify-center", children: _jsx(HoverPrefetchLink, { href: href, onClick: () => setOpen(false), children: t('openGoal') }) }) })) : null] })] }));
38
+ return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { variant: "ghost", size: "icon", "aria-label": t('sessionChip'), className: "relative", "data-testid": "session-goal-chip", children: [_jsx(TargetIcon, { className: "size-4" }), attention ? _jsx(StatusDot, { tone: "warning", className: "absolute top-1 right-1" }) : null] }) }), _jsxs(PopoverContent, { align: "end", sideOffset: 8, className: "w-80 overflow-hidden p-0", children: [_jsxs("div", { className: "flex flex-col gap-2 border-b px-4 pt-4 pb-3", children: [_jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsx("h3", { className: "text-foreground text-sm font-medium", children: t('sessionChip') }), _jsx(GoalStatusBadge, { status: doc?.status, paused: goalPaused(goal) })] }), _jsx("p", { className: "text-foreground line-clamp-2 text-sm", children: doc?.objective ?? goal.slug }), _jsx("p", { className: "text-muted-foreground text-xs", children: t(`sessionRole.${role}`) })] }), _jsxs("div", { className: "flex flex-col gap-2 px-4 py-3 text-xs", children: [_jsxs("div", { className: "flex items-start gap-2", children: [_jsx("span", { className: "mt-1", children: _jsx(GoalHealthDot, { goal: goal }) }), _jsxs("div", { className: "flex min-w-0 flex-col gap-1", children: [_jsx("span", { className: "text-foreground", children: t(`health.${goal.health.state}`) }), goal.health.issues.map((issue) => (_jsx("span", { className: "text-muted-foreground", children: issueText(issue, goal) }, issue)))] })] }), _jsxs("dl", { className: "text-muted-foreground grid grid-cols-[auto_1fr] gap-x-3 gap-y-1", children: [_jsx("dt", { children: t('progress') }), _jsx("dd", { className: "text-foreground tabular-nums", children: t('criteria', { met: progress.met, total: progress.total }) }), goal.health.state !== 'closed' ? (_jsxs(_Fragment, { children: [_jsx("dt", { children: t('heartbeat') }), _jsx("dd", { className: "text-foreground", children: goalNextWake(goal)
39
+ ? t('nextWake', { time: formatGoalTime(goalNextWake(goal), locale, now) })
40
+ : t('noWake') })] })) : null, goalLastWake(goal) ? (_jsxs(_Fragment, { children: [_jsx("dt", { children: t('lastWakeLabel') }), _jsx("dd", { className: "text-foreground", children: formatGoalTime(goalLastWake(goal), locale, now) })] })) : null] }), asks.length > 0 ? (_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("span", { className: "text-muted-foreground", children: t('needsYou') }), _jsx("ul", { className: "flex flex-col gap-1", children: asks.map((ask) => (_jsxs("li", { className: "text-foreground flex justify-between gap-2", children: [_jsx("span", { className: "min-w-0 truncate", children: ask.title }), ask.due ? _jsx("span", { className: "text-muted-foreground shrink-0", children: formatGoalTime(ask.due, locale, now) }) : null] }, ask.id))) })] })) : null] }), href ? (_jsx("div", { className: "border-t px-4 py-2", children: _jsx(Button, { asChild: true, variant: "ghost", size: "sm", className: "w-full justify-center", children: _jsx(HoverPrefetchLink, { href: href, onClick: () => setOpen(false), children: t('openGoal') }) }) })) : null] })] }));
41
41
  }
@@ -10,13 +10,13 @@ import { type TodoItem } from '../../tool/shared/todo-helpers.js';
10
10
  * single row.
11
11
  *
12
12
  * Pure, so both branches are testable without mounting anything.
13
- * @deprecated Renders an OpenCode-only tool or todo list in an OpenCode session (pi has none). OpenCode is sunset (2026-10-23): no new code; delete with OpenCode.
13
+ * @deprecated Renders an OpenCode-only tool or todo list (pi has none). Only a transcript OpenCode wrote holds one; this keeps it readable. No new code.
14
14
  */
15
15
  export declare function planPanelRows(todos: ReadonlyArray<TodoItem>): Array<{
16
16
  todo: TodoItem;
17
17
  key: string;
18
18
  }>;
19
- /** @deprecated Renders an OpenCode-only tool or todo list in an OpenCode session (pi has none). OpenCode is sunset (2026-10-23): no new code; delete with OpenCode. */
19
+ /** @deprecated Renders an OpenCode-only tool or todo list (pi has none). Only a transcript OpenCode wrote holds one; this keeps it readable. No new code. */
20
20
  export declare function PlanPanelCard({ sessionId }: {
21
21
  sessionId: string;
22
22
  }): import("react").JSX.Element | null;
@@ -64,7 +64,7 @@ function PlanProgress({ done, total, running }) {
64
64
  * single row.
65
65
  *
66
66
  * Pure, so both branches are testable without mounting anything.
67
- * @deprecated Renders an OpenCode-only tool or todo list in an OpenCode session (pi has none). OpenCode is sunset (2026-10-23): no new code; delete with OpenCode.
67
+ * @deprecated Renders an OpenCode-only tool or todo list (pi has none). Only a transcript OpenCode wrote holds one; this keeps it readable. No new code.
68
68
  */
69
69
  export function planPanelRows(todos) {
70
70
  // Keyed first, filtered second — see `planListTodos`: keying first is what
@@ -73,7 +73,7 @@ export function planPanelRows(todos) {
73
73
  const listed = planListTodos(keyed);
74
74
  return listed.length > 0 ? listed : keyed;
75
75
  }
76
- /** @deprecated Renders an OpenCode-only tool or todo list in an OpenCode session (pi has none). OpenCode is sunset (2026-10-23): no new code; delete with OpenCode. */
76
+ /** @deprecated Renders an OpenCode-only tool or todo list (pi has none). Only a transcript OpenCode wrote holds one; this keeps it readable. No new code. */
77
77
  export function PlanPanelCard({ sessionId }) {
78
78
  const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
79
79
  const { data } = useRuntimeSessionTodo(sessionId);
@@ -13,6 +13,12 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
13
13
  * (or a click on the screen) drops the shield, rings the screen and focuses
14
14
  * it; "Return control" puts the shield back.
15
15
  *
16
+ * voxl resizes the desktop to the viewer's window (--enable-resize). With more
17
+ * than one viewer, one viewer sizes it: the first to connect, then whoever
18
+ * acts on the desktop (apps/sandbox/voxl/size-owner.patch); the others watch
19
+ * it scaled. Before that patch two viewers of different sizes resized it back
20
+ * and forth, and every resize showed a black frame.
21
+ *
16
22
  * The frame unmounts while this browser tab is hidden. voxl paces every
17
23
  * viewer to the slowest one, and a background tab stops acking frames, so a
18
24
  * forgotten tab would slow the stream for everyone watching. It reconnects,
@@ -25,7 +25,7 @@ export function useSessionPanelView({ sessionId, projectId, projectSessionId, tr
25
25
  //
26
26
  // A transient sub-session has no Kortix session row for `/turn` to answer
27
27
  // about, so it keeps the stream slot — repaired on every stream (re)connect
28
- // by the status-snapshot reconciler in `use-opencode-events`.
28
+ // by the status-snapshot reconciler in `use-runtime-events`.
29
29
  const sessionStatus = useSessionStateStore((s) => s.sessionStatus[sessionId]);
30
30
  const working = useSessionWorking(projectId ?? '', projectSessionId ?? '', {
31
31
  enabled: !!projectId && !!projectSessionId,
@@ -77,7 +77,7 @@ export function useSessionPanelSessionSync({ sessionId, projectSessionId, transi
77
77
  // `continuity` names the Kortix project session behind this layout id and
78
78
  // whether this mount is the transient boot shell. The store uses it for one
79
79
  // thing: the boot→ready crossfade renames the layout from the Kortix session
80
- // id (shell) to the OpenCode id (real chat) for the SAME session — that
80
+ // id (shell) to the runtime session id (real chat) for the SAME session — that
81
81
  // handoff must carry an open panel across instead of slamming it shut.
82
82
  useEffect(() => {
83
83
  if (!isVisibleLayout)
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  /**
4
- * Safety net for the session subtree: during sandbox provisioning the opencode
4
+ * Safety net for the session subtree: during sandbox provisioning the
5
5
  * runtime URL isn't pinned yet, and any stray `getClient()` call throws
6
6
  * "Server URL not ready — sandbox is still loading". Without this, such a throw
7
7
  * escalates to the Next route boundary (app/error.tsx) and the user sees a hard
@@ -13,7 +13,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
13
13
  * must never be replaced by a full-page loading logo. Every other error is
14
14
  * rethrown so it bubbles to the outer boundary exactly as before.
15
15
  *
16
- * The gate fix in `use-opencode-sessions/keys.ts` + the guard in `session-chat`
16
+ * The gate fix in `use-runtime-sessions/keys.ts` + the guard in `session-chat`
17
17
  * should prevent these throws in the first place; this is belt-and-suspenders so
18
18
  * a missed caller degrades to "loading", never to a crash.
19
19
  */
@@ -68,3 +68,50 @@ export interface StoppedSandboxCacheState {
68
68
  * returns `false`: the terminal card stays exactly as it was, byte for byte.
69
69
  */
70
70
  export declare function canRenderCachedTranscriptWhileSandboxDown(state: StoppedSandboxCacheState): boolean;
71
+ /**
72
+ * Which surface the session route paints, decided in ONE place.
73
+ *
74
+ * The route used to decide this with an ordered `if` chain over a dozen
75
+ * booleans, and the order was the only transition table. This function is
76
+ * that table. Every input is a fact the route already derives; the output
77
+ * names a full-screen surface (`screen`), a terminal notice in the composer's
78
+ * slot over a readable transcript (`notice`), or neither (the chat).
79
+ *
80
+ * Precedence, first match wins:
81
+ * 1. switch-loading · 2. billing-gated · 3. missing (404) · 4. archived (the
82
+ * session was deleted and its computer removed) · 5. repository-disconnected
83
+ * · 6. waking (the wake ladder still has rungs) or start-failure · 7. dormant
84
+ * (stopped, no sandbox row) · 8. runtime-lost · 9. stopped (`fatal`): the
85
+ * auto-resume boot loader or the Restart card · 10. chat.
86
+ *
87
+ * A readable transcript turns 5, 6 (failure), 7 (legacy) and 8 into notices,
88
+ * and a notice blocks the lower terminal checks (7, 8), as before. Step 9
89
+ * still replaces the chat when no cached transcript may render.
90
+ */
91
+ export type SessionRouteScreen = 'switch-loading' | 'billing-gated' | 'missing' | 'archived' | 'repository-disconnected' | 'waking' | 'start-failure' | 'legacy-dormant' | 'stopped-dormant' | 'runtime-lost' | 'auto-resuming' | 'stopped';
92
+ export type SessionRouteNotice = 'archived' | 'repository-disconnected' | 'start-failure' | 'legacy-dormant' | 'runtime-lost';
93
+ export interface SessionRouteSurfaceInput {
94
+ sessionSwitchLoading: boolean;
95
+ gated: boolean;
96
+ sessionMissing: boolean;
97
+ /** `sandbox.status === 'archived'`. */
98
+ sandboxArchived: boolean;
99
+ repositoryDisconnected: boolean;
100
+ wakeLadderHolding: boolean;
101
+ /** `recoverableFailure !== null`. */
102
+ hasRecoverableFailure: boolean;
103
+ dormantWithoutRuntime: boolean;
104
+ legacyMigrated: boolean;
105
+ runtimeIdentityUnavailable: boolean;
106
+ previousRepositoryHistoryAvailable: boolean;
107
+ /** `sandbox.status` is `stopped|error` and `shouldPaintFatalCard` says paint. */
108
+ fatal: boolean;
109
+ autoResuming: boolean;
110
+ hasTranscript: boolean;
111
+ showCachedTranscriptWhileDown: boolean;
112
+ }
113
+ export interface SessionRouteSurface {
114
+ screen: SessionRouteScreen | null;
115
+ notice: SessionRouteNotice | null;
116
+ }
117
+ export declare function resolveSessionRouteSurface(input: SessionRouteSurfaceInput): SessionRouteSurface;
@@ -60,3 +60,59 @@ export function canRenderCachedTranscriptWhileSandboxDown(state) {
60
60
  const sandboxIsDown = state.sandboxStatus === 'stopped' || state.sandboxStatus === 'error';
61
61
  return sandboxIsDown && state.hasCachedContent;
62
62
  }
63
+ export function resolveSessionRouteSurface(input) {
64
+ const screen = (kind) => ({ screen: kind, notice: null });
65
+ if (input.sessionSwitchLoading)
66
+ return screen('switch-loading');
67
+ if (input.gated)
68
+ return screen('billing-gated');
69
+ if (input.sessionMissing)
70
+ return screen('missing');
71
+ let notice = null;
72
+ const screenOrNotice = (kind) => {
73
+ if (!input.hasTranscript)
74
+ return screen(kind);
75
+ notice = kind;
76
+ return null;
77
+ };
78
+ if (input.sandboxArchived) {
79
+ const surface = screenOrNotice('archived');
80
+ if (surface)
81
+ return surface;
82
+ }
83
+ if (!notice && input.repositoryDisconnected) {
84
+ const surface = screenOrNotice('repository-disconnected');
85
+ if (surface)
86
+ return surface;
87
+ }
88
+ if (input.wakeLadderHolding) {
89
+ if (!input.showCachedTranscriptWhileDown)
90
+ return screen('waking');
91
+ }
92
+ else if (input.hasRecoverableFailure && !notice) {
93
+ const surface = screenOrNotice('start-failure');
94
+ if (surface)
95
+ return surface;
96
+ }
97
+ if (!notice && input.dormantWithoutRuntime) {
98
+ if (input.legacyMigrated) {
99
+ const surface = screenOrNotice('legacy-dormant');
100
+ if (surface)
101
+ return surface;
102
+ }
103
+ else if (!input.hasTranscript) {
104
+ // A deliberate stop with a readable transcript is not a dead end: the
105
+ // conversation and a live composer stay (a send wakes the box).
106
+ return screen('stopped-dormant');
107
+ }
108
+ }
109
+ if (!notice && input.runtimeIdentityUnavailable && !input.previousRepositoryHistoryAvailable) {
110
+ const surface = screenOrNotice('runtime-lost');
111
+ if (surface)
112
+ return surface;
113
+ }
114
+ if (input.fatal && !input.showCachedTranscriptWhileDown) {
115
+ return screen(input.autoResuming ? 'auto-resuming' : 'stopped');
116
+ }
117
+ return { screen: null, notice };
118
+ }
@@ -5,6 +5,6 @@
5
5
  * `isActionPanelOpen` / `isSidePanelOpen` / `panelMode`: those made the plan
6
6
  * hop surfaces on every panel toggle, and they also re-rendered the whole
7
7
  * transcript each time one of them changed.
8
- * @deprecated Renders an OpenCode-only tool or todo list in an OpenCode session (pi has none). OpenCode is sunset (2026-10-23): no new code; delete with OpenCode.
8
+ * @deprecated Renders an OpenCode-only tool or todo list (pi has none). Only a transcript OpenCode wrote holds one; this keeps it readable. No new code.
9
9
  */
10
10
  export declare function usePlanInChat(): boolean;
@@ -23,7 +23,7 @@ import { planBelongsToChat } from '../turn/plan-anchor.js';
23
23
  * `isActionPanelOpen` / `isSidePanelOpen` / `panelMode`: those made the plan
24
24
  * hop surfaces on every panel toggle, and they also re-rendered the whole
25
25
  * transcript each time one of them changed.
26
- * @deprecated Renders an OpenCode-only tool or todo list in an OpenCode session (pi has none). OpenCode is sunset (2026-10-23): no new code; delete with OpenCode.
26
+ * @deprecated Renders an OpenCode-only tool or todo list (pi has none). Only a transcript OpenCode wrote holds one; this keeps it readable. No new code.
27
27
  */
28
28
  export function usePlanInChat() {
29
29
  return planBelongsToChat({ isMobile: useIsMobile() });
@@ -44,7 +44,7 @@ interface SessionChatProps {
44
44
  * the not-found card — rather than its own "starting" loader.
45
45
  *
46
46
  * The project-session route crossfades the instant boot shell into this
47
- * component over 300ms. It used to start that fade as soon as an OpenCode
47
+ * component over 300ms. It used to start that fade as soon as a runtime
48
48
  * session id existed, which is earlier than this component has anything to
49
49
  * show: the fade landed on the compact `SessionStartingLoader` below, which
50
50
  * then swapped to the transcript. Two handovers where the user asked for one.