@soron-ai/next 0.0.0-stage → 0.1.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.
@@ -0,0 +1 @@
1
+ export declare function olderThan(version: string, floor: string): boolean;
@@ -0,0 +1,19 @@
1
+ import type { AliasEntry } from './core/contract.ts';
2
+ export type SourceRef = {
3
+ n: number;
4
+ label: string;
5
+ };
6
+ type Proofs = {
7
+ sources: readonly SourceRef[];
8
+ onProof?: ((ns: number[], el: HTMLElement | null, show: boolean) => void) | undefined;
9
+ onOpenSource?: ((ns: number[]) => void) | undefined;
10
+ };
11
+ type Props = {
12
+ markdown: string;
13
+ aliases: readonly AliasEntry[];
14
+ sources: readonly SourceRef[] | null;
15
+ onProof?: Proofs['onProof'];
16
+ onOpenSource?: Proofs['onOpenSource'];
17
+ };
18
+ export declare function SoronAnswer({ markdown, aliases, sources, onProof, onOpenSource }: Props): import("react").JSX.Element | null;
19
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare function badgeFrom(tokenUrl: string, doFetch?: typeof fetch): () => Promise<string>;
2
+ export declare function accountOf(token: string): string | null;
@@ -0,0 +1,11 @@
1
+ export type Recall = {
2
+ index: number;
3
+ saved: string;
4
+ };
5
+ export declare const NO_RECALL: Recall;
6
+ export declare const onFirstLine: (value: string, caret: number) => boolean;
7
+ export declare const onLastLine: (value: string, caret: number) => boolean;
8
+ export declare function recallStep(sent: readonly string[], state: Recall, current: string, dir: 'up' | 'down'): {
9
+ state: Recall;
10
+ text: string;
11
+ } | null;
@@ -0,0 +1,14 @@
1
+ import { type Ref } from 'react';
2
+ import type { Effort } from './core/contract.ts';
3
+ export declare function Surge({ frame }: {
4
+ frame?: boolean;
5
+ }): import("react").JSX.Element;
6
+ type Props = {
7
+ field: Ref<HTMLTextAreaElement>;
8
+ surge: number | null;
9
+ onEffort: (effort: Effort) => void;
10
+ keyboard: boolean;
11
+ refocus: () => void;
12
+ };
13
+ export declare function SoronComposer({ field, surge, onEffort, keyboard, refocus }: Props): import("react").JSX.Element | null;
14
+ export {};
@@ -0,0 +1,17 @@
1
+ import type { Effort, Spend } from './contract.ts';
2
+ import type { CardId } from './service-link.ts';
3
+ export type Card = {
4
+ id: CardId | 'reconnect' | 'monthcap' | 'old';
5
+ text: string;
6
+ act: 'Réessayer' | 'Recharger' | null;
7
+ waitS?: number;
8
+ off?: boolean;
9
+ };
10
+ export declare function card(id: Card['id']): Card;
11
+ export declare const usd: (n: number) => string;
12
+ export declare function dayOf(spend: Spend): {
13
+ capped: boolean;
14
+ highOff: boolean;
15
+ cappedText: string;
16
+ };
17
+ export declare function capCard(spend: Spend, effort: Effort): Card['id'];
@@ -0,0 +1,209 @@
1
+ import { z } from 'zod';
2
+ export type Json = string | number | boolean | null | Json[] | {
3
+ [key: string]: Json;
4
+ };
5
+ declare const citation: z.ZodDiscriminatedUnion<[z.ZodObject<{
6
+ kind: z.ZodLiteral<"code">;
7
+ path: z.ZodString;
8
+ start: z.ZodNumber;
9
+ end: z.ZodNumber;
10
+ }, z.core.$strip>, z.ZodObject<{
11
+ kind: z.ZodLiteral<"data">;
12
+ toolCallId: z.ZodString;
13
+ }, z.core.$strip>], "kind">;
14
+ export type Citation = z.infer<typeof citation>;
15
+ declare const aliasEntry: z.ZodObject<{
16
+ alias: z.ZodString;
17
+ value: z.ZodString;
18
+ }, z.core.$strip>;
19
+ export type AliasEntry = z.infer<typeof aliasEntry>;
20
+ declare const done: z.ZodObject<{
21
+ type: z.ZodLiteral<"done">;
22
+ status: z.ZodCatch<z.ZodEnum<{
23
+ cancelled: "cancelled";
24
+ completed: "completed";
25
+ error: "error";
26
+ refused: "refused";
27
+ }>>;
28
+ answer: z.ZodString;
29
+ citations: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
30
+ kind: z.ZodLiteral<"code">;
31
+ path: z.ZodString;
32
+ start: z.ZodNumber;
33
+ end: z.ZodNumber;
34
+ }, z.core.$strip>, z.ZodObject<{
35
+ kind: z.ZodLiteral<"data">;
36
+ toolCallId: z.ZodString;
37
+ }, z.core.$strip>], "kind">>;
38
+ carnet: z.ZodType<Json, unknown, z.core.$ZodTypeInternals<Json, unknown>>;
39
+ commit: z.ZodNullable<z.ZodString>;
40
+ mechanisms: z.ZodType<Json, unknown, z.core.$ZodTypeInternals<Json, unknown>>;
41
+ suggestNewDiscussion: z.ZodBoolean;
42
+ promptTokens: z.ZodNumber;
43
+ costUsd: z.ZodNumber;
44
+ durationMs: z.ZodNumber;
45
+ reads: z.ZodArray<z.ZodObject<{
46
+ id: z.ZodString;
47
+ origin: z.ZodCatch<z.ZodEnum<{
48
+ page: "page";
49
+ tool: "tool";
50
+ }>>;
51
+ procedure: z.ZodString;
52
+ input: z.ZodRecord<z.ZodString, z.ZodType<Json, unknown, z.core.$ZodTypeInternals<Json, unknown>>>;
53
+ at: z.ZodString;
54
+ outcome: z.ZodString;
55
+ }, z.core.$strip>>;
56
+ covered: z.ZodObject<{
57
+ filesRead: z.ZodArray<z.ZodString>;
58
+ searches: z.ZodArray<z.ZodString>;
59
+ reads: z.ZodNumber;
60
+ }, z.core.$strip>;
61
+ staleCode: z.ZodOptional<z.ZodObject<{
62
+ committedAt: z.ZodString;
63
+ }, z.core.$strip>>;
64
+ reason: z.ZodCatch<z.ZodOptional<z.ZodEnum<{
65
+ agent_failed: "agent_failed";
66
+ internal: "internal";
67
+ mirror_failed: "mirror_failed";
68
+ no_reply: "no_reply";
69
+ question_cap: "question_cap";
70
+ shutdown: "shutdown";
71
+ timeout: "timeout";
72
+ }>>>;
73
+ promptVersion: z.ZodCatch<z.ZodOptional<z.ZodString>>;
74
+ }, z.core.$strip>;
75
+ export type Done = z.infer<typeof done>;
76
+ declare const streamEvent: z.ZodDiscriminatedUnion<[z.ZodObject<{
77
+ type: z.ZodLiteral<"started">;
78
+ at: z.ZodString;
79
+ }, z.core.$strip>, z.ZodObject<{
80
+ type: z.ZodLiteral<"step">;
81
+ tool: z.ZodCatch<z.ZodEnum<{
82
+ data: "data";
83
+ files: "files";
84
+ prepare: "prepare";
85
+ read: "read";
86
+ search: "search";
87
+ }>>;
88
+ target: z.ZodString;
89
+ label: z.ZodString;
90
+ }, z.core.$strip>, z.ZodObject<{
91
+ type: z.ZodLiteral<"thinking">;
92
+ }, z.core.$strip>, z.ZodObject<{
93
+ type: z.ZodLiteral<"text">;
94
+ text: z.ZodString;
95
+ }, z.core.$strip>, z.ZodObject<{
96
+ type: z.ZodLiteral<"ask">;
97
+ question: z.ZodString;
98
+ options: z.ZodArray<z.ZodString>;
99
+ }, z.core.$strip>, z.ZodObject<{
100
+ type: z.ZodLiteral<"answered">;
101
+ }, z.core.$strip>, z.ZodObject<{
102
+ type: z.ZodLiteral<"restart">;
103
+ }, z.core.$strip>, z.ZodObject<{
104
+ type: z.ZodLiteral<"final">;
105
+ }, z.core.$strip>, z.ZodObject<{
106
+ type: z.ZodLiteral<"read">;
107
+ procedure: z.ZodString;
108
+ outcome: z.ZodString;
109
+ }, z.core.$strip>, z.ZodObject<{
110
+ type: z.ZodLiteral<"aliases">;
111
+ state: z.ZodArray<z.ZodObject<{
112
+ alias: z.ZodString;
113
+ value: z.ZodString;
114
+ }, z.core.$strip>>;
115
+ }, z.core.$strip>, z.ZodObject<{
116
+ type: z.ZodLiteral<"done">;
117
+ status: z.ZodCatch<z.ZodEnum<{
118
+ cancelled: "cancelled";
119
+ completed: "completed";
120
+ error: "error";
121
+ refused: "refused";
122
+ }>>;
123
+ answer: z.ZodString;
124
+ citations: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
125
+ kind: z.ZodLiteral<"code">;
126
+ path: z.ZodString;
127
+ start: z.ZodNumber;
128
+ end: z.ZodNumber;
129
+ }, z.core.$strip>, z.ZodObject<{
130
+ kind: z.ZodLiteral<"data">;
131
+ toolCallId: z.ZodString;
132
+ }, z.core.$strip>], "kind">>;
133
+ carnet: z.ZodType<Json, unknown, z.core.$ZodTypeInternals<Json, unknown>>;
134
+ commit: z.ZodNullable<z.ZodString>;
135
+ mechanisms: z.ZodType<Json, unknown, z.core.$ZodTypeInternals<Json, unknown>>;
136
+ suggestNewDiscussion: z.ZodBoolean;
137
+ promptTokens: z.ZodNumber;
138
+ costUsd: z.ZodNumber;
139
+ durationMs: z.ZodNumber;
140
+ reads: z.ZodArray<z.ZodObject<{
141
+ id: z.ZodString;
142
+ origin: z.ZodCatch<z.ZodEnum<{
143
+ page: "page";
144
+ tool: "tool";
145
+ }>>;
146
+ procedure: z.ZodString;
147
+ input: z.ZodRecord<z.ZodString, z.ZodType<Json, unknown, z.core.$ZodTypeInternals<Json, unknown>>>;
148
+ at: z.ZodString;
149
+ outcome: z.ZodString;
150
+ }, z.core.$strip>>;
151
+ covered: z.ZodObject<{
152
+ filesRead: z.ZodArray<z.ZodString>;
153
+ searches: z.ZodArray<z.ZodString>;
154
+ reads: z.ZodNumber;
155
+ }, z.core.$strip>;
156
+ staleCode: z.ZodOptional<z.ZodObject<{
157
+ committedAt: z.ZodString;
158
+ }, z.core.$strip>>;
159
+ reason: z.ZodCatch<z.ZodOptional<z.ZodEnum<{
160
+ agent_failed: "agent_failed";
161
+ internal: "internal";
162
+ mirror_failed: "mirror_failed";
163
+ no_reply: "no_reply";
164
+ question_cap: "question_cap";
165
+ shutdown: "shutdown";
166
+ timeout: "timeout";
167
+ }>>>;
168
+ promptVersion: z.ZodCatch<z.ZodOptional<z.ZodString>>;
169
+ }, z.core.$strip>], "type">;
170
+ export type StreamEvent = z.infer<typeof streamEvent>;
171
+ export declare function parseStreamEvent(data: string): StreamEvent | null;
172
+ declare const spend: z.ZodObject<{
173
+ day: z.ZodString;
174
+ spentUsd: z.ZodNumber;
175
+ reservedUsd: z.ZodNumber;
176
+ capUsd: z.ZodNumber;
177
+ effortCapUsd: z.ZodObject<{
178
+ medium: z.ZodNumber;
179
+ high: z.ZodNumber;
180
+ }, z.core.$strip>;
181
+ month: z.ZodOptional<z.ZodObject<{
182
+ spentUsd: z.ZodNumber;
183
+ capUsd: z.ZodNumber;
184
+ }, z.core.$strip>>;
185
+ }, z.core.$strip>;
186
+ export type Spend = z.infer<typeof spend>;
187
+ export declare function parseSpend(raw: unknown): Spend | null;
188
+ export type Effort = 'medium' | 'high';
189
+ export type PageRef = {
190
+ route: string;
191
+ title?: string;
192
+ visibleText?: string;
193
+ environment?: 'staging';
194
+ };
195
+ export type HistoryExchange = {
196
+ question: string;
197
+ page: Omit<PageRef, 'visibleText'>;
198
+ answer: string;
199
+ citations: readonly Citation[];
200
+ commit: string;
201
+ carnet: Json;
202
+ };
203
+ export declare const LIMITS: {
204
+ question: number;
205
+ history: number;
206
+ aliases: number;
207
+ reply: number;
208
+ };
209
+ export {};
@@ -0,0 +1,26 @@
1
+ import type { Done, Effort } from './contract.ts';
2
+ export declare const NB = "\u00A0";
3
+ export declare function fr(s: string): string;
4
+ export declare function plural(n: number, one: string, many?: string): string;
5
+ export type EndCause = {
6
+ by: 'done';
7
+ done: Done;
8
+ } | {
9
+ by: 'stopped';
10
+ } | {
11
+ by: 'cut';
12
+ } | {
13
+ by: 'session';
14
+ status: 401 | 403;
15
+ };
16
+ export type EndAction = 'retry' | 'retry-high' | 'reformulate' | 'none';
17
+ export type Ending = {
18
+ kind: 'answer';
19
+ done: Done;
20
+ } | {
21
+ kind: 'ended';
22
+ text: string;
23
+ action: EndAction;
24
+ covered: string | null;
25
+ };
26
+ export declare function endingOf(cause: EndCause, effort: Effort, partial: boolean): Ending;
@@ -0,0 +1,40 @@
1
+ import type { Data, Parent, PhrasingContent, Root } from 'mdast';
2
+ import type { AliasEntry } from './contract.ts';
3
+ interface SoronMark {
4
+ type: 'soronMark';
5
+ ns: number[];
6
+ data?: Data;
7
+ }
8
+ interface SoronUnknown {
9
+ type: 'soronUnknown';
10
+ entity: string;
11
+ data?: Data;
12
+ }
13
+ interface SoronProof extends Parent {
14
+ type: 'soronProof';
15
+ ns: number[];
16
+ children: PhrasingContent[];
17
+ }
18
+ declare module 'mdast' {
19
+ interface PhrasingContentMap {
20
+ soronMark: SoronMark;
21
+ soronUnknown: SoronUnknown;
22
+ soronProof: SoronProof;
23
+ }
24
+ interface RootContentMap {
25
+ soronMark: SoronMark;
26
+ soronUnknown: SoronUnknown;
27
+ soronProof: SoronProof;
28
+ }
29
+ }
30
+ export type AlertKind = 'note' | 'tip' | 'important' | 'warning' | 'caution';
31
+ export declare const ALERTS: Readonly<Record<AlertKind, string>>;
32
+ export declare function alertKind(v: unknown): AlertKind | null;
33
+ type SoronMarkdownOptions = {
34
+ aliases: readonly AliasEntry[];
35
+ done: boolean;
36
+ };
37
+ export declare function remarkSoron(options: SoronMarkdownOptions): (tree: Root) => void;
38
+ export declare function streamSafe(text: string): string;
39
+ export declare function plainText(markdown: string, aliases: readonly AliasEntry[]): string;
40
+ export {};
@@ -0,0 +1,33 @@
1
+ import type { AliasEntry, Done, StreamEvent } from './contract.ts';
2
+ type StepTool = Extract<StreamEvent, {
3
+ type: 'step';
4
+ }>['tool'];
5
+ type JournalLine = {
6
+ kind: 'step';
7
+ tool: StepTool;
8
+ target: string;
9
+ label: string;
10
+ atMs: number;
11
+ } | {
12
+ kind: 'forbidden';
13
+ procedure: string;
14
+ };
15
+ export type RunView = {
16
+ steps: number;
17
+ label: string | null;
18
+ journal: readonly JournalLine[];
19
+ ask: {
20
+ question: string;
21
+ options: readonly string[];
22
+ } | null;
23
+ text: string;
24
+ answering: boolean;
25
+ restarted: boolean;
26
+ aliases: readonly AliasEntry[];
27
+ lastAliases: readonly AliasEntry[] | null;
28
+ done: Done | null;
29
+ };
30
+ export declare const EMPTY_RUN: RunView;
31
+ export declare function unionAliases(held: readonly AliasEntry[], received: readonly AliasEntry[]): AliasEntry[];
32
+ export declare function reduceRun(view: RunView, event: StreamEvent, atMs: number): RunView;
33
+ export {};
@@ -0,0 +1,58 @@
1
+ import { type Effort, type HistoryExchange, type AliasEntry, type PageRef, type Spend } from './contract.ts';
2
+ export type CardId = 'down' | 'busy' | 'unavailable' | 'slow' | 'reserved' | 'capnear' | 'invalid' | 'long' | 'badge' | 'role';
3
+ export declare class BadgeRefused extends Error {
4
+ readonly status: number;
5
+ constructor(status: number);
6
+ }
7
+ export type StartBody = {
8
+ question: string;
9
+ page: PageRef;
10
+ history: readonly HistoryExchange[];
11
+ aliases: readonly AliasEntry[];
12
+ effort: Effort;
13
+ };
14
+ export type StartResult = {
15
+ kind: 'started';
16
+ id: string;
17
+ } | {
18
+ kind: 'already_running';
19
+ id: string;
20
+ } | {
21
+ kind: 'daily_cap';
22
+ spend: Spend;
23
+ } | {
24
+ kind: 'card';
25
+ card: CardId;
26
+ };
27
+ export type EventsResult = {
28
+ kind: 'stream';
29
+ body: ReadableStream<Uint8Array>;
30
+ } | {
31
+ kind: 'gone';
32
+ } | {
33
+ kind: 'session';
34
+ status: 401 | 403;
35
+ } | {
36
+ kind: 'slow';
37
+ } | {
38
+ kind: 'down';
39
+ };
40
+ export type ServiceLink = {
41
+ start(body: StartBody): Promise<StartResult>;
42
+ events(id: string, after: number, signal: AbortSignal): Promise<EventsResult>;
43
+ answer(id: string, reply: string): Promise<'ok' | CardId>;
44
+ cancel(id: string): Promise<void>;
45
+ renewBadge(id: string): Promise<void>;
46
+ spend(): Promise<Spend | null>;
47
+ };
48
+ type ErrorBody = {
49
+ error?: unknown;
50
+ [key: string]: unknown;
51
+ };
52
+ export declare function cardFor(status: number, body: ErrorBody | null): CardId;
53
+ export declare function createServiceLink(deps: {
54
+ baseUrl: string;
55
+ badge: () => Promise<string>;
56
+ fetch?: typeof fetch;
57
+ }): ServiceLink;
58
+ export {};
@@ -0,0 +1,55 @@
1
+ import { type Card } from './cards.ts';
2
+ import { type Effort, type Spend } from './contract.ts';
3
+ import { type Ending } from './ending.ts';
4
+ import { type RunView } from './run-view.ts';
5
+ import type { ServiceLink, StartBody } from './service-link.ts';
6
+ export type Phase = 'sending' | 'reading' | 'waiting' | 'answering' | 'ended';
7
+ export type Passage = {
8
+ key: number;
9
+ question: string;
10
+ effort: Effort;
11
+ following: boolean;
12
+ runId: string | null;
13
+ view: RunView;
14
+ phase: Phase;
15
+ ending: Ending | null;
16
+ choice: string | null;
17
+ startedAt: number;
18
+ lastEventId: number;
19
+ };
20
+ export type Snapshot = {
21
+ passage: Passage | null;
22
+ card: Card | null;
23
+ cardQuestion: string | null;
24
+ cardEffort: Effort | null;
25
+ spend: Spend | null;
26
+ };
27
+ export declare const RULES: {
28
+ idleMs: number;
29
+ reconnectCardMs: number;
30
+ giveUpMs: number;
31
+ slowDownMs: number;
32
+ backoffMaxMs: number;
33
+ badgeRenewMs: number;
34
+ stoppedRetryMs: number;
35
+ stoppedRetries: number;
36
+ };
37
+ type Options = {
38
+ link: ServiceLink;
39
+ onDraft?: (question: string) => void;
40
+ onEnded?: (passage: Passage) => void;
41
+ };
42
+ export declare function createSoronSession({ link, onDraft, onEnded }: Options): {
43
+ subscribe(listener: () => void): () => void;
44
+ getSnapshot: () => Snapshot;
45
+ refreshSpend: () => Promise<void>;
46
+ ask(body: StartBody): boolean;
47
+ resume(runId: string, question: string, effort: Effort): boolean;
48
+ choose(reply: string): void;
49
+ stop(): void;
50
+ dismissCard: () => void;
51
+ shut(id: Card['id']): void;
52
+ dispose(): void;
53
+ };
54
+ export type SoronSession = ReturnType<typeof createSoronSession>;
55
+ export {};
@@ -0,0 +1,8 @@
1
+ type SseFrame = {
2
+ id: number | null;
3
+ data: string;
4
+ };
5
+ export declare function createSseParser(): {
6
+ push(text: string): SseFrame[];
7
+ };
8
+ export {};
@@ -0,0 +1,11 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type TriggerProps } from './ui.tsx';
3
+ export declare function HistoryMenu({ open, onOpenChange, onAll, trigger, }: {
4
+ open: boolean;
5
+ onOpenChange: (open: boolean) => void;
6
+ onAll: () => void;
7
+ trigger: (props: TriggerProps) => ReactNode;
8
+ }): import("react").JSX.Element | null;
9
+ export declare function AllDiscussions({ onClose }: {
10
+ onClose: () => void;
11
+ }): import("react").JSX.Element | null;
@@ -0,0 +1,26 @@
1
+ export declare const RETENTION_MS: number;
2
+ export type DiscussionRecord<E, R = unknown> = {
3
+ id: string;
4
+ title: string;
5
+ startPage: string;
6
+ createdAt: number;
7
+ updatedAt: number;
8
+ exchanges: E[];
9
+ draft: string;
10
+ running: R | null;
11
+ };
12
+ type DiscussionStore<E, R = unknown> = {
13
+ list(): Promise<DiscussionRecord<E, R>[]>;
14
+ put(record: DiscussionRecord<E, R>): Promise<void>;
15
+ update(id: string, change: (stored: DiscussionRecord<E, R>) => DiscussionRecord<E, R>): Promise<void>;
16
+ remove(id: string): Promise<void>;
17
+ clear(): Promise<void>;
18
+ };
19
+ export declare function openDiscussions<E, R = unknown>(opts: {
20
+ idb: IDBFactory;
21
+ account: string;
22
+ now?: () => number;
23
+ merge?: (stored: DiscussionRecord<E, R>, incoming: DiscussionRecord<E, R>) => DiscussionRecord<E, R>;
24
+ }): DiscussionStore<E, R>;
25
+ export declare function purgeAllDiscussions(idb: IDBFactory, keep?: string): Promise<void>;
26
+ export {};
@@ -0,0 +1,27 @@
1
+ import type { AliasEntry } from './core/contract.ts';
2
+ import { type EndAction, type Ending } from './core/ending.ts';
3
+ import type { RunView } from './core/run-view.ts';
4
+ import type { Phase } from './core/session.ts';
5
+ export declare const formatDateTime: (iso: string) => string;
6
+ export type ExchangeProps = {
7
+ anchor?: number;
8
+ pinned?: boolean;
9
+ question: string;
10
+ pageLabel: string | null;
11
+ askedAt: string;
12
+ view: RunView;
13
+ phase: Phase;
14
+ ending: Ending | null;
15
+ choice: string | null;
16
+ following: boolean;
17
+ aliases: readonly AliasEntry[];
18
+ elapsedMs: number;
19
+ onChoose?: (reply: string) => void;
20
+ onAction?: (question: string, action: EndAction, anchor?: number) => void;
21
+ onTip?: (tip: {
22
+ el: HTMLElement;
23
+ lines: string[];
24
+ } | null) => void;
25
+ onCopied?: () => void;
26
+ };
27
+ export declare const SoronExchange: import("react").MemoExoticComponent<(p: ExchangeProps) => import("react").JSX.Element>;
@@ -0,0 +1,5 @@
1
+ export type EyeState = 'rest' | 'reading' | 'waiting';
2
+ export declare function SoronEye({ size, state }: {
3
+ size: 16 | 32 | 80;
4
+ state?: EyeState;
5
+ }): import("react").JSX.Element;
@@ -0,0 +1,5 @@
1
+ export declare function tooOld(o: {
2
+ service: string;
3
+ version: string;
4
+ fetch?: typeof fetch;
5
+ }): Promise<boolean>;
@@ -0,0 +1,2 @@
1
+ export declare function SoronTrigger(): import("react").JSX.Element | null;
2
+ export declare function SoronPanel(): import("react").JSX.Element | null;
@@ -0,0 +1,73 @@
1
+ import { Component, type ReactNode } from 'react';
2
+ import { type AliasEntry, type Effort, type HistoryExchange, type PageRef } from './core/contract.ts';
3
+ import { type Snapshot } from './core/session.ts';
4
+ import { type SelfTest } from './self-test.ts';
5
+ import { type Discussion, type Exchange } from './use-discussions.ts';
6
+ type Signal = 'ready' | 'failed' | null;
7
+ export type FontSize = 14 | 16 | 18;
8
+ type SoronContext = {
9
+ snapshot: Snapshot;
10
+ exchanges: readonly Exchange[];
11
+ runningPage: {
12
+ page: Omit<PageRef, 'visibleText'>;
13
+ label: string;
14
+ askedAt: string;
15
+ } | null;
16
+ aliases: readonly AliasEntry[];
17
+ open: boolean;
18
+ setOpen: (open: boolean) => void;
19
+ signal: Signal;
20
+ draft: string;
21
+ setDraft: (text: string) => void;
22
+ ask: (question: string, effort?: Effort) => boolean;
23
+ stop: () => void;
24
+ choose: (reply: string) => void;
25
+ dismissCard: () => void;
26
+ effort: Effort;
27
+ setEffort: (effort: Effort) => void;
28
+ newDiscussion: () => void;
29
+ width: number;
30
+ setWidth: (w: number, persist?: boolean) => void;
31
+ fontSize: FontSize;
32
+ setFontSize: (fs: FontSize) => void;
33
+ announce: (text: string, now?: boolean) => void;
34
+ discussions: readonly Discussion[];
35
+ currentId: string;
36
+ title: string;
37
+ openDiscussion: (id: string) => void;
38
+ removeDiscussion: (id: string) => void;
39
+ undo: Discussion | null;
40
+ restoreDiscussion: () => void;
41
+ clearAll: () => void;
42
+ sent: readonly string[];
43
+ flushDraft: () => Promise<void>;
44
+ selfTest: SelfTest | 'running' | null;
45
+ };
46
+ export declare function useSoron(): SoronContext | null;
47
+ export declare const WIDTH: {
48
+ min: number;
49
+ max: number;
50
+ initial: number;
51
+ };
52
+ export declare function historyOf(exchanges: readonly Exchange[]): HistoryExchange[];
53
+ export declare class SoronBoundary extends Component<{
54
+ children: ReactNode;
55
+ }, {
56
+ failed: boolean;
57
+ }> {
58
+ state: {
59
+ failed: boolean;
60
+ };
61
+ static getDerivedStateFromError(): {
62
+ failed: boolean;
63
+ };
64
+ render(): ReactNode;
65
+ }
66
+ export declare function SoronProvider({ service, badge, account, version, children, }: {
67
+ service: string;
68
+ badge: () => Promise<string>;
69
+ account: string | null;
70
+ version: string;
71
+ children: ReactNode;
72
+ }): import("react").JSX.Element;
73
+ export {};