@klarkxy/dsh-deep-view 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,98 @@
1
+ import { RpcResult as RpcResult$1 } from "@klarkxy/dsh-plugin-kit/contracts";
2
+ //#region src/contracts.d.ts
3
+ type RpcResult<T = unknown> = RpcResult$1<T>;
4
+ declare const PLUGIN_NAME = "@klarkxy/dsh-deep-view";
5
+ declare const RPC_CHANNEL = "/dsh-deep-view";
6
+ declare const VIEW_OWNER = "dsh-deep-view";
7
+ type Scalar = string | number | boolean;
8
+ type Formula = {
9
+ '=': string;
10
+ };
11
+ type Value = Scalar | Formula;
12
+ type ChoiceOption = {
13
+ label: string;
14
+ value?: Scalar;
15
+ };
16
+ type ViewNode = {
17
+ type: 'stack' | 'row' | 'text' | 'metric' | 'table' | 'chart' | 'progress' | 'callout' | 'sources' | 'slider' | 'number' | 'choice' | 'toggle' | 'options' | 'confirm' | 'form' | 'submit';
18
+ id?: string;
19
+ children?: ViewNode[];
20
+ let?: Record<string, string>;
21
+ text?: Value;
22
+ label?: string;
23
+ value?: Value;
24
+ tone?: Value;
25
+ caption?: Value;
26
+ columns?: {
27
+ key: string;
28
+ label: string;
29
+ }[];
30
+ rows?: Value[][];
31
+ kind?: 'bar' | 'hbar' | 'line' | 'area' | 'donut';
32
+ categories?: Scalar[];
33
+ series?: {
34
+ name?: string;
35
+ values: (number | Formula)[];
36
+ }[];
37
+ unit?: string;
38
+ percent?: Value;
39
+ max?: Value;
40
+ valueLabel?: Value;
41
+ items?: {
42
+ label: string;
43
+ url: string;
44
+ }[];
45
+ min?: number;
46
+ step?: number;
47
+ options?: ChoiceOption[] | {
48
+ label: string;
49
+ description?: string;
50
+ }[];
51
+ multi?: boolean;
52
+ confirmLabel?: string;
53
+ cancelLabel?: string;
54
+ fields?: {
55
+ id: string;
56
+ label: string;
57
+ placeholder?: string;
58
+ }[];
59
+ submitLabel?: string;
60
+ };
61
+ type ShownView = {
62
+ title: string;
63
+ view: ViewNode;
64
+ interactive: boolean;
65
+ };
66
+ type ViewFailure = {
67
+ error: string;
68
+ };
69
+ type PendingView = {
70
+ id: string;
71
+ sessionId: string;
72
+ callId?: string;
73
+ title: string;
74
+ view: ViewNode;
75
+ };
76
+ type ViewAnswer = {
77
+ id: string;
78
+ action: string;
79
+ values: Record<string, unknown>;
80
+ };
81
+ /** Stored on the same user message as its readable answer, outside model text. */
82
+ type ViewAnswerMetadata = {
83
+ owner: typeof VIEW_OWNER;
84
+ version: 1;
85
+ answer: ViewAnswer;
86
+ };
87
+ type ViewPresentation = {
88
+ owner: typeof VIEW_OWNER;
89
+ viewId?: string;
90
+ title: string;
91
+ view: ViewNode;
92
+ interactive: boolean;
93
+ awaitReply: boolean;
94
+ };
95
+ declare function isRecord(value: unknown): value is Record<string, unknown>;
96
+ //#endregion
97
+ export { ChoiceOption, Formula, PLUGIN_NAME, PendingView, RPC_CHANNEL, RpcResult, Scalar, ShownView, VIEW_OWNER, Value, ViewAnswer, ViewAnswerMetadata, ViewFailure, ViewNode, ViewPresentation, isRecord };
98
+ //# sourceMappingURL=contracts.d.ts.map
@@ -0,0 +1,11 @@
1
+ //#region src/contracts.ts
2
+ const PLUGIN_NAME = "@klarkxy/dsh-deep-view";
3
+ const RPC_CHANNEL = "/dsh-deep-view";
4
+ const VIEW_OWNER = "dsh-deep-view";
5
+ function isRecord(value) {
6
+ return value !== null && typeof value === "object" && !Array.isArray(value);
7
+ }
8
+ //#endregion
9
+ export { PLUGIN_NAME, RPC_CHANNEL, VIEW_OWNER, isRecord };
10
+
11
+ //# sourceMappingURL=contracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contracts.js","names":[],"sources":["../src/contracts.ts"],"sourcesContent":["import type { RpcResult as SharedRpcResult } from '@klarkxy/dsh-plugin-kit/contracts'\nexport type RpcResult<T = unknown> = SharedRpcResult<T>\nexport const PLUGIN_NAME = '@klarkxy/dsh-deep-view'\nexport const RPC_CHANNEL = '/dsh-deep-view'\nexport const VIEW_OWNER = 'dsh-deep-view'\n\nexport type Scalar = string | number | boolean\nexport type Formula = { '=': string }\nexport type Value = Scalar | Formula\nexport type ChoiceOption = { label: string; value?: Scalar }\nexport type ViewNode = {\n type: 'stack' | 'row' | 'text' | 'metric' | 'table' | 'chart' | 'progress' | 'callout' | 'sources'\n | 'slider' | 'number' | 'choice' | 'toggle' | 'options' | 'confirm' | 'form' | 'submit'\n id?: string\n children?: ViewNode[]\n let?: Record<string, string>\n text?: Value\n label?: string\n value?: Value\n tone?: Value\n caption?: Value\n columns?: { key: string; label: string }[]\n rows?: Value[][]\n kind?: 'bar' | 'hbar' | 'line' | 'area' | 'donut'\n categories?: Scalar[]\n series?: { name?: string; values: (number | Formula)[] }[]\n unit?: string\n percent?: Value\n max?: Value\n valueLabel?: Value\n items?: { label: string; url: string }[]\n min?: number\n step?: number\n options?: ChoiceOption[] | { label: string; description?: string }[]\n multi?: boolean\n confirmLabel?: string\n cancelLabel?: string\n fields?: { id: string; label: string; placeholder?: string }[]\n submitLabel?: string\n}\nexport type ShownView = { title: string; view: ViewNode; interactive: boolean }\nexport type ViewFailure = { error: string }\nexport type PendingView = { id: string; sessionId: string; callId?: string; title: string; view: ViewNode }\nexport type ViewAnswer = { id: string; action: string; values: Record<string, unknown> }\n/** Stored on the same user message as its readable answer, outside model text. */\nexport type ViewAnswerMetadata = { owner: typeof VIEW_OWNER; version: 1; answer: ViewAnswer }\nexport type ViewPresentation = {\n owner: typeof VIEW_OWNER\n viewId?: string\n title: string\n view: ViewNode\n interactive: boolean\n awaitReply: boolean\n}\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === 'object' && !Array.isArray(value)\n}\n"],"mappings":";AAEA,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,aAAa;AAkD1B,SAAgB,SAAS,OAAkD;CACzE,OAAO,UAAU,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AAC5E"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,73 @@
1
+ import { PendingView, RpcResult } from "./contracts.js";
2
+ import { ContextFormed, createUserMessage } from "@deepseek-ai/dsh-llm";
3
+ import { Context } from "@deepseek-ai/cordis";
4
+ import { IncomingMessage, ServerResponse } from "node:http";
5
+ //#region ../dsh-plugin-kit/src/contracts.d.ts
6
+ /** Public, browser-safe contracts. Host implementations stay in their owning packages. */
7
+ type ProducerSourceKind = `plugin:${string}`;
8
+ type ProducerMessageSource = {
9
+ kind: ProducerSourceKind;
10
+ plugin: string;
11
+ } & ContextFormed;
12
+ /**
13
+ * V4 sessions persist the producing extension in `kind`; the retired generic
14
+ * `plugin` wrapper is not admitted. Each feature plugin declares its own kind.
15
+ */
16
+ declare module '@deepseek-ai/dsh-llm' {
17
+ interface MessageSourceMap {
18
+ [kind: ProducerSourceKind]: ProducerMessageSource;
19
+ }
20
+ }
21
+ //#endregion
22
+ //#region ../dsh-plugin-kit/src/host-rpc.d.ts
23
+ interface HostRpcContext {
24
+ webServer: {
25
+ register(route: {
26
+ kind: 'prefix';
27
+ path: string;
28
+ handler(req: IncomingMessage, res: ServerResponse): void | Promise<void>;
29
+ }): () => void;
30
+ };
31
+ connection: {
32
+ requestRejection?: (request: IncomingMessage) => number | undefined;
33
+ };
34
+ }
35
+ //#endregion
36
+ //#region src/index.d.ts
37
+ declare const name = "deep-view";
38
+ declare const inject: readonly ["tools", "sessionController", "sessions", "agents", "connection", "webServer"];
39
+ type AgentLike = {
40
+ id: string;
41
+ session: unknown;
42
+ followup(message: ReturnType<typeof createUserMessage>): void;
43
+ };
44
+ type Host = Context & HostRpcContext & {
45
+ tools: {
46
+ get(name: string, scope?: object): unknown;
47
+ register(definition: Record<string, unknown>): () => void;
48
+ };
49
+ agents: {
50
+ get(id: string): AgentLike | undefined;
51
+ roots(): AgentLike[];
52
+ };
53
+ sessionController: {
54
+ resolveAgent(id: string): Promise<{
55
+ agent?: AgentLike;
56
+ error?: {
57
+ message?: string;
58
+ };
59
+ }>;
60
+ };
61
+ sessions: {
62
+ flush(session: unknown): Promise<boolean>;
63
+ };
64
+ logger?: {
65
+ warn(message: string, ...args: unknown[]): void;
66
+ };
67
+ };
68
+ declare function createShowViewTool(host: Host, pending: Map<string, PendingView>, makeId?: () => string): Record<string, unknown>;
69
+ declare function createRpc(host: Host, pending: Map<string, PendingView>): (endpoint: string, payload: unknown, signal: AbortSignal) => Promise<RpcResult>;
70
+ declare function apply(ctx: Context): Promise<void>;
71
+ //#endregion
72
+ export { apply, createRpc, createShowViewTool, inject, name };
73
+ //# sourceMappingURL=index.d.ts.map