@prettier-ai/dsh-client-ui-tool 0.1.2-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.
Files changed (36) hide show
  1. package/LICENSE +21 -0
  2. package/README.i18n.yaml +6 -0
  3. package/README.md +111 -0
  4. package/README.zh.md +111 -0
  5. package/lib/client.js +2111 -0
  6. package/lib/index.js +6 -0
  7. package/lib/invariant.js +23 -0
  8. package/lib/types/client/apply.d.ts +9 -0
  9. package/lib/types/client/contract/slots.d.ts +58 -0
  10. package/lib/types/client/index.d.ts +4 -0
  11. package/lib/types/client/locale.d.ts +3 -0
  12. package/lib/types/client/tool/ToolCallTree.d.ts +9 -0
  13. package/lib/types/client/tool/ToolDetails.d.ts +9 -0
  14. package/lib/types/client/tool/components/AskQuestionCard.d.ts +11 -0
  15. package/lib/types/client/tool/components/ToolRow.d.ts +55 -0
  16. package/lib/types/client/tool/models/ask-question-card-model.d.ts +22 -0
  17. package/lib/types/client/tool/models/diff-card-model.d.ts +37 -0
  18. package/lib/types/client/tool/models/primitive-labels.d.ts +36 -0
  19. package/lib/types/client/tool/models/raw-tool-call.d.ts +27 -0
  20. package/lib/types/client/tool/models/read-card-model.d.ts +31 -0
  21. package/lib/types/client/tool/models/search-card-model.d.ts +23 -0
  22. package/lib/types/client/tool/models/terminal-card-model.d.ts +81 -0
  23. package/lib/types/client/tool/models/tool-call-model.d.ts +75 -0
  24. package/lib/types/client/tool/models/web-card-model.d.ts +14 -0
  25. package/lib/types/client/tool/toolviews/GenericToolCard.d.ts +7 -0
  26. package/lib/types/client/tool/toolviews/ask-question-row.d.ts +14 -0
  27. package/lib/types/client/tool/toolviews/bash-sample.d.ts +14 -0
  28. package/lib/types/client/tool/toolviews/file-mutation-row.d.ts +16 -0
  29. package/lib/types/client/tool/toolviews/plan-summary.d.ts +48 -0
  30. package/lib/types/client/tool/toolviews/read-row.d.ts +16 -0
  31. package/lib/types/client/tool/toolviews/search-row.d.ts +14 -0
  32. package/lib/types/client/tool/toolviews/todo-row.d.ts +14 -0
  33. package/lib/types/client/tool/toolviews/web-row.d.ts +14 -0
  34. package/lib/types/index.d.ts +4 -0
  35. package/lib/types/invariant.d.ts +16 -0
  36. package/package.json +90 -0
@@ -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,16 @@
1
+ import type { Context } from '@prettier-ai/cordis';
2
+ import type { PropsLocale } from '@prettier-ai/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.
7
+ */
8
+ export declare function ReadRow({ toolName, block, cwd, home, openFile, inspect, t }: ReadRowProps): import("react").JSX.Element;
9
+ /** Registers the read tool's conversation row. */
10
+ export declare const readToolview: {
11
+ name: string;
12
+ inject: string[];
13
+ apply(ctx: Context): void;
14
+ };
15
+ export {};
16
+ //# sourceMappingURL=read-row.d.ts.map
@@ -0,0 +1,14 @@
1
+ import type { Context } from '@prettier-ai/cordis';
2
+ import type { PropsLocale } from '@prettier-ai/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 '@prettier-ai/cordis';
2
+ import type { PropsLocale } from '@prettier-ai/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 '@prettier-ai/cordis';
2
+ import type { PropsLocale } from '@prettier-ai/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
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Package-owned invariant companion for `@prettier-ai/dsh-client-ui-tool`.
3
+ * @module @prettier-ai/dsh-client-ui-tool/invariant
4
+ */
5
+ import type { Context } from '@prettier-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,90 @@
1
+ {
2
+ "name": "@prettier-ai/dsh-client-ui-tool",
3
+ "description": "Client Tool call-tree renderer and keyed per-tool presentation slot",
4
+ "version": "0.1.2-alpha.1",
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
+ "./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
+ "@prettier-ai/dsh-api-workspace-controller",
36
+ "@prettier-ai/dsh-client-connection",
37
+ "@prettier-ai/dsh-client-locale",
38
+ "@prettier-ai/dsh-client-ui-conversation"
39
+ ],
40
+ "platform": "web"
41
+ }
42
+ },
43
+ "license": "MIT",
44
+ "dependencies": {
45
+ "clsx": "^2.0.0"
46
+ },
47
+ "peerDependencies": {
48
+ "@prettier-ai/cordis": "^4.0.1",
49
+ "@prettier-ai/dsh-client-connection": "^0.1.2-alpha.1",
50
+ "@prettier-ai/dsh-client-ui-conversation": "^0.1.2-alpha.1",
51
+ "@prettier-ai/dsh-invariants": "^0.1.2-alpha.1",
52
+ "@prettier-ai/dsh-api-workspace-controller": "^0.1.2-alpha.1",
53
+ "@prettier-ai/dsh-client-locale": "^0.1.2-alpha.1",
54
+ "@prettier-ai/dsh-client-ui-chat": "^0.1.2-alpha.1",
55
+ "@prettier-ai/dsh-api-remotes": "^0.1.2-alpha.1",
56
+ "@prettier-ai/dsh-client-ui-renderer": "^0.1.2-alpha.1",
57
+ "@prettier-ai/dsh-client-ui-session": "^0.1.2-alpha.1",
58
+ "@prettier-ai/dsh-util-workspace-path": "^0.1.2-alpha.1"
59
+ },
60
+ "devDependencies": {
61
+ "@testing-library/react": "^16.1.0",
62
+ "@types/react": "~18.3.1",
63
+ "react": "^18.2.0",
64
+ "react-dom": "^18.2.0",
65
+ "@prettier-ai/cordis": "^4.0.1",
66
+ "@prettier-ai/dsh-api-remotes": "^0.1.2-alpha.1",
67
+ "@prettier-ai/dsh-client-connection": "^0.1.2-alpha.1",
68
+ "@prettier-ai/dsh-client-locale": "^0.1.2-alpha.1",
69
+ "@prettier-ai/dsh-client-test-runtime": "^0.1.2-alpha.1",
70
+ "@prettier-ai/dsh-client-ui-conversation": "^0.1.2-alpha.1",
71
+ "@prettier-ai/dsh-client-ui-primitives": "^0.1.2-alpha.1",
72
+ "@prettier-ai/dsh-client-ui-slots": "^0.1.2-alpha.1",
73
+ "@prettier-ai/dsh-invariants": "^0.1.2-alpha.1",
74
+ "@prettier-ai/dsh-api-workspace-controller": "^0.1.2-alpha.1",
75
+ "@prettier-ai/dsh-client-ui-renderer": "^0.1.2-alpha.1",
76
+ "@prettier-ai/dsh-client-ui-session": "^0.1.2-alpha.1",
77
+ "@prettier-ai/dsh-client-ui-chat": "^0.1.2-alpha.1",
78
+ "@prettier-ai/dsh-util-workspace-path": "^0.1.2-alpha.1"
79
+ },
80
+ "files": [
81
+ "lib/index.js",
82
+ "lib/invariant.js",
83
+ "lib/client.js",
84
+ "lib/types/**/*.d.ts"
85
+ ],
86
+ "scripts": {
87
+ "bundle": "tsdown",
88
+ "watch": "tsdown --watch"
89
+ }
90
+ }