@tangle-network/agent-app 0.63.60 → 0.63.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DesignCanvas-Q65UV4D5.js → DesignCanvas-566V5KVC.js} +3 -2
- package/dist/{DesignCanvasEditor-THEFESEX.js → DesignCanvasEditor-YWDEFWYQ.js} +3 -2
- package/dist/app-auth/index.js +2 -1
- package/dist/app-auth/index.js.map +1 -1
- package/dist/assistant/index.js +6 -5
- package/dist/assistant/index.js.map +1 -1
- package/dist/chat-react/index.js +3 -3
- package/dist/chat-routes/agent-producers.d.ts +38 -0
- package/dist/chat-routes/index.d.ts +1 -0
- package/dist/chat-routes/index.js +25 -8
- package/dist/chat-routes/index.js.map +1 -1
- package/dist/chat-routes/turn-admission.d.ts +3 -3
- package/dist/chat-routes/turn-route-contracts.d.ts +38 -1
- package/dist/chat-routes/wire.d.ts +29 -4
- package/dist/chat-store/index.js +4 -2
- package/dist/chat-store/index.js.map +1 -1
- package/dist/chat-store/parts.d.ts +19 -3
- package/dist/{chunk-P7UB7ZVP.js → chunk-75I4RXIE.js} +2 -2
- package/dist/{chunk-GGJYAV7R.js → chunk-DPZXCVVS.js} +2 -2
- package/dist/{chunk-GGJYAV7R.js.map → chunk-DPZXCVVS.js.map} +1 -1
- package/dist/{chunk-LAZCUQFZ.js → chunk-F2N55QQX.js} +47 -10
- package/dist/chunk-F2N55QQX.js.map +1 -0
- package/dist/{chunk-QGJOT6R6.js → chunk-F6UC2T6U.js} +49 -9
- package/dist/{chunk-QGJOT6R6.js.map → chunk-F6UC2T6U.js.map} +1 -1
- package/dist/{chunk-AICYKYYF.js → chunk-MIQL36JS.js} +17 -4
- package/dist/chunk-MIQL36JS.js.map +1 -0
- package/dist/{chunk-RILVJYXJ.js → chunk-N5KBDRSX.js} +2 -2
- package/dist/{chunk-IDQ7N36R.js → chunk-O2TYB3DH.js} +2 -2
- package/dist/{chunk-H6BRJU5M.js → chunk-RKNNMC6T.js} +1 -1
- package/dist/{chunk-HHPQMFKP.js → chunk-RNFVAAJJ.js} +2 -2
- package/dist/{chunk-KFO5R4SN.js → chunk-RVC7EHJI.js} +135 -64
- package/dist/chunk-RVC7EHJI.js.map +1 -0
- package/dist/{chunk-4E2MUVGL.js → chunk-TFV4QOCG.js} +3 -3
- package/dist/chunk-XBBXPZJI.js +47 -0
- package/dist/chunk-XBBXPZJI.js.map +1 -0
- package/dist/design-canvas/index.js +2 -1
- package/dist/design-canvas/index.js.map +1 -1
- package/dist/design-canvas-react/engine.js +2 -1
- package/dist/design-canvas-react/index.js +3 -2
- package/dist/design-canvas-react/index.js.map +1 -1
- package/dist/design-canvas-react/lazy.js +1 -1
- package/dist/operator/index.js +2 -2
- package/dist/platform/index.js +2 -1
- package/dist/platform/index.js.map +1 -1
- package/dist/preset-cloudflare/index.js +4 -4
- package/dist/public-consultation/index.d.ts +2 -2
- package/dist/public-consultation/index.js +7 -6
- package/dist/public-consultation/index.js.map +1 -1
- package/dist/sandbox/index.js +2 -2
- package/dist/sequences/index.js +2 -1
- package/dist/sequences/index.js.map +1 -1
- package/dist/stories/chat/fixtures.d.ts +4 -0
- package/dist/web/index.d.ts +1 -0
- package/dist/web/index.js +7 -1
- package/dist/web/speakers.d.ts +30 -0
- package/dist/web-react/chat-messages.d.ts +1 -1
- package/dist/web-react/chat-stream.d.ts +7 -0
- package/dist/web-react/entry-composer.d.ts +2 -2
- package/dist/web-react/index.js +8 -5
- package/dist/web-react/use-file-mentions.d.ts +23 -4
- package/dist/workspace-react/index.d.ts +29 -1
- package/dist/workspace-react/index.js +34 -0
- package/dist/workspace-react/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-AICYKYYF.js.map +0 -1
- package/dist/chunk-KFO5R4SN.js.map +0 -1
- package/dist/chunk-LAZCUQFZ.js.map +0 -1
- /package/dist/{DesignCanvas-Q65UV4D5.js.map → DesignCanvas-566V5KVC.js.map} +0 -0
- /package/dist/{DesignCanvasEditor-THEFESEX.js.map → DesignCanvasEditor-YWDEFWYQ.js.map} +0 -0
- /package/dist/{chunk-P7UB7ZVP.js.map → chunk-75I4RXIE.js.map} +0 -0
- /package/dist/{chunk-RILVJYXJ.js.map → chunk-N5KBDRSX.js.map} +0 -0
- /package/dist/{chunk-IDQ7N36R.js.map → chunk-O2TYB3DH.js.map} +0 -0
- /package/dist/{chunk-H6BRJU5M.js.map → chunk-RKNNMC6T.js.map} +0 -0
- /package/dist/{chunk-HHPQMFKP.js.map → chunk-RNFVAAJJ.js.map} +0 -0
- /package/dist/{chunk-4E2MUVGL.js.map → chunk-TFV4QOCG.js.map} +0 -0
|
@@ -47,3 +47,7 @@ export declare const multiPartyAuthors: {
|
|
|
47
47
|
};
|
|
48
48
|
/** A legal intake that the agent hands to an attorney, who joins the thread. */
|
|
49
49
|
export declare const multiPartyThread: ChatUiMessage[];
|
|
50
|
+
/** One turn addressed to two agents: ONE stored assistant row whose parts carry
|
|
51
|
+
* a speaker part before each answer. `ChatMessages` draws it as two answers
|
|
52
|
+
* under two authors, in the order the person typed the mentions. */
|
|
53
|
+
export declare const twoAgentsThread: ChatUiMessage[];
|
package/dist/web/index.d.ts
CHANGED
package/dist/web/index.js
CHANGED
|
@@ -8,7 +8,11 @@ import {
|
|
|
8
8
|
parseChatStreamErrorEvent,
|
|
9
9
|
parseRetryAfterSeconds,
|
|
10
10
|
readFirstTouchAcquisition
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-RKNNMC6T.js";
|
|
12
|
+
import {
|
|
13
|
+
SPEAKER_ROLE_LABEL,
|
|
14
|
+
expandSpeakerRows
|
|
15
|
+
} from "../chunk-XBBXPZJI.js";
|
|
12
16
|
import {
|
|
13
17
|
createApiKeyFetch
|
|
14
18
|
} from "../chunk-RN4WPTBH.js";
|
|
@@ -46,6 +50,7 @@ import {
|
|
|
46
50
|
export {
|
|
47
51
|
FREE_ROUTE_BUDGETS,
|
|
48
52
|
FreeRouteLimitError,
|
|
53
|
+
SPEAKER_ROLE_LABEL,
|
|
49
54
|
STANDARD_SECURITY_HEADERS,
|
|
50
55
|
WORKSPACE_BUDGET_MULTIPLIER,
|
|
51
56
|
acquisitionFromRequest,
|
|
@@ -57,6 +62,7 @@ export {
|
|
|
57
62
|
clearCookieHeader,
|
|
58
63
|
createApiKeyFetch,
|
|
59
64
|
createRateLimiterBinding,
|
|
65
|
+
expandSpeakerRows,
|
|
60
66
|
extractRequestContext,
|
|
61
67
|
firstTouchAcquisitionCookie,
|
|
62
68
|
freeRouteLimitResponse,
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A turn addressed to several agents is persisted as ONE assistant row whose
|
|
3
|
+
* parts carry a `speaker` part before each responder's parts. A transcript
|
|
4
|
+
* draws each answer under its author, so this splits such a row into one row
|
|
5
|
+
* per speaker in stored order. Rows without a speaker part pass through
|
|
6
|
+
* untouched, byte for byte. Pure and renderer-neutral: no React, no DOM.
|
|
7
|
+
*/
|
|
8
|
+
export interface SpeakerRow {
|
|
9
|
+
id: string | number;
|
|
10
|
+
role?: string;
|
|
11
|
+
content: string;
|
|
12
|
+
/** Stored parts; the typed store union and raw records are both read. */
|
|
13
|
+
parts?: ReadonlyArray<unknown>;
|
|
14
|
+
author?: {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
role?: string;
|
|
18
|
+
avatarUrl?: string;
|
|
19
|
+
};
|
|
20
|
+
segments?: unknown;
|
|
21
|
+
toolCalls?: unknown;
|
|
22
|
+
}
|
|
23
|
+
export interface Speaker {
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
handle?: string;
|
|
27
|
+
}
|
|
28
|
+
/** The role label a split row shows beside the agent's name. */
|
|
29
|
+
export declare const SPEAKER_ROLE_LABEL = "Agent";
|
|
30
|
+
export declare function expandSpeakerRows<T extends SpeakerRow>(rows: readonly T[]): Array<T & Pick<SpeakerRow, 'author'>>;
|
|
@@ -14,4 +14,4 @@ export declare function useThinkingSeconds(active: boolean): number;
|
|
|
14
14
|
* reader's `viewerId`: the reader's own messages stay right-aligned, everyone
|
|
15
15
|
* else's are named, and a named agent replaces the agent label.
|
|
16
16
|
*/
|
|
17
|
-
export declare function ChatMessages({ messages, messageSize, chrome, models, renderMarkdown, renderExtras, durableCards, userLabel, agentLabel, loading, turnPhase, approval, onToolCallClick, toolRenderers, error, onRetry, renderEmpty, emptyState, header, resolveAttachmentUrl, workProductCards, viewerId, }: ChatMessagesProps): import("react").JSX.Element;
|
|
17
|
+
export declare function ChatMessages({ messages: storedMessages, messageSize, chrome, models, renderMarkdown, renderExtras, durableCards, userLabel, agentLabel, loading, turnPhase, approval, onToolCallClick, toolRenderers, error, onRetry, renderEmpty, emptyState, header, resolveAttachmentUrl, workProductCards, viewerId, }: ChatMessagesProps): import("react").JSX.Element;
|
|
@@ -44,6 +44,13 @@ export interface ChatStreamCallbacks {
|
|
|
44
44
|
/** The turn's intent line (`session.run.intent`): show it as a labeled status line until the first `onText`. */
|
|
45
45
|
onIntent?: (intent: TurnIntentData) => void;
|
|
46
46
|
onText?: (delta: string) => void;
|
|
47
|
+
/** The next responder of a turn addressed to several agents starts: open a
|
|
48
|
+
* new assistant block under this author; text that follows is theirs. */
|
|
49
|
+
onSpeaker?: (speaker: {
|
|
50
|
+
id: string;
|
|
51
|
+
name: string;
|
|
52
|
+
handle?: string;
|
|
53
|
+
}) => void;
|
|
47
54
|
onReasoning?: (delta: string) => void;
|
|
48
55
|
/** The message's reasoning so far, when it started and when it ended, after every reasoning delta and once
|
|
49
56
|
* when thinking ends. Spread it onto `ReasoningRow`. `consumeChatStream` and `streamChatTurn` keep it;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import type { ComposerFileRejection } from './composer-file-accept';
|
|
3
3
|
import type { UseFileMentionsResult } from './use-file-mentions';
|
|
4
|
-
import type { ChatAttachmentInput,
|
|
4
|
+
import type { ChatAttachmentInput, ChatMention } from '../chat-routes/wire';
|
|
5
5
|
import { type AgentSessionControlsProps } from './agent-session-controls';
|
|
6
6
|
import { type ComposerPlanModeSelection } from './composer-mode-controls';
|
|
7
7
|
export interface EntryComposerProps {
|
|
@@ -60,7 +60,7 @@ export interface EntryComposerProps {
|
|
|
60
60
|
/** Block submit until a persisted selection has resolved against the catalog,
|
|
61
61
|
* so the first turn cannot go out under the wrong model. Defaults to true. */
|
|
62
62
|
ready?: boolean;
|
|
63
|
-
onSubmit: (prompt: string, attachments: ChatAttachmentInput[], mentions:
|
|
63
|
+
onSubmit: (prompt: string, attachments: ChatAttachmentInput[], mentions: ChatMention[]) => void;
|
|
64
64
|
className?: string;
|
|
65
65
|
composerClassName?: string;
|
|
66
66
|
/** Max width of the centered column. Defaults to the fleet's 820px. */
|
package/dist/web-react/index.js
CHANGED
|
@@ -101,6 +101,7 @@ import {
|
|
|
101
101
|
provenanceStandingMeta,
|
|
102
102
|
provenanceTriggerLabel,
|
|
103
103
|
pruneRecordGridOverlay,
|
|
104
|
+
rankAgentMentions,
|
|
104
105
|
rankFileMentions,
|
|
105
106
|
readRecordGridCell,
|
|
106
107
|
recordGridEditorText,
|
|
@@ -147,7 +148,7 @@ import {
|
|
|
147
148
|
withoutRecordGridCreated,
|
|
148
149
|
withoutRecordGridRemoved,
|
|
149
150
|
withoutRecordGridUpdate
|
|
150
|
-
} from "../chunk-
|
|
151
|
+
} from "../chunk-F2N55QQX.js";
|
|
151
152
|
import {
|
|
152
153
|
useInfiniteScroll
|
|
153
154
|
} from "../chunk-UHSUY6H6.js";
|
|
@@ -189,7 +190,7 @@ import {
|
|
|
189
190
|
preloadWhenIdle,
|
|
190
191
|
useComposerAttachments,
|
|
191
192
|
useDictation
|
|
192
|
-
} from "../chunk-
|
|
193
|
+
} from "../chunk-DPZXCVVS.js";
|
|
193
194
|
import "../chunk-L7MB2LLM.js";
|
|
194
195
|
import {
|
|
195
196
|
AgentSessionControls,
|
|
@@ -249,8 +250,9 @@ import {
|
|
|
249
250
|
ALLOWED_ATTACHMENT_SNIFFED_MIMES,
|
|
250
251
|
ATTACHMENT_ACCEPT,
|
|
251
252
|
OOXML_SNIFFED_MIMES
|
|
252
|
-
} from "../chunk-
|
|
253
|
+
} from "../chunk-75I4RXIE.js";
|
|
253
254
|
import "../chunk-B7CL7ENS.js";
|
|
255
|
+
import "../chunk-XBBXPZJI.js";
|
|
254
256
|
import {
|
|
255
257
|
attachmentInputToPart,
|
|
256
258
|
attachmentKindForMime,
|
|
@@ -258,7 +260,7 @@ import {
|
|
|
258
260
|
isChatAttachmentPart,
|
|
259
261
|
mentionInputToPart,
|
|
260
262
|
mentionPartsFromMessageParts
|
|
261
|
-
} from "../chunk-
|
|
263
|
+
} from "../chunk-MIQL36JS.js";
|
|
262
264
|
import "../chunk-ZVEEWGDK.js";
|
|
263
265
|
import {
|
|
264
266
|
attachmentPartKey
|
|
@@ -310,7 +312,7 @@ import {
|
|
|
310
312
|
mediaTypeForMentionPath,
|
|
311
313
|
mentionKindForPath,
|
|
312
314
|
settleTurnResponse
|
|
313
|
-
} from "../chunk-
|
|
315
|
+
} from "../chunk-F6UC2T6U.js";
|
|
314
316
|
import "../chunk-AMUXRAUO.js";
|
|
315
317
|
import "../chunk-PV33JZKV.js";
|
|
316
318
|
import "../chunk-RCSAAWOH.js";
|
|
@@ -518,6 +520,7 @@ export {
|
|
|
518
520
|
provenanceTriggerLabel,
|
|
519
521
|
pruneRecordGridOverlay,
|
|
520
522
|
questionInteractionContentSignature,
|
|
523
|
+
rankAgentMentions,
|
|
521
524
|
rankFileMentions,
|
|
522
525
|
readRecordGridCell,
|
|
523
526
|
reconcileEffortLevels,
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* (tangle-network/agent-container#5934) without an import either way.
|
|
18
18
|
*/
|
|
19
19
|
import type { ReactNode } from 'react';
|
|
20
|
-
import type { FileMention } from '../chat-routes/wire';
|
|
20
|
+
import type { ChatMention, FileMention } from '../chat-routes/wire';
|
|
21
21
|
/** The atomic pill's payload. For a file mention, `id` is the
|
|
22
22
|
* workspace-relative path (the pill's stable identity and the `@<id>`
|
|
23
23
|
* serialization the editor uses to round-trip `value`), `label` is the
|
|
@@ -50,6 +50,20 @@ export interface ComposerMentionProp {
|
|
|
50
50
|
* ARIA attributes. */
|
|
51
51
|
popoverClassName?: string;
|
|
52
52
|
}
|
|
53
|
+
/** A workspace agent the composer can `@`. `handle` is what the text carries
|
|
54
|
+
* after `@` and the pill's identity; `id` is the stable profile id the turn
|
|
55
|
+
* is addressed with. */
|
|
56
|
+
export interface AgentMentionOption {
|
|
57
|
+
id: string;
|
|
58
|
+
handle: string;
|
|
59
|
+
name: string;
|
|
60
|
+
/** One line under the name in the popover, such as what the agent does. */
|
|
61
|
+
description?: string;
|
|
62
|
+
}
|
|
63
|
+
/** Agents whose name or handle starts with, then contains, the query; an
|
|
64
|
+
* empty query lists them all. Agents come before files in the popover: a
|
|
65
|
+
* workspace has a handful, a box has thousands. */
|
|
66
|
+
export declare function rankAgentMentions(agents: readonly AgentMentionOption[], query: string): AgentMentionOption[];
|
|
53
67
|
/**
|
|
54
68
|
* Ranks `files` against `query` (case-insensitive), capped to `limit`:
|
|
55
69
|
* name-prefix matches first, then name-substring, then path-substring.
|
|
@@ -88,14 +102,19 @@ export interface UseFileMentionsOptions {
|
|
|
88
102
|
/** Text shown in the popover's empty state once the index is loaded and
|
|
89
103
|
* the query matched nothing. Default {@link DEFAULT_MENTION_EMPTY_TEXT}. */
|
|
90
104
|
emptyText?: string;
|
|
105
|
+
/** The workspace's agents, offered in the same `@` popover before files.
|
|
106
|
+
* A picked agent is sent as an `AgentMention` and the turn is addressed
|
|
107
|
+
* to it (the route's `agents.resolve` seam). Omit → files only. */
|
|
108
|
+
agents?: readonly AgentMentionOption[];
|
|
91
109
|
}
|
|
92
110
|
/** Provide properties and methods to manage and refresh file mentions in a composer interface */
|
|
93
111
|
export interface UseFileMentionsResult {
|
|
94
112
|
/** Spread straight into `ChatComposer`'s `mention` prop. */
|
|
95
113
|
mention: ComposerMentionProp;
|
|
96
|
-
/** The files currently referenced by mentions in the composer's
|
|
97
|
-
* the send-body list
|
|
98
|
-
|
|
114
|
+
/** The files and agents currently referenced by mentions in the composer's
|
|
115
|
+
* value, in document order — the send-body list. Files go through
|
|
116
|
+
* `fileMentionsToParts`; agents are addressed by the route. */
|
|
117
|
+
mentions: ChatMention[];
|
|
99
118
|
/** Drop all currently-referenced mentions (e.g. after a successful send). */
|
|
100
119
|
clearMentions: () => void;
|
|
101
120
|
/** Force a re-fetch of the index right now, ignoring `refreshAfterMs` — for
|
|
@@ -57,6 +57,32 @@ export interface AgentWorkspaceAppsConfig {
|
|
|
57
57
|
hrefForApp: (appId: string) => string;
|
|
58
58
|
prefetch?: RailPrefetch;
|
|
59
59
|
}
|
|
60
|
+
/** One agent in the workspace roster the rail lists. */
|
|
61
|
+
export interface AgentWorkspaceAgentRow {
|
|
62
|
+
/** The stable profile id. */
|
|
63
|
+
id: string;
|
|
64
|
+
name: string;
|
|
65
|
+
/** What the composer's `@` carries; shown beside the name. */
|
|
66
|
+
handle?: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The workspace's agents under one expandable rail row, like Apps: each row
|
|
70
|
+
* opens the agent's own thread (its direct line and its feed), and an optional
|
|
71
|
+
* create route adds "New agent". Products supply authorized rows and real
|
|
72
|
+
* routes; the roster comes from the product's agent-profile catalog.
|
|
73
|
+
*/
|
|
74
|
+
export interface AgentWorkspaceAgentsConfig {
|
|
75
|
+
icon: WorkspaceIcon;
|
|
76
|
+
items: readonly AgentWorkspaceAgentRow[];
|
|
77
|
+
hrefForAgent: (agentId: string) => string;
|
|
78
|
+
/** Row label. Defaults to `Agents`. */
|
|
79
|
+
label?: string;
|
|
80
|
+
/** Route that creates an agent; adds a "New agent" row at the end. */
|
|
81
|
+
createHref?: string;
|
|
82
|
+
/** Label for the create row. Defaults to `New agent`. */
|
|
83
|
+
createLabel?: string;
|
|
84
|
+
prefetch?: RailPrefetch;
|
|
85
|
+
}
|
|
60
86
|
/** Route data for the shared active-nav resolver. */
|
|
61
87
|
export interface AgentWorkspaceActiveRoute {
|
|
62
88
|
/** Current browser pathname, including the product's workspace base. */
|
|
@@ -86,6 +112,8 @@ export interface AgentWorkspaceLayoutProps extends Omit<SidebarLayoutProps, 'act
|
|
|
86
112
|
sessions?: AgentWorkspaceSessionConfig;
|
|
87
113
|
/** Authorized app destinations, in the product's persisted order. */
|
|
88
114
|
apps?: AgentWorkspaceAppsConfig;
|
|
115
|
+
/** The workspace's agents, each opening its own thread. */
|
|
116
|
+
agents?: AgentWorkspaceAgentsConfig;
|
|
89
117
|
/** When supplied, active navigation is resolved by the shared route rules. */
|
|
90
118
|
activeRoute?: AgentWorkspaceActiveRoute;
|
|
91
119
|
/** Escape hatch for routers that already resolved the active item. */
|
|
@@ -113,7 +141,7 @@ export interface AgentWorkspaceLayoutProps extends Omit<SidebarLayoutProps, 'act
|
|
|
113
141
|
* with `SessionHistoryPanel` and `EntryComposer` for the complete chat-first
|
|
114
142
|
* structure.
|
|
115
143
|
*/
|
|
116
|
-
export declare function AgentWorkspaceLayout({ children, navItems, sessions, apps, activeRoute, activeId, product, workspace, prewarm, ...sidebarProps }: AgentWorkspaceLayoutProps): import("react").JSX.Element;
|
|
144
|
+
export declare function AgentWorkspaceLayout({ children, navItems, sessions, apps, agents, activeRoute, activeId, product, workspace, prewarm, ...sidebarProps }: AgentWorkspaceLayoutProps): import("react").JSX.Element;
|
|
117
145
|
export { AgentWorkspaceCompanion, createAgentWorkspaceCompanionTabs, type AgentWorkspaceCompanionHandle, type AgentWorkspaceCompanionProps, type AgentWorkspaceCompanionTab, type AgentWorkspaceCompanionTool, type AgentWorkspaceCompanionTools, type AgentWorkspaceCompanionNavigation } from './companion';
|
|
118
146
|
export { WorkspaceSwitcher, type WorkspaceSwitcherItem, type WorkspaceSwitcherProps } from '../web-react/workspace-switcher';
|
|
119
147
|
export { WorkspaceInitial } from '../web-react/workspace-switcher';
|
|
@@ -820,6 +820,7 @@ function AgentWorkspaceLayout({
|
|
|
820
820
|
navItems,
|
|
821
821
|
sessions,
|
|
822
822
|
apps,
|
|
823
|
+
agents,
|
|
823
824
|
activeRoute,
|
|
824
825
|
activeId,
|
|
825
826
|
product,
|
|
@@ -868,6 +869,27 @@ function AgentWorkspaceLayout({
|
|
|
868
869
|
prefetch: apps.prefetch
|
|
869
870
|
};
|
|
870
871
|
});
|
|
872
|
+
const agentNavItems = [
|
|
873
|
+
...(agents?.items ?? []).map((agent) => {
|
|
874
|
+
const href = agents.hrefForAgent(agent.id);
|
|
875
|
+
if (!href.startsWith("/") || href.startsWith("//") || /[?#\\]/.test(href)) {
|
|
876
|
+
throw new Error("Workspace agent href must be a local route path");
|
|
877
|
+
}
|
|
878
|
+
return {
|
|
879
|
+
id: "workspace-agent:" + agent.id,
|
|
880
|
+
label: agent.handle ? `${agent.name} \xB7 @${agent.handle}` : agent.name,
|
|
881
|
+
icon: agents.icon,
|
|
882
|
+
href,
|
|
883
|
+
prefetch: agents.prefetch
|
|
884
|
+
};
|
|
885
|
+
}),
|
|
886
|
+
...agents?.createHref ? [{ id: "workspace-agent:new", label: agents.createLabel ?? "New agent", icon: agents.icon, href: agents.createHref, prefetch: agents.prefetch }] : []
|
|
887
|
+
];
|
|
888
|
+
const agentRoutes = activeRoute ? agentNavItems.map((item) => {
|
|
889
|
+
const path = routePathFromHref(item.href, activeRoute.base);
|
|
890
|
+
if (!path) throw new Error("Workspace agent href must be under the active workspace");
|
|
891
|
+
return { id: item.id, path };
|
|
892
|
+
}) : [];
|
|
871
893
|
const appRoutes = activeRoute ? appNavItems.map((item) => {
|
|
872
894
|
const path = routePathFromHref(item.href, activeRoute.base);
|
|
873
895
|
if (!path) throw new Error("Workspace app href must be under the active workspace");
|
|
@@ -879,6 +901,7 @@ function AgentWorkspaceLayout({
|
|
|
879
901
|
routes: [
|
|
880
902
|
...activeRoute.routes,
|
|
881
903
|
...appRoutes,
|
|
904
|
+
...agentRoutes,
|
|
882
905
|
...sessionNav && historyRoutePath ? [{ id: sessions?.id ?? "history", path: historyRoutePath }] : []
|
|
883
906
|
]
|
|
884
907
|
}) : activeId;
|
|
@@ -898,8 +921,19 @@ function AgentWorkspaceLayout({
|
|
|
898
921
|
})),
|
|
899
922
|
subActiveIds: activeAppId ? [activeAppId] : void 0
|
|
900
923
|
} : void 0;
|
|
924
|
+
const activeAgentId = agentNavItems.some((item) => item.id === resolvedActiveId) ? resolvedActiveId : void 0;
|
|
925
|
+
const agentGroup = agents && agentNavItems.length > 0 ? {
|
|
926
|
+
id: "workspace-agents",
|
|
927
|
+
label: agents.label ?? "Agents",
|
|
928
|
+
icon: agents.icon,
|
|
929
|
+
expandable: true,
|
|
930
|
+
defaultOpen: true,
|
|
931
|
+
subItems: agentNavItems.map(({ id, label, icon, href, prefetch }) => ({ id, label, icon, href, prefetch })),
|
|
932
|
+
subActiveIds: activeAgentId ? [activeAgentId] : void 0
|
|
933
|
+
} : void 0;
|
|
901
934
|
const workspaceNavItems = [
|
|
902
935
|
...navItems,
|
|
936
|
+
...agentGroup ? [agentGroup] : [],
|
|
903
937
|
...appGroup ? [appGroup] : [],
|
|
904
938
|
...sessionNav ? [sessionNav] : []
|
|
905
939
|
];
|