@kortix/ui 0.15.0 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/dist/_vendor/kortix-shared.js +233 -130
  2. package/dist/_vendor/shared/code-language.d.ts +2 -2
  3. package/dist/_vendor/shared/html.d.ts +7 -0
  4. package/dist/_vendor/shared/index.d.ts +1 -0
  5. package/dist/_vendor/shared/pixel-mark.d.ts +28 -0
  6. package/dist/_vendor/shared/runtime-versions.d.ts +2 -6
  7. package/dist/_vendor/shared/tool-output/media-path.d.ts +1 -6
  8. package/dist/_vendor/shared/tool-output/scan.d.ts +2 -0
  9. package/dist/_vendor/shared/utils/string.d.ts +6 -0
  10. package/dist/artifacts/artifact-session.js +4 -3
  11. package/dist/customize/agents/agent-page.js +5 -5
  12. package/dist/customize/agents/agent-status.js +1 -1
  13. package/dist/customize/agents/agents-page.js +3 -3
  14. package/dist/customize/connectors/use-agent-access.d.ts +3 -3
  15. package/dist/customize/sections/connectors-view.js +50 -37
  16. package/dist/customize/sections/llm-provider/chatgpt-subscription-connect.js +21 -18
  17. package/dist/customize/sections/llm-provider/device-grant.d.ts +15 -0
  18. package/dist/customize/sections/llm-provider/device-grant.js +27 -0
  19. package/dist/customize/sections/view/agent-editor.d.ts +2 -2
  20. package/dist/customize/sections/view/agent-editor.js +2 -2
  21. package/dist/customize/sections/view/review-center-connected.js +37 -6
  22. package/dist/customize/sections/view/secret-delivery.d.ts +4 -5
  23. package/dist/customize/sections/view/secret-delivery.js +5 -4
  24. package/dist/customize/triggers/schedule/trigger-runs-logic.d.ts +6 -0
  25. package/dist/customize/triggers/schedule/trigger-runs-logic.js +13 -0
  26. package/dist/customize/triggers/schedule/trigger-runs-panel.js +9 -2
  27. package/dist/files/project/api/runtime-files.d.ts +2 -2
  28. package/dist/files/project/api/runtime-files.js +2 -2
  29. package/dist/files/project/components/drive-explorer.js +1 -1
  30. package/dist/files/project/components/drive-grid-view.js +0 -1
  31. package/dist/files/project/components/drive-list-view.js +0 -1
  32. package/dist/files/project/components/file-explorer-page.js +1 -1
  33. package/dist/files/project/hooks/index.d.ts +1 -1
  34. package/dist/files/project/hooks/index.js +1 -1
  35. package/dist/files/project/hooks/use-server-health.d.ts +1 -1
  36. package/dist/files/project/hooks/use-server-health.js +1 -1
  37. package/dist/files/project/search/workspace-search-service.d.ts +1 -1
  38. package/dist/files/project/search/workspace-search-service.js +1 -1
  39. package/dist/files/runtime/hooks/index.d.ts +1 -1
  40. package/dist/files/runtime/hooks/index.js +1 -1
  41. package/dist/files/runtime/hooks/server-health-state.d.ts +2 -2
  42. package/dist/files/runtime/hooks/server-health-state.js +2 -2
  43. package/dist/files/runtime/hooks/system-dir.js +2 -2
  44. package/dist/files/runtime/hooks/use-file-content.d.ts +1 -1
  45. package/dist/files/runtime/hooks/use-file-content.js +1 -1
  46. package/dist/files/runtime/hooks/use-file-list.d.ts +1 -1
  47. package/dist/files/runtime/hooks/use-file-list.js +3 -3
  48. package/dist/files/runtime/hooks/use-server-health.d.ts +2 -2
  49. package/dist/files/runtime/hooks/use-server-health.js +3 -3
  50. package/dist/files/runtime/hooks/use-workspace-search.d.ts +1 -2
  51. package/dist/files/runtime/hooks/use-workspace-search.js +0 -1
  52. package/dist/files/runtime/index.d.ts +2 -2
  53. package/dist/files/runtime/index.js +2 -2
  54. package/dist/files/runtime/path-utils.d.ts +1 -1
  55. package/dist/files/runtime/path-utils.js +1 -1
  56. package/dist/files/runtime/sandbox-explorer-source.d.ts +1 -1
  57. package/dist/files/runtime/sandbox-explorer-source.js +1 -1
  58. package/dist/files/runtime/sandbox-file-explorer.d.ts +1 -1
  59. package/dist/files/runtime/sandbox-file-explorer.js +2 -2
  60. package/dist/files/tree/components/file-tree-item.js +0 -1
  61. package/dist/files/tree/hooks/use-file-events.d.ts +1 -1
  62. package/dist/files/tree/hooks/use-file-events.js +1 -1
  63. package/dist/i18n/en.d.ts +63 -1
  64. package/dist/i18n/en.js +79 -17
  65. package/dist/internal/files/file-read-retry.js +1 -1
  66. package/dist/internal/files/types.d.ts +2 -2
  67. package/dist/internal/files/types.js +2 -2
  68. package/dist/internal/goals/goal-meta.d.ts +33 -14
  69. package/dist/internal/goals/goal-meta.js +55 -13
  70. package/dist/internal/layout/nav-hover-card.d.ts +1 -1
  71. package/dist/internal/layout/nav-hover-card.js +1 -1
  72. package/dist/internal/layout/project-capability-nav.d.ts +1 -1
  73. package/dist/internal/layout/project-capability-nav.js +1 -1
  74. package/dist/internal/lib/browser-error-noise.d.ts +1 -1
  75. package/dist/internal/lib/browser-error-noise.js +1 -1
  76. package/dist/internal/lib/browser-noise/rules/expected-states.js +1 -1
  77. package/dist/internal/lib/browser-noise/rules/injected-scripts.js +18 -0
  78. package/dist/internal/lib/browser-noise/rules/old-browsers.d.ts +1 -0
  79. package/dist/internal/lib/browser-noise/rules/old-browsers.js +1 -1
  80. package/dist/internal/lib/browser-noise/rules/rejections.d.ts +0 -9
  81. package/dist/internal/lib/browser-noise/rules/rejections.js +0 -14
  82. package/dist/internal/lib/delivered-but-disconnected.js +3 -5
  83. package/dist/internal/lib/error-handler.js +8 -3
  84. package/dist/internal/lib/pixel-mark.d.ts +4 -17
  85. package/dist/internal/lib/pixel-mark.js +5 -148
  86. package/dist/internal/lib/sounds.d.ts +4 -4
  87. package/dist/internal/lib/sounds.js +4 -4
  88. package/dist/internal/lib/use-project-feature-flags.js +3 -1
  89. package/dist/internal/stores/composer-prefill-store.js +4 -1
  90. package/dist/internal/stores/sound-store.d.ts +4 -4
  91. package/dist/internal/stores/sound-store.js +10 -0
  92. package/dist/markdown/code/shiki-highlighter.js +14 -5
  93. package/dist/markdown/file-links.js +12 -3
  94. package/dist/markdown/markdown-frontmatter.d.ts +6 -6
  95. package/dist/markdown/markdown-frontmatter.js +3 -3
  96. package/dist/primitives/button.js +2 -1
  97. package/dist/session/agents/held-messages.d.ts +1 -5
  98. package/dist/session/agents/held-messages.js +1 -21
  99. package/dist/session/composer/ComposerAboveCard.d.ts +4 -1
  100. package/dist/session/composer/ComposerAboveCard.js +2 -2
  101. package/dist/session/composer/composer-chat-input.d.ts +1 -1
  102. package/dist/session/composer/composer-chat-input.js +2 -2
  103. package/dist/session/composer/composer.js +16 -1
  104. package/dist/session/composer/hooks/use-file-search.d.ts +15 -15
  105. package/dist/session/composer/hooks/use-file-search.js +16 -16
  106. package/dist/session/composer/menus/mention-controller.js +1 -3
  107. package/dist/session/composer/menus/space-mentions.d.ts +14 -4
  108. package/dist/session/composer/menus/space-mentions.js +17 -1
  109. package/dist/session/composer/use-instant-session-send.js +2 -2
  110. package/dist/session/header/session-goal-indicator.js +4 -4
  111. package/dist/session/panel/easy/plan-card.d.ts +2 -2
  112. package/dist/session/panel/easy/plan-card.js +2 -2
  113. package/dist/session/panel/session-desktop.js +6 -0
  114. package/dist/session/panel/use-session-panel-state.js +2 -2
  115. package/dist/session/status/sandbox-loading-boundary.js +2 -2
  116. package/dist/session/status/session-terminal-state.d.ts +47 -0
  117. package/dist/session/status/session-terminal-state.js +56 -0
  118. package/dist/session/thread/plan-surface.d.ts +1 -1
  119. package/dist/session/thread/plan-surface.js +1 -1
  120. package/dist/session/thread/session-chat.d.ts +1 -1
  121. package/dist/session/thread/session-chat.js +88 -99
  122. package/dist/session/thread/stop-sequence.d.ts +51 -0
  123. package/dist/session/thread/stop-sequence.js +55 -0
  124. package/dist/session/thread/transcript.d.ts +2 -2
  125. package/dist/session/thread/transcript.js +2 -2
  126. package/dist/session/tool/tools/apply-patch-tool.d.ts +1 -1
  127. package/dist/session/tool/tools/apply-patch-tool.js +1 -1
  128. package/dist/session/tool/tools/kortix-action-tool.js +1 -1
  129. package/dist/session/tool/tools/multi-agent-tool-bodies.d.ts +1 -1
  130. package/dist/session/tool/tools/multi-agent-tool-bodies.js +1 -1
  131. package/dist/session/tool/tools/multi-agent-tools.js +1 -1
  132. package/dist/session/tool/tools/pty-kill-tool.d.ts +1 -1
  133. package/dist/session/tool/tools/pty-kill-tool.js +1 -1
  134. package/dist/session/tool/tools/pty-read-tool.d.ts +2 -2
  135. package/dist/session/tool/tools/pty-read-tool.js +2 -2
  136. package/dist/session/tool/tools/pty-spawn-tool.d.ts +1 -1
  137. package/dist/session/tool/tools/pty-spawn-tool.js +1 -1
  138. package/dist/session/tool/tools/pty-write-tool.d.ts +1 -1
  139. package/dist/session/tool/tools/pty-write-tool.js +1 -1
  140. package/dist/session/tool/tools/todo-write-tool.d.ts +1 -1
  141. package/dist/session/tool/tools/todo-write-tool.js +1 -1
  142. package/dist/session/turn/peer-message-row.d.ts +1 -10
  143. package/dist/session/turn/peer-message-row.js +1 -18
  144. package/dist/session/turn/plan-anchor.d.ts +3 -3
  145. package/dist/session/turn/plan-anchor.js +3 -3
  146. package/dist/session/turn/plan-card.d.ts +7 -7
  147. package/dist/session/turn/plan-card.js +7 -7
  148. package/dist/styles.css +1 -1
  149. package/dist/terminal/terminal-card-gate.d.ts +6 -3
  150. package/dist/terminal/terminal-card-gate.js +21 -4
  151. package/dist/workspace/index.d.ts +1 -1
  152. package/dist/workspace/index.js +1 -1
  153. package/dist/workspace/review/review-center.d.ts +8 -2
  154. package/dist/workspace/review/review-center.js +44 -13
  155. package/dist/workspace/review/review-reducer.d.ts +7 -0
  156. package/dist/workspace/review/review-reducer.js +11 -0
  157. package/dist/workspace/sidebar/footer/project-artifacts-nav.d.ts +6 -1
  158. package/dist/workspace/sidebar/footer/project-artifacts-nav.js +47 -4
  159. package/dist/workspace/sidebar/project-nav-items.js +11 -12
  160. package/dist/workspace/spaces/principal-card.d.ts +3 -1
  161. package/dist/workspace/spaces/principal-card.js +3 -3
  162. package/dist/workspace/spaces/space-agent-ask.d.ts +14 -0
  163. package/dist/workspace/spaces/space-agent-ask.js +36 -0
  164. package/dist/workspace/spaces/space-details-dialog.js +1 -1
  165. package/dist/workspace/spaces/space-details-panel.d.ts +2 -1
  166. package/dist/workspace/spaces/space-details-panel.js +62 -8
  167. package/dist/workspace/spaces/space-mention-source.d.ts +3 -2
  168. package/dist/workspace/spaces/space-mention-source.js +12 -19
  169. package/dist/workspace/spaces/space-view.js +3 -2
  170. package/package.json +3 -3
  171. package/skills/kortix-ui/references/modules.md +1 -1
  172. package/dist/session/tool/tools/multi-agent-tool-data.d.ts +0 -63
  173. package/dist/session/tool/tools/multi-agent-tool-data.js +0 -118
@@ -2,13 +2,14 @@
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 { ArrowSquareOut, BrowserIcon, ChatCircleIcon, FileTextIcon, X } from '@phosphor-icons/react';
5
+ import { ArrowSquareOutIcon, BrowserIcon, ChatCircleIcon, FileTextIcon, XIcon } from '@phosphor-icons/react';
6
6
  import { useEffect, useState } from 'react';
7
7
  import { useTranslations } from '../i18n/index.js';
8
8
  import { useLocalizedUiCatalog } from '../i18n/ui-catalog/use-localized-ui-catalog.js';
9
9
  import { Button } from '../primitives/button.js';
10
10
  import { CountBadge } from '../primitives/count-badge.js';
11
11
  import Hint from '../primitives/hint.js';
12
+ import { Skeleton } from '../primitives/skeleton.js';
12
13
  import { useUiComponents, useUiRouter } from '../providers/ui-provider.js';
13
14
  import { ArtifactFrame } from './artifact-frame.js';
14
15
  import { artifactFrameKey, parseArtifactUrl } from './frame-policy.js';
@@ -81,7 +82,7 @@ export function ShowArtifactCard({ url, fallback }) {
81
82
  const Icon = artifact ? TYPE_ICON[artifact.type] : FileTextIcon;
82
83
  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
84
  // 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?.title ?? ' ' }), _jsxs("span", { className: "text-muted-foreground flex items-center gap-1.5 text-xs", children: [_jsx("span", { children: artifact ? (artifact.type === 'doc' ? copy.doc : copy.page) : ' ' }), artifact?.openThreads ? (_jsx(CountBadge, { count: artifact.openThreads, tone: "waiting", icon: _jsx(ChatCircleIcon, { "aria-hidden": true }), role: "img", "aria-label": t('openComments', { count: artifact.openThreads }) })) : null] })] }), _jsx("span", { className: "text-muted-foreground group-hover:text-foreground shrink-0 text-xs font-medium transition-colors", children: copy.open })] })] }));
85
+ 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" })), _jsxs("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" })), artifact?.openThreads ? (_jsx(CountBadge, { count: artifact.openThreads, tone: "waiting", icon: _jsx(ChatCircleIcon, { "aria-hidden": true }), role: "img", "aria-label": t('openComments', { count: artifact.openThreads }) })) : null] })] }), _jsx("span", { className: "text-muted-foreground group-hover:text-foreground shrink-0 text-xs font-medium transition-colors", children: copy.open })] })] }));
85
86
  }
86
87
  /**
87
88
  * An artifact in the session panel: the page itself (a doc read as its page),
@@ -101,5 +102,5 @@ function ArtifactPagePreview({ url, onClose }) {
101
102
  const router = useUiRouter();
102
103
  const { artifact, failed } = useShownArtifact(url);
103
104
  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(ArrowSquareOut, { 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(X, { 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
+ 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
106
  }
@@ -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 ?? config.open_code_default_agent ?? null;
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 = (config.default_agent ?? config.open_code_default_agent) === agent.name;
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 = (config.default_agent ?? config.open_code_default_agent) === agent.name;
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 ?? config.open_code_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 ?? config.open_code_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: (config?.default_agent ?? config?.open_code_default_agent) === agent.name,
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 ?? config?.open_code_default_agent ?? null;
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 ?? config?.open_code_default_agent ?? null;
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 ?? config.open_code_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: string | null;
19
- open_code_default_agent: string | null;
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: "opencode" | "declarative";
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, pollConnectionOAuth2DeviceAuthorization, putConnectionOAuth2Application, reconcileMemberConnection, renameConnection, revokeConnection, setConnectorCredential, setDefaultConnection, startConnectionOAuth2Authorization, startConnectionOAuth2DeviceAuthorization, updateConnectionCredential, } from '@kortix/sdk';
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
- if (!device || !deviceConnectionId)
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
- let stopped = false;
815
- const poll = async () => {
816
- try {
817
- const status = await pollConnectionOAuth2DeviceAuthorization(projectId, deviceConnectionId, device.session_id);
818
- if (stopped || status.status === 'pending')
819
- return;
820
- stopped = true;
821
- if (status.status === 'active') {
822
- successToast(tI18nHardcoded.raw('i18nComplete.textc2a5f8398f12'));
823
- onSaved();
824
- onOpenChange(false);
825
- }
826
- else {
827
- errorToast(status.error_code || tI18nHardcoded.raw('i18nComplete.text911a1cde90bc'));
828
- }
829
- }
830
- catch (error) {
831
- if (!stopped)
832
- errorToast(error instanceof Error
833
- ? error.message
834
- : tI18nHardcoded.raw('i18nComplete.textfa23c868781d'));
835
- }
836
- };
837
- void poll();
838
- const timer = window.setInterval(() => void poll(), device.interval_seconds * 1000);
839
- const expiryTimer = window.setTimeout(() => {
840
- stopped = true;
841
- errorToast(tI18nHardcoded.raw('i18nComplete.text02c1d7b545ea'));
842
- }, Math.max(0, new Date(device.expires_at).getTime() - Date.now()));
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, useRef, useState } from 'react';
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
- const cancelledRef = useRef(false);
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
- cancelledRef.current = true;
89
- };
90
- }, []);
89
+ return () => runs.cancel();
90
+ }, [runs]);
91
91
  const reset = useCallback(() => {
92
- cancelledRef.current = true;
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
- cancelledRef.current = false;
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 (cancelledRef.current) {
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 (!cancelledRef.current)
144
+ if (!isCancelled())
142
145
  await claudeConnected();
143
146
  }
144
147
  catch (err) {
145
- if (cancelledRef.current)
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
- cancelledRef.current = false;
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: () => cancelledRef.current,
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
+ }
@@ -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. The API answers the
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. The API answers the
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) {
@@ -29,6 +29,7 @@ import { mapApiReviewItem } from '../../../workspace/review/map.js';
29
29
  import { connectorCallId, crChangeRequestId, isApprovalExpiredError, itemDeepLink, } from '../../../workspace/review/review-actions.js';
30
30
  import { AskDeck } from '../../../session/prompts/ask-deck.js';
31
31
  import { ReviewCenter } from '../../../workspace/review/review-center.js';
32
+ import { REVIEW_VERDICT_ANNOUNCED } from '../../../workspace/review/review-reducer.js';
32
33
  /**
33
34
  * How many session deep links the inbox warms up front. A page holds up to 50
34
35
  * items, and each prefetch is a real dynamic RSC render. Eight covers the rows
@@ -137,15 +138,28 @@ export function ReviewCenterConnected({ projectName }) {
137
138
  conflicts,
138
139
  }, closeCustomize);
139
140
  }
141
+ // Each branch resolves when the server accepted the verdict and rejects when
142
+ // it refused, so the inbox can roll its optimistic status back. A branch
143
+ // that shows its own success toast resolves `REVIEW_VERDICT_ANNOUNCED`.
140
144
  function handleAct(id, verdict, feedback) {
145
+ return new Promise((settle, refuse) => {
146
+ actOnItem(id, verdict, feedback, () => settle(REVIEW_VERDICT_ANNOUNCED), () => settle(undefined), refuse);
147
+ });
148
+ }
149
+ function actOnItem(id, verdict, feedback, announced, accepted, refused) {
141
150
  // The shared parameter-review component calls this for one exact action.
142
151
  const executionId = connectorCallId(id);
143
152
  if (executionId) {
144
153
  resolve.mutate({ executionId, decision: verdict === 'approve' ? 'approve' : 'deny', note: feedback }, {
145
- onSuccess: () => verdict === 'approve'
146
- ? successToast(tI18nComplete.raw('text2b2b0a697042'))
147
- : infoToast(tI18nComplete.raw('textda404deb110f')),
154
+ onSuccess: () => {
155
+ if (verdict === 'approve')
156
+ successToast(tI18nComplete.raw('text2b2b0a697042'));
157
+ else
158
+ infoToast(tI18nComplete.raw('textda404deb110f'));
159
+ announced();
160
+ },
148
161
  onError: (e) => {
162
+ refused(e);
149
163
  if (!isApprovalExpiredError(e))
150
164
  return errorToast(e.message);
151
165
  errorToast(tHardcodedUi('approvalPage.expiredHint'));
@@ -163,8 +177,10 @@ export function ReviewCenterConnected({ projectName }) {
163
177
  onSuccess: () => {
164
178
  successToast(tI18nComplete.raw('text0cad31cba248'));
165
179
  refreshInbox();
180
+ announced();
166
181
  },
167
182
  onError: (e) => {
183
+ refused(e);
168
184
  if (e.code === 'MERGE_CONFLICT') {
169
185
  const item = items.find((candidate) => candidate.id === id);
170
186
  const conflicts = e.data?.conflicts ?? [];
@@ -192,8 +208,12 @@ export function ReviewCenterConnected({ projectName }) {
192
208
  onSuccess: () => {
193
209
  infoToast(tI18nComplete.raw('text67382c89fdde'));
194
210
  refreshInbox();
211
+ announced();
212
+ },
213
+ onError: (e) => {
214
+ refused(e);
215
+ errorToast(e.message);
195
216
  },
196
- onError: (e) => errorToast(e.message),
197
217
  });
198
218
  }
199
219
  else {
@@ -203,6 +223,7 @@ export function ReviewCenterConnected({ projectName }) {
203
223
  const note = (feedback ?? '').trim();
204
224
  if (!note) {
205
225
  infoToast(tI18nComplete.raw('text8918eace1b87'));
226
+ refused(new Error('A change request needs a note.'));
206
227
  return;
207
228
  }
208
229
  requestChanges.mutate({ crId, feedback: note }, {
@@ -211,13 +232,23 @@ export function ReviewCenterConnected({ projectName }) {
211
232
  ? tI18nComplete.raw('text99764404a562')
212
233
  : tI18nComplete.raw('text871f77182091'));
213
234
  refreshInbox();
235
+ announced();
236
+ },
237
+ onError: (e) => {
238
+ refused(e);
239
+ errorToast(e.message);
214
240
  },
215
- onError: (e) => errorToast(e.message),
216
241
  });
217
242
  }
218
243
  return;
219
244
  }
220
- act.mutate({ id, verdict, feedback }, { onError: (e) => errorToast(e.message) });
245
+ act.mutate({ id, verdict, feedback }, {
246
+ onSuccess: accepted,
247
+ onError: (e) => {
248
+ refused(e);
249
+ errorToast(e.message);
250
+ },
251
+ });
221
252
  }
222
253
  // Bulk verdicts send every id the inbox chose: native, and `call:` for
223
254
  // Approve and Deny. The server decides each one and answers one result per
@@ -250,8 +250,6 @@ export declare function missingAgentGrantNotice(identifier: string, tI18nComplet
250
250
  export type AgentGrantConfig = {
251
251
  agent_discovery?: string | null;
252
252
  default_agent?: string | null;
253
- /** @deprecated Server alias for `default_agent`. */
254
- open_code_default_agent?: string | null;
255
253
  agents?: readonly {
256
254
  name: string;
257
255
  scope?: {
@@ -285,9 +283,10 @@ export type AgentGrantPlan = {
285
283
  *
286
284
  * `agent_discovery` is the server's own verdict on whether the manifest
287
285
  * declares any agent (apps/api/src/projects/git/config.ts `resolveConfigAgents`)
288
- * — `declarative` means it does, `opencode` means it declares none. Anything
289
- * else is a config we cannot read, and an unread config confirms rather than
290
- * guesses: a missed confirmation silently revokes working runtime secrets.
286
+ * — `declarative` means it does. Anything else (`null` in a response filtered
287
+ * by the caller's access) is a config we cannot read, and an unread config
288
+ * confirms rather than guesses: a missed confirmation silently revokes working
289
+ * runtime secrets.
291
290
  */
292
291
  export declare function agentGrantPlan(config: AgentGrantConfig | null | undefined, identifier: string): AgentGrantPlan;
293
292
  /**
@@ -425,9 +425,10 @@ function admitsIdentifier(list, identifier) {
425
425
  *
426
426
  * `agent_discovery` is the server's own verdict on whether the manifest
427
427
  * declares any agent (apps/api/src/projects/git/config.ts `resolveConfigAgents`)
428
- * — `declarative` means it does, `opencode` means it declares none. Anything
429
- * else is a config we cannot read, and an unread config confirms rather than
430
- * guesses: a missed confirmation silently revokes working runtime secrets.
428
+ * — `declarative` means it does. Anything else (`null` in a response filtered
429
+ * by the caller's access) is a config we cannot read, and an unread config
430
+ * confirms rather than guesses: a missed confirmation silently revokes working
431
+ * runtime secrets.
431
432
  */
432
433
  export function agentGrantPlan(config, identifier) {
433
434
  const declared = [];
@@ -442,7 +443,7 @@ export function agentGrantPlan(config, identifier) {
442
443
  currentSecrets: env === 'all' ? 'all' : Array.isArray(env) ? env : null,
443
444
  });
444
445
  }
445
- const defaultAgent = (config?.default_agent ?? config?.open_code_default_agent ?? '').trim();
446
+ const defaultAgent = (config?.default_agent ?? '').trim();
446
447
  // A project can carry a default agent that no manifest entry declares — the
447
448
  // endpoint upserts the entry, so it is still a valid target.
448
449
  const candidates = declared.length > 0 || !defaultAgent
@@ -46,4 +46,10 @@ export declare function inRunRange(run: Pick<ProjectTriggerRun, 'started_at'>, r
46
46
  } | null): boolean;
47
47
  /** The source a trigger's own runs come from; a row names any other one (manual, replay, reminder). */
48
48
  export declare function isDefaultSource(triggerType: ProjectTriggerType, source: ProjectTriggerRun['source']): boolean;
49
+ /** The App event a run fired on (an App event trigger), from its payload: name, the App's own id, the App. Null for any other run. */
50
+ export declare function appEventOf(payload: Record<string, unknown>): {
51
+ name: string;
52
+ id: string | null;
53
+ app: string;
54
+ } | null;
49
55
  export {};
@@ -88,3 +88,16 @@ export function inRunRange(run, range) {
88
88
  export function isDefaultSource(triggerType, source) {
89
89
  return source === triggerType;
90
90
  }
91
+ /** The App event a run fired on (an App event trigger), from its payload: name, the App's own id, the App. Null for any other run. */
92
+ export function appEventOf(payload) {
93
+ const event = payload.event;
94
+ const app = payload.app;
95
+ if (!event || typeof event !== 'object' || !app || typeof app !== 'object')
96
+ return null;
97
+ const name = event.name;
98
+ const slug = app.slug;
99
+ if (typeof name !== 'string' || !name || typeof slug !== 'string' || !slug)
100
+ return null;
101
+ const id = event.id;
102
+ return { name, id: typeof id === 'string' && id ? id : null, app: slug };
103
+ }