@collective-intelligence/ai 0.0.0-stage → 0.8.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 (172) hide show
  1. package/AGENTS.md +52 -0
  2. package/README.md +462 -2
  3. package/dist/api/access-check.d.ts +18 -0
  4. package/dist/api/answer-sources.d.ts +48 -0
  5. package/dist/api/attachments-api.d.ts +187 -0
  6. package/dist/api/catalog-api.d.ts +408 -0
  7. package/dist/api/chat-api.d.ts +2401 -0
  8. package/dist/api/chat-surface-api.d.ts +4186 -0
  9. package/dist/api/compaction.d.ts +52 -0
  10. package/dist/api/conversations.d.ts +107 -0
  11. package/dist/api/errors.d.ts +117 -0
  12. package/dist/api/feedback-api.d.ts +185 -0
  13. package/dist/api/files.d.ts +22 -0
  14. package/dist/api/ids.d.ts +33 -0
  15. package/dist/api/index.d.ts +21 -0
  16. package/dist/api/intents-api.d.ts +65 -0
  17. package/dist/api/place-context.d.ts +34 -0
  18. package/dist/api/projects-api.d.ts +718 -0
  19. package/dist/api/speech-api.d.ts +345 -0
  20. package/dist/api/transcript.d.ts +260 -0
  21. package/dist/api/turns.d.ts +196 -0
  22. package/dist/api.d.ts +21 -0
  23. package/dist/api.js +1 -0
  24. package/dist/domain/access.d.ts +29 -0
  25. package/dist/domain/context-trail.d.ts +65 -0
  26. package/dist/domain/data-parts.d.ts +247 -0
  27. package/dist/domain/errors.d.ts +28 -0
  28. package/dist/domain/index.d.ts +14 -0
  29. package/dist/domain/intents.d.ts +101 -0
  30. package/dist/domain/message.d.ts +173 -0
  31. package/dist/domain/place.d.ts +17 -0
  32. package/dist/domain/runtime-value.d.ts +16 -0
  33. package/dist/domain-50vzrrp9.js +2 -0
  34. package/dist/domain-5fpd4fte.js +1 -0
  35. package/dist/domain-9wzbv87n.js +2 -0
  36. package/dist/domain-g97xs965.js +2 -0
  37. package/dist/domain-hk3yw2m7.js +1 -0
  38. package/dist/domain-qyts6dgz.js +0 -0
  39. package/dist/domain-s07s1ry1.js +2 -0
  40. package/dist/domain.d.ts +14 -0
  41. package/dist/domain.js +1 -0
  42. package/dist/headless/access/access-store.d.ts +28 -0
  43. package/dist/headless/access/visibility.d.ts +24 -0
  44. package/dist/headless/blocked-state.d.ts +21 -0
  45. package/dist/headless/chat-registry.d.ts +63 -0
  46. package/dist/headless/chat-session-provider.d.ts +109 -0
  47. package/dist/headless/chat-surface.d.ts +4210 -0
  48. package/dist/headless/host-ports.d.ts +146 -0
  49. package/dist/headless/index.d.ts +33 -0
  50. package/dist/headless/intents/card-ends.d.ts +22 -0
  51. package/dist/headless/intents/intent-call.d.ts +28 -0
  52. package/dist/headless/intents/intents-provider.d.ts +108 -0
  53. package/dist/headless/intents/page-registry.d.ts +129 -0
  54. package/dist/headless/intents/use-intent-dispatch.d.ts +60 -0
  55. package/dist/headless/intents/use-intents.d.ts +11 -0
  56. package/dist/headless/intents/use-returned-intent-handle.d.ts +11 -0
  57. package/dist/headless/launch/chat-launch.d.ts +42 -0
  58. package/dist/headless/launch/launch-target.d.ts +25 -0
  59. package/dist/headless/launch/submit.d.ts +29 -0
  60. package/dist/headless/run-state.d.ts +16 -0
  61. package/dist/headless/sent-files.d.ts +20 -0
  62. package/dist/headless/server-started-turn-follow.proof.d.ts +26 -0
  63. package/dist/headless/session-machine.d.ts +745 -0
  64. package/dist/headless/trail/buffer.d.ts +48 -0
  65. package/dist/headless/trail/json-ld.d.ts +10 -0
  66. package/dist/headless/trail/switches.d.ts +10 -0
  67. package/dist/headless/trail/trail-provider.d.ts +53 -0
  68. package/dist/headless/transcript-messages.d.ts +26 -0
  69. package/dist/headless.d.ts +33 -0
  70. package/dist/headless.js +2 -0
  71. package/dist/transport/chat-client.d.ts +25 -0
  72. package/dist/transport/chat-transport.d.ts +57 -0
  73. package/dist/transport/index.d.ts +6 -0
  74. package/dist/transport/simulated-chat-transport.d.ts +39 -0
  75. package/dist/transport.d.ts +6 -0
  76. package/dist/transport.js +1 -0
  77. package/dist/views/assistant-sidebar/assistant-sidebar.d.ts +15 -0
  78. package/dist/views/assistant-sidebar/layout.d.ts +47 -0
  79. package/dist/views/assistant-sidebar/toggle.d.ts +14 -0
  80. package/dist/views/assistant-sidebar/use-shortcut.d.ts +11 -0
  81. package/dist/views/blocked/chat-blocked-state.d.ts +15 -0
  82. package/dist/views/chat-operations.d.ts +46 -0
  83. package/dist/views/chat-root.d.ts +14 -0
  84. package/dist/views/chat.d.ts +51 -0
  85. package/dist/views/composer/capability-picker.d.ts +77 -0
  86. package/dist/views/composer/capability-pickers.d.ts +24 -0
  87. package/dist/views/composer/chat-composer.d.ts +15 -0
  88. package/dist/views/composer/composer-picks.d.ts +31 -0
  89. package/dist/views/composer/composer-trail.d.ts +21 -0
  90. package/dist/views/composer/draft-attachments.d.ts +36 -0
  91. package/dist/views/composer/queued-messages.d.ts +9 -0
  92. package/dist/views/composer/send-menu.d.ts +11 -0
  93. package/dist/views/composer/slash-suggestions.d.ts +37 -0
  94. package/dist/views/composer/trail-chips.d.ts +15 -0
  95. package/dist/views/composer/voice-input/microphone.d.ts +14 -0
  96. package/dist/views/composer/voice-input/remote-transcription.d.ts +12 -0
  97. package/dist/views/composer/voice-input/use-voice-input.d.ts +30 -0
  98. package/dist/views/composer/voice-input/voice-input.d.ts +15 -0
  99. package/dist/views/dock/chat-dock.d.ts +57 -0
  100. package/dist/views/dock/dock-session.d.ts +22 -0
  101. package/dist/views/header/chat-header.d.ts +10 -0
  102. package/dist/views/header/compaction-controls.d.ts +17 -0
  103. package/dist/views/header/memory-switch.d.ts +16 -0
  104. package/dist/views/index.d.ts +58 -0
  105. package/dist/views/intents/form-fields.d.ts +38 -0
  106. package/dist/views/intents/intent-card.d.ts +61 -0
  107. package/dist/views/intents/intent-form.d.ts +23 -0
  108. package/dist/views/intents/intent-notices.d.ts +39 -0
  109. package/dist/views/intents/intent-trigger.d.ts +46 -0
  110. package/dist/views/intents/labels.d.ts +23 -0
  111. package/dist/views/labels/en.d.ts +3 -0
  112. package/dist/views/labels/index.d.ts +13 -0
  113. package/dist/views/labels/it.d.ts +3 -0
  114. package/dist/views/labels/types.d.ts +7 -0
  115. package/dist/views/launch/chat-launch-button.d.ts +21 -0
  116. package/dist/views/parts/answer-feedback.d.ts +26 -0
  117. package/dist/views/parts/evidence-part.d.ts +8 -0
  118. package/dist/views/parts/file-part.d.ts +8 -0
  119. package/dist/views/parts/image-generation-part.d.ts +9 -0
  120. package/dist/views/parts/image-generation.d.ts +84 -0
  121. package/dist/views/parts/intent-card-part.d.ts +8 -0
  122. package/dist/views/parts/memory-evidence-part.d.ts +7 -0
  123. package/dist/views/parts/message-parts.d.ts +21 -0
  124. package/dist/views/parts/question-part.d.ts +8 -0
  125. package/dist/views/parts/read-aloud.d.ts +23 -0
  126. package/dist/views/parts/reasoning-part.d.ts +8 -0
  127. package/dist/views/parts/steering-message-part.d.ts +7 -0
  128. package/dist/views/parts/text-part.d.ts +4 -0
  129. package/dist/views/parts/tool-part.d.ts +11 -0
  130. package/dist/views/parts/types.d.ts +103 -0
  131. package/dist/views/parts/use-read-aloud.d.ts +13 -0
  132. package/dist/views/run-trace/message-run.d.ts +17 -0
  133. package/dist/views/run-trace/run-stream.d.ts +128 -0
  134. package/dist/views/run-trace/run-trace-parts.d.ts +26 -0
  135. package/dist/views/run-trace/run-trace.d.ts +31 -0
  136. package/dist/views/sidebar/conversation-dialogs.d.ts +38 -0
  137. package/dist/views/sidebar/conversation-row.d.ts +23 -0
  138. package/dist/views/sidebar/conversation-sidebar.d.ts +10 -0
  139. package/dist/views/sidebar/date-groups.d.ts +12 -0
  140. package/dist/views/sidebar/history-filter.d.ts +57 -0
  141. package/dist/views/sidebar/projects/project-dialogs.d.ts +40 -0
  142. package/dist/views/sidebar/projects/project-files.d.ts +16 -0
  143. package/dist/views/sidebar/projects/project-groups.d.ts +19 -0
  144. package/dist/views/sidebar/projects/project-view.d.ts +21 -0
  145. package/dist/views/sidebar/projects/projects-section.d.ts +21 -0
  146. package/dist/views/sidebar/projects/use-chat-projects.d.ts +32 -0
  147. package/dist/views/slots.d.ts +148 -0
  148. package/dist/views/transcript/chat-transcript.d.ts +13 -0
  149. package/dist/views/transcript/sent-trail.d.ts +13 -0
  150. package/dist/views/transcript/use-image-reload.d.ts +16 -0
  151. package/dist/views.d.ts +58 -0
  152. package/dist/views.js +3 -0
  153. package/docs/guide/ai/index.md +377 -0
  154. package/docs/guide/ai/studio.md +245 -0
  155. package/docs/guide/data/connectors.md +267 -0
  156. package/docs/guide/data/datasets.md +145 -0
  157. package/docs/guide/data/documents.md +235 -0
  158. package/docs/guide/data/index.md +62 -0
  159. package/docs/guide/data/knowledge.md +214 -0
  160. package/docs/guide/develop/extensions.md +299 -0
  161. package/docs/guide/develop/external-apps.md +279 -0
  162. package/docs/guide/develop/infrastructure.md +135 -0
  163. package/docs/guide/develop/sdks.md +233 -0
  164. package/docs/guide/index.md +83 -0
  165. package/docs/guide/platform/access.md +311 -0
  166. package/docs/guide/platform/architecture.md +166 -0
  167. package/docs/guide/platform/built-ins.md +225 -0
  168. package/docs/guide/platform/entrypoints.md +318 -0
  169. package/docs/guide/scenarios/index.md +130 -0
  170. package/docs/guide/template/index.md +295 -0
  171. package/docs/guide/template/state-machines.md +294 -0
  172. package/package.json +123 -4
@@ -0,0 +1,13 @@
1
+ import type { InvocationId } from "../../api/index.js";
2
+ import type { ChatReadAloudPlayback } from "./types.js";
3
+ /**
4
+ * Reads the answer of `invocationId` aloud, one part at a time (AC-153):
5
+ * the server splits the answer, the client asks for part 0 and for part
6
+ * n + 1 only after part n ended; each read answers a fresh signed URL. One
7
+ * audio element, created in the click, plays every part. Stopping, or
8
+ * leaving, stops the audio.
9
+ */
10
+ export declare const useReadAloud: (invocationId: InvocationId) => {
11
+ playback: ChatReadAloudPlayback;
12
+ toggle: () => void;
13
+ };
@@ -0,0 +1,17 @@
1
+ import type { InvocationId } from "../../api/index.js";
2
+ import type { ChatLabels, ChatLocale } from "../labels/index.js";
3
+ import type { ChatMessagePartComponents } from "../parts/types.js";
4
+ type MessageRunProps = Readonly<{
5
+ labels: ChatLabels;
6
+ locale: ChatLocale;
7
+ messageParts?: ChatMessagePartComponents | undefined;
8
+ /** The turn of the answer: the root run that its run stream follows. */
9
+ runId: InvocationId;
10
+ }>;
11
+ /**
12
+ * The run of an answer inside the chat (AC-358): a closed line that opens
13
+ * the answer's `<RunTrace>`, with the run's status, its steps and its run
14
+ * trace link. The run stream is read only once the user opens it.
15
+ */
16
+ export declare const MessageRun: ({ labels, locale, messageParts, runId }: MessageRunProps) => import("react").JSX.Element;
17
+ export {};
@@ -0,0 +1,128 @@
1
+ import * as Effect from "effect/Effect";
2
+ import * as Schema from "effect/Schema";
3
+ import type { ChatSurfaceClient } from "../../api/index.js";
4
+ import type { AiError, AiResult, CiUIMessage } from "../../domain/index.js";
5
+ import { InvocationId } from "../../api/index.js";
6
+ import { AiFailureError } from "../../domain/index.js";
7
+ /**
8
+ * Where a run is, as its run stream tells it: `loading` before the stream
9
+ * starts; `running` while it follows the run; `waiting` when the run waits
10
+ * for an approval or an answer (`finish` without a reason); `completed`,
11
+ * `cancelled` or `failed` once the run ended (`finish` with `stop`, `other`
12
+ * or `error`).
13
+ */
14
+ export type RunTraceStatus = "cancelled" | "completed" | "failed" | "loading" | "running" | "waiting";
15
+ /** What a run trace shows: the run as one assistant message, and how it stands. */
16
+ export type RunTraceState = Readonly<{
17
+ /** The run's masked error, when it failed. */
18
+ errorText: string | null;
19
+ /** Why the run stream could not be read: refused, not found or not reachable. */
20
+ failure: AiError | null;
21
+ /** The run's parts and metadata (its trace link); `null` until the stream starts. */
22
+ message: CiUIMessage | null;
23
+ status: RunTraceStatus;
24
+ }>;
25
+ /** Runs one operation of the typed client, as `useChatSession().call` does. */
26
+ export type RunTraceCall = <A, E>(operation: (client: ChatSurfaceClient) => Effect.Effect<A, E>) => Promise<AiResult<A>>;
27
+ export declare const loadingRun: RunTraceState;
28
+ /**
29
+ * Reads `GET /runs/:runId/stream` through the typed client (ARC-040,
30
+ * FLOW-014): the run as one assistant message, built by the AI SDK from the
31
+ * stream's chunks, so its metadata takes the trace link of `start` and of
32
+ * `finish`. Each change goes to `update`; a refusal fails the operation. It
33
+ * stops reading when `signal` aborts.
34
+ */
35
+ export declare const readRunStream: (runId: InvocationId, update: (state: Partial<RunTraceState>) => void, signal: AbortSignal) => (client: ChatSurfaceClient) => Effect.Effect<"aborted" | undefined, AiFailureError | import("effect/http/HttpClientError").HttpClientError | Schema.SchemaError | {
36
+ readonly correlationId: string;
37
+ readonly error: {
38
+ readonly code: "conflict";
39
+ readonly message: string;
40
+ readonly retryable: boolean;
41
+ readonly details?: {
42
+ readonly reason: "intent_turn_agent" | "intent_turn_busy" | "turn_ended";
43
+ };
44
+ };
45
+ readonly ok: false;
46
+ } | {
47
+ readonly correlationId: string;
48
+ readonly error: {
49
+ readonly code: "forbidden";
50
+ readonly message: string;
51
+ readonly retryable: boolean;
52
+ readonly details: {
53
+ readonly reason: "app_disabled" | "approval_not_allowed" | "capability_missing" | "not_available_here" | "principal_not_allowed";
54
+ };
55
+ };
56
+ readonly ok: false;
57
+ } | {
58
+ readonly correlationId: string;
59
+ readonly error: {
60
+ readonly code: "internal";
61
+ readonly message: string;
62
+ readonly retryable: boolean;
63
+ };
64
+ readonly ok: false;
65
+ } | {
66
+ readonly correlationId: string;
67
+ readonly error: {
68
+ readonly code: "invalid_request";
69
+ readonly message: string;
70
+ readonly retryable: boolean;
71
+ readonly details?: {
72
+ readonly filename?: string;
73
+ readonly reason: "malformed" | "oversized" | "too_many_files" | "unsupported";
74
+ };
75
+ };
76
+ readonly ok: false;
77
+ } | {
78
+ readonly correlationId: string;
79
+ readonly error: {
80
+ readonly code: "not_found";
81
+ readonly message: string;
82
+ readonly retryable: boolean;
83
+ };
84
+ readonly ok: false;
85
+ } | {
86
+ readonly correlationId: string;
87
+ readonly error: {
88
+ readonly code: "rate_limited";
89
+ readonly message: string;
90
+ readonly retryable: boolean;
91
+ };
92
+ readonly ok: false;
93
+ } | {
94
+ readonly correlationId: string;
95
+ readonly error: {
96
+ readonly code: "unauthenticated";
97
+ readonly message: string;
98
+ readonly retryable: boolean;
99
+ };
100
+ readonly ok: false;
101
+ } | {
102
+ readonly correlationId: string;
103
+ readonly error: {
104
+ readonly code: "unavailable";
105
+ readonly message: string;
106
+ readonly retryable: boolean;
107
+ };
108
+ readonly ok: false;
109
+ }, never>;
110
+ /**
111
+ * The run trace of one run: it reads the run stream while React subscribes
112
+ * to it (after the first commit, so a render never starts a request), stops
113
+ * reading when the last subscriber leaves, and reads again on `retry`.
114
+ */
115
+ export declare const makeRunTraceStore: (runId: string, call: RunTraceCall) => {
116
+ getSnapshot: () => Readonly<{
117
+ /** The run's masked error, when it failed. */
118
+ errorText: string | null;
119
+ /** Why the run stream could not be read: refused, not found or not reachable. */
120
+ failure: AiError | null;
121
+ /** The run's parts and metadata (its trace link); `null` until the stream starts. */
122
+ message: CiUIMessage | null;
123
+ status: RunTraceStatus;
124
+ }>;
125
+ /** Reads the run stream again from the start, after a failure. */
126
+ retry: () => void;
127
+ subscribe: (listener: () => void) => () => void;
128
+ };
@@ -0,0 +1,26 @@
1
+ import type { CiUIMessage } from "../../domain/index.js";
2
+ import type { ChatLabels } from "../labels/index.js";
3
+ import type { ChatPartRenderers } from "../parts/message-parts.js";
4
+ /** The line status of a part: `running` only while the run still runs. */
5
+ type LineStatus = "error" | "running" | undefined;
6
+ /** The `status` prop of a line: none for a line that neither runs nor failed. */
7
+ export declare const statusProp: (status: LineStatus) => {
8
+ status?: never;
9
+ } | {
10
+ status: "error" | "running";
11
+ };
12
+ type RunTracePartsProps = Readonly<{
13
+ labels: ChatLabels;
14
+ message: CiUIMessage;
15
+ renderers: ChatPartRenderers;
16
+ /** `true` while the run runs: a line that waits shows that it runs. */
17
+ running: boolean;
18
+ }>;
19
+ /**
20
+ * The parts of a run (Q217): tool calls and reasoning as lines of the
21
+ * ui-react Trace, one Trace per run of them, and the other parts with the
22
+ * chat's part renderers. The trace is read-only: an approval or a question
23
+ * shows its state, and the chat answers it.
24
+ */
25
+ export declare const RunTraceParts: ({ labels, message, renderers, running }: RunTracePartsProps) => import("react").JSX.Element[];
26
+ export {};
@@ -0,0 +1,31 @@
1
+ import type { ChatSurfaceOptions } from "../../headless/index.js";
2
+ import type { ChatLabels, ChatLocale } from "../labels/index.js";
3
+ import type { ChatMessagePartComponents } from "../parts/types.js";
4
+ export type RunTraceProps = Readonly<{
5
+ /**
6
+ * The mount whose run stream the trace reads, as for `ChatSessionProvider`.
7
+ * Without it, the trace reads through the Chat Session of the nearest
8
+ * `ChatSessionProvider`, for example a run inside the chat.
9
+ */
10
+ api?: ChatSurfaceOptions;
11
+ /** A class name beside the `data-part="run-trace"` attribute. */
12
+ className?: string | undefined;
13
+ /** Labels that replace the labels of the locale with the same name. */
14
+ labels?: Partial<ChatLabels> | undefined;
15
+ /** The language of the labels; `en` when not set. */
16
+ locale?: ChatLocale | undefined;
17
+ /** Renderers that replace the default renderer of a message part. */
18
+ messageParts?: ChatMessagePartComponents | undefined;
19
+ /** The run: the root invocation that `GET /runs/:runId/stream` follows. */
20
+ runId: string;
21
+ }>;
22
+ /**
23
+ * A run as assistant message parts (AC-358, AC-400): it reads
24
+ * `GET /runs/:runId/stream` through the typed client, before or after the
25
+ * run ended, and shows the run's status, its steps with the ui-react Trace,
26
+ * its other parts with the chat's renderers, and the run trace link. It
27
+ * follows a running run live and reads again for another `runId`. The
28
+ * server decides what a reader sees: a first-level stream has no text, no
29
+ * tool input or output and no trace link.
30
+ */
31
+ export declare const RunTrace: ({ api, ...props }: RunTraceProps) => import("react").JSX.Element;
@@ -0,0 +1,38 @@
1
+ import type { Conversation, ConversationId, Project } from "../../api/index.js";
2
+ import type { ChatAction } from "../chat-operations.js";
3
+ import type { ChatLabels } from "../labels/index.js";
4
+ import type { ConversationRowActions } from "./conversation-row.js";
5
+ /** The Conversation that a dialog asks about, by dialog. */
6
+ type ConversationDialog = Readonly<{
7
+ conversation: Conversation;
8
+ kind: "delete" | "rename";
9
+ }>;
10
+ type ConversationDialogsOptions = Readonly<{
11
+ /** Called after the open Conversation was deleted. */
12
+ onDeletedOpen: () => void;
13
+ onSelect: (conversationId: ConversationId) => void;
14
+ /** The Projects of the move items; `undefined` hides them. */
15
+ projects: readonly Project[] | undefined;
16
+ }>;
17
+ /**
18
+ * The rename, move and delete writes of the Conversations of a list, the
19
+ * row actions that start them, and the dialog that is open. Each write
20
+ * reads the Conversation list again.
21
+ */
22
+ /** The writes and the open dialog of a list of Conversations. */
23
+ export type ConversationListWrites = Readonly<{
24
+ actions: ConversationRowActions;
25
+ close: () => void;
26
+ dialog: ConversationDialog | undefined;
27
+ remove: (conversation: Conversation) => void;
28
+ /** The rename, move or delete that runs or ran last. */
29
+ write: ChatAction;
30
+ }>;
31
+ export declare const useConversationDialogs: ({ onDeletedOpen, onSelect, projects }: ConversationDialogsOptions) => ConversationListWrites;
32
+ type ConversationDialogsProps = Readonly<{
33
+ dialogs: ConversationListWrites;
34
+ labels: ChatLabels;
35
+ }>;
36
+ /** The rename and delete dialogs that `useConversationDialogs` opens. */
37
+ export declare const ConversationDialogs: ({ dialogs: { close, dialog, remove, write }, labels }: ConversationDialogsProps) => import("react").JSX.Element;
38
+ export {};
@@ -0,0 +1,23 @@
1
+ import type { Conversation, ConversationId, Project, ProjectId } from "../../api/index.js";
2
+ import type { ChatLabels } from "../labels/index.js";
3
+ /** What the row menu of a Conversation does. */
4
+ export type ConversationRowActions = Readonly<{
5
+ onDelete: (conversation: Conversation) => void;
6
+ /** Moves the Conversation into a Project, or out of its Project with `null`. */
7
+ onMove: (conversation: Conversation, projectId: ProjectId | null) => void;
8
+ onRename: (conversation: Conversation) => void;
9
+ onSelect: (conversationId: ConversationId) => void;
10
+ /** The Projects of the move items; `undefined` hides them. */
11
+ projects: readonly Project[] | undefined;
12
+ }>;
13
+ type ConversationRowProps = Readonly<{
14
+ actions: ConversationRowActions;
15
+ active: boolean;
16
+ conversation: Conversation;
17
+ labels: ChatLabels;
18
+ /** The name of the Origin of a Conversation from another Place. */
19
+ placeName: string | undefined;
20
+ }>;
21
+ /** One Conversation of a list, with its place name and its rename, move and delete menu. */
22
+ export declare const ConversationRow: ({ actions, active, conversation, labels, placeName }: ConversationRowProps) => import("react").JSX.Element;
23
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { ConversationSidebarProps } from "../slots.js";
2
+ /**
3
+ * The Conversation list of the default chat: the new chat button, the title
4
+ * search, the History Scope filter, the Draft row of a new chat, the Projects
5
+ * with their Conversations, and the other listed Conversations by date
6
+ * group, each with its place name when it comes from another Place. The chat
7
+ * places it beside the transcript from the Studio breakpoint, in a sheet
8
+ * below it.
9
+ */
10
+ export declare const ConversationSidebar: ({ className, history, labels, newChat, projects, selectConversation, slots }: ConversationSidebarProps) => import("react").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import type { Conversation } from "../../api/index.js";
2
+ /** A date group of the Conversation list, by the last activity of its Conversations. */
3
+ export type ChatDateGroup = "earlier" | "previous_seven_days" | "today" | "yesterday";
4
+ /** One date group with its Conversations, in list order. */
5
+ export type ChatDateGroupRows = Readonly<{
6
+ conversations: readonly Conversation[];
7
+ group: ChatDateGroup;
8
+ }>;
9
+ /** The Conversations by date group: only the groups that hold one, in fixed order. */
10
+ export declare const groupByActivity: (conversations: readonly Conversation[], now: Date) => readonly ChatDateGroupRows[];
11
+ /** Tells whether the title of a Conversation holds the search text, in any case. */
12
+ export declare const matchesSearch: (title: string, search: string) => boolean;
@@ -0,0 +1,57 @@
1
+ import type { Conversation, PlaceContext } from "../../api/index.js";
2
+ import type { Place } from "../../domain/index.js";
3
+ import type { ChatLabels } from "../labels/index.js";
4
+ /** A choice of the Conversation list filter. */
5
+ export type ChatHistoryFilterValue = "all_listed" | "this_place";
6
+ /** The Conversation list filter that the chat gives its sidebar. */
7
+ export type ChatHistoryFilter = Readonly<{
8
+ /** The two choices with their labels, "This place" first (AC-046). */
9
+ options: readonly Readonly<{
10
+ label: string;
11
+ value: ChatHistoryFilterValue;
12
+ }>[];
13
+ /** Changes the choice; the list follows it. */
14
+ setValue: (value: ChatHistoryFilterValue) => void;
15
+ /** The choice; `this_place` when the chat starts (AC-048). */
16
+ value: ChatHistoryFilterValue;
17
+ /**
18
+ * `true` when the History Scope before the user's choice holds a Place
19
+ * other than the chat's Place; the default sidebar shows the filter only
20
+ * then (AC-047, AC-278).
21
+ */
22
+ visible: boolean;
23
+ }>;
24
+ /** The History Scope of the chat as its sidebar needs it. */
25
+ export type ChatHistory = Readonly<{
26
+ filter: ChatHistoryFilter;
27
+ /** The Conversations that the list shows: the developer's subset, then the user's choice. */
28
+ listed: (conversations: readonly Conversation[]) => readonly Conversation[];
29
+ /**
30
+ * The place name on the row of a Conversation from another Place: the
31
+ * name that the place context gives it, `unknownPlace` without one;
32
+ * `undefined` for a Conversation of the chat's Place (AC-051, AC-279).
33
+ */
34
+ placeNameOf: (origin: Place) => string | undefined;
35
+ }>;
36
+ type HistoryOptions = Readonly<{
37
+ /** The developer's subset of the History Scope Ceiling (AC-245). */
38
+ historyScope: readonly Place[] | undefined;
39
+ labels: Pick<ChatLabels, "allListedPlaces" | "thisPlace" | "unknownPlace">;
40
+ place: Place;
41
+ /** The place context; `null` until it answers. */
42
+ placeContext: PlaceContext | null;
43
+ }>;
44
+ /**
45
+ * The History Scope of the chat: the allowed Places of the place context,
46
+ * narrowed by the developer's `historyScope`, then by the user's filter.
47
+ * The caller Place is always listed.
48
+ */
49
+ export declare const useChatHistory: ({ historyScope, labels, place, placeContext }: HistoryOptions) => ChatHistory;
50
+ type HistoryFilterProps = Readonly<{
51
+ filter: ChatHistoryFilter;
52
+ /** The accessible name of the choice group. */
53
+ label: string;
54
+ }>;
55
+ /** The choices of the Conversation list filter, "This place" first. */
56
+ export declare const HistoryFilter: ({ filter, label }: HistoryFilterProps) => import("react").JSX.Element;
57
+ export {};
@@ -0,0 +1,40 @@
1
+ import type { Project } from "../../../api/index.js";
2
+ import type { ChatLabels } from "../../labels/index.js";
3
+ import type { ChatProjects } from "./use-chat-projects.js";
4
+ /** The dialog of a Project that is open. */
5
+ export type ProjectDialog = Readonly<{
6
+ kind: "create";
7
+ }> | Readonly<{
8
+ kind: "delete" | "rename";
9
+ project: Project;
10
+ }>;
11
+ type ProjectActionsProps = Readonly<{
12
+ labels: ChatLabels;
13
+ onOpen: (dialog: ProjectDialog) => void;
14
+ project: Project;
15
+ }>;
16
+ /** The rename and delete menu of a Project. */
17
+ export declare const ProjectActions: ({ labels, onOpen, project }: ProjectActionsProps) => import("react").JSX.Element;
18
+ type ProjectDialogsProps = Readonly<{
19
+ dialog: ProjectDialog | null;
20
+ labels: ChatLabels;
21
+ /** Opens a new chat; called when the deleted Project held the open chat. */
22
+ newChat: () => void;
23
+ onClose: () => void;
24
+ projects: ChatProjects;
25
+ }>;
26
+ /**
27
+ * The create, rename and delete dialogs of a Project. A created Project
28
+ * opens its view; a delete also deletes its Conversations on the server, so
29
+ * a chat in it starts over as a new chat.
30
+ */
31
+ export declare const ProjectDialogs: ({ dialog, labels, newChat, onClose, projects }: ProjectDialogsProps) => import("react").JSX.Element;
32
+ /** The open Project dialog of one place of the chat. */
33
+ /** The open Project dialog, and the handlers that open and close it. */
34
+ export type ProjectDialogState = Readonly<{
35
+ dialog: ProjectDialog | null;
36
+ handleClose: () => void;
37
+ handleOpen: (dialog: ProjectDialog | null) => void;
38
+ }>;
39
+ export declare const useProjectDialog: () => ProjectDialogState;
40
+ export {};
@@ -0,0 +1,16 @@
1
+ import type { ProjectId } from "../../../api/index.js";
2
+ import type { ChatLabels, ChatLocale } from "../../labels/index.js";
3
+ type ProjectFilesSectionProps = Readonly<{
4
+ labels: ChatLabels;
5
+ locale: ChatLocale;
6
+ /** The open Project; give the section a `key` with it. */
7
+ projectId: ProjectId;
8
+ }>;
9
+ /**
10
+ * The Project Files of the open Project, as the server describes them: the
11
+ * use of the file text budget, the files, and the files to add. A file that
12
+ * the server would refuse for its type, its size or a full Project is not
13
+ * sent; the others go one at a time, in the order chosen.
14
+ */
15
+ export declare const ProjectFilesSection: ({ labels, locale, projectId }: ProjectFilesSectionProps) => import("react").JSX.Element;
16
+ export {};
@@ -0,0 +1,19 @@
1
+ import type { Conversation, Project } from "../../../api/index.js";
2
+ /** A Project of the sidebar with its listed Conversations. */
3
+ export type ProjectGroup = Readonly<{
4
+ conversations: readonly Conversation[];
5
+ project: Project;
6
+ }>;
7
+ /** The Conversations of the list, split into the Projects section and the rest. */
8
+ export type ProjectSplit = Readonly<{
9
+ /** The Conversations outside a shown Project, for the date groups. */
10
+ others: readonly Conversation[];
11
+ projectGroups: readonly ProjectGroup[];
12
+ }>;
13
+ /**
14
+ * Splits the listed Conversations into the Projects section and the date
15
+ * groups. A Conversation shows under its Project only when its Project is
16
+ * listed. A search keeps the matching Conversations and hides each Project
17
+ * without a match. Projects come in the order of their latest activity.
18
+ */
19
+ export declare const splitByProject: (conversations: readonly Conversation[], projects: readonly Project[], search: string) => ProjectSplit;
@@ -0,0 +1,21 @@
1
+ import type { ConversationId, Project } from "../../../api/index.js";
2
+ import type { ChatLabels, ChatLocale } from "../../labels/index.js";
3
+ import type { ChatHistory } from "../history-filter.js";
4
+ import type { ChatProjects } from "./use-chat-projects.js";
5
+ type ProjectViewProps = Readonly<{
6
+ history: ChatHistory;
7
+ labels: ChatLabels;
8
+ locale: ChatLocale;
9
+ newChat: () => void;
10
+ /** The Project whose view is open. */
11
+ project: Project;
12
+ projects: ChatProjects;
13
+ selectConversation: (conversationId: ConversationId) => void;
14
+ }>;
15
+ /**
16
+ * The main area of an open Project: its instructions, its files and its
17
+ * Conversations. The composer under it starts a new Conversation in the
18
+ * Project.
19
+ */
20
+ export declare const ProjectView: ({ history, labels, locale, newChat, project, projects, selectConversation }: ProjectViewProps) => import("react").JSX.Element;
21
+ export {};
@@ -0,0 +1,21 @@
1
+ import type { ConversationId } from "../../../api/index.js";
2
+ import type { Place } from "../../../domain/index.js";
3
+ import type { ChatLabels } from "../../labels/index.js";
4
+ import type { ConversationRowActions } from "../conversation-row.js";
5
+ import type { ProjectGroup } from "./project-groups.js";
6
+ import type { ChatProjects } from "./use-chat-projects.js";
7
+ type ProjectsSectionProps = Readonly<{
8
+ activeConversationId: ConversationId | null;
9
+ /** The Projects with their Conversations, after the search. */
10
+ groups: readonly ProjectGroup[];
11
+ /** A search is on: each Project shows its matches, unfolded. */
12
+ isSearch: boolean;
13
+ labels: ChatLabels;
14
+ newChat: () => void;
15
+ placeNameOf: (origin: Place) => string | undefined;
16
+ projects: ChatProjects;
17
+ rowActions: ConversationRowActions;
18
+ }>;
19
+ /** The Projects of the chat, above the date groups of the Conversation list. */
20
+ export declare const ProjectsSection: ({ groups, newChat, ...entryProps }: ProjectsSectionProps) => import("react").JSX.Element;
21
+ export {};
@@ -0,0 +1,32 @@
1
+ import type { Project, ProjectId } from "../../../api/index.js";
2
+ /** The Projects of a chat and the Project view of its main area. */
3
+ export type ChatProjects = Readonly<{
4
+ /**
5
+ * `false` when the `flags` port turns Projects off, or the server answers
6
+ * that Projects are not available here (off for the Organization, or a
7
+ * host with no `flags` port such as an External App): hide every Project
8
+ * control (AC-190).
9
+ */
10
+ enabled: boolean;
11
+ /** `true` when the last read of the Project list failed. */
12
+ failed: boolean;
13
+ /** Leaves the Project view. */
14
+ leaveProject: () => void;
15
+ /** The Projects that the server shows to the user in this Place; `undefined` until they are read. */
16
+ list: readonly Project[] | undefined;
17
+ /** Opens the view of a Project in place of a Conversation: a new chat in that Project. */
18
+ openProjectView: (projectId: ProjectId) => void;
19
+ /** Reads the Projects and the Conversations again, after a Project write. */
20
+ reload: () => void;
21
+ /** The Project whose view the main area shows; `undefined` while it shows a Conversation. */
22
+ viewed: Project | undefined;
23
+ /** The id of the Project of the open new chat, if it started in a Project view. */
24
+ viewedId: ProjectId | undefined;
25
+ }>;
26
+ /**
27
+ * The Projects of a chat, without UI: the list that the server shows (the
28
+ * client computes no Project Visibility) and the Project view. The view
29
+ * shows while no Conversation is open; opening it opens a new chat in its
30
+ * Project.
31
+ */
32
+ export declare const useChatProjects: () => ChatProjects;