@collective-intelligence/ai 0.0.0-placeholder.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/AGENTS.md +52 -0
  2. package/README.md +463 -1
  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 +120 -4
@@ -0,0 +1,52 @@
1
+ import * as Schema from "effect/Schema";
2
+ /** The compaction of a Conversation: its active summary and what it covers. */
3
+ export declare const CompactionState: Schema.Struct<{
4
+ readonly active: Schema.Boolean;
5
+ readonly activeSummary: Schema.NullOr<Schema.Struct<{
6
+ readonly id: Schema.String;
7
+ readonly status: Schema.String;
8
+ readonly summary: Schema.String;
9
+ readonly trigger: Schema.String;
10
+ }>>;
11
+ readonly boundary: Schema.NullOr<Schema.Struct<{
12
+ readonly compactedThroughInvocationId: Schema.NullOr<Schema.brand<Schema.String, "@collective-intelligence/ai/InvocationId">>;
13
+ readonly coveredInvocationCount: Schema.Int;
14
+ readonly coveredMessageCount: Schema.Int;
15
+ }>>;
16
+ }>;
17
+ /** The answer of the compaction read, a new compaction, its regeneration and its reset. */
18
+ export declare const CompactionResponse: Schema.Struct<{
19
+ readonly compaction: Schema.Struct<{
20
+ readonly active: Schema.Boolean;
21
+ readonly activeSummary: Schema.NullOr<Schema.Struct<{
22
+ readonly id: Schema.String;
23
+ readonly status: Schema.String;
24
+ readonly summary: Schema.String;
25
+ readonly trigger: Schema.String;
26
+ }>>;
27
+ readonly boundary: Schema.NullOr<Schema.Struct<{
28
+ readonly compactedThroughInvocationId: Schema.NullOr<Schema.brand<Schema.String, "@collective-intelligence/ai/InvocationId">>;
29
+ readonly coveredInvocationCount: Schema.Int;
30
+ readonly coveredMessageCount: Schema.Int;
31
+ }>>;
32
+ }>;
33
+ /** The Conversation after the operation, for clients that cache it. */
34
+ readonly conversation: Schema.Struct<{
35
+ readonly agentId: Schema.NullOr<Schema.brand<Schema.String, "@collective-intelligence/ai/AgentId">>;
36
+ readonly createdAt: Schema.NullOr<Schema.Date>;
37
+ readonly id: Schema.brand<Schema.String, "@collective-intelligence/ai/ConversationId">;
38
+ readonly lastActivityAt: Schema.NullOr<Schema.Date>;
39
+ readonly lastActivityInvocationId: Schema.NullOr<Schema.String>;
40
+ readonly memoryEnabled: Schema.Boolean;
41
+ readonly organizationId: Schema.String;
42
+ readonly origin: Schema.Codec<import("../domain.js").Place, import("../domain.js").Place, never, never>;
43
+ readonly projectId: Schema.NullOr<Schema.brand<Schema.String, "@collective-intelligence/ai/ProjectId">>;
44
+ readonly subject: Schema.NullOr<Schema.Struct<{
45
+ readonly id: Schema.String;
46
+ readonly kind: Schema.Literals<readonly ["skill_draft", "report_draft", "entity_schema_draft", "organization_identity", "workflow_working_copy"]>;
47
+ }>>;
48
+ readonly title: Schema.String;
49
+ readonly updatedAt: Schema.NullOr<Schema.Date>;
50
+ readonly userId: Schema.NullOr<Schema.String>;
51
+ }>;
52
+ }>;
@@ -0,0 +1,107 @@
1
+ import * as Schema from "effect/Schema";
2
+ import type { Place } from "../domain/index.js";
3
+ export declare const PlaceKind: Schema.Literals<readonly ["studio_app", "external_app", "dashboard"]>;
4
+ /** A Place: the Studio app id, the External App's application id or the Organization id, by kind. */
5
+ export declare const PlaceSchema: Schema.Codec<Place>;
6
+ /**
7
+ * The draft that a Conversation works on (D19): one kind of Dashboard draft
8
+ * and its id. Only the Dashboard mount links a Conversation to a draft.
9
+ */
10
+ export declare const ConversationSubjectSchema: Schema.Struct<{
11
+ readonly id: Schema.String;
12
+ readonly kind: Schema.Literals<readonly ["skill_draft", "report_draft", "entity_schema_draft", "organization_identity", "workflow_working_copy"]>;
13
+ }>;
14
+ export type ConversationSubject = typeof ConversationSubjectSchema.Type;
15
+ /** The Conversation that a request names. */
16
+ export declare const ConversationPath: Schema.Struct<{
17
+ readonly conversationId: Schema.brand<Schema.String, "@collective-intelligence/ai/ConversationId">;
18
+ }>;
19
+ /**
20
+ * A Conversation of the caller: the Agent it is bound to (null for a plain
21
+ * chat), its Project (null without one), its Origin, the Place where it
22
+ * started, and the draft it works on (null without one). The binding only
23
+ * routes later messages: each turn and transcript read rechecks the Agent's
24
+ * audience.
25
+ */
26
+ export declare const ConversationSchema: Schema.Struct<{
27
+ readonly agentId: Schema.NullOr<Schema.brand<Schema.String, "@collective-intelligence/ai/AgentId">>;
28
+ readonly createdAt: Schema.NullOr<Schema.Date>;
29
+ readonly id: Schema.brand<Schema.String, "@collective-intelligence/ai/ConversationId">;
30
+ readonly lastActivityAt: Schema.NullOr<Schema.Date>;
31
+ readonly lastActivityInvocationId: Schema.NullOr<Schema.String>;
32
+ readonly memoryEnabled: Schema.Boolean;
33
+ readonly organizationId: Schema.String;
34
+ /** The Place where the Conversation started; it never changes. */
35
+ readonly origin: Schema.Codec<Place, Place, never, never>;
36
+ readonly projectId: Schema.NullOr<Schema.brand<Schema.String, "@collective-intelligence/ai/ProjectId">>;
37
+ /** The draft that the Conversation works on; null when it works on none. */
38
+ readonly subject: Schema.NullOr<Schema.Struct<{
39
+ readonly id: Schema.String;
40
+ readonly kind: Schema.Literals<readonly ["skill_draft", "report_draft", "entity_schema_draft", "organization_identity", "workflow_working_copy"]>;
41
+ }>>;
42
+ readonly title: Schema.String;
43
+ readonly updatedAt: Schema.NullOr<Schema.Date>;
44
+ /** The owning user; null when an app server or an Anonymous Visitor owns the Conversation. */
45
+ readonly userId: Schema.NullOr<Schema.String>;
46
+ }>;
47
+ export type Conversation = typeof ConversationSchema.Type;
48
+ export declare const ListConversationsQuery: Schema.Struct<{
49
+ /**
50
+ * The client subset of the History Scope, one `historyScope` per Place. It
51
+ * only narrows: a Place outside the History Scope Ceiling adds nothing, and
52
+ * the caller Place is always listed.
53
+ */
54
+ readonly historyScope: Schema.optionalKey<Schema.$Array<Schema.decodeTo<Schema.Codec<Place, Place, never, never>, Schema.TemplateLiteralParser<readonly [Schema.Literals<readonly ["studio_app", "external_app", "dashboard"]>, ":", Schema.String]>, never, never>>>;
55
+ /**
56
+ * Only the Conversations that work on this draft, the one with the latest
57
+ * activity first, so a docked chat opens its draft's Conversation again.
58
+ */
59
+ readonly subject: Schema.optionalKey<Schema.decodeTo<Schema.Struct<{
60
+ readonly id: Schema.String;
61
+ readonly kind: Schema.Literals<readonly ["skill_draft", "report_draft", "entity_schema_draft", "organization_identity", "workflow_working_copy"]>;
62
+ }>, Schema.TemplateLiteralParser<readonly [Schema.Literals<readonly ["skill_draft", "report_draft", "entity_schema_draft", "organization_identity", "workflow_working_copy"]>, ":", Schema.String]>, never, never>>;
63
+ }>;
64
+ export declare const ListConversationsResponse: Schema.Struct<{
65
+ readonly data: Schema.$Array<Schema.Struct<{
66
+ readonly agentId: Schema.NullOr<Schema.brand<Schema.String, "@collective-intelligence/ai/AgentId">>;
67
+ readonly createdAt: Schema.NullOr<Schema.Date>;
68
+ readonly id: Schema.brand<Schema.String, "@collective-intelligence/ai/ConversationId">;
69
+ readonly lastActivityAt: Schema.NullOr<Schema.Date>;
70
+ readonly lastActivityInvocationId: Schema.NullOr<Schema.String>;
71
+ readonly memoryEnabled: Schema.Boolean;
72
+ readonly organizationId: Schema.String;
73
+ /** The Place where the Conversation started; it never changes. */
74
+ readonly origin: Schema.Codec<Place, Place, never, never>;
75
+ readonly projectId: Schema.NullOr<Schema.brand<Schema.String, "@collective-intelligence/ai/ProjectId">>;
76
+ /** The draft that the Conversation works on; null when it works on none. */
77
+ readonly subject: Schema.NullOr<Schema.Struct<{
78
+ readonly id: Schema.String;
79
+ readonly kind: Schema.Literals<readonly ["skill_draft", "report_draft", "entity_schema_draft", "organization_identity", "workflow_working_copy"]>;
80
+ }>>;
81
+ readonly title: Schema.String;
82
+ readonly updatedAt: Schema.NullOr<Schema.Date>;
83
+ /** The owning user; null when an app server or an Anonymous Visitor owns the Conversation. */
84
+ readonly userId: Schema.NullOr<Schema.String>;
85
+ }>>;
86
+ }>;
87
+ /**
88
+ * The start of a Conversation. It takes the caller Place as its Origin; no
89
+ * field names a Place.
90
+ */
91
+ export declare const CreateConversationRequest: Schema.Struct<{
92
+ /** Binds the new Conversation to this Agent; the caller must be admitted. */
93
+ readonly agentId: Schema.optionalKey<Schema.brand<Schema.String, "@collective-intelligence/ai/AgentId">>;
94
+ /** Starts the Conversation in this Project of the caller. */
95
+ readonly projectId: Schema.optionalKey<Schema.brand<Schema.String, "@collective-intelligence/ai/ProjectId">>;
96
+ readonly title: Schema.optionalKey<Schema.String>;
97
+ }>;
98
+ /** A rename, the memory switch of the Conversation, or a move between Projects. */
99
+ export declare const UpdateConversationRequest: Schema.Struct<{
100
+ readonly memoryEnabled: Schema.optionalKey<Schema.Boolean>;
101
+ /**
102
+ * Moves the Conversation into this Project; null removes it from its
103
+ * Project. An absent key changes no membership.
104
+ */
105
+ readonly projectId: Schema.optionalKey<Schema.NullOr<Schema.brand<Schema.String, "@collective-intelligence/ai/ProjectId">>>;
106
+ readonly title: Schema.optionalKey<Schema.String>;
107
+ }>;
@@ -0,0 +1,117 @@
1
+ import * as Schema from "effect/Schema";
2
+ /**
3
+ * Why the chat refuses a known caller (`forbidden`): no conversation
4
+ * capability within the app's Max Privileges, a disabled or removed app, a
5
+ * principal that may not chat, a Conversation outside the lists of the
6
+ * caller Place or whose Agent the Place does not offer, or an approval that
7
+ * the caller may not decide.
8
+ */
9
+ export declare const chatRefusalReasons: readonly ["capability_missing", "app_disabled", "principal_not_allowed", "not_available_here", "approval_not_allowed"];
10
+ export type ChatRefusalReason = (typeof chatRefusalReasons)[number];
11
+ /**
12
+ * Why a request conflicts with the Conversation (`conflict`): an answer to
13
+ * an approval or a question names a turn that has ended, so no turn takes
14
+ * it any more; the chat reads the Conversation again and shows no failure.
15
+ * A Chat Launch of an Intent finds a turn that still runs
16
+ * (`intent_turn_busy`) or an Agent conversation (`intent_turn_agent`); the
17
+ * chat shows why. A conflict without a reason (another turn runs) is a
18
+ * failure.
19
+ */
20
+ export declare const chatConflictReasons: readonly ["turn_ended", "intent_turn_busy", "intent_turn_agent"];
21
+ export type ChatConflictReason = (typeof chatConflictReasons)[number];
22
+ /** Why the chat refuses an uploaded file (`invalid_request`). */
23
+ export declare const uploadRejectionReasons: readonly ["unsupported", "oversized", "malformed", "too_many_files"];
24
+ export type UploadRejectionReason = (typeof uploadRejectionReasons)[number];
25
+ /**
26
+ * The failures of every chat operation, one envelope per code. The mount
27
+ * maps its admission refusals and the handler failures onto them.
28
+ */
29
+ export declare const chatFailures: readonly [Schema.Struct<{
30
+ readonly correlationId: Schema.String;
31
+ readonly error: Schema.Struct<{
32
+ /** Set when an uploaded file was refused: why, and the first refused file. */
33
+ readonly details: Schema.optionalKey<Schema.Struct<{
34
+ readonly filename: Schema.optionalKey<Schema.String>;
35
+ readonly reason: Schema.Literals<readonly ["unsupported", "oversized", "malformed", "too_many_files"]>;
36
+ }>>;
37
+ } & {
38
+ readonly code: Schema.Literal<"invalid_request">;
39
+ readonly message: Schema.String;
40
+ /** True when the same request can succeed later without a change. */
41
+ readonly retryable: Schema.Boolean;
42
+ }>;
43
+ readonly ok: Schema.Literal<false>;
44
+ }>, Schema.Struct<{
45
+ readonly correlationId: Schema.String;
46
+ readonly error: Schema.Struct<{
47
+ readonly code: Schema.Literal<"unauthenticated">;
48
+ readonly message: Schema.String;
49
+ /** True when the same request can succeed later without a change. */
50
+ readonly retryable: Schema.Boolean;
51
+ }>;
52
+ readonly ok: Schema.Literal<false>;
53
+ }>, Schema.Struct<{
54
+ readonly correlationId: Schema.String;
55
+ readonly error: Schema.Struct<{
56
+ readonly details: Schema.Struct<{
57
+ readonly reason: Schema.Literals<readonly ["capability_missing", "app_disabled", "principal_not_allowed", "not_available_here", "approval_not_allowed"]>;
58
+ }>;
59
+ } & {
60
+ readonly code: Schema.Literal<"forbidden">;
61
+ readonly message: Schema.String;
62
+ /** True when the same request can succeed later without a change. */
63
+ readonly retryable: Schema.Boolean;
64
+ }>;
65
+ readonly ok: Schema.Literal<false>;
66
+ }>, Schema.Struct<{
67
+ readonly correlationId: Schema.String;
68
+ readonly error: Schema.Struct<{
69
+ readonly code: Schema.Literal<"not_found">;
70
+ readonly message: Schema.String;
71
+ /** True when the same request can succeed later without a change. */
72
+ readonly retryable: Schema.Boolean;
73
+ }>;
74
+ readonly ok: Schema.Literal<false>;
75
+ }>, Schema.Struct<{
76
+ readonly correlationId: Schema.String;
77
+ readonly error: Schema.Struct<{
78
+ readonly details: Schema.optionalKey<Schema.Struct<{
79
+ readonly reason: Schema.Literals<readonly ["turn_ended", "intent_turn_busy", "intent_turn_agent"]>;
80
+ }>>;
81
+ } & {
82
+ readonly code: Schema.Literal<"conflict">;
83
+ readonly message: Schema.String;
84
+ /** True when the same request can succeed later without a change. */
85
+ readonly retryable: Schema.Boolean;
86
+ }>;
87
+ readonly ok: Schema.Literal<false>;
88
+ }>, Schema.Struct<{
89
+ readonly correlationId: Schema.String;
90
+ readonly error: Schema.Struct<{
91
+ readonly code: Schema.Literal<"rate_limited">;
92
+ readonly message: Schema.String;
93
+ /** True when the same request can succeed later without a change. */
94
+ readonly retryable: Schema.Boolean;
95
+ }>;
96
+ readonly ok: Schema.Literal<false>;
97
+ }>, Schema.Struct<{
98
+ readonly correlationId: Schema.String;
99
+ readonly error: Schema.Struct<{
100
+ readonly code: Schema.Literal<"internal">;
101
+ readonly message: Schema.String;
102
+ /** True when the same request can succeed later without a change. */
103
+ readonly retryable: Schema.Boolean;
104
+ }>;
105
+ readonly ok: Schema.Literal<false>;
106
+ }>, Schema.Struct<{
107
+ readonly correlationId: Schema.String;
108
+ readonly error: Schema.Struct<{
109
+ readonly code: Schema.Literal<"unavailable">;
110
+ readonly message: Schema.String;
111
+ /** True when the same request can succeed later without a change. */
112
+ readonly retryable: Schema.Boolean;
113
+ }>;
114
+ readonly ok: Schema.Literal<false>;
115
+ }>];
116
+ /** One failure of a chat operation, as the client decodes it. */
117
+ export type ChatFailure = (typeof chatFailures)[number]["Type"];
@@ -0,0 +1,185 @@
1
+ import { HttpApiEndpoint, HttpApiGroup } from "effect/http-api";
2
+ import * as Schema from "effect/Schema";
3
+ /** The caller's rating of an answer; null fields when there is none. */
4
+ export declare const CurrentUserFeedback: Schema.Struct<{
5
+ readonly sentiment: Schema.NullOr<Schema.Literals<readonly ["positive", "negative"]>>;
6
+ readonly submitterNote: Schema.NullOr<Schema.String>;
7
+ }>;
8
+ declare const ChatFeedbackApi_base: HttpApiGroup.HttpApiGroup<"chatFeedback", HttpApiEndpoint.HttpApiEndpoint<"clearAnswerFeedback", "DELETE", "/chat/answers/:invocationId/feedback", Schema.toCodecStringTree<Schema.Struct<{
9
+ readonly invocationId: Schema.brand<Schema.String, "@collective-intelligence/ai/InvocationId">;
10
+ }>>, never, never, never, Schema.toCodecJson<Schema.Struct<{
11
+ readonly currentUserFeedback: Schema.Struct<{
12
+ readonly sentiment: Schema.NullOr<Schema.Literals<readonly ["positive", "negative"]>>;
13
+ readonly submitterNote: Schema.NullOr<Schema.String>;
14
+ }>;
15
+ readonly feedbackTargetId: Schema.String;
16
+ }>>, Schema.toCodecJson<Schema.Struct<{
17
+ readonly correlationId: Schema.String;
18
+ readonly error: Schema.Struct<{
19
+ readonly details: Schema.optionalKey<Schema.Struct<{
20
+ readonly reason: Schema.Literals<readonly ["turn_ended", "intent_turn_busy", "intent_turn_agent"]>;
21
+ }>>;
22
+ } & {
23
+ readonly code: Schema.Literal<"conflict">;
24
+ readonly message: Schema.String;
25
+ readonly retryable: Schema.Boolean;
26
+ }>;
27
+ readonly ok: Schema.Literal<false>;
28
+ }> | Schema.Struct<{
29
+ readonly correlationId: Schema.String;
30
+ readonly error: Schema.Struct<{
31
+ readonly details: Schema.Struct<{
32
+ readonly reason: Schema.Literals<readonly ["capability_missing", "app_disabled", "principal_not_allowed", "not_available_here", "approval_not_allowed"]>;
33
+ }>;
34
+ } & {
35
+ readonly code: Schema.Literal<"forbidden">;
36
+ readonly message: Schema.String;
37
+ readonly retryable: Schema.Boolean;
38
+ }>;
39
+ readonly ok: Schema.Literal<false>;
40
+ }> | Schema.Struct<{
41
+ readonly correlationId: Schema.String;
42
+ readonly error: Schema.Struct<{
43
+ readonly code: Schema.Literal<"internal">;
44
+ readonly message: Schema.String;
45
+ readonly retryable: Schema.Boolean;
46
+ }>;
47
+ readonly ok: Schema.Literal<false>;
48
+ }> | Schema.Struct<{
49
+ readonly correlationId: Schema.String;
50
+ readonly error: Schema.Struct<{
51
+ readonly details: Schema.optionalKey<Schema.Struct<{
52
+ readonly filename: Schema.optionalKey<Schema.String>;
53
+ readonly reason: Schema.Literals<readonly ["unsupported", "oversized", "malformed", "too_many_files"]>;
54
+ }>>;
55
+ } & {
56
+ readonly code: Schema.Literal<"invalid_request">;
57
+ readonly message: Schema.String;
58
+ readonly retryable: Schema.Boolean;
59
+ }>;
60
+ readonly ok: Schema.Literal<false>;
61
+ }> | Schema.Struct<{
62
+ readonly correlationId: Schema.String;
63
+ readonly error: Schema.Struct<{
64
+ readonly code: Schema.Literal<"not_found">;
65
+ readonly message: Schema.String;
66
+ readonly retryable: Schema.Boolean;
67
+ }>;
68
+ readonly ok: Schema.Literal<false>;
69
+ }> | Schema.Struct<{
70
+ readonly correlationId: Schema.String;
71
+ readonly error: Schema.Struct<{
72
+ readonly code: Schema.Literal<"rate_limited">;
73
+ readonly message: Schema.String;
74
+ readonly retryable: Schema.Boolean;
75
+ }>;
76
+ readonly ok: Schema.Literal<false>;
77
+ }> | Schema.Struct<{
78
+ readonly correlationId: Schema.String;
79
+ readonly error: Schema.Struct<{
80
+ readonly code: Schema.Literal<"unauthenticated">;
81
+ readonly message: Schema.String;
82
+ readonly retryable: Schema.Boolean;
83
+ }>;
84
+ readonly ok: Schema.Literal<false>;
85
+ }> | Schema.Struct<{
86
+ readonly correlationId: Schema.String;
87
+ readonly error: Schema.Struct<{
88
+ readonly code: Schema.Literal<"unavailable">;
89
+ readonly message: Schema.String;
90
+ readonly retryable: Schema.Boolean;
91
+ }>;
92
+ readonly ok: Schema.Literal<false>;
93
+ }>>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"putAnswerFeedback", "PUT", "/chat/answers/:invocationId/feedback", Schema.toCodecStringTree<Schema.Struct<{
94
+ readonly invocationId: Schema.brand<Schema.String, "@collective-intelligence/ai/InvocationId">;
95
+ }>>, never, Schema.toCodecJson<Schema.Struct<{
96
+ readonly sentiment: Schema.Literals<readonly ["positive", "negative"]>;
97
+ readonly submitterNote: Schema.optionalKey<Schema.String>;
98
+ }>>, never, Schema.toCodecJson<Schema.Struct<{
99
+ readonly currentUserFeedback: Schema.Struct<{
100
+ readonly sentiment: Schema.NullOr<Schema.Literals<readonly ["positive", "negative"]>>;
101
+ readonly submitterNote: Schema.NullOr<Schema.String>;
102
+ }>;
103
+ readonly feedbackTargetId: Schema.String;
104
+ }>>, Schema.toCodecJson<Schema.Struct<{
105
+ readonly correlationId: Schema.String;
106
+ readonly error: Schema.Struct<{
107
+ readonly details: Schema.optionalKey<Schema.Struct<{
108
+ readonly reason: Schema.Literals<readonly ["turn_ended", "intent_turn_busy", "intent_turn_agent"]>;
109
+ }>>;
110
+ } & {
111
+ readonly code: Schema.Literal<"conflict">;
112
+ readonly message: Schema.String;
113
+ readonly retryable: Schema.Boolean;
114
+ }>;
115
+ readonly ok: Schema.Literal<false>;
116
+ }> | Schema.Struct<{
117
+ readonly correlationId: Schema.String;
118
+ readonly error: Schema.Struct<{
119
+ readonly details: Schema.Struct<{
120
+ readonly reason: Schema.Literals<readonly ["capability_missing", "app_disabled", "principal_not_allowed", "not_available_here", "approval_not_allowed"]>;
121
+ }>;
122
+ } & {
123
+ readonly code: Schema.Literal<"forbidden">;
124
+ readonly message: Schema.String;
125
+ readonly retryable: Schema.Boolean;
126
+ }>;
127
+ readonly ok: Schema.Literal<false>;
128
+ }> | Schema.Struct<{
129
+ readonly correlationId: Schema.String;
130
+ readonly error: Schema.Struct<{
131
+ readonly code: Schema.Literal<"internal">;
132
+ readonly message: Schema.String;
133
+ readonly retryable: Schema.Boolean;
134
+ }>;
135
+ readonly ok: Schema.Literal<false>;
136
+ }> | Schema.Struct<{
137
+ readonly correlationId: Schema.String;
138
+ readonly error: Schema.Struct<{
139
+ readonly details: Schema.optionalKey<Schema.Struct<{
140
+ readonly filename: Schema.optionalKey<Schema.String>;
141
+ readonly reason: Schema.Literals<readonly ["unsupported", "oversized", "malformed", "too_many_files"]>;
142
+ }>>;
143
+ } & {
144
+ readonly code: Schema.Literal<"invalid_request">;
145
+ readonly message: Schema.String;
146
+ readonly retryable: Schema.Boolean;
147
+ }>;
148
+ readonly ok: Schema.Literal<false>;
149
+ }> | Schema.Struct<{
150
+ readonly correlationId: Schema.String;
151
+ readonly error: Schema.Struct<{
152
+ readonly code: Schema.Literal<"not_found">;
153
+ readonly message: Schema.String;
154
+ readonly retryable: Schema.Boolean;
155
+ }>;
156
+ readonly ok: Schema.Literal<false>;
157
+ }> | Schema.Struct<{
158
+ readonly correlationId: Schema.String;
159
+ readonly error: Schema.Struct<{
160
+ readonly code: Schema.Literal<"rate_limited">;
161
+ readonly message: Schema.String;
162
+ readonly retryable: Schema.Boolean;
163
+ }>;
164
+ readonly ok: Schema.Literal<false>;
165
+ }> | Schema.Struct<{
166
+ readonly correlationId: Schema.String;
167
+ readonly error: Schema.Struct<{
168
+ readonly code: Schema.Literal<"unauthenticated">;
169
+ readonly message: Schema.String;
170
+ readonly retryable: Schema.Boolean;
171
+ }>;
172
+ readonly ok: Schema.Literal<false>;
173
+ }> | Schema.Struct<{
174
+ readonly correlationId: Schema.String;
175
+ readonly error: Schema.Struct<{
176
+ readonly code: Schema.Literal<"unavailable">;
177
+ readonly message: Schema.String;
178
+ readonly retryable: Schema.Boolean;
179
+ }>;
180
+ readonly ok: Schema.Literal<false>;
181
+ }>>, never, never>, false>;
182
+ /** The caller's feedback on one answer: its rating and its clear. */
183
+ export declare class ChatFeedbackApi extends ChatFeedbackApi_base {
184
+ }
185
+ export {};
@@ -0,0 +1,22 @@
1
+ import * as Schema from "effect/Schema";
2
+ /** The parser `maxFileSize` of a chat upload. */
3
+ export declare const maxUploadPartBytes: number;
4
+ /** The most chat attachments of one upload. */
5
+ export declare const maxAttachmentsPerUpload = 10;
6
+ /** A presigned storage URL of a stored file; no file bytes go through the backend. */
7
+ export declare const DownloadUrl: Schema.Struct<{
8
+ readonly expiresIn: Schema.Int;
9
+ readonly url: Schema.String;
10
+ }>;
11
+ /** One stored chat attachment and the state of its text extraction. */
12
+ export declare const storedAttachmentFields: {
13
+ characterCount: Schema.Int;
14
+ contentType: Schema.NullOr<Schema.String>;
15
+ extension: Schema.NullOr<Schema.String>;
16
+ extractionStatus: Schema.String;
17
+ filename: Schema.String;
18
+ id: Schema.brand<Schema.String, "@collective-intelligence/ai/AttachmentId">;
19
+ sizeBytes: Schema.Int;
20
+ truncated: Schema.Boolean;
21
+ unavailableReason: Schema.NullOr<Schema.String>;
22
+ };
@@ -0,0 +1,33 @@
1
+ import * as Schema from "effect/Schema";
2
+ /** A UUID as the chat contract carries it. */
3
+ export declare const Uuid: Schema.String;
4
+ /** A Conversation. */
5
+ export declare const ConversationId: Schema.brand<Schema.String, "@collective-intelligence/ai/ConversationId">;
6
+ export type ConversationId = typeof ConversationId.Type;
7
+ /**
8
+ * One Harness invocation: a turn, the answer it gives, or the root
9
+ * invocation of a run (`/runs/:runId/stream`).
10
+ */
11
+ export declare const InvocationId: Schema.brand<Schema.String, "@collective-intelligence/ai/InvocationId">;
12
+ export type InvocationId = typeof InvocationId.Type;
13
+ /** An Agent that a Conversation can be bound to. */
14
+ export declare const AgentId: Schema.brand<Schema.String, "@collective-intelligence/ai/AgentId">;
15
+ export type AgentId = typeof AgentId.Type;
16
+ /** A Project of the caller. */
17
+ export declare const ProjectId: Schema.brand<Schema.String, "@collective-intelligence/ai/ProjectId">;
18
+ export type ProjectId = typeof ProjectId.Type;
19
+ /** A Project File. */
20
+ export declare const ProjectFileId: Schema.brand<Schema.String, "@collective-intelligence/ai/ProjectFileId">;
21
+ export type ProjectFileId = typeof ProjectFileId.Type;
22
+ /** A chat attachment of a Conversation. */
23
+ export declare const AttachmentId: Schema.brand<Schema.String, "@collective-intelligence/ai/AttachmentId">;
24
+ export type AttachmentId = typeof AttachmentId.Type;
25
+ /** A Queued Message of a Conversation. */
26
+ export declare const QueuedMessageId: Schema.brand<Schema.String, "@collective-intelligence/ai/QueuedMessageId">;
27
+ export type QueuedMessageId = typeof QueuedMessageId.Type;
28
+ /** A Steering Message of a turn. */
29
+ export declare const SteeringMessageId: Schema.brand<Schema.String, "@collective-intelligence/ai/SteeringMessageId">;
30
+ export type SteeringMessageId = typeof SteeringMessageId.Type;
31
+ /** A recorded voice clip, uploaded for one transcription. */
32
+ export declare const SpeechClipId: Schema.brand<Schema.String, "@collective-intelligence/ai/SpeechClipId">;
33
+ export type SpeechClipId = typeof SpeechClipId.Type;
@@ -0,0 +1,21 @@
1
+ export type { AccessCheckOptions, AccessCheckPort, AccessCheckResponse } from "./access-check.js";
2
+ export { ChatAttachmentsApi } from "./attachments-api.js";
3
+ export { ChatCatalogApi } from "./catalog-api.js";
4
+ export type { CatalogAgent, CatalogSkill, CatalogTool } from "./catalog-api.js";
5
+ export { ChatApi } from "./chat-api.js";
6
+ export { ChatSurfaceApi, makeChatSurfaceClient } from "./chat-surface-api.js";
7
+ export type { ChatSurfaceClient, ChatSurfaceClientOptions } from "./chat-surface-api.js";
8
+ export type { Conversation, ConversationSubject } from "./conversations.js";
9
+ export { chatConflictReasons, chatRefusalReasons, uploadRejectionReasons } from "./errors.js";
10
+ export type { ChatConflictReason, ChatFailure, ChatRefusalReason, UploadRejectionReason } from "./errors.js";
11
+ export { ChatFeedbackApi } from "./feedback-api.js";
12
+ export { intentOperationIds } from "./intents-api.js";
13
+ export type { IntentCallOptions, IntentInput, IntentOperationId, IntentOperations, IntentOutput, IntentsApi } from "./intents-api.js";
14
+ export { AgentId, AttachmentId, ConversationId, InvocationId, ProjectFileId, ProjectId, QueuedMessageId, SpeechClipId, SteeringMessageId } from "./ids.js";
15
+ export type { PlaceContext } from "./place-context.js";
16
+ export { ChatProjectsApi } from "./projects-api.js";
17
+ export type { Project, ProjectFile } from "./projects-api.js";
18
+ export { ChatSpeechApi } from "./speech-api.js";
19
+ export { TranscriptSchema } from "./transcript.js";
20
+ export type { Transcript } from "./transcript.js";
21
+ export type { ChatSendRequest, QueuedMessage, QueueMessageResponse, SendSteeringMessageResponse, TurnWait } from "./turns.js";
@@ -0,0 +1,65 @@
1
+ import type { AiResult, IntentCatalogEntry, IntentDispatchEnd, IntentDispatchOutcome, IntentDispatchRecordState, IntentHandle, IntentResultTarget, IntentReturnPage, JsonObject } from "../domain/index.js";
2
+ /**
3
+ * One Intent Dispatch. The caller makes one idempotency key for each user
4
+ * action; a repeat with the same key and request replays the dispatch. A
5
+ * chat Result Target makes a Chat Launch instead of a dispatch, so it never
6
+ * reaches `IntentsApi`.
7
+ */
8
+ type IntentDispatchInput = {
9
+ readonly fqn: string;
10
+ readonly idempotencyKey: string;
11
+ readonly inputs: JsonObject;
12
+ } & ({
13
+ readonly resultTarget: Extract<IntentResultTarget, "notification">;
14
+ readonly returnPage?: IntentReturnPage;
15
+ } | {
16
+ readonly resultTarget: Extract<IntentResultTarget, "nothing">;
17
+ });
18
+ interface Operation<Input, Output> {
19
+ readonly input: Input;
20
+ readonly output: Output;
21
+ }
22
+ /**
23
+ * The Intent operations by operation id. A read or a wait by any caller
24
+ * other than the dispatching caller answers `not_found`. An Intent Handle
25
+ * has no cancel operation.
26
+ */
27
+ export interface IntentOperations {
28
+ /**
29
+ * Dispatches an Intent by its FQN. A temporary platform failure answers
30
+ * the retryable `unavailable` error; a repeated key with another request
31
+ * answers `conflict`. Neither is an outcome.
32
+ */
33
+ readonly dispatch: Operation<IntentDispatchInput, IntentDispatchOutcome>;
34
+ readonly list: Operation<Readonly<Record<string, never>>, readonly IntentCatalogEntry[]>;
35
+ readonly read: Operation<{
36
+ readonly handle: IntentHandle;
37
+ }, IntentDispatchRecordState>;
38
+ /**
39
+ * Resolves at the end of the run: the adapter repeats the bounded server
40
+ * wait while the run is still running.
41
+ */
42
+ readonly wait: Operation<{
43
+ readonly handle: IntentHandle;
44
+ }, IntentDispatchEnd>;
45
+ }
46
+ export type IntentOperationId = keyof IntentOperations;
47
+ export type IntentInput<Op extends IntentOperationId> = IntentOperations[Op]["input"];
48
+ export type IntentOutput<Op extends IntentOperationId> = IntentOperations[Op]["output"];
49
+ /** Every Intent operation id, for adapters that map each one. */
50
+ export declare const intentOperationIds: readonly IntentOperationId[];
51
+ export interface IntentCallOptions {
52
+ readonly signal?: AbortSignal;
53
+ }
54
+ /**
55
+ * The Intents contract (Q16): a contract of its own, not a group of
56
+ * `ChatSurfaceApi`, so an Intent control works with no chat. Each host fills
57
+ * it with an adapter over its Intent routes: the Studio over its Studio
58
+ * routes, the External App client SDK over the application routes, a test
59
+ * over a stub. `call` answers every failure as an `AiError`; a refused
60
+ * dispatch is an outcome, not an error.
61
+ */
62
+ export interface IntentsApi {
63
+ readonly call: <Op extends IntentOperationId>(op: Op, input: IntentInput<Op>, options?: IntentCallOptions) => Promise<AiResult<IntentOutput<Op>>>;
64
+ }
65
+ export {};
@@ -0,0 +1,34 @@
1
+ import * as Schema from "effect/Schema";
2
+ /** What a chat client needs of the caller Place, read once at chat start. */
3
+ export declare const PlaceContextSchema: Schema.Struct<{
4
+ /**
5
+ * "Context Trail enabled" of the caller Place: off sends no Context Trail
6
+ * with a turn; on without Place Settings. `false` when an older backend
7
+ * does not send it (AC-225; AC-226 keeps the backend authoritative).
8
+ */
9
+ readonly contextTrailEnabled: Schema.withDecodingDefaultKey<Schema.Boolean, never>;
10
+ /**
11
+ * "Context Trail visible" of the caller Place: off hides the trail chips
12
+ * in the composer; on without Place Settings. `false` when an older
13
+ * backend does not send it (AC-225; AC-226 keeps the backend
14
+ * authoritative).
15
+ */
16
+ readonly contextTrailVisible: Schema.withDecodingDefaultKey<Schema.Boolean, never>;
17
+ /**
18
+ * The allowed Places of the caller Place: its History Scope Ceiling, the
19
+ * caller Place first. A ceiling of every Place lists every Place of the
20
+ * Organization. The client shows the conversation filter only when more
21
+ * than one Place is allowed, and labels a row of another Place with its
22
+ * name.
23
+ */
24
+ readonly places: Schema.$Array<Schema.Struct<{
25
+ readonly id: Schema.String;
26
+ readonly kind: Schema.Literals<readonly ["studio_app", "external_app", "dashboard"]>;
27
+ readonly name: Schema.NullOr<Schema.String>;
28
+ }>>;
29
+ /** The read-aloud switch of the caller Place; on without Place Settings. */
30
+ readonly readAloud: Schema.Boolean;
31
+ /** For a Studio app only: how it takes voice input; `local` (Whisper) without Place Settings. */
32
+ readonly voiceInputMode: Schema.optionalKey<Schema.Literals<readonly ["local", "remote"]>>;
33
+ }>;
34
+ export type PlaceContext = typeof PlaceContextSchema.Type;