@kortix/ui 0.15.0 → 0.15.2

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 (220) 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 -2
  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-frame.d.ts +0 -1
  11. package/dist/artifacts/artifact-frame.js +4 -10
  12. package/dist/artifacts/artifact-session.js +4 -7
  13. package/dist/artifacts/frame-policy.d.ts +1 -1
  14. package/dist/artifacts/frame-policy.js +2 -2
  15. package/dist/customize/agents/agent-page.js +5 -5
  16. package/dist/customize/agents/agent-status.js +1 -1
  17. package/dist/customize/agents/agents-page.js +3 -3
  18. package/dist/customize/connectors/use-agent-access.d.ts +3 -3
  19. package/dist/customize/sections/connectors-view.js +50 -37
  20. package/dist/customize/sections/llm-provider/chatgpt-subscription-connect.js +21 -18
  21. package/dist/customize/sections/llm-provider/device-grant.d.ts +15 -0
  22. package/dist/customize/sections/llm-provider/device-grant.js +27 -0
  23. package/dist/customize/sections/view/agent-editor-catalog.js +0 -5
  24. package/dist/customize/sections/view/agent-editor.d.ts +2 -2
  25. package/dist/customize/sections/view/agent-editor.js +2 -2
  26. package/dist/customize/sections/view/review-center-connected.js +37 -6
  27. package/dist/customize/sections/view/secret-delivery.d.ts +4 -5
  28. package/dist/customize/sections/view/secret-delivery.js +5 -4
  29. package/dist/customize/triggers/schedule/trigger-list.d.ts +2 -2
  30. package/dist/customize/triggers/schedule/trigger-list.js +12 -18
  31. package/dist/customize/triggers/schedule/trigger-runs-logic.d.ts +6 -0
  32. package/dist/customize/triggers/schedule/trigger-runs-logic.js +13 -0
  33. package/dist/customize/triggers/schedule/trigger-runs-panel.js +9 -2
  34. package/dist/files/project/api/runtime-files.d.ts +2 -2
  35. package/dist/files/project/api/runtime-files.js +2 -2
  36. package/dist/files/project/components/drive-explorer.js +1 -1
  37. package/dist/files/project/components/drive-grid-view.js +0 -1
  38. package/dist/files/project/components/drive-list-view.js +0 -1
  39. package/dist/files/project/components/file-explorer-page.js +1 -1
  40. package/dist/files/project/hooks/index.d.ts +1 -1
  41. package/dist/files/project/hooks/index.js +1 -1
  42. package/dist/files/project/hooks/use-server-health.d.ts +1 -1
  43. package/dist/files/project/hooks/use-server-health.js +1 -1
  44. package/dist/files/project/search/workspace-search-service.d.ts +1 -1
  45. package/dist/files/project/search/workspace-search-service.js +1 -1
  46. package/dist/files/runtime/hooks/index.d.ts +1 -1
  47. package/dist/files/runtime/hooks/index.js +1 -1
  48. package/dist/files/runtime/hooks/server-health-state.d.ts +2 -2
  49. package/dist/files/runtime/hooks/server-health-state.js +2 -2
  50. package/dist/files/runtime/hooks/system-dir.js +2 -2
  51. package/dist/files/runtime/hooks/use-file-content.d.ts +1 -1
  52. package/dist/files/runtime/hooks/use-file-content.js +1 -1
  53. package/dist/files/runtime/hooks/use-file-list.d.ts +1 -1
  54. package/dist/files/runtime/hooks/use-file-list.js +3 -3
  55. package/dist/files/runtime/hooks/use-server-health.d.ts +2 -2
  56. package/dist/files/runtime/hooks/use-server-health.js +3 -3
  57. package/dist/files/runtime/hooks/use-workspace-search.d.ts +1 -2
  58. package/dist/files/runtime/hooks/use-workspace-search.js +0 -1
  59. package/dist/files/runtime/index.d.ts +2 -2
  60. package/dist/files/runtime/index.js +2 -2
  61. package/dist/files/runtime/path-utils.d.ts +1 -1
  62. package/dist/files/runtime/path-utils.js +1 -1
  63. package/dist/files/runtime/sandbox-explorer-source.d.ts +1 -1
  64. package/dist/files/runtime/sandbox-explorer-source.js +1 -1
  65. package/dist/files/runtime/sandbox-file-explorer.d.ts +1 -1
  66. package/dist/files/runtime/sandbox-file-explorer.js +2 -2
  67. package/dist/files/tree/components/file-tree-item.js +0 -1
  68. package/dist/files/tree/hooks/use-file-events.d.ts +1 -1
  69. package/dist/files/tree/hooks/use-file-events.js +1 -1
  70. package/dist/i18n/en.d.ts +60 -175
  71. package/dist/i18n/en.js +71 -186
  72. package/dist/internal/components/agent-mark.js +6 -0
  73. package/dist/internal/components/clickable-path.d.ts +3 -0
  74. package/dist/internal/components/clickable-path.js +4 -1
  75. package/dist/internal/files/file-read-retry.js +1 -1
  76. package/dist/internal/files/types.d.ts +2 -2
  77. package/dist/internal/files/types.js +2 -2
  78. package/dist/internal/goals/goal-meta.d.ts +33 -14
  79. package/dist/internal/goals/goal-meta.js +55 -13
  80. package/dist/internal/layout/nav-hover-card.d.ts +1 -1
  81. package/dist/internal/layout/nav-hover-card.js +1 -1
  82. package/dist/internal/layout/project-capability-nav.d.ts +1 -1
  83. package/dist/internal/layout/project-capability-nav.js +1 -1
  84. package/dist/internal/lib/browser-error-noise.d.ts +1 -1
  85. package/dist/internal/lib/browser-error-noise.js +1 -1
  86. package/dist/internal/lib/browser-noise/rules/expected-states.js +1 -1
  87. package/dist/internal/lib/browser-noise/rules/injected-scripts.js +29 -0
  88. package/dist/internal/lib/browser-noise/rules/old-browsers.d.ts +1 -0
  89. package/dist/internal/lib/browser-noise/rules/old-browsers.js +1 -1
  90. package/dist/internal/lib/browser-noise/rules/rejections.d.ts +0 -9
  91. package/dist/internal/lib/browser-noise/rules/rejections.js +0 -14
  92. package/dist/internal/lib/delivered-but-disconnected.js +3 -5
  93. package/dist/internal/lib/error-handler.js +8 -3
  94. package/dist/internal/lib/pixel-mark.d.ts +4 -17
  95. package/dist/internal/lib/pixel-mark.js +5 -148
  96. package/dist/internal/lib/sounds.d.ts +4 -4
  97. package/dist/internal/lib/sounds.js +4 -4
  98. package/dist/internal/lib/trigger-clock.d.ts +5 -0
  99. package/dist/internal/lib/trigger-clock.js +15 -0
  100. package/dist/internal/lib/turn-broadcast.d.ts +0 -3
  101. package/dist/internal/lib/use-project-feature-flags.d.ts +2 -0
  102. package/dist/internal/lib/use-project-feature-flags.js +5 -5
  103. package/dist/internal/lib/web-notifications.d.ts +1 -8
  104. package/dist/internal/lib/web-notifications.js +12 -53
  105. package/dist/internal/notifications/notification-bell.d.ts +13 -33
  106. package/dist/internal/notifications/notification-bell.js +14 -117
  107. package/dist/internal/notifications/notification-inbox.d.ts +45 -0
  108. package/dist/internal/notifications/notification-inbox.js +119 -0
  109. package/dist/internal/notifications/notification-rows.d.ts +3 -4
  110. package/dist/internal/notifications/notification-rows.js +1 -4
  111. package/dist/internal/notifications/use-inbox-summary.d.ts +13 -0
  112. package/dist/internal/notifications/use-inbox-summary.js +22 -0
  113. package/dist/internal/notifications/web-push.d.ts +9 -10
  114. package/dist/internal/notifications/web-push.js +9 -10
  115. package/dist/internal/stores/composer-prefill-store.js +4 -1
  116. package/dist/internal/stores/sound-store.d.ts +4 -4
  117. package/dist/internal/stores/sound-store.js +10 -0
  118. package/dist/internal/stores/web-notification-store.d.ts +6 -9
  119. package/dist/internal/stores/web-notification-store.js +0 -4
  120. package/dist/lib/routes.d.ts +8 -0
  121. package/dist/lib/routes.js +4 -1
  122. package/dist/markdown/code/shiki-highlighter.js +14 -5
  123. package/dist/markdown/doc-editor/doc-menus.d.ts +1 -10
  124. package/dist/markdown/doc-editor/doc-menus.js +6 -69
  125. package/dist/markdown/file-links.js +33 -3
  126. package/dist/markdown/markdown-frontmatter.d.ts +6 -6
  127. package/dist/markdown/markdown-frontmatter.js +3 -3
  128. package/dist/primitives/button.d.ts +1 -1
  129. package/dist/primitives/button.js +2 -1
  130. package/dist/session/agents/held-messages.d.ts +1 -5
  131. package/dist/session/agents/held-messages.js +1 -21
  132. package/dist/session/composer/ComposerAboveCard.d.ts +4 -1
  133. package/dist/session/composer/ComposerAboveCard.js +2 -2
  134. package/dist/session/composer/composer-chat-input.d.ts +1 -1
  135. package/dist/session/composer/composer-chat-input.js +2 -2
  136. package/dist/session/composer/composer.js +16 -1
  137. package/dist/session/composer/hooks/use-file-search.d.ts +15 -15
  138. package/dist/session/composer/hooks/use-file-search.js +16 -16
  139. package/dist/session/composer/menus/mention-controller.js +1 -3
  140. package/dist/session/composer/menus/space-mentions.d.ts +14 -4
  141. package/dist/session/composer/menus/space-mentions.js +17 -1
  142. package/dist/session/composer/use-instant-session-send.js +2 -2
  143. package/dist/session/header/reminder-parts.d.ts +1 -1
  144. package/dist/session/header/session-goal-indicator.js +4 -4
  145. package/dist/session/header/session-site-header.js +2 -6
  146. package/dist/session/panel/easy/plan-card.d.ts +2 -2
  147. package/dist/session/panel/easy/plan-card.js +2 -2
  148. package/dist/session/panel/session-desktop.js +6 -0
  149. package/dist/session/panel/session-reminders-panel.js +4 -15
  150. package/dist/session/panel/use-session-panel-state.js +2 -2
  151. package/dist/session/status/sandbox-loading-boundary.js +2 -2
  152. package/dist/session/status/session-terminal-state.d.ts +47 -0
  153. package/dist/session/status/session-terminal-state.js +56 -0
  154. package/dist/session/thread/plan-surface.d.ts +1 -1
  155. package/dist/session/thread/plan-surface.js +1 -1
  156. package/dist/session/thread/session-chat.d.ts +1 -1
  157. package/dist/session/thread/session-chat.js +88 -99
  158. package/dist/session/thread/stop-sequence.d.ts +51 -0
  159. package/dist/session/thread/stop-sequence.js +55 -0
  160. package/dist/session/thread/transcript.d.ts +2 -2
  161. package/dist/session/thread/transcript.js +2 -2
  162. package/dist/session/tool/tools/apply-patch-tool.d.ts +1 -1
  163. package/dist/session/tool/tools/apply-patch-tool.js +1 -1
  164. package/dist/session/tool/tools/kortix-action-tool.js +1 -1
  165. package/dist/session/tool/tools/multi-agent-tool-bodies.d.ts +1 -1
  166. package/dist/session/tool/tools/multi-agent-tool-bodies.js +1 -1
  167. package/dist/session/tool/tools/multi-agent-tools.js +1 -1
  168. package/dist/session/tool/tools/pty-kill-tool.d.ts +1 -1
  169. package/dist/session/tool/tools/pty-kill-tool.js +1 -1
  170. package/dist/session/tool/tools/pty-read-tool.d.ts +2 -2
  171. package/dist/session/tool/tools/pty-read-tool.js +2 -2
  172. package/dist/session/tool/tools/pty-spawn-tool.d.ts +1 -1
  173. package/dist/session/tool/tools/pty-spawn-tool.js +1 -1
  174. package/dist/session/tool/tools/pty-write-tool.d.ts +1 -1
  175. package/dist/session/tool/tools/pty-write-tool.js +1 -1
  176. package/dist/session/tool/tools/session-spawn-tool.js +7 -4
  177. package/dist/session/tool/tools/task-tool.js +18 -4
  178. package/dist/session/tool/tools/todo-write-tool.d.ts +1 -1
  179. package/dist/session/tool/tools/todo-write-tool.js +1 -1
  180. package/dist/session/turn/peer-message-row.d.ts +1 -10
  181. package/dist/session/turn/peer-message-row.js +1 -18
  182. package/dist/session/turn/plan-anchor.d.ts +3 -3
  183. package/dist/session/turn/plan-anchor.js +3 -3
  184. package/dist/session/turn/plan-card.d.ts +7 -7
  185. package/dist/session/turn/plan-card.js +7 -7
  186. package/dist/styles.css +1 -1
  187. package/dist/terminal/terminal-card-gate.d.ts +6 -3
  188. package/dist/terminal/terminal-card-gate.js +21 -4
  189. package/dist/workspace/home/access-requests-bell.d.ts +6 -9
  190. package/dist/workspace/home/access-requests-bell.js +8 -10
  191. package/dist/workspace/index.d.ts +1 -1
  192. package/dist/workspace/index.js +1 -1
  193. package/dist/workspace/layout/project-home.js +1 -2
  194. package/dist/workspace/review/review-center.d.ts +8 -2
  195. package/dist/workspace/review/review-center.js +44 -13
  196. package/dist/workspace/review/review-reducer.d.ts +7 -0
  197. package/dist/workspace/review/review-reducer.js +11 -0
  198. package/dist/workspace/sidebar/footer/project-artifacts-nav.d.ts +6 -1
  199. package/dist/workspace/sidebar/footer/project-artifacts-nav.js +47 -4
  200. package/dist/workspace/sidebar/project-nav-items.js +11 -12
  201. package/dist/workspace/sidebar/project-sidebar.js +2 -6
  202. package/dist/workspace/spaces/principal-card.d.ts +3 -1
  203. package/dist/workspace/spaces/principal-card.js +3 -3
  204. package/dist/workspace/spaces/space-agent-ask.d.ts +14 -0
  205. package/dist/workspace/spaces/space-agent-ask.js +36 -0
  206. package/dist/workspace/spaces/space-details-dialog.js +1 -1
  207. package/dist/workspace/spaces/space-details-panel.d.ts +2 -1
  208. package/dist/workspace/spaces/space-details-panel.js +62 -8
  209. package/dist/workspace/spaces/space-mention-source.d.ts +3 -2
  210. package/dist/workspace/spaces/space-mention-source.js +12 -19
  211. package/dist/workspace/spaces/space-view.js +3 -2
  212. package/package.json +11 -7
  213. package/skills/kortix-ui/references/custom-dashboard.md +1 -1
  214. package/skills/kortix-ui/references/modules.md +1 -1
  215. package/dist/_vendor/shared/artifact-annotations.d.ts +0 -311
  216. package/dist/_vendor/shared/artifact-comments.d.ts +0 -155
  217. package/dist/internal/hooks/use-notification-center.d.ts +0 -50
  218. package/dist/internal/hooks/use-notification-center.js +0 -151
  219. package/dist/session/tool/tools/multi-agent-tool-data.d.ts +0 -63
  220. package/dist/session/tool/tools/multi-agent-tool-data.js +0 -118
@@ -11,6 +11,32 @@ import { isUnderSandboxRoot } from '@kortix/sdk';
11
11
  const FILE_LINK_HREF = '#kortix-file:';
12
12
  const FILE_SCHEME = /^(?:sandbox|file|computer):(?:\/\/[^/]*)?/i;
13
13
  const ANY_SCHEME = /^[a-z][a-z0-9+.-]*:/i;
14
+ /**
15
+ * A path the file preview can open: under a sandbox root, or under a session's
16
+ * drive mounts (`/drives/<mount>/…`), which the file client reads through the
17
+ * drive API (`internal/files/session-drive-files.ts`). A router links a worker's
18
+ * result file in the thread folder this way.
19
+ */
20
+ function isFilePreviewPath(path) {
21
+ return isUnderSandboxRoot(path) || (path.startsWith('/drives/') && !path.split('/').some((part) => part === '..' || part === '.'));
22
+ }
23
+ /**
24
+ * The path of a link to this app's own `/drives/…` URL, still encoded, or null.
25
+ * The web app has no `/drives` route: `https://<app>/drives/me/a.jpg` is the
26
+ * same file as `/drives/me/a.jpg`, not a page. Without a window (server
27
+ * render) no origin is this app's.
28
+ */
29
+ function ownDriveUrlPath(href) {
30
+ if (typeof window === 'undefined')
31
+ return null;
32
+ try {
33
+ const url = new URL(href);
34
+ return url.origin === window.location.origin && url.pathname.startsWith('/drives/') ? url.pathname : null;
35
+ }
36
+ catch {
37
+ return null;
38
+ }
39
+ }
14
40
  /**
15
41
  * Resolves a document-relative href against the directory of the document
16
42
  * that contains the link, lexically (`.` and `..` only — no filesystem
@@ -39,13 +65,14 @@ function resolveDocumentRelative(baseDir, href) {
39
65
  */
40
66
  export function workspaceFileLinkPath(url, baseDir) {
41
67
  let path = url?.trim() ?? '';
68
+ path = ownDriveUrlPath(path) ?? path;
42
69
  if (FILE_SCHEME.test(path)) {
43
70
  path = path.replace(FILE_SCHEME, '');
44
71
  }
45
72
  else if (ANY_SCHEME.test(path) || /^(?:[#?]|\/\/)/.test(path)) {
46
73
  return null;
47
74
  }
48
- else if (path.startsWith('/') && !isUnderSandboxRoot(path)) {
75
+ else if (path.startsWith('/') && !isFilePreviewPath(path)) {
49
76
  // A root-relative path outside the sandbox roots is an app route.
50
77
  return null;
51
78
  }
@@ -60,8 +87,11 @@ export function workspaceFileLinkPath(url, baseDir) {
60
87
  const resolved = path.startsWith('/')
61
88
  ? resolveDocumentRelative('', path)
62
89
  : resolveDocumentRelative(baseDir, path);
63
- return resolved && isUnderSandboxRoot(resolved) ? resolved : null;
90
+ return resolved && isFilePreviewPath(resolved) ? resolved : null;
64
91
  }
92
+ // An encoded `..` (`%2F..%2F`) only shows after decoding.
93
+ if (path.startsWith('/drives/') && !isFilePreviewPath(path))
94
+ return null;
65
95
  return path || null;
66
96
  }
67
97
  export function parseFileLinkHref(href, document = false) {
@@ -72,7 +102,7 @@ export function parseFileLinkHref(href, document = false) {
72
102
  if (!document)
73
103
  return path || null;
74
104
  const resolved = resolveDocumentRelative('', path);
75
- return path.startsWith('/') && resolved && isUnderSandboxRoot(resolved) ? resolved : null;
105
+ return path.startsWith('/') && resolved && isFilePreviewPath(resolved) ? resolved : null;
76
106
  }
77
107
  catch {
78
108
  return null;
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  /**
3
- * Minimal YAML frontmatter rendering for markdown files (opencode-style agent
4
- * and skill definitions, but generic). The parser handles flat key/value pairs
5
- * plus a single level of nested objects — enough for the patterns documented
6
- * at https://opencode.ai/docs/agents/ and similar conventions.
3
+ * Minimal YAML frontmatter rendering for markdown files (agent and skill
4
+ * definitions, but generic). The parser handles flat key/value pairs plus a
5
+ * single level of nested objects — enough for agent and skill frontmatter
6
+ * (`description`, `mode`, `permission`, ...) and similar conventions.
7
7
  */
8
8
  export type FrontmatterValue = string | Record<string, string>;
9
9
  export interface ParsedMarkdown {
@@ -13,8 +13,8 @@ export interface ParsedMarkdown {
13
13
  export declare function parseFrontmatter(content: string): ParsedMarkdown;
14
14
  /**
15
15
  * Render markdown content; if a leading YAML frontmatter block is present, it
16
- * renders as a small metadata card above the prose. Used for opencode-style
17
- * agent / skill markdown files (and any other frontmatter-prefixed `.md`).
16
+ * renders as a small metadata card above the prose. Used for agent / skill
17
+ * markdown files (and any other frontmatter-prefixed `.md`).
18
18
  */
19
19
  export declare function MarkdownWithFrontmatter({ content, className, documentPath, }: {
20
20
  content: string;
@@ -64,7 +64,7 @@ export function parseFrontmatter(content) {
64
64
  const line = rawLine.trimEnd();
65
65
  if (!line.trim() || line.trim().startsWith('#'))
66
66
  continue;
67
- // A nested key may be QUOTED, and in the opencode permission idiom it
67
+ // A nested key may be QUOTED, and in the agent permission idiom it
68
68
  // usually is — `"*": allow`. Matching only [\w.-] dropped that line, left
69
69
  // the parent an empty object, and printed a bare em-dash where the
70
70
  // permissions belong. Wildcards and path-ish keys are accepted bare too.
@@ -143,8 +143,8 @@ function FrontmatterValueBody({ value }) {
143
143
  }
144
144
  /**
145
145
  * Render markdown content; if a leading YAML frontmatter block is present, it
146
- * renders as a small metadata card above the prose. Used for opencode-style
147
- * agent / skill markdown files (and any other frontmatter-prefixed `.md`).
146
+ * renders as a small metadata card above the prose. Used for agent / skill
147
+ * markdown files (and any other frontmatter-prefixed `.md`).
148
148
  */
149
149
  export function MarkdownWithFrontmatter({ content, className, documentPath, }) {
150
150
  const { frontmatter, body } = parseFrontmatter(content);
@@ -1,7 +1,7 @@
1
1
  import { type VariantProps } from 'class-variance-authority';
2
2
  import * as React from 'react';
3
3
  declare const buttonVariants: (props?: ({
4
- variant?: "link" | "input" | "text" | "popover" | "background" | "outline" | "accent" | "error" | "secondary" | "success" | "warning" | "info" | "default" | "destructive" | "blue" | "muted" | "danger" | "transparent" | "brand" | "blue-ghost" | "blue-secondary" | "outline-ghost" | "secondary-outline" | "sidebar" | "ghost" | "foreground" | "outline-foreground" | "inverse" | "invert-outline-foreground" | "ghost-input" | "ghost-sidebar" | "outline-sidebar" | null | undefined;
4
+ variant?: "link" | "input" | "text" | "popover" | "background" | "outline" | "accent" | "error" | "secondary" | "success" | "warning" | "info" | "default" | "destructive" | "muted" | "danger" | "blue" | "transparent" | "brand" | "blue-ghost" | "blue-secondary" | "outline-ghost" | "secondary-outline" | "sidebar" | "ghost" | "foreground" | "outline-foreground" | "inverse" | "invert-outline-foreground" | "ghost-input" | "ghost-sidebar" | "outline-sidebar" | null | undefined;
5
5
  size?: "base" | "default" | "icon" | "toolbar" | "xs" | "sm" | "lg" | "xl" | "icon-xs" | "icon-sm" | "icon-base" | "icon-md" | "icon-lg" | "magic-sm" | null | undefined;
6
6
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
7
  export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
@@ -40,7 +40,8 @@ const buttonVariants = cva("flex items-center justify-center gap-2 whitespace-no
40
40
  },
41
41
  size: {
42
42
  default: 'h-9 px-4 py-2 has-[>svg]:px-3',
43
- xs: 'h-7 gap-1.5 px-2.5 rounded-sm has-[>svg]:px-2',
43
+ // In a group, the radius of its icon neighbours (`icon-sm`, `icon`), so the group's outer corners match.
44
+ xs: 'h-7 gap-1.5 px-2.5 rounded-sm in-data-[slot=button-group]:rounded-md has-[>svg]:px-2',
44
45
  base: "h-7 gap-1 px-2.5 in-data-[slot=button-group]:rounded-2xl has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
45
46
  sm: 'h-8 gap-1.5 px-3 has-[>svg]:px-2.5',
46
47
  lg: 'h-10 px-6 has-[>svg]:px-4',
@@ -1,4 +1,4 @@
1
- import type { PeerMessage } from '@kortix/sdk';
1
+ import { type PeerMessage } from '@kortix/sdk';
2
2
  import { usePeerMessages } from '@kortix/sdk/react';
3
3
  /**
4
4
  * Messages from other sessions that wait for the person (`inbound: hold`, or a
@@ -7,8 +7,6 @@ import { usePeerMessages } from '@kortix/sdk/react';
7
7
  * the agent strip. "Approve message" delivers it, "Deny" drops it. A message
8
8
  * nobody decides expires after 5 minutes on the server.
9
9
  */
10
- /** The preview line: the sender's summary, else the message's first line. */
11
- export declare function heldPreview(message: Pick<PeerMessage, 'summary' | 'message'>): string;
12
10
  export interface HeldMessageCardProps {
13
11
  message: PeerMessage;
14
12
  pending: 'approve' | 'deny' | null;
@@ -23,8 +21,6 @@ export declare function HeldMessageList({ messages, approve, deny, }: {
23
21
  approve: PeerMessagesQuery['approve'];
24
22
  deny: PeerMessagesQuery['deny'];
25
23
  }): import("react").JSX.Element | null;
26
- /** The messages that wait for the person, oldest first (the order they arrived). */
27
- export declare function heldMessages(messages: readonly PeerMessage[] | undefined): PeerMessage[];
28
24
  /** A session's held messages, read on their own (for a host without the agent strip). */
29
25
  export declare function HeldMessages({ projectId, sessionId }: {
30
26
  projectId: string | undefined;
@@ -5,22 +5,8 @@ import { errorToast } from '../../primitives/toast.js';
5
5
  import { useTranslations } from '../../i18n/index.js';
6
6
  import { AgentFace, AgentStatus } from './agent-surface.js';
7
7
  import { peerHandleLabel } from '../../_vendor/kortix-shared.js';
8
+ import { heldMessages } from '@kortix/sdk';
8
9
  import { usePeerMessages } from '@kortix/sdk/react';
9
- /**
10
- * Messages from other sessions that wait for the person (`inbound: hold`, or a
11
- * session the person asked to approve first). Claude Code opens an approval
12
- * dialog with the sender and a preview; Kortix shows one card per message above
13
- * the agent strip. "Approve message" delivers it, "Deny" drops it. A message
14
- * nobody decides expires after 5 minutes on the server.
15
- */
16
- /** The preview line: the sender's summary, else the message's first line. */
17
- export function heldPreview(message) {
18
- const summary = message.summary?.trim();
19
- if (summary)
20
- return summary;
21
- const first = message.message.trim().split('\n')[0] ?? '';
22
- return first.length > 200 ? `${first.slice(0, 200)}…` : first;
23
- }
24
10
  export function HeldMessageCard({ message, pending, onApprove, onDeny }) {
25
11
  const t = useTranslations('multiAgent.held');
26
12
  const handle = message.from_handle;
@@ -40,12 +26,6 @@ export function HeldMessageList({ messages, approve, deny, }) {
40
26
  const fail = (key) => (error) => errorToast(t(key), { description: error instanceof Error ? error.message : undefined });
41
27
  return (_jsx("div", { "aria-label": t('label'), role: "group", className: "space-y-1.5", children: held.map((message) => (_jsx(HeldMessageCard, { message: message, pending: pendingFor(message.id), onApprove: () => approve.mutate(message.id, { onError: fail('approveFailed') }), onDeny: () => deny.mutate(message.id, { onError: fail('denyFailed') }) }, message.id))) }));
42
28
  }
43
- /** The messages that wait for the person, oldest first (the order they arrived). */
44
- export function heldMessages(messages) {
45
- return (messages ?? [])
46
- .filter((message) => message.status === 'held')
47
- .sort((a, b) => Date.parse(a.created_at) - Date.parse(b.created_at));
48
- }
49
29
  /** A session's held messages, read on their own (for a host without the agent strip). */
50
30
  export function HeldMessages({ projectId, sessionId }) {
51
31
  const { data, approve, deny } = usePeerMessages(projectId, sessionId, 'in');
@@ -1,3 +1,4 @@
1
+ import type { ReactNode } from 'react';
1
2
  import { type SessionChatInputProps } from './composer.js';
2
3
  import type { ComposerQuote } from './composer-logic.js';
3
4
  /**
@@ -18,6 +19,8 @@ export interface ComposerAboveCardDerived {
18
19
  remove: string;
19
20
  };
20
21
  handleRemoveQuote: (id: string) => void;
22
+ /** Inside a space: the ask about an agent the last message named from outside it (`menus/space-mentions.ts`). */
23
+ spaceAsk?: ReactNode;
21
24
  }
22
25
  export type ComposerAboveCardProps = SessionChatInputProps & ComposerAboveCardDerived;
23
- export declare function ComposerAboveCard({ dockId, quotes, quoteListLabels, handleRemoveQuote, aboveSlot, inputSlot, notice, noticeAsleep, onNoticeRetry, onModelChange, slashMenuPlacement, questionActive, }: ComposerAboveCardProps): import("react").JSX.Element;
26
+ export declare function ComposerAboveCard({ dockId, quotes, quoteListLabels, handleRemoveQuote, spaceAsk, aboveSlot, inputSlot, notice, noticeAsleep, onNoticeRetry, onModelChange, slashMenuPlacement, questionActive, }: ComposerAboveCardProps): import("react").JSX.Element;
@@ -14,9 +14,9 @@ import { QuoteList } from './quote-list.js';
14
14
  * keeps only the side ring, so no ring line crosses a seam.
15
15
  */
16
16
  const DOCKED_MIDDLE_LAYER_CLASS = 'ring-muted/15 rounded-t-none ring-3 [clip-path:inset(0_-8px_0_-8px)]';
17
- export function ComposerAboveCard({ dockId, quotes, quoteListLabels, handleRemoveQuote, aboveSlot, inputSlot, notice = null, noticeAsleep, onNoticeRetry, onModelChange, slashMenuPlacement = 'above', questionActive = false, }) {
17
+ export function ComposerAboveCard({ dockId, quotes, quoteListLabels, handleRemoveQuote, spaceAsk = null, aboveSlot, inputSlot, notice = null, noticeAsleep, onNoticeRetry, onModelChange, slashMenuPlacement = 'above', questionActive = false, }) {
18
18
  const showQueueStrip = Boolean(inputSlot);
19
- return (_jsxs(_Fragment, { children: [slashMenuPlacement === 'above' && _jsx("div", { id: dockId }), _jsx("div", { className: "mb-2 w-full empty:hidden", children: _jsx(QuoteList, { quotes: quotes, labels: quoteListLabels, onRemove: handleRemoveQuote }, quotes.length === 0 ? 'empty' : 'quotes') }), aboveSlot && _jsx("div", { className: "mb-2 w-full empty:hidden", children: aboveSlot }), (notice || showQueueStrip) && (_jsxs("div", { "data-composer-stack": true, className: "relative isolate flex w-full flex-col items-center justify-center [&>[data-composer-strip]:not(:empty)~*]:rounded-t-none", children: [showQueueStrip && (
19
+ return (_jsxs(_Fragment, { children: [slashMenuPlacement === 'above' && _jsx("div", { id: dockId }), _jsx("div", { className: "mb-2 w-full empty:hidden", children: _jsx(QuoteList, { quotes: quotes, labels: quoteListLabels, onRemove: handleRemoveQuote }, quotes.length === 0 ? 'empty' : 'quotes') }), spaceAsk ? _jsx("div", { className: "mb-2 w-full", children: spaceAsk }) : null, aboveSlot && _jsx("div", { className: "mb-2 w-full empty:hidden", children: aboveSlot }), (notice || showQueueStrip) && (_jsxs("div", { "data-composer-stack": true, className: "relative isolate flex w-full flex-col items-center justify-center [&>[data-composer-strip]:not(:empty)~*]:rounded-t-none", children: [showQueueStrip && (
20
20
  // A pending question also carries a ring around the whole
21
21
  // surface, down to the card: each layer clips its ring at the seam.
22
22
  _jsx("div", { "data-composer-strip": true, className: cn(COMPOSER_INPUT_SLOT_CLASS, questionActive &&
@@ -17,7 +17,7 @@ export interface ComposerOptions {
17
17
  }
18
18
  /**
19
19
  * The canonical "compose a first message" input: {@link SessionChatInput}
20
- * pre-wired with the OpenCode model / agent / variant / command selectors (the
20
+ * pre-wired with the model / agent / variant / command selectors (the
21
21
  * four catalog queries + per-session selection state). Used by the home composer
22
22
  * and the instant session shell so neither hand-rolls the selector wiring.
23
23
  *
@@ -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;
@@ -22,7 +22,7 @@ export declare function useReminderView(now: number): (reminder: SessionReminder
22
22
  nextAt: number;
23
23
  countdown: [string, string | null];
24
24
  share: number | null;
25
- tone: "red" | "purple";
25
+ tone: "purple" | "red";
26
26
  pauseLabel: string;
27
27
  schedule: string;
28
28
  meta: string;
@@ -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
  }