@kortix/ui 0.15.0 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 -0
- 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-session.js +4 -3
- 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.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-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 +63 -1
- package/dist/i18n/en.js +79 -17
- 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 +18 -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/use-project-feature-flags.js +3 -1
- 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/markdown/code/shiki-highlighter.js +14 -5
- package/dist/markdown/file-links.js +12 -3
- package/dist/markdown/markdown-frontmatter.d.ts +6 -6
- package/dist/markdown/markdown-frontmatter.js +3 -3
- 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/session-goal-indicator.js +4 -4
- 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/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/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/index.d.ts +1 -1
- package/dist/workspace/index.js +1 -1
- 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/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 +3 -3
- package/skills/kortix-ui/references/modules.md +1 -1
- 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
|
@@ -41,9 +41,12 @@ export declare function shouldPaintTerminalCard(input: {
|
|
|
41
41
|
* and the wake ladder only holds until it exhausts — so withholding the
|
|
42
42
|
* card there strands the user with no card AND no poll.
|
|
43
43
|
*
|
|
44
|
-
* `stage` alone
|
|
45
|
-
*
|
|
46
|
-
*
|
|
44
|
+
* `stage` alone decides, and every value is named. `starting` is still
|
|
45
|
+
* polling (the server retries on its own); `provisioning` and `null` (no
|
|
46
|
+
* `/start` answer yet) have not reached a verdict; `ready` contradicts a
|
|
47
|
+
* `stopped|error` row, which is then a stale cache from an earlier `/start`.
|
|
48
|
+
* None of those paints. `stopped` and `failed` are the server's verdict, and
|
|
49
|
+
* they paint.
|
|
47
50
|
*/
|
|
48
51
|
export declare function shouldPaintFatalCard(input: {
|
|
49
52
|
stage: SessionStartStage | null;
|
|
@@ -45,10 +45,27 @@ export function shouldPaintTerminalCard(input) {
|
|
|
45
45
|
* and the wake ladder only holds until it exhausts — so withholding the
|
|
46
46
|
* card there strands the user with no card AND no poll.
|
|
47
47
|
*
|
|
48
|
-
* `stage` alone
|
|
49
|
-
*
|
|
50
|
-
*
|
|
48
|
+
* `stage` alone decides, and every value is named. `starting` is still
|
|
49
|
+
* polling (the server retries on its own); `provisioning` and `null` (no
|
|
50
|
+
* `/start` answer yet) have not reached a verdict; `ready` contradicts a
|
|
51
|
+
* `stopped|error` row, which is then a stale cache from an earlier `/start`.
|
|
52
|
+
* None of those paints. `stopped` and `failed` are the server's verdict, and
|
|
53
|
+
* they paint.
|
|
51
54
|
*/
|
|
52
55
|
export function shouldPaintFatalCard(input) {
|
|
53
|
-
|
|
56
|
+
switch (input.stage) {
|
|
57
|
+
case 'stopped':
|
|
58
|
+
case 'failed':
|
|
59
|
+
return true;
|
|
60
|
+
case null:
|
|
61
|
+
case 'provisioning':
|
|
62
|
+
case 'starting':
|
|
63
|
+
case 'ready':
|
|
64
|
+
return false;
|
|
65
|
+
default: {
|
|
66
|
+
const unhandled = input.stage;
|
|
67
|
+
void unhandled;
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
54
71
|
}
|
|
@@ -29,7 +29,7 @@ export { CompanyMemoryPage } from './memory/company-memory-page.js';
|
|
|
29
29
|
export { ProjectSessionList } from './sidebar/project-session-list.js';
|
|
30
30
|
export { ProjectSidebar } from './sidebar/project-sidebar.js';
|
|
31
31
|
export { ShareSessionModal } from './sidebar/modal/share-session-modal.js';
|
|
32
|
-
export { formatGoalTime, goalAssignedTo, GoalHealthDot, goalHref, goalNeedsYou, goalNeedsAttention, goalLastWake, useGoalPerson, useStartGoal, goalOpenAsks, goalPaused, GoalCriteriaProgress, GoalPersonChip, GoalStatusIcon, goalIconState, goalStatusIconState, type GoalIconState, useGoalStateText, goalProgress, GoalStatusBadge, useGoalClock, useGoalIssueText, } from '../internal/goals/goal-meta.js';
|
|
32
|
+
export { formatGoalTime, goalAssignedTo, GoalHealthDot, goalHref, goalNeedsYou, goalNeedsAttention, goalLastWake, useGoalPerson, useStartGoal, goalOpenAsks, goalPaused, GoalCriteriaProgress, GoalPersonChip, GoalStatusIcon, goalIconState, goalStatusIconState, type GoalIconState, useGoalStateText, goalProgress, goalCriteriaStatus, goalNextWake, GoalStatusBadge, useGoalClock, useGoalBlockedNextStep, useGoalIssueText, } from '../internal/goals/goal-meta.js';
|
|
33
33
|
export { useActiveSpace } from '../internal/stores/active-space-store.js';
|
|
34
34
|
export { ALL_SPACES } from '../customize/shared/catalog/catalog-space-tabs.js';
|
|
35
35
|
export { SpaceFilterTabs, spaceFilterLabel } from './space/space-filter-tabs.js';
|
package/dist/workspace/index.js
CHANGED
|
@@ -34,7 +34,7 @@ export { CompanyMemoryPage } from './memory/company-memory-page.js';
|
|
|
34
34
|
export { ProjectSessionList } from './sidebar/project-session-list.js';
|
|
35
35
|
export { ProjectSidebar } from './sidebar/project-sidebar.js';
|
|
36
36
|
export { ShareSessionModal } from './sidebar/modal/share-session-modal.js';
|
|
37
|
-
export { formatGoalTime, goalAssignedTo, GoalHealthDot, goalHref, goalNeedsYou, goalNeedsAttention, goalLastWake, useGoalPerson, useStartGoal, goalOpenAsks, goalPaused, GoalCriteriaProgress, GoalPersonChip, GoalStatusIcon, goalIconState, goalStatusIconState, useGoalStateText, goalProgress, GoalStatusBadge, useGoalClock, useGoalIssueText, } from '../internal/goals/goal-meta.js';
|
|
37
|
+
export { formatGoalTime, goalAssignedTo, GoalHealthDot, goalHref, goalNeedsYou, goalNeedsAttention, goalLastWake, useGoalPerson, useStartGoal, goalOpenAsks, goalPaused, GoalCriteriaProgress, GoalPersonChip, GoalStatusIcon, goalIconState, goalStatusIconState, useGoalStateText, goalProgress, goalCriteriaStatus, goalNextWake, GoalStatusBadge, useGoalClock, useGoalBlockedNextStep, useGoalIssueText, } from '../internal/goals/goal-meta.js';
|
|
38
38
|
// Spaces: the per-viewer active space and the space filter the Goals and Artifacts pages share.
|
|
39
39
|
export { useActiveSpace } from '../internal/stores/active-space-store.js';
|
|
40
40
|
export { ALL_SPACES } from '../customize/shared/catalog/catalog-space-tabs.js';
|
|
@@ -16,8 +16,14 @@ export declare function ReviewCenter({ initialItems, segment: segmentProp, onSeg
|
|
|
16
16
|
isLoading: boolean;
|
|
17
17
|
isError: boolean;
|
|
18
18
|
};
|
|
19
|
-
/**
|
|
20
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Connected mode: fire the server verdict for a single item. Return a
|
|
21
|
+
* promise to make the inbox wait for the server: it rolls the optimistic
|
|
22
|
+
* status back on a rejection (the host toasts the error), and it shows its
|
|
23
|
+
* own success toast only on resolve, unless the host resolves with
|
|
24
|
+
* `REVIEW_VERDICT_ANNOUNCED` because it already told the user.
|
|
25
|
+
*/
|
|
26
|
+
onAct?: (id: string, verdict: ReviewVerdict, feedback?: string) => unknown;
|
|
21
27
|
/** Connected mode: fire the server verdict for many items (the select-mode
|
|
22
28
|
* bar and `d`). Resolves with one result per id; absent results mean all ok. */
|
|
23
29
|
onBulkAct?: (ids: string[], verdict: ReviewVerdict) => void | Promise<readonly BulkResult[] | undefined>;
|
|
@@ -47,7 +47,7 @@ import { ConnectorAppMark } from '../../markdown/setup-links/connector-handshake
|
|
|
47
47
|
import { ApprovalDecisionModal, reviewApprovalAsker, reviewApprovalDenyOnly, reviewApprovalDetails, } from './approval-modal.js';
|
|
48
48
|
import { ReviewDetail, ReviewItemModal } from './review-detail.js';
|
|
49
49
|
import { KIND_META, reviewKindLabel, reviewStatusLabel, } from './review-meta.js';
|
|
50
|
-
import { bulkSetStatus, decideApprovalAction, filterItems, groupBySession, sessionOptions, setStatus, } from './review-reducer.js';
|
|
50
|
+
import { bulkSetStatus, decideApprovalAction, filterItems, groupBySession, isPromiseLike, REVIEW_VERDICT_ANNOUNCED, sessionOptions, setStatus, } from './review-reducer.js';
|
|
51
51
|
import { segmentForStatus, } from './types.js';
|
|
52
52
|
/**
|
|
53
53
|
* Relative time is client-only: it depends on `Date.now()`, which differs between
|
|
@@ -238,6 +238,11 @@ export function ReviewCenter({ initialItems, segment: segmentProp, onSegmentChan
|
|
|
238
238
|
// next `initialItems` reconciliation (the refetch that follows a mutation).
|
|
239
239
|
const [pendingId, setPendingId] = useState(null);
|
|
240
240
|
const [pendingDecision, setPendingDecision] = useState(null);
|
|
241
|
+
// The single verdict still waiting for the server (an `onAct` that returned
|
|
242
|
+
// a promise). While it waits, a poll keeps its optimistic status and does
|
|
243
|
+
// not clear the spinner, so the row cannot flicker back to "needs you" and a
|
|
244
|
+
// second verdict cannot go out.
|
|
245
|
+
const [inFlight, setInFlight] = useState(null);
|
|
241
246
|
const undoRef = useRef(null);
|
|
242
247
|
// Query root for scroll-into-view — a container of the [data-idx] rows. It wraps
|
|
243
248
|
// either the flat <ul> or the grouped <div>, so it's typed to the common base.
|
|
@@ -380,10 +385,13 @@ export function ReviewCenter({ initialItems, segment: segmentProp, onSegmentChan
|
|
|
380
385
|
const [initialItemsSeen, setInitialItemsSeen] = useState(initialItems);
|
|
381
386
|
if (initialItems !== initialItemsSeen) {
|
|
382
387
|
setInitialItemsSeen(initialItems);
|
|
383
|
-
if (initialItems)
|
|
384
|
-
setItems(initialItems);
|
|
385
|
-
|
|
386
|
-
|
|
388
|
+
if (initialItems) {
|
|
389
|
+
setItems(inFlight ? setStatus(initialItems, inFlight.id, inFlight.status) : initialItems);
|
|
390
|
+
}
|
|
391
|
+
if (!inFlight) {
|
|
392
|
+
setPendingId(null);
|
|
393
|
+
setPendingDecision(null);
|
|
394
|
+
}
|
|
387
395
|
}
|
|
388
396
|
// Detect items that arrived since the user last looked → flag them "fresh".
|
|
389
397
|
// The first load of each segment seeds its known set silently (nothing is
|
|
@@ -432,15 +440,35 @@ export function ReviewCenter({ initialItems, segment: segmentProp, onSegmentChan
|
|
|
432
440
|
* lets the refetch reconcile (the action is a real state change, so no local
|
|
433
441
|
* Undo); prototype mode is fully local and undoable.
|
|
434
442
|
*/
|
|
435
|
-
function apply(next, message, tone = 'success', server) {
|
|
436
|
-
if (connected) {
|
|
437
|
-
setItems(next);
|
|
438
|
-
server?.();
|
|
439
|
-
(tone === 'info' ? infoToast : successToast)(message);
|
|
440
|
-
}
|
|
441
|
-
else {
|
|
443
|
+
function apply(next, message, tone = 'success', server, optimistic) {
|
|
444
|
+
if (!connected) {
|
|
442
445
|
commit(next, message, tone);
|
|
446
|
+
return;
|
|
443
447
|
}
|
|
448
|
+
const before = items;
|
|
449
|
+
setItems(next);
|
|
450
|
+
const result = server?.();
|
|
451
|
+
const announce = () => (tone === 'info' ? infoToast : successToast)(message);
|
|
452
|
+
if (!isPromiseLike(result)) {
|
|
453
|
+
announce();
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
// Wait for the server: no "done" toast before it answers, and a refused
|
|
457
|
+
// verdict puts the item back where it was.
|
|
458
|
+
if (optimistic)
|
|
459
|
+
setInFlight(optimistic);
|
|
460
|
+
void Promise.resolve(result)
|
|
461
|
+
.then((value) => {
|
|
462
|
+
if (value !== REVIEW_VERDICT_ANNOUNCED)
|
|
463
|
+
announce();
|
|
464
|
+
}, () => setItems(before))
|
|
465
|
+
.finally(() => {
|
|
466
|
+
if (!optimistic)
|
|
467
|
+
return;
|
|
468
|
+
setInFlight(null);
|
|
469
|
+
setPendingId(null);
|
|
470
|
+
setPendingDecision(null);
|
|
471
|
+
});
|
|
444
472
|
}
|
|
445
473
|
/** Every verdict path checks here first, so a refused verdict never commits. */
|
|
446
474
|
const allowsId = (id, verdict) => {
|
|
@@ -452,11 +480,14 @@ export function ReviewCenter({ initialItems, segment: segmentProp, onSegmentChan
|
|
|
452
480
|
const verdict = statusToVerdict(status);
|
|
453
481
|
if (verdict && !allowsId(id, verdict))
|
|
454
482
|
return;
|
|
483
|
+
// One verdict per item at a time.
|
|
484
|
+
if (inFlight?.id === id)
|
|
485
|
+
return;
|
|
455
486
|
if (connected && (status === 'approved' || status === 'rejected')) {
|
|
456
487
|
setPendingId(id);
|
|
457
488
|
setPendingDecision(status === 'approved' ? 'approve' : 'deny');
|
|
458
489
|
}
|
|
459
|
-
apply(setStatus(items, id, status), message ?? 'Updated', status === 'rejected' || status === 'changes_requested' ? 'info' : 'success', verdict && onAct ? () => onAct(id, verdict, feedback) : undefined);
|
|
490
|
+
apply(setStatus(items, id, status), message ?? 'Updated', status === 'rejected' || status === 'changes_requested' ? 'info' : 'success', verdict && onAct ? () => onAct(id, verdict, feedback) : undefined, { id, status });
|
|
460
491
|
},
|
|
461
492
|
decideAction: (itemId, actionId, decision) => setItems(decideApprovalAction(items, itemId, actionId, decision)),
|
|
462
493
|
openSession: onOpenSession,
|
|
@@ -49,3 +49,10 @@ export declare function sessionOptions(items: ReviewItem[], labelFor: (sessionId
|
|
|
49
49
|
}[];
|
|
50
50
|
/** Set the same status on many items at once (multi-select bulk approve / dismiss). */
|
|
51
51
|
export declare function bulkSetStatus(items: ReviewItem[], ids: Iterable<string>, status: ReviewStatus): ReviewItem[];
|
|
52
|
+
/**
|
|
53
|
+
* What a host's `onAct` resolves with when it already told the user the
|
|
54
|
+
* verdict landed (its own, more specific toast). The inbox then shows none,
|
|
55
|
+
* so one verdict is one success toast.
|
|
56
|
+
*/
|
|
57
|
+
export declare const REVIEW_VERDICT_ANNOUNCED: "review-verdict-announced";
|
|
58
|
+
export declare function isPromiseLike(value: unknown): value is PromiseLike<unknown>;
|
|
@@ -118,3 +118,14 @@ export function bulkSetStatus(items, ids, status) {
|
|
|
118
118
|
const set = ids instanceof Set ? ids : new Set(ids);
|
|
119
119
|
return items.map((i) => (set.has(i.id) ? { ...i, status } : i));
|
|
120
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* What a host's `onAct` resolves with when it already told the user the
|
|
123
|
+
* verdict landed (its own, more specific toast). The inbox then shows none,
|
|
124
|
+
* so one verdict is one success toast.
|
|
125
|
+
*/
|
|
126
|
+
export const REVIEW_VERDICT_ANNOUNCED = 'review-verdict-announced';
|
|
127
|
+
export function isPromiseLike(value) {
|
|
128
|
+
return (typeof value === 'object' &&
|
|
129
|
+
value !== null &&
|
|
130
|
+
typeof value.then === 'function');
|
|
131
|
+
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/** The Artifacts row shows only with the `artifacts` flag on. */
|
|
2
2
|
export declare function useArtifactsRowVisible(projectId: string | undefined): boolean;
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* The Artifacts row: docs, slides, boards and dashboards published in the
|
|
5
|
+
* project. A mouse that rests on it opens a card of those artifacts, newest
|
|
6
|
+
* change first, so one click opens one. The list is the gallery's own query
|
|
7
|
+
* (`scope: 'all'`), so the card and the page share one cache entry.
|
|
8
|
+
*/
|
|
4
9
|
export declare function ProjectArtifactsNavItem({ projectId }: {
|
|
5
10
|
projectId: string;
|
|
6
11
|
}): import("react").JSX.Element | null;
|
|
@@ -2,21 +2,64 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { uiRoutes } from '../../../lib/routes.js';
|
|
4
4
|
import { ProjectNavRow } from '../../../internal/layout/project-nav-row.js';
|
|
5
|
+
import { HoverPrefetchLink } from '../../../internal/components/hover-prefetch-link.js';
|
|
5
6
|
import { useTranslations } from '../../../i18n/index.js';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
7
|
+
import { Popover, PopoverAnchor } from '../../../primitives/popover.js';
|
|
8
|
+
import { InputGroupSearch, InputGroupSearchIcon, InputGroupSearchInput, } from '../../../primitives/input-group.js';
|
|
9
|
+
import { menuRow } from '../../../primitives/menu-recipe.js';
|
|
10
|
+
import { NavHoverCardContent, NavHoverCardList, useNavHoverCard } from '../../../internal/layout/nav-hover-card.js';
|
|
11
|
+
import { useArtifacts, useFeatureFlag } from '@kortix/sdk/react';
|
|
12
|
+
import { BrowserIcon, CardsThreeIcon, FileTextIcon, MagnifyingGlassIcon } from '@phosphor-icons/react';
|
|
8
13
|
import { useUiPathname } from '../../../providers/ui-provider.js';
|
|
14
|
+
import { useRef, useState } from 'react';
|
|
15
|
+
/** Above this many artifacts the card gets a search field. Same as the Apps card. */
|
|
16
|
+
const SEARCH_THRESHOLD = 10;
|
|
17
|
+
/** The list's page size (the API default). A full page may hold more: a search there asks the server. */
|
|
18
|
+
const LIST_PAGE = 100;
|
|
19
|
+
/** The glyph the artifact's own header draws for its type (`artifact-session.tsx`). */
|
|
20
|
+
const TYPE_ICON = { doc: FileTextIcon, html: BrowserIcon };
|
|
9
21
|
/** The Artifacts row shows only with the `artifacts` flag on. */
|
|
10
22
|
export function useArtifactsRowVisible(projectId) {
|
|
11
23
|
return useFeatureFlag(projectId, 'artifacts').enabled;
|
|
12
24
|
}
|
|
13
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* The Artifacts row: docs, slides, boards and dashboards published in the
|
|
27
|
+
* project. A mouse that rests on it opens a card of those artifacts, newest
|
|
28
|
+
* change first, so one click opens one. The list is the gallery's own query
|
|
29
|
+
* (`scope: 'all'`), so the card and the page share one cache entry.
|
|
30
|
+
*/
|
|
14
31
|
export function ProjectArtifactsNavItem({ projectId }) {
|
|
15
32
|
const t = useTranslations('sidebar');
|
|
16
33
|
const pathname = useUiPathname();
|
|
17
34
|
const visible = useArtifactsRowVisible(projectId);
|
|
35
|
+
const artifacts = useArtifacts(visible ? projectId : null, { scope: 'all' });
|
|
36
|
+
const [query, setQuery] = useState('');
|
|
37
|
+
const searchRef = useRef(null);
|
|
38
|
+
const listed = artifacts.data ?? [];
|
|
39
|
+
const card = useNavHoverCard({ enabled: listed.length > 0, holdRef: searchRef });
|
|
40
|
+
const showSearch = listed.length > SEARCH_THRESHOLD;
|
|
41
|
+
const needle = query.trim().toLowerCase();
|
|
42
|
+
// Same split as the gallery: a full page filters on the server, a shorter list here.
|
|
43
|
+
const paged = listed.length >= LIST_PAGE;
|
|
44
|
+
const server = useArtifacts(paged && needle ? projectId : null, { scope: 'all', q: needle || undefined });
|
|
45
|
+
// Title or description, as the server's `q` matches. The loaded page shows until the server
|
|
46
|
+
// answers this query (not a previous one's placeholder), and when it fails.
|
|
47
|
+
const local = needle
|
|
48
|
+
? listed.filter((artifact) => artifact.title.toLowerCase().includes(needle) || !!artifact.description?.toLowerCase().includes(needle))
|
|
49
|
+
: listed;
|
|
50
|
+
const shown = paged && needle && server.data && !server.isPlaceholderData ? server.data : local;
|
|
18
51
|
const href = projectId ? uiRoutes().artifacts(projectId) : null;
|
|
19
52
|
if (!href || !visible)
|
|
20
53
|
return null;
|
|
21
|
-
|
|
54
|
+
const close = () => card.setOpen(false);
|
|
55
|
+
return (_jsxs(Popover, { open: card.open, onOpenChange: (next) => {
|
|
56
|
+
card.setOpen(next);
|
|
57
|
+
if (!next)
|
|
58
|
+
setQuery('');
|
|
59
|
+
}, children: [_jsx(PopoverAnchor, { virtualRef: card.anchorRef }), _jsxs(ProjectNavRow, { active: pathname?.startsWith(href) === true, label: t('artifacts'), href: href, prefetch: true, ...card.rowProps, children: [_jsx("span", { className: "shrink-0", children: _jsx(CardsThreeIcon, {}) }), t('artifacts')] }), _jsxs(NavHoverCardContent, { ...card.contentProps, children: [showSearch ? (_jsx("div", { className: "border-border border-b p-1", children: _jsxs(InputGroupSearch, { children: [_jsx(InputGroupSearchIcon, { children: _jsx(MagnifyingGlassIcon, {}) }), _jsx(InputGroupSearchInput, { ref: searchRef, variant: "popover", size: "xs", value: query, onChange: (event) => setQuery(event.target.value), placeholder: t('searchArtifacts'), "aria-label": t('searchArtifacts') })] }) })) : null, _jsxs(NavHoverCardList, { className: "max-h-80 overflow-x-hidden overflow-y-auto overscroll-contain", children: [shown.map((artifact) => (_jsx("li", { children: _jsx(ArtifactRow, { artifact: artifact, href: `${href}/${encodeURIComponent(artifact.artifact_id)}`, onOpen: close }) }, artifact.artifact_id))), shown.length === 0 ? (_jsx("li", { className: menuRow('sm', 'default', 'text-muted-foreground pointer-events-none'), children: t('appsNoMatches') })) : null] })] })] }));
|
|
60
|
+
}
|
|
61
|
+
/** One artifact: its type glyph and its title. */
|
|
62
|
+
function ArtifactRow({ artifact, href, onOpen }) {
|
|
63
|
+
const Glyph = TYPE_ICON[artifact.type];
|
|
64
|
+
return (_jsxs(HoverPrefetchLink, { href: href, onClick: onOpen, className: menuRow('sm', 'default', 'cursor-pointer'), children: [_jsx(Glyph, { "aria-hidden": true, className: "text-muted-foreground size-4 shrink-0" }), _jsx("span", { className: "min-w-0 flex-1 truncate", children: artifact.title })] }));
|
|
22
65
|
}
|
|
@@ -6,18 +6,16 @@ import { ProjectArtifactsNavItem } from './footer/project-artifacts-nav.js';
|
|
|
6
6
|
import { ProjectFilesNavItem } from './footer/project-files-nav.js';
|
|
7
7
|
import { CustomizeGlyph, useCapabilityAccess, } from '../../internal/layout/project-settings-nav.js';
|
|
8
8
|
import { isProjectAdminPath, ProjectCapabilityNav, useOpenNewAgent } from '../../internal/layout/project-capability-nav.js';
|
|
9
|
-
import { capabilityTabHref } from '../../internal/lib/capability-tab-routes.js';
|
|
10
9
|
import { PROJECT_ACTIONS } from '../../internal/lib/project-actions.js';
|
|
11
10
|
import { useProjectCan } from '../../internal/lib/use-project-can.js';
|
|
12
11
|
import { Button } from '../../primitives/button.js';
|
|
13
|
-
import { ButtonGroup } from '../../primitives/button-group.js';
|
|
14
12
|
import Hint from '../../primitives/hint.js';
|
|
15
13
|
import { cn } from '../../lib/utils.js';
|
|
16
14
|
import { SidebarMenuButton, SidebarMenuItem, useSidebar } from '../../primitives/sidebar.js';
|
|
17
15
|
import { useIsMobile } from '../../internal/hooks/index.js';
|
|
18
16
|
import { useTranslations } from '../../i18n/index.js';
|
|
19
|
-
import { CaretRightIcon,
|
|
20
|
-
import {
|
|
17
|
+
import { CaretRightIcon, PlusIcon } from '@phosphor-icons/react';
|
|
18
|
+
import { useUiPathname } from '../../providers/ui-provider.js';
|
|
21
19
|
import { useEffect, useState } from 'react';
|
|
22
20
|
/**
|
|
23
21
|
* The nav rows under New session, in one fixed order. Each row applies its
|
|
@@ -33,10 +31,11 @@ export function ProjectNavItems({ projectId }) {
|
|
|
33
31
|
* Customize, for the people who may configure the project. Most configuring
|
|
34
32
|
* happens by asking an agent in a session, so this stays one disclosure: the
|
|
35
33
|
* row toggles the project's agents, Review, Models and Settings
|
|
36
|
-
* (`ProjectCapabilityNav`). On hover, its right edge holds
|
|
37
|
-
*
|
|
38
|
-
* a click overrides that until you cross between those
|
|
39
|
-
* the caller may open no capability page (same gate
|
|
34
|
+
* (`ProjectCapabilityNav`). On hover, its right edge holds + (New agent);
|
|
35
|
+
* All agents is a row inside the disclosure. Open by itself on an agent or
|
|
36
|
+
* Customize page; a click overrides that until you cross between those
|
|
37
|
+
* contexts. Absent when the caller may open no capability page (same gate
|
|
38
|
+
* as the tab bar).
|
|
40
39
|
*/
|
|
41
40
|
function CustomizeNavEntry({ projectId }) {
|
|
42
41
|
const t = useTranslations('sidebar');
|
|
@@ -62,10 +61,10 @@ function CustomizeNavEntry({ projectId }) {
|
|
|
62
61
|
return (_jsxs(_Fragment, { children: [_jsxs(SidebarMenuItem, { className: "group/customize", children: [_jsxs(SidebarMenuButton, { onClick: () => setOverride(!open), "aria-expanded": open,
|
|
63
62
|
// The caret is the Sessions header's: 12px (beats the button's
|
|
64
63
|
// `[&_svg]:size-4!`), shown on hover, turned when open.
|
|
65
|
-
className: "group/menu-button text-sidebar-foreground pr-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
className: "group/menu-button text-sidebar-foreground pr-8 [&>svg:last-child]:size-3!", children: [_jsx("span", { className: "shrink-0", children: _jsx(CustomizeGlyph, {}) }), _jsx("span", { className: "truncate", children: t('customize') }), _jsx(CaretRightIcon, { "aria-hidden": true, className: cn('text-muted-foreground duration-normal size-3 shrink-0 opacity-0 transition-transform ease-out group-focus-within/customize:opacity-100 group-hover/customize:opacity-100', open && 'rotate-90') })] }), hasAgents && canCreate && openNewAgent ? (_jsx(Hint, { side: "top", label: tTabs('newAgent'), children: _jsx(Button, { variant: "secondary", size: "icon-xs", type: "button", "aria-label": tTabs('newAgent'), className: "absolute top-1/2 right-1 -translate-y-1/2 opacity-100 transition-opacity group-focus-within/customize:opacity-100 group-hover/customize:opacity-100 md:opacity-0", onClick: () => {
|
|
65
|
+
close();
|
|
66
|
+
openNewAgent();
|
|
67
|
+
}, children: _jsx(PlusIcon, { className: "size-4" }) }) })) : null] }), open ? _jsx(ProjectCapabilityNav, { projectId: projectId }) : null] }));
|
|
69
68
|
}
|
|
70
69
|
function NavItem({ id, projectId }) {
|
|
71
70
|
switch (id) {
|
|
@@ -44,7 +44,7 @@ export declare function PrincipalHover({ projectId, principal, children, classNa
|
|
|
44
44
|
* the Profile on click (Enter too), and `onOpened` to close the popover it
|
|
45
45
|
* sits in. Every list of principals in Spaces renders through it.
|
|
46
46
|
*/
|
|
47
|
-
export declare function PrincipalRow({ projectId, principal, avatar, name, secondary, tag, onOpened, }: {
|
|
47
|
+
export declare function PrincipalRow({ projectId, principal, avatar, name, secondary, tag, actions, onOpened, }: {
|
|
48
48
|
projectId: string;
|
|
49
49
|
principal: Principal;
|
|
50
50
|
/** One 28px slot, so every name starts on one edge. */
|
|
@@ -54,6 +54,8 @@ export declare function PrincipalRow({ projectId, principal, avatar, name, secon
|
|
|
54
54
|
secondary?: string | null;
|
|
55
55
|
/** A muted tag at the row's end ("You", "Default"). */
|
|
56
56
|
tag?: string | null;
|
|
57
|
+
/** The row's own menu at its end, beside the card trigger (a button never nests in one). */
|
|
58
|
+
actions?: ReactNode;
|
|
57
59
|
onOpened?: () => void;
|
|
58
60
|
}): import("react").JSX.Element;
|
|
59
61
|
/**
|
|
@@ -167,8 +167,8 @@ export function PrincipalHover({ projectId, principal, children, className, focu
|
|
|
167
167
|
* the Profile on click (Enter too), and `onOpened` to close the popover it
|
|
168
168
|
* sits in. Every list of principals in Spaces renders through it.
|
|
169
169
|
*/
|
|
170
|
-
export function PrincipalRow({ projectId, principal, avatar, name, secondary, tag, onOpened, }) {
|
|
171
|
-
return (
|
|
170
|
+
export function PrincipalRow({ projectId, principal, avatar, name, secondary, tag, actions, onOpened, }) {
|
|
171
|
+
return (_jsxs("li", { className: actions ? 'hover:bg-hover flex items-center rounded-md pr-1' : undefined, children: [_jsxs(PrincipalHover, { projectId: projectId, principal: principal, onOpened: onOpened, className: cn('flex min-h-9 w-full min-w-0 items-center gap-2.5 rounded-md px-2 py-1', actions ? 'flex-1' : 'hover:bg-hover'), children: [_jsx("span", { className: "flex size-7 shrink-0 items-center justify-center", children: avatar }), _jsxs("span", { className: "flex min-w-0 flex-1 flex-col", children: [_jsx("span", { className: "truncate text-sm leading-tight", children: name }), secondary ? _jsx("span", { className: "text-muted-foreground truncate text-xs leading-tight tabular-nums", children: secondary }) : null] }), tag ? _jsx("span", { className: "text-muted-foreground shrink-0 text-xs", children: tag }) : null] }), actions] }));
|
|
172
172
|
}
|
|
173
173
|
/** The card: avatar, name ("(you)"), role and description, then one or two actions. */
|
|
174
174
|
function PrincipalSummary({ projectId, principal, onOpenProfile }) {
|
|
@@ -209,7 +209,7 @@ function AgentProfile({ projectId, name }) {
|
|
|
209
209
|
const spaces = useProjectSpaces(projectId);
|
|
210
210
|
const personalName = usePersonalSpaceName();
|
|
211
211
|
const agent = config?.agents.find((item) => item.name === name);
|
|
212
|
-
const projectDefault = config?.default_agent ??
|
|
212
|
+
const projectDefault = config?.default_agent ?? null;
|
|
213
213
|
// The spaces it works in: channels that list it, and the person's own space for My Kortix.
|
|
214
214
|
const memberOf = (spaces.data ?? []).filter((space) => !space.archived_at && (space.kind === 'channel' ? !!space.agents?.includes(name) : isPersonalSpace(space) && isMyKortixAgentName(name)));
|
|
215
215
|
const add = useAddAgentToSpace(projectId, name);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ProjectSpace } from '@kortix/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* Above a space's composer after a send named an agent from outside the space
|
|
4
|
+
* (flag `chat`). A space's agents are a boundary: the router hands work only
|
|
5
|
+
* to them, so naming another agent never adds it. A person who may edit the
|
|
6
|
+
* channel gets "Add Worker to #launch? Add · Not now"; anyone else gets who to
|
|
7
|
+
* ask. Add replaces the channel's agent list (PATCH space `agents`).
|
|
8
|
+
*/
|
|
9
|
+
export declare function SpaceAgentAsk({ projectId, space, agent, onDone, }: {
|
|
10
|
+
projectId: string;
|
|
11
|
+
space: ProjectSpace;
|
|
12
|
+
agent: string;
|
|
13
|
+
onDone: () => void;
|
|
14
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useUpdateProjectSpace } from '@kortix/sdk/react';
|
|
4
|
+
import { useTranslations } from '../../i18n/index.js';
|
|
5
|
+
import { Close } from '../../icons/close.js';
|
|
6
|
+
import { AgentMark } from '../../internal/components/agent-mark.js';
|
|
7
|
+
import { Button } from '../../primitives/button.js';
|
|
8
|
+
import { errorToast, successToast } from '../../primitives/toast.js';
|
|
9
|
+
import { agentLabel } from './space-timeline.js';
|
|
10
|
+
/**
|
|
11
|
+
* Above a space's composer after a send named an agent from outside the space
|
|
12
|
+
* (flag `chat`). A space's agents are a boundary: the router hands work only
|
|
13
|
+
* to them, so naming another agent never adds it. A person who may edit the
|
|
14
|
+
* channel gets "Add Worker to #launch? Add · Not now"; anyone else gets who to
|
|
15
|
+
* ask. Add replaces the channel's agent list (PATCH space `agents`).
|
|
16
|
+
*/
|
|
17
|
+
export function SpaceAgentAsk({ projectId, space, agent, onDone, }) {
|
|
18
|
+
const t = useTranslations('spaces.mentions');
|
|
19
|
+
const update = useUpdateProjectSpace(projectId);
|
|
20
|
+
const spaceName = `#${space.slug ?? space.name}`;
|
|
21
|
+
const label = agentLabel(agent);
|
|
22
|
+
const canEdit = space.kind === 'channel' && space.can_edit === true;
|
|
23
|
+
const add = () => {
|
|
24
|
+
const agents = space.agents ?? [];
|
|
25
|
+
if (agents.includes(agent))
|
|
26
|
+
return onDone();
|
|
27
|
+
update.mutate({ spaceId: space.space_id, input: { agents: [...agents, agent] } }, {
|
|
28
|
+
onSuccess: () => {
|
|
29
|
+
successToast(t('added', { agent: label, space: spaceName }));
|
|
30
|
+
onDone();
|
|
31
|
+
},
|
|
32
|
+
onError: () => errorToast(t('addFailed')),
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
return (_jsxs("div", { role: "status", "aria-live": "polite", "data-space-agent-ask": agent, className: "bg-sidebar border-border flex w-full items-center gap-2 rounded-xl border py-1.5 pr-1.5 pl-3", children: [_jsx(AgentMark, { slug: agent, size: 14 }), _jsx("span", { className: "text-muted-foreground min-w-0 flex-1 truncate text-xs", children: canEdit ? t('askAdd', { agent: label, space: spaceName }) : t('askAdmin', { agent: label, space: spaceName }) }), canEdit ? (_jsxs(_Fragment, { children: [_jsx(Button, { type: "button", size: "xs", onClick: add, disabled: update.isPending, children: t('askAddConfirm') }), _jsx(Button, { type: "button", variant: "ghost", size: "xs", className: "text-muted-foreground hover:text-foreground", onClick: onDone, children: t('askNotNow') })] })) : (_jsx(Button, { type: "button", variant: "ghost", size: "icon-xs", className: "text-muted-foreground hover:text-foreground", "aria-label": t('dismiss'), onClick: onDone, children: _jsx(Close, { className: "size-3.5" }) }))] }));
|
|
36
|
+
}
|
|
@@ -50,7 +50,7 @@ function AboutPane({ space, onEdit, onArchive }) {
|
|
|
50
50
|
});
|
|
51
51
|
// A channel with an agent list starts a new thread on its first agent.
|
|
52
52
|
const channelDefault = space.agents?.[0] ?? null;
|
|
53
|
-
const defaultAgent = channelDefault ?? detail.data?.config.default_agent ??
|
|
53
|
+
const defaultAgent = channelDefault ?? detail.data?.config.default_agent ?? null;
|
|
54
54
|
const created = new Date(space.created_at).toLocaleDateString(locale, { dateStyle: 'medium' });
|
|
55
55
|
// Its creator or a project manager; an older API sends no `can_edit`.
|
|
56
56
|
const editable = space.can_edit !== false;
|
|
@@ -2,7 +2,8 @@ import type { ProjectSpace } from '@kortix/sdk';
|
|
|
2
2
|
/**
|
|
3
3
|
* A space's details, on the right of the space (flag `chat`), opened from its
|
|
4
4
|
* name in the header: its tile, name and description, then Agents (the
|
|
5
|
-
* default first), People, Tabs and Routines, each with its own "Add"
|
|
5
|
+
* default first), People, Tabs and Routines, each with its own "Add", and
|
|
6
|
+
* Proactive (flag `spaces_proactive`). The
|
|
6
7
|
* rarer settings (make private, leave, archive, member menus) stay in the
|
|
7
8
|
* full settings dialog, one link at the end. Everything here can also be
|
|
8
9
|
* asked for in chat: the hint line says so.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { qk, useProjectConfig, useProjectSpaceMembers, useProjectTriggers } from '@kortix/sdk/react';
|
|
4
|
-
import { LightningIcon, LockSimpleIcon, PencilSimpleIcon, PlusIcon } from '@phosphor-icons/react';
|
|
3
|
+
import { qk, useFeatureFlag, useProjectConfig, useProjectSpaceMembers, useProjectSpaceProactive, useProjectTriggers, useSetProjectSpaceProactive, useUpdateProjectSpace, } from '@kortix/sdk/react';
|
|
4
|
+
import { DotsThreeIcon, LightningIcon, LockSimpleIcon, PencilSimpleIcon, PlusIcon } from '@phosphor-icons/react';
|
|
5
5
|
import { useQueryClient } from '@tanstack/react-query';
|
|
6
6
|
import { useEffect, useRef, useState } from 'react';
|
|
7
7
|
import { describeWhen, triggerName } from '../../customize/triggers/schedule/schedule-copy.js';
|
|
@@ -12,8 +12,11 @@ import { Close } from '../../icons/close.js';
|
|
|
12
12
|
import { AgentMark } from '../../internal/components/agent-mark.js';
|
|
13
13
|
import { uiRoutes } from '../../lib/routes.js';
|
|
14
14
|
import { Button } from '../../primitives/button.js';
|
|
15
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuTrigger, } from '../../primitives/dropdown-menu.js';
|
|
15
16
|
import Hint from '../../primitives/hint.js';
|
|
16
17
|
import { Label } from '../../primitives/label.js';
|
|
18
|
+
import { Switch } from '../../primitives/switch.js';
|
|
19
|
+
import { errorToast, successToast } from '../../primitives/toast.js';
|
|
17
20
|
import { UserAvatar } from '../../primitives/user-avatar.js';
|
|
18
21
|
import { UiLink as Link, useUiViewer } from '../../providers/ui-provider.js';
|
|
19
22
|
import { PrincipalRow } from './principal-card.js';
|
|
@@ -25,7 +28,8 @@ import { agentLabel } from './space-timeline.js';
|
|
|
25
28
|
/**
|
|
26
29
|
* A space's details, on the right of the space (flag `chat`), opened from its
|
|
27
30
|
* name in the header: its tile, name and description, then Agents (the
|
|
28
|
-
* default first), People, Tabs and Routines, each with its own "Add"
|
|
31
|
+
* default first), People, Tabs and Routines, each with its own "Add", and
|
|
32
|
+
* Proactive (flag `spaces_proactive`). The
|
|
29
33
|
* rarer settings (make private, leave, archive, member menus) stay in the
|
|
30
34
|
* full settings dialog, one link at the end. Everything here can also be
|
|
31
35
|
* asked for in chat: the hint line says so.
|
|
@@ -49,7 +53,7 @@ export function SpaceDetailsPanel({ projectId, space, name, onClose, onOpenTab,
|
|
|
49
53
|
if (canAdd)
|
|
50
54
|
setAdding(true);
|
|
51
55
|
}
|
|
52
|
-
return (_jsxs("aside", { "aria-label": t('title', { name }), className: "bg-background flex min-h-0 w-full flex-1 flex-col", children: [_jsxs("div", { className: "kx-titlebar-row relative flex shrink-0 items-center gap-2 px-2", children: [_jsx("div", { className: "kx-titlebar-tabs flex h-12 min-w-0 flex-1 items-center px-3", children: _jsx("h2", { className: "text-sm font-medium", children: t('heading') }) }), _jsx(Hint, { label: t('close'), side: "bottom", children: _jsx(Button, { variant: "ghost", size: "icon-md", "aria-label": t('close'), onClick: onClose, children: _jsx(Close, {}) }) })] }), _jsxs("div", { className: "min-h-0 flex-1 overflow-y-auto", children: [_jsxs("div", { className: "flex flex-col items-center gap-2 px-6 pt-2 pb-6 text-center", children: [_jsx(SpaceAvatar, { space: space, size: "xl", label: name, projectId: projectId }), _jsxs("div", { className: "flex min-w-0 items-center gap-1.5", children: [_jsx("h3", { className: "truncate text-lg font-semibold", children: name }), isPrivateSpace(space) ? (_jsx(LockSimpleIcon, { role: "img", "aria-label": t('private'), className: "text-muted-foreground size-3.5 shrink-0" })) : null, onRename && editable ? (_jsx(Hint, { label: t('rename'), side: "bottom", children: _jsx(Button, { variant: "ghost", size: "icon-sm", className: "text-muted-foreground", "aria-label": t('rename'), onClick: onRename, children: _jsx(PencilSimpleIcon, { className: "size-3.5" }) }) })) : null] }), _jsx("p", { className: "text-muted-foreground text-sm text-pretty", children: space.description || (isPersonalSpace(space) ? t('personalDescription') : isPrivateSpace(space) ? t('privateDescription') : t('noDescription')) })] }), _jsxs("div", { className: "space-y-6 px-4 pb-6", children: [_jsx(AgentsSection, { projectId: projectId, space: space,
|
|
56
|
+
return (_jsxs("aside", { "aria-label": t('title', { name }), className: "bg-background flex min-h-0 w-full flex-1 flex-col", children: [_jsxs("div", { className: "kx-titlebar-row relative flex shrink-0 items-center gap-2 px-2", children: [_jsx("div", { className: "kx-titlebar-tabs flex h-12 min-w-0 flex-1 items-center px-3", children: _jsx("h2", { className: "text-sm font-medium", children: t('heading') }) }), _jsx(Hint, { label: t('close'), side: "bottom", children: _jsx(Button, { variant: "ghost", size: "icon-md", "aria-label": t('close'), onClick: onClose, children: _jsx(Close, {}) }) })] }), _jsxs("div", { className: "min-h-0 flex-1 overflow-y-auto", children: [_jsxs("div", { className: "flex flex-col items-center gap-2 px-6 pt-2 pb-6 text-center", children: [_jsx(SpaceAvatar, { space: space, size: "xl", label: name, projectId: projectId }), _jsxs("div", { className: "flex min-w-0 items-center gap-1.5", children: [_jsx("h3", { className: "truncate text-lg font-semibold", children: name }), isPrivateSpace(space) ? (_jsx(LockSimpleIcon, { role: "img", "aria-label": t('private'), className: "text-muted-foreground size-3.5 shrink-0" })) : null, onRename && editable ? (_jsx(Hint, { label: t('rename'), side: "bottom", children: _jsx(Button, { variant: "ghost", size: "icon-sm", className: "text-muted-foreground", "aria-label": t('rename'), onClick: onRename, children: _jsx(PencilSimpleIcon, { className: "size-3.5" }) }) })) : null] }), _jsx("p", { className: "text-muted-foreground text-sm text-pretty", children: space.description || (isPersonalSpace(space) ? t('personalDescription') : isPrivateSpace(space) ? t('privateDescription') : t('noDescription')) })] }), _jsxs("div", { className: "space-y-6 px-4 pb-6", children: [_jsx(AgentsSection, { projectId: projectId, space: space, editable: !!channel && editable }), _jsx("div", { ref: peopleRef, className: "scroll-mt-2", children: _jsx(PeopleSection, { projectId: projectId, space: space, members: members.data?.members, onAdd: canAdd ? () => setAdding(true) : undefined }) }), _jsx(TabsSection, { projectId: projectId, space: space, onOpenTab: onOpenTab }), _jsx(RoutinesSection, { projectId: projectId, space: space }), _jsx(ProactiveSection, { projectId: projectId, space: space }), onOpenSettings ? (_jsx(Button, { variant: "ghost", size: "sm", className: "text-muted-foreground hover:text-foreground", onClick: onOpenSettings, children: t('allSettings') })) : null] })] }), _jsx("p", { className: "text-muted-foreground shrink-0 border-t px-5 py-3 text-xs text-pretty", children: t('askHint') }), channel ? (_jsx(AddChannelMembersDialog, { projectId: projectId, space: channel, open: adding, onOpenChange: setAdding })) : null] }));
|
|
53
57
|
}
|
|
54
58
|
/** A section: its label, its rows, then its "Add" when the viewer may add. */
|
|
55
59
|
function Section({ title, add, children }) {
|
|
@@ -66,15 +70,35 @@ function Row({ avatar, name, tag, href, card, }) {
|
|
|
66
70
|
function AddButton({ label, onClick }) {
|
|
67
71
|
return (_jsxs(Button, { variant: "ghost", size: "sm", className: "text-muted-foreground hover:text-foreground gap-1.5", onClick: onClick, children: [_jsx(PlusIcon, { className: "size-3.5 shrink-0" }), label] }));
|
|
68
72
|
}
|
|
69
|
-
/**
|
|
70
|
-
|
|
73
|
+
/**
|
|
74
|
+
* The space's agents, the default first: the agents its threads hand work to
|
|
75
|
+
* (the router routes only to them). A channel's editor makes one the default
|
|
76
|
+
* (moves it first), removes one, and adds a project agent from a picker.
|
|
77
|
+
*/
|
|
78
|
+
function AgentsSection({ projectId, space, editable }) {
|
|
71
79
|
const t = useTranslations('spaces.panel');
|
|
80
|
+
const tDetails = useTranslations('spaces.details');
|
|
72
81
|
const config = useProjectConfig(projectId);
|
|
73
|
-
const
|
|
82
|
+
const update = useUpdateProjectSpace(projectId);
|
|
83
|
+
const projectDefault = config?.default_agent ?? null;
|
|
74
84
|
const agents = space.kind === 'dm' ? (space.dm_agent_name ? [space.dm_agent_name] : []) : (space.agents ?? []);
|
|
75
85
|
// No agent list: a new thread starts on the project's default agent.
|
|
76
86
|
const shown = agents.length > 0 ? agents : projectDefault ? [projectDefault] : [];
|
|
77
|
-
|
|
87
|
+
const spaceName = space.slug ?? space.name;
|
|
88
|
+
const addable = (config?.agents ?? [])
|
|
89
|
+
.filter((agent) => !agent.hidden && agent.enabled !== false && agent.mode !== 'subagent')
|
|
90
|
+
.filter((agent) => !agents.includes(agent.name));
|
|
91
|
+
const save = (next, done) => update.mutate({ spaceId: space.space_id, input: { agents: next } }, { onSuccess: () => successToast(done), onError: () => errorToast(tDetails('agentsFailed')) });
|
|
92
|
+
const add = editable ? (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "ghost", size: "sm", className: "text-muted-foreground hover:text-foreground gap-1.5", disabled: update.isPending, children: [_jsx(PlusIcon, { className: "size-3.5 shrink-0" }), t('addAgent')] }) }), _jsx(DropdownMenuContent, { align: "start", className: "w-64", children: addable.length === 0 ? (_jsx(DropdownMenuLabel, { className: "text-muted-foreground text-xs font-normal", children: t('noAgentsToAdd') })) : (addable.map((agent) => (_jsxs(DropdownMenuItem, { className: "gap-2.5", onSelect: () =>
|
|
93
|
+
// An empty list ran on the project's default: adding keeps that agent first, so the default does not move.
|
|
94
|
+
save(agents.length === 0 && projectDefault && projectDefault !== agent.name ? [projectDefault, agent.name] : [...agents, agent.name], tDetails('agentAdded', { agent: agentLabel(agent.name), name: spaceName })), children: [_jsx(AgentMark, { slug: agent.name, size: 21 }), _jsxs("span", { className: "flex min-w-0 flex-col", children: [_jsx("span", { className: "truncate text-sm", children: agentLabel(agent.name) }), agent.description ? _jsx("span", { className: "text-muted-foreground truncate text-xs", children: agent.description }) : null] })] }, agent.name)))) })] })) : null;
|
|
95
|
+
return (_jsx(Section, { title: t('agents'), add: add, children: shown.map((agent, index) => {
|
|
96
|
+
const label = agentLabel(agent);
|
|
97
|
+
const isDefault = index === 0;
|
|
98
|
+
// The project's default stands in for an empty list: nothing to move or remove.
|
|
99
|
+
const listed = agents.includes(agent);
|
|
100
|
+
return (_jsx(PrincipalRow, { projectId: projectId, principal: { kind: 'agent', name: agent }, avatar: _jsx(AgentMark, { slug: agent, size: 21 }), name: label, tag: isDefault ? (listed ? t('default') : t('projectDefault')) : null, actions: editable && listed ? (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon-sm", className: "text-muted-foreground shrink-0", "aria-label": tDetails('agentMenu', { agent: label }), disabled: update.isPending, children: _jsx(DotsThreeIcon, { className: "size-4" }) }) }), _jsxs(DropdownMenuContent, { align: "end", children: [isDefault ? null : (_jsx(DropdownMenuItem, { onSelect: () => save([agent, ...agents.filter((item) => item !== agent)], tDetails('defaultSet', { agent: label, name: spaceName })), children: tDetails('makeDefault') })), _jsx(DropdownMenuItem, { onSelect: () => save(agents.filter((item) => item !== agent), tDetails('agentRemoved', { agent: label, name: spaceName })), children: tDetails('removeAgent', { name: spaceName }) })] })] })) : null }, agent));
|
|
101
|
+
}) }));
|
|
78
102
|
}
|
|
79
103
|
/** The space's people: its members, or only the viewer in a private space of one person. */
|
|
80
104
|
function PeopleSection({ projectId, space, members, onAdd, }) {
|
|
@@ -117,3 +141,33 @@ function RoutinesSection({ projectId, space }) {
|
|
|
117
141
|
} })] })) : null;
|
|
118
142
|
return (_jsxs(Section, { title: t('routines'), add: add, children: [routines.map((trigger) => (_jsx(Row, { avatar: _jsx(LightningIcon, { className: "text-muted-foreground size-4" }), name: triggerName(trigger), tag: describeWhen(trigger), href: uiRoutes().customize(projectId, `triggers?id=${encodeURIComponent(trigger.slug)}`) }, trigger.slug))), privateChannel && routines.length === 0 ? (_jsx("li", { className: "text-muted-foreground px-2 py-1 text-xs text-pretty", children: t('routinesPrivate') })) : null] }));
|
|
119
143
|
}
|
|
144
|
+
/** The browser's IANA zone, for the daily brief; UTC when it has none. */
|
|
145
|
+
function browserTimeZone() {
|
|
146
|
+
try {
|
|
147
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone || 'UTC';
|
|
148
|
+
}
|
|
149
|
+
catch {
|
|
150
|
+
return 'UTC';
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/** One switch row: the name, a muted line under it, the switch at the end. */
|
|
154
|
+
function SwitchRow({ label, hint, checked, disabled, onChange, }) {
|
|
155
|
+
return (_jsxs("li", { className: "flex min-h-9 items-center gap-2.5 px-2 py-1", children: [_jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("p", { className: "truncate text-sm", children: label }), _jsx("p", { className: "text-muted-foreground text-xs text-pretty", children: hint })] }), _jsx(Switch, { checked: checked, onCheckedChange: onChange, disabled: disabled, "aria-label": label, className: "shrink-0" })] }));
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Proactive (flag `spaces_proactive`): the space's watcher reads what happens
|
|
159
|
+
* here and writes only when it matters; the daily brief adds one summary at
|
|
160
|
+
* 9:00. Only the space's creator, a project manager or the DM's owner may
|
|
161
|
+
* change them (`can_edit`); everyone else sees the state.
|
|
162
|
+
*/
|
|
163
|
+
function ProactiveSection({ projectId, space }) {
|
|
164
|
+
const t = useTranslations('spaces.panel');
|
|
165
|
+
const flag = useFeatureFlag(projectId, 'spaces_proactive');
|
|
166
|
+
const settings = useProjectSpaceProactive(projectId, space.space_id, { enabled: flag.enabled });
|
|
167
|
+
const update = useSetProjectSpaceProactive(projectId, space.space_id);
|
|
168
|
+
if (!flag.enabled || !settings.data)
|
|
169
|
+
return null;
|
|
170
|
+
const { enabled, daily_brief: dailyBrief, can_edit: canEdit } = settings.data;
|
|
171
|
+
const save = (input) => update.mutate(input, { onError: () => errorToast(t('proactiveFailed')) });
|
|
172
|
+
return (_jsxs(Section, { title: t('proactive'), children: [_jsx(SwitchRow, { label: t('proactiveWatch'), hint: t('proactiveWatchHint'), checked: enabled, disabled: !canEdit || update.isPending, onChange: (next) => save({ enabled: next }) }), enabled ? (_jsx(SwitchRow, { label: t('proactiveBrief'), hint: t('proactiveBriefHint'), checked: dailyBrief, disabled: !canEdit || update.isPending, onChange: (next) => save(next ? { daily_brief: true, brief_timezone: browserTimeZone() } : { daily_brief: false }) })) : null] }));
|
|
173
|
+
}
|