@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.
- package/AGENTS.md +52 -0
- package/README.md +462 -2
- package/dist/api/access-check.d.ts +18 -0
- package/dist/api/answer-sources.d.ts +48 -0
- package/dist/api/attachments-api.d.ts +187 -0
- package/dist/api/catalog-api.d.ts +408 -0
- package/dist/api/chat-api.d.ts +2401 -0
- package/dist/api/chat-surface-api.d.ts +4186 -0
- package/dist/api/compaction.d.ts +52 -0
- package/dist/api/conversations.d.ts +107 -0
- package/dist/api/errors.d.ts +117 -0
- package/dist/api/feedback-api.d.ts +185 -0
- package/dist/api/files.d.ts +22 -0
- package/dist/api/ids.d.ts +33 -0
- package/dist/api/index.d.ts +21 -0
- package/dist/api/intents-api.d.ts +65 -0
- package/dist/api/place-context.d.ts +34 -0
- package/dist/api/projects-api.d.ts +718 -0
- package/dist/api/speech-api.d.ts +345 -0
- package/dist/api/transcript.d.ts +260 -0
- package/dist/api/turns.d.ts +196 -0
- package/dist/api.d.ts +21 -0
- package/dist/api.js +1 -0
- package/dist/domain/access.d.ts +29 -0
- package/dist/domain/context-trail.d.ts +65 -0
- package/dist/domain/data-parts.d.ts +247 -0
- package/dist/domain/errors.d.ts +28 -0
- package/dist/domain/index.d.ts +14 -0
- package/dist/domain/intents.d.ts +101 -0
- package/dist/domain/message.d.ts +173 -0
- package/dist/domain/place.d.ts +17 -0
- package/dist/domain/runtime-value.d.ts +16 -0
- package/dist/domain-50vzrrp9.js +2 -0
- package/dist/domain-5fpd4fte.js +1 -0
- package/dist/domain-9wzbv87n.js +2 -0
- package/dist/domain-g97xs965.js +2 -0
- package/dist/domain-hk3yw2m7.js +1 -0
- package/dist/domain-qyts6dgz.js +0 -0
- package/dist/domain-s07s1ry1.js +2 -0
- package/dist/domain.d.ts +14 -0
- package/dist/domain.js +1 -0
- package/dist/headless/access/access-store.d.ts +28 -0
- package/dist/headless/access/visibility.d.ts +24 -0
- package/dist/headless/blocked-state.d.ts +21 -0
- package/dist/headless/chat-registry.d.ts +63 -0
- package/dist/headless/chat-session-provider.d.ts +109 -0
- package/dist/headless/chat-surface.d.ts +4210 -0
- package/dist/headless/host-ports.d.ts +146 -0
- package/dist/headless/index.d.ts +33 -0
- package/dist/headless/intents/card-ends.d.ts +22 -0
- package/dist/headless/intents/intent-call.d.ts +28 -0
- package/dist/headless/intents/intents-provider.d.ts +108 -0
- package/dist/headless/intents/page-registry.d.ts +129 -0
- package/dist/headless/intents/use-intent-dispatch.d.ts +60 -0
- package/dist/headless/intents/use-intents.d.ts +11 -0
- package/dist/headless/intents/use-returned-intent-handle.d.ts +11 -0
- package/dist/headless/launch/chat-launch.d.ts +42 -0
- package/dist/headless/launch/launch-target.d.ts +25 -0
- package/dist/headless/launch/submit.d.ts +29 -0
- package/dist/headless/run-state.d.ts +16 -0
- package/dist/headless/sent-files.d.ts +20 -0
- package/dist/headless/server-started-turn-follow.proof.d.ts +26 -0
- package/dist/headless/session-machine.d.ts +745 -0
- package/dist/headless/trail/buffer.d.ts +48 -0
- package/dist/headless/trail/json-ld.d.ts +10 -0
- package/dist/headless/trail/switches.d.ts +10 -0
- package/dist/headless/trail/trail-provider.d.ts +53 -0
- package/dist/headless/transcript-messages.d.ts +26 -0
- package/dist/headless.d.ts +33 -0
- package/dist/headless.js +2 -0
- package/dist/transport/chat-client.d.ts +25 -0
- package/dist/transport/chat-transport.d.ts +57 -0
- package/dist/transport/index.d.ts +6 -0
- package/dist/transport/simulated-chat-transport.d.ts +39 -0
- package/dist/transport.d.ts +6 -0
- package/dist/transport.js +1 -0
- package/dist/views/assistant-sidebar/assistant-sidebar.d.ts +15 -0
- package/dist/views/assistant-sidebar/layout.d.ts +47 -0
- package/dist/views/assistant-sidebar/toggle.d.ts +14 -0
- package/dist/views/assistant-sidebar/use-shortcut.d.ts +11 -0
- package/dist/views/blocked/chat-blocked-state.d.ts +15 -0
- package/dist/views/chat-operations.d.ts +46 -0
- package/dist/views/chat-root.d.ts +14 -0
- package/dist/views/chat.d.ts +51 -0
- package/dist/views/composer/capability-picker.d.ts +77 -0
- package/dist/views/composer/capability-pickers.d.ts +24 -0
- package/dist/views/composer/chat-composer.d.ts +15 -0
- package/dist/views/composer/composer-picks.d.ts +31 -0
- package/dist/views/composer/composer-trail.d.ts +21 -0
- package/dist/views/composer/draft-attachments.d.ts +36 -0
- package/dist/views/composer/queued-messages.d.ts +9 -0
- package/dist/views/composer/send-menu.d.ts +11 -0
- package/dist/views/composer/slash-suggestions.d.ts +37 -0
- package/dist/views/composer/trail-chips.d.ts +15 -0
- package/dist/views/composer/voice-input/microphone.d.ts +14 -0
- package/dist/views/composer/voice-input/remote-transcription.d.ts +12 -0
- package/dist/views/composer/voice-input/use-voice-input.d.ts +30 -0
- package/dist/views/composer/voice-input/voice-input.d.ts +15 -0
- package/dist/views/dock/chat-dock.d.ts +57 -0
- package/dist/views/dock/dock-session.d.ts +22 -0
- package/dist/views/header/chat-header.d.ts +10 -0
- package/dist/views/header/compaction-controls.d.ts +17 -0
- package/dist/views/header/memory-switch.d.ts +16 -0
- package/dist/views/index.d.ts +58 -0
- package/dist/views/intents/form-fields.d.ts +38 -0
- package/dist/views/intents/intent-card.d.ts +61 -0
- package/dist/views/intents/intent-form.d.ts +23 -0
- package/dist/views/intents/intent-notices.d.ts +39 -0
- package/dist/views/intents/intent-trigger.d.ts +46 -0
- package/dist/views/intents/labels.d.ts +23 -0
- package/dist/views/labels/en.d.ts +3 -0
- package/dist/views/labels/index.d.ts +13 -0
- package/dist/views/labels/it.d.ts +3 -0
- package/dist/views/labels/types.d.ts +7 -0
- package/dist/views/launch/chat-launch-button.d.ts +21 -0
- package/dist/views/parts/answer-feedback.d.ts +26 -0
- package/dist/views/parts/evidence-part.d.ts +8 -0
- package/dist/views/parts/file-part.d.ts +8 -0
- package/dist/views/parts/image-generation-part.d.ts +9 -0
- package/dist/views/parts/image-generation.d.ts +84 -0
- package/dist/views/parts/intent-card-part.d.ts +8 -0
- package/dist/views/parts/memory-evidence-part.d.ts +7 -0
- package/dist/views/parts/message-parts.d.ts +21 -0
- package/dist/views/parts/question-part.d.ts +8 -0
- package/dist/views/parts/read-aloud.d.ts +23 -0
- package/dist/views/parts/reasoning-part.d.ts +8 -0
- package/dist/views/parts/steering-message-part.d.ts +7 -0
- package/dist/views/parts/text-part.d.ts +4 -0
- package/dist/views/parts/tool-part.d.ts +11 -0
- package/dist/views/parts/types.d.ts +103 -0
- package/dist/views/parts/use-read-aloud.d.ts +13 -0
- package/dist/views/run-trace/message-run.d.ts +17 -0
- package/dist/views/run-trace/run-stream.d.ts +128 -0
- package/dist/views/run-trace/run-trace-parts.d.ts +26 -0
- package/dist/views/run-trace/run-trace.d.ts +31 -0
- package/dist/views/sidebar/conversation-dialogs.d.ts +38 -0
- package/dist/views/sidebar/conversation-row.d.ts +23 -0
- package/dist/views/sidebar/conversation-sidebar.d.ts +10 -0
- package/dist/views/sidebar/date-groups.d.ts +12 -0
- package/dist/views/sidebar/history-filter.d.ts +57 -0
- package/dist/views/sidebar/projects/project-dialogs.d.ts +40 -0
- package/dist/views/sidebar/projects/project-files.d.ts +16 -0
- package/dist/views/sidebar/projects/project-groups.d.ts +19 -0
- package/dist/views/sidebar/projects/project-view.d.ts +21 -0
- package/dist/views/sidebar/projects/projects-section.d.ts +21 -0
- package/dist/views/sidebar/projects/use-chat-projects.d.ts +32 -0
- package/dist/views/slots.d.ts +148 -0
- package/dist/views/transcript/chat-transcript.d.ts +13 -0
- package/dist/views/transcript/sent-trail.d.ts +13 -0
- package/dist/views/transcript/use-image-reload.d.ts +16 -0
- package/dist/views.d.ts +58 -0
- package/dist/views.js +3 -0
- package/docs/guide/ai/index.md +377 -0
- package/docs/guide/ai/studio.md +245 -0
- package/docs/guide/data/connectors.md +267 -0
- package/docs/guide/data/datasets.md +145 -0
- package/docs/guide/data/documents.md +235 -0
- package/docs/guide/data/index.md +62 -0
- package/docs/guide/data/knowledge.md +214 -0
- package/docs/guide/develop/extensions.md +299 -0
- package/docs/guide/develop/external-apps.md +279 -0
- package/docs/guide/develop/infrastructure.md +135 -0
- package/docs/guide/develop/sdks.md +233 -0
- package/docs/guide/index.md +83 -0
- package/docs/guide/platform/access.md +311 -0
- package/docs/guide/platform/architecture.md +166 -0
- package/docs/guide/platform/built-ins.md +225 -0
- package/docs/guide/platform/entrypoints.md +318 -0
- package/docs/guide/scenarios/index.md +130 -0
- package/docs/guide/template/index.md +295 -0
- package/docs/guide/template/state-machines.md +294 -0
- package/package.json +123 -4
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/** A value that crosses the wire as JSON. */
|
|
2
|
+
export type JsonValue = boolean | null | number | string | readonly JsonValue[] | {
|
|
3
|
+
readonly [key: string]: JsonValue;
|
|
4
|
+
};
|
|
5
|
+
/** A JSON object, such as the inputs of an Intent. */
|
|
6
|
+
export type JsonObject = Readonly<Record<string, JsonValue>>;
|
|
7
|
+
/**
|
|
8
|
+
* The id of the Dispatch Record of one Intent Dispatch, which a `started`
|
|
9
|
+
* answer carries; never a run id. Only the dispatching caller reads or waits
|
|
10
|
+
* with it.
|
|
11
|
+
*/
|
|
12
|
+
export type IntentHandle = string;
|
|
13
|
+
/**
|
|
14
|
+
* The declared output of the bound Automation: the structured output of an
|
|
15
|
+
* Agent, the output of a Workflow, or the text of a Skill. The catalog entry
|
|
16
|
+
* of the Intent carries its schema.
|
|
17
|
+
*/
|
|
18
|
+
export type IntentResult = JsonValue;
|
|
19
|
+
/**
|
|
20
|
+
* One input that the Input Gate refused: `missing` for a `required` rule,
|
|
21
|
+
* `invalid` for any other rule, with the path of the field.
|
|
22
|
+
*/
|
|
23
|
+
export interface IntentFieldProblem {
|
|
24
|
+
readonly path: string;
|
|
25
|
+
readonly problem: "invalid" | "missing";
|
|
26
|
+
readonly reason: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The answer of an Intent Dispatch, the same on every surface. `needs_input`
|
|
30
|
+
* and `not_allowed` start no run; an unknown Intent is also `not_allowed`, so
|
|
31
|
+
* a caller cannot learn which Intents exist. A Sync dispatch that passes the
|
|
32
|
+
* Sync wait limit answers `started`.
|
|
33
|
+
*/
|
|
34
|
+
export type IntentDispatchOutcome = {
|
|
35
|
+
readonly kind: "completed";
|
|
36
|
+
readonly result: IntentResult;
|
|
37
|
+
} | {
|
|
38
|
+
readonly kind: "started";
|
|
39
|
+
readonly handle: IntentHandle;
|
|
40
|
+
} | {
|
|
41
|
+
readonly kind: "needs_input";
|
|
42
|
+
readonly fields: readonly IntentFieldProblem[];
|
|
43
|
+
} | {
|
|
44
|
+
readonly kind: "not_allowed";
|
|
45
|
+
} | {
|
|
46
|
+
readonly kind: "failed";
|
|
47
|
+
readonly reason: string;
|
|
48
|
+
};
|
|
49
|
+
/** The end of a started dispatch: the Intent Result, or why the run failed. */
|
|
50
|
+
export type IntentDispatchEnd = Extract<IntentDispatchOutcome, {
|
|
51
|
+
readonly kind: "completed" | "failed";
|
|
52
|
+
}>;
|
|
53
|
+
/** The state of a Dispatch Record: still running, or its end. */
|
|
54
|
+
export type IntentDispatchRecordState = {
|
|
55
|
+
readonly kind: "running";
|
|
56
|
+
} | {
|
|
57
|
+
readonly kind: "starting";
|
|
58
|
+
} | IntentDispatchEnd;
|
|
59
|
+
/** An Intent that the caller may trigger now, as the catalog lists it. */
|
|
60
|
+
export interface IntentCatalogEntry {
|
|
61
|
+
readonly description: string;
|
|
62
|
+
readonly displayName: string;
|
|
63
|
+
readonly fqn: string;
|
|
64
|
+
/** The schema that the Input Gate checks the inputs against. */
|
|
65
|
+
readonly inputSchema: JsonObject;
|
|
66
|
+
/**
|
|
67
|
+
* The output schema of the bound Automation: the Agent output schema, the
|
|
68
|
+
* Workflow output contract, or text for a Skill.
|
|
69
|
+
*/
|
|
70
|
+
readonly outputSchema: JsonObject;
|
|
71
|
+
readonly resultMode: "async" | "sync";
|
|
72
|
+
}
|
|
73
|
+
/** Where the frontend sends the Intent Result of one dispatch. */
|
|
74
|
+
export type IntentResultTarget = "chat" | "nothing" | "notification";
|
|
75
|
+
/**
|
|
76
|
+
* A page of the same Studio app, named by its page id and parameters, never
|
|
77
|
+
* a free URL: "Open" on the inbox entry returns there with the Intent Handle.
|
|
78
|
+
*/
|
|
79
|
+
export interface IntentReturnPage {
|
|
80
|
+
readonly pageId: string;
|
|
81
|
+
readonly params: Readonly<Record<string, string>>;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The turn that a Chat Launch sends to the chat: an Intent with the inputs
|
|
85
|
+
* that the control has, a plain message, or a Skill with a message. The chat
|
|
86
|
+
* dispatches an `intent` turn before any model call (the Launched Intent) and
|
|
87
|
+
* asks for the inputs that are missing or invalid; a `skill` turn runs the
|
|
88
|
+
* Skill with its text.
|
|
89
|
+
*/
|
|
90
|
+
export type PreparedTurn = {
|
|
91
|
+
readonly fqn: string;
|
|
92
|
+
readonly inputs: JsonObject;
|
|
93
|
+
readonly kind: "intent";
|
|
94
|
+
} | {
|
|
95
|
+
readonly kind: "message";
|
|
96
|
+
readonly text: string;
|
|
97
|
+
} | {
|
|
98
|
+
readonly kind: "skill";
|
|
99
|
+
readonly skillId: string;
|
|
100
|
+
readonly text: string;
|
|
101
|
+
};
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import type { UIMessage } from "ai";
|
|
2
|
+
import * as Schema from "effect/Schema";
|
|
3
|
+
import type { CiDataParts, CiStandardSchema } from "./data-parts.js";
|
|
4
|
+
/**
|
|
5
|
+
* What the user chose for one turn, beside the message text: the chat send
|
|
6
|
+
* carries only the last message, so a user message carries its choices in
|
|
7
|
+
* its metadata, and the server reads them from there.
|
|
8
|
+
*/
|
|
9
|
+
declare const CiTurnOptionsSchema: Schema.Struct<{
|
|
10
|
+
/** Chat attachments of the Conversation, uploaded before the send. */
|
|
11
|
+
readonly attachmentIds: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
12
|
+
/**
|
|
13
|
+
* The Context Trail of the turn, the oldest entry first (AC-037): the
|
|
14
|
+
* backend keeps the newest entries within 16 KiB, and none when the
|
|
15
|
+
* caller Place switches the trail off.
|
|
16
|
+
*/
|
|
17
|
+
readonly contextTrail: Schema.optionalKey<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
18
|
+
readonly at: Schema.String;
|
|
19
|
+
readonly data: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
20
|
+
readonly event: Schema.String;
|
|
21
|
+
readonly source: Schema.String;
|
|
22
|
+
}>, Schema.Struct<{
|
|
23
|
+
readonly at: Schema.String;
|
|
24
|
+
readonly data: Schema.StructWithRest<Schema.Struct<{
|
|
25
|
+
readonly "@type": Schema.String;
|
|
26
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>;
|
|
27
|
+
readonly source: Schema.String;
|
|
28
|
+
}>, Schema.Struct<{
|
|
29
|
+
readonly app: Schema.String;
|
|
30
|
+
readonly at: Schema.String;
|
|
31
|
+
readonly page: Schema.String;
|
|
32
|
+
readonly title: Schema.String;
|
|
33
|
+
}>]>>>;
|
|
34
|
+
/** A tool that the turn runs first, with its input. */
|
|
35
|
+
readonly directTool: Schema.optionalKey<Schema.Struct<{
|
|
36
|
+
readonly handle: Schema.String;
|
|
37
|
+
readonly input: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
38
|
+
}>>;
|
|
39
|
+
/**
|
|
40
|
+
* The Intent of a Chat Launch, with the inputs that the control has
|
|
41
|
+
* (AC-036). The turn dispatches it before any model call, keyed by the
|
|
42
|
+
* id of this message; it takes no text, direct tool or chosen capability.
|
|
43
|
+
*/
|
|
44
|
+
readonly launch: Schema.optionalKey<Schema.Struct<{
|
|
45
|
+
readonly fqn: Schema.String;
|
|
46
|
+
readonly inputs: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
47
|
+
}>>;
|
|
48
|
+
/** The skills and tools that the user chose for the turn. */
|
|
49
|
+
readonly selectedCapabilities: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
50
|
+
readonly id: Schema.String;
|
|
51
|
+
readonly kind: Schema.Literals<readonly ["skill", "tool"]>;
|
|
52
|
+
}>>>;
|
|
53
|
+
/** The report run that the user chose for the turn. */
|
|
54
|
+
readonly selectedReportRunId: Schema.optionalKey<Schema.String>;
|
|
55
|
+
}>;
|
|
56
|
+
export type CiTurnOptions = typeof CiTurnOptionsSchema.Type;
|
|
57
|
+
/** The user's rating of an answer: helpful or not helpful. */
|
|
58
|
+
declare const CiAnswerSentimentSchema: Schema.Literals<readonly ["positive", "negative"]>;
|
|
59
|
+
export type CiAnswerSentiment = typeof CiAnswerSentimentSchema.Type;
|
|
60
|
+
/**
|
|
61
|
+
* The metadata of a CI message. The stream can send it in pieces, so each
|
|
62
|
+
* field is optional.
|
|
63
|
+
*/
|
|
64
|
+
declare const CiMessageMetadataSchema: Schema.Struct<{
|
|
65
|
+
/** When the server saved the message, as an ISO 8601 date-time. */
|
|
66
|
+
readonly createdAt: Schema.optionalKey<Schema.String>;
|
|
67
|
+
/** On an answer: the user's rating of it, as the transcript read it. */
|
|
68
|
+
readonly currentUserFeedback: Schema.optionalKey<Schema.Struct<{
|
|
69
|
+
readonly sentiment: Schema.NullOr<Schema.Literals<readonly ["positive", "negative"]>>;
|
|
70
|
+
readonly submitterNote: Schema.NullOr<Schema.String>;
|
|
71
|
+
}>>;
|
|
72
|
+
/** The id that answer feedback for this message targets. */
|
|
73
|
+
readonly feedbackTargetId: Schema.optionalKey<Schema.String>;
|
|
74
|
+
/** The turn that the message belongs to. */
|
|
75
|
+
readonly invocationId: Schema.optionalKey<Schema.String>;
|
|
76
|
+
/** The link to the trace of the turn's run. */
|
|
77
|
+
readonly traceLink: Schema.optionalKey<Schema.String>;
|
|
78
|
+
/** On a user message: what the user chose for its turn. */
|
|
79
|
+
readonly turnOptions: Schema.optionalKey<Schema.Struct<{
|
|
80
|
+
/** Chat attachments of the Conversation, uploaded before the send. */
|
|
81
|
+
readonly attachmentIds: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
82
|
+
/**
|
|
83
|
+
* The Context Trail of the turn, the oldest entry first (AC-037): the
|
|
84
|
+
* backend keeps the newest entries within 16 KiB, and none when the
|
|
85
|
+
* caller Place switches the trail off.
|
|
86
|
+
*/
|
|
87
|
+
readonly contextTrail: Schema.optionalKey<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
88
|
+
readonly at: Schema.String;
|
|
89
|
+
readonly data: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
90
|
+
readonly event: Schema.String;
|
|
91
|
+
readonly source: Schema.String;
|
|
92
|
+
}>, Schema.Struct<{
|
|
93
|
+
readonly at: Schema.String;
|
|
94
|
+
readonly data: Schema.StructWithRest<Schema.Struct<{
|
|
95
|
+
readonly "@type": Schema.String;
|
|
96
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>;
|
|
97
|
+
readonly source: Schema.String;
|
|
98
|
+
}>, Schema.Struct<{
|
|
99
|
+
readonly app: Schema.String;
|
|
100
|
+
readonly at: Schema.String;
|
|
101
|
+
readonly page: Schema.String;
|
|
102
|
+
readonly title: Schema.String;
|
|
103
|
+
}>]>>>;
|
|
104
|
+
/** A tool that the turn runs first, with its input. */
|
|
105
|
+
readonly directTool: Schema.optionalKey<Schema.Struct<{
|
|
106
|
+
readonly handle: Schema.String;
|
|
107
|
+
readonly input: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
108
|
+
}>>;
|
|
109
|
+
/**
|
|
110
|
+
* The Intent of a Chat Launch, with the inputs that the control has
|
|
111
|
+
* (AC-036). The turn dispatches it before any model call, keyed by the
|
|
112
|
+
* id of this message; it takes no text, direct tool or chosen capability.
|
|
113
|
+
*/
|
|
114
|
+
readonly launch: Schema.optionalKey<Schema.Struct<{
|
|
115
|
+
readonly fqn: Schema.String;
|
|
116
|
+
readonly inputs: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
117
|
+
}>>;
|
|
118
|
+
/** The skills and tools that the user chose for the turn. */
|
|
119
|
+
readonly selectedCapabilities: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
120
|
+
readonly id: Schema.String;
|
|
121
|
+
readonly kind: Schema.Literals<readonly ["skill", "tool"]>;
|
|
122
|
+
}>>>;
|
|
123
|
+
/** The report run that the user chose for the turn. */
|
|
124
|
+
readonly selectedReportRunId: Schema.optionalKey<Schema.String>;
|
|
125
|
+
}>>;
|
|
126
|
+
}>;
|
|
127
|
+
export type CiMessageMetadata = typeof CiMessageMetadataSchema.Type;
|
|
128
|
+
/** The metadata schema as Standard Schema, for `messageMetadataSchema` of an AI SDK `Chat`. */
|
|
129
|
+
export declare const ciMessageMetadataSchema: CiStandardSchema<typeof CiMessageMetadataSchema>;
|
|
130
|
+
/** The name of the client-answered question tool. */
|
|
131
|
+
export declare const ciAskUserToolName = "ci_ask_user";
|
|
132
|
+
/** The input of `ci_ask_user`: the question that the agent asks the user. */
|
|
133
|
+
declare const CiAskUserInputSchema: Schema.Struct<{
|
|
134
|
+
/** True when the user can answer with their own text besides the options. */
|
|
135
|
+
readonly allowFreeText: Schema.Boolean;
|
|
136
|
+
readonly mode: Schema.Literals<readonly ["open", "single_choice"]>;
|
|
137
|
+
readonly options: Schema.$Array<Schema.Struct<{
|
|
138
|
+
readonly description: Schema.NullOr<Schema.String>;
|
|
139
|
+
readonly id: Schema.String;
|
|
140
|
+
readonly label: Schema.String;
|
|
141
|
+
}>>;
|
|
142
|
+
readonly prompt: Schema.String;
|
|
143
|
+
}>;
|
|
144
|
+
export type CiAskUserInput = typeof CiAskUserInputSchema.Type;
|
|
145
|
+
/** The output of `ci_ask_user`: the user's answer, an option or their own text. */
|
|
146
|
+
declare const CiAskUserOutputSchema: Schema.Union<readonly [Schema.Struct<{
|
|
147
|
+
readonly kind: Schema.Literal<"option">;
|
|
148
|
+
readonly optionId: Schema.String;
|
|
149
|
+
}>, Schema.Struct<{
|
|
150
|
+
readonly kind: Schema.Literal<"free_text">;
|
|
151
|
+
readonly text: Schema.String;
|
|
152
|
+
}>]>;
|
|
153
|
+
export type CiAskUserOutput = typeof CiAskUserOutputSchema.Type;
|
|
154
|
+
/** The `ci_ask_user` input and output schemas, each an Effect schema and a Standard Schema. */
|
|
155
|
+
export type CiAskUserSchemas = Readonly<{
|
|
156
|
+
input: CiStandardSchema<typeof CiAskUserInputSchema>;
|
|
157
|
+
output: CiStandardSchema<typeof CiAskUserOutputSchema>;
|
|
158
|
+
}>;
|
|
159
|
+
/** The `ci_ask_user` schemas, for the tool definition. */
|
|
160
|
+
export declare const ciAskUserSchemas: CiAskUserSchemas;
|
|
161
|
+
/**
|
|
162
|
+
* The tools with a CI type. Every other tool reaches the chat as a dynamic
|
|
163
|
+
* tool part; any tool can ask for approval through `needsApproval`.
|
|
164
|
+
*/
|
|
165
|
+
export type CiTools = Readonly<{
|
|
166
|
+
[ciAskUserToolName]: {
|
|
167
|
+
input: CiAskUserInput;
|
|
168
|
+
output: CiAskUserOutput;
|
|
169
|
+
};
|
|
170
|
+
}>;
|
|
171
|
+
/** The one CI message type of every chat. */
|
|
172
|
+
export type CiUIMessage = UIMessage<CiMessageMetadata, CiDataParts, CiTools>;
|
|
173
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The kinds of Place: a Studio app, an External App, or the Dashboard of an
|
|
3
|
+
* Organization (one Place per Organization).
|
|
4
|
+
*/
|
|
5
|
+
export declare const placeKinds: readonly ["studio_app", "external_app", "dashboard"];
|
|
6
|
+
export type PlaceKind = (typeof placeKinds)[number];
|
|
7
|
+
/**
|
|
8
|
+
* Where a chat runs, identified by its kind and id. The id is the Studio app
|
|
9
|
+
* id, the External App's application id, or the Organization id of the
|
|
10
|
+
* Dashboard, by `kind`.
|
|
11
|
+
*/
|
|
12
|
+
export type Place = {
|
|
13
|
+
readonly [Kind in PlaceKind]: Readonly<{
|
|
14
|
+
id: string;
|
|
15
|
+
kind: Kind;
|
|
16
|
+
}>;
|
|
17
|
+
}[PlaceKind];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type RuntimeValue = bigint | boolean | null | number | object | string | symbol | undefined;
|
|
2
|
+
type RuntimeFunction = (...arguments_: never[]) => RuntimeValue;
|
|
3
|
+
export type RuntimeRecord<Value = unknown> = Record<string, Value>;
|
|
4
|
+
export declare const hasBigIntRuntimeKind: <Value>(value: Value) => value is Value & bigint;
|
|
5
|
+
export declare const hasBooleanRuntimeKind: <Value>(value: Value) => value is Value & boolean;
|
|
6
|
+
export declare const hasFunctionRuntimeKind: <Value>(value: Value) => value is Extract<Value, RuntimeFunction>;
|
|
7
|
+
export declare const hasNumberRuntimeKind: <Value>(value: Value) => value is Value & number;
|
|
8
|
+
export declare const hasNullRuntimeKind: <Value>(value: Value) => value is Value & null;
|
|
9
|
+
export declare const hasObjectRuntimeKind: <Value>(value: Value) => value is Value & (object | null);
|
|
10
|
+
export declare const hasStringRuntimeKind: <Value>(value: Value) => value is Value & string;
|
|
11
|
+
export declare const hasSymbolRuntimeKind: <Value>(value: Value) => value is Value & symbol;
|
|
12
|
+
export declare const hasUndefinedRuntimeKind: <Value>(value: Value) => value is Value & undefined;
|
|
13
|
+
export declare const isNullish: <Value>(value: Value) => value is Value & (null | undefined);
|
|
14
|
+
export declare const asRuntimeValue: <InputValue>(value: InputValue) => RuntimeValue & InputValue;
|
|
15
|
+
export declare const requireValue: <Value>(value: Value) => NonNullable<Value>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import*as Schema from"effect/Schema";var NullableText=Schema.NullOr(Schema.String);var evidenceHeading={description:NullableText,title:NullableText};var TableColumnSchema=Schema.Struct({description:NullableText,key:Schema.String,label:Schema.String,link:Schema.NullOr(Schema.Struct({labelKey:NullableText,urlKey:Schema.String})),valueKind:NullableText});var TableEvidenceSchema=Schema.Struct({...evidenceHeading,columns:Schema.Array(TableColumnSchema),kind:Schema.Literal("table"),rows:Schema.Array(Schema.JsonObject)});var SourceNavigationSchema=Schema.Union([Schema.Struct({entityId:Schema.String,kind:Schema.Literal("entity")}),Schema.Struct({fileId:Schema.String,kind:Schema.Literal("file")}),Schema.Struct({kind:Schema.Literal("external_url"),url:Schema.String})]);var SourceItemSchema=Schema.Struct({contradictionStatus:Schema.String,evidenceId:NullableText,excerpt:Schema.String,matchClassification:Schema.String,navigation:Schema.NullOr(SourceNavigationSchema),provenanceLabel:Schema.String,relevanceScore:Schema.Finite.check(Schema.isBetween({maximum:1,minimum:0})),title:Schema.String});var SourceGroupSchema=Schema.Struct({items:Schema.Array(SourceItemSchema),label:Schema.String,sourceKind:Schema.String});var SourcesEvidenceSchema=Schema.Struct({...evidenceHeading,groups:Schema.Array(SourceGroupSchema),kind:Schema.Literal("sources"),omittedCount:Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))});var LinksEvidenceSchema=Schema.Struct({...evidenceHeading,kind:Schema.Literal("links"),links:Schema.Array(Schema.Struct({description:NullableText,label:Schema.String,url:Schema.String}))});var SummaryEvidenceSchema=Schema.Struct({...evidenceHeading,kind:Schema.Literal("summary"),text:Schema.String});var WarningsEvidenceSchema=Schema.Struct({...evidenceHeading,kind:Schema.Literal("warnings"),warnings:Schema.Array(Schema.String)});var JsonEvidenceSchema=Schema.Struct({...evidenceHeading,kind:Schema.Literal("json"),value:Schema.Json});var ImageEvidenceSchema=Schema.Struct({...evidenceHeading,images:Schema.Array(Schema.Struct({alt:NullableText,filename:Schema.String,mediaType:Schema.String,url:Schema.String})),kind:Schema.Literal("image")});var EvidenceSchema=Schema.Union([TableEvidenceSchema,SourcesEvidenceSchema,LinksEvidenceSchema,SummaryEvidenceSchema,WarningsEvidenceSchema,JsonEvidenceSchema,ImageEvidenceSchema]);var MemoryEvidenceEventSchema=Schema.Struct({category:NullableText,kind:Schema.Literals(["retrieved","selected","used","created","suggested","merged","superseded","rejected","skipped"]),lifecycleStatus:NullableText,memoryId:NullableText,reason:NullableText,scope:NullableText});var MemoryEvidenceSchema=Schema.Struct({events:Schema.Array(MemoryEvidenceEventSchema)});var draftSubjectKinds2=["skill_draft","report_draft","entity_schema_draft","organization_identity","workflow_working_copy"];var DraftUpdateSchema=Schema.Struct({changes:Schema.JsonObject,subject:Schema.Struct({id:Schema.String,kind:Schema.Literals(draftSubjectKinds2)})});var RunStatusSchema=Schema.Union([Schema.Struct({invocationId:Schema.String,kind:Schema.Literal("next_turn"),userMessage:Schema.Struct({id:Schema.String,text:Schema.String})}),Schema.Struct({invocationId:Schema.String,kind:Schema.Literal("running_turn")})]);var intentCardFields={dispatchId:Schema.String,displayName:Schema.optionalKey(Schema.String),fqn:Schema.String};var IntentCardSchema=Schema.Union([Schema.Struct({...intentCardFields,state:Schema.Literal("running")}),Schema.Struct({...intentCardFields,result:Schema.Json,state:Schema.Literal("completed")}),Schema.Struct({...intentCardFields,reason:Schema.String,state:Schema.Literal("failed")}),Schema.Struct({...intentCardFields,state:Schema.Literal("ended")})]);var ciDataPartSchemas2={"draft-update":Schema.toStandardSchemaV1(DraftUpdateSchema),evidence:Schema.toStandardSchemaV1(EvidenceSchema),"intent-card":Schema.toStandardSchemaV1(IntentCardSchema),"memory-evidence":Schema.toStandardSchemaV1(MemoryEvidenceSchema),"run-status":Schema.toStandardSchemaV1(RunStatusSchema)};import*as Schema2 from"effect/Schema";var PageVisitSchema=Schema2.Struct({app:Schema2.String,at:Schema2.String,page:Schema2.String,title:Schema2.String});var TrailMetadataDataSchema=Schema2.StructWithRest(Schema2.Struct({"@type":Schema2.String}),[Schema2.Record(Schema2.String,Schema2.Json)]);var TrailMetadataSchema=Schema2.Struct({at:Schema2.String,data:TrailMetadataDataSchema,source:Schema2.String});var TrailEventSchema=Schema2.Struct({at:Schema2.String,data:Schema2.Record(Schema2.String,Schema2.Json),event:Schema2.String,source:Schema2.String});var ContextTrailEntrySchema=Schema2.Union([TrailEventSchema,TrailMetadataSchema,PageVisitSchema]);var contextTrailEntrySchema2=Schema2.toStandardSchemaV1(ContextTrailEntrySchema);var placeKinds2=["studio_app","external_app","dashboard"];
|
|
2
|
+
export{draftSubjectKinds2,ciDataPartSchemas2,ContextTrailEntrySchema,contextTrailEntrySchema2,placeKinds2};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as Schema from"effect/Schema";var Uuid=Schema.String.check(Schema.isUUID());var ConversationId2=Uuid.pipe(Schema.brand("@collective-intelligence/ai/ConversationId"));var InvocationId2=Uuid.pipe(Schema.brand("@collective-intelligence/ai/InvocationId"));var AgentId2=Uuid.pipe(Schema.brand("@collective-intelligence/ai/AgentId"));var ProjectId2=Uuid.pipe(Schema.brand("@collective-intelligence/ai/ProjectId"));var ProjectFileId2=Uuid.pipe(Schema.brand("@collective-intelligence/ai/ProjectFileId"));var AttachmentId2=Uuid.pipe(Schema.brand("@collective-intelligence/ai/AttachmentId"));var QueuedMessageId2=Uuid.pipe(Schema.brand("@collective-intelligence/ai/QueuedMessageId"));var SteeringMessageId2=Uuid.pipe(Schema.brand("@collective-intelligence/ai/SteeringMessageId"));var SpeechClipId2=Uuid.pipe(Schema.brand("@collective-intelligence/ai/SpeechClipId"));export{Uuid,ConversationId2,InvocationId2,AgentId2,ProjectId2,ProjectFileId2,AttachmentId2,QueuedMessageId2,SteeringMessageId2,SpeechClipId2};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var aiErrorCodes2=["unauthenticated","forbidden","not_found","conflict","invalid_request","rate_limited","unavailable","internal"];class AiFailureError2 extends Error{name="AiFailureError";error;constructor(error,options){super(error.message,options);this.error=error}}
|
|
2
|
+
export{aiErrorCodes2,AiFailureError2};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Uuid,ConversationId2,InvocationId2,AgentId2,ProjectId2,ProjectFileId2,AttachmentId2,QueuedMessageId2,SteeringMessageId2,SpeechClipId2}from"./domain-5fpd4fte.js";import{draftSubjectKinds2,ciDataPartSchemas2,contextTrailEntrySchema2,placeKinds2}from"./domain-50vzrrp9.js";import{Multipart}from"effect/http";import{HttpApiEndpoint,HttpApiGroup,HttpApiSchema as HttpApiSchema2}from"effect/http-api";import*as Schema3 from"effect/Schema";import{HttpApiSchema}from"effect/http-api";import*as Schema from"effect/Schema";var chatRefusalReasons2=["capability_missing","app_disabled","principal_not_allowed","not_available_here","approval_not_allowed"];var chatConflictReasons2=["turn_ended","intent_turn_busy","intent_turn_agent"];var uploadRejectionReasons2=["unsupported","oversized","malformed","too_many_files"];var statusOf={conflict:409,forbidden:403,internal:500,invalid_request:400,not_found:404,rate_limited:429,unauthenticated:401,unavailable:503};var failure=(code,fields)=>Schema.Struct({correlationId:Schema.String,error:Schema.Struct({...fields,code:Schema.Literal(code),message:Schema.String,retryable:Schema.Boolean}),ok:Schema.Literal(false)}).pipe(HttpApiSchema.status(statusOf[code]));var chatFailures=[failure("invalid_request",{details:Schema.optionalKey(Schema.Struct({filename:Schema.optionalKey(Schema.String),reason:Schema.Literals(uploadRejectionReasons2)}))}),failure("unauthenticated",{}),failure("forbidden",{details:Schema.Struct({reason:Schema.Literals(chatRefusalReasons2)})}),failure("not_found",{}),failure("conflict",{details:Schema.optionalKey(Schema.Struct({reason:Schema.Literals(chatConflictReasons2)}))}),failure("rate_limited",{}),failure("internal",{}),failure("unavailable",{})];import*as Schema2 from"effect/Schema";var partHeaderBytes=32*1024;var maxFileBytes=10*1024*1024;var maxUploadPartBytes=maxFileBytes+partHeaderBytes;var maxAttachmentsPerUpload=10;var DownloadUrl=Schema2.Struct({expiresIn:Schema2.Int,url:Schema2.String});var storedAttachmentFields={characterCount:Schema2.Int,contentType:Schema2.NullOr(Schema2.String),extension:Schema2.NullOr(Schema2.String),extractionStatus:Schema2.String,filename:Schema2.String,id:AttachmentId2,sizeBytes:Schema2.Int,truncated:Schema2.Boolean,unavailableReason:Schema2.NullOr(Schema2.String)};var UploadAttachmentsPath=Schema3.Struct({conversationId:ConversationId2});var AttachmentsUpload=Schema3.Struct({files:Multipart.FilesSchema}).pipe(HttpApiSchema2.asMultipart({maxFileSize:maxUploadPartBytes,maxParts:maxAttachmentsPerUpload}));var UploadedAttachment=Schema3.Struct(storedAttachmentFields);var UploadAttachmentsResponse=Schema3.Struct({attachments:Schema3.Array(UploadedAttachment)});var AttachmentPath=Schema3.Struct({attachmentId:AttachmentId2,conversationId:ConversationId2});var error=chatFailures;class ChatAttachmentsApi2 extends HttpApiGroup.make("chatAttachments").add(HttpApiEndpoint.post("uploadAttachments","/chat/conversations/:conversationId/attachments",{error,params:UploadAttachmentsPath,payload:AttachmentsUpload,success:UploadAttachmentsResponse.pipe(HttpApiSchema2.status(201))})).add(HttpApiEndpoint.get("getAttachmentDownloadUrl","/chat/conversations/:conversationId/attachments/:attachmentId/download-url",{error,params:AttachmentPath,success:DownloadUrl})){}import{HttpApiEndpoint as HttpApiEndpoint2,HttpApiGroup as HttpApiGroup2}from"effect/http-api";import*as Schema4 from"effect/Schema";var AgentDirectoryEntry=Schema4.Struct({agentType:Schema4.Literals(["organization","personal"]),degraded:Schema4.Boolean,displayName:Schema4.String,fqn:Schema4.String,id:AgentId2,paused:Schema4.Boolean,responsibility:Schema4.String});var ListAgentsResponse=Schema4.Struct({data:Schema4.Array(AgentDirectoryEntry)});var SkillSourceMode=Schema4.Literals(["user","skill"]);var SkillDirectoryEntry=Schema4.Struct({dataAccess:Schema4.NullOr(Schema4.Struct({datasets:Schema4.optionalKey(SkillSourceMode),documents:Schema4.optionalKey(SkillSourceMode),knowledge:Schema4.optionalKey(SkillSourceMode)})),description:Schema4.NullOr(Schema4.String),fqn:Schema4.String,id:Schema4.String,name:Schema4.String,slug:Schema4.String});var ListSkillsResponse=Schema4.Struct({data:Schema4.Array(SkillDirectoryEntry)});var ListToolsQuery=Schema4.Struct({conversationId:Schema4.optionalKey(ConversationId2),usageScope:Schema4.optionalKey(Schema4.Literals(["chat","skill","automation"]))});var ToolCatalogEntry=Schema4.Struct({collectionId:Schema4.NullOr(Schema4.String),description:Schema4.String,displayName:Schema4.String,fqn:Schema4.String,id:Schema4.String,inputSchema:Schema4.Record(Schema4.String,Schema4.Json)});var ListToolsResponse=Schema4.Struct({data:Schema4.Array(ToolCatalogEntry)});var AttachmentFileType=Schema4.Struct({extension:Schema4.String,mediaTypes:Schema4.Array(Schema4.String)});var AttachmentCapabilities=Schema4.Struct({fileTypes:Schema4.Array(AttachmentFileType),projectFileTypes:Schema4.Array(AttachmentFileType)});var error2=chatFailures;class ChatCatalogApi2 extends HttpApiGroup2.make("chatCatalog").add(HttpApiEndpoint2.get("listAgents","/chat/agents",{error:error2,success:ListAgentsResponse})).add(HttpApiEndpoint2.get("listSkills","/chat/skills",{error:error2,success:ListSkillsResponse})).add(HttpApiEndpoint2.get("listTools","/chat/tools",{error:error2,query:ListToolsQuery,success:ListToolsResponse})).add(HttpApiEndpoint2.get("getAttachmentCapabilities","/chat/attachment-capabilities",{error:error2,success:AttachmentCapabilities})){}import{HttpApiEndpoint as HttpApiEndpoint4,HttpApiGroup as HttpApiGroup4,HttpApiSchema as HttpApiSchema4}from"effect/http-api";import*as Schema5 from"effect/Schema";var EvidenceNavigationPath=Schema5.Struct({invocationId:InvocationId2});var EvidenceNavigation=Schema5.Union([Schema5.Struct({entityId:Uuid,kind:Schema5.Literal("entity")}),Schema5.Struct({fileId:Uuid,kind:Schema5.Literal("file")}),Schema5.Struct({kind:Schema5.Literal("external_url"),url:Schema5.String})]);var EvidenceNavigationRequest=Schema5.Struct({evidenceId:Schema5.NonEmptyString,navigation:EvidenceNavigation});var EvidenceNavigationTarget=Schema5.Union([Schema5.Struct({entityId:Uuid,kind:Schema5.Literal("entity")}),Schema5.Struct({fileId:Uuid,kind:Schema5.Literal("file"),mediaUrl:Schema5.optionalKey(Schema5.String)}),Schema5.Struct({kind:Schema5.Literal("external_url"),url:Schema5.String})]);var EvidenceNavigationResponse=Schema5.Struct({target:Schema5.NullOr(EvidenceNavigationTarget)});var ArtifactProgress=Schema5.Struct({currentArtifact:Schema5.NullOr(Schema5.Struct({artifactId:Uuid,contentType:Schema5.NullOr(Schema5.String),filename:Schema5.String,role:Schema5.String,sourceKind:Schema5.String})),failed:Schema5.Int,leased:Schema5.Int,pending:Schema5.Int,processed:Schema5.Int,skipped:Schema5.Int});import*as Schema7 from"effect/Schema";import*as Schema6 from"effect/Schema";import*as SchemaTransformation from"effect/SchemaTransformation";var PlaceKind=Schema6.Literals(placeKinds2);var PlaceSchema=Schema6.Union([Schema6.Struct({id:Schema6.String,kind:Schema6.Literal("studio_app")}),Schema6.Struct({id:Schema6.String,kind:Schema6.Literal("external_app")}),Schema6.Struct({id:Schema6.String,kind:Schema6.Literal("dashboard")})]);var ConversationSubjectSchema=Schema6.Struct({id:Schema6.String,kind:Schema6.Literals(draftSubjectKinds2)});var ConversationPath=Schema6.Struct({conversationId:ConversationId2});var ConversationSchema=Schema6.Struct({agentId:Schema6.NullOr(AgentId2),createdAt:Schema6.NullOr(Schema6.Date),id:ConversationId2,lastActivityAt:Schema6.NullOr(Schema6.Date),lastActivityInvocationId:Schema6.NullOr(Schema6.String),memoryEnabled:Schema6.Boolean,organizationId:Schema6.String,origin:PlaceSchema,projectId:Schema6.NullOr(ProjectId2),subject:Schema6.NullOr(ConversationSubjectSchema),title:Schema6.String,updatedAt:Schema6.NullOr(Schema6.Date),userId:Schema6.NullOr(Schema6.String)});var PlaceParam=Schema6.TemplateLiteralParser([PlaceKind,":",Schema6.String]).pipe(Schema6.decodeTo(PlaceSchema,SchemaTransformation.transform({decode:([kind,,id])=>({id,kind}),encode:(place)=>[place.kind,":",place.id]})));var SubjectParam=Schema6.TemplateLiteralParser([Schema6.Literals(draftSubjectKinds2),":",Schema6.String]).pipe(Schema6.decodeTo(ConversationSubjectSchema,SchemaTransformation.transform({decode:([kind,,id])=>({id,kind}),encode:(subject)=>[subject.kind,":",subject.id]})));var ListConversationsQuery=Schema6.Struct({historyScope:Schema6.optionalKey(Schema6.Array(PlaceParam)),subject:Schema6.optionalKey(SubjectParam)});var ListConversationsResponse=Schema6.Struct({data:Schema6.Array(ConversationSchema)});var CreateConversationRequest=Schema6.Struct({agentId:Schema6.optionalKey(AgentId2),projectId:Schema6.optionalKey(ProjectId2),title:Schema6.optionalKey(Schema6.String)});var UpdateConversationRequest=Schema6.Struct({memoryEnabled:Schema6.optionalKey(Schema6.Boolean),projectId:Schema6.optionalKey(Schema6.NullOr(ProjectId2)),title:Schema6.optionalKey(Schema6.String)});var CompactionState=Schema7.Struct({active:Schema7.Boolean,activeSummary:Schema7.NullOr(Schema7.Struct({id:Uuid,status:Schema7.String,summary:Schema7.String,trigger:Schema7.String})),boundary:Schema7.NullOr(Schema7.Struct({compactedThroughInvocationId:Schema7.NullOr(InvocationId2),coveredInvocationCount:Schema7.Int,coveredMessageCount:Schema7.Int}))});var CompactionResponse=Schema7.Struct({compaction:CompactionState,conversation:ConversationSchema});import*as Effect from"effect/Effect";import*as Schema8 from"effect/Schema";var NamedPlace=Schema8.Struct({id:Schema8.String,kind:PlaceKind,name:Schema8.NullOr(Schema8.String)});var PlaceContextSchema=Schema8.Struct({contextTrailEnabled:Schema8.Boolean.pipe(Schema8.withDecodingDefaultKey(Effect.succeed(false))),contextTrailVisible:Schema8.Boolean.pipe(Schema8.withDecodingDefaultKey(Effect.succeed(false))),places:Schema8.Array(NamedPlace),readAloud:Schema8.Boolean,voiceInputMode:Schema8.optionalKey(Schema8.Literals(["local","remote"]))});import*as Schema10 from"effect/Schema";import{HttpApiEndpoint as HttpApiEndpoint3,HttpApiGroup as HttpApiGroup3}from"effect/http-api";import*as Schema9 from"effect/Schema";var AnswerSentiment=Schema9.Literals(["positive","negative"]);var CurrentUserFeedback=Schema9.Struct({sentiment:Schema9.NullOr(AnswerSentiment),submitterNote:Schema9.NullOr(Schema9.String)});var AnswerFeedbackPath=Schema9.Struct({invocationId:InvocationId2});var AnswerFeedbackRequest=Schema9.Struct({sentiment:AnswerSentiment,submitterNote:Schema9.optionalKey(Schema9.String)});var AnswerFeedbackResponse=Schema9.Struct({currentUserFeedback:CurrentUserFeedback,feedbackTargetId:Uuid});var error3=chatFailures;class ChatFeedbackApi2 extends HttpApiGroup3.make("chatFeedback").add(HttpApiEndpoint3.put("putAnswerFeedback","/chat/answers/:invocationId/feedback",{error:error3,params:AnswerFeedbackPath,payload:AnswerFeedbackRequest,success:AnswerFeedbackResponse})).add(HttpApiEndpoint3.delete("clearAnswerFeedback","/chat/answers/:invocationId/feedback",{error:error3,params:AnswerFeedbackPath,success:AnswerFeedbackResponse})){}var TranscriptToolDisplay=Schema10.Union([Schema10.Struct({kind:Schema10.Literal("text"),text:Schema10.String}),Schema10.Struct({kind:Schema10.Literal("unavailable")})]);var TranscriptAttachment=Schema10.Struct({...storedAttachmentFields,mediaUrl:Schema10.NullOr(Schema10.String)});var ToolDisplayPart=Schema10.Struct({data:Schema10.Unknown,description:Schema10.NullOr(Schema10.String),metadata:Schema10.Record(Schema10.String,Schema10.Unknown),title:Schema10.NullOr(Schema10.String),type:Schema10.String});var ToolTrace=Schema10.Struct({displayName:Schema10.NullOr(Schema10.String),displayParts:Schema10.Array(ToolDisplayPart),durationMs:Schema10.NullOr(Schema10.Finite),error:Schema10.NullOr(Schema10.String),fqn:Schema10.NullOr(Schema10.String),toolId:Schema10.NullOr(Schema10.String)});var InteractionOption=Schema10.Struct({description:Schema10.NullOr(Schema10.String),id:Schema10.String,label:Schema10.String});var InteractionOperation=Schema10.Union([Schema10.Struct({displayName:Schema10.String,kind:Schema10.Literal("tool"),toolFqn:Schema10.String,toolId:Uuid}),Schema10.Struct({displayName:Schema10.String,fqn:Schema10.String,inputs:Schema10.Record(Schema10.String,Schema10.Json),kind:Schema10.Literal("intent")})]);var UserInteraction=Schema10.Struct({allowFreeText:Schema10.Boolean,id:Uuid,kind:Schema10.Literals(["approval","question"]),mode:Schema10.NullOr(Schema10.Literals(["open","single_choice"])),operation:Schema10.NullOr(InteractionOperation),options:Schema10.Array(InteractionOption),preview:Schema10.NullOr(Schema10.String),prompt:Schema10.String,safePreview:Schema10.NullOr(Schema10.String),status:Schema10.Literals(["pending","responding","completed","cancelled","failed"]),summary:Schema10.NullOr(Schema10.String)});var ProcessingEvent=Schema10.Struct({data:Schema10.Record(Schema10.String,Schema10.Unknown),event:Schema10.String});var MemoryEvidenceEvent=Schema10.Struct({category:Schema10.NullOr(Schema10.String),conversationId:Schema10.NullOr(ConversationId2),invocationId:Schema10.NullOr(InvocationId2),kind:Schema10.String,lifecycleStatus:Schema10.NullOr(Schema10.String),memoryId:Schema10.NullOr(Uuid),reason:Schema10.NullOr(Schema10.String),scope:Schema10.NullOr(Schema10.String)});var TranscriptIntentCards=Schema10.optionalKey(Schema10.Array(ciDataPartSchemas2["intent-card"]));var TranscriptRun=Schema10.Struct({approvalRequestId:Schema10.NullOr(Uuid),conversationId:ConversationId2,durationMs:Schema10.Finite,inputTokens:Schema10.Int,intentCards:TranscriptIntentCards,invocationId:InvocationId2,memoryEvidence:Schema10.NullOr(Schema10.Struct({events:Schema10.Array(MemoryEvidenceEvent)})),model:Schema10.NullOr(Schema10.String),output:Schema10.String,outputTokens:Schema10.Int,permissionWait:Schema10.NullOr(Schema10.Struct({capabilityKind:Schema10.Literals(["skill","tool"]),invocationId:InvocationId2,subjectId:Uuid})),processingEvents:Schema10.Array(ProcessingEvent),skillOutcome:Schema10.NullOr(Schema10.String),status:Schema10.String,toolTrace:Schema10.Array(ToolTrace),traceLink:Schema10.optionalKey(Schema10.String),userInteraction:Schema10.NullOr(UserInteraction)});var TranscriptMessage=Schema10.Struct({approvalRequestId:Schema10.NullOr(Uuid),attachments:Schema10.Array(TranscriptAttachment),content:Schema10.String,contextTrail:Schema10.optionalKey(Schema10.Array(contextTrailEntrySchema2)),conversationId:ConversationId2,currentUserFeedback:Schema10.optionalKey(CurrentUserFeedback),feedbackTargetId:Schema10.optionalKey(Uuid),invocationId:InvocationId2,processingEvents:Schema10.Array(ProcessingEvent),role:Schema10.Literals(["assistant","user"]),run:Schema10.optionalKey(TranscriptRun),status:Schema10.String,toolDisplay:TranscriptToolDisplay});var TranscriptSteeringMessage=Schema10.Struct({attachments:Schema10.Array(TranscriptAttachment),claimedAt:Schema10.NullOr(Schema10.Date),content:Schema10.String,id:SteeringMessageId2,invocationId:InvocationId2});var TranscriptAgentTurn=Schema10.Struct({completedAt:Schema10.NullOr(Schema10.Date),createdAt:Schema10.Date,input:Schema10.String,intentCards:TranscriptIntentCards,message:Schema10.NullOr(Schema10.String),sequence:Schema10.Int,status:Schema10.Literals(["pending","completed","failed","cancelled"]),turnId:Uuid});var TranscriptSchema2=Schema10.Struct({agentTurns:Schema10.Array(TranscriptAgentTurn),conversation:Schema10.Struct({agent:Schema10.NullOr(Schema10.Struct({displayName:Schema10.String,id:AgentId2})),compaction:CompactionState,contextUsage:Schema10.Struct({estimatedCharacters:Schema10.Int,fillRatio:Schema10.Finite,thresholdCharacters:Schema10.Int}),id:ConversationId2,title:Schema10.String}),messages:Schema10.Array(TranscriptMessage),steeringMessages:Schema10.Array(TranscriptSteeringMessage)});import{HttpApiSchema as HttpApiSchema3}from"effect/http-api";import*as Schema11 from"effect/Schema";var UIMessageEventStream=Schema11.String.pipe(HttpApiSchema3.asText({contentType:"text/event-stream"}));var UIMessagePart=Schema11.StructWithRest(Schema11.Struct({type:Schema11.String}),[Schema11.Record(Schema11.String,Schema11.Unknown)]);var ChatSendMessage=Schema11.Struct({id:Schema11.NonEmptyString,metadata:Schema11.optionalKey(Schema11.Unknown),parts:Schema11.Array(UIMessagePart),role:Schema11.Literals(["system","user","assistant"])});var ChatSendRequestSchema=Schema11.Struct({message:ChatSendMessage,messageId:Schema11.optionalKey(Schema11.String),trigger:Schema11.Literals(["submit-message","regenerate-message"])});var RunPath=Schema11.Struct({runId:InvocationId2});var TurnStatus=Schema11.Literals(["cancelled","completed","error","running","waiting_for_approval"]);var TurnPath=Schema11.Struct({invocationId:InvocationId2});var ConversationTurnPath=Schema11.Struct({conversationId:ConversationId2,invocationId:InvocationId2});var TurnWaitResponse=Schema11.Struct({waiting:Schema11.Boolean});var CancelTurnResponse=Schema11.Struct({invocationId:InvocationId2,status:TurnStatus});var QueuedMessageRevision=Schema11.Int.check(Schema11.isGreaterThanOrEqualTo(1));var ClientMessageId=Uuid;var QueuedMessageSchema=Schema11.Struct({content:Schema11.String,createdAt:Schema11.Date,id:QueuedMessageId2,invocationId:Schema11.NullOr(InvocationId2),position:Schema11.Int,revision:QueuedMessageRevision,status:Schema11.Literals(["waiting","claimed","removed"])});var SendSteeringMessageRequest=Schema11.Struct({clientMessageId:ClientMessageId,content:Schema11.String,invocationId:InvocationId2});var SendSteeringMessageResponseSchema=Schema11.Union([Schema11.Struct({conversationId:ConversationId2,invocationId:InvocationId2,outcome:Schema11.Literal("started"),status:TurnStatus}),Schema11.Struct({conversationId:ConversationId2,invocationId:InvocationId2,outcome:Schema11.Literal("saved"),status:TurnStatus,steeringMessageId:SteeringMessageId2}),Schema11.Struct({conversationId:ConversationId2,outcome:Schema11.Literal("queued"),queuedMessageId:QueuedMessageId2,revision:QueuedMessageRevision})]);var QueueMessageRequest=Schema11.Struct({clientMessageId:ClientMessageId,content:Schema11.String});var QueueMessageResponseSchema=Schema11.Union([Schema11.Struct({conversationId:ConversationId2,outcome:Schema11.Literal("queued"),queuedMessage:QueuedMessageSchema}),Schema11.Struct({conversationId:ConversationId2,invocationId:Schema11.optionalKey(InvocationId2),outcome:Schema11.Literal("started"),queuedMessageId:Schema11.optionalKey(QueuedMessageId2)}),Schema11.Struct({conversationId:ConversationId2,invocationId:InvocationId2,outcome:Schema11.Literal("saved"),steeringMessageId:SteeringMessageId2})]);var ListQueuedMessagesResponse=Schema11.Struct({data:Schema11.Array(QueuedMessageSchema)});var QueuedMessagePath=Schema11.Struct({conversationId:ConversationId2,queuedMessageId:QueuedMessageId2});var UpdateQueuedMessageRequest=Schema11.Struct({content:Schema11.String,revision:QueuedMessageRevision});var RemoveQueuedMessageQuery=Schema11.Struct({revision:Schema11.NumberFromString.pipe(Schema11.check(Schema11.isInt(),Schema11.isGreaterThanOrEqualTo(1)))});var error4=chatFailures;class ChatApi2 extends HttpApiGroup4.make("chat").add(HttpApiEndpoint4.get("listConversations","/chat/conversations",{error:error4,query:ListConversationsQuery,success:ListConversationsResponse})).add(HttpApiEndpoint4.post("createConversation","/chat/conversations",{error:error4,payload:CreateConversationRequest,success:ConversationSchema.pipe(HttpApiSchema4.status(201))})).add(HttpApiEndpoint4.get("getConversation","/chat/conversations/:conversationId",{error:error4,params:ConversationPath,success:ConversationSchema})).add(HttpApiEndpoint4.patch("updateConversation","/chat/conversations/:conversationId",{error:error4,params:ConversationPath,payload:UpdateConversationRequest,success:ConversationSchema})).add(HttpApiEndpoint4.delete("deleteConversation","/chat/conversations/:conversationId",{error:error4,params:ConversationPath,success:HttpApiSchema4.NoContent})).add(HttpApiEndpoint4.get("getTranscript","/chat/conversations/:conversationId/transcript",{error:error4,params:ConversationPath,success:TranscriptSchema2})).add(HttpApiEndpoint4.post("send","/chat/:conversationId",{error:error4,params:ConversationPath,payload:ChatSendRequestSchema,success:UIMessageEventStream})).add(HttpApiEndpoint4.get("resumeStream","/chat/:conversationId/stream",{error:error4,params:ConversationPath,success:[UIMessageEventStream,HttpApiSchema4.NoContent]})).add(HttpApiEndpoint4.get("streamRun","/runs/:runId/stream",{error:error4,params:RunPath,success:UIMessageEventStream})).add(HttpApiEndpoint4.get("watchTurnWait","/chat/conversations/:conversationId/turns/:invocationId/wait",{error:error4,params:ConversationTurnPath,success:TurnWaitResponse})).add(HttpApiEndpoint4.post("cancelTurn","/chat/turns/:invocationId/cancel",{error:error4,params:TurnPath,success:CancelTurnResponse})).add(HttpApiEndpoint4.post("sendSteeringMessage","/chat/conversations/:conversationId/steering-messages",{error:error4,params:ConversationPath,payload:SendSteeringMessageRequest,success:SendSteeringMessageResponseSchema})).add(HttpApiEndpoint4.post("queueMessage","/chat/conversations/:conversationId/queued-messages",{error:error4,params:ConversationPath,payload:QueueMessageRequest,success:QueueMessageResponseSchema})).add(HttpApiEndpoint4.get("listQueuedMessages","/chat/conversations/:conversationId/queued-messages",{error:error4,params:ConversationPath,success:ListQueuedMessagesResponse})).add(HttpApiEndpoint4.patch("updateQueuedMessage","/chat/conversations/:conversationId/queued-messages/:queuedMessageId",{error:error4,params:QueuedMessagePath,payload:UpdateQueuedMessageRequest,success:QueuedMessageSchema})).add(HttpApiEndpoint4.delete("removeQueuedMessage","/chat/conversations/:conversationId/queued-messages/:queuedMessageId",{error:error4,params:QueuedMessagePath,query:RemoveQueuedMessageQuery,success:HttpApiSchema4.NoContent})).add(HttpApiEndpoint4.get("getPlaceContext","/chat/place-context",{error:error4,success:PlaceContextSchema})).add(HttpApiEndpoint4.get("getCompaction","/chat/conversations/:conversationId/compaction",{error:error4,params:ConversationPath,success:CompactionResponse})).add(HttpApiEndpoint4.post("compact","/chat/conversations/:conversationId/compactions",{error:error4,params:ConversationPath,success:CompactionResponse})).add(HttpApiEndpoint4.post("regenerateCompaction","/chat/conversations/:conversationId/compactions/regenerate",{error:error4,params:ConversationPath,success:CompactionResponse})).add(HttpApiEndpoint4.delete("resetCompaction","/chat/conversations/:conversationId/compactions/active",{error:error4,params:ConversationPath,success:CompactionResponse})).add(HttpApiEndpoint4.post("resolveEvidenceNavigation","/chat/invocations/:invocationId/evidence-navigation",{error:error4,params:EvidenceNavigationPath,payload:EvidenceNavigationRequest,success:EvidenceNavigationResponse})).add(HttpApiEndpoint4.get("getArtifactProgress","/chat/conversations/:conversationId/artifact-progress",{error:error4,params:ConversationPath,success:ArtifactProgress})){}import*as Effect2 from"effect/Effect";import*as Equal from"effect/Equal";import{HttpClient,HttpClientResponse}from"effect/http";import{HttpApi,HttpApiClient}from"effect/http-api";import*as Option from"effect/Option";import{Multipart as Multipart2}from"effect/http";import{HttpApiEndpoint as HttpApiEndpoint5,HttpApiGroup as HttpApiGroup5,HttpApiSchema as HttpApiSchema5}from"effect/http-api";import*as Schema12 from"effect/Schema";var ProjectName=Schema12.Trim.check(Schema12.isMinLength(1),Schema12.isMaxLength(200));var ProjectInstructions=Schema12.String.check(Schema12.isMaxLength(8000));var ProjectPath=Schema12.Struct({projectId:ProjectId2});var ProjectCreateRequest=Schema12.Struct({name:ProjectName});var ProjectUpdateRequest=Schema12.Struct({instructions:Schema12.optionalKey(Schema12.NullOr(ProjectInstructions)),name:Schema12.optionalKey(ProjectName)});var ProjectSchema=Schema12.Struct({createdAt:Schema12.Date,id:ProjectId2,instructions:Schema12.NullOr(Schema12.String),name:Schema12.String,updatedAt:Schema12.Date});var ProjectList=Schema12.Struct({data:Schema12.Array(ProjectSchema)});var ProjectFilePath=Schema12.Struct({fileId:ProjectFileId2,projectId:ProjectId2});var ProjectFileSchema=Schema12.Struct({contentType:Schema12.NullOr(Schema12.String),createdAt:Schema12.Date,extractionState:Schema12.Literals(["available","truncated","failed"]),filename:Schema12.String,id:ProjectFileId2,inContext:Schema12.Boolean,sizeBytes:Schema12.Int});var ProjectFileList=Schema12.Struct({files:Schema12.Array(ProjectFileSchema),maxCharacters:Schema12.Int,usedCharacters:Schema12.Int});var ProjectFileUpload=Schema12.Struct({file:Multipart2.SingleFileSchema}).pipe(HttpApiSchema5.asMultipart({maxFileSize:maxUploadPartBytes,maxParts:1}));var error5=chatFailures;class ChatProjectsApi2 extends HttpApiGroup5.make("chatProjects").add(HttpApiEndpoint5.get("listProjects","/chat/projects",{error:error5,success:ProjectList})).add(HttpApiEndpoint5.post("createProject","/chat/projects",{error:error5,payload:ProjectCreateRequest,success:ProjectSchema.pipe(HttpApiSchema5.status(201))})).add(HttpApiEndpoint5.patch("updateProject","/chat/projects/:projectId",{error:error5,params:ProjectPath,payload:ProjectUpdateRequest,success:ProjectSchema})).add(HttpApiEndpoint5.delete("deleteProject","/chat/projects/:projectId",{error:error5,params:ProjectPath,success:HttpApiSchema5.NoContent})).add(HttpApiEndpoint5.get("listProjectFiles","/chat/projects/:projectId/files",{error:error5,params:ProjectPath,success:ProjectFileList})).add(HttpApiEndpoint5.post("uploadProjectFile","/chat/projects/:projectId/files",{error:error5,params:ProjectPath,payload:ProjectFileUpload,success:ProjectFileSchema.pipe(HttpApiSchema5.status(201))})).add(HttpApiEndpoint5.delete("deleteProjectFile","/chat/projects/:projectId/files/:fileId",{error:error5,params:ProjectFilePath,success:HttpApiSchema5.NoContent})).add(HttpApiEndpoint5.get("getProjectFileDownloadUrl","/chat/projects/:projectId/files/:fileId/download-url",{error:error5,params:ProjectFilePath,success:DownloadUrl})){}import{HttpApiEndpoint as HttpApiEndpoint6,HttpApiGroup as HttpApiGroup6}from"effect/http-api";import*as Schema13 from"effect/Schema";var maxClipBytes=25*1024*1024;var ClipContentType=Schema13.String.check(Schema13.isMaxLength(255),Schema13.isPattern(/^audio\/[a-z0-9][a-z0-9!#$&^_.+-]*(?:\s*;.*)?$/iu));var CreateSpeechClipRequest=Schema13.Struct({contentType:ClipContentType,size:Schema13.Int.check(Schema13.isBetween({maximum:maxClipBytes,minimum:1}))});var SpeechClipUpload=Schema13.Struct({clipId:SpeechClipId2,headers:Schema13.Record(Schema13.String,Schema13.String),method:Schema13.Literal("PUT"),url:Schema13.String});var TranscribeSpeechClipRequest=Schema13.Struct({clipId:SpeechClipId2});var SpeechTranscription=Schema13.Struct({text:Schema13.String});var ReadAloudPartPath=Schema13.Struct({invocationId:InvocationId2,partIndex:Schema13.NumberFromString.pipe(Schema13.check(Schema13.isInt(),Schema13.isGreaterThanOrEqualTo(0),Schema13.isLessThanOrEqualTo(1e4)))});var ReadAloudPart=Schema13.Struct({partCount:Schema13.Int,url:Schema13.String});var SpeechAvailability=Schema13.Struct({readAloud:Schema13.Boolean,remoteTranscription:Schema13.Boolean});var error6=chatFailures;class ChatSpeechApi2 extends HttpApiGroup6.make("chatSpeech").add(HttpApiEndpoint6.post("createSpeechClip","/chat/speech/clips",{error:error6,payload:CreateSpeechClipRequest,success:SpeechClipUpload})).add(HttpApiEndpoint6.post("transcribeSpeechClip","/chat/speech/transcriptions",{error:error6,payload:TranscribeSpeechClipRequest,success:SpeechTranscription})).add(HttpApiEndpoint6.get("getReadAloudPart","/chat/speech/read-aloud/:invocationId/parts/:partIndex",{error:error6,params:ReadAloudPartPath,success:ReadAloudPart})).add(HttpApiEndpoint6.get("getSpeechAvailability","/chat/speech/availability",{error:error6,success:SpeechAvailability})){}class ChatSurfaceApi2 extends HttpApi.make("chat-surface").add(ChatApi2).add(ChatProjectsApi2).add(ChatAttachmentsApi2).add(ChatSpeechApi2).add(ChatFeedbackApi2).add(ChatCatalogApi2){}var responsesByReference=(client)=>HttpClient.tap(client,(response)=>Effect2.sync(()=>{Equal.byReferenceUnsafe(response);const source=HttpClientResponse.toWeb(response);if(Option.isSome(source)){Equal.byReferenceUnsafe(source.value)}}));var makeChatSurfaceClient2=({transformClient,...options})=>HttpApiClient.make(ChatSurfaceApi2,{...options,transformClient:(client)=>responsesByReference(transformClient?.(client)??client)});
|
|
2
|
+
export{chatRefusalReasons2,chatConflictReasons2,uploadRejectionReasons2,ChatAttachmentsApi2,ChatCatalogApi2,ChatFeedbackApi2,TranscriptSchema2,ChatApi2,ChatProjectsApi2,ChatSpeechApi2,ChatSurfaceApi2,makeChatSurfaceClient2};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{makeChatSurfaceClient2}from"./domain-g97xs965.js";import{AgentId2}from"./domain-5fpd4fte.js";import{ciDataPartSchemas2}from"./domain-50vzrrp9.js";import{ciMessageMetadataSchema2,hasObjectRuntimeKind2,hasStringRuntimeKind2,asRuntimeValue2}from"./domain-s07s1ry1.js";import{aiErrorCodes2,AiFailureError2}from"./domain-9wzbv87n.js";import{createContext,useContext,useEffect,useMemo,useRef,useState,useSyncExternalStore}from"react";var sameItems=(left,right)=>left.length===right.length&&left.every((item,at)=>item===right[at]);var takesLaunches=({receive})=>receive!==undefined;var retryPause=(attempt)=>Math.min(1000*2**attempt,30000);var pause=async(milliseconds,signal)=>{if(signal.aborted){return}await new Promise((resolve)=>{const timeout=globalThis.setTimeout(resolve,milliseconds);signal.addEventListener("abort",()=>{globalThis.clearTimeout(timeout);resolve()},{once:true})})};var waitAnswer=async(intents,handle,signal)=>{try{return await intents.call("wait",{handle},{signal})}catch{return}};var followRun=async(intents,handle,signal)=>{for(let attempt=0;!signal.aborted;attempt+=1){const answer=await waitAnswer(intents,handle,signal);if(answer!==undefined&&(answer.ok||!answer.error.retryable)){return signal.aborted?undefined:answer}await pause(retryPause(attempt),signal)}return};var createPageRegistry=()=>{const root={parent:undefined};const subscribers=new Set;const listeners=new Set;const running=new Map;const lookups=new WeakMap;let registered=[];let version=0;let waits=[];let shown=[];let adoptions=[];let connection;let fallback;const changed=()=>{for(const onChange of subscribers){onChange()}};const publish=(notice)=>{for(const{fqn,listener}of listeners){if(fqn===notice.fqn){listener(notice)}}};const persist=()=>{connection?.waits?.write(waits)};const drop=(handle)=>{running.delete(handle);waits=waits.filter((wait)=>wait.handle!==handle);persist()};const show=(notice)=>{shown=[...shown.filter(({id})=>id!==notice.id),notice];changed()};const follow=async(wait,intents)=>{const controller=new AbortController;running.set(wait.handle,controller);const answer=await followRun(intents,wait.handle,controller.signal);if(answer===undefined){return}if(!answer.ok){if(answer.error.code==="not_found"){drop(wait.handle)}else{running.delete(wait.handle)}return}const outcome=answer.value;const{displayName,fqn,handle}=wait;drop(handle);show({displayName,fqn,id:handle,outcome});publish({fqn,handle,outcome})};const followAdoption=async(adoption,intents)=>{const stop=new AbortController;adoption.stop=stop;const{fqn,handle}=adoption.returned;const answer=await followRun(intents,handle,stop.signal);if(answer===undefined){return}if(!answer.ok){if(answer.error.code==="not_found"){adoptions=adoptions.filter((other)=>other!==adoption)}else{adoption.stop=undefined}return}adoption.end={fqn,handle,outcome:answer.value};changed();publish(adoption.end)};const startAdoption=(adoption)=>{const intents=connection?.api;if(intents!==undefined&&adoption.stop===undefined){followAdoption(adoption,intents)}};const piecesOf=(scope,kind)=>{const byKind=lookups.get(scope)??new Map;lookups.set(scope,byKind);const cached=byKind.get(kind);if(cached?.version===version){return cached.pieces}const found=[];for(let at=scope;at;at=at.parent){for(const entry of registered){if(entry.scope===at&&entry.piece.kind===kind){found.push(entry.piece)}}}const pieces=cached!==undefined&&sameItems(cached.pieces,found)?cached.pieces:found;byKind.set(kind,{pieces,version});return pieces};const start=(wait)=>{const intents=connection?.api;if(intents!==undefined&&!running.has(wait.handle)){follow(wait,intents)}};return{adopt:(returned)=>{const adoption={end:undefined,returned,stop:undefined};adoptions=[adoption,...adoptions];startAdoption(adoption);return()=>{adoption.stop?.abort();adoptions=adoptions.filter((other)=>other!==adoption);if(adoption.end!==undefined){changed()}}},adopted:(fqn)=>adoptions.find(({end})=>end?.fqn===fqn)?.end,connect:(next)=>{connection=next;fallback=next.launchFallback===undefined?undefined:{id:"host",kind:"chat",preferred:false,receive:next.launchFallback};changed();waits=next.waits?.read()??waits;for(const wait of waits){start(wait)}for(const adoption of adoptions){startAdoption(adoption)}return()=>{connection=undefined;fallback=undefined;changed();for(const controller of running.values()){controller.abort()}running.clear();for(const adoption of adoptions){if(adoption.end===undefined){adoption.stop?.abort();adoption.stop=undefined}}}},dismiss:(id)=>{shown=shown.filter((notice)=>notice.id!==id);changed()},keep:(wait)=>{if(waits.some(({handle})=>handle===wait.handle)){return}waits=[...waits,wait];persist();start(wait)},launchTarget:(scope,target)=>{const chats=registered.map(({piece})=>piece).filter((piece)=>piece.kind==="chat"&&takesLaunches(piece));return chats.find(({id})=>id===target)??chats.find(({preferred})=>preferred)??piecesOf(scope,"chat").find(takesLaunches)??fallback},listen:(fqn,listener)=>{const entry={fqn,listener};listeners.add(entry);for(const{end}of adoptions){if(end?.fqn===fqn){listener(end)}}return()=>{listeners.delete(entry)}},notices:()=>shown,pieces:piecesOf,publish,register:(scope,piece)=>{const entry={piece,scope};registered=[...registered,entry];version+=1;changed();return()=>{registered=registered.filter((other)=>other!==entry);version+=1;changed()}},root,show,subscribe:(onChange)=>{subscribers.add(onChange);return()=>{subscribers.delete(onChange)}}}};import{jsx}from"react/jsx-runtime";var IntentsContext=createContext(undefined);var useIntentsScope2=()=>{const scope=useContext(IntentsContext);if(scope===undefined){throw new Error("Render the Intent controls and hooks inside <IntentsProvider>.")}return scope};var useOptionalIntentsScope2=()=>useContext(IntentsContext);var apiScopes=new WeakMap;var apiCount=0;var apiScopeOf=(api)=>{const known=apiScopes.get(api);if(known!==undefined){return known}apiCount+=1;const scope=`api:${apiCount}`;apiScopes.set(api,scope);return scope};var cacheScopeOf=(api,caller)=>{const apiScope=api===undefined?"none":apiScopeOf(api);return caller===undefined?apiScope:`${apiScope}:caller:${caller}`};var IntentsProvider2=({access,api,caller,children,launchFallback,waits})=>{const[owned,setOwned]=useState(()=>({caller,registry:createPageRegistry()}));if(owned.caller!==caller){setOwned({caller,registry:createPageRegistry()})}const{registry}=owned;useEffect(()=>registry.connect({api,launchFallback,waits}),[api,launchFallback,registry,waits]);const value=useMemo(()=>({access,api,cacheScope:cacheScopeOf(api,caller),registry,scope:registry.root}),[access,api,caller,registry]);return jsx(IntentsContext.Provider,{value,children})};var IntentsRegistryScope2=({children})=>{const parent=useIntentsScope2();const value=useMemo(()=>({...parent,scope:{parent:parent.scope}}),[parent]);return jsx(IntentsContext.Provider,{value,children})};var useRegisterPieceIn=(intents,{id,kind,preferred=false,receive})=>{const{registry,scope}=intents??{};const latest=useRef(receive);useEffect(()=>{latest.current=receive});const receives=receive!==undefined;useEffect(()=>registry===undefined||scope===undefined?undefined:registry.register(scope,{id,kind,preferred,receive:receives?(launch)=>{latest.current?.(launch)}:undefined}),[id,kind,preferred,receives,registry,scope])};var useRegisterPiece2=(registration)=>{useRegisterPieceIn(useIntentsScope2(),registration)};var useRegisterOptionalPiece=(registration)=>{useRegisterPieceIn(useOptionalIntentsScope2(),registration)};var usePieces2=(kind)=>{const{registry,scope}=useIntentsScope2();return useSyncExternalStore(registry.subscribe,()=>registry.pieces(scope,kind),()=>registry.pieces(scope,kind))};var useIntentResult2=(fqn,listener)=>{const{registry}=useIntentsScope2();const latest=useRef(listener);useEffect(()=>{latest.current=listener});useEffect(()=>registry.listen(fqn,(notice)=>{latest.current(notice)}),[fqn,registry])};var chatBlockedKinds2=["sign_in_to_chat","chat_not_available","app_not_available","service_not_available"];var chatBlockedState=(error,read)=>{if(error.code==="unauthenticated"){return{error,kind:"sign_in_to_chat"}}if(error.code==="forbidden"&&error.reason==="capability_missing"){return{error,kind:"chat_not_available"}}if(error.code==="forbidden"&&error.reason==="app_disabled"){return{error,kind:"app_not_available"}}if(read==="first"&&(error.code==="unavailable"||error.code==="internal")){return{error,kind:"service_not_available"}}return null};import{useChat}from"@ai-sdk/react";import{useActorRef,useSelector}from"@xstate/react";import*as Effect3 from"effect/Effect";import{createContext as createContext2,useCallback,useContext as useContext2,useEffect as useEffect2,useMemo as useMemo2,useState as useState2,useSyncExternalStore as useSyncExternalStore2}from"react";import*as Context from"effect/Context";import*as Duration from"effect/Duration";import*as Effect from"effect/Effect";import{FetchHttpClient,HttpClientError}from"effect/http";import*as Layer from"effect/Layer";import*as ManagedRuntime from"effect/ManagedRuntime";import*as Option from"effect/Option";import*as Schedule from"effect/Schedule";import*as Schema from"effect/Schema";class ChatSurface extends Context.Service()("@collective-intelligence/ai/headless/ChatSurface"){}var platformFetch=(fetch)=>Object.assign((input,init)=>fetch(input,init),{preconnect:()=>null});var chatSurfaceLayer=({fetch,...client})=>{const http=fetch===undefined?FetchHttpClient.layer:FetchHttpClient.layer.pipe(Layer.provide(Layer.succeed(FetchHttpClient.Fetch)(platformFetch(fetch))));return Layer.effect(ChatSurface)(makeChatSurfaceClient2(client)).pipe(Layer.provide(http))};var makeChatSessionRuntime=(options)=>ManagedRuntime.make(chatSurfaceLayer(options));var decodeEnvelope=Schema.decodeUnknownOption(Schema.Struct({error:Schema.Struct({code:Schema.Literals(aiErrorCodes2),details:Schema.optionalKey(Schema.Struct({reason:Schema.optionalKey(Schema.String)})),message:Schema.String,retryable:Schema.Boolean})}));var codeOfStatus=(status)=>{if(status===401){return"unauthenticated"}if(status===403){return"forbidden"}if(status===404){return"not_found"}if(status===409){return"conflict"}if(status===429){return"rate_limited"}if(status>=500){return"unavailable"}return"invalid_request"};var clientFailure=(failure)=>{const{reason}=failure;if(reason._tag==="TransportError"){return{code:"unavailable",message:failure.message,retryable:true}}if(reason._tag==="StatusCodeError"){const code=codeOfStatus(reason.response.status);return{code,message:failure.message,retryable:code==="rate_limited"||code==="unavailable"}}return{code:"internal",message:failure.message,retryable:false}};var toSessionFailure=(cause)=>{if(cause instanceof AiFailureError2){return cause}if(HttpClientError.isHttpClientError(cause)){return new AiFailureError2(clientFailure(cause),{cause})}return Option.match(decodeEnvelope(cause),{onNone:()=>new AiFailureError2({code:"internal",message:cause instanceof Error?cause.message:String(cause),retryable:false},{cause}),onSome:({error})=>{const failure={code:error.code,message:error.message,retryable:error.retryable};const reason=error.details?.reason;return new AiFailureError2(reason===undefined?failure:{...failure,reason},{cause})}})};var callChatSurface=(operation)=>Effect.gen(function*call(){const client=yield*ChatSurface;return yield*operation(client).pipe(Effect.mapError(toSessionFailure),Effect.catchDefect((defect)=>Effect.fail(toSessionFailure(defect))))});var retryRead=(read)=>Effect.retry(read,{schedule:Schedule.exponential(Duration.millis(100)),times:3,while:(failure)=>failure.error.retryable});var retryWatch=(watch)=>Effect.retry(watch,{schedule:Schedule.min([Schedule.exponential(Duration.millis(100)),Schedule.spaced(Duration.seconds(5))]),while:(failure)=>failure.error.retryable});var chatFeatureFlags2={memory:"memory",projects:"projects"};var chatControls=(host)=>{const isOn=(flag)=>host.flags?.isEnabled(flag)??true;return{files:host.files,memory:isOn(chatFeatureFlags2.memory),openTarget:host.openTarget,projects:isOn(chatFeatureFlags2.projects),trail:host.trail,voiceInput:host.speechInput}};var createBrowserFilePort2=()=>({download:(file)=>{const link=document.createElement("a");link.href=file.url;link.download=file.filename;link.rel="noopener";document.body.append(link);link.click();link.remove();return Promise.resolve()},open:(file)=>{window.open(file.url,"_blank","noopener");return Promise.resolve()}});var endedCards=(messages)=>messages.flatMap(({parts})=>parts.flatMap((part)=>part.type==="data-intent-card"&&(part.data.state==="completed"||part.data.state==="failed")?[part.data]:[]));var intentCardReloadMs=5000;var intentCardPending=(messages)=>messages.some(({parts})=>parts.some((part)=>part.type==="data-intent-card"&&part.data.state==="running"));var noticeOf=(card)=>({fqn:card.fqn,handle:card.dispatchId,outcome:card.state==="completed"?{kind:"completed",result:card.result}:{kind:"failed",reason:card.reason}});var createIntentCardEndTracker=()=>{let known;return{observe:(status,messages)=>{if(status!=="ready"){known=undefined;return[]}const ended=endedCards(messages);if(known===undefined){known=new Set(ended.map(({dispatchId})=>dispatchId));return[]}const seen=known;const fresh=ended.filter(({dispatchId})=>!seen.has(dispatchId));for(const{dispatchId}of fresh){seen.add(dispatchId)}return fresh.map(noticeOf)}}};import{fromEffect}from"@collective-intelligence/effect-xstate/actors";import{isToolUIPart}from"ai";import{SecureRandom}from"effect/crypto";import*as Effect2 from"effect/Effect";import{assign,enqueueActions,fromCallback,raise,setup}from"xstate";import{Chat}from"@ai-sdk/react";import{lastAssistantMessageIsCompleteWithApprovalResponses}from"ai";import*as Option3 from"effect/Option";import*as Schema4 from"effect/Schema";import*as Schema3 from"effect/Schema";import*as Option2 from"effect/Option";import*as Schema2 from"effect/Schema";var openRunStates2=["pending","running","resuming","paused","reconciliation_required","waiting_for_approval","waiting_for_input","waiting_for_permission"];var endedRunStates=["completed","cancelled","error","failed"];var open=new Set(openRunStates2);var isOpenRunState2=(state)=>open.has(state);var decodeRunState=Schema2.decodeUnknownOption(Schema2.Literals([...openRunStates2,...endedRunStates]));var runStateOf=(status)=>Option2.getOrNull(decodeRunState(status));var isOpen=(status)=>{const state=runStateOf(status);return state!==null&&isOpenRunState2(state)};var openTurnOf=({messages})=>{const newest=messages.at(-1);if(newest===undefined){return null}return newest.role==="user"||isOpen(newest.run?.status??newest.status)?{invocationId:newest.invocationId}:null};var openAgentTurnOf=({agentTurns})=>agentTurns.at(-1)?.status==="pending"?{invocationId:null}:null;var textParts=(text)=>text===""?[]:[{text,type:"text"}];var unknownMediaType="application/octet-stream";var attachmentParts=(message)=>message.attachments.map((attachment)=>({filename:attachment.filename,mediaType:attachment.contentType??unknownMediaType,type:"file",url:attachment.mediaUrl??""}));var answerMetadata=(message)=>({invocationId:message.invocationId,...message.currentUserFeedback!==undefined&&{currentUserFeedback:message.currentUserFeedback},...message.feedbackTargetId!==undefined&&{feedbackTargetId:message.feedbackTargetId},...message.run?.traceLink!==undefined&&{traceLink:message.run.traceLink}});var steeringParts=(transcript,invocationId)=>transcript.steeringMessages.filter((steering)=>steering.invocationId===invocationId).map((steering)=>({id:steering.id,parts:[{text:steering.content,type:"text"}],type:"steering-message"}));var isMemoryEvent=Schema3.is(ciDataPartSchemas2["memory-evidence"].fields.events.value);var memoryParts=(invocationId,run)=>{const events=(run?.memoryEvidence?.events??[]).flatMap((event)=>{const shown={category:event.category,kind:event.kind,lifecycleStatus:event.lifecycleStatus,memoryId:event.memoryId,reason:event.reason,scope:event.scope};return isMemoryEvent(shown)?[shown]:[]});return events.length===0?[]:[{data:{events},id:`memory-evidence-${invocationId}`,type:"data-memory-evidence"}]};var imageParts=(invocationId,run)=>(run?.toolTrace??[]).flatMap((trace,traceIndex)=>trace.displayParts.flatMap((part,partIndex)=>part.type==="image_generation"?[{input:{},output:part.data,state:"output-available",toolCallId:`image-generation-${invocationId}-${traceIndex}-${partIndex}`,toolName:trace.fqn??trace.displayName??"image_generation",type:"dynamic-tool"}]:[]));var intentCardParts=(cards)=>(cards??[]).map((card)=>({data:card,id:`intent-card-${card.dispatchId}`,type:"data-intent-card"}));var agentTurnMessages=(turn)=>{const parts=[...textParts(turn.message??""),...intentCardParts(turn.intentCards)];return[{id:`user-${turn.turnId}`,parts:textParts(turn.input),role:"user"},...turn.message===null&&parts.length===0?[]:[{id:turn.turnId,parts,role:"assistant"}]]};var conversationMessages=(transcript)=>{if(transcript.conversation.agent!==null){return{messages:transcript.agentTurns.flatMap(agentTurnMessages),openTurn:openAgentTurnOf(transcript)}}const openTurn=openTurnOf(transcript);const messages=transcript.messages.flatMap((message)=>{if(message.role==="user"){return[{id:`user-${message.invocationId}`,metadata:{invocationId:message.invocationId,...message.contextTrail!==undefined&&{turnOptions:{contextTrail:message.contextTrail}}},parts:[...attachmentParts(message),...textParts(message.content)],role:"user"}]}if(message.invocationId===openTurn?.invocationId){return[]}return[{id:message.invocationId,metadata:answerMetadata(message),parts:[...steeringParts(transcript,message.invocationId),...imageParts(message.invocationId,message.run),...textParts(message.content),...intentCardParts(message.run?.intentCards),...memoryParts(message.invocationId,message.run)],role:"assistant"}]});return{messages,openTurn}};var sentFileParts=(files,uploaded)=>uploaded.flatMap(({contentType,filename},index)=>{const file=files[index];return file===undefined?[]:[{filename,mediaType:contentType??(file.type===""?unknownMediaType:file.type),type:"file",url:URL.createObjectURL(file)}]});var revokeSentFiles=(messages)=>{for(const{parts}of messages){for(const part of parts){if(part.type==="file"&&part.url.startsWith("blob:")){URL.revokeObjectURL(part.url)}}}};var newChatId="new-chat";var decodeMetadata=Schema4.decodeUnknownOption(ciMessageMetadataSchema2);var namedTurnOf=(chunk)=>chunk.type==="start"?Option3.getOrUndefined(decodeMetadata(chunk.messageMetadata))?.invocationId:undefined;var watched=(stream,{finish,named})=>{finish.finishReason="none";return stream.pipeThrough(new TransformStream({transform:(chunk,controller)=>{if(chunk.type==="finish"){finish.finishReason=chunk.finishReason??"stop"}controller.enqueue(chunk);const invocationId=namedTurnOf(chunk);if(invocationId!==undefined){named(invocationId)}}}))};var isNetworkFailure=(error)=>{if(!(error instanceof TypeError)){return false}const message=error.message.toLowerCase();return message.includes("fetch")||message.includes("network")||message==="load failed"};var networkFailureOf=(failure)=>{const cause=failure instanceof AiFailureError2?failure.cause:failure;return cause instanceof TypeError&&isNetworkFailure(cause)?cause:null};var watchedTransport=(transport,watch)=>({onResumeEmpty:transport.onResumeEmpty,reconnectToStream:async(request)=>{const stream=await transport.reconnectToStream(request);return stream===null?null:watched(stream,watch)},resumeStreamIsReplay:transport.resumeStreamIsReplay??false,sendMessages:async(request)=>{try{return watched(await transport.sendMessages(request),watch)}catch(error){throw networkFailureOf(error)??error}}});var streamEnd=({isAbort,isDisconnect,isError},{finishReason})=>{if(isAbort){return"stopped"}if(isDisconnect){return"disconnected"}if(isError){return"failed"}return finishReason==="none"||finishReason==="interrupted"?"cut":"ended"};var errorOf=(error)=>{if(error instanceof AiFailureError2){return error.error}return isNetworkFailure(error)?{code:"unavailable",message:error.message,retryable:true}:{code:"internal",message:error.message,retryable:false}};var makeChatRegistry=(transport)=>{const chats=new Map;const listeners=new Set;const tell=(event)=>{for(const listener of listeners){listener(event)}};const make=(conversationId)=>{const finish={finishReason:"none"};const chat=new Chat({dataPartSchemas:ciDataPartSchemas2,id:conversationId??newChatId,messageMetadataSchema:ciMessageMetadataSchema2,onData:(part)=>{if(conversationId!==null&&part.type==="data-run-status"){tell({conversationId,runStatus:part.data,type:"chat.run_status"})}},onError:(error)=>{if(conversationId!==null){tell({conversationId,dropped:isNetworkFailure(error),error:errorOf(error),type:"chat.failed"})}},onFinish:(options)=>{if(conversationId!==null){tell({conversationId,end:streamEnd(options,finish),type:"chat.finished"})}},sendAutomaticallyWhen:lastAssistantMessageIsCompleteWithApprovalResponses,transport:watchedTransport(transport,{finish,named:(invocationId)=>{if(conversationId!==null){tell({conversationId,invocationId,type:"chat.turn_named"})}}})});chats.set(conversationId??newChatId,chat);return chat};return{chat:(conversationId)=>chats.get(conversationId??newChatId)??make(conversationId),dispose:()=>{for(const chat of chats.values()){chat.stop();revokeSentFiles(chat.messages)}chats.clear()},subscribe:(listener)=>{listeners.add(listener);return()=>{listeners.delete(listener)}}}};import*as DateTime from"effect/DateTime";var trailBufferSize2=50;var isMetadata=(entry)=>("source"in entry)&&!("event"in entry);var createTrailBuffer2=(now=()=>DateTime.formatIso(DateTime.nowUnsafe()))=>{const subscribers=new Set;const metadataKeys=new Map;let entries=[];let latestVisit;let recording=false;const notify=()=>{for(const onChange of subscribers){onChange()}};const commit=(next)=>{let kept=next;while(kept.length>trailBufferSize2){const oldest=kept.findIndex((entry)=>!isMetadata(entry));const dropped=oldest===-1?0:oldest;kept=kept.filter((_,at)=>at!==dropped)}entries=kept;notify()};const withoutMetadataOf=(source)=>entries.filter((entry)=>!isMetadata(entry)||entry.source!==source);return{clearMetadata:(source)=>{if(!metadataKeys.delete(source)){return}const next=withoutMetadataOf(source);if(next.length!==entries.length){commit(next)}},entries:()=>entries,pushEvent:(source,{event,...data})=>{if(recording){commit([...entries,{at:now(),data,event,source}])}},recordPageVisit:({app,page,title})=>{if(!recording){return}const latest=latestVisit;if(latest?.app===app&&latest.page===page){if(latest.title===title){return}const retitled={...latest,title};latestVisit=retitled;if(entries.includes(latest)){commit(entries.map((entry)=>entry===latest?retitled:entry))}return}const visit={app,at:now(),page,title};latestVisit=visit;commit([...entries,visit])},recording:()=>recording,remove:(entry)=>{if(entries.includes(entry)){commit(entries.filter((other)=>other!==entry))}},setMetadata:(source,data)=>{if(!recording){return}const key=JSON.stringify(data);if(metadataKeys.get(source)===key){return}metadataKeys.set(source,key);commit([...withoutMetadataOf(source),{at:now(),data,source}])},setRecording:(enabled)=>{if(enabled===recording){return}recording=enabled;if(!enabled){metadataKeys.clear();latestVisit=undefined;entries=[]}notify()},subscribe:(onChange)=>{subscribers.add(onChange);return()=>{subscribers.delete(onChange)}}}};var turnTrail2=(trail,launched=[])=>{if(trail===undefined||!trail.recording()){return}const entries=launched.length===0?trail.entries():[...trail.entries(),...launched];return entries.length===0?undefined:entries};var noFollow={invocationId:null,joined:false,next:null};var userMessageCount=(messages)=>messages.filter(({role})=>role==="user").length;var turnEnded="turn_ended";var answeredEndedTurn=({code,reason})=>code==="conflict"&&reason===turnEnded;var refusal=(message)=>({code:"invalid_request",message,retryable:false});var noOpenConversation=refusal("No Conversation is open.");var runningAnswerTakesNoFiles=refusal("A message to a running answer takes no attachments.");var noRunningTurn=refusal("The running answer has no turn id yet.");var composerBusy=refusal("The last message is still on its way: send again once it has gone.");var launchIntoBusyConversation={code:"conflict",message:"Another turn of this conversation is running.",reason:"intent_turn_busy",retryable:false};var userMessage=(id,text)=>({id,parts:[{text,type:"text"}],role:"user"});var failureOf=(error)=>error instanceof AiFailureError2?error.error:{code:"internal",message:error instanceof Error?error.message:String(error),retryable:false};var blocks=(error,read)=>chatBlockedState(failureOf(error),read)!==null;var failedWith=(read)=>({event})=>{const failure=failureOf("error"in event?event.error:undefined);return{blocked:chatBlockedState(failure,read),failure}};var draftBack=({draft,sending})=>draft===""?sending:draft;var sendFailedWith=(read)=>(args)=>({...failedWith(read)(args),draft:draftBack(args.context),sending:""});var onConversation=(conversationId,operation)=>conversationId===null?Effect2.fail(new AiFailureError2(noOpenConversation)):operation(conversationId);var titleOf=(text)=>text.trim().split(/\s+/u).slice(0,6).join(" ");var uploadFiles=(conversationId,{files=[],...submit})=>{if(files.length===0){return Effect2.succeed(submit)}const payload=new FormData;for(const file of files){payload.append("files",file)}return Effect2.map(callChatSurface((client)=>client.chatAttachments.uploadAttachments({params:{conversationId},payload})),({attachments})=>({...submit,attachmentIds:[...submit.attachmentIds??[],...attachments.map(({id})=>id)],fileParts:sentFileParts(files,attachments)}))};var hasAttachments=({attachmentIds=[],files=[]})=>attachmentIds.length>0||files.length>0;var listConversations=({historyScope,subject})=>Effect2.map(callChatSurface((client)=>client.chat.listConversations({query:{...historyScope!==undefined&&{historyScope},...subject!==undefined&&{subject}}})),({data})=>data);var actors={cancelTurn:fromEffect(({invocationId})=>invocationId===null?Effect2.void:Effect2.asVoid(callChatSurface((client)=>client.chat.cancelTurn({params:{invocationId}})))),changeQueued:fromEffect(({change,conversationId})=>onConversation(conversationId,(id)=>{if(change===null){return Effect2.void}const params={conversationId:id,queuedMessageId:change.queuedMessageId};return Effect2.asVoid(change.type==="UPDATE_QUEUED"?callChatSurface((client)=>client.chat.updateQueuedMessage({params,payload:{content:change.content,revision:change.revision}})):callChatSurface((client)=>client.chat.removeQueuedMessage({params,query:{revision:change.revision}})))})),chatEvents:fromCallback(({input:{registry,transport},sendBack})=>{const stopChats=registry.subscribe(sendBack);const stopResumeEmpty=transport.onResumeEmpty(({conversationId})=>{sendBack({conversationId,type:"chat.resume_empty"})});return()=>{stopChats();stopResumeEmpty();registry.dispose()}}),createConversation:fromEffect(({newChat,submit})=>{const title=titleOf(submit.text);return Effect2.flatMap(callChatSurface((client)=>client.chat.createConversation({payload:title===""?newChat:{...newChat,title}})),(conversation)=>Effect2.match(uploadFiles(conversation.id,submit),{onFailure:({error})=>({conversation,submit,uploadFailure:error}),onSuccess:(uploaded)=>({conversation,submit:uploaded,uploadFailure:null})}))}),listConversations:fromEffect((filter)=>retryRead(listConversations(filter))),listQueued:fromEffect(({conversationId})=>onConversation(conversationId,(id)=>retryRead(Effect2.map(callChatSurface((client)=>client.chat.listQueuedMessages({params:{conversationId:id}})),({data})=>data)))),loadSession:fromEffect(({historyScope,placeContext,subject,trail})=>Effect2.all({conversations:retryRead(listConversations({historyScope,subject})),placeContext:placeContext===null?retryRead(callChatSurface((client)=>client.chat.getPlaceContext())).pipe(Effect2.tap(({contextTrailEnabled})=>Effect2.sync(()=>{trail?.setRecording(contextTrailEnabled)}))):Effect2.succeed(placeContext)},{concurrency:"unbounded"})),queueMessage:fromEffect(({conversationId,launchId,text})=>onConversation(conversationId,(id)=>{const clientMessageId=launchId??SecureRandom.uuidV4Unsafe();return Effect2.map(callChatSurface((client)=>client.chat.queueMessage({params:{conversationId:id},payload:{clientMessageId,content:text}})),(answer)=>({answer,clientMessageId,text}))})),readMessages:fromEffect(({conversationId,resume})=>onConversation(conversationId,(id)=>retryRead(Effect2.map(callChatSurface((client)=>client.chat.getTranscript({params:{conversationId:id}})),(transcript)=>({...conversationMessages(transcript),resume}))))),steer:fromEffect(({conversationId,invocationId,text})=>onConversation(conversationId,(id)=>{if(invocationId===null){return Effect2.fail(new AiFailureError2(noRunningTurn))}const clientMessageId=SecureRandom.uuidV4Unsafe();return Effect2.map(callChatSurface((client)=>client.chat.sendSteeringMessage({params:{conversationId:id},payload:{clientMessageId,content:text,invocationId}})),(answer)=>({answer,clientMessageId,text}))})),uploadFiles:fromEffect(({conversationId,submit})=>onConversation(conversationId,(id)=>uploadFiles(id,submit))),watchWait:fromEffect(({conversationId,invocationId})=>conversationId===null||invocationId===null?Effect2.void:retryWatch(callChatSurface((client)=>client.chat.watchTurnWait({params:{conversationId,invocationId}}))).pipe(Effect2.repeat({while:({waiting})=>waiting}),Effect2.asVoid))};var invocationIdOf=(invocationId)=>invocationId;var openChat=(context)=>context.registry.chat(context.conversationId);var isStreaming=(context)=>{const{status}=openChat(context);return status==="submitted"||status==="streaming"};var shownWaitOf=(context)=>{const{conversationId}=context;const newest=openChat(context).lastMessage;const invocationId=newest?.metadata?.invocationId;if(conversationId===null||isStreaming(context)||newest?.role!=="assistant"||invocationId===undefined){return null}return newest.parts.some((part)=>isToolUIPart(part)&&part.state==="approval-requested")?{conversationId,invocationId:invocationIdOf(invocationId)}:null};var turnRuns=(context)=>isStreaming(context)||context.follow.invocationId!==null;var runningTurnOf=(context)=>{if(context.follow.invocationId!==null){return context.follow.invocationId}const newest=openChat(context).lastMessage;const invocationId=newest?.role==="assistant"?newest.metadata?.invocationId:undefined;return invocationId===undefined?null:invocationIdOf(invocationId)};var namedTurnOf2=(event)=>{if(event.type==="chat.turn_named"){return invocationIdOf(event.invocationId)}return event.type==="chat.run_status"&&event.runStatus.kind==="running_turn"?invocationIdOf(event.runStatus.invocationId):null};var stopChat=({context})=>{openChat(context).stop()};var turnOptionsOf=({capabilities:chosen,host},{attachmentIds,capabilities=chosen,directTool,launch,selectedReportRunId,trail})=>{const contextTrail=turnTrail2(host.trail,trail);const choices=launch===undefined?{...directTool!==undefined&&{directTool},...capabilities.length>0&&{selectedCapabilities:capabilities.map(({id,kind})=>({id,kind}))}}:{launch};return{...attachmentIds!==undefined&&attachmentIds.length>0&&{attachmentIds:[...attachmentIds]},...contextTrail!==undefined&&{contextTrail:[...contextTrail]},...choices,...selectedReportRunId!==undefined&&{selectedReportRunId}}};var isLaunch=(event)=>event.type==="SUBMIT"&&event.launchId!==undefined;var isMessageLaunch=(event)=>isLaunch(event)&&event.type==="SUBMIT"&&event.launch===undefined&&event.capabilities===undefined&&(event.trail===undefined||event.trail.length===0);var submitOf=(event)=>{if(event.type!=="SUBMIT"){return{text:""}}const{type:_submit,...submit}=event;return submit};var resume=(context)=>{const chat=openChat(context);queueMicrotask(()=>{chat.resumeStream()})};var addUserMessage=(context,message)=>{const chat=openChat(context);if(!chat.messages.some(({id})=>id===message.id)){chat.messages=[...chat.messages,message]}};var showMessages=(context,{messages})=>{if(!isStreaming(context)){const chat=openChat(context);revokeSentFiles(chat.messages);chat.messages=messages}};var newestUserText=(context)=>{let text="";for(const{parts,role}of openChat(context).messages){if(role==="user"){text=parts.flatMap((part)=>part.type==="text"?[part.text]:[]).join("")}}return text};var afterRead=(context,{messages})=>{const{draft,dropped}=context;if(dropped===null){return{}}return userMessageCount(messages)>=dropped.userMessages?{dropped:null}:{draft:draft===""?newestUserText(context):draft,dropped:null,failure:dropped.error}};var sendThroughChat=(context,submit)=>{const turnOptions=turnOptionsOf(context,submit);const metadata=Object.keys(turnOptions).length===0?{}:{turnOptions};openChat(context).sendMessage(submit.launchId===undefined?{files:[...submit.fileParts??[]],metadata,text:submit.text}:{id:submit.launchId,metadata,parts:[{text:submit.text,type:"text"}]});const conversation=context.conversations.find(({id})=>id===context.conversationId);if(conversation!==undefined){context.host.messages?.sent({conversation})}};var answerFollowOf=({answer,clientMessageId,text},streaming)=>{switch(answer.outcome){case"queued":{return{reloadQueue:true,resume:false,started:null}}case"started":{return{reloadQueue:true,resume:true,started:{invocationId:answer.invocationId??null,message:userMessage(clientMessageId,text)}}}default:{const state="status"in answer?runStateOf(answer.status):"running";return{reloadQueue:false,resume:!streaming&&state!==null&&isOpenRunState2(state),started:null}}}};var isSelected=(context,conversationId)=>context.conversationId===conversationId;var chatSessionMachine=setup({actions:{followSent:enqueueActions(({context,enqueue},sent)=>{const streaming=isStreaming(context);const follow=answerFollowOf(sent,streaming);const{started}=follow;if(started!==null&&streaming){enqueue.assign({follow:{...context.follow,next:{invocationId:started.invocationId,userMessage:started.message}}})}else if(started!==null){enqueue(()=>{addUserMessage(context,started.message);resume(context)});enqueue.assign({follow:{...noFollow,invocationId:started.invocationId}})}else if(follow.resume){enqueue(()=>{resume(context)})}if(follow.reloadQueue){enqueue.raise({type:"RELOAD_QUEUE"})}}),takeDraft:assign(({event})=>({draft:"",sending:event.type==="SUBMIT"||event.type==="QUEUE"?event.text:""}))},actors,types:{context:{},events:{},input:{}}}).createMachine({context:({input})=>{const host=input.host??{};return{blocked:null,capabilities:[],conversationId:host.sessions?.read(input.place)?.conversationId??null,conversations:[],draft:"",dropped:null,failure:null,follow:noFollow,historyScope:input.historyScope,host,newChat:{},place:input.place,placeContext:null,queuedMessages:[],registry:makeChatRegistry(input.transport),runtime:makeChatSessionRuntime(input.api),sending:"",subject:input.subject,transport:input.transport}},id:"chatSession",initial:"starting",invoke:{input:({context})=>({registry:context.registry,transport:context.transport}),src:"chatEvents"},on:{DRAFT:{actions:assign({draft:({event})=>event.text})},SET_CAPABILITIES:{actions:assign({capabilities:({event})=>event.capabilities})}},states:{blocked:{on:{RETRY:{actions:assign({blocked:null,failure:null}),target:"starting"}}},ready:{on:{NEW_CHAT:{actions:[assign({capabilities:[],conversationId:null,dropped:null,follow:noFollow,newChat:({event})=>{const{type:_newChat,...newChat}=event;return newChat},queuedMessages:[]}),({context})=>{context.host.sessions?.write(context.place,{conversationId:null})}],reenter:true,target:"ready"},RETRY:{actions:[assign({failure:null}),raise({type:"RELOAD_CONVERSATIONS"}),raise({type:"RELOAD_QUEUE"})]},SELECT_CONVERSATION:{actions:[assign({capabilities:[],conversationId:({event})=>event.conversationId,dropped:null,follow:noFollow,queuedMessages:[]}),({context,event})=>{context.host.sessions?.write(context.place,{conversationId:event.conversationId})}],target:"switching"},"chat.failed":[{actions:assign({dropped:({context,event})=>({error:event.error,userMessages:userMessageCount(openChat(context).messages)})}),guard:({context,event})=>isSelected(context,event.conversationId)&&event.dropped},{actions:raise({resume:false,type:"READ_MESSAGES"}),guard:({context,event})=>isSelected(context,event.conversationId)&&answeredEndedTurn(event.error)},{actions:assign(failedWith("later")),guard:({context,event})=>isSelected(context,event.conversationId)&&chatBlockedState(event.error,"later")!==null,target:"blocked"},{actions:assign({failure:({event})=>event.error}),guard:({context,event})=>isSelected(context,event.conversationId)}],"chat.finished":[{actions:[({context})=>{const{next}=context.follow;if(next!==null){addUserMessage(context,next.userMessage);resume(context)}},assign({follow:({context})=>({...noFollow,invocationId:context.follow.next?.invocationId??null})}),raise({type:"RELOAD_QUEUE"})],guard:({context,event})=>isSelected(context,event.conversationId)&&context.follow.next!==null},{actions:[assign({follow:({context})=>({...context.follow,joined:false})}),raise({resume:true,type:"READ_MESSAGES"})],guard:({context,event})=>isSelected(context,event.conversationId)&&context.follow.joined},{actions:({context})=>{resume(context)},guard:({context,event})=>isSelected(context,event.conversationId)&&(event.end==="cut"||event.end==="disconnected")},{actions:enqueueActions(({context,enqueue,event})=>{enqueue.assign({follow:noFollow});enqueue.raise({type:"RELOAD_QUEUE"});enqueue.raise({type:"RELOAD_CONVERSATIONS"});const wait=event.end==="ended"?shownWaitOf(context):null;if(wait!==null){enqueue.raise({...wait,type:"WATCH_WAIT"})}}),guard:({context,event})=>isSelected(context,event.conversationId)}],"chat.resume_empty":{actions:[assign({follow:noFollow}),raise({resume:false,type:"READ_MESSAGES"})],guard:({context,event})=>isSelected(context,event.conversationId)},"chat.run_status":{actions:assign({follow:({context,event})=>{const{runStatus}=event;const invocationId=invocationIdOf(runStatus.invocationId);return runStatus.kind==="next_turn"?{...context.follow,next:{invocationId,userMessage:userMessage(runStatus.userMessage.id,runStatus.userMessage.text)}}:{invocationId,joined:true,next:null}}}),guard:({context,event})=>isSelected(context,event.conversationId)},"chat.turn_named":{actions:assign({dropped:null}),guard:({context,event})=>isSelected(context,event.conversationId)}},states:{composer:{initial:"idle",on:{QUEUE:{actions:assign({failure:composerBusy})},SUBMIT:{actions:assign({failure:composerBusy})}},states:{cancelling:{invoke:{input:({context,event})=>({invocationId:namedTurnOf2(event)??runningTurnOf(context),runtime:context.runtime}),onDone:{actions:assign({follow:noFollow}),target:"idle"},onError:[{actions:assign(failedWith("later")),guard:({event})=>blocks(event.error,"later"),target:"#chatSession.blocked"},{actions:assign(failedWith("later")),target:"idle"}],src:"cancelTurn"}},changingQueue:{invoke:{input:({context,event})=>({change:event.type==="UPDATE_QUEUED"||event.type==="REMOVE_QUEUED"?event:null,conversationId:context.conversationId,runtime:context.runtime}),onDone:{actions:raise({type:"RELOAD_QUEUE"}),target:"idle"},onError:[{actions:assign(failedWith("later")),guard:({event})=>blocks(event.error,"later"),target:"#chatSession.blocked"},{actions:[assign(failedWith("later")),raise({type:"RELOAD_QUEUE"})],target:"idle"}],src:"changeQueued"}},creating:{invoke:{input:({context,event})=>({newChat:context.newChat,runtime:context.runtime,submit:submitOf(event)}),onDone:{actions:[assign({conversationId:({event})=>event.output.conversation.id,conversations:({context,event})=>[event.output.conversation,...context.conversations],draft:({context,event})=>event.output.uploadFailure===null?context.draft:draftBack(context),failure:({event})=>event.output.uploadFailure,follow:noFollow,newChat:{}}),({context,event})=>{context.host.sessions?.write(context.place,{conversationId:event.output.conversation.id,fromNewChat:true});if(event.output.uploadFailure===null){sendThroughChat(context,event.output.submit)}}],target:"idle"},onError:[{actions:assign(sendFailedWith("later")),guard:({event})=>blocks(event.error,"later"),target:"#chatSession.blocked"},{actions:assign(sendFailedWith("later")),target:"idle"}],src:"createConversation"}},idle:{entry:assign({sending:""}),on:{QUEUE:[{actions:assign({failure:noOpenConversation}),guard:({context})=>context.conversationId===null},{actions:"takeDraft",target:"queueing"}],REMOVE_QUEUED:{target:"changingQueue"},STOP:[{guard:({context})=>runningTurnOf(context)===null&&isStreaming(context),target:"stopping"},{actions:stopChat,target:"cancelling"}],SUBMIT:[{guard:({context,event})=>isLaunch(event)&&context.conversationId===null,target:"creating"},{guard:({context,event})=>isMessageLaunch(event)&&turnRuns(context),target:"queueing"},{actions:assign({failure:launchIntoBusyConversation}),guard:({context,event})=>isLaunch(event)&&turnRuns(context)},{actions:[assign({dropped:null,failure:null,follow:noFollow}),({context,event})=>{sendThroughChat(context,submitOf(event))}],guard:({event})=>isLaunch(event)},{actions:"takeDraft",guard:({context})=>context.conversationId===null,target:"creating"},{actions:assign({failure:runningAnswerTakesNoFiles}),guard:({context,event})=>turnRuns(context)&&hasAttachments(event)},{actions:"takeDraft",guard:({context})=>turnRuns(context),target:"steering"},{actions:"takeDraft",guard:({event})=>(event.files?.length??0)>0,target:"uploading"},{actions:[assign({draft:"",dropped:null,failure:null,follow:noFollow}),({context,event})=>{sendThroughChat(context,submitOf(event))}]}],UPDATE_QUEUED:{target:"changingQueue"}}},queueing:{invoke:{input:({context,event})=>({conversationId:context.conversationId,launchId:event.type==="SUBMIT"?event.launchId:undefined,runtime:context.runtime,text:event.type==="QUEUE"||event.type==="SUBMIT"?event.text:""}),onDone:{actions:[assign({failure:null}),{params:({event})=>event.output,type:"followSent"}],target:"idle"},onError:[{actions:assign(sendFailedWith("later")),guard:({event})=>blocks(event.error,"later"),target:"#chatSession.blocked"},{actions:assign(sendFailedWith("later")),target:"idle"}],src:"queueMessage"}},steering:{invoke:{input:({context,event})=>({conversationId:context.conversationId,invocationId:runningTurnOf(context),runtime:context.runtime,text:event.type==="SUBMIT"?event.text:""}),onDone:{actions:[assign({failure:null}),{params:({event})=>event.output,type:"followSent"}],target:"idle"},onError:[{actions:assign(sendFailedWith("later")),guard:({event})=>blocks(event.error,"later"),target:"#chatSession.blocked"},{actions:assign(sendFailedWith("later")),target:"idle"}],src:"steer"}},stopping:{on:{"chat.failed":{guard:({context,event})=>isSelected(context,event.conversationId),target:"idle"},"chat.finished":{guard:({context,event})=>isSelected(context,event.conversationId),target:"idle"},"chat.run_status":{actions:stopChat,guard:({context,event})=>isSelected(context,event.conversationId)&&namedTurnOf2(event)!==null,target:"cancelling"},"chat.turn_named":{actions:stopChat,guard:({context,event})=>isSelected(context,event.conversationId),target:"cancelling"}}},uploading:{invoke:{input:({context,event})=>({conversationId:context.conversationId,runtime:context.runtime,submit:submitOf(event)}),onDone:{actions:[assign({failure:null,follow:noFollow}),({context,event})=>{sendThroughChat(context,event.output)}],target:"idle"},onError:[{actions:assign(sendFailedWith("later")),guard:({event})=>blocks(event.error,"later"),target:"#chatSession.blocked"},{actions:assign(sendFailedWith("later")),target:"idle"}],src:"uploadFiles"}}}},conversations:{initial:"idle",on:{RELOAD_CONVERSATIONS:".loading"},states:{idle:{},loading:{invoke:{input:({context})=>({historyScope:context.historyScope,runtime:context.runtime,subject:context.subject}),onDone:{actions:assign({conversations:({event})=>event.output}),target:"idle"},onError:[{actions:assign(failedWith("later")),guard:({event})=>blocks(event.error,"later"),target:"#chatSession.blocked"},{target:"idle"}],src:"listConversations"}}}},follow:{initial:"idle",on:{READ_MESSAGES:".reading"},states:{idle:{},reading:{invoke:{input:({context,event})=>({conversationId:context.conversationId,resume:event.type==="READ_MESSAGES"&&event.resume,runtime:context.runtime}),onDone:{actions:[assign(({context,event})=>afterRead(context,event.output)),({context,event})=>{showMessages(context,event.output);if(event.output.resume){resume(context)}}],target:"idle"},onError:[{actions:assign(failedWith("later")),guard:({event})=>blocks(event.error,"later"),target:"#chatSession.blocked"},{actions:assign(failedWith("later")),target:"idle"}],src:"readMessages"}}}},queue:{initial:"check",on:{RELOAD_QUEUE:".check"},states:{check:{always:[{guard:({context})=>context.conversationId===null,target:"idle"},{target:"loading"}]},idle:{},loading:{invoke:{input:({context})=>({conversationId:context.conversationId,runtime:context.runtime}),onDone:{actions:assign({queuedMessages:({event})=>event.output}),target:"idle"},onError:[{actions:assign(failedWith("later")),guard:({event})=>blocks(event.error,"later"),target:"#chatSession.blocked"},{target:"idle"}],src:"listQueued"}}}},wait:{initial:"idle",on:{WATCH_WAIT:{reenter:true,target:".watching"},"chat.turn_named":{guard:({context,event})=>isSelected(context,event.conversationId),target:".idle"}},states:{idle:{},watching:{invoke:{input:({context,event})=>({conversationId:event.type==="WATCH_WAIT"?event.conversationId:null,invocationId:event.type==="WATCH_WAIT"?event.invocationId:null,runtime:context.runtime}),onDone:{actions:({context})=>{if(shownWaitOf(context)!==null){resume(context)}},target:"idle"},onError:{target:"idle"},src:"watchWait"}}}}},type:"parallel"},starting:{invoke:{input:({context})=>({historyScope:context.historyScope,placeContext:context.placeContext,runtime:context.runtime,subject:context.subject,trail:context.host.trail}),onDone:[{actions:assign({conversations:({event})=>event.output.conversations,placeContext:({event})=>event.output.placeContext}),guard:({context,event})=>event.output.conversations.some(({id})=>id===context.conversationId),target:"switching"},{actions:assign({conversationId:({event})=>event.output.conversations[0]?.id??null,conversations:({event})=>event.output.conversations,placeContext:({event})=>event.output.placeContext}),guard:({context,event})=>context.subject!==undefined&&event.output.conversations.length>0,target:"switching"},{actions:assign({conversationId:null,conversations:({event})=>event.output.conversations,placeContext:({event})=>event.output.placeContext}),target:"ready"}],onError:[{actions:assign(failedWith("first")),guard:({event})=>blocks(event.error,"first"),target:"blocked"},{actions:assign(failedWith("first")),target:"ready"}],src:"loadSession"}},switching:{invoke:{input:({context})=>({conversationId:context.conversationId,resume:false,runtime:context.runtime}),onDone:{actions:[({context,event})=>{showMessages(context,event.output);if(event.output.openTurn!==null&&!isStreaming(context)){resume(context)}},assign({follow:({event})=>({...noFollow,invocationId:event.output.openTurn?.invocationId??null})})],target:"ready"},onError:[{actions:assign(failedWith("later")),guard:({event})=>blocks(event.error,"later"),target:"blocked"},{actions:assign(failedWith("later")),target:"ready"}],src:"readMessages"},on:{NEW_CHAT:{actions:raise(({event})=>event),target:"ready"},SELECT_CONVERSATION:{actions:raise(({event})=>event),target:"ready"}}}}});import{jsx as jsx2,jsxs}from"react/jsx-runtime";var SessionActor=createContext2(null);var useSessionActor=()=>{const actor=useContext2(SessionActor);if(actor===null){throw new Error("The chat hooks need a ChatSessionProvider.")}return actor};var statusOf=(snapshot)=>{if(snapshot.matches("blocked")){return"blocked"}if(snapshot.matches("ready")){return"ready"}return snapshot.matches("switching")?"switching":"starting"};var busyOf=(snapshot)=>snapshot.matches("ready")&&!snapshot.matches({ready:{composer:"idle"}});var useChatStatus=(actor)=>{const chat=useSelector(actor,({context})=>context.registry.chat(context.conversationId));return useSyncExternalStore2(chat["~registerStatusCallback"],()=>chat.status,()=>chat.status)};var useChatSession2=()=>{const actor=useSessionActor();const status=useSelector(actor,statusOf);const busy=useSelector(actor,busyOf);const context=useSelector(actor,(snapshot)=>snapshot.context);const chatStatus=useChatStatus(actor);const call=useCallback((operation)=>actor.getSnapshot().context.runtime.runPromise(Effect3.match(callChatSurface(operation),{onFailure:({error})=>({error,ok:false}),onSuccess:(value)=>({ok:true,value})})),[actor]);const actions=useMemo2(()=>({newChat:(options={})=>{actor.send({...options,type:"NEW_CHAT"})},queue:(text)=>{actor.send({text,type:"QUEUE"})},readMessages:()=>{actor.send({resume:false,type:"READ_MESSAGES"})},reloadConversations:()=>{actor.send({type:"RELOAD_CONVERSATIONS"})},removeQueuedMessage:(queuedMessageId,revision)=>{actor.send({queuedMessageId,revision,type:"REMOVE_QUEUED"})},retry:()=>{actor.send({type:"RETRY"})},selectConversation:(conversationId)=>{actor.send({conversationId,type:"SELECT_CONVERSATION"})},setCapabilities:(capabilities)=>{actor.send({capabilities,type:"SET_CAPABILITIES"})},setDraft:(text)=>{actor.send({text,type:"DRAFT"})},stop:()=>{actor.send({type:"STOP"})},submit:(submit)=>{actor.send({...submit,type:"SUBMIT"})},updateQueuedMessage:(queuedMessageId,content,revision)=>{actor.send({content,queuedMessageId,revision,type:"UPDATE_QUEUED"})}}),[actor]);const controls=useMemo2(()=>chatControls(context.host),[context.host]);return{...actions,blocked:context.blocked,busy,call,capabilities:context.capabilities,controls,conversationId:context.conversationId,conversations:context.conversations,draft:context.draft,failure:context.failure,place:context.place,placeContext:context.placeContext,queuedMessages:context.queuedMessages,sendMode:chatStatus==="submitted"||chatStatus==="streaming"||context.follow.invocationId!==null?"running":"idle",status}};var useCiChat2=()=>{const actor=useSessionActor();const chat=useSelector(actor,({context})=>context.registry.chat(context.conversationId));return useChat({chat})};var IntentCardWatch=()=>{const registry=useContext2(IntentsContext)?.registry;const{readMessages,status}=useChatSession2();const{messages,status:answer}=useCiChat2();const[tracker]=useState2(createIntentCardEndTracker);useEffect2(()=>{for(const notice of tracker.observe(status,messages)){registry?.publish(notice)}},[messages,registry,status,tracker]);const waiting=status==="ready"&&answer!=="streaming"&&answer!=="submitted"&&intentCardPending(messages);useEffect2(()=>{if(!waiting){return}const timer=setInterval(readMessages,intentCardReloadMs);return()=>{clearInterval(timer)}},[readMessages,waiting]);return null};var ChatSessionProvider2=({api,children,historyScope,host,place,subject,transport})=>{const input={api,...historyScope!==undefined&&{historyScope},...host!==undefined&&{host},place,...subject!==undefined&&{subject},transport};const actor=useActorRef(chatSessionMachine,{input});return jsxs(SessionActor.Provider,{value:actor,children:[children,jsx2(IntentCardWatch,{})]})};import{useMutation,useQueryClient}from"@tanstack/react-query";import{useCallback as useCallback2,useEffect as useEffect3,useRef as useRef2,useState as useState3,useSyncExternalStore as useSyncExternalStore3}from"react";import{queryOptions,skipToken}from"@tanstack/react-query";var intentKeys={list:(cacheScope)=>["ai","intents",cacheScope,"list"]};var callIntents=async(api,op,input,signal)=>{const answer=async()=>{try{return await api.call(op,input,signal===undefined?{}:{signal})}catch(error){throw new AiFailureError2({code:"unavailable",message:"The Intents API failed",retryable:true},{cause:error})}};const result=await answer();if(!result.ok){throw new AiFailureError2(result.error)}return result.value};var retryRetryable=(failureCount,error)=>error.error.retryable&&failureCount<3;var intentListQuery=(cacheScope,api)=>queryOptions({queryFn:api===undefined?skipToken:({signal})=>callIntents(api,"list",{},signal),queryKey:intentKeys.list(cacheScope),retry:retryRetryable});var storedTarget=(options)=>options.resultTarget==="notification"&&options.returnPage!==undefined?{resultTarget:"notification",returnPage:options.returnPage}:{resultTarget:options.resultTarget};var outcomeStates={completed:"done",failed:"failed",needs_input:"needs_input",not_allowed:"failed",started:"done"};var stateOf=(mutation)=>{if(mutation.status==="idle"){return"ready"}if(mutation.status==="pending"){return"working"}return mutation.status==="error"?"failed":outcomeStates[mutation.data.outcome.kind]};var noIntents=new AiFailureError2({code:"unavailable",message:"No IntentsApi is set on IntentsProvider",retryable:false});var useIntentDispatch2=(fqn,options)=>{const intentsScope=useIntentsScope2();const{registry}=intentsScope;const queryClient=useQueryClient();const latest=useRef2(undefined);const listedEntry=async(api,cacheScope)=>{const entries=await queryClient.ensureQueryData(intentListQuery(cacheScope,api)).catch(()=>[]);return entries.find((listed)=>listed.fqn===fqn)};const settle=async(api,{cacheScope,registry:dispatchRegistry},outcome,idempotencyKey,signal)=>{const notify=options.resultTarget==="notification";if(outcome.kind==="completed"||outcome.kind==="failed"){dispatchRegistry.publish({fqn,handle:undefined,outcome});if(notify){const entry=await listedEntry(api,cacheScope);dispatchRegistry.show({displayName:entry?.displayName??fqn,fqn,id:idempotencyKey,outcome})}return{handle:undefined,outcome}}if(outcome.kind!=="started"){return{handle:undefined,outcome}}const{handle}=outcome;const entry=await listedEntry(api,cacheScope);if(notify){dispatchRegistry.keep({displayName:entry?.displayName??fqn,fqn,handle})}if(entry?.resultMode!=="sync"||signal.aborted){return{handle,outcome}}const end=await callIntents(api,"wait",{handle},signal);if(!notify){dispatchRegistry.publish({fqn,handle,outcome:end})}return{handle,outcome:end}};const mutation=useMutation({mutationFn:async({idempotencyKey,inputs,scope,signal})=>{const intents=scope.api;if(intents===undefined){throw noIntents}const outcome=await callIntents(intents,"dispatch",{fqn,idempotencyKey,inputs,...storedTarget(options)});return await settle(intents,scope,outcome,idempotencyKey,signal)}});const{mutateAsync}=mutation;const[runEnds,setRunEnds]=useState3(()=>new Map);useIntentResult2(fqn,(notice)=>{const{handle}=notice;if(handle!==undefined){setRunEnds((ends)=>new Map(ends).set(handle,notice))}});const returnedEnd=useCallback2(()=>registry.adopted(fqn),[fqn,registry]);const returned=useSyncExternalStore3(registry.subscribe,returnedEnd,returnedEnd);useEffect3(()=>()=>{latest.current?.abort()},[]);const dispatch=useCallback2(async(inputs,call={})=>{latest.current?.abort();const controller=new AbortController;latest.current=controller;try{const{outcome}=await mutateAsync({idempotencyKey:call.idempotencyKey??crypto.randomUUID(),inputs,scope:intentsScope,signal:controller.signal});return{ok:true,value:outcome}}catch(error){return{error:error instanceof AiFailureError2?error.error:{code:"internal",message:String(error),retryable:false},ok:false}}},[intentsScope,mutateAsync]);if(mutation.status==="idle"&&returned!==undefined){return{dispatch,error:undefined,handle:returned.handle,outcome:returned.outcome,state:outcomeStates[returned.outcome.kind]}}const settled=mutation.data;const runEnd=settled?.outcome.kind==="started"&&settled.handle!==undefined?runEnds.get(settled.handle):undefined;if(settled!==undefined&&runEnd!==undefined){return{dispatch,error:undefined,handle:settled.handle,outcome:runEnd.outcome,state:outcomeStates[runEnd.outcome.kind]}}return{dispatch,error:mutation.error?.error,handle:mutation.data?.handle,outcome:mutation.data?.outcome,state:stateOf(mutation)}};import{useQuery}from"@tanstack/react-query";var useIntents2=()=>{const{api,cacheScope}=useIntentsScope2();const list=useQuery(intentListQuery(cacheScope,api));return{enabled:api!==undefined,list}};import{useCallback as useCallback3,useSyncExternalStore as useSyncExternalStore4}from"react";var useLaunch2=()=>{const{registry,scope}=useIntentsScope2();return useCallback3((turn,{target,...how}={})=>{const receive=registry.launchTarget(scope,target)?.receive;if(receive===undefined){return}const launch={...how,launchId:crypto.randomUUID(),turn};receive(launch);return launch.launchId},[registry,scope])};var useHasLaunchTarget2=(target)=>{const{registry,scope}=useIntentsScope2();const snapshot=useCallback3(()=>registry.launchTarget(scope,target)!==undefined,[registry,scope,target]);return useSyncExternalStore4(registry.subscribe,snapshot,snapshot)};import{useEffect as useEffect4,useRef as useRef3}from"react";import*as Schema5 from"effect/Schema";var isAgentId=Schema5.is(AgentId2);var submitChatLaunch2=(chat,{agentId,conversation,launchId,prefill,trail,turn})=>{const text=turn.kind==="intent"?turn.fqn:turn.text;const current=conversation==="current"&&chat.conversationId!==null;const named=isAgentId(agentId)?agentId:chat.pinnedAgentId;const agent=turn.kind==="intent"?undefined:named;const needsAgent=turn.kind!=="intent"&&!current&&agent===undefined&&chat.plainChat===false;if(prefill===true||needsAgent){chat.setDraft(turn.kind==="intent"?"":text);return}if(!current){chat.newChat(agent===undefined?{}:{agentId:agent})}const launched={launchId,text,...trail!==undefined&&trail.length>0&&{trail}};switch(turn.kind){case"intent":{chat.submit({...launched,launch:{fqn:turn.fqn,inputs:turn.inputs}});return}case"skill":{chat.submit({...launched,capabilities:[{id:turn.skillId,kind:"skill"}]});return}default:{chat.submit(launched)}}};var useChatLaunchTarget2=({id,onLaunch,preferred,session})=>{const ready=session.status==="ready";const held=useRef3(undefined);useEffect4(()=>{const launch=held.current;if(ready&&launch!==undefined){held.current=undefined;submitChatLaunch2(session,launch)}},[ready,session]);const takes=ready||preferred===true&&session.status==="starting";useRegisterOptionalPiece({id,kind:"chat",preferred,receive:takes?(launch)=>{onLaunch?.();if(ready){submitChatLaunch2(session,launch)}else{held.current=launch}}:undefined})};import{createContext as createContext3,useCallback as useCallback4,useContext as useContext3,useEffect as useEffect5,useId,useSyncExternalStore as useSyncExternalStore5}from"react";var jsonLdBlocks='script[type="application/ld+json"]';var readerSource="json-ld";var isRecord=(value)=>hasObjectRuntimeKind2(value)&&value!==null&&!Array.isArray(value);var isTypedNode=(value)=>isRecord(value)&&hasStringRuntimeKind2(value["@type"]);var nodesOf=(text)=>{let parsed;try{parsed=asRuntimeValue2(JSON.parse(text))}catch{return[]}if(Array.isArray(parsed)){return parsed}const graph=isRecord(parsed)?parsed["@graph"]:undefined;return Array.isArray(graph)?graph:[parsed]};var isBlock=(node)=>node instanceof Element&&node.matches(jsonLdBlocks);var holdsBlock=(node)=>node instanceof Element&&(node.matches(jsonLdBlocks)||node.querySelector(jsonLdBlocks)!==null);var touchesBlocks=({addedNodes,removedNodes,target})=>isBlock(target)||isBlock(target.parentNode)||[...addedNodes,...removedNodes].some(holdsBlock);var readPageJsonLd=(trail)=>{const blockNumbers=new WeakMap;let blocks=0;let sources=new Set;const read=()=>{const next=new Set;for(const block of document.querySelectorAll(jsonLdBlocks)){const number=blockNumbers.get(block)??(blocks+=1);blockNumbers.set(block,number);const nodes=nodesOf(block.textContent).filter(isTypedNode);for(const[at,data]of nodes.entries()){const source=`${readerSource}:${number}:${at}`;next.add(source);trail.setMetadata(source,data)}}for(const source of sources){if(!next.has(source)){trail.clearMetadata(source)}}sources=next};read();const observer=new MutationObserver((records)=>{if(records.some(touchesBlocks)){read()}});observer.observe(document,{characterData:true,childList:true,subtree:true});return()=>{observer.disconnect();for(const source of sources){trail.clearMetadata(source)}}};import{jsx as jsx3}from"react/jsx-runtime";var TrailContext=createContext3(undefined);var ContextTrailProvider2=({children,trail})=>jsx3(TrailContext.Provider,{value:trail,children});var useTrailBuffer2=()=>useContext3(TrailContext);var noEntries=[];var unsubscribeNothing=()=>{return};var noSubscription=()=>unsubscribeNothing;var useTrailEntries2=(trail)=>{const entries=trail?.entries??(()=>noEntries);return useSyncExternalStore5(trail?.subscribe??noSubscription,entries,entries)};var useContextTrailEntries2=()=>useTrailEntries2(useContext3(TrailContext));var useRecording=(trail)=>useSyncExternalStore5(trail?.subscribe??noSubscription,()=>trail?.recording()??false,()=>false);var useRecordPageVisit2=({app,page,title})=>{const trail=useContext3(TrailContext);const recording=useRecording(trail);useEffect5(()=>{if(recording){trail?.recordPageVisit({app,page,title})}},[app,page,recording,title,trail])};var useTrailMetadata2=(data,source)=>{const trail=useContext3(TrailContext);const own=useId();const id=source??own;const recording=useRecording(trail);useRegisterOptionalPiece({id,kind:"trail_source"});useEffect5(()=>()=>{trail?.clearMetadata(id)},[id,trail]);useEffect5(()=>{if(recording){trail?.setMetadata(id,data)}},[data,id,recording,trail])};var useTrailEvent2=(source)=>{const trail=useContext3(TrailContext);const own=useId();const id=source??own;return useCallback4((push)=>{trail?.pushEvent(id,push)},[id,trail])};var usePageJsonLd2=()=>{const trail=useContext3(TrailContext);const recording=useRecording(trail);useRegisterOptionalPiece({id:readerSource,kind:"trail_source"});useEffect5(()=>{if(!recording||trail===undefined){return}return readPageJsonLd(trail)},[recording,trail])};export{useIntentsScope2,useOptionalIntentsScope2,IntentsProvider2,IntentsRegistryScope2,useRegisterPiece2,usePieces2,useIntentResult2,chatBlockedKinds2,chatSurfaceLayer,makeChatSessionRuntime,toSessionFailure,callChatSurface,retryRead,chatFeatureFlags2,createBrowserFilePort2,openRunStates2,isOpenRunState2,trailBufferSize2,createTrailBuffer2,turnTrail2,useChatSession2,useCiChat2,ChatSessionProvider2,useIntentDispatch2,useIntents2,useLaunch2,useHasLaunchTarget2,submitChatLaunch2,useChatLaunchTarget2,ContextTrailProvider2,useTrailBuffer2,useTrailEntries2,useContextTrailEntries2,useRecordPageVisit2,useTrailMetadata2,useTrailEvent2,usePageJsonLd2};
|
|
File without changes
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{ContextTrailEntrySchema}from"./domain-50vzrrp9.js";import*as Schema from"effect/Schema";var CiTurnOptionsSchema=Schema.Struct({attachmentIds:Schema.optionalKey(Schema.Array(Schema.String)),contextTrail:Schema.optionalKey(Schema.Array(ContextTrailEntrySchema)),directTool:Schema.optionalKey(Schema.Struct({handle:Schema.String,input:Schema.Record(Schema.String,Schema.Unknown)})),launch:Schema.optionalKey(Schema.Struct({fqn:Schema.String,inputs:Schema.Record(Schema.String,Schema.Json)})),selectedCapabilities:Schema.optionalKey(Schema.Array(Schema.Struct({id:Schema.String,kind:Schema.Literals(["skill","tool"])}))),selectedReportRunId:Schema.optionalKey(Schema.String)});var CiAnswerSentimentSchema=Schema.Literals(["positive","negative"]);var CiMessageMetadataSchema=Schema.Struct({createdAt:Schema.optionalKey(Schema.String),currentUserFeedback:Schema.optionalKey(Schema.Struct({sentiment:Schema.NullOr(CiAnswerSentimentSchema),submitterNote:Schema.NullOr(Schema.String)})),feedbackTargetId:Schema.optionalKey(Schema.String),invocationId:Schema.optionalKey(Schema.String),traceLink:Schema.optionalKey(Schema.String),turnOptions:Schema.optionalKey(CiTurnOptionsSchema)});var ciMessageMetadataSchema2=Schema.toStandardSchemaV1(CiMessageMetadataSchema);var ciAskUserToolName2="ci_ask_user";var CiAskUserInputSchema=Schema.Struct({allowFreeText:Schema.Boolean,mode:Schema.Literals(["open","single_choice"]),options:Schema.Array(Schema.Struct({description:Schema.NullOr(Schema.String),id:Schema.String,label:Schema.String})),prompt:Schema.String});var CiAskUserOutputSchema=Schema.Union([Schema.Struct({kind:Schema.Literal("option"),optionId:Schema.String}),Schema.Struct({kind:Schema.Literal("free_text"),text:Schema.String})]);var ciAskUserSchemas2={input:Schema.toStandardSchemaV1(CiAskUserInputSchema),output:Schema.toStandardSchemaV1(CiAskUserOutputSchema)};var hasBigIntRuntimeKind2=(value)=>Object.prototype.toString.call(value)==="[object BigInt]"&&Object.is(value,BigInt(String(value)));var hasBooleanRuntimeKind2=(value)=>value===true||value===false;var hasFunctionRuntimeKind2=(value)=>{try{Function.prototype.toString.call(value);return true}catch{return false}};var hasNumberRuntimeKind2=(value)=>Object.prototype.toString.call(value)==="[object Number]"&&Object.is(value,Number(value));var hasNullRuntimeKind2=(value)=>value===null;var hasObjectRuntimeKind2=(value)=>value===null||Object.is(new Object(value),value)&&!hasFunctionRuntimeKind2(value);var hasStringRuntimeKind2=(value)=>Object.prototype.toString.call(value)==="[object String]"&&Object.is(value,String(value));var hasSymbolRuntimeKind2=(value)=>Object.prototype.toString.call(value)==="[object Symbol]"&&!Object.is(new Object(value),value);var hasUndefinedRuntimeKind2=(value)=>value===undefined;var isNullish2=(value)=>value===null||value===undefined;var asRuntimeValue2=(value)=>{if(hasNullRuntimeKind2(value)){return value}if(hasBigIntRuntimeKind2(value)){return value}if(hasBooleanRuntimeKind2(value)){return value}if(hasFunctionRuntimeKind2(value)){return value}if(hasNumberRuntimeKind2(value)){return value}if(hasObjectRuntimeKind2(value)){return value}if(hasStringRuntimeKind2(value)){return value}if(hasSymbolRuntimeKind2(value)){return value}if(hasUndefinedRuntimeKind2(value)){return value}throw new Error("Unsupported runtime value")};var assertPresent=(value)=>{if(isNullish2(value)){throw new Error("Required value is missing")}};var requireValue2=(value)=>{assertPresent(value);return value};
|
|
2
|
+
export{ciMessageMetadataSchema2,ciAskUserToolName2,ciAskUserSchemas2,hasBigIntRuntimeKind2,hasBooleanRuntimeKind2,hasFunctionRuntimeKind2,hasNumberRuntimeKind2,hasNullRuntimeKind2,hasObjectRuntimeKind2,hasStringRuntimeKind2,hasSymbolRuntimeKind2,hasUndefinedRuntimeKind2,isNullish2,asRuntimeValue2,requireValue2};
|
package/dist/domain.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { ciDataPartSchemas, draftSubjectKinds } from "./domain/data-parts.js";
|
|
2
|
+
export type { CiDataPartSchemas, CiDataParts, CiStandardSchema, DraftSubjectKind, DraftUpdate, Evidence, EvidenceKind, IntentCardPart, MemoryEvidence, RunStatus, SourceNavigation, SourcesEvidence, TableEvidence } from "./domain/data-parts.js";
|
|
3
|
+
export type { AccessCheckAnswer, AccessTarget } from "./domain/access.js";
|
|
4
|
+
export { contextTrailEntrySchema } from "./domain/context-trail.js";
|
|
5
|
+
export type { ContextTrailEntry, PageVisit, TrailEvent, TrailEventPush, TrailMetadata, TrailMetadataData } from "./domain/context-trail.js";
|
|
6
|
+
export { AiFailureError, aiErrorCodes } from "./domain/errors.js";
|
|
7
|
+
export type { AiError, AiErrorCode, AiResult } from "./domain/errors.js";
|
|
8
|
+
export type { IntentCatalogEntry, IntentDispatchEnd, IntentDispatchOutcome, IntentDispatchRecordState, IntentFieldProblem, IntentHandle, IntentResult, IntentResultTarget, IntentReturnPage, JsonObject, JsonValue, PreparedTurn } from "./domain/intents.js";
|
|
9
|
+
export { ciAskUserSchemas, ciAskUserToolName, ciMessageMetadataSchema } from "./domain/message.js";
|
|
10
|
+
export type { CiAnswerSentiment, CiAskUserInput, CiAskUserOutput, CiAskUserSchemas, CiMessageMetadata, CiTools, CiTurnOptions, CiUIMessage } from "./domain/message.js";
|
|
11
|
+
export { placeKinds } from "./domain/place.js";
|
|
12
|
+
export type { Place, PlaceKind } from "./domain/place.js";
|
|
13
|
+
export { asRuntimeValue, hasBigIntRuntimeKind, hasBooleanRuntimeKind, hasFunctionRuntimeKind, hasNullRuntimeKind, hasNumberRuntimeKind, hasObjectRuntimeKind, hasStringRuntimeKind, hasSymbolRuntimeKind, hasUndefinedRuntimeKind, isNullish, requireValue } from "./domain/runtime-value.js";
|
|
14
|
+
export type { RuntimeRecord, RuntimeValue } from "./domain/runtime-value.js";
|
package/dist/domain.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{draftSubjectKinds2,ciDataPartSchemas2,contextTrailEntrySchema2,placeKinds2}from"./domain-50vzrrp9.js";import{ciMessageMetadataSchema2,ciAskUserToolName2,ciAskUserSchemas2,hasBigIntRuntimeKind2,hasBooleanRuntimeKind2,hasFunctionRuntimeKind2,hasNumberRuntimeKind2,hasNullRuntimeKind2,hasObjectRuntimeKind2,hasStringRuntimeKind2,hasSymbolRuntimeKind2,hasUndefinedRuntimeKind2,isNullish2,asRuntimeValue2,requireValue2}from"./domain-s07s1ry1.js";import{aiErrorCodes2,AiFailureError2}from"./domain-9wzbv87n.js";export{AiFailureError2 as AiFailureError,aiErrorCodes2 as aiErrorCodes,asRuntimeValue2 as asRuntimeValue,ciAskUserSchemas2 as ciAskUserSchemas,ciAskUserToolName2 as ciAskUserToolName,ciDataPartSchemas2 as ciDataPartSchemas,ciMessageMetadataSchema2 as ciMessageMetadataSchema,contextTrailEntrySchema2 as contextTrailEntrySchema,draftSubjectKinds2 as draftSubjectKinds,hasBigIntRuntimeKind2 as hasBigIntRuntimeKind,hasBooleanRuntimeKind2 as hasBooleanRuntimeKind,hasFunctionRuntimeKind2 as hasFunctionRuntimeKind,hasNullRuntimeKind2 as hasNullRuntimeKind,hasNumberRuntimeKind2 as hasNumberRuntimeKind,hasObjectRuntimeKind2 as hasObjectRuntimeKind,hasStringRuntimeKind2 as hasStringRuntimeKind,hasSymbolRuntimeKind2 as hasSymbolRuntimeKind,hasUndefinedRuntimeKind2 as hasUndefinedRuntimeKind,isNullish2 as isNullish,placeKinds2 as placeKinds,requireValue2 as requireValue};
|