@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.
- package/dist/_vendor/kortix-shared.js +233 -130
- package/dist/_vendor/shared/code-language.d.ts +2 -2
- package/dist/_vendor/shared/html.d.ts +7 -0
- package/dist/_vendor/shared/index.d.ts +1 -2
- package/dist/_vendor/shared/pixel-mark.d.ts +28 -0
- package/dist/_vendor/shared/runtime-versions.d.ts +2 -6
- package/dist/_vendor/shared/tool-output/media-path.d.ts +1 -6
- package/dist/_vendor/shared/tool-output/scan.d.ts +2 -0
- package/dist/_vendor/shared/utils/string.d.ts +6 -0
- package/dist/artifacts/artifact-frame.d.ts +0 -1
- package/dist/artifacts/artifact-frame.js +4 -10
- package/dist/artifacts/artifact-session.js +4 -7
- package/dist/artifacts/frame-policy.d.ts +1 -1
- package/dist/artifacts/frame-policy.js +2 -2
- package/dist/customize/agents/agent-page.js +5 -5
- package/dist/customize/agents/agent-status.js +1 -1
- package/dist/customize/agents/agents-page.js +3 -3
- package/dist/customize/connectors/use-agent-access.d.ts +3 -3
- package/dist/customize/sections/connectors-view.js +50 -37
- package/dist/customize/sections/llm-provider/chatgpt-subscription-connect.js +21 -18
- package/dist/customize/sections/llm-provider/device-grant.d.ts +15 -0
- package/dist/customize/sections/llm-provider/device-grant.js +27 -0
- package/dist/customize/sections/view/agent-editor-catalog.js +0 -5
- package/dist/customize/sections/view/agent-editor.d.ts +2 -2
- package/dist/customize/sections/view/agent-editor.js +2 -2
- package/dist/customize/sections/view/review-center-connected.js +37 -6
- package/dist/customize/sections/view/secret-delivery.d.ts +4 -5
- package/dist/customize/sections/view/secret-delivery.js +5 -4
- package/dist/customize/triggers/schedule/trigger-list.d.ts +2 -2
- package/dist/customize/triggers/schedule/trigger-list.js +12 -18
- package/dist/customize/triggers/schedule/trigger-runs-logic.d.ts +6 -0
- package/dist/customize/triggers/schedule/trigger-runs-logic.js +13 -0
- package/dist/customize/triggers/schedule/trigger-runs-panel.js +9 -2
- package/dist/files/project/api/runtime-files.d.ts +2 -2
- package/dist/files/project/api/runtime-files.js +2 -2
- package/dist/files/project/components/drive-explorer.js +1 -1
- package/dist/files/project/components/drive-grid-view.js +0 -1
- package/dist/files/project/components/drive-list-view.js +0 -1
- package/dist/files/project/components/file-explorer-page.js +1 -1
- package/dist/files/project/hooks/index.d.ts +1 -1
- package/dist/files/project/hooks/index.js +1 -1
- package/dist/files/project/hooks/use-server-health.d.ts +1 -1
- package/dist/files/project/hooks/use-server-health.js +1 -1
- package/dist/files/project/search/workspace-search-service.d.ts +1 -1
- package/dist/files/project/search/workspace-search-service.js +1 -1
- package/dist/files/runtime/hooks/index.d.ts +1 -1
- package/dist/files/runtime/hooks/index.js +1 -1
- package/dist/files/runtime/hooks/server-health-state.d.ts +2 -2
- package/dist/files/runtime/hooks/server-health-state.js +2 -2
- package/dist/files/runtime/hooks/system-dir.js +2 -2
- package/dist/files/runtime/hooks/use-file-content.d.ts +1 -1
- package/dist/files/runtime/hooks/use-file-content.js +1 -1
- package/dist/files/runtime/hooks/use-file-list.d.ts +1 -1
- package/dist/files/runtime/hooks/use-file-list.js +3 -3
- package/dist/files/runtime/hooks/use-server-health.d.ts +2 -2
- package/dist/files/runtime/hooks/use-server-health.js +3 -3
- package/dist/files/runtime/hooks/use-workspace-search.d.ts +1 -2
- package/dist/files/runtime/hooks/use-workspace-search.js +0 -1
- package/dist/files/runtime/index.d.ts +2 -2
- package/dist/files/runtime/index.js +2 -2
- package/dist/files/runtime/path-utils.d.ts +1 -1
- package/dist/files/runtime/path-utils.js +1 -1
- package/dist/files/runtime/sandbox-explorer-source.d.ts +1 -1
- package/dist/files/runtime/sandbox-explorer-source.js +1 -1
- package/dist/files/runtime/sandbox-file-explorer.d.ts +1 -1
- package/dist/files/runtime/sandbox-file-explorer.js +2 -2
- package/dist/files/tree/components/file-tree-item.js +0 -1
- package/dist/files/tree/hooks/use-file-events.d.ts +1 -1
- package/dist/files/tree/hooks/use-file-events.js +1 -1
- package/dist/i18n/en.d.ts +60 -175
- package/dist/i18n/en.js +71 -186
- package/dist/internal/components/agent-mark.js +6 -0
- package/dist/internal/components/clickable-path.d.ts +3 -0
- package/dist/internal/components/clickable-path.js +4 -1
- package/dist/internal/files/file-read-retry.js +1 -1
- package/dist/internal/files/types.d.ts +2 -2
- package/dist/internal/files/types.js +2 -2
- package/dist/internal/goals/goal-meta.d.ts +33 -14
- package/dist/internal/goals/goal-meta.js +55 -13
- package/dist/internal/layout/nav-hover-card.d.ts +1 -1
- package/dist/internal/layout/nav-hover-card.js +1 -1
- package/dist/internal/layout/project-capability-nav.d.ts +1 -1
- package/dist/internal/layout/project-capability-nav.js +1 -1
- package/dist/internal/lib/browser-error-noise.d.ts +1 -1
- package/dist/internal/lib/browser-error-noise.js +1 -1
- package/dist/internal/lib/browser-noise/rules/expected-states.js +1 -1
- package/dist/internal/lib/browser-noise/rules/injected-scripts.js +29 -0
- package/dist/internal/lib/browser-noise/rules/old-browsers.d.ts +1 -0
- package/dist/internal/lib/browser-noise/rules/old-browsers.js +1 -1
- package/dist/internal/lib/browser-noise/rules/rejections.d.ts +0 -9
- package/dist/internal/lib/browser-noise/rules/rejections.js +0 -14
- package/dist/internal/lib/delivered-but-disconnected.js +3 -5
- package/dist/internal/lib/error-handler.js +8 -3
- package/dist/internal/lib/pixel-mark.d.ts +4 -17
- package/dist/internal/lib/pixel-mark.js +5 -148
- package/dist/internal/lib/sounds.d.ts +4 -4
- package/dist/internal/lib/sounds.js +4 -4
- package/dist/internal/lib/trigger-clock.d.ts +5 -0
- package/dist/internal/lib/trigger-clock.js +15 -0
- package/dist/internal/lib/turn-broadcast.d.ts +0 -3
- package/dist/internal/lib/use-project-feature-flags.d.ts +2 -0
- package/dist/internal/lib/use-project-feature-flags.js +5 -5
- package/dist/internal/lib/web-notifications.d.ts +1 -8
- package/dist/internal/lib/web-notifications.js +12 -53
- package/dist/internal/notifications/notification-bell.d.ts +13 -33
- package/dist/internal/notifications/notification-bell.js +14 -117
- package/dist/internal/notifications/notification-inbox.d.ts +45 -0
- package/dist/internal/notifications/notification-inbox.js +119 -0
- package/dist/internal/notifications/notification-rows.d.ts +3 -4
- package/dist/internal/notifications/notification-rows.js +1 -4
- package/dist/internal/notifications/use-inbox-summary.d.ts +13 -0
- package/dist/internal/notifications/use-inbox-summary.js +22 -0
- package/dist/internal/notifications/web-push.d.ts +9 -10
- package/dist/internal/notifications/web-push.js +9 -10
- package/dist/internal/stores/composer-prefill-store.js +4 -1
- package/dist/internal/stores/sound-store.d.ts +4 -4
- package/dist/internal/stores/sound-store.js +10 -0
- package/dist/internal/stores/web-notification-store.d.ts +6 -9
- package/dist/internal/stores/web-notification-store.js +0 -4
- package/dist/lib/routes.d.ts +8 -0
- package/dist/lib/routes.js +4 -1
- package/dist/markdown/code/shiki-highlighter.js +14 -5
- package/dist/markdown/doc-editor/doc-menus.d.ts +1 -10
- package/dist/markdown/doc-editor/doc-menus.js +6 -69
- package/dist/markdown/file-links.js +33 -3
- package/dist/markdown/markdown-frontmatter.d.ts +6 -6
- package/dist/markdown/markdown-frontmatter.js +3 -3
- package/dist/primitives/button.d.ts +1 -1
- package/dist/primitives/button.js +2 -1
- package/dist/session/agents/held-messages.d.ts +1 -5
- package/dist/session/agents/held-messages.js +1 -21
- package/dist/session/composer/ComposerAboveCard.d.ts +4 -1
- package/dist/session/composer/ComposerAboveCard.js +2 -2
- package/dist/session/composer/composer-chat-input.d.ts +1 -1
- package/dist/session/composer/composer-chat-input.js +2 -2
- package/dist/session/composer/composer.js +16 -1
- package/dist/session/composer/hooks/use-file-search.d.ts +15 -15
- package/dist/session/composer/hooks/use-file-search.js +16 -16
- package/dist/session/composer/menus/mention-controller.js +1 -3
- package/dist/session/composer/menus/space-mentions.d.ts +14 -4
- package/dist/session/composer/menus/space-mentions.js +17 -1
- package/dist/session/composer/use-instant-session-send.js +2 -2
- package/dist/session/header/reminder-parts.d.ts +1 -1
- package/dist/session/header/session-goal-indicator.js +4 -4
- package/dist/session/header/session-site-header.js +2 -6
- package/dist/session/panel/easy/plan-card.d.ts +2 -2
- package/dist/session/panel/easy/plan-card.js +2 -2
- package/dist/session/panel/session-desktop.js +6 -0
- package/dist/session/panel/session-reminders-panel.js +4 -15
- package/dist/session/panel/use-session-panel-state.js +2 -2
- package/dist/session/status/sandbox-loading-boundary.js +2 -2
- package/dist/session/status/session-terminal-state.d.ts +47 -0
- package/dist/session/status/session-terminal-state.js +56 -0
- package/dist/session/thread/plan-surface.d.ts +1 -1
- package/dist/session/thread/plan-surface.js +1 -1
- package/dist/session/thread/session-chat.d.ts +1 -1
- package/dist/session/thread/session-chat.js +88 -99
- package/dist/session/thread/stop-sequence.d.ts +51 -0
- package/dist/session/thread/stop-sequence.js +55 -0
- package/dist/session/thread/transcript.d.ts +2 -2
- package/dist/session/thread/transcript.js +2 -2
- package/dist/session/tool/tools/apply-patch-tool.d.ts +1 -1
- package/dist/session/tool/tools/apply-patch-tool.js +1 -1
- package/dist/session/tool/tools/kortix-action-tool.js +1 -1
- package/dist/session/tool/tools/multi-agent-tool-bodies.d.ts +1 -1
- package/dist/session/tool/tools/multi-agent-tool-bodies.js +1 -1
- package/dist/session/tool/tools/multi-agent-tools.js +1 -1
- package/dist/session/tool/tools/pty-kill-tool.d.ts +1 -1
- package/dist/session/tool/tools/pty-kill-tool.js +1 -1
- package/dist/session/tool/tools/pty-read-tool.d.ts +2 -2
- package/dist/session/tool/tools/pty-read-tool.js +2 -2
- package/dist/session/tool/tools/pty-spawn-tool.d.ts +1 -1
- package/dist/session/tool/tools/pty-spawn-tool.js +1 -1
- package/dist/session/tool/tools/pty-write-tool.d.ts +1 -1
- package/dist/session/tool/tools/pty-write-tool.js +1 -1
- package/dist/session/tool/tools/session-spawn-tool.js +7 -4
- package/dist/session/tool/tools/task-tool.js +18 -4
- package/dist/session/tool/tools/todo-write-tool.d.ts +1 -1
- package/dist/session/tool/tools/todo-write-tool.js +1 -1
- package/dist/session/turn/peer-message-row.d.ts +1 -10
- package/dist/session/turn/peer-message-row.js +1 -18
- package/dist/session/turn/plan-anchor.d.ts +3 -3
- package/dist/session/turn/plan-anchor.js +3 -3
- package/dist/session/turn/plan-card.d.ts +7 -7
- package/dist/session/turn/plan-card.js +7 -7
- package/dist/styles.css +1 -1
- package/dist/terminal/terminal-card-gate.d.ts +6 -3
- package/dist/terminal/terminal-card-gate.js +21 -4
- package/dist/workspace/home/access-requests-bell.d.ts +6 -9
- package/dist/workspace/home/access-requests-bell.js +8 -10
- package/dist/workspace/index.d.ts +1 -1
- package/dist/workspace/index.js +1 -1
- package/dist/workspace/layout/project-home.js +1 -2
- package/dist/workspace/review/review-center.d.ts +8 -2
- package/dist/workspace/review/review-center.js +44 -13
- package/dist/workspace/review/review-reducer.d.ts +7 -0
- package/dist/workspace/review/review-reducer.js +11 -0
- package/dist/workspace/sidebar/footer/project-artifacts-nav.d.ts +6 -1
- package/dist/workspace/sidebar/footer/project-artifacts-nav.js +47 -4
- package/dist/workspace/sidebar/project-nav-items.js +11 -12
- package/dist/workspace/sidebar/project-sidebar.js +2 -6
- package/dist/workspace/spaces/principal-card.d.ts +3 -1
- package/dist/workspace/spaces/principal-card.js +3 -3
- package/dist/workspace/spaces/space-agent-ask.d.ts +14 -0
- package/dist/workspace/spaces/space-agent-ask.js +36 -0
- package/dist/workspace/spaces/space-details-dialog.js +1 -1
- package/dist/workspace/spaces/space-details-panel.d.ts +2 -1
- package/dist/workspace/spaces/space-details-panel.js +62 -8
- package/dist/workspace/spaces/space-mention-source.d.ts +3 -2
- package/dist/workspace/spaces/space-mention-source.js +12 -19
- package/dist/workspace/spaces/space-view.js +3 -2
- package/package.json +11 -7
- package/skills/kortix-ui/references/custom-dashboard.md +1 -1
- package/skills/kortix-ui/references/modules.md +1 -1
- package/dist/_vendor/shared/artifact-annotations.d.ts +0 -311
- package/dist/_vendor/shared/artifact-comments.d.ts +0 -155
- package/dist/internal/hooks/use-notification-center.d.ts +0 -50
- package/dist/internal/hooks/use-notification-center.js +0 -151
- package/dist/session/tool/tools/multi-agent-tool-data.d.ts +0 -63
- 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('/') && !
|
|
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 &&
|
|
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 &&
|
|
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 (
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
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
|
|
17
|
-
*
|
|
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
|
|
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
|
|
147
|
-
*
|
|
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" | "
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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 ||
|
|
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: `
|
|
72
|
-
* (`use-
|
|
73
|
-
* `[
|
|
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. `
|
|
76
|
-
* (`use-
|
|
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
|
-
* ? [...
|
|
83
|
-
* :
|
|
83
|
+
* ? [...runtimeKeys.agents(), 'dir', directory] // ['runtime','agents',<server>,'dir',<dir>]
|
|
84
|
+
* : runtimeKeys.agents() // ['runtime','agents',<server>]
|
|
84
85
|
* ```
|
|
85
86
|
*
|
|
86
|
-
* The bare `['
|
|
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 `
|
|
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
|
-
* `'
|
|
92
|
-
*
|
|
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 `
|
|
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-
|
|
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 `
|
|
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-
|
|
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: `
|
|
123
|
-
* (`use-
|
|
124
|
-
* `[
|
|
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. `
|
|
127
|
-
* (`use-
|
|
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
|
-
* ? [...
|
|
134
|
-
* :
|
|
134
|
+
* ? [...runtimeKeys.agents(), 'dir', directory] // ['runtime','agents',<server>,'dir',<dir>]
|
|
135
|
+
* : runtimeKeys.agents() // ['runtime','agents',<server>]
|
|
135
136
|
* ```
|
|
136
137
|
*
|
|
137
|
-
* The bare `['
|
|
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 `
|
|
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
|
-
* `'
|
|
143
|
-
*
|
|
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 `
|
|
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-
|
|
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 `
|
|
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
|
|
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
|
-
/**
|
|
33
|
-
|
|
34
|
-
|
|
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.
|
|
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
|
|
184
|
-
//
|
|
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: "
|
|
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
|
|
39
|
-
? t('nextWake', { time: formatGoalTime(goal
|
|
40
|
-
: t('noWake') })] })) : null, goal
|
|
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
|
}
|