@deepseek-ai/dsh-client-ui-tool 0.0.1-rc.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/LICENSE +28 -0
- package/README.i18n.yaml +6 -0
- package/README.md +49 -0
- package/README.zh.md +49 -0
- package/lib/client.js +1614 -0
- package/lib/index.js +6 -0
- package/lib/invariant.js +23 -0
- package/lib/types/client/apply.d.ts +10 -0
- package/lib/types/client/contract/slots.d.ts +35 -0
- package/lib/types/client/index.d.ts +4 -0
- package/lib/types/client/locale.d.ts +3 -0
- package/lib/types/client/tool/ToolCallTree.d.ts +9 -0
- package/lib/types/client/tool/ToolDetails.d.ts +16 -0
- package/lib/types/client/tool/components/ToolRow.d.ts +79 -0
- package/lib/types/client/tool/models/diff-card-model.d.ts +58 -0
- package/lib/types/client/tool/models/read-card-model.d.ts +60 -0
- package/lib/types/client/tool/models/search-card-model.d.ts +89 -0
- package/lib/types/client/tool/models/terminal-card-model.d.ts +71 -0
- package/lib/types/client/tool/models/tool-call-model.d.ts +65 -0
- package/lib/types/client/tool/models/web-card-model.d.ts +39 -0
- package/lib/types/client/tool/toolviews/GenericToolCard.d.ts +7 -0
- package/lib/types/client/tool/toolviews/ask-question-row.d.ts +23 -0
- package/lib/types/client/tool/toolviews/bash-sample.d.ts +26 -0
- package/lib/types/client/tool/toolviews/file-mutation-row.d.ts +31 -0
- package/lib/types/client/tool/toolviews/plan-summary.d.ts +48 -0
- package/lib/types/client/tool/toolviews/read-row.d.ts +26 -0
- package/lib/types/client/tool/toolviews/search-row.d.ts +31 -0
- package/lib/types/client/tool/toolviews/todo-row.d.ts +25 -0
- package/lib/types/client/tool/toolviews/web-row.d.ts +26 -0
- package/lib/types/index.d.ts +4 -0
- package/lib/types/invariant.d.ts +16 -0
- package/package.json +82 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots';
|
|
3
|
+
import type { ToolCallViewProps } from '../../contract/slots.ts';
|
|
4
|
+
/** Full row props: the toolview runtime share plus the standard locale seat. */
|
|
5
|
+
type FileMutationRowProps = ToolCallViewProps & PropsLocale<'conversation'>;
|
|
6
|
+
/**
|
|
7
|
+
* File-mutation row: icon + {Edit,Write} · {path} in the shared ToolRow chrome,
|
|
8
|
+
* with the applied diff as the row's collapsed-by-default card body. The
|
|
9
|
+
* summary is a path link (a file tool's interaction); the host's `openFile`
|
|
10
|
+
* resolves it against the session cwd, so this passes the tool's own path
|
|
11
|
+
* verbatim. An errored mutation has no diff card, so ToolRow surfaces the
|
|
12
|
+
* model-facing error text through its Output section and its first line in the
|
|
13
|
+
* collapsed summary instead.
|
|
14
|
+
*/
|
|
15
|
+
export declare function FileMutationRow({ toolName, block, cwd, openFile, inspect, t }: FileMutationRowProps): import("react").JSX.Element;
|
|
16
|
+
/**
|
|
17
|
+
* The file-mutation rows as a plain registrant plugin following the chat
|
|
18
|
+
* toolview declaration across independent activation and reload lifetimes.
|
|
19
|
+
*/
|
|
20
|
+
export declare const fileMutationToolview: {
|
|
21
|
+
name: string;
|
|
22
|
+
inject: string[];
|
|
23
|
+
/**
|
|
24
|
+
* Register the file-mutation row into the Tool-owned keyed view slot
|
|
25
|
+
* under both mutation tool names.
|
|
26
|
+
* @param ctx - registrant context (disposal rides ctx.effect inside slots.register).
|
|
27
|
+
*/
|
|
28
|
+
apply(ctx: Context): void;
|
|
29
|
+
};
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=file-mutation-row.d.ts.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure plan derivation for the todo_write row's one-line summary. Several items
|
|
3
|
+
* may be `in_progress` at once — parallel work runs concurrent tasks, so a
|
|
4
|
+
* summary built from one active item would silently drop the rest. The plan
|
|
5
|
+
* strip header derives its own counts inline and shares nothing with this, so
|
|
6
|
+
* this stays inside the toolviews domain rather than in `contract/` (the
|
|
7
|
+
* inter-domain face).
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* One list item as the row sees it: unvalidated model JSON parsed from a call's
|
|
12
|
+
* args, so any field may be missing or mistyped.
|
|
13
|
+
*/
|
|
14
|
+
export interface PlanItemLike {
|
|
15
|
+
content?: unknown;
|
|
16
|
+
status?: unknown;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Counts plus the two halves of the summary, deliberately NOT pre-joined: the
|
|
20
|
+
* row ellipsizes its summary text, and a count concatenated onto the end of the
|
|
21
|
+
* task name is the first thing a narrow row clips — exactly when it carries
|
|
22
|
+
* information. The row renders `activeExtra` in its own non-shrinking span
|
|
23
|
+
* beside the truncatable text.
|
|
24
|
+
*/
|
|
25
|
+
export interface PlanSummary {
|
|
26
|
+
done: number;
|
|
27
|
+
total: number;
|
|
28
|
+
/** First `in_progress` content, or null when that first item is unusable. */
|
|
29
|
+
activeContent: string | null;
|
|
30
|
+
/** Active items beyond the first; 0 whenever there is no `activeContent` to sit beside. */
|
|
31
|
+
activeExtra: number;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Derive the counts and the active summary from a whole-list snapshot. It names
|
|
35
|
+
* the first `in_progress` item and counts the remaining active ones, so a
|
|
36
|
+
* parallel plan reports how many tasks are running rather than naming one and
|
|
37
|
+
* hiding the others. `activeContent` is null when nothing is in progress, or
|
|
38
|
+
* when the first active item's content is missing, mistyped, or blank once
|
|
39
|
+
* trimmed — the tool's own rule for usable content, applied here because a
|
|
40
|
+
* rejected call keeps its args verbatim. The row then renders the counts alone
|
|
41
|
+
* rather than falling back to the generic tool summary: the counts are already
|
|
42
|
+
* known to be good, and the active-item clause is the only part an unusable
|
|
43
|
+
* name costs.
|
|
44
|
+
* @param todos - the whole list, in model order.
|
|
45
|
+
* @returns the done/total counts and the two summary halves.
|
|
46
|
+
*/
|
|
47
|
+
export declare function planSummary(todos: readonly PlanItemLike[]): PlanSummary;
|
|
48
|
+
//# sourceMappingURL=plan-summary.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots';
|
|
3
|
+
import type { ToolCallViewProps } from '../../contract/slots.ts';
|
|
4
|
+
/** Full row props: the toolview runtime share plus the standard locale seat. */
|
|
5
|
+
type ReadRowProps = ToolCallViewProps & PropsLocale<'conversation'>;
|
|
6
|
+
/**
|
|
7
|
+
* Read row: icon + Read · {path} in the shared ToolRow chrome, with the file's
|
|
8
|
+
* read card as the row's collapsed-by-default card body. The summary path is an
|
|
9
|
+
* openable host link when the row names a single file.
|
|
10
|
+
*/
|
|
11
|
+
export declare function ReadRow({ toolName, block, cwd, openFile, inspect, t }: ReadRowProps): import("react").JSX.Element;
|
|
12
|
+
/**
|
|
13
|
+
* The read row as a plain registrant plugin following the atomic Tool-view
|
|
14
|
+
* declaration across independent activation and reload lifetimes.
|
|
15
|
+
*/
|
|
16
|
+
export declare const readToolview: {
|
|
17
|
+
name: string;
|
|
18
|
+
inject: string[];
|
|
19
|
+
/**
|
|
20
|
+
* Register the read row into the Tool-owned keyed view slot.
|
|
21
|
+
* @param ctx - registrant context (disposal rides ctx.effect inside slots.register).
|
|
22
|
+
*/
|
|
23
|
+
apply(ctx: Context): void;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=read-row.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots';
|
|
3
|
+
import type { ToolCallViewProps } from '../../contract/slots.ts';
|
|
4
|
+
/** Full row props: the toolview runtime share plus the standard locale seat. */
|
|
5
|
+
type SearchRowProps = ToolCallViewProps & PropsLocale<'conversation'>;
|
|
6
|
+
/**
|
|
7
|
+
* Search row: icon + Search · {summary} in the shared ToolRow chrome, with the
|
|
8
|
+
* completed search's card as the row's collapsed-by-default card body (a capped
|
|
9
|
+
* search's recovery footer rides below it, inside ToolRow). Registered under
|
|
10
|
+
* both `grep` and `glob`; the derived model's `kind` decides the card shape. A
|
|
11
|
+
* settled call with no search card surfaces its model-facing text through
|
|
12
|
+
* ToolRow's Output section, since the keyed SearchRow owns this render slot.
|
|
13
|
+
*/
|
|
14
|
+
export declare function SearchRow({ toolName, block, inspect, t }: SearchRowProps): import("react").JSX.Element;
|
|
15
|
+
/**
|
|
16
|
+
* The search view follows the atomic Tool-view declaration across activation
|
|
17
|
+
* and reload. One component registers under both keys because `grep` and
|
|
18
|
+
* `glob` are the same visual object discriminated by the result view's `kind`.
|
|
19
|
+
*/
|
|
20
|
+
export declare const searchToolview: {
|
|
21
|
+
name: string;
|
|
22
|
+
inject: string[];
|
|
23
|
+
/**
|
|
24
|
+
* Register the search row into the Tool-owned keyed view slot under both
|
|
25
|
+
* the `grep` and `glob` tool names.
|
|
26
|
+
* @param ctx - registrant context (disposal rides ctx.effect inside slots.register).
|
|
27
|
+
*/
|
|
28
|
+
apply(ctx: Context): void;
|
|
29
|
+
};
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=search-row.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots';
|
|
3
|
+
import type { ToolCallViewProps } from '../../contract/slots.ts';
|
|
4
|
+
/** Todo row props: the toolview runtime share plus the standard locale seat. */
|
|
5
|
+
type TodoRowProps = ToolCallViewProps & PropsLocale<'conversation'>;
|
|
6
|
+
/** One-line plan update row (the whole row toggles the call's Input/Output
|
|
7
|
+
* sections, ToolRow's unified expand). Non-ok execution states keep the
|
|
8
|
+
* shared row's dot semantics — a cancelled call wrote no todo/write, so it
|
|
9
|
+
* must not read as a completed update. */
|
|
10
|
+
export declare function TodoRow({ toolName, block, inspect, t }: TodoRowProps): import("react").JSX.Element;
|
|
11
|
+
/**
|
|
12
|
+
* The todo row as a plain registrant plugin following the atomic Tool-view
|
|
13
|
+
* declaration across independent activation and reload lifetimes.
|
|
14
|
+
*/
|
|
15
|
+
export declare const todoToolview: {
|
|
16
|
+
name: string;
|
|
17
|
+
inject: string[];
|
|
18
|
+
/**
|
|
19
|
+
* Register the todo row into the Tool-owned keyed view slot.
|
|
20
|
+
* @param ctx - registrant context (disposal rides ctx.effect inside slots.register).
|
|
21
|
+
*/
|
|
22
|
+
apply(ctx: Context): void;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=todo-row.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots';
|
|
3
|
+
import type { ToolCallViewProps } from '../../contract/slots.ts';
|
|
4
|
+
/** Full row props: the toolview runtime share plus the standard locale seat. */
|
|
5
|
+
type WebRowProps = ToolCallViewProps & PropsLocale<'conversation'>;
|
|
6
|
+
/**
|
|
7
|
+
* Web row: icon + Search/Fetch · {summary} in the shared ToolRow chrome, with
|
|
8
|
+
* the completed retrieval's web card as the row's collapsed-by-default card
|
|
9
|
+
* body. The row discriminates on `toolName` only to pick its icon and title.
|
|
10
|
+
*/
|
|
11
|
+
export declare function WebRow({ toolName, block, inspect, t }: WebRowProps): import("react").JSX.Element;
|
|
12
|
+
/**
|
|
13
|
+
* The web rows follow the atomic Tool-view declaration across activation and
|
|
14
|
+
* reload. One WebRow component registers under both web tool names.
|
|
15
|
+
*/
|
|
16
|
+
export declare const webToolview: {
|
|
17
|
+
name: string;
|
|
18
|
+
inject: string[];
|
|
19
|
+
/**
|
|
20
|
+
* Register the web row under both web tool names' keyed toolview holes.
|
|
21
|
+
* @param ctx - registrant context (disposal rides ctx.effect inside slots.register).
|
|
22
|
+
*/
|
|
23
|
+
apply(ctx: Context): void;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=web-row.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package-owned invariant companion for `@deepseek-ai/dsh-client-ui-tool`.
|
|
3
|
+
* @module @deepseek-ai/dsh-client-ui-tool/invariant
|
|
4
|
+
*/
|
|
5
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
6
|
+
/** Cordis companion plugin name. */
|
|
7
|
+
export declare const name = "client-ui-tool-invariant";
|
|
8
|
+
/** Service required before the companion can reserve package ownership. */
|
|
9
|
+
export declare const inject: string[];
|
|
10
|
+
/**
|
|
11
|
+
* Register this package's invariant companion.
|
|
12
|
+
* @param ctx - Cordis context carrying the invariant service.
|
|
13
|
+
* @returns the installed registration's disposer after setup succeeds.
|
|
14
|
+
*/
|
|
15
|
+
export declare const apply: (ctx: Context) => Promise<() => void>;
|
|
16
|
+
//# sourceMappingURL=invariant.d.ts.map
|
package/package.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@deepseek-ai/dsh-client-ui-tool",
|
|
3
|
+
"description": "Client Tool call-tree renderer and keyed per-tool presentation slot",
|
|
4
|
+
"version": "0.0.1-rc.1",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "restricted"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
|
|
11
|
+
"directory": "packages/client/ui-tool"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "lib/index.js",
|
|
15
|
+
"types": "lib/types/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./lib/types/index.d.ts",
|
|
19
|
+
"default": "./lib/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./invariant": {
|
|
22
|
+
"types": "./lib/types/invariant.d.ts",
|
|
23
|
+
"default": "./lib/invariant.js"
|
|
24
|
+
},
|
|
25
|
+
"./client": {
|
|
26
|
+
"types": "./lib/types/client/index.d.ts",
|
|
27
|
+
"default": "./lib/client.js"
|
|
28
|
+
},
|
|
29
|
+
"./src/*": "./src/*",
|
|
30
|
+
"./package.json": "./package.json"
|
|
31
|
+
},
|
|
32
|
+
"dsh": {
|
|
33
|
+
"client": {
|
|
34
|
+
"inject": [
|
|
35
|
+
"@deepseek-ai/dsh-client-runtime",
|
|
36
|
+
"@deepseek-ai/dsh-client-locale",
|
|
37
|
+
"@deepseek-ai/dsh-client-ui-conversation"
|
|
38
|
+
],
|
|
39
|
+
"platform": "web"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"license": "BSD-3-Clause",
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"clsx": "^2.0.0"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"react": "^18.2.0",
|
|
48
|
+
"@deepseek-ai/dsh-client-locale": "^0.0.1-rc.1",
|
|
49
|
+
"@deepseek-ai/dsh-client-runtime": "^0.0.1-rc.1",
|
|
50
|
+
"@deepseek-ai/dsh-client-ui-conversation": "^0.0.1-rc.1",
|
|
51
|
+
"@deepseek-ai/dsh-client-ui-primitives": "^0.0.1-rc.1",
|
|
52
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.0.1-rc.1",
|
|
53
|
+
"@deepseek-ai/cordis": "^4.0.1-rc.1",
|
|
54
|
+
"@deepseek-ai/dsh-invariants": "^0.0.1-rc.1"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@testing-library/react": "^16.1.0",
|
|
58
|
+
"@types/react": "~18.3.1",
|
|
59
|
+
"react": "^18.2.0",
|
|
60
|
+
"react-dom": "^18.2.0",
|
|
61
|
+
"@deepseek-ai/dsh-client-connection": "^0.0.1-rc.1",
|
|
62
|
+
"@deepseek-ai/dsh-client-locale": "^0.0.1-rc.1",
|
|
63
|
+
"@deepseek-ai/dsh-client-runtime": "^0.0.1-rc.1",
|
|
64
|
+
"@deepseek-ai/dsh-client-test-runtime": "^0.0.1-rc.1",
|
|
65
|
+
"@deepseek-ai/dsh-client-ui-conversation": "^0.0.1-rc.1",
|
|
66
|
+
"@deepseek-ai/dsh-client-ui-primitives": "^0.0.1-rc.1",
|
|
67
|
+
"@deepseek-ai/dsh-client-web-react": "^0.0.1-rc.1",
|
|
68
|
+
"@deepseek-ai/dsh-invariants": "^0.0.1-rc.1",
|
|
69
|
+
"@deepseek-ai/cordis": "^4.0.1-rc.1",
|
|
70
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.0.1-rc.1"
|
|
71
|
+
},
|
|
72
|
+
"files": [
|
|
73
|
+
"lib/index.js",
|
|
74
|
+
"lib/invariant.js",
|
|
75
|
+
"lib/client.js",
|
|
76
|
+
"lib/types/**/*.d.ts"
|
|
77
|
+
],
|
|
78
|
+
"scripts": {
|
|
79
|
+
"bundle": "tsdown",
|
|
80
|
+
"watch": "tsdown --watch"
|
|
81
|
+
}
|
|
82
|
+
}
|