@kirkchinese/dsh-citeciter 0.8.2 → 0.9.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +78 -29
- package/README.zh.md +76 -29
- package/lib/client.js +7183 -6236
- package/lib/index.js +921 -386
- package/lib/{typert-common-BMA9IB7p.js → typert-common-Q3dqDoUa.js} +24 -17
- package/lib/typert.host.js +9 -30
- package/lib/typert.remote-client.js +1 -1
- package/lib/types/actions.d.ts +10 -0
- package/lib/types/atomic-replace.d.ts +9 -0
- package/lib/types/board-capture-protocol.d.ts +45 -0
- package/lib/types/board-capture.d.ts +6 -1
- package/lib/types/board.d.ts +4 -4
- package/lib/types/citer-agent-registry.d.ts +2 -2
- package/lib/types/citer-session-access.d.ts +1 -1
- package/lib/types/client/action-controller.d.ts +2 -5
- package/lib/types/client/action-executor.d.ts +1 -1
- package/lib/types/client/board-capture-controller.d.ts +17 -0
- package/lib/types/client/citer-session-face.d.ts +17 -1
- package/lib/types/client/companion-controller.d.ts +17 -9
- package/lib/types/client/components/ActionWheel.d.ts +2 -4
- package/lib/types/client/components/BoardCaptureWorker.d.ts +7 -0
- package/lib/types/client/components/CitePanel.d.ts +6 -3
- package/lib/types/client/components/LearningExample.d.ts +5 -0
- package/lib/types/client/components/MessageImage.d.ts +8 -0
- package/lib/types/client/components/ToolMessage.d.ts +10 -0
- package/lib/types/client/components/TopicComposer.d.ts +1 -4
- package/lib/types/client/dock-geometry.d.ts +4 -2
- package/lib/types/client/draft-controller.d.ts +45 -0
- package/lib/types/client/draft-references.d.ts +4 -7
- package/lib/types/client/host-dock.d.ts +4 -2
- package/lib/types/client/host-icons.d.ts +13 -0
- package/lib/types/client/host-image-preview.d.ts +8 -0
- package/lib/types/client/host-ui-adapter.d.ts +24 -0
- package/lib/types/client/native-composer.d.ts +7 -3
- package/lib/types/client/native-document.d.ts +2 -8
- package/lib/types/client/prompt.d.ts +2 -0
- package/lib/types/client/selection-references.d.ts +4 -0
- package/lib/types/client/transcript-position.d.ts +2 -1
- package/lib/types/client/types.d.ts +2 -0
- package/lib/types/client/update-controller.d.ts +2 -2
- package/lib/types/document-access.d.ts +3 -0
- package/lib/types/document-tools.d.ts +10 -0
- package/lib/types/draft-contract.d.ts +98 -0
- package/lib/types/draft-store.d.ts +23 -0
- package/lib/types/host-agent-modules.d.ts +4 -2
- package/lib/types/host-settings-adapter.d.ts +11 -0
- package/lib/types/index.d.ts +3 -1
- package/lib/types/learning-example.d.ts +53 -0
- package/lib/types/learning.d.ts +24 -3
- package/lib/types/message-projection.d.ts +15 -0
- package/lib/types/model-admission.d.ts +7 -0
- package/lib/types/native-session-contract.d.ts +1 -0
- package/lib/types/session-format-guard.d.ts +6 -0
- package/lib/types/source-storage.d.ts +3 -0
- package/lib/types/tool-events.d.ts +18 -0
- package/lib/types/topic-archive.d.ts +5 -0
- package/lib/types/topic-prompts.d.ts +5 -3
- package/lib/types/topic-runtime.d.ts +4 -2
- package/lib/types/topic.d.ts +204 -17
- package/lib/types/typert-codec.d.ts +13 -0
- package/lib/types/typert-common.d.ts +1165 -100
- package/lib/types/typert.host.d.ts +3271 -825
- package/lib/{update-BtuUBRbP.js → update-BRpjPM2f.js} +187 -9
- package/package.json +80 -78
|
@@ -1,4 +1,23 @@
|
|
|
1
|
-
import { f as citeCiterRequestSchema, p as citeCiterResponseSchema, r as updateCheckResponseSchema } from "./update-
|
|
1
|
+
import { f as citeCiterRequestSchema, p as citeCiterResponseSchema, r as updateCheckResponseSchema } from "./update-BRpjPM2f.js";
|
|
2
|
+
//#region lib/types/typert-codec.js
|
|
3
|
+
/** Public Typert schema forms: 0.1.5 reads schema; 0.1.7 creates it lazily. Both refer to one schema. */
|
|
4
|
+
function strictCodec(typeSymbol, schema) {
|
|
5
|
+
return {
|
|
6
|
+
mode: "strict",
|
|
7
|
+
typeSymbol,
|
|
8
|
+
schema,
|
|
9
|
+
create: () => schema
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
/** Publish the same named schema through both supported registry contracts. */
|
|
13
|
+
function namedSchema(name, schema) {
|
|
14
|
+
return {
|
|
15
|
+
name,
|
|
16
|
+
schema,
|
|
17
|
+
create: () => schema
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
2
21
|
//#region lib/types/typert-common.js
|
|
3
22
|
/** Strict root-scoped Topic command shared by Host and browser manifests. */
|
|
4
23
|
const citeCiterRequestDescriptor = {
|
|
@@ -11,18 +30,10 @@ const citeCiterRequestDescriptor = {
|
|
|
11
30
|
name: "rawRequest",
|
|
12
31
|
wire: "rawRequest",
|
|
13
32
|
source: "json",
|
|
14
|
-
codec:
|
|
15
|
-
mode: "strict",
|
|
16
|
-
typeSymbol: "@kirkchinese/dsh-citeciter#CiteCiterRequest",
|
|
17
|
-
schema: citeCiterRequestSchema
|
|
18
|
-
}
|
|
33
|
+
codec: strictCodec("@kirkchinese/dsh-citeciter#CiteCiterRequest", citeCiterRequestSchema)
|
|
19
34
|
}],
|
|
20
35
|
cancellation: { parameter: "signal" },
|
|
21
|
-
result:
|
|
22
|
-
mode: "strict",
|
|
23
|
-
typeSymbol: "@kirkchinese/dsh-citeciter#CiteCiterResponse",
|
|
24
|
-
schema: citeCiterResponseSchema
|
|
25
|
-
},
|
|
36
|
+
result: strictCodec("@kirkchinese/dsh-citeciter#CiteCiterResponse", citeCiterResponseSchema),
|
|
26
37
|
sourceLocation: {
|
|
27
38
|
file: "src/index.ts",
|
|
28
39
|
line: 127,
|
|
@@ -38,11 +49,7 @@ const updateCheckDescriptor = {
|
|
|
38
49
|
invocation: { kind: "direct" },
|
|
39
50
|
parameters: [],
|
|
40
51
|
cancellation: { parameter: "signal" },
|
|
41
|
-
result:
|
|
42
|
-
mode: "strict",
|
|
43
|
-
typeSymbol: "@kirkchinese/dsh-citeciter#UpdateCheckResponse",
|
|
44
|
-
schema: updateCheckResponseSchema
|
|
45
|
-
},
|
|
52
|
+
result: strictCodec("@kirkchinese/dsh-citeciter#UpdateCheckResponse", updateCheckResponseSchema),
|
|
46
53
|
sourceLocation: {
|
|
47
54
|
file: "src/index.ts",
|
|
48
55
|
line: 134,
|
|
@@ -50,4 +57,4 @@ const updateCheckDescriptor = {
|
|
|
50
57
|
}
|
|
51
58
|
};
|
|
52
59
|
//#endregion
|
|
53
|
-
export { updateCheckDescriptor as n, citeCiterRequestDescriptor as t };
|
|
60
|
+
export { updateCheckDescriptor as n, namedSchema as r, citeCiterRequestDescriptor as t };
|
package/lib/typert.host.js
CHANGED
|
@@ -1,39 +1,18 @@
|
|
|
1
|
-
import { C as topicSummarySchema, S as topicSnapshotSchema, f as citeCiterRequestSchema, l as citationDraftSchema, p as citeCiterResponseSchema, r as updateCheckResponseSchema, u as citationRecordSchema } from "./update-
|
|
2
|
-
import { n as updateCheckDescriptor, t as citeCiterRequestDescriptor } from "./typert-common-
|
|
1
|
+
import { C as topicSummarySchema, S as topicSnapshotSchema, f as citeCiterRequestSchema, l as citationDraftSchema, p as citeCiterResponseSchema, r as updateCheckResponseSchema, u as citationRecordSchema } from "./update-BRpjPM2f.js";
|
|
2
|
+
import { n as updateCheckDescriptor, r as namedSchema, t as citeCiterRequestDescriptor } from "./typert-common-Q3dqDoUa.js";
|
|
3
3
|
//#region lib/types/typert.host.js
|
|
4
4
|
/** Handwritten strict Host contribution matching the single Remote decorator. */
|
|
5
5
|
const TYPERT = {
|
|
6
6
|
package: "@kirkchinese/dsh-citeciter",
|
|
7
7
|
face: "host",
|
|
8
8
|
schemas: [
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
name: "TopicSummary",
|
|
19
|
-
schema: topicSummarySchema
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
name: "TopicSnapshot",
|
|
23
|
-
schema: topicSnapshotSchema
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
name: "CiteCiterRequest",
|
|
27
|
-
schema: citeCiterRequestSchema
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: "CiteCiterResponse",
|
|
31
|
-
schema: citeCiterResponseSchema
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
name: "UpdateCheckResponse",
|
|
35
|
-
schema: updateCheckResponseSchema
|
|
36
|
-
}
|
|
9
|
+
namedSchema("CitationDraft", citationDraftSchema),
|
|
10
|
+
namedSchema("CitationRecord", citationRecordSchema),
|
|
11
|
+
namedSchema("TopicSummary", topicSummarySchema),
|
|
12
|
+
namedSchema("TopicSnapshot", topicSnapshotSchema),
|
|
13
|
+
namedSchema("CiteCiterRequest", citeCiterRequestSchema),
|
|
14
|
+
namedSchema("CiteCiterResponse", citeCiterResponseSchema),
|
|
15
|
+
namedSchema("UpdateCheckResponse", updateCheckResponseSchema)
|
|
37
16
|
],
|
|
38
17
|
model: {
|
|
39
18
|
services: [],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as updateCheckDescriptor, t as citeCiterRequestDescriptor } from "./typert-common-
|
|
1
|
+
import { n as updateCheckDescriptor, t as citeCiterRequestDescriptor } from "./typert-common-Q3dqDoUa.js";
|
|
2
2
|
//#region lib/types/typert.remote-client.js
|
|
3
3
|
/** Browser contribution mounted by the CiteCiter Client fiber. */
|
|
4
4
|
const TYPERT_REMOTE = {
|
package/lib/types/actions.d.ts
CHANGED
|
@@ -12,6 +12,10 @@ export declare const citeActionSchema: z.ZodObject<{
|
|
|
12
12
|
side: "side";
|
|
13
13
|
floating: "floating";
|
|
14
14
|
}>;
|
|
15
|
+
target: z.ZodOptional<z.ZodEnum<{
|
|
16
|
+
current: "current";
|
|
17
|
+
new: "new";
|
|
18
|
+
}>>;
|
|
15
19
|
}, z.core.$strict>;
|
|
16
20
|
export type CiteAction = z.infer<typeof citeActionSchema>;
|
|
17
21
|
export declare const wheelSlotsSchema: z.ZodArray<z.ZodNullable<z.ZodObject<{
|
|
@@ -26,6 +30,10 @@ export declare const wheelSlotsSchema: z.ZodArray<z.ZodNullable<z.ZodObject<{
|
|
|
26
30
|
side: "side";
|
|
27
31
|
floating: "floating";
|
|
28
32
|
}>;
|
|
33
|
+
target: z.ZodOptional<z.ZodEnum<{
|
|
34
|
+
current: "current";
|
|
35
|
+
new: "new";
|
|
36
|
+
}>>;
|
|
29
37
|
}, z.core.$strict>>>;
|
|
30
38
|
export declare const wheelTriggerSchema: z.ZodEnum<{
|
|
31
39
|
"right-button": "right-button";
|
|
@@ -43,5 +51,7 @@ export declare const actionModelSchema: z.ZodObject<{
|
|
|
43
51
|
export type ActionModel = z.infer<typeof actionModelSchema>;
|
|
44
52
|
/** Clockwise from twelve o'clock. Empty slots retain their positions. */
|
|
45
53
|
export declare const DEFAULT_WHEEL_SLOTS: readonly (CiteAction | null)[];
|
|
54
|
+
/** Preserve customized legacy slots; only the unchanged built-in free question gains append behavior. */
|
|
55
|
+
export declare function actionTarget(action: CiteAction): 'current' | 'new';
|
|
46
56
|
/** Combine a mode and optional user question without hidden system state. */
|
|
47
57
|
export declare function actionQuestion(action: CiteAction, question: string): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Atomically replace an owned file, tolerating brief Windows sharing conflicts.
|
|
3
|
+
* @param temporary - complete temporary file in the destination directory.
|
|
4
|
+
* @param destination - ownership-validated target; callers serialize its writes.
|
|
5
|
+
* @throws The last filesystem error after at most 620ms of retry delays. Other
|
|
6
|
+
* errors and non-Windows failures propagate immediately. Neither file is deleted
|
|
7
|
+
* here; callers retain responsibility for temporary-file cleanup.
|
|
8
|
+
*/
|
|
9
|
+
export declare function atomicReplace(temporary: string, destination: string): Promise<void>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Immutable board revision requested by one real model tool call, independent of UI selection. */
|
|
3
|
+
export declare const boardCaptureJobSchema: z.ZodObject<{
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
sessionId: z.ZodString;
|
|
6
|
+
board: z.ZodObject<{
|
|
7
|
+
version: z.ZodLiteral<4>;
|
|
8
|
+
revision: z.ZodNumber;
|
|
9
|
+
elements: z.ZodArray<z.ZodObject<{
|
|
10
|
+
id: z.ZodString;
|
|
11
|
+
kind: z.ZodEnum<{
|
|
12
|
+
text: "text";
|
|
13
|
+
image: "image";
|
|
14
|
+
markdown: "markdown";
|
|
15
|
+
math: "math";
|
|
16
|
+
svg: "svg";
|
|
17
|
+
html: "html";
|
|
18
|
+
table: "table";
|
|
19
|
+
}>;
|
|
20
|
+
content: z.ZodString;
|
|
21
|
+
x: z.ZodNumber;
|
|
22
|
+
y: z.ZodNumber;
|
|
23
|
+
w: z.ZodNumber;
|
|
24
|
+
h: z.ZodNumber;
|
|
25
|
+
style: z.ZodObject<{
|
|
26
|
+
color: z.ZodOptional<z.ZodString>;
|
|
27
|
+
fontSize: z.ZodOptional<z.ZodString>;
|
|
28
|
+
}, z.core.$strict>;
|
|
29
|
+
focused: z.ZodBoolean;
|
|
30
|
+
animation: z.ZodOptional<z.ZodObject<{
|
|
31
|
+
name: z.ZodEnum<{
|
|
32
|
+
"fade-in": "fade-in";
|
|
33
|
+
"slide-in": "slide-in";
|
|
34
|
+
pulse: "pulse";
|
|
35
|
+
highlight: "highlight";
|
|
36
|
+
}>;
|
|
37
|
+
durationMs: z.ZodNumber;
|
|
38
|
+
iterations: z.ZodNumber;
|
|
39
|
+
run: z.ZodNumber;
|
|
40
|
+
}, z.core.$strict>>;
|
|
41
|
+
}, z.core.$strict>>;
|
|
42
|
+
invalid: z.ZodNumber;
|
|
43
|
+
}, z.core.$strict>;
|
|
44
|
+
}, z.core.$strict>;
|
|
45
|
+
export type BoardCaptureJob = z.infer<typeof boardCaptureJobSchema>;
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { Agent } from '@deepseek-ai/dsh-agent';
|
|
3
|
+
import type { BoardSnapshot } from './board.ts';
|
|
4
|
+
import type { BoardCaptureJob } from './board-capture-protocol.ts';
|
|
2
5
|
/** Correlates one model-requested render with one client reply; bytes become a durable DSH attachment. */
|
|
3
6
|
export declare class BoardCaptureBroker {
|
|
4
7
|
private readonly pending;
|
|
5
8
|
id(sessionId: string): string | undefined;
|
|
9
|
+
/** Only live capture requests are advertised; polling does not load or resume other Topics. */
|
|
10
|
+
jobs(): BoardCaptureJob[];
|
|
6
11
|
reply(sessionId: string, id: string, png?: string, error?: string): void;
|
|
7
12
|
dispose(): void;
|
|
8
13
|
private capture;
|
|
9
14
|
/** Tool returns the browser-rendered board image inside the current turn; it never starts another prompt. */
|
|
10
|
-
tool(ctx: Context): import("@deepseek-ai/dsh-tools").ToolDefinition;
|
|
15
|
+
tool(ctx: Context, readBoard: (agent: Agent) => BoardSnapshot): import("@deepseek-ai/dsh-tools").ToolDefinition;
|
|
11
16
|
}
|
package/lib/types/board.d.ts
CHANGED
|
@@ -10,8 +10,8 @@ export declare const BOARD_MAX_ELEMENTS = 50;
|
|
|
10
10
|
export declare const BOARD_MAX_CONTENT_BYTES = 500000;
|
|
11
11
|
/** Element kinds the blackboard renders safely on the chalk canvas. */
|
|
12
12
|
export declare const boardElementKindSchema: z.ZodEnum<{
|
|
13
|
-
image: "image";
|
|
14
13
|
text: "text";
|
|
14
|
+
image: "image";
|
|
15
15
|
markdown: "markdown";
|
|
16
16
|
math: "math";
|
|
17
17
|
svg: "svg";
|
|
@@ -32,8 +32,8 @@ export declare const boardOpSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
32
32
|
op: z.ZodLiteral<"set">;
|
|
33
33
|
id: z.ZodString;
|
|
34
34
|
kind: z.ZodEnum<{
|
|
35
|
-
image: "image";
|
|
36
35
|
text: "text";
|
|
36
|
+
image: "image";
|
|
37
37
|
markdown: "markdown";
|
|
38
38
|
math: "math";
|
|
39
39
|
svg: "svg";
|
|
@@ -93,8 +93,8 @@ export declare const boardBatchSchema: z.ZodArray<z.ZodDiscriminatedUnion<[z.Zod
|
|
|
93
93
|
op: z.ZodLiteral<"set">;
|
|
94
94
|
id: z.ZodString;
|
|
95
95
|
kind: z.ZodEnum<{
|
|
96
|
-
image: "image";
|
|
97
96
|
text: "text";
|
|
97
|
+
image: "image";
|
|
98
98
|
markdown: "markdown";
|
|
99
99
|
math: "math";
|
|
100
100
|
svg: "svg";
|
|
@@ -185,8 +185,8 @@ export declare const boardSnapshotSchema: z.ZodObject<{
|
|
|
185
185
|
elements: z.ZodArray<z.ZodObject<{
|
|
186
186
|
id: z.ZodString;
|
|
187
187
|
kind: z.ZodEnum<{
|
|
188
|
-
image: "image";
|
|
189
188
|
text: "text";
|
|
189
|
+
image: "image";
|
|
190
190
|
markdown: "markdown";
|
|
191
191
|
math: "math";
|
|
192
192
|
svg: "svg";
|
|
@@ -8,8 +8,8 @@ export declare class CiterAgentRegistry extends AgentRegistry {
|
|
|
8
8
|
readonly registry: AgentRegistry;
|
|
9
9
|
});
|
|
10
10
|
enter(agent: Agent, owner: Agent | undefined): () => void;
|
|
11
|
-
announce(
|
|
12
|
-
register(agent: Agent):
|
|
11
|
+
announce(...args: Parameters<AgentRegistry['announce']>): ReturnType<AgentRegistry['announce']>;
|
|
12
|
+
register(agent: Agent): ReturnType<AgentRegistry['register']>;
|
|
13
13
|
get(id: SessionId): Agent | undefined;
|
|
14
14
|
list(): Agent[];
|
|
15
15
|
roots(): Agent[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Context } from '@deepseek-ai/cordis';
|
|
2
2
|
import type SessionStore from '@deepseek-ai/dsh-session';
|
|
3
3
|
import type { Session } from '@deepseek-ai/dsh-session';
|
|
4
|
-
/**
|
|
4
|
+
/** Route durability checkpoints to owned stores without publishing Topic identities in the Host store. */
|
|
5
5
|
export declare class CiterSessionAccess {
|
|
6
6
|
private readonly owners;
|
|
7
7
|
/** Install one reversible adapter for this plugin's lifetime. No Host files or Agent Loop methods change. */
|
|
@@ -34,14 +34,13 @@ export interface ActionSnapshot {
|
|
|
34
34
|
readonly x: number;
|
|
35
35
|
readonly y: number;
|
|
36
36
|
} | null;
|
|
37
|
-
question: string;
|
|
38
37
|
submitting: boolean;
|
|
39
38
|
error: string | null;
|
|
40
39
|
model: ActionModel | undefined;
|
|
41
40
|
}
|
|
42
41
|
/** Direction around the actual displayed centre; no action inside the dead zone or outside the wheel. */
|
|
43
42
|
export declare function wheelSector(dx: number, dy: number): number | null;
|
|
44
|
-
/**
|
|
43
|
+
/** Prepare a draft through the action's destination policy; the Topic composer owns input and submission. */
|
|
45
44
|
export declare function createActionController(execute: (source: ActionSource, action: CiteAction, question: string, model?: ActionModel) => Promise<void>, defaultModel?: () => ActionModel | undefined): {
|
|
46
45
|
getSnapshot: () => ActionSnapshot;
|
|
47
46
|
subscribe: (fn: () => void) => () => void;
|
|
@@ -49,13 +48,11 @@ export declare function createActionController(execute: (source: ActionSource, a
|
|
|
49
48
|
move(x: number, y: number): void;
|
|
50
49
|
focus(index: number): void;
|
|
51
50
|
release(quick: boolean): void;
|
|
52
|
-
/**
|
|
51
|
+
/** Focus loss cancels only the transient gesture; the Topic composer retains its draft. */
|
|
53
52
|
dismissWheel(): void;
|
|
54
53
|
choose: (index: number | null) => void;
|
|
55
54
|
cancel: () => void;
|
|
56
55
|
submit: () => Promise<void>;
|
|
57
|
-
setModel(model: ActionModel | undefined): void;
|
|
58
|
-
setQuestion(question: string): void;
|
|
59
56
|
dispose(): Promise<void>;
|
|
60
57
|
};
|
|
61
58
|
export type ActionController = ReturnType<typeof createActionController>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type CiteAction, type ActionModel, type PanelPresentation } from '../actions.ts';
|
|
2
2
|
import { type ActionSource } from './action-controller.ts';
|
|
3
3
|
import type { CompanionFace } from './companion-controller.ts';
|
|
4
4
|
import type { ReaderFace } from './reader-controller.ts';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { BoardCaptureJob } from '../board-capture-protocol.ts';
|
|
2
|
+
import type { CiteCiterRequest, CiteCiterResponse } from '../topic.ts';
|
|
3
|
+
export interface BoardCaptureSnapshot {
|
|
4
|
+
jobs: readonly BoardCaptureJob[];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Poll only model-requested board renders, independently of navigation or visible Topics.
|
|
8
|
+
* @param request - authenticated root-scoped Citer transport; no Session activation is needed.
|
|
9
|
+
* @param report - report transport failures once until connectivity recovers.
|
|
10
|
+
* @returns render store and stable reply callback; dispose aborts RPCs and removes the poll timer.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createBoardCaptureController(request: (request: CiteCiterRequest, signal: AbortSignal) => Promise<CiteCiterResponse>, report: (error: unknown) => void): {
|
|
13
|
+
getSnapshot: () => BoardCaptureSnapshot;
|
|
14
|
+
subscribe: (fn: () => void) => () => void;
|
|
15
|
+
reply: (sessionId: string, id: string, png?: string, error?: string) => Promise<void>;
|
|
16
|
+
dispose: () => void;
|
|
17
|
+
};
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import type { Context } from '@deepseek-ai/cordis';
|
|
2
2
|
import type { SessionFace, SessionSnapshot } from '@deepseek-ai/dsh-api-session-controller/client';
|
|
3
3
|
import { type SessionId } from '@deepseek-ai/dsh-session/types';
|
|
4
|
+
import type { MessageId } from '@deepseek-ai/dsh-llm';
|
|
4
5
|
import type { SessionRequestId } from '@deepseek-ai/dsh-api-session-controller/types';
|
|
6
|
+
import type { NativeState } from '../native-session-contract.ts';
|
|
7
|
+
/** Native control state plus Citer's read-only view of the authoritative inbox. */
|
|
8
|
+
export interface CiterSessionSnapshot extends SessionSnapshot {
|
|
9
|
+
readonly modelSelectionRequired?: boolean;
|
|
10
|
+
readonly queue: readonly (NativeState['queue'][number] & {
|
|
11
|
+
id: MessageId;
|
|
12
|
+
messageId: MessageId;
|
|
13
|
+
rpcId?: SessionRequestId;
|
|
14
|
+
content: import('@deepseek-ai/dsh-llm').ContentBlock[];
|
|
15
|
+
preview: string;
|
|
16
|
+
})[];
|
|
17
|
+
}
|
|
5
18
|
type Submission = Parameters<SessionFace['beginSubmission']>[0];
|
|
6
19
|
/** Own the published SessionFace contract for Citer navigation. Sending, uploads and inbox mutations remain native DSH operations. */
|
|
7
20
|
export declare class CiterSessionFace implements SessionFace {
|
|
@@ -17,8 +30,11 @@ export declare class CiterSessionFace implements SessionFace {
|
|
|
17
30
|
private observers;
|
|
18
31
|
private timer;
|
|
19
32
|
private refreshing;
|
|
33
|
+
private nextRequestId;
|
|
34
|
+
/** Use the draft's durable identity for this explicit send, including retries after restart. */
|
|
35
|
+
prepareSubmission(requestId: string): void;
|
|
20
36
|
constructor(ctx: Context, sessionId: SessionId);
|
|
21
|
-
getSnapshot: () =>
|
|
37
|
+
getSnapshot: () => CiterSessionSnapshot;
|
|
22
38
|
subscribe: (listener: () => void) => (() => void);
|
|
23
39
|
/** Establish ownership and obtain a real baseline before accepting composer work. */
|
|
24
40
|
ready(): Promise<void>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { NativeComposer, DeliveryMode } from './native-composer.ts';
|
|
2
2
|
import type { DraftAttachmentId } from '@deepseek-ai/dsh-client-ui-conversation/client';
|
|
3
3
|
import type { SessionId } from '@deepseek-ai/dsh-session/types';
|
|
4
|
-
import type {
|
|
4
|
+
import type { SettingsForm } from './host-ui-adapter.ts';
|
|
5
5
|
import type { SnapshotStore } from '@deepseek-ai/dsh-client-store';
|
|
6
6
|
import type { ChatSnapshot } from '@deepseek-ai/dsh-client-ui-chat/client';
|
|
7
7
|
import type { RemoteResult } from '@deepseek-ai/dsh-typert-protocol';
|
|
@@ -9,16 +9,19 @@ import { type CiteCiterRequest, type CiteCiterResponse, type CiteCiterSettings,
|
|
|
9
9
|
import { type CreateMode, type DocumentClaimIntent } from './request-guard.ts';
|
|
10
10
|
import type { ActionModel } from '../actions.ts';
|
|
11
11
|
import type { CiteSelection } from './types.ts';
|
|
12
|
+
import { type DraftReference } from './draft-references.ts';
|
|
12
13
|
export type CompanionPhase = 'idle' | 'creating' | 'ready' | 'running' | 'stopping' | 'stopped' | 'error';
|
|
13
14
|
export type { CreateMode } from './request-guard.ts';
|
|
14
15
|
export type TopicsStatus = 'idle' | 'loading' | 'ready' | 'error';
|
|
15
16
|
export type SettingsSaveStatus = 'idle' | 'saving' | 'saved' | 'error';
|
|
17
|
+
export interface ComposeSeed {
|
|
18
|
+
readonly sessionId: string;
|
|
19
|
+
readonly question: string;
|
|
20
|
+
readonly id: string;
|
|
21
|
+
readonly references: readonly DraftReference[];
|
|
22
|
+
}
|
|
16
23
|
export interface CompanionSnapshot {
|
|
17
|
-
|
|
18
|
-
readonly sessionId: string;
|
|
19
|
-
readonly question: string;
|
|
20
|
-
readonly id: string;
|
|
21
|
-
} | null;
|
|
24
|
+
composeSeeds: readonly ComposeSeed[];
|
|
22
25
|
sourceSessionId: SessionId | null;
|
|
23
26
|
phase: CompanionPhase;
|
|
24
27
|
draftQuote: string | null;
|
|
@@ -51,11 +54,16 @@ export interface CompanionFace {
|
|
|
51
54
|
/** Create a Reading Topic; rejects on failure so the Reader retains the unsent question. */
|
|
52
55
|
createFromDocument(claim: DocumentClaimIntent, question: string, sourceSessionId?: SessionId, modelRoute?: ActionModel): Promise<void>;
|
|
53
56
|
openTopic(sessionId: string): Promise<void>;
|
|
54
|
-
|
|
57
|
+
/** Resolve only the explicitly selected, unarchived Topic; null means create a new one. */
|
|
58
|
+
resolveDraftTopic(sourceSessionId: SessionId): Promise<string | null>;
|
|
59
|
+
/** Append to the exact still-selected Topic; never change its route, permissions or running turn. */
|
|
60
|
+
appendSelection(sourceSessionId: SessionId, topicSessionId: string, question: string, references: readonly DraftReference[]): void;
|
|
61
|
+
/** Acknowledge a draft event only after its UI consumer accepted it. */
|
|
62
|
+
consumeComposeSeed(id: string): void;
|
|
63
|
+
ask(question: string, attachments?: readonly DraftAttachmentId[], mode?: DeliveryMode, requestId?: string, expectedSessionId?: string): Promise<boolean>;
|
|
55
64
|
setPermission(mode: NonNullable<CiteCiterSettings['defaultPermission']>): Promise<void>;
|
|
56
65
|
answerQuestion(key: string, answer: QuestionAnswer): Promise<void>;
|
|
57
66
|
cancelQuestion(key: string): Promise<void>;
|
|
58
|
-
boardCaptureReply(sessionId: string, id: string, png?: string, error?: string): Promise<void>;
|
|
59
67
|
stop(): Promise<void>;
|
|
60
68
|
rename(title: string): Promise<boolean>;
|
|
61
69
|
archive(archived: boolean): Promise<boolean>;
|
|
@@ -70,4 +78,4 @@ export interface CompanionFace {
|
|
|
70
78
|
/** Initial browser snapshot for the root-scoped CiteCiter controller. */
|
|
71
79
|
export declare const INITIAL_COMPANION_SNAPSHOT: CompanionSnapshot;
|
|
72
80
|
/** Bind private Topic Remote calls to one browser snapshot and polling lifecycle. */
|
|
73
|
-
export declare function createCompanionController(readChat: (sessionId: SessionId) => ChatSnapshot | undefined,
|
|
81
|
+
export declare function createCompanionController(readChat: (sessionId: SessionId) => ChatSnapshot | undefined, configForms: SettingsForm<CiteCiterSettings>, request: RemoteRequest, onAutoOpen: () => void, store: SnapshotStore<CompanionSnapshot>, nativeComposer: NativeComposer): CompanionFace;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import type { SnapshotSelectorHook } from '@deepseek-ai/dsh-client-store';
|
|
2
2
|
import { type ActionController, type ActionSnapshot } from '../action-controller.ts';
|
|
3
3
|
import type { CompanionActions } from '../view-actions.ts';
|
|
4
|
-
import type { CompanionSnapshot } from '../companion-controller.ts';
|
|
5
4
|
export type ActionCallbacks = Omit<ActionController, 'getSnapshot' | 'subscribe' | 'dispose'>;
|
|
6
|
-
/** Public
|
|
7
|
-
export declare function ActionWheel({ useActions,
|
|
5
|
+
/** Public wheel and creation-error retry. Questions and models are edited only in the Topic composer. */
|
|
6
|
+
export declare function ActionWheel({ useActions, actions, companion }: {
|
|
8
7
|
useActions: SnapshotSelectorHook<ActionSnapshot>;
|
|
9
|
-
useCompanion: SnapshotSelectorHook<CompanionSnapshot>;
|
|
10
8
|
actions: ActionCallbacks;
|
|
11
9
|
companion: CompanionActions;
|
|
12
10
|
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SnapshotSelectorHook } from '@deepseek-ai/dsh-client-store';
|
|
2
|
+
import type { BoardCaptureSnapshot, createBoardCaptureController } from '../board-capture-controller.ts';
|
|
3
|
+
/** Root-owned render workers survive panel close, Topic changes and source navigation. */
|
|
4
|
+
export declare function BoardCaptureWorker({ useCapture, reply }: {
|
|
5
|
+
readonly useCapture: SnapshotSelectorHook<BoardCaptureSnapshot>;
|
|
6
|
+
readonly reply: ReturnType<typeof createBoardCaptureController>['reply'];
|
|
7
|
+
}): import("react").JSX.Element;
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import type { NativeComposer, DeliveryMode } from '../native-composer.ts';
|
|
2
|
-
import type
|
|
2
|
+
import { type DraftController, type DraftSnapshot } from '../draft-controller.ts';
|
|
3
|
+
import type { InteractionSnapshot } from '../host-ui-adapter.ts';
|
|
3
4
|
import type { SnapshotSelectorHook } from '@deepseek-ai/dsh-client-store';
|
|
4
5
|
import type { CiteOverlaySnapshot } from '../types.ts';
|
|
5
6
|
import type { CompanionSnapshot } from '../companion-controller.ts';
|
|
6
7
|
import type { CompanionActions, OverlayActions } from '../view-actions.ts';
|
|
7
8
|
export interface CitePanelProps {
|
|
9
|
+
readonly drafts: Omit<DraftController, 'getSnapshot' | 'subscribe' | 'dispose'>;
|
|
10
|
+
readonly useDrafts: SnapshotSelectorHook<DraftSnapshot>;
|
|
8
11
|
readonly nativeComposer: NativeComposer;
|
|
9
12
|
readonly useCompanion: SnapshotSelectorHook<CompanionSnapshot>;
|
|
10
13
|
readonly useOverlay: SnapshotSelectorHook<CiteOverlaySnapshot>;
|
|
11
|
-
readonly useInteractions:
|
|
14
|
+
readonly useInteractions: SnapshotSelectorHook<InteractionSnapshot>;
|
|
12
15
|
readonly useSubmission: SnapshotSelectorHook<DeliveryMode>;
|
|
13
16
|
readonly bus: OverlayActions;
|
|
14
17
|
readonly companion: CompanionActions;
|
|
@@ -21,4 +24,4 @@ export interface CitePanelProps {
|
|
|
21
24
|
* @param props - shared panel bus, Topic controller, and host callbacks.
|
|
22
25
|
* @returns the responsive Topic dock and its dialogs, or null while closed.
|
|
23
26
|
*/
|
|
24
|
-
export declare function CitePanel({ nativeComposer, useCompanion, useOverlay, useInteractions, useSubmission, bus, companion, closePanel, openReader, reportParseError }: CitePanelProps): import("react").JSX.Element | null;
|
|
27
|
+
export declare function CitePanel({ nativeComposer, drafts, useDrafts, useCompanion, useOverlay, useInteractions, useSubmission, bus, companion, closePanel, openReader, reportParseError }: CitePanelProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { LearningExample as Example } from '../../learning-example.ts';
|
|
2
|
+
/** Render the explicit example kind; even HTML/SVG source stays literal code. */
|
|
3
|
+
export declare function LearningExample({ example }: {
|
|
4
|
+
readonly example: Example;
|
|
5
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { NativeComposer } from '../native-composer.ts';
|
|
2
|
+
import type { MessageAttachment } from './MessageAttachments.tsx';
|
|
3
|
+
/** Own an authorized image URL and its preview for exactly one mounted attachment. */
|
|
4
|
+
export declare function MessageImage({ sessionId, attachment, load }: {
|
|
5
|
+
readonly sessionId: string;
|
|
6
|
+
readonly attachment: MessageAttachment;
|
|
7
|
+
readonly load: NativeComposer['attachment'];
|
|
8
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TopicMessage } from '../../topic.ts';
|
|
2
|
+
import type { NativeComposer } from '../native-composer.ts';
|
|
3
|
+
/** Show returned files immediately while keeping diagnostic arguments and results collapsible. */
|
|
4
|
+
export declare function ToolRow({ message, sessionId, load }: {
|
|
5
|
+
readonly message: Extract<TopicMessage, {
|
|
6
|
+
role: 'tool';
|
|
7
|
+
}>;
|
|
8
|
+
readonly sessionId: string;
|
|
9
|
+
readonly load: NativeComposer['attachment'];
|
|
10
|
+
}): import("react").JSX.Element;
|
|
@@ -3,15 +3,12 @@ import type { ProviderOption, TopicModelConfig } from '../../topic.ts';
|
|
|
3
3
|
import type { CompanionPhase } from '../companion-controller.ts';
|
|
4
4
|
import { type PermissionMode } from './PermissionControl.tsx';
|
|
5
5
|
import type { DeliveryMode } from '../native-composer.ts';
|
|
6
|
-
import type { DraftReference } from '../draft-references.ts';
|
|
7
6
|
/**
|
|
8
7
|
* Render the Topic draft and its submission controls without accessing services.
|
|
9
8
|
* @param props - controlled draft, model route, request state and user-action callbacks.
|
|
10
9
|
* @returns one form; model changes and sending remain owned by the Topic controller.
|
|
11
10
|
*/
|
|
12
|
-
export declare function TopicComposer({ question, placeholder, route, providers, phase, canSend, routeSaving, folded, inputRef, onExpand, onQuestion, onSubmit, onStop, onModel, onReasoning, attachments, permission, onPermission, onFiles, delivery, onDelivery
|
|
13
|
-
readonly sources: readonly DraftReference[];
|
|
14
|
-
readonly onReference: (reference: DraftReference) => void;
|
|
11
|
+
export declare function TopicComposer({ question, placeholder, route, providers, phase, canSend, routeSaving, folded, inputRef, onExpand, onQuestion, onSubmit, onStop, onModel, onReasoning, attachments, permission, onPermission, onFiles, delivery, onDelivery }: {
|
|
15
12
|
readonly permission: PermissionMode;
|
|
16
13
|
readonly onPermission: (mode: PermissionMode) => void;
|
|
17
14
|
readonly onFiles: (files: readonly File[]) => void;
|
|
@@ -6,10 +6,12 @@ export interface DockViewport {
|
|
|
6
6
|
readonly details: number;
|
|
7
7
|
readonly caption: number;
|
|
8
8
|
readonly percent: number;
|
|
9
|
+
/** Explicit Citer navigation may temporarily take the compact page from details. */
|
|
10
|
+
readonly preferDetails?: boolean;
|
|
9
11
|
}
|
|
10
|
-
/** Wide windows reserve a column; compact
|
|
12
|
+
/** Wide windows reserve a column; compact details take priority unless Citer was explicitly selected. */
|
|
11
13
|
export interface DockGeometry {
|
|
12
|
-
readonly mode: 'columns' | 'page';
|
|
14
|
+
readonly mode: 'columns' | 'page' | 'suspended';
|
|
13
15
|
readonly width: number;
|
|
14
16
|
readonly height: number;
|
|
15
17
|
readonly top: number;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ComposerAttachment } from '@deepseek-ai/dsh-client-ui-conversation/client';
|
|
2
|
+
import type { CiteCiterRequest, CiteCiterResponse } from '../topic.ts';
|
|
3
|
+
import { type DraftContent, type DraftFile } from '../draft-contract.ts';
|
|
4
|
+
import { type DraftReference } from './draft-references.ts';
|
|
5
|
+
import type { NativeComposer } from './native-composer.ts';
|
|
6
|
+
export interface DraftView {
|
|
7
|
+
readonly content: DraftContent;
|
|
8
|
+
readonly files: readonly ComposerAttachment[];
|
|
9
|
+
readonly missing: readonly DraftFile[];
|
|
10
|
+
readonly ready: boolean;
|
|
11
|
+
readonly saving: boolean;
|
|
12
|
+
readonly sending: boolean;
|
|
13
|
+
readonly conflict: boolean;
|
|
14
|
+
readonly pending: boolean;
|
|
15
|
+
readonly error: string | null;
|
|
16
|
+
}
|
|
17
|
+
export type DraftSnapshot = Readonly<Record<string, DraftView>>;
|
|
18
|
+
export declare const EMPTY_DRAFT_VIEW: DraftView;
|
|
19
|
+
type Request = (request: CiteCiterRequest) => Promise<CiteCiterResponse>;
|
|
20
|
+
/** Own draft persistence and attachment lifetimes independently of panel mounting and Topic navigation. */
|
|
21
|
+
export declare function createDraftController(request: Request, native: NativeComposer): {
|
|
22
|
+
getSnapshot: () => Readonly<Record<string, DraftView>>;
|
|
23
|
+
subscribe: (listener: () => void) => () => void;
|
|
24
|
+
/** Pending receipts are already durable; only unflushed local edits need a navigation warning. */
|
|
25
|
+
hasUnsavedChanges: () => boolean;
|
|
26
|
+
flushAll: () => Promise<PromiseSettledResult<void>[]>;
|
|
27
|
+
ensure: (id: string) => Promise<void>;
|
|
28
|
+
flush: (id: string) => Promise<void>;
|
|
29
|
+
setText: (id: string, text: string) => Promise<void>;
|
|
30
|
+
append: (id: string, text: string, references: readonly DraftReference[]) => Promise<void>;
|
|
31
|
+
removeReference: (id: string, referenceId: string) => Promise<void>;
|
|
32
|
+
addFiles: (id: string, files: readonly File[]) => Promise<void>;
|
|
33
|
+
removeFile: (id: string, fileId: string) => Promise<void>;
|
|
34
|
+
/** Persist the exact outgoing snapshot and identity before native submission begins. */
|
|
35
|
+
submit: (id: string, send: (content: DraftContent, files: readonly ComposerAttachment[], requestId: string) => Promise<boolean>, retry?: boolean) => Promise<boolean>;
|
|
36
|
+
reload: (id: string) => Promise<void>;
|
|
37
|
+
/** Check a lost send response without replacing edits made while the check is in flight. */
|
|
38
|
+
reconcile: (id: string) => Promise<void>;
|
|
39
|
+
/** Explicit conflict resolution: restore locally retained bytes removed by a peer, then CAS the latest revision. */
|
|
40
|
+
keepLocal: (id: string) => Promise<void>;
|
|
41
|
+
forget: (id: string) => void;
|
|
42
|
+
dispose: () => Promise<void>;
|
|
43
|
+
};
|
|
44
|
+
export type DraftController = ReturnType<typeof createDraftController>;
|
|
45
|
+
export {};
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import type { TopicSummary } from '../topic.ts';
|
|
2
|
+
import type { DraftContent } from '../draft-contract.ts';
|
|
2
3
|
/** One unsent model-visible reference. Removing this value removes its serialized content. */
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
readonly label: string;
|
|
7
|
-
readonly content: string;
|
|
8
|
-
readonly address?: string;
|
|
9
|
-
}
|
|
4
|
+
export type DraftReference = DraftContent['references'][number];
|
|
5
|
+
/** Append real references once per unsent draft. A later explicit selection can restore a removed item. */
|
|
6
|
+
export declare function mergeDraftReferences(current: readonly DraftReference[], incoming: readonly DraftReference[]): readonly DraftReference[];
|
|
10
7
|
/** Build initial references without submitting them. Stable Topic-scoped IDs preserve menu focus during live snapshot refreshes. */
|
|
11
8
|
export declare function topicDraftReferences(topic: TopicSummary, documentTitle?: string): readonly DraftReference[];
|
|
12
9
|
/** Display a document filename while retaining the full title/path in its serialized content. Legacy ID-only references keep their generic label. */
|