@agent-native/core 0.167.1 → 0.168.0

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 (117) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/templates/analytics/.agents/skills/agent-native-docs/SKILL.md +11 -0
  3. package/corpus/templates/assets/.agents/skills/agent-native-docs/SKILL.md +11 -0
  4. package/corpus/templates/brain/.agents/skills/agent-native-docs/SKILL.md +11 -0
  5. package/corpus/templates/brain/actions/list-sources.ts +17 -7
  6. package/corpus/templates/brain/app/components/brain/Surface.tsx +4 -2
  7. package/corpus/templates/brain/app/lib/brain.ts +13 -3
  8. package/corpus/templates/brain/server/lib/brain-health.ts +5 -8
  9. package/corpus/templates/brain/server/lib/brain.ts +1 -0
  10. package/corpus/templates/brain/server/lib/capture-sanitization.ts +5 -0
  11. package/corpus/templates/brain/server/routes/api/brain/queue/run.post.ts +3 -2
  12. package/corpus/templates/calendar/.agents/skills/agent-native-docs/SKILL.md +11 -0
  13. package/corpus/templates/chat/.agents/skills/agent-native-docs/SKILL.md +11 -0
  14. package/corpus/templates/clips/.agents/skills/agent-native-docs/SKILL.md +11 -0
  15. package/corpus/templates/clips/app/routes/download.tsx +78 -131
  16. package/corpus/templates/clips/desktop/src/app.tsx +11 -10
  17. package/corpus/templates/clips/desktop/src/lib/desktop-oauth-window.ts +23 -0
  18. package/corpus/templates/content/.agents/skills/agent-native-docs/SKILL.md +11 -0
  19. package/corpus/templates/crm/.agents/skills/agent-native-docs/SKILL.md +11 -0
  20. package/corpus/templates/design/.agents/skills/agent-native-docs/SKILL.md +11 -0
  21. package/corpus/templates/dispatch/.agents/skills/agent-native-docs/SKILL.md +11 -0
  22. package/corpus/templates/factory/.agents/skills/agent-native-docs/SKILL.md +11 -0
  23. package/corpus/templates/forms/.agents/skills/agent-native-docs/SKILL.md +11 -0
  24. package/corpus/templates/macros/.agents/skills/agent-native-docs/SKILL.md +11 -0
  25. package/corpus/templates/mail/.agents/skills/agent-native-docs/SKILL.md +11 -0
  26. package/corpus/templates/plan/.agents/skills/agent-native-docs/SKILL.md +11 -0
  27. package/corpus/templates/slides/.agents/skills/agent-native-docs/SKILL.md +11 -0
  28. package/corpus/templates/tasks/.agents/skills/agent-native-docs/SKILL.md +11 -0
  29. package/dist/chat-threads/store.d.ts +7 -0
  30. package/dist/chat-threads/store.js +15 -0
  31. package/dist/client/AboutAgentNativeDialog.d.ts +5 -0
  32. package/dist/client/AboutAgentNativeDialog.js +56 -0
  33. package/dist/client/AgentPanel.d.ts +5 -1
  34. package/dist/client/AgentPanel.js +8 -8
  35. package/dist/client/AssistantChat.d.ts +3 -1
  36. package/dist/client/AssistantChat.js +22 -6
  37. package/dist/client/CommandMenu.d.ts +6 -1
  38. package/dist/client/CommandMenu.js +46 -3
  39. package/dist/client/EnvironmentBadge.js +4 -1
  40. package/dist/client/MultiTabAssistantChat.d.ts +3 -1
  41. package/dist/client/MultiTabAssistantChat.js +5 -4
  42. package/dist/client/agent-native-version.d.ts +12 -0
  43. package/dist/client/agent-native-version.js +36 -0
  44. package/dist/client/agent-page/AgentJobsTab.js +39 -6
  45. package/dist/client/agent-page/AutomationScheduleDialog.d.ts +10 -1
  46. package/dist/client/agent-page/AutomationScheduleDialog.js +3 -2
  47. package/dist/client/agent-page/ScheduledTriggerNotice.d.ts +22 -0
  48. package/dist/client/agent-page/ScheduledTriggerNotice.js +84 -0
  49. package/dist/client/agent-page/scheduled-trigger-state.d.ts +28 -0
  50. package/dist/client/agent-page/scheduled-trigger-state.js +10 -0
  51. package/dist/client/agent-page/use-jobs.d.ts +7 -0
  52. package/dist/client/agent-page/use-jobs.js +14 -0
  53. package/dist/client/blocks/library/diagram.config.d.ts +4 -1
  54. package/dist/client/blocks/library/diagram.js +1 -1
  55. package/dist/client/chat/run-recovery.js +15 -7
  56. package/dist/client/use-chat-threads.d.ts +7 -0
  57. package/dist/client/use-chat-threads.js +144 -40
  58. package/dist/collab/routes.d.ts +1 -1
  59. package/dist/config.d.ts +3 -1
  60. package/dist/config.js +14 -9
  61. package/dist/deploy/build.d.ts +5 -0
  62. package/dist/deploy/build.js +12 -1
  63. package/dist/framework-tools.js +1 -0
  64. package/dist/jobs/actions/get-scheduled-trigger-status.d.ts +13 -0
  65. package/dist/jobs/actions/get-scheduled-trigger-status.js +21 -0
  66. package/dist/localization/core-messages/ar-SA.js +6 -0
  67. package/dist/localization/core-messages/de-DE.js +6 -0
  68. package/dist/localization/core-messages/en-US.d.ts +6 -0
  69. package/dist/localization/core-messages/en-US.js +6 -0
  70. package/dist/localization/core-messages/es-ES.js +6 -0
  71. package/dist/localization/core-messages/fr-FR.js +6 -0
  72. package/dist/localization/core-messages/hi-IN.js +6 -0
  73. package/dist/localization/core-messages/ja-JP.js +6 -0
  74. package/dist/localization/core-messages/ko-KR.js +6 -0
  75. package/dist/localization/core-messages/pt-BR.js +6 -0
  76. package/dist/localization/core-messages/zh-CN.js +6 -0
  77. package/dist/localization/core-messages/zh-TW.js +6 -0
  78. package/dist/localization/core-messages.d.ts +6 -0
  79. package/dist/localization/default-messages.d.ts +14 -0
  80. package/dist/localization/default-messages.js +14 -0
  81. package/dist/mcp/screen-memory-stdio.d.ts +7 -7
  82. package/dist/notifications/routes.d.ts +1 -1
  83. package/dist/observability/routes.d.ts +3 -3
  84. package/dist/provider-api/actions/custom-provider-registration.d.ts +1 -1
  85. package/dist/provider-api/actions/provider-api.d.ts +12 -12
  86. package/dist/resources/handlers.d.ts +2 -2
  87. package/dist/server/action-discovery.js +4 -0
  88. package/dist/server/agent-chat/recurring-jobs-runtime.d.ts +42 -1
  89. package/dist/server/agent-chat/recurring-jobs-runtime.js +102 -9
  90. package/dist/server/agent-chat-plugin.d.ts +3 -1
  91. package/dist/server/agent-chat-plugin.js +115 -24
  92. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  93. package/dist/server/attribution.d.ts +29 -0
  94. package/dist/server/attribution.js +68 -0
  95. package/dist/server/auth.js +58 -15
  96. package/dist/server/better-auth-instance.js +16 -4
  97. package/dist/server/identity-sso.js +14 -2
  98. package/dist/server/realtime-token.d.ts +1 -1
  99. package/dist/server/request-context.d.ts +8 -0
  100. package/dist/server/request-context.js +4 -0
  101. package/dist/templates/chat/.agents/skills/agent-native-docs/SKILL.md +11 -0
  102. package/dist/templates/default/.agents/skills/agent-native-docs/SKILL.md +11 -0
  103. package/dist/templates/headless/.agents/skills/agent-native-docs/SKILL.md +11 -0
  104. package/dist/templates/workspace-core/.agents/skills/agent-native-docs/SKILL.md +11 -0
  105. package/dist/vite/agent-native-config-loader.js +1 -1
  106. package/dist/vite/client.js +19 -8
  107. package/dist/vite/package-versions.d.ts +1 -0
  108. package/dist/vite/package-versions.js +97 -0
  109. package/docs/content/agent-native-config.mdx +55 -31
  110. package/docs/content/deployment.mdx +3 -1
  111. package/docs/content/environment-variables.mdx +51 -14
  112. package/docs/content/recurring-jobs.mdx +6 -0
  113. package/package.json +2 -2
  114. package/src/templates/chat/.agents/skills/agent-native-docs/SKILL.md +11 -0
  115. package/src/templates/default/.agents/skills/agent-native-docs/SKILL.md +11 -0
  116. package/src/templates/headless/.agents/skills/agent-native-docs/SKILL.md +11 -0
  117. package/src/templates/workspace-core/.agents/skills/agent-native-docs/SKILL.md +11 -0
@@ -134,3 +134,14 @@ hand-duplicating framework logic.
134
134
  `agent-surfaces`.
135
135
  - Do not copy framework runtime internals when a public API or narrow UI copy
136
136
  will do; read `customizing-agent-native` for the supported override ladder.
137
+
138
+ ## Authoring visual docs blocks
139
+
140
+ Treat the shared `Diagram` block as a renderer, not as a reason to style every
141
+ docs UI as a sketch. Use the hand-drawn font and Rough.js only for actual
142
+ diagrams or wireframes that communicate structure, flow, or a design draft.
143
+ For polished UI-like content - cards, logo walls, tables, controls, or product
144
+ shells — set `renderMode="design"` (and usually `frame="hide"` when the block
145
+ is the content itself). Design mode preserves normal docs typography and
146
+ disables the Rough.js overlay. Keep `data-rough` only on elements intentionally
147
+ sketched inside a real diagram.
@@ -134,3 +134,14 @@ hand-duplicating framework logic.
134
134
  `agent-surfaces`.
135
135
  - Do not copy framework runtime internals when a public API or narrow UI copy
136
136
  will do; read `customizing-agent-native` for the supported override ladder.
137
+
138
+ ## Authoring visual docs blocks
139
+
140
+ Treat the shared `Diagram` block as a renderer, not as a reason to style every
141
+ docs UI as a sketch. Use the hand-drawn font and Rough.js only for actual
142
+ diagrams or wireframes that communicate structure, flow, or a design draft.
143
+ For polished UI-like content - cards, logo walls, tables, controls, or product
144
+ shells — set `renderMode="design"` (and usually `frame="hide"` when the block
145
+ is the content itself). Design mode preserves normal docs typography and
146
+ disables the Rough.js overlay. Keep `data-rough` only on elements intentionally
147
+ sketched inside a real diagram.
@@ -134,3 +134,14 @@ hand-duplicating framework logic.
134
134
  `agent-surfaces`.
135
135
  - Do not copy framework runtime internals when a public API or narrow UI copy
136
136
  will do; read `customizing-agent-native` for the supported override ladder.
137
+
138
+ ## Authoring visual docs blocks
139
+
140
+ Treat the shared `Diagram` block as a renderer, not as a reason to style every
141
+ docs UI as a sketch. Use the hand-drawn font and Rough.js only for actual
142
+ diagrams or wireframes that communicate structure, flow, or a design draft.
143
+ For polished UI-like content - cards, logo walls, tables, controls, or product
144
+ shells — set `renderMode="design"` (and usually `frame="hide"` when the block
145
+ is the content itself). Design mode preserves normal docs typography and
146
+ disables the Rough.js overlay. Keep `data-rough` only on elements intentionally
147
+ sketched inside a real diagram.
@@ -134,3 +134,14 @@ hand-duplicating framework logic.
134
134
  `agent-surfaces`.
135
135
  - Do not copy framework runtime internals when a public API or narrow UI copy
136
136
  will do; read `customizing-agent-native` for the supported override ladder.
137
+
138
+ ## Authoring visual docs blocks
139
+
140
+ Treat the shared `Diagram` block as a renderer, not as a reason to style every
141
+ docs UI as a sketch. Use the hand-drawn font and Rough.js only for actual
142
+ diagrams or wireframes that communicate structure, flow, or a design draft.
143
+ For polished UI-like content - cards, logo walls, tables, controls, or product
144
+ shells — set `renderMode="design"` (and usually `frame="hide"` when the block
145
+ is the content itself). Design mode preserves normal docs typography and
146
+ disables the Rough.js overlay. Keep `data-rough` only on elements intentionally
147
+ sketched inside a real diagram.
@@ -134,3 +134,14 @@ hand-duplicating framework logic.
134
134
  `agent-surfaces`.
135
135
  - Do not copy framework runtime internals when a public API or narrow UI copy
136
136
  will do; read `customizing-agent-native` for the supported override ladder.
137
+
138
+ ## Authoring visual docs blocks
139
+
140
+ Treat the shared `Diagram` block as a renderer, not as a reason to style every
141
+ docs UI as a sketch. Use the hand-drawn font and Rough.js only for actual
142
+ diagrams or wireframes that communicate structure, flow, or a design draft.
143
+ For polished UI-like content - cards, logo walls, tables, controls, or product
144
+ shells — set `renderMode="design"` (and usually `frame="hide"` when the block
145
+ is the content itself). Design mode preserves normal docs typography and
146
+ disables the Rough.js overlay. Keep `data-rough` only on elements intentionally
147
+ sketched inside a real diagram.
@@ -134,3 +134,14 @@ hand-duplicating framework logic.
134
134
  `agent-surfaces`.
135
135
  - Do not copy framework runtime internals when a public API or narrow UI copy
136
136
  will do; read `customizing-agent-native` for the supported override ladder.
137
+
138
+ ## Authoring visual docs blocks
139
+
140
+ Treat the shared `Diagram` block as a renderer, not as a reason to style every
141
+ docs UI as a sketch. Use the hand-drawn font and Rough.js only for actual
142
+ diagrams or wireframes that communicate structure, flow, or a design draft.
143
+ For polished UI-like content - cards, logo walls, tables, controls, or product
144
+ shells — set `renderMode="design"` (and usually `frame="hide"` when the block
145
+ is the content itself). Design mode preserves normal docs typography and
146
+ disables the Rough.js overlay. Keep `data-rough` only on elements intentionally
147
+ sketched inside a real diagram.
@@ -134,3 +134,14 @@ hand-duplicating framework logic.
134
134
  `agent-surfaces`.
135
135
  - Do not copy framework runtime internals when a public API or narrow UI copy
136
136
  will do; read `customizing-agent-native` for the supported override ladder.
137
+
138
+ ## Authoring visual docs blocks
139
+
140
+ Treat the shared `Diagram` block as a renderer, not as a reason to style every
141
+ docs UI as a sketch. Use the hand-drawn font and Rough.js only for actual
142
+ diagrams or wireframes that communicate structure, flow, or a design draft.
143
+ For polished UI-like content - cards, logo walls, tables, controls, or product
144
+ shells — set `renderMode="design"` (and usually `frame="hide"` when the block
145
+ is the content itself). Design mode preserves normal docs typography and
146
+ disables the Rough.js overlay. Keep `data-rough` only on elements intentionally
147
+ sketched inside a real diagram.
@@ -134,3 +134,14 @@ hand-duplicating framework logic.
134
134
  `agent-surfaces`.
135
135
  - Do not copy framework runtime internals when a public API or narrow UI copy
136
136
  will do; read `customizing-agent-native` for the supported override ladder.
137
+
138
+ ## Authoring visual docs blocks
139
+
140
+ Treat the shared `Diagram` block as a renderer, not as a reason to style every
141
+ docs UI as a sketch. Use the hand-drawn font and Rough.js only for actual
142
+ diagrams or wireframes that communicate structure, flow, or a design draft.
143
+ For polished UI-like content - cards, logo walls, tables, controls, or product
144
+ shells — set `renderMode="design"` (and usually `frame="hide"` when the block
145
+ is the content itself). Design mode preserves normal docs typography and
146
+ disables the Rough.js overlay. Keep `data-rough` only on elements intentionally
147
+ sketched inside a real diagram.
@@ -134,3 +134,14 @@ hand-duplicating framework logic.
134
134
  `agent-surfaces`.
135
135
  - Do not copy framework runtime internals when a public API or narrow UI copy
136
136
  will do; read `customizing-agent-native` for the supported override ladder.
137
+
138
+ ## Authoring visual docs blocks
139
+
140
+ Treat the shared `Diagram` block as a renderer, not as a reason to style every
141
+ docs UI as a sketch. Use the hand-drawn font and Rough.js only for actual
142
+ diagrams or wireframes that communicate structure, flow, or a design draft.
143
+ For polished UI-like content - cards, logo walls, tables, controls, or product
144
+ shells — set `renderMode="design"` (and usually `frame="hide"` when the block
145
+ is the content itself). Design mode preserves normal docs typography and
146
+ disables the Rough.js overlay. Keep `data-rough` only on elements intentionally
147
+ sketched inside a real diagram.
@@ -134,3 +134,14 @@ hand-duplicating framework logic.
134
134
  `agent-surfaces`.
135
135
  - Do not copy framework runtime internals when a public API or narrow UI copy
136
136
  will do; read `customizing-agent-native` for the supported override ladder.
137
+
138
+ ## Authoring visual docs blocks
139
+
140
+ Treat the shared `Diagram` block as a renderer, not as a reason to style every
141
+ docs UI as a sketch. Use the hand-drawn font and Rough.js only for actual
142
+ diagrams or wireframes that communicate structure, flow, or a design draft.
143
+ For polished UI-like content - cards, logo walls, tables, controls, or product
144
+ shells — set `renderMode="design"` (and usually `frame="hide"` when the block
145
+ is the content itself). Design mode preserves normal docs typography and
146
+ disables the Rough.js overlay. Keep `data-rough` only on elements intentionally
147
+ sketched inside a real diagram.
@@ -26,6 +26,13 @@ export interface ChatThreadScope {
26
26
  id: string;
27
27
  label?: string;
28
28
  }
29
+ export declare function isAppOwnedChatScope(scope?: ChatThreadScope | null): boolean;
30
+ /**
31
+ * A scoped rail may claim a legacy unscoped thread on its first write, but
32
+ * once a thread has a scope, a non-null incoming scope must match it. App-
33
+ * owned threads additionally require a scope on every subsequent write.
34
+ */
35
+ export declare function threadScopeMismatch(existing?: ChatThreadScope | null, incoming?: ChatThreadScope | null): boolean;
29
36
  export interface ChatThreadSource {
30
37
  platform?: string | null;
31
38
  appId?: string | null;
@@ -241,6 +241,21 @@ export async function repairLegacyChatThreadMessageCounts(options = {}) {
241
241
  function generateId() {
242
242
  return `thread-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
243
243
  }
244
+ export function isAppOwnedChatScope(scope) {
245
+ return scope?.type === "workspace-app" || scope?.type === "desktop-app";
246
+ }
247
+ /**
248
+ * A scoped rail may claim a legacy unscoped thread on its first write, but
249
+ * once a thread has a scope, a non-null incoming scope must match it. App-
250
+ * owned threads additionally require a scope on every subsequent write.
251
+ */
252
+ export function threadScopeMismatch(existing, incoming) {
253
+ if (!existing)
254
+ return false;
255
+ if (!incoming)
256
+ return isAppOwnedChatScope(existing);
257
+ return existing.type !== incoming.type || existing.id !== incoming.id;
258
+ }
244
259
  function readScope(r) {
245
260
  const type = r.scope_type;
246
261
  const id = r.scope_id;
@@ -0,0 +1,5 @@
1
+ export interface AboutAgentNativeDialogProps {
2
+ open: boolean;
3
+ onOpenChange: (open: boolean) => void;
4
+ }
5
+ export declare function AboutAgentNativeDialog({ open, onOpenChange, }: AboutAgentNativeDialogProps): import("react").JSX.Element;
@@ -0,0 +1,56 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button } from "@agent-native/toolkit/ui/button";
3
+ import { IconCheck, IconCode, IconCopy, IconX } from "@tabler/icons-react";
4
+ import { useEffect, useMemo, useRef, useState } from "react";
5
+ import { formatAgentNativeDiagnostics, getAgentNativeDiagnostics, getAgentNativePackageVersions, } from "./agent-native-version.js";
6
+ import { writeClipboardText } from "./clipboard.js";
7
+ import { Dialog, DialogContent, DialogTitle } from "./components/ui/dialog.js";
8
+ import { useT } from "./i18n.js";
9
+ export function AboutAgentNativeDialog({ open, onOpenChange, }) {
10
+ const t = useT();
11
+ const [copyState, setCopyState] = useState("idle");
12
+ const copyResetTimer = useRef(null);
13
+ const packageVersions = getAgentNativePackageVersions();
14
+ const diagnostics = useMemo(() => formatAgentNativeDiagnostics(), []);
15
+ const { buildId, environment } = getAgentNativeDiagnostics();
16
+ useEffect(() => {
17
+ if (!open) {
18
+ setCopyState("idle");
19
+ }
20
+ }, [open]);
21
+ useEffect(() => () => {
22
+ if (copyResetTimer.current !== null) {
23
+ window.clearTimeout(copyResetTimer.current);
24
+ }
25
+ }, []);
26
+ const handleCopy = async () => {
27
+ const didCopy = await writeClipboardText(diagnostics);
28
+ setCopyState(didCopy ? "copied" : "failed");
29
+ if (copyResetTimer.current !== null) {
30
+ window.clearTimeout(copyResetTimer.current);
31
+ }
32
+ copyResetTimer.current = window.setTimeout(() => {
33
+ setCopyState("idle");
34
+ copyResetTimer.current = null;
35
+ }, 1600);
36
+ };
37
+ return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { "aria-describedby": undefined, className: "max-w-md gap-5", children: [_jsxs(DialogTitle, { className: "flex items-center gap-2 text-base", children: [_jsx(IconCode, { className: "size-4 text-muted-foreground" }), t("agentChat.aboutAgentNative.title", {
38
+ defaultValue: "About Agent Native",
39
+ })] }), _jsx("div", { className: "overflow-hidden rounded-md border border-border", children: packageVersions.length > 0 ? (packageVersions.map(({ name, version }) => (_jsxs("div", { className: "flex items-center justify-between gap-4 border-b border-border px-3 py-2 last:border-b-0", children: [_jsx("span", { className: "min-w-0 truncate font-mono text-xs text-foreground", children: name }), _jsxs("span", { className: "shrink-0 font-mono text-xs text-muted-foreground", children: [_jsx("span", { className: "sr-only", children: t("agentChat.aboutAgentNative.version", {
40
+ defaultValue: "Version",
41
+ }) }), version] })] }, name)))) : (_jsxs("div", { className: "px-3 py-2 font-mono text-xs text-muted-foreground", children: ["@agent-native/core -", " ", t("agentChat.aboutAgentNative.unknown", {
42
+ defaultValue: "Unknown",
43
+ })] })) }), _jsxs("dl", { className: "grid gap-2 text-xs", children: [_jsxs("div", { className: "flex items-center justify-between gap-4", children: [_jsx("dt", { className: "text-muted-foreground", children: t("agentChat.aboutAgentNative.environment", {
44
+ defaultValue: "Environment",
45
+ }) }), _jsx("dd", { className: "font-mono text-foreground", children: environment })] }), _jsxs("div", { className: "flex items-center justify-between gap-4", children: [_jsx("dt", { className: "text-muted-foreground", children: t("agentChat.aboutAgentNative.build", {
46
+ defaultValue: "Build",
47
+ }) }), _jsx("dd", { className: "max-w-[16rem] truncate font-mono text-foreground", children: buildId })] })] }), _jsxs(Button, { className: "w-full", onClick: () => void handleCopy(), type: "button", variant: "outline", children: [copyState === "copied" ? (_jsx(IconCheck, {})) : copyState === "failed" ? (_jsx(IconX, {})) : (_jsx(IconCopy, {})), copyState === "copied"
48
+ ? t("agentChat.common.copied", { defaultValue: "Copied" })
49
+ : copyState === "failed"
50
+ ? t("agentChat.recovery.copyFailed", {
51
+ defaultValue: "Copy failed",
52
+ })
53
+ : t("agentChat.aboutAgentNative.copyDiagnostics", {
54
+ defaultValue: "Copy diagnostics",
55
+ })] })] }) }));
56
+ }
@@ -107,6 +107,8 @@ export interface AgentPanelProps extends Omit<AssistantChatProps, "onSwitchToCli
107
107
  restoreActiveThread?: boolean;
108
108
  /** Ambient resource context rendered as a composer chip. */
109
109
  scope?: import("./use-chat-threads.js").ChatThreadScope | null;
110
+ /** Keep app-owned chat history isolated to the supplied scope. */
111
+ isolateHistoryByScope?: boolean;
110
112
  /** @deprecated Scope context now appears inside the composer. */
111
113
  showScopeBadge?: MultiTabAssistantChatProps["showScopeBadge"];
112
114
  /** Stable browser tab id used for tab-scoped app-state context. */
@@ -239,6 +241,8 @@ export interface AgentSidebarProps {
239
241
  onFullscreenRequest?: () => void;
240
242
  /** Ambient resource context rendered as a composer chip. */
241
243
  scope?: import("./use-chat-threads.js").ChatThreadScope | null;
244
+ /** Keep app-owned chat history isolated to the supplied scope. */
245
+ isolateHistoryByScope?: boolean;
242
246
  /** @deprecated Scope context now appears inside the composer. */
243
247
  showScopeBadge?: MultiTabAssistantChatProps["showScopeBadge"];
244
248
  /** Stable browser tab id used for tab-scoped app-state context. */
@@ -254,7 +258,7 @@ export interface AgentSidebarProps {
254
258
  * Wraps app content with a toggleable agent sidebar.
255
259
  * Use AgentToggleButton in your header to open/close it.
256
260
  */
257
- export declare function AgentSidebar({ children, emptyStateText, suggestions, dynamicSuggestions, composerToolbarSlot, composerSlot, onComposerTextChange, imageModelMenu, availableAgents, availableModels, modelListLoading, selectedAgent, onAgentChange, onConnectLocalRuntime, runtime, adapterReloadKey, threadFooterSlot, defaultSidebarWidth, sidebarWidth, position, defaultOpen, animateMobile, animateDesktop, chatViewTransition, chatViewTransitionHandoff, storageKey, openStorageKey, apiUrl, agentChatSurface, desktopIdentityUnauthenticated, desktopIdentityAuthenticated, showTabBar, suppressInlineOpenApp, composerPlaceholder, openOnChatRunning, onFullscreenRequest, scope, showScopeBadge, browserTabId, threadUrlSync, agentPageHref, suppressFirstRunOnboarding, }: AgentSidebarProps): React.JSX.Element;
261
+ export declare function AgentSidebar({ children, emptyStateText, suggestions, dynamicSuggestions, composerToolbarSlot, composerSlot, onComposerTextChange, imageModelMenu, availableAgents, availableModels, modelListLoading, selectedAgent, onAgentChange, onConnectLocalRuntime, runtime, adapterReloadKey, threadFooterSlot, defaultSidebarWidth, sidebarWidth, position, defaultOpen, animateMobile, animateDesktop, chatViewTransition, chatViewTransitionHandoff, storageKey, openStorageKey, apiUrl, agentChatSurface, desktopIdentityUnauthenticated, desktopIdentityAuthenticated, showTabBar, suppressInlineOpenApp, composerPlaceholder, openOnChatRunning, onFullscreenRequest, scope, isolateHistoryByScope, showScopeBadge, browserTabId, threadUrlSync, agentPageHref, suppressFirstRunOnboarding, }: AgentSidebarProps): React.JSX.Element;
258
262
  /**
259
263
  * Focus the agent chat composer input.
260
264
  * Opens the sidebar if closed, then focuses the text input.
@@ -436,7 +436,7 @@ function CodeAccessUnavailablePanel({ title, description, ctaLabel, ctaHref, sec
436
436
  });
437
437
  }, className: "inline-flex items-center gap-1.5 rounded-md border border-border bg-background px-3 py-1.5 text-xs font-medium text-foreground hover:bg-accent", children: secondaryCtaLabel })] })] }));
438
438
  }
439
- function AgentPanelInner({ defaultMode = "chat", className, style, apiUrl, emptyStateText, emptyStateAddon, suggestions, dynamicSuggestions, showHeader = true, onCollapse, isFullscreen, onToggleFullscreen, onFullViewRequest, onSnapTo75Percent, isWideDrawer, onExitWideDrawer, devAppUrl, storageKey, restoreActiveThread = true, scope, showScopeBadge, browserTabId, threadUrlSync, chatNotice, showTabBar = true, showPageNewChatButton = false, allowSettingsMode = true, chatOnly = false, agentPageHref, codeAccess, ...assistantChatProps }) {
439
+ function AgentPanelInner({ defaultMode = "chat", className, style, apiUrl, emptyStateText, emptyStateAddon, suggestions, dynamicSuggestions, showHeader = true, onCollapse, isFullscreen, onToggleFullscreen, onFullViewRequest, onSnapTo75Percent, isWideDrawer, onExitWideDrawer, devAppUrl, storageKey, restoreActiveThread = true, scope, isolateHistoryByScope = false, showScopeBadge, browserTabId, threadUrlSync, chatNotice, showTabBar = true, showPageNewChatButton = false, allowSettingsMode = true, chatOnly = false, agentPageHref, codeAccess, ...assistantChatProps }) {
440
440
  const t = useT();
441
441
  const navigate = useNavigate();
442
442
  const location = useLocation();
@@ -838,7 +838,7 @@ function AgentPanelInner({ defaultMode = "chat", className, style, apiUrl, empty
838
838
  const isActive = tab.id === activeTabId ||
839
839
  (tab.id === focusParentId &&
840
840
  activeTab?.parentThreadId === tab.id);
841
- return (_jsxs("div", { role: "button", tabIndex: 0, ref: isActive ? activeTabRefCb : undefined, onClick: () => setActiveTabId(tab.id), onKeyDown: activateOnKeyDown(() => setActiveTabId(tab.id)), className: cn("agent-tab relative flex shrink-0 items-center gap-1 rounded-md px-2.5 py-1.5 text-[11px] font-medium cursor-pointer max-w-[150px]", isActive
841
+ return (_jsxs("div", { role: "button", tabIndex: 0, ref: isActive ? activeTabRefCb : undefined, onClick: () => setActiveTabId(tab.id), onKeyDown: activateOnKeyDown(() => setActiveTabId(tab.id)), className: cn("agent-tab relative flex shrink-0 items-center gap-1 rounded-md px-2.5 py-1.5 text-[11px] font-medium cursor-pointer min-w-[56px] max-w-[150px]", isActive
842
842
  ? "bg-accent text-foreground"
843
843
  : "text-muted-foreground hover:bg-accent hover:text-foreground"), children: [_jsx("span", { className: "truncate pe-1", children: tab.label }), tab.status === "running" && (_jsx("span", { className: "h-1.5 w-1.5 shrink-0 rounded-full bg-muted-foreground/50 animate-pulse" })), _jsx("button", { type: "button", "aria-label": t("agentPanel.closeTab"), onClick: (e) => {
844
844
  e.stopPropagation();
@@ -881,7 +881,7 @@ function AgentPanelInner({ defaultMode = "chat", className, style, apiUrl, empty
881
881
  const isActive = tab.id === activeTabId ||
882
882
  (tab.id === focusParentId &&
883
883
  activeTab?.parentThreadId === tab.id);
884
- return (_jsxs("div", { role: "button", tabIndex: 0, ref: isActive ? activeTabRefCb : undefined, onClick: () => setActiveTabId(tab.id), onKeyDown: activateOnKeyDown(() => setActiveTabId(tab.id)), className: cn("agent-tab relative flex shrink-0 items-center gap-1 rounded-md px-2.5 py-1.5 text-[11px] font-medium cursor-pointer max-w-[150px]", isActive
884
+ return (_jsxs("div", { role: "button", tabIndex: 0, ref: isActive ? activeTabRefCb : undefined, onClick: () => setActiveTabId(tab.id), onKeyDown: activateOnKeyDown(() => setActiveTabId(tab.id)), className: cn("agent-tab relative flex shrink-0 items-center gap-1 rounded-md px-2.5 py-1.5 text-[11px] font-medium cursor-pointer min-w-[56px] max-w-[150px]", isActive
885
885
  ? "bg-accent text-foreground"
886
886
  : "text-muted-foreground hover:bg-accent hover:text-foreground"), children: [_jsx("span", { className: "truncate pe-1", children: tab.label }), tab.status === "running" && (_jsx("span", { className: "h-1.5 w-1.5 shrink-0 rounded-full bg-muted-foreground/50 animate-pulse" })), _jsx("button", { type: "button", "aria-label": t("agentPanel.closeTab"), onClick: (e) => {
887
887
  e.stopPropagation();
@@ -899,7 +899,7 @@ function AgentPanelInner({ defaultMode = "chat", className, style, apiUrl, empty
899
899
  })
900
900
  : cliTabs.map((id, i) => (_jsxs("div", { role: "button", tabIndex: 0, ref: id === activeCliTab
901
901
  ? activeTabRefCb
902
- : undefined, onClick: () => setActiveCliTab(id), onKeyDown: activateOnKeyDown(() => setActiveCliTab(id)), className: cn("agent-tab relative flex shrink-0 items-center gap-1 rounded-md px-2.5 py-1.5 text-[11px] font-medium cursor-pointer", id === activeCliTab
902
+ : undefined, onClick: () => setActiveCliTab(id), onKeyDown: activateOnKeyDown(() => setActiveCliTab(id)), className: cn("agent-tab relative flex shrink-0 items-center gap-1 rounded-md px-2.5 py-1.5 text-[11px] font-medium cursor-pointer min-w-[56px]", id === activeCliTab
903
903
  ? "bg-accent text-foreground"
904
904
  : "text-muted-foreground hover:bg-accent hover:text-foreground"), children: [_jsxs("span", { children: ["Terminal ", i + 1] }), _jsx("button", { type: "button", "aria-label": t("agentPanel.closeTab"), onClick: (e) => {
905
905
  e.stopPropagation();
@@ -917,7 +917,7 @@ function AgentPanelInner({ defaultMode = "chat", className, style, apiUrl, empty
917
917
  ? "bg-accent text-foreground"
918
918
  : "text-muted-foreground hover:bg-accent hover:text-foreground"), children: "Main" }), childTabs.map((tab) => (_jsxs("div", { role: "button", tabIndex: 0, ref: tab.id === activeTabId
919
919
  ? activeTabRefCb
920
- : undefined, onClick: () => setActiveTabId(tab.id), onKeyDown: activateOnKeyDown(() => setActiveTabId(tab.id)), className: cn("agent-tab relative flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium cursor-pointer max-w-[140px]", tab.id === activeTabId
920
+ : undefined, onClick: () => setActiveTabId(tab.id), onKeyDown: activateOnKeyDown(() => setActiveTabId(tab.id)), className: cn("agent-tab relative flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium cursor-pointer min-w-[48px] max-w-[140px]", tab.id === activeTabId
921
921
  ? "bg-accent text-foreground"
922
922
  : "text-muted-foreground hover:bg-accent hover:text-foreground"), children: [_jsx("span", { className: "truncate pe-1", children: tab.subAgentName || tab.label }), tab.status === "running" && (_jsx("span", { className: "h-1 w-1 shrink-0 rounded-full bg-muted-foreground/50 animate-pulse" })), _jsx("button", { type: "button", "aria-label": t("agentPanel.closeTab"), onClick: (e) => {
923
923
  e.stopPropagation();
@@ -981,7 +981,7 @@ function AgentPanelInner({ defaultMode = "chat", className, style, apiUrl, empty
981
981
  `margin-left:auto;margin-right:auto;width:100%;}`,
982
982
  } }), SHOW_ONBOARDING && mounted && (_jsx(Suspense, { fallback: null, children: _jsx(OnboardingPanel, {}) })), showFirstRunOnboarding && mounted && !insideAgentSidebar && (_jsx(Suspense, { fallback: null, children: _jsx(FirstRunOnboarding, {}) })), _jsx("div", { className: cn("flex flex-col min-h-0", mode === "chat" ? "flex-1" : "shrink-0"), children: mounted && (_jsx(Suspense, { fallback: _jsx(ChatLoadingSkeleton, { renderHeader: showHeader ? renderChatHeader : undefined, centerComposerWhenEmpty: assistantChatProps.centerComposerWhenEmpty, composerSlot: assistantChatProps.composerSlot, composerAreaClassName: assistantChatProps.composerAreaClassName, composerLayoutVariant: assistantChatProps.composerLayoutVariant }), children: _jsx(MultiTabAssistantChatLazy, { ...assistantChatProps, agentChatSurface: effectiveAgentChatSurface, apiUrl: apiUrl, showHeader: false, renderHeader: showHeader ? renderChatHeader : undefined, showTabBar: showTabBar, renderOverlay: showPageNewChatButton && !showHeader
983
983
  ? renderPageChatOverlay
984
- : undefined, contentHidden: mode !== "chat", emptyStateText: emptyStateText, emptyStateAddon: emptyStateAddon, suggestions: suggestions, dynamicSuggestions: dynamicSuggestions, onSwitchToCli: () => switchMode("cli"), execMode: execMode, onExecModeChange: switchExecMode, storageKey: storageKey, restoreActiveThread: restoreActiveThread, scope: scope, showScopeBadge: showScopeBadge, browserTabId: browserTabId, threadUrlSync: threadUrlSync }) })) }), canUseCodeTools
984
+ : undefined, contentHidden: mode !== "chat", emptyStateText: emptyStateText, emptyStateAddon: emptyStateAddon, suggestions: suggestions, dynamicSuggestions: dynamicSuggestions, onSwitchToCli: () => switchMode("cli"), execMode: execMode, onExecModeChange: switchExecMode, storageKey: storageKey, restoreActiveThread: restoreActiveThread, scope: scope, isolateHistoryByScope: isolateHistoryByScope, showScopeBadge: showScopeBadge, browserTabId: browserTabId, threadUrlSync: threadUrlSync }) })) }), canUseCodeTools
985
985
  ? mode === "cli" &&
986
986
  cliTabs.map((id) => (_jsx("div", { className: "min-h-0 relative flex-1", style: {
987
987
  display: id === activeCliTab ? undefined : "none",
@@ -1418,7 +1418,7 @@ export function AgentChatSurface({ mode = "panel", className, defaultMode = "cha
1418
1418
  * Wraps app content with a toggleable agent sidebar.
1419
1419
  * Use AgentToggleButton in your header to open/close it.
1420
1420
  */
1421
- export function AgentSidebar({ children, emptyStateText = "How can I help you?", suggestions, dynamicSuggestions, composerToolbarSlot, composerSlot, onComposerTextChange, imageModelMenu, availableAgents, availableModels, modelListLoading, selectedAgent, onAgentChange, onConnectLocalRuntime, runtime, adapterReloadKey, threadFooterSlot, defaultSidebarWidth, sidebarWidth, position = "right", defaultOpen = false, animateMobile = true, animateDesktop = true, chatViewTransition = false, chatViewTransitionHandoff = false, storageKey, openStorageKey, apiUrl, agentChatSurface, desktopIdentityUnauthenticated, desktopIdentityAuthenticated, showTabBar = true, suppressInlineOpenApp, composerPlaceholder, openOnChatRunning = false, onFullscreenRequest, scope, showScopeBadge, browserTabId, threadUrlSync, agentPageHref, suppressFirstRunOnboarding = false, }) {
1421
+ export function AgentSidebar({ children, emptyStateText = "How can I help you?", suggestions, dynamicSuggestions, composerToolbarSlot, composerSlot, onComposerTextChange, imageModelMenu, availableAgents, availableModels, modelListLoading, selectedAgent, onAgentChange, onConnectLocalRuntime, runtime, adapterReloadKey, threadFooterSlot, defaultSidebarWidth, sidebarWidth, position = "right", defaultOpen = false, animateMobile = true, animateDesktop = true, chatViewTransition = false, chatViewTransitionHandoff = false, storageKey, openStorageKey, apiUrl, agentChatSurface, desktopIdentityUnauthenticated, desktopIdentityAuthenticated, showTabBar = true, suppressInlineOpenApp, composerPlaceholder, openOnChatRunning = false, onFullscreenRequest, scope, isolateHistoryByScope = false, showScopeBadge, browserTabId, threadUrlSync, agentPageHref, suppressFirstRunOnboarding = false, }) {
1422
1422
  const staticHostedHarnessEnabled = isHostedHarnessConfigured(injectedAgentNativeConfig().harness);
1423
1423
  const hostedHarnessQuery = useActionQuery("get-hosted-harness-config", undefined, { enabled: staticHostedHarnessEnabled });
1424
1424
  const hostedHarnessStatus = hostedHarnessQuery.data;
@@ -2059,7 +2059,7 @@ export function AgentSidebar({ children, emptyStateText = "How can I help you?",
2059
2059
  ? "desktop"
2060
2060
  : undefined, "data-agent-sidebar-layout": panelLayout, "data-agent-sidebar-position": effectivePosition, "data-agent-native-hosted-harness-ui": hostedHarnessUi ? "desktop" : undefined, "data-agent-sidebar-state": panelOpen ? "open" : "closed", "data-agent-sidebar-per-app-chat": isPerAppChatSidebar ? "true" : undefined, "data-agent-sidebar-resizing": isResizing ? "true" : undefined, "data-agent-sidebar-chat-handoff": chatViewTransitionHandoff ? "true" : undefined, style: chatViewTransition
2061
2061
  ? getAgentChatViewTransitionStyle(panelStyle)
2062
- : panelStyle, inert: sidebarAnimationEnabled && !panelOpen ? true : undefined, "aria-hidden": sidebarAnimationEnabled && !panelOpen ? true : undefined, children: _jsx("div", { className: "agent-sidebar-panel-inner flex min-h-0 flex-1 flex-col", children: _jsx(AgentPanel, { emptyStateText: emptyStateText, suggestions: suggestions, dynamicSuggestions: dynamicSuggestions, composerToolbarSlot: composerToolbarSlot, composerSlot: composerSlot, onComposerTextChange: onComposerTextChange, imageModelMenu: imageModelMenu, availableAgents: effectiveAvailableAgents, availableModels: availableModels, modelListLoading: modelListLoading, selectedAgent: effectiveSelectedAgent, onAgentChange: effectiveOnAgentChange, hostedHarness: hostedHarnessEnabled, onConnectLocalRuntime: onConnectLocalRuntime, runtime: runtime, adapterReloadKey: adapterReloadKey, threadFooterSlot: threadFooterSlot, apiUrl: apiUrl, agentChatSurface: agentChatSurface, desktopIdentityUnauthenticated: desktopIdentityUnauthenticated, desktopIdentityAuthenticated: desktopIdentityAuthenticated, showTabBar: effectiveShowTabBar, suppressInlineOpenApp: suppressInlineOpenApp, composerPlaceholder: composerPlaceholder, missingApiKeySetupLayout: "sidebar", onCollapse: () => setOpenPersisted(false), onSnapTo75Percent: isMobile ? undefined : snapTo75Percent, isWideDrawer: isMobile ? false : isWideDrawer, onExitWideDrawer: isMobile ? undefined : exitWideDrawer, onFullViewRequest: onFullscreenRequest, storageKey: storageKey, scope: scope, showScopeBadge: showScopeBadge, browserTabId: browserTabId, threadUrlSync: threadUrlSync, agentPageHref: agentPageHref, allowSettingsMode: false, chatOnly: true }) }) }), showResizeHandle && isLeft && (_jsx(ResizeHandle, { position: effectivePosition, onDrag: handleDrag, onResizeStart: handleResizeStart, onResizeEnd: handleResizeEnd }))] })) : null;
2062
+ : panelStyle, inert: sidebarAnimationEnabled && !panelOpen ? true : undefined, "aria-hidden": sidebarAnimationEnabled && !panelOpen ? true : undefined, children: _jsx("div", { className: "agent-sidebar-panel-inner flex min-h-0 flex-1 flex-col", children: _jsx(AgentPanel, { emptyStateText: emptyStateText, suggestions: suggestions, dynamicSuggestions: dynamicSuggestions, composerToolbarSlot: composerToolbarSlot, composerSlot: composerSlot, onComposerTextChange: onComposerTextChange, imageModelMenu: imageModelMenu, availableAgents: effectiveAvailableAgents, availableModels: availableModels, modelListLoading: modelListLoading, selectedAgent: effectiveSelectedAgent, onAgentChange: effectiveOnAgentChange, hostedHarness: hostedHarnessEnabled, onConnectLocalRuntime: onConnectLocalRuntime, runtime: runtime, adapterReloadKey: adapterReloadKey, threadFooterSlot: threadFooterSlot, apiUrl: apiUrl, agentChatSurface: agentChatSurface, desktopIdentityUnauthenticated: desktopIdentityUnauthenticated, desktopIdentityAuthenticated: desktopIdentityAuthenticated, showTabBar: effectiveShowTabBar, suppressInlineOpenApp: suppressInlineOpenApp, composerPlaceholder: composerPlaceholder, missingApiKeySetupLayout: "sidebar", onCollapse: () => setOpenPersisted(false), onSnapTo75Percent: isMobile ? undefined : snapTo75Percent, isWideDrawer: isMobile ? false : isWideDrawer, onExitWideDrawer: isMobile ? undefined : exitWideDrawer, onFullViewRequest: onFullscreenRequest, storageKey: storageKey, scope: scope, isolateHistoryByScope: isolateHistoryByScope, showScopeBadge: showScopeBadge, browserTabId: browserTabId, threadUrlSync: threadUrlSync, agentPageHref: agentPageHref, allowSettingsMode: false, chatOnly: true }) }) }), showResizeHandle && isLeft && (_jsx(ResizeHandle, { position: effectivePosition, onDrag: handleDrag, onResizeStart: handleResizeStart, onResizeEnd: handleResizeEnd }))] })) : null;
2063
2063
  const drawerPlaceholder = wideDrawerEnabled && !presentationMode && panelOpen ? (_jsx("div", { "aria-hidden": "true", className: "agent-sidebar-drawer-placeholder shrink-0", "data-agent-sidebar-placeholder": "true", style: { width: drawerPlaceholderWidth + 1 } })) : null;
2064
2064
  return (_jsx(AgentSidebarOnboardingContext.Provider, { value: true, children: _jsxs(RealtimeVoiceModeProvider, { browserTabId: browserTabId, children: [showFirstRunOnboarding && (_jsx(Suspense, { fallback: null, children: _jsx(FirstRunOnboarding, {}) })), _jsxs("div", { className: "agent-sidebar-shell flex min-w-0 flex-1 h-screen overflow-hidden", "data-agent-sidebar-position": effectivePosition, "data-agent-native-hosted-harness-ui": hostedHarnessUi ? "desktop" : undefined, "data-agent-native-hosted-chat": isPerAppChatHosted ? "true" : undefined, "data-agent-sidebar-resizing": isResizing ? "true" : undefined, children: [isMobile &&
2065
2065
  !isPerAppChatHosted &&
@@ -11,7 +11,7 @@ import { type AgentChatRuntime } from "./chat/runtime.js";
11
11
  import { type AgentComposerLayoutVariant, type ComposerSubmitIntent, type Reference } from "./composer/index.js";
12
12
  import { type AgentDynamicSuggestionsOption } from "./dynamic-suggestions.js";
13
13
  import { type ContentPart } from "./sse-event-processor.js";
14
- import type { ChatThreadScope, ChatThreadSnapshot } from "./use-chat-threads.js";
14
+ import { type ChatThreadScope, type ChatThreadSnapshot } from "./use-chat-threads.js";
15
15
  export { AssistantMessageListErrorBoundary, AssistantUiStaleIndexErrorBoundary, assistantUiRecoverableRenderErrorKind, isAssistantUiRecoverableRenderError, isAssistantUiStaleIndexError, } from "./assistant-ui-recovery.js";
16
16
  export { displayableUserMessageText } from "./chat/message-components.js";
17
17
  export declare function shouldSuppressUnauthenticatedDesktopThreadRestore(surface: AgentChatSurfaceKind, status: number, desktopIdentityUnauthenticated?: boolean): boolean;
@@ -269,6 +269,8 @@ export interface AssistantChatProps {
269
269
  threadId?: string;
270
270
  /** Resource scope to include with chat requests for server-side context. */
271
271
  contextScope?: ChatThreadScope | null;
272
+ /** Restrict server-side thread restores to the supplied app scope. */
273
+ isolateHistoryByScope?: boolean;
272
274
  /** Namespace used to hide ambient composer context from other host surfaces. */
273
275
  contextNamespace?: string;
274
276
  /** Whether this chat owns the active visible composer context snapshot. */
@@ -39,6 +39,7 @@ import { McpConnectionSuggestion } from "./resources/McpConnectionSuggestion.js"
39
39
  import { claimRunStream, createRunStreamToken, ownsRunStream, releaseRunStream, } from "./run-stream-ownership.js";
40
40
  import { AgentAutoContinueSignal, readSSEStreamRaw, settleInterruptedToolCalls, } from "./sse-event-processor.js";
41
41
  import { useAgentEngineConfigured } from "./use-agent-engine-configured.js";
42
+ import { appendChatThreadScopeParams, } from "./use-chat-threads.js";
42
43
  import { useDevMode } from "./use-dev-mode.js";
43
44
  import { useRunStuckDetection } from "./use-run-stuck-detection.js";
44
45
  import { cn } from "./utils.js";
@@ -1386,7 +1387,7 @@ function approvalResolutionIdentity(approvalKey, toolCallId,
1386
1387
  askId) {
1387
1388
  return `${toolCallId ?? ""}\u0000${approvalKey}\u0000${askId ?? ""}`;
1388
1389
  }
1389
- const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateText, suggestions, dynamicSuggestions, threadFooterSlot, emptyStateAddon, showHeader = true, onSwitchToCli, className, apiUrl, tabId, browserTabId, threadId, contextScope, contextNamespace, isActiveComposer = true, onMessageCountChange, onSaveThread, onGenerateTitle, composerSlot, onComposerTextChange, composerAreaClassName, composerPlaceholder, missingApiKeySetupLayout = "default", composerLayoutVariant = "default", centerComposerWhenEmpty = false, emptyStateDisplay = "default", composerToolbarSlot, composerExtraActionButton, showModelSelector = true, composerDisabled = false, composerDisabledPlaceholder, isNewThread, isThreadStateLoading, onSlashCommand, execMode, onExecModeChange, approvalActions, planModeDisabled, planModeDisabledReason, selectedModel, defaultModel, selectedEngine, selectedEffort, availableModels, modelListLoading, onModelChange, onEffortChange, availableAgents, selectedAgent, hostedHarness, onAgentChange, imageModelMenu, onForkChat, onConnectProvider, onConnectLocalRuntime, plusMenuMode = "full", providerStatusChecksEnabled = true, loadHistoryRepository, historyReloadKey, externalStreaming = false, agentChatSurface = "app", desktopIdentityUnauthenticated = false, desktopIdentityAuthenticated = false, suppressInlineOpenApp = false, }, ref) {
1390
+ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateText, suggestions, dynamicSuggestions, threadFooterSlot, emptyStateAddon, showHeader = true, onSwitchToCli, className, apiUrl, tabId, browserTabId, threadId, contextScope, isolateHistoryByScope = false, contextNamespace, isActiveComposer = true, onMessageCountChange, onSaveThread, onGenerateTitle, composerSlot, onComposerTextChange, composerAreaClassName, composerPlaceholder, missingApiKeySetupLayout = "default", composerLayoutVariant = "default", centerComposerWhenEmpty = false, emptyStateDisplay = "default", composerToolbarSlot, composerExtraActionButton, showModelSelector = true, composerDisabled = false, composerDisabledPlaceholder, isNewThread, isThreadStateLoading, onSlashCommand, execMode, onExecModeChange, approvalActions, planModeDisabled, planModeDisabledReason, selectedModel, defaultModel, selectedEngine, selectedEffort, availableModels, modelListLoading, onModelChange, onEffortChange, availableAgents, selectedAgent, hostedHarness, onAgentChange, imageModelMenu, onForkChat, onConnectProvider, onConnectLocalRuntime, plusMenuMode = "full", providerStatusChecksEnabled = true, loadHistoryRepository, historyReloadKey, externalStreaming = false, agentChatSurface = "app", desktopIdentityUnauthenticated = false, desktopIdentityAuthenticated = false, suppressInlineOpenApp = false, }, ref) {
1390
1391
  const t = useT();
1391
1392
  const thread = useThread();
1392
1393
  const threadRuntime = useThreadRuntime();
@@ -1418,6 +1419,14 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
1418
1419
  enabled: messages.length === 0,
1419
1420
  });
1420
1421
  const messageListResetKey = useMemo(() => assistantUiMessageListStructureKey(messages), [messages]);
1422
+ const threadScopeQuery = useMemo(() => {
1423
+ if (!isolateHistoryByScope || !contextScope)
1424
+ return "";
1425
+ const params = new URLSearchParams();
1426
+ appendChatThreadScopeParams(params, contextScope);
1427
+ const query = params.toString();
1428
+ return query ? `?${query}` : "";
1429
+ }, [contextScope?.id, contextScope?.type, isolateHistoryByScope]);
1421
1430
  // Chat-wide drag-and-drop: users expect to drop a file anywhere on the agent
1422
1431
  // sidebar (thread, header, composer) and have it attach — same as ChatGPT,
1423
1432
  // Claude.ai, Linear, Slack, etc. Tiptap's own `handleDrop` only fires inside
@@ -1989,7 +1998,7 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
1989
1998
  ? setTimeout(() => ownAbort.abort(), getPollAbortMs(2000))
1990
1999
  : null;
1991
2000
  try {
1992
- const refreshRes = await fetch(`${apiUrl}/threads/${encodeURIComponent(threadId)}`, { signal: signal ?? ownAbort?.signal });
2001
+ const refreshRes = await fetch(`${apiUrl}/threads/${encodeURIComponent(threadId)}${threadScopeQuery}`, { signal: signal ?? ownAbort?.signal });
1993
2002
  if (!refreshRes.ok)
1994
2003
  return null;
1995
2004
  const refreshData = await refreshRes.json();
@@ -2006,7 +2015,13 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
2006
2015
  if (ownAbortTimer)
2007
2016
  clearTimeout(ownAbortTimer);
2008
2017
  }
2009
- }, [apiUrl, importThreadData, loadHistoryRepository, threadId]);
2018
+ }, [
2019
+ apiUrl,
2020
+ importThreadData,
2021
+ loadHistoryRepository,
2022
+ threadId,
2023
+ threadScopeQuery,
2024
+ ]);
2010
2025
  const exportCleanThreadRepo = useCallback(() => ensureMessageMetadata(normalizeThreadRepository(threadRuntime.export())), [threadRuntime]);
2011
2026
  const exportPersistableThreadRepo = useCallback(() => withLastAssistantRunDuration(exportCleanThreadRepo(), showRunningInUI ? null : lastChatRunDurationMs), [exportCleanThreadRepo, lastChatRunDurationMs, showRunningInUI]);
2012
2027
  useEffect(() => {
@@ -2698,7 +2713,7 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
2698
2713
  (async () => {
2699
2714
  let canReconnect = false;
2700
2715
  try {
2701
- const res = await fetch(`${apiUrl}/threads/${encodeURIComponent(threadId)}`);
2716
+ const res = await fetch(`${apiUrl}/threads/${encodeURIComponent(threadId)}${threadScopeQuery}`);
2702
2717
  if (!res.ok) {
2703
2718
  if (!cancelled) {
2704
2719
  setThreadRestoreError(shouldSuppressUnauthenticatedDesktopThreadRestore(agentChatSurface, res.status, desktopIdentityUnauthenticated)
@@ -2811,6 +2826,7 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
2811
2826
  isThreadStateLoading,
2812
2827
  desktopIdentityUnauthenticated,
2813
2828
  restoreAttempt,
2829
+ threadScopeQuery,
2814
2830
  ]);
2815
2831
  useEffect(() => {
2816
2832
  if (!loadHistoryRepository ||
@@ -2992,7 +3008,7 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
2992
3008
  const timer = setTimeout(() => {
2993
3009
  (async () => {
2994
3010
  try {
2995
- const res = await fetch(`${apiUrl}/threads/${encodeURIComponent(threadId)}/queued`, {
3011
+ const res = await fetch(`${apiUrl}/threads/${encodeURIComponent(threadId)}/queued${threadScopeQuery}`, {
2996
3012
  method: "POST",
2997
3013
  headers: { "Content-Type": "application/json" },
2998
3014
  body: JSON.stringify({ queuedMessages }),
@@ -3010,7 +3026,7 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
3010
3026
  })();
3011
3027
  }, 300);
3012
3028
  return () => clearTimeout(timer);
3013
- }, [queuedMessages, threadId, apiUrl]);
3029
+ }, [queuedMessages, threadId, apiUrl, threadScopeQuery]);
3014
3030
  // Nudge the shared hook to re-check after a Builder connect.
3015
3031
  const handleBuilderConnected = useCallback(() => {
3016
3032
  focusComposerAfterConnectRef.current = true;
@@ -89,8 +89,13 @@ export interface CommandMenuProps {
89
89
  * multiple apps share an origin.
90
90
  */
91
91
  changelogKey?: string;
92
+ /**
93
+ * Whether to show the built-in "About Agent Native" entry. Defaults to true
94
+ * for app-shell menus that provide a changelog; set false for local menus.
95
+ */
96
+ showAbout?: boolean;
92
97
  }
93
- export declare function CommandMenu({ open, onOpenChange, children, renderResults, placeholder, emptyText: _emptyText, showAgentFallback, className, changelog, changelogLabel, changelogKey, }: CommandMenuProps): React.JSX.Element;
98
+ export declare function CommandMenu({ open, onOpenChange, children, renderResults, placeholder, emptyText: _emptyText, showAgentFallback, className, changelog, changelogLabel, changelogKey, showAbout: showAboutProp, }: CommandMenuProps): React.JSX.Element;
94
99
  export declare namespace CommandMenu {
95
100
  export { CommandGroup as Group };
96
101
  export { CommandItem as Item };