@tangle-network/agent-app 0.63.59 → 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.
Files changed (81) hide show
  1. package/dist/{DesignCanvas-Q65UV4D5.js → DesignCanvas-566V5KVC.js} +3 -2
  2. package/dist/{DesignCanvasEditor-THEFESEX.js → DesignCanvasEditor-YWDEFWYQ.js} +3 -2
  3. package/dist/app-auth/index.js +2 -1
  4. package/dist/app-auth/index.js.map +1 -1
  5. package/dist/assistant/index.js +6 -5
  6. package/dist/assistant/index.js.map +1 -1
  7. package/dist/chat-react/index.js +3 -3
  8. package/dist/chat-routes/agent-producers.d.ts +38 -0
  9. package/dist/chat-routes/index.d.ts +1 -0
  10. package/dist/chat-routes/index.js +25 -8
  11. package/dist/chat-routes/index.js.map +1 -1
  12. package/dist/chat-routes/turn-admission.d.ts +3 -3
  13. package/dist/chat-routes/turn-route-contracts.d.ts +38 -1
  14. package/dist/chat-routes/wire.d.ts +29 -4
  15. package/dist/chat-store/index.js +4 -2
  16. package/dist/chat-store/index.js.map +1 -1
  17. package/dist/chat-store/parts.d.ts +19 -3
  18. package/dist/{chunk-P7UB7ZVP.js → chunk-75I4RXIE.js} +2 -2
  19. package/dist/{chunk-GGJYAV7R.js → chunk-DPZXCVVS.js} +2 -2
  20. package/dist/{chunk-GGJYAV7R.js.map → chunk-DPZXCVVS.js.map} +1 -1
  21. package/dist/{chunk-LAZCUQFZ.js → chunk-F2N55QQX.js} +47 -10
  22. package/dist/chunk-F2N55QQX.js.map +1 -0
  23. package/dist/{chunk-QGJOT6R6.js → chunk-F6UC2T6U.js} +49 -9
  24. package/dist/{chunk-QGJOT6R6.js.map → chunk-F6UC2T6U.js.map} +1 -1
  25. package/dist/{chunk-AICYKYYF.js → chunk-MIQL36JS.js} +17 -4
  26. package/dist/chunk-MIQL36JS.js.map +1 -0
  27. package/dist/{chunk-RILVJYXJ.js → chunk-N5KBDRSX.js} +2 -2
  28. package/dist/{chunk-IDQ7N36R.js → chunk-O2TYB3DH.js} +2 -2
  29. package/dist/{chunk-H6BRJU5M.js → chunk-RKNNMC6T.js} +1 -1
  30. package/dist/{chunk-HHPQMFKP.js → chunk-RNFVAAJJ.js} +2 -2
  31. package/dist/{chunk-KFO5R4SN.js → chunk-RVC7EHJI.js} +135 -64
  32. package/dist/chunk-RVC7EHJI.js.map +1 -0
  33. package/dist/{chunk-4E2MUVGL.js → chunk-TFV4QOCG.js} +3 -3
  34. package/dist/chunk-XBBXPZJI.js +47 -0
  35. package/dist/chunk-XBBXPZJI.js.map +1 -0
  36. package/dist/design-canvas/index.js +2 -1
  37. package/dist/design-canvas/index.js.map +1 -1
  38. package/dist/design-canvas-react/engine.js +2 -1
  39. package/dist/design-canvas-react/index.js +3 -2
  40. package/dist/design-canvas-react/index.js.map +1 -1
  41. package/dist/design-canvas-react/lazy.js +1 -1
  42. package/dist/operator/index.js +2 -2
  43. package/dist/platform/index.js +2 -1
  44. package/dist/platform/index.js.map +1 -1
  45. package/dist/preset-cloudflare/index.js +4 -4
  46. package/dist/public-consultation/index.d.ts +2 -2
  47. package/dist/public-consultation/index.js +7 -6
  48. package/dist/public-consultation/index.js.map +1 -1
  49. package/dist/sandbox/index.js +2 -2
  50. package/dist/sequences/index.js +2 -1
  51. package/dist/sequences/index.js.map +1 -1
  52. package/dist/stories/chat/fixtures.d.ts +4 -0
  53. package/dist/theme/tokens.css +2 -4
  54. package/dist/vault/store/index.js +330 -259
  55. package/dist/vault/store/index.js.map +1 -1
  56. package/dist/vault/store/sandbox-hydrate.d.ts +22 -1
  57. package/dist/vault/store/sandbox-reconcile.d.ts +11 -3
  58. package/dist/vault/store/sandbox-sync.d.ts +26 -0
  59. package/dist/web/index.d.ts +1 -0
  60. package/dist/web/index.js +7 -1
  61. package/dist/web/speakers.d.ts +30 -0
  62. package/dist/web-react/chat-messages.d.ts +1 -1
  63. package/dist/web-react/chat-stream.d.ts +7 -0
  64. package/dist/web-react/entry-composer.d.ts +2 -2
  65. package/dist/web-react/index.js +8 -5
  66. package/dist/web-react/use-file-mentions.d.ts +23 -4
  67. package/dist/workspace-react/index.d.ts +29 -1
  68. package/dist/workspace-react/index.js +34 -0
  69. package/dist/workspace-react/index.js.map +1 -1
  70. package/package.json +5 -5
  71. package/dist/chunk-AICYKYYF.js.map +0 -1
  72. package/dist/chunk-KFO5R4SN.js.map +0 -1
  73. package/dist/chunk-LAZCUQFZ.js.map +0 -1
  74. /package/dist/{DesignCanvas-Q65UV4D5.js.map → DesignCanvas-566V5KVC.js.map} +0 -0
  75. /package/dist/{DesignCanvasEditor-THEFESEX.js.map → DesignCanvasEditor-YWDEFWYQ.js.map} +0 -0
  76. /package/dist/{chunk-P7UB7ZVP.js.map → chunk-75I4RXIE.js.map} +0 -0
  77. /package/dist/{chunk-RILVJYXJ.js.map → chunk-N5KBDRSX.js.map} +0 -0
  78. /package/dist/{chunk-IDQ7N36R.js.map → chunk-O2TYB3DH.js.map} +0 -0
  79. /package/dist/{chunk-H6BRJU5M.js.map → chunk-RKNNMC6T.js.map} +0 -0
  80. /package/dist/{chunk-HHPQMFKP.js.map → chunk-RNFVAAJJ.js.map} +0 -0
  81. /package/dist/{chunk-4E2MUVGL.js.map → chunk-TFV4QOCG.js.map} +0 -0
@@ -6,7 +6,8 @@
6
6
  * the recorded cursor.
7
7
  */
8
8
  import type { Outcome } from '../../sandbox/outcome';
9
- import { type SandboxVaultSyncConfig } from './sandbox-sync';
9
+ import { type VaultBoxSyncSkip } from './box-state';
10
+ import { type SandboxVaultSyncConfig, type SandboxVaultSyncStageObserver } from './sandbox-sync';
10
11
  export interface VaultHydrationFileSystem {
11
12
  exists(path: string): Promise<boolean>;
12
13
  writeMany(files: Array<{
@@ -46,6 +47,13 @@ export interface VaultHydrationStats {
46
47
  processedHeads: number;
47
48
  /** True when the coordinator's record proved the box current and nothing was listed or written. */
48
49
  inSync?: boolean;
50
+ /** Files the box refused for their size (`skipOversizeFiles`): absent from the box and its baseline. */
51
+ skipped: VaultBoxSyncSkip[];
52
+ /** Set when the copy budget ran out: heads not on the box yet, and whether later pages were not examined. */
53
+ deferred: {
54
+ pendingPaths: string[];
55
+ morePages: boolean;
56
+ } | null;
49
57
  }
50
58
  export interface VaultHydrationOptions {
51
59
  /** Paths a reconciliation parked as conflicts; hydration leaves both copies alone. */
@@ -54,6 +62,19 @@ export interface VaultHydrationOptions {
54
62
  appliedPaths?: ReadonlySet<string>;
55
63
  /** May still be in flight (the Vault-loss probe): hydrate awaits it only to compare heads. */
56
64
  pathsMissingFromBox?: ReadonlySet<string> | Promise<ReadonlySet<string>>;
65
+ /** False when the caller makes the warm-path decision and records the sync itself: hydration then neither skips nor records. */
66
+ recordSync?: boolean;
67
+ /**
68
+ * A copy that may span calls. Hydration spends `remainingChars` (Vault
69
+ * characters read; past it, it records what it wrote and returns `deferred`)
70
+ * and appends every Vault path it writes, so a caller that retries on a new
71
+ * box keeps one budget and can finish what the first attempt wrote.
72
+ */
73
+ progress?: {
74
+ remainingChars: number;
75
+ writtenPaths: string[];
76
+ };
77
+ onStage?: SandboxVaultSyncStageObserver;
57
78
  }
58
79
  /** Hydrate every live Vault head into the box, page by page, until the listing ends. */
59
80
  export declare function hydrateSandboxVault(config: SandboxVaultSyncConfig, box: VaultHydrationBox, workspaceId: string, options?: VaultHydrationOptions): Promise<Outcome<VaultHydrationStats>>;
@@ -1,6 +1,6 @@
1
1
  import { type SandboxExecChannel } from '../../sandbox/binary-read';
2
- import type { VaultMutationConflict } from './revisions';
3
- import { type SandboxVaultPathRejection, type SandboxVaultSyncChange, type SandboxVaultSyncConfig, type SandboxVaultSyncProgress } from './sandbox-sync';
2
+ import type { VaultMutationConflict, VaultWriteProvenance } from './revisions';
3
+ import { type SandboxVaultPathRejection, type SandboxVaultSyncChange, type SandboxVaultSyncConfig, type SandboxVaultSyncProgress, type SandboxVaultSyncStageObserver } from './sandbox-sync';
4
4
  /** The box calls reconciliation makes; a `@tangle-network/sandbox` instance satisfies it. */
5
5
  export interface VaultReconcileBox extends SandboxExecChannel {
6
6
  id: string;
@@ -20,10 +20,12 @@ export interface SandboxVaultSyncResult {
20
20
  pathsMissingFromBox: string[];
21
21
  operationId: string | null;
22
22
  changes: SandboxVaultSyncChange[];
23
+ /** Box changes the Vault already holds (another path committed the same bytes); recorded without a commit. */
24
+ convergedChanges?: SandboxVaultSyncChange[];
23
25
  appliedPaths: string[];
24
26
  conflicts: VaultMutationConflict[];
25
27
  progress: SandboxVaultSyncProgress;
26
- blockedReason?: 'filesystem_incarnation_missing' | 'filesystem_incarnation_not_ready' | 'vault_directory_missing' | 'sandbox_deletion_denied';
28
+ blockedReason?: 'filesystem_incarnation_missing' | 'filesystem_incarnation_not_ready' | 'vault_directory_missing' | 'sandbox_deletion_denied' | 'mass_deletion_guard';
27
29
  baselineResetReason?: 'baseline_missing' | 'filesystem_incarnation_changed';
28
30
  }
29
31
  /**
@@ -41,6 +43,12 @@ export declare function assertSandboxVaultReconciliation(workspaceId: string, re
41
43
  export interface SandboxVaultSyncOptions {
42
44
  sessionId?: string;
43
45
  operationId?: string;
46
+ /** Attribution the commits carry. */
47
+ provenance?: VaultWriteProvenance;
48
+ /** Refuse, before any commit, a box file the Vault has no live head for (a retained mirror that must not promote unknown bytes). */
49
+ canonicalPathsOnly?: boolean;
50
+ onPhase?: (phase: 'baseline-read' | 'manifest' | 'canonical-heads' | 'file-reads' | 'head-reads' | 'plan-changes' | 'staged' | 'mutate' | 'baseline-write' | 'box-sync-invalidate') => void;
51
+ onStage?: SandboxVaultSyncStageObserver;
44
52
  onStaged?: (checkpoint: {
45
53
  operationId: string;
46
54
  changes: SandboxVaultSyncChange[];
@@ -1,12 +1,16 @@
1
+ import { type VaultDeletionPolicy } from '../server';
1
2
  import type { VaultHeadState, VaultMutationRequest, VaultMutationResult, VaultSandboxBaseline } from './revisions';
2
3
  import type { VaultFrontmatterCodec, VaultHeadListOptions, VaultHeadListPage } from './store';
3
4
  import type { VaultBoxStateView, VaultBoxSyncRecord } from './box-state';
5
+ import type { VaultHydrationBox } from './sandbox-hydrate';
4
6
  /** The store calls the sync engine makes; `createVaultStore` returns all of them. */
5
7
  export interface SandboxVaultSyncStore {
6
8
  codec: VaultFrontmatterCodec;
7
9
  listVaultHeadPage(workspaceId: string, options?: VaultHeadListOptions): Promise<VaultHeadListPage>;
8
10
  readVaultFileState(workspaceId: string, filePath: string): Promise<VaultHeadState>;
9
11
  commitVaultMutation(request: VaultMutationRequest): Promise<VaultMutationResult>;
12
+ /** The committed revision at or before `headRevision` whose content hash is `contentHash`, or null. */
13
+ findVaultRevisionWithContent(workspaceId: string, path: string, headRevision: string, contentHash: string): Promise<string | null>;
10
14
  readVaultSandboxBaseline(workspaceId: string, sandboxId: string): Promise<VaultSandboxBaseline | null>;
11
15
  writeVaultSandboxBaseline(baseline: VaultSandboxBaseline): Promise<void>;
12
16
  readVaultBoxState(workspaceId: string): Promise<VaultBoxStateView | null>;
@@ -26,7 +30,29 @@ export interface SandboxVaultSyncConfig {
26
30
  * box re-hydrates on its next turn. Defaults to `SANDBOX_VAULT_SYNC_CONTRACT`.
27
31
  */
28
32
  contract?: string;
33
+ /**
34
+ * How a box may delete Vault files. `'rename-only'` (the default) commits a
35
+ * delete only as half of a same-content rename. `guard` commits any delete
36
+ * unless the batch trips `assessVaultDeletionBatch` (an empty scan, every
37
+ * file, or most of a large Vault), which withholds every delete of the pass.
38
+ */
39
+ deletes?: 'rename-only' | {
40
+ guard: VaultDeletionPolicy;
41
+ };
42
+ /** Root-relative directories that hold no Vault files, such as a private session tree; reconcile never scans them. */
43
+ excludeDirs?: readonly string[];
44
+ /** Writes one request's text files to the box; defaults to `box.fs.writeMany`. */
45
+ writeText?: (box: VaultHydrationBox, files: Array<{
46
+ path: string;
47
+ content: string;
48
+ }>) => Promise<void>;
49
+ /** Leave a file with no baseline entry in place when the box already holds its exact bytes (a box restored from a snapshot). */
50
+ skipFilesAlreadyOnBox?: boolean;
51
+ /** Leave a file the box refuses for its size off the box and report it in `skipped`, instead of failing hydration. */
52
+ skipOversizeFiles?: boolean;
29
53
  }
54
+ /** A sync stage's timing, for product telemetry. */
55
+ export type SandboxVaultSyncStageObserver = (stage: 'baseline_read' | 'head_list' | 'kv_read' | 'sandbox_write' | 'baseline_write' | 'reconcile_scan' | 'reconcile_import', startedAt: number, detail?: Record<string, number>) => void;
30
56
  /** The engine's own hydration contract; a product appends its own when its box layout changes. */
31
57
  export declare const SANDBOX_VAULT_SYNC_CONTRACT = "agent-app-sandbox-vault-sync-v1";
32
58
  /** The body prefix of a Vault document whose remainder is base64-encoded binary bytes. */
@@ -7,3 +7,4 @@ export * from './mime';
7
7
  export * from './timeout';
8
8
  export * from './fetch-guard';
9
9
  export * from './chat-stream-error';
10
+ export { expandSpeakerRows, SPEAKER_ROLE_LABEL, type Speaker, type SpeakerRow } from './speakers';
package/dist/web/index.js CHANGED
@@ -8,7 +8,11 @@ import {
8
8
  parseChatStreamErrorEvent,
9
9
  parseRetryAfterSeconds,
10
10
  readFirstTouchAcquisition
11
- } from "../chunk-H6BRJU5M.js";
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, FileMention } from '../chat-routes/wire';
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: FileMention[]) => void;
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. */
@@ -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-LAZCUQFZ.js";
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-GGJYAV7R.js";
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-P7UB7ZVP.js";
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-AICYKYYF.js";
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-QGJOT6R6.js";
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 value —
97
- * the send-body list (map through `fileMentionsToParts`). */
98
- mentions: FileMention[];
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
  ];