@x1a0f3n9/dsh-client-ui-tool 0.1.5-rc.3

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.
Files changed (36) hide show
  1. package/LICENSE +21 -0
  2. package/README.i18n.yaml +6 -0
  3. package/README.md +115 -0
  4. package/README.zh.md +115 -0
  5. package/lib/client.js +2394 -0
  6. package/lib/index.js +6 -0
  7. package/lib/types/client/apply.d.ts +10 -0
  8. package/lib/types/client/contract/slots.d.ts +100 -0
  9. package/lib/types/client/index.d.ts +4 -0
  10. package/lib/types/client/locale.d.ts +3 -0
  11. package/lib/types/client/tool/ToolCallTree.d.ts +9 -0
  12. package/lib/types/client/tool/components/AskQuestionCard.d.ts +11 -0
  13. package/lib/types/client/tool/components/ToolRow.d.ts +75 -0
  14. package/lib/types/client/tool/models/ask-question-card-model.d.ts +22 -0
  15. package/lib/types/client/tool/models/diff-card-model.d.ts +37 -0
  16. package/lib/types/client/tool/models/image-card-model.d.ts +45 -0
  17. package/lib/types/client/tool/models/primitive-labels.d.ts +36 -0
  18. package/lib/types/client/tool/models/raw-tool-call.d.ts +27 -0
  19. package/lib/types/client/tool/models/read-card-model.d.ts +43 -0
  20. package/lib/types/client/tool/models/search-card-model.d.ts +23 -0
  21. package/lib/types/client/tool/models/terminal-card-model.d.ts +87 -0
  22. package/lib/types/client/tool/models/tool-call-model.d.ts +75 -0
  23. package/lib/types/client/tool/models/web-card-model.d.ts +14 -0
  24. package/lib/types/client/tool/toolviews/GenericToolCard.d.ts +7 -0
  25. package/lib/types/client/tool/toolviews/ask-question-row.d.ts +14 -0
  26. package/lib/types/client/tool/toolviews/bash-sample.d.ts +14 -0
  27. package/lib/types/client/tool/toolviews/file-mutation-row.d.ts +16 -0
  28. package/lib/types/client/tool/toolviews/plan-summary.d.ts +48 -0
  29. package/lib/types/client/tool/toolviews/read-family-row.d.ts +26 -0
  30. package/lib/types/client/tool/toolviews/read-image-row.d.ts +24 -0
  31. package/lib/types/client/tool/toolviews/read-row.d.ts +17 -0
  32. package/lib/types/client/tool/toolviews/search-row.d.ts +14 -0
  33. package/lib/types/client/tool/toolviews/todo-row.d.ts +14 -0
  34. package/lib/types/client/tool/toolviews/web-row.d.ts +14 -0
  35. package/lib/types/index.d.ts +4 -0
  36. package/package.json +81 -0
@@ -0,0 +1,7 @@
1
+ import type { ToolCallOwnerProps, ToolTreeProps } from '../../contract/slots.ts';
2
+ /** Card props: the owner payload plus the render site's locale seat (plain prop). */
3
+ export interface GenericToolCardProps extends ToolCallOwnerProps {
4
+ t: ToolTreeProps['t'];
5
+ }
6
+ export declare function GenericToolCard({ toolName, block, cwd, home, openFile, inspect, t }: GenericToolCardProps): import("react").JSX.Element;
7
+ //# sourceMappingURL=GenericToolCard.d.ts.map
@@ -0,0 +1,14 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import type { PropsLocale } from '@x1a0f3n9/dsh-client-ui-slots';
3
+ import type { ToolCallViewProps } from '../../contract/slots.ts';
4
+ type AskQuestionRowProps = ToolCallViewProps & PropsLocale<'conversation'>;
5
+ /** Summarizes a pending, answered, cancelled, or interrupted question set. */
6
+ export declare function AskQuestionRow({ toolName, block, inspect, t }: AskQuestionRowProps): import("react").JSX.Element;
7
+ /** Registers the ask-user-question conversation row. */
8
+ export declare const askQuestionToolview: {
9
+ name: string;
10
+ inject: string[];
11
+ apply(ctx: Context): void;
12
+ };
13
+ export {};
14
+ //# sourceMappingURL=ask-question-row.d.ts.map
@@ -0,0 +1,14 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import type { PropsLocale } from '@x1a0f3n9/dsh-client-ui-slots';
3
+ import type { ToolCallViewProps } from '../../contract/slots.ts';
4
+ type BashRowProps = ToolCallViewProps & PropsLocale<'conversation'>;
5
+ /** Renders expandable Bash output with an accessible lifecycle label. */
6
+ export declare function BashRow({ toolName, block, sessionId, useSessions, inspect, t }: BashRowProps): import("react").JSX.Element;
7
+ /** Registers the standalone Bash conversation-row sample. */
8
+ export declare const bashToolviewSample: {
9
+ name: string;
10
+ inject: string[];
11
+ apply(ctx: Context): void;
12
+ };
13
+ export {};
14
+ //# sourceMappingURL=bash-sample.d.ts.map
@@ -0,0 +1,16 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import type { PropsLocale } from '@x1a0f3n9/dsh-client-ui-slots';
3
+ import type { ToolCallViewProps } from '../../contract/slots.ts';
4
+ type FileMutationRowProps = ToolCallViewProps & PropsLocale<'conversation'>;
5
+ /**
6
+ * Lets users expand an applied file diff and open the reported path.
7
+ */
8
+ export declare function FileMutationRow({ toolName, block, cwd, home, openFile, inspect, t }: FileMutationRowProps): import("react").JSX.Element;
9
+ /** Registers the edit and write conversation rows. */
10
+ export declare const fileMutationToolview: {
11
+ name: string;
12
+ inject: string[];
13
+ apply(ctx: Context): void;
14
+ };
15
+ export {};
16
+ //# 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 { ReactNode } from 'react';
2
+ import type { PropsRenderSlots } from '@x1a0f3n9/dsh-client-ui-slots';
3
+ import type { ToolCallViewProps } from '../../contract/slots.ts';
4
+ import { type ToolRowProps } from '../components/ToolRow.tsx';
5
+ /** Full row props of a read-family toolview: the runtime share plus its locale seat. */
6
+ export type ReadFamilyRowProps = ToolCallViewProps & {
7
+ t: ToolRowProps['t'];
8
+ };
9
+ /** read_image row props: the runtime share, the declared image child slot, and the locale seat. */
10
+ export type ReadImageRowProps = ReadFamilyRowProps & PropsRenderSlots<'tool.call.images'>;
11
+ /**
12
+ * The card material one read-family row contributes: exactly the ToolRow card
13
+ * props that row owns. `read` supplies `read` and the line its call named;
14
+ * `read_image` supplies `image` together with the slot dispatcher and loader
15
+ * that draw it.
16
+ */
17
+ export type ReadFamilyCard = Pick<ToolRowProps, 'read' | 'image' | 'renderSlot' | 'loadImage' | 'filePathLine'>;
18
+ /**
19
+ * Compose a read-family row: the shared chrome and model-derived fields, plus the
20
+ * caller's card material.
21
+ * @param props - the toolview runtime share and locale seat.
22
+ * @param card - the card props this row owns.
23
+ * @returns the assembled ToolRow.
24
+ */
25
+ export declare function readFamilyRow({ toolName, block, cwd, home, openFile, inspect, t }: ReadFamilyRowProps, card: ReadFamilyCard): ReactNode;
26
+ //# sourceMappingURL=read-family-row.d.ts.map
@@ -0,0 +1,24 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import { type ReadImageRowProps } from './read-family-row.tsx';
3
+ /**
4
+ * read_image row: the read-family chrome with the durably committed image as the
5
+ * row's collapsed-by-default card body, rendered through the `tool.call.images`
6
+ * slot this entry declares.
7
+ */
8
+ export declare function ReadImageRow(props: ReadImageRowProps): import("react").ReactNode;
9
+ /**
10
+ * The read_image row as a plain registrant plugin following the atomic Tool-view
11
+ * declaration across independent activation and reload lifetimes. Declaring
12
+ * `tool.call.images` as a child slot authorizes this entry's `renderSlot` to
13
+ * dispatch the gallery.
14
+ */
15
+ export declare const readImageToolview: {
16
+ name: string;
17
+ inject: string[];
18
+ /**
19
+ * Register the read_image 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
+ //# sourceMappingURL=read-image-row.d.ts.map
@@ -0,0 +1,17 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import type { PropsLocale } from '@x1a0f3n9/dsh-client-ui-slots';
3
+ import type { ToolCallViewProps } from '../../contract/slots.ts';
4
+ type ReadRowProps = ToolCallViewProps & PropsLocale<'conversation'>;
5
+ /**
6
+ * Lets users expand a completed read result and open its reported path at the
7
+ * line the call started from.
8
+ */
9
+ export declare function ReadRow(props: ReadRowProps): import("react").ReactNode;
10
+ /** Registers the read tool's conversation row. */
11
+ export declare const readToolview: {
12
+ name: string;
13
+ inject: string[];
14
+ apply(ctx: Context): void;
15
+ };
16
+ export {};
17
+ //# sourceMappingURL=read-row.d.ts.map
@@ -0,0 +1,14 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import type { PropsLocale } from '@x1a0f3n9/dsh-client-ui-slots';
3
+ import type { ToolCallViewProps } from '../../contract/slots.ts';
4
+ type SearchRowProps = ToolCallViewProps & PropsLocale<'conversation'>;
5
+ /** Lets users expand grep or glob results and recover capped searches. */
6
+ export declare function SearchRow({ toolName, block, inspect, t }: SearchRowProps): import("react").JSX.Element;
7
+ /** Registers the grep and glob conversation rows. */
8
+ export declare const searchToolview: {
9
+ name: string;
10
+ inject: string[];
11
+ apply(ctx: Context): void;
12
+ };
13
+ export {};
14
+ //# sourceMappingURL=search-row.d.ts.map
@@ -0,0 +1,14 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import type { PropsLocale } from '@x1a0f3n9/dsh-client-ui-slots';
3
+ import type { ToolCallViewProps } from '../../contract/slots.ts';
4
+ type TodoRowProps = ToolCallViewProps & PropsLocale<'conversation'>;
5
+ /** Summarizes a plan update without presenting a cancelled call as completed. */
6
+ export declare function TodoRow({ toolName, block, inspect, t }: TodoRowProps): import("react").JSX.Element;
7
+ /** Registers the todo conversation row. */
8
+ export declare const todoToolview: {
9
+ name: string;
10
+ inject: string[];
11
+ apply(ctx: Context): void;
12
+ };
13
+ export {};
14
+ //# sourceMappingURL=todo-row.d.ts.map
@@ -0,0 +1,14 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import type { PropsLocale } from '@x1a0f3n9/dsh-client-ui-slots';
3
+ import type { ToolCallViewProps } from '../../contract/slots.ts';
4
+ type WebRowProps = ToolCallViewProps & PropsLocale<'conversation'>;
5
+ /** Lets users expand a completed web search or fetch result. */
6
+ export declare function WebRow({ toolName, block, inspect, t }: WebRowProps): import("react").JSX.Element;
7
+ /** Registers the web search and fetch conversation rows. */
8
+ export declare const webToolview: {
9
+ name: string;
10
+ inject: string[];
11
+ apply(ctx: Context): void;
12
+ };
13
+ export {};
14
+ //# sourceMappingURL=web-row.d.ts.map
@@ -0,0 +1,4 @@
1
+ /** Host loader entry for the browser-only Tool UI plugin. */
2
+ /** Provides no host-side behavior. */
3
+ export declare function apply(): void;
4
+ //# sourceMappingURL=index.d.ts.map
package/package.json ADDED
@@ -0,0 +1,81 @@
1
+ {
2
+ "name": "@x1a0f3n9/dsh-client-ui-tool",
3
+ "description": "Client Tool call-tree renderer and keyed per-tool presentation slot",
4
+ "version": "0.1.5-rc.3",
5
+ "publishConfig": {
6
+ "access": "public"
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
+ "./client": {
22
+ "types": "./lib/types/client/index.d.ts",
23
+ "default": "./lib/client.js"
24
+ },
25
+ "./src/*": "./src/*",
26
+ "./package.json": "./package.json"
27
+ },
28
+ "dsh": {
29
+ "client": {
30
+ "inject": [
31
+ "@x1a0f3n9/dsh-api-workspace-controller",
32
+ "@x1a0f3n9/dsh-client-connection",
33
+ "@x1a0f3n9/dsh-client-locale",
34
+ "@x1a0f3n9/dsh-client-ui-conversation"
35
+ ],
36
+ "platform": "web"
37
+ }
38
+ },
39
+ "license": "MIT",
40
+ "peerDependencies": {
41
+ "@deepseek-ai/cordis": "^4.0.2"
42
+ },
43
+ "devDependencies": {
44
+ "@testing-library/react": "^16.1.0",
45
+ "@types/react": "~18.3.1",
46
+ "react": "^18.2.0",
47
+ "react-dom": "^18.2.0",
48
+ "clsx": "^2.0.0",
49
+ "@x1a0f3n9/dsh-spill-policy": "^0.1.5-rc.3",
50
+ "@x1a0f3n9/dsh-agent": "^0.1.5-rc.3",
51
+ "@x1a0f3n9/dsh-llm": "^0.1.5-rc.3",
52
+ "@x1a0f3n9/dsh-session": "^0.1.5-rc.3",
53
+ "@x1a0f3n9/dsh-system-prompt": "^0.1.5-rc.3",
54
+ "@x1a0f3n9/dsh-tools": "^0.1.5-rc.3",
55
+ "@x1a0f3n9/dsh-spill": "^0.1.5-rc.3",
56
+ "@x1a0f3n9/dsh-code-runtime-worker-thread": "^0.1.5-rc.3",
57
+ "@deepseek-ai/cordis": "^4.0.2",
58
+ "@x1a0f3n9/dsh-api-remotes": "^0.1.5-rc.3",
59
+ "@x1a0f3n9/dsh-client-connection": "^0.1.5-rc.3",
60
+ "@x1a0f3n9/dsh-client-locale": "^0.1.5-rc.3",
61
+ "@x1a0f3n9/dsh-client-test-runtime": "^0.1.5-rc.3",
62
+ "@x1a0f3n9/dsh-client-ui-conversation": "^0.1.5-rc.3",
63
+ "@x1a0f3n9/dsh-client-ui-primitives": "^0.1.5-rc.3",
64
+ "@x1a0f3n9/dsh-client-ui-slots": "^0.1.5-rc.3",
65
+ "@x1a0f3n9/dsh-api-workspace-controller": "^0.1.5-rc.3",
66
+ "@x1a0f3n9/dsh-client-ui-chat": "^0.1.5-rc.3",
67
+ "@x1a0f3n9/dsh-client-ui-renderer": "^0.1.5-rc.3",
68
+ "@x1a0f3n9/dsh-client-ui-session": "^0.1.5-rc.3",
69
+ "@x1a0f3n9/dsh-util-workspace-path": "^0.1.5-rc.3",
70
+ "@x1a0f3n9/dsh-attachment": "^0.1.5-rc.3"
71
+ },
72
+ "files": [
73
+ "lib/index.js",
74
+ "lib/client.js",
75
+ "lib/types/**/*.d.ts"
76
+ ],
77
+ "scripts": {
78
+ "bundle": "tsdown",
79
+ "watch": "tsdown --watch"
80
+ }
81
+ }