@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
|
@@ -16,3 +16,9 @@ export declare function truncateString(str?: string, maxLength?: number): string
|
|
|
16
16
|
* slug (`harness-reflector`) into a display name (`Harness-Reflector`).
|
|
17
17
|
*/
|
|
18
18
|
export declare function capitalizeWords(str: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Trim trailing slashes without a regex. `/\/+$/` against a long run of
|
|
21
|
+
* slashes backtracks polynomially, so a value that reaches an exported library
|
|
22
|
+
* function gets this linear scan instead.
|
|
23
|
+
*/
|
|
24
|
+
export declare function stripTrailingSlashes(value: string): string;
|
|
@@ -11,7 +11,6 @@ export declare const ArtifactFrame: import("react").ForwardRefExoticComponent<{
|
|
|
11
11
|
title: string;
|
|
12
12
|
className?: string;
|
|
13
13
|
preview?: boolean;
|
|
14
|
-
onFrame?: (frame: HTMLIFrameElement | null) => void;
|
|
15
14
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
16
15
|
/** Create (and park) the pooled frame for an artifact page; a no-op when it exists. */
|
|
17
16
|
export declare function ensureArtifactFrame(key: string, src: string, title: string): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef, useLayoutEffect,
|
|
3
|
+
import { forwardRef, useLayoutEffect, useState } from 'react';
|
|
4
4
|
import { claimFrame, ensureFrame } from '../apps/app-preview-pool.js';
|
|
5
5
|
import { ARTIFACT_FRAME_ALLOW, ARTIFACT_IFRAME_SANDBOX } from './frame-policy.js';
|
|
6
6
|
/**
|
|
@@ -19,12 +19,8 @@ const PREVIEW_CANVAS = 'bg-background';
|
|
|
19
19
|
* viewer without reloading. `frameKey` changes after a save, so an edit loads
|
|
20
20
|
* the new page. The ref is the slot (the viewer's full screen target).
|
|
21
21
|
*/
|
|
22
|
-
export const ArtifactFrame = forwardRef(function ArtifactFrame({ frameKey, src, title, className, preview
|
|
22
|
+
export const ArtifactFrame = forwardRef(function ArtifactFrame({ frameKey, src, title, className, preview }, ref) {
|
|
23
23
|
const [slot, setSlot] = useState(null);
|
|
24
|
-
const latestOnFrame = useRef(onFrame);
|
|
25
|
-
useLayoutEffect(() => {
|
|
26
|
-
latestOnFrame.current = onFrame;
|
|
27
|
-
});
|
|
28
24
|
const interactive = !preview;
|
|
29
25
|
const frameClass = `${className ?? ''} ${preview ? PREVIEW_CANVAS : ARTIFACT_CANVAS}`;
|
|
30
26
|
useLayoutEffect(() => {
|
|
@@ -47,13 +43,11 @@ export const ArtifactFrame = forwardRef(function ArtifactFrame({ frameKey, src,
|
|
|
47
43
|
const reload = !!previous && Date.now() - previous.at < RELOAD_MS;
|
|
48
44
|
if (interactive && (!reload || previous.focused) && !typingElsewhere())
|
|
49
45
|
claimed?.focus({ preventScroll: true });
|
|
50
|
-
latestOnFrame.current?.(claimed);
|
|
51
46
|
return () => {
|
|
52
47
|
releasedFocus.set(page, {
|
|
53
48
|
at: Date.now(),
|
|
54
49
|
focused: !!claimed && claimed.ownerDocument.activeElement === claimed,
|
|
55
50
|
});
|
|
56
|
-
latestOnFrame.current?.(null);
|
|
57
51
|
release();
|
|
58
52
|
};
|
|
59
53
|
// The URL is read once per key: a refetch must not reload the page.
|
|
@@ -71,7 +65,7 @@ export const ArtifactFrame = forwardRef(function ArtifactFrame({ frameKey, src,
|
|
|
71
65
|
const RELOAD_MS = 15_000;
|
|
72
66
|
// One browser tab: whether each artifact's last released frame had the keyboard.
|
|
73
67
|
const releasedFocus = new Map();
|
|
74
|
-
/** `artifact:<id>` of a frame key (`artifact:<id>:<version
|
|
68
|
+
/** `artifact:<id>` of a frame key (`artifact:<id>:<version>`). */
|
|
75
69
|
const artifactOf = (frameKey) => frameKey.split(':').slice(0, 2).join(':');
|
|
76
70
|
/** The keyboard is in a text field or an editor of this document. */
|
|
77
71
|
function typingElsewhere() {
|
|
@@ -86,7 +80,7 @@ export function ensureArtifactFrame(key, src, title) {
|
|
|
86
80
|
sandbox: ARTIFACT_IFRAME_SANDBOX,
|
|
87
81
|
allow: ARTIFACT_FRAME_ALLOW,
|
|
88
82
|
testid: 'artifact-frame',
|
|
89
|
-
// The page sees this app's origin, never the path
|
|
83
|
+
// The page sees this app's origin, never the path with project ids.
|
|
90
84
|
referrerPolicy: 'strict-origin',
|
|
91
85
|
});
|
|
92
86
|
}
|
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { getPublicArtifact } from '@kortix/sdk';
|
|
4
4
|
import { useArtifact } from '@kortix/sdk/react';
|
|
5
|
-
import {
|
|
5
|
+
import { ArrowSquareOutIcon, BrowserIcon, FileTextIcon, XIcon } from '@phosphor-icons/react';
|
|
6
6
|
import { useEffect, useState } from 'react';
|
|
7
|
-
import { useTranslations } from '../i18n/index.js';
|
|
8
7
|
import { useLocalizedUiCatalog } from '../i18n/ui-catalog/use-localized-ui-catalog.js';
|
|
9
8
|
import { Button } from '../primitives/button.js';
|
|
10
|
-
import { CountBadge } from '../primitives/count-badge.js';
|
|
11
9
|
import Hint from '../primitives/hint.js';
|
|
10
|
+
import { Skeleton } from '../primitives/skeleton.js';
|
|
12
11
|
import { useUiComponents, useUiRouter } from '../providers/ui-provider.js';
|
|
13
12
|
import { ArtifactFrame } from './artifact-frame.js';
|
|
14
13
|
import { artifactFrameKey, parseArtifactUrl } from './frame-policy.js';
|
|
@@ -61,7 +60,6 @@ function useShownArtifact(url) {
|
|
|
61
60
|
src: detail.version.view_url,
|
|
62
61
|
frameKey: artifactFrameKey(detail),
|
|
63
62
|
href: `/projects/${detail.project_id}/artifacts/${detail.artifact_id}`,
|
|
64
|
-
openThreads: detail.open_thread_count,
|
|
65
63
|
},
|
|
66
64
|
failed: false,
|
|
67
65
|
};
|
|
@@ -74,14 +72,13 @@ function useShownArtifact(url) {
|
|
|
74
72
|
*/
|
|
75
73
|
export function ShowArtifactCard({ url, fallback }) {
|
|
76
74
|
const copy = useLocalizedUiCatalog(COPY);
|
|
77
|
-
const t = useTranslations('artifacts');
|
|
78
75
|
const { artifact, failed } = useShownArtifact(url);
|
|
79
76
|
if (failed)
|
|
80
77
|
return _jsx(_Fragment, { children: fallback });
|
|
81
78
|
const Icon = artifact ? TYPE_ICON[artifact.type] : FileTextIcon;
|
|
82
79
|
return (_jsxs("a", { href: url, target: "_blank", rel: "noopener noreferrer", "data-testid": "show-artifact-card", className: "group border-border bg-card hover:border-foreground/20 flex w-full max-w-xl flex-col overflow-hidden rounded-lg border text-left transition-colors", children: [_jsx("span", { className: "bg-muted relative block aspect-[16/9] w-full overflow-hidden border-b", children: artifact ? (_jsx(ArtifactFrame, { preview: true,
|
|
83
80
|
// Its own frame: the chat card keeps its preview while the panel shows the artifact.
|
|
84
|
-
frameKey: `${artifact.frameKey}:chat`, src: artifact.src, title: artifact.title, className: "pointer-events-none absolute top-0 left-0 h-[400%] w-[400%] origin-top-left scale-25 border-0" })) : null }), _jsxs("span", { className: "flex items-center gap-3 p-3", children: [_jsx("span", { className: "bg-muted flex size-8 shrink-0 items-center justify-center rounded-md", children: _jsx(Icon, { className: "text-muted-foreground size-4" }) }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsx("span", { className: "text-foreground block truncate text-sm font-medium", children: artifact
|
|
81
|
+
frameKey: `${artifact.frameKey}:chat`, src: artifact.src, title: artifact.title, className: "pointer-events-none absolute top-0 left-0 h-[400%] w-[400%] origin-top-left scale-25 border-0" })) : null }), _jsxs("span", { className: "flex items-center gap-3 p-3", children: [_jsx("span", { className: "bg-muted flex size-8 shrink-0 items-center justify-center rounded-md", children: _jsx(Icon, { className: "text-muted-foreground size-4" }) }), _jsxs("span", { className: "min-w-0 flex-1", children: [artifact ? (_jsx("span", { className: "text-foreground block truncate text-sm font-medium", children: artifact.title })) : (_jsx(Skeleton, { className: "my-0.5 h-4 w-40 max-w-full" })), _jsx("span", { className: "text-muted-foreground flex items-center gap-1.5 text-xs", children: artifact ? (_jsx("span", { children: artifact.type === 'doc' ? copy.doc : copy.page })) : (_jsx(Skeleton, { className: "my-0.5 h-3 w-16" })) })] }), _jsx("span", { className: "text-muted-foreground group-hover:text-foreground shrink-0 text-xs font-medium transition-colors", children: copy.open })] })] }));
|
|
85
82
|
}
|
|
86
83
|
/**
|
|
87
84
|
* An artifact in the session panel: the page itself (a doc read as its page),
|
|
@@ -101,5 +98,5 @@ function ArtifactPagePreview({ url, onClose }) {
|
|
|
101
98
|
const router = useUiRouter();
|
|
102
99
|
const { artifact, failed } = useShownArtifact(url);
|
|
103
100
|
const Icon = artifact ? TYPE_ICON[artifact.type] : FileTextIcon;
|
|
104
|
-
return (_jsxs("div", { className: "flex h-full min-h-0 flex-col", children: [_jsxs("div", { className: "flex h-10 shrink-0 items-center gap-2 border-b pr-1 pl-3", children: [_jsx(Icon, { className: "text-muted-foreground size-4 shrink-0", "aria-hidden": true }), _jsx("span", { className: "text-foreground min-w-0 flex-1 truncate text-sm font-medium", children: artifact?.title ?? '' }), artifact?.href ? (_jsx(Hint, { label: copy.openArtifact, side: "bottom", children: _jsx(Button, { size: "icon-sm", variant: "ghost", "aria-label": copy.openArtifact, onClick: () => router.push(artifact.href), children: _jsx(
|
|
101
|
+
return (_jsxs("div", { className: "flex h-full min-h-0 flex-col", children: [_jsxs("div", { className: "flex h-10 shrink-0 items-center gap-2 border-b pr-1 pl-3", children: [_jsx(Icon, { className: "text-muted-foreground size-4 shrink-0", "aria-hidden": true }), _jsx("span", { className: "text-foreground min-w-0 flex-1 truncate text-sm font-medium", children: artifact?.title ?? '' }), artifact?.href ? (_jsx(Hint, { label: copy.openArtifact, side: "bottom", children: _jsx(Button, { size: "icon-sm", variant: "ghost", "aria-label": copy.openArtifact, onClick: () => router.push(artifact.href), children: _jsx(ArrowSquareOutIcon, { className: "size-3.5" }) }) })) : null, _jsx(Hint, { label: copy.close, side: "bottom", children: _jsx(Button, { size: "icon-sm", variant: "ghost", "aria-label": copy.close, onClick: onClose, children: _jsx(XIcon, { className: "size-3.5" }) }) })] }), _jsx("div", { className: "bg-muted relative min-h-0 flex-1", children: artifact ? (_jsx(ArtifactFrame, { frameKey: artifact.frameKey, src: artifact.src, title: artifact.title, className: "absolute inset-0 size-full border-0" })) : failed ? (_jsx("p", { className: "text-muted-foreground p-6 text-sm", children: copy.unavailable })) : null })] }));
|
|
105
102
|
}
|
|
@@ -12,7 +12,7 @@ export declare const ARTIFACT_FRAME_PREFIX = "artifact:";
|
|
|
12
12
|
export declare function artifactFrameKey(artifact: {
|
|
13
13
|
artifact_id: string;
|
|
14
14
|
updated_at: string;
|
|
15
|
-
}, version?: string | null
|
|
15
|
+
}, version?: string | null): string;
|
|
16
16
|
/**
|
|
17
17
|
* Print a doc to PDF without leaving the page: its print view (`?print=1`)
|
|
18
18
|
* loads in a hidden frame and opens the print dialog for that frame alone. The
|
|
@@ -9,8 +9,8 @@ export const ARTIFACT_FRAME_ALLOW = 'fullscreen; clipboard-write; autoplay; encr
|
|
|
9
9
|
/** Artifact frames share the Apps frame pool (`@kortix/ui/apps`); their keys start with this. */
|
|
10
10
|
export const ARTIFACT_FRAME_PREFIX = 'artifact:';
|
|
11
11
|
/** One pooled frame per artifact state: a save (`updated_at`) or an old version gets its own. */
|
|
12
|
-
export function artifactFrameKey(artifact, version
|
|
13
|
-
return `${ARTIFACT_FRAME_PREFIX}${artifact.artifact_id}:${version ?? artifact.updated_at}
|
|
12
|
+
export function artifactFrameKey(artifact, version) {
|
|
13
|
+
return `${ARTIFACT_FRAME_PREFIX}${artifact.artifact_id}:${version ?? artifact.updated_at}`;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* Print a doc to PDF without leaving the page: its print view (`?print=1`)
|
|
@@ -190,7 +190,7 @@ function useAgentUseCounts(projectId, agentName, config) {
|
|
|
190
190
|
...contract('inventory'),
|
|
191
191
|
});
|
|
192
192
|
// A trigger stored as `default` starts the project's default agent.
|
|
193
|
-
const fallback = config.default_agent ??
|
|
193
|
+
const fallback = config.default_agent ?? null;
|
|
194
194
|
return {
|
|
195
195
|
triggerCount: triggers.data
|
|
196
196
|
? triggers.data.triggers.filter((a) => a.target.kind === 'agent' && (a.target.agent === 'default' && fallback ? fallback : a.target.agent) === agentName).length
|
|
@@ -231,7 +231,7 @@ function HeaderBadges({ agent, config, block }) {
|
|
|
231
231
|
const tPage = useI18nTranslations('agentEditor.page');
|
|
232
232
|
const enabled = block.enabled !== false;
|
|
233
233
|
const mode = (block.behavior?.mode ?? agent.mode ?? 'primary').toLowerCase();
|
|
234
|
-
const isDefault =
|
|
234
|
+
const isDefault = config.default_agent === agent.name;
|
|
235
235
|
return (_jsxs(_Fragment, { children: [isDefault ? (_jsx(Badge, { variant: "secondary", size: "xs", children: tPage('default') })) : null, mode === 'subagent' ? (_jsx(Badge, { variant: "muted", size: "xs", children: t('startSubagent') })) : null, !enabled ? (_jsx(Badge, { variant: "muted", size: "xs", children: t('off') })) : null] }));
|
|
236
236
|
}
|
|
237
237
|
/**
|
|
@@ -344,7 +344,7 @@ function AgentActions({ projectId, agent, config, canWrite, share, }) {
|
|
|
344
344
|
const configure = useConfigureThread(projectId);
|
|
345
345
|
const makeDefault = useDefaultAgent(projectId);
|
|
346
346
|
const [confirm, setConfirm] = useState(null);
|
|
347
|
-
const isDefault =
|
|
347
|
+
const isDefault = config.default_agent === agent.name;
|
|
348
348
|
const mode = agent.mode?.toLowerCase();
|
|
349
349
|
const startBlocked = agent.enabled === false
|
|
350
350
|
? t('startDisabled')
|
|
@@ -410,7 +410,7 @@ function EditableAgentPage({ projectId, agent, config, initial, renderApps, }) {
|
|
|
410
410
|
const policySetOptions = useMemo(() => connectorPolicySetOptions(config.manifest_raw), [config.manifest_raw]);
|
|
411
411
|
const policySetControl = useAgentPolicySetControls(projectId, editor, policySetOptions);
|
|
412
412
|
const surface = { kind: 'agent', agentName: agent.name };
|
|
413
|
-
const defaultAgent = config.default_agent
|
|
413
|
+
const defaultAgent = config.default_agent;
|
|
414
414
|
const name = agentDisplayName(agent.name);
|
|
415
415
|
const sourcePath = editor.draft.file ?? configEntitySourcePath(agent.path);
|
|
416
416
|
const { draft, set } = editor;
|
|
@@ -539,7 +539,7 @@ function ReadOnlyAgentPage({ projectId, agent, config, block, canWrite, }) {
|
|
|
539
539
|
return (_jsxs(AgentTabBody, { className: `${location.view === 'model' || location.view === 'workspace' ? CENTER_COLUMN : RAIL_COLUMN} space-y-6`, children: [banner, _jsx(EditorSectionStyleProvider, { value: "panel", children: location.view === 'model' ? (_jsxs("div", { className: "space-y-3", children: [_jsx(AgentModel, { projectId: projectId, agentName: agent.name }), _jsx("p", { className: "text-muted-foreground text-xs text-pretty", children: tI18nComplete.raw('text9dee2a1acfd9') })] })) : (_jsxs("div", { className: "space-y-8", children: [_jsx(AgentScope, { projectId: projectId, agentName: agent.name, scope: agent.scope }), _jsx(AgentAuthorityCard, { projectId: projectId, agentName: agent.name, grant: block.kortix_permissions ?? block.kortix_cli })] })) })] }));
|
|
540
540
|
case 'triggers':
|
|
541
541
|
// The same Triggers screen; its own controls decide what a reader may change.
|
|
542
|
-
return (_jsx(Embedded, { agentName: agent.name, children: _jsx(TriggersPage, { projectId: projectId, surface: { kind: 'agent', agentName: agent.name }, defaultAgent: config.default_agent
|
|
542
|
+
return (_jsx(Embedded, { agentName: agent.name, children: _jsx(TriggersPage, { projectId: projectId, surface: { kind: 'agent', agentName: agent.name }, defaultAgent: config.default_agent }) }));
|
|
543
543
|
}
|
|
544
544
|
})();
|
|
545
545
|
return (_jsxs("div", { className: "relative flex h-full min-h-0 flex-1 flex-col", children: [_jsx(AgentBreadcrumbHeader, { listHref: capabilityTabHref(projectId, 'agent'), slug: agent.name, title: name, badges: _jsx(HeaderBadges, { agent: agent, config: config, block: block }), actions: _jsx(AgentActions, { projectId: projectId, agent: agent, config: config, canWrite: canWrite, share: share }) }), _jsx(RailLayout, { rail: _jsx(AgentRail, { groups: railGroups, active: railKeyOf(location) }), children: body })] }));
|
|
@@ -3,7 +3,7 @@ export function agentStatus(agent, config) {
|
|
|
3
3
|
return {
|
|
4
4
|
mode,
|
|
5
5
|
showMode: !!mode && mode !== 'primary',
|
|
6
|
-
isDefault:
|
|
6
|
+
isDefault: config?.default_agent === agent.name,
|
|
7
7
|
disabled: agent.enabled === false,
|
|
8
8
|
};
|
|
9
9
|
}
|
|
@@ -94,7 +94,7 @@ export function AgentsPage({ projectId }) {
|
|
|
94
94
|
});
|
|
95
95
|
const triggerCounts = useMemo(() => {
|
|
96
96
|
const counts = new Map();
|
|
97
|
-
const fallback = config?.default_agent ??
|
|
97
|
+
const fallback = config?.default_agent ?? null;
|
|
98
98
|
for (const trigger of triggersQuery.data?.triggers ?? []) {
|
|
99
99
|
const owner = trigger.agent === 'default' && fallback ? fallback : trigger.agent;
|
|
100
100
|
counts.set(owner, (counts.get(owner) ?? 0) + 1);
|
|
@@ -119,7 +119,7 @@ export function AgentsPage({ projectId }) {
|
|
|
119
119
|
}, [grantsQuery.data]);
|
|
120
120
|
const agents = useMemo(() => toArray(config?.agents), [config]);
|
|
121
121
|
const filtered = useMemo(() => filterAgents(agents, { mode: null, query }), [agents, query]);
|
|
122
|
-
const defaultAgent = config?.default_agent ??
|
|
122
|
+
const defaultAgent = config?.default_agent ?? null;
|
|
123
123
|
// The agents a person starts first (the default leading), subagents after.
|
|
124
124
|
const work = useMemo(() => filtered
|
|
125
125
|
.filter((agent) => !agent.platform)
|
|
@@ -194,7 +194,7 @@ function DefaultAgentSelector({ projectId, config, canWrite, }) {
|
|
|
194
194
|
const queryClient = useQueryClient();
|
|
195
195
|
// A subagent cannot start a chat, so it is not offered as the default.
|
|
196
196
|
const availableAgents = toArray(config.agents).filter((agent) => agent.enabled !== false && agentInMode(agent, 'primary'));
|
|
197
|
-
const current = config.default_agent
|
|
197
|
+
const current = config.default_agent;
|
|
198
198
|
const mutation = useMutation({
|
|
199
199
|
mutationFn: (agentName) => updateProjectDefaultAgent(projectId, agentName),
|
|
200
200
|
onSuccess: async (result) => {
|
|
@@ -15,12 +15,12 @@ export declare function useAgentAccess(projectId: string): {
|
|
|
15
15
|
signals: Record<string, boolean>;
|
|
16
16
|
manifest_raw: string | null;
|
|
17
17
|
manifest_health?: import("@kortix/sdk").ProjectManifestHealth;
|
|
18
|
-
open_code_raw
|
|
19
|
-
open_code_default_agent
|
|
18
|
+
open_code_raw?: string | null;
|
|
19
|
+
open_code_default_agent?: string | null;
|
|
20
20
|
builtin_agents?: {
|
|
21
21
|
my_kortix: boolean;
|
|
22
22
|
};
|
|
23
|
-
agent_discovery: "
|
|
23
|
+
agent_discovery: "declarative" | "opencode";
|
|
24
24
|
agents: Array<{
|
|
25
25
|
name: string;
|
|
26
26
|
path: string;
|
|
@@ -37,7 +37,7 @@ import { emptyProjectSlot, useAddAccount } from '../../internal/hooks/connectors
|
|
|
37
37
|
import { useDeleteTunnelConnection } from '@kortix/sdk/react';
|
|
38
38
|
import { useCopy } from '../../internal/hooks/use-copy.js';
|
|
39
39
|
import { cn } from '../../internal/lib/utils.js';
|
|
40
|
-
import { createConnector, discoverConnectionOAuth2, discoverConnectionOAuth2Resource, discoverConnectorAuth, ensureProjectConnectorConnection, getConnectorConfig, getProjectDetail, listAllConnections, listConnections, listProjectAccess,
|
|
40
|
+
import { createConnector, discoverConnectionOAuth2, discoverConnectionOAuth2Resource, discoverConnectorAuth, ensureProjectConnectorConnection, getConnectorConfig, getProjectDetail, listAllConnections, listConnections, listProjectAccess, putConnectionOAuth2Application, reconcileMemberConnection, renameConnection, revokeConnection, setConnectorCredential, setDefaultConnection, startConnectionOAuth2Authorization, startConnectionOAuth2DeviceAuthorization, updateConnectionCredential, waitForConnectionOAuth2, } from '@kortix/sdk';
|
|
41
41
|
import { contract, qk, useFeatureFlag, useProjectAccountId } from '@kortix/sdk/react';
|
|
42
42
|
import { AddAccountFields } from './add-account-fields.js';
|
|
43
43
|
import { useEmailInboxes, useRemoveEmailInbox, } from '../../internal/hooks/channels/use-email-inboxes.js';
|
|
@@ -808,44 +808,57 @@ export function SetCredentialModal({ projectId, connector, connectionId, owner,
|
|
|
808
808
|
const [device, setDevice] = useState(null);
|
|
809
809
|
const [deviceConnectionId, setDeviceConnectionId] = useState(null);
|
|
810
810
|
const [manualSetup, setManualSetup] = useState(false);
|
|
811
|
+
// The callers pass inline lambdas. Read them through refs, so a parent
|
|
812
|
+
// re-render does not tear the poll down and fire an extra poll.
|
|
813
|
+
const onSavedRef = useRef(onSaved);
|
|
814
|
+
const onOpenChangeRef = useRef(onOpenChange);
|
|
811
815
|
useEffect(() => {
|
|
812
|
-
|
|
816
|
+
onSavedRef.current = onSaved;
|
|
817
|
+
onOpenChangeRef.current = onOpenChange;
|
|
818
|
+
});
|
|
819
|
+
// A closed dialog has no sign-in in progress: the code goes, and the poll
|
|
820
|
+
// below stops. It used to keep polling and call `onSaved` on a dialog the
|
|
821
|
+
// user had left.
|
|
822
|
+
useEffect(() => {
|
|
823
|
+
if (!open)
|
|
824
|
+
setDevice(null);
|
|
825
|
+
}, [open]);
|
|
826
|
+
// The device-code wait is the SDK's (`waitForConnectionOAuth2`): it polls at
|
|
827
|
+
// the server's interval, one request at a time, keeps polling on
|
|
828
|
+
// `pending`/`ready`/`not_configured`, and fails on `expired`/`error`/
|
|
829
|
+
// `revoked`. Bounded by the code's own expiry.
|
|
830
|
+
useEffect(() => {
|
|
831
|
+
if (!open || !device || !deviceConnectionId)
|
|
813
832
|
return;
|
|
814
|
-
|
|
815
|
-
const
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
return () => {
|
|
844
|
-
stopped = true;
|
|
845
|
-
window.clearInterval(timer);
|
|
846
|
-
window.clearTimeout(expiryTimer);
|
|
847
|
-
};
|
|
848
|
-
}, [device, deviceConnectionId, onOpenChange, onSaved, projectId, tI18nHardcoded]);
|
|
833
|
+
const controller = new AbortController();
|
|
834
|
+
const expiresAtMs = new Date(device.expires_at).getTime();
|
|
835
|
+
waitForConnectionOAuth2(projectId, deviceConnectionId, {
|
|
836
|
+
kind: 'device',
|
|
837
|
+
sessionId: device.session_id,
|
|
838
|
+
userCode: device.user_code,
|
|
839
|
+
url: device.verification_uri_complete ?? device.verification_uri,
|
|
840
|
+
expiresAt: device.expires_at,
|
|
841
|
+
intervalSeconds: device.interval_seconds,
|
|
842
|
+
}, { signal: controller.signal, timeoutMs: Math.max(0, expiresAtMs - Date.now()) }).then(() => {
|
|
843
|
+
if (controller.signal.aborted)
|
|
844
|
+
return;
|
|
845
|
+
setDevice(null);
|
|
846
|
+
successToast(tI18nHardcoded.raw('i18nComplete.textc2a5f8398f12'));
|
|
847
|
+
onSavedRef.current();
|
|
848
|
+
onOpenChangeRef.current(false);
|
|
849
|
+
}, (error) => {
|
|
850
|
+
if (controller.signal.aborted)
|
|
851
|
+
return;
|
|
852
|
+
// A terminal answer clears the code, so Save starts a fresh one.
|
|
853
|
+
setDevice(null);
|
|
854
|
+
errorToast(Date.now() >= expiresAtMs
|
|
855
|
+
? tI18nHardcoded.raw('i18nComplete.text02c1d7b545ea')
|
|
856
|
+
: error instanceof Error && error.message
|
|
857
|
+
? error.message
|
|
858
|
+
: tI18nHardcoded.raw('i18nComplete.text911a1cde90bc'));
|
|
859
|
+
});
|
|
860
|
+
return () => controller.abort();
|
|
861
|
+
}, [open, device, deviceConnectionId, projectId, tI18nHardcoded]);
|
|
849
862
|
const resolveConnectionId = async () => {
|
|
850
863
|
if (connectionId)
|
|
851
864
|
return connectionId;
|
|
@@ -12,10 +12,10 @@ import { CheckCircleIcon as CheckCircle2, WarningIcon as TriangleAlert, } from '
|
|
|
12
12
|
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
13
13
|
import { useTranslations } from '../../../i18n/index.js';
|
|
14
14
|
import { useUiViewer } from '../../../providers/ui-provider.js';
|
|
15
|
-
import { useCallback, useEffect, useMemo,
|
|
15
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
16
16
|
import { forgetSubscriptionCredentials, subscriptionIsConnected, subscriptionPrimaryAction, } from './subscription-control.js';
|
|
17
17
|
import { sleep } from './utils.js';
|
|
18
|
-
import { runDeviceGrant } from './device-grant.js';
|
|
18
|
+
import { createRunGeneration, runDeviceGrant } from './device-grant.js';
|
|
19
19
|
/** OAuth route id, the provider the models belong to, and the logo. */
|
|
20
20
|
const SUBSCRIPTIONS = {
|
|
21
21
|
chatgpt: { oauth: 'openai', providerId: 'codex', logo: 'openai', logoName: 'OpenAI' },
|
|
@@ -82,20 +82,20 @@ export function useSubscriptionSignIn({ projectId, onConnected, kind = 'chatgpt'
|
|
|
82
82
|
/** Claude: the sign-in the pasted code completes, and whether it is being checked. */
|
|
83
83
|
const [claudeFlow, setClaudeFlow] = useState(null);
|
|
84
84
|
const [checking, setChecking] = useState(false);
|
|
85
|
-
|
|
85
|
+
// One generation per sign-in run: Cancel then Connect must not revive the
|
|
86
|
+
// old loop (see `createRunGeneration`).
|
|
87
|
+
const [runs] = useState(createRunGeneration);
|
|
86
88
|
useEffect(() => {
|
|
87
|
-
return () =>
|
|
88
|
-
|
|
89
|
-
};
|
|
90
|
-
}, []);
|
|
89
|
+
return () => runs.cancel();
|
|
90
|
+
}, [runs]);
|
|
91
91
|
const reset = useCallback(() => {
|
|
92
|
-
|
|
92
|
+
runs.cancel();
|
|
93
93
|
setChallenge(null);
|
|
94
94
|
setClaudeFlow(null);
|
|
95
95
|
setChecking(false);
|
|
96
96
|
setError(null);
|
|
97
97
|
setPhase('idle');
|
|
98
|
-
}, []);
|
|
98
|
+
}, [runs]);
|
|
99
99
|
const claudeConnected = useCallback(async () => {
|
|
100
100
|
setPhase('done');
|
|
101
101
|
setChallenge(null);
|
|
@@ -108,14 +108,14 @@ export function useSubscriptionSignIn({ projectId, onConnected, kind = 'chatgpt'
|
|
|
108
108
|
}, [copy.connectedToast, onConnected, projectId, queryClient, subscription.providerId]);
|
|
109
109
|
/** Claude: start `claude setup-token` and open claude.com. The tab opens inside the click, so a popup blocker lets it through. */
|
|
110
110
|
const startClaude = useCallback(async () => {
|
|
111
|
-
|
|
111
|
+
const isCancelled = runs.begin();
|
|
112
112
|
setError(null);
|
|
113
113
|
setChallenge(null);
|
|
114
114
|
setPhase('waiting');
|
|
115
115
|
const popup = typeof window === 'undefined' ? null : window.open('about:blank', '_blank');
|
|
116
116
|
try {
|
|
117
117
|
const started = await startClaudeSubscriptionLogin(projectId);
|
|
118
|
-
if (
|
|
118
|
+
if (isCancelled()) {
|
|
119
119
|
popup?.close();
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
@@ -126,23 +126,26 @@ export function useSubscriptionSignIn({ projectId, onConnected, kind = 'chatgpt'
|
|
|
126
126
|
}
|
|
127
127
|
catch (err) {
|
|
128
128
|
popup?.close();
|
|
129
|
+
if (isCancelled())
|
|
130
|
+
return;
|
|
129
131
|
setPhase('idle');
|
|
130
132
|
setError(err instanceof Error && err.message ? err.message : copy.failed);
|
|
131
133
|
}
|
|
132
|
-
}, [copy.failed, projectId]);
|
|
134
|
+
}, [copy.failed, projectId, runs]);
|
|
133
135
|
/** Claude: hand the code claude.com showed to the sign-in. A refused code ends it: the next try signs in again. */
|
|
134
136
|
const submitCode = useCallback(async (code) => {
|
|
135
137
|
if (!claudeFlow || !code.trim())
|
|
136
138
|
return;
|
|
139
|
+
const isCancelled = runs.current();
|
|
137
140
|
setChecking(true);
|
|
138
141
|
setError(null);
|
|
139
142
|
try {
|
|
140
143
|
await completeClaudeSubscriptionLogin(projectId, { flowId: claudeFlow, code: code.trim() });
|
|
141
|
-
if (!
|
|
144
|
+
if (!isCancelled())
|
|
142
145
|
await claudeConnected();
|
|
143
146
|
}
|
|
144
147
|
catch (err) {
|
|
145
|
-
if (
|
|
148
|
+
if (isCancelled())
|
|
146
149
|
return;
|
|
147
150
|
setPhase('idle');
|
|
148
151
|
setChallenge(null);
|
|
@@ -152,11 +155,11 @@ export function useSubscriptionSignIn({ projectId, onConnected, kind = 'chatgpt'
|
|
|
152
155
|
finally {
|
|
153
156
|
setChecking(false);
|
|
154
157
|
}
|
|
155
|
-
}, [claudeConnected, claudeFlow, projectId, tClaude]);
|
|
158
|
+
}, [claudeConnected, claudeFlow, projectId, tClaude, runs]);
|
|
156
159
|
const handleConnect = useCallback(async () => {
|
|
157
160
|
if (claude)
|
|
158
161
|
return startClaude();
|
|
159
|
-
|
|
162
|
+
const isCancelled = runs.begin();
|
|
160
163
|
setError(null);
|
|
161
164
|
setChallenge(null);
|
|
162
165
|
setPhase('waiting');
|
|
@@ -165,7 +168,7 @@ export function useSubscriptionSignIn({ projectId, onConnected, kind = 'chatgpt'
|
|
|
165
168
|
pollOAuth: (flowId) => pollProjectProviderOAuth(projectId, subscription.oauth, flowId),
|
|
166
169
|
sleep,
|
|
167
170
|
now: Date.now,
|
|
168
|
-
isCancelled
|
|
171
|
+
isCancelled,
|
|
169
172
|
setChallenge,
|
|
170
173
|
setPhase,
|
|
171
174
|
setError,
|
|
@@ -179,7 +182,7 @@ export function useSubscriptionSignIn({ projectId, onConnected, kind = 'chatgpt'
|
|
|
179
182
|
onConnected(subscription.providerId);
|
|
180
183
|
},
|
|
181
184
|
});
|
|
182
|
-
}, [claude, startClaude, projectId, queryClient, onConnected, subscription, copy.connectedToast, copy.failed]);
|
|
185
|
+
}, [claude, startClaude, projectId, queryClient, onConnected, subscription, copy.connectedToast, copy.failed, runs]);
|
|
183
186
|
// What the PROJECT holds, not what this component remembers doing. A
|
|
184
187
|
// credential connected in another tab, another surface, or before this page
|
|
185
188
|
// load is still connected — and until this read existed the card offered
|
|
@@ -13,3 +13,18 @@ export declare function runDeviceGrant({ startOAuth, pollOAuth, sleep, now, isCa
|
|
|
13
13
|
onSuccess: () => void;
|
|
14
14
|
failedMessage: string;
|
|
15
15
|
}): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* One generation per sign-in run. `begin()` starts a run and returns ITS
|
|
18
|
+
* cancelled check; `cancel()` (Cancel, unmount) ends every run so far.
|
|
19
|
+
*
|
|
20
|
+
* A single shared boolean could not tell runs apart: Cancel set it, the next
|
|
21
|
+
* Connect cleared it, and the old loop (asleep in its poll interval) woke up
|
|
22
|
+
* "not cancelled", polled its old flow, and its `expired` answer wiped the new
|
|
23
|
+
* code off the card.
|
|
24
|
+
*/
|
|
25
|
+
export declare function createRunGeneration(): {
|
|
26
|
+
begin(): () => boolean;
|
|
27
|
+
/** The cancelled check of the run in progress, without starting one. */
|
|
28
|
+
current(): () => boolean;
|
|
29
|
+
cancel(): void;
|
|
30
|
+
};
|
|
@@ -51,3 +51,30 @@ export async function runDeviceGrant({ startOAuth, pollOAuth, sleep, now, isCanc
|
|
|
51
51
|
setError(err instanceof Error ? err.message : failedMessage);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* One generation per sign-in run. `begin()` starts a run and returns ITS
|
|
56
|
+
* cancelled check; `cancel()` (Cancel, unmount) ends every run so far.
|
|
57
|
+
*
|
|
58
|
+
* A single shared boolean could not tell runs apart: Cancel set it, the next
|
|
59
|
+
* Connect cleared it, and the old loop (asleep in its poll interval) woke up
|
|
60
|
+
* "not cancelled", polled its old flow, and its `expired` answer wiped the new
|
|
61
|
+
* code off the card.
|
|
62
|
+
*/
|
|
63
|
+
export function createRunGeneration() {
|
|
64
|
+
let current = 0;
|
|
65
|
+
return {
|
|
66
|
+
begin() {
|
|
67
|
+
current += 1;
|
|
68
|
+
const run = current;
|
|
69
|
+
return () => current !== run;
|
|
70
|
+
},
|
|
71
|
+
/** The cancelled check of the run in progress, without starting one. */
|
|
72
|
+
current() {
|
|
73
|
+
const run = current;
|
|
74
|
+
return () => current !== run;
|
|
75
|
+
},
|
|
76
|
+
cancel() {
|
|
77
|
+
current += 1;
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
}
|
|
@@ -229,9 +229,4 @@ export const KORTIX_PERMISSIONS_CATALOG = [
|
|
|
229
229
|
actions: ['project.artifact.read', 'project.artifact.write', 'project.artifact.manage', 'project.artifact.public'],
|
|
230
230
|
featureFlag: 'artifacts',
|
|
231
231
|
},
|
|
232
|
-
{
|
|
233
|
-
group: 'Artifact comments',
|
|
234
|
-
actions: ['project.artifact.comment'],
|
|
235
|
-
featureFlag: 'artifact_comments',
|
|
236
|
-
},
|
|
237
232
|
];
|
|
@@ -30,8 +30,8 @@ export interface AgentDraft {
|
|
|
30
30
|
commit: (saved: AgentConfigBlock) => void;
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
|
-
* A served block with its behavior under `behavior` only.
|
|
34
|
-
* pre-W4 `opencode` alias beside it; a draft that kept both would send two
|
|
33
|
+
* A served block with its behavior under `behavior` only. An older API answers
|
|
34
|
+
* the pre-W4 `opencode` alias beside it; a draft that kept both would send two
|
|
35
35
|
* copies of every edit.
|
|
36
36
|
*/
|
|
37
37
|
export declare function behaviorBlock(block: AgentConfigBlock): AgentConfigBlock;
|
|
@@ -76,8 +76,8 @@ export function stableStringify(value) {
|
|
|
76
76
|
return `{${entries.join(',')}}`;
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
|
-
* A served block with its behavior under `behavior` only.
|
|
80
|
-
* pre-W4 `opencode` alias beside it; a draft that kept both would send two
|
|
79
|
+
* A served block with its behavior under `behavior` only. An older API answers
|
|
80
|
+
* the pre-W4 `opencode` alias beside it; a draft that kept both would send two
|
|
81
81
|
* copies of every edit.
|
|
82
82
|
*/
|
|
83
83
|
export function behaviorBlock(block) {
|