@agimon-ai/doompi-grep 0.0.1-alpha.4 → 0.0.1-alpha.41

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 CHANGED
@@ -16,7 +16,7 @@ packages use the same hashline protocol.
16
16
  ## Requirements
17
17
 
18
18
  - Node.js 22.19.0 or newer
19
- - Pi 0.84.2 and Pi TUI 0.84.2
19
+ - Pi 0.85.0 and Pi TUI 0.85.0
20
20
 
21
21
  ## Install
22
22
 
@@ -2,9 +2,9 @@ import { Context } from "@deepseek-ai/cordis";
2
2
  import { ExtensionAPI } from "@earendil-works/pi-coding-agent";
3
3
  //#region src/adapters/pi/extension.d.ts
4
4
  /** Install the hashline grep replacement after claiming its Pi tool name. */
5
- declare function installDoomPiGrepRuntime(cordis: Context, pi: ExtensionAPI): void;
5
+ export declare function installDoomPiGrepRuntime(cordis: Context, pi: ExtensionAPI): void;
6
6
  /** Connect the package's standard Pi entry to DoomPi's shared Cordis host. */
7
- declare function activateDoomPiGrepExtension(pi: ExtensionAPI): Promise<void>;
7
+ export declare function activateDoomPiGrepExtension(pi: ExtensionAPI): Promise<void>;
8
8
  //#endregion
9
- export { activateDoomPiGrepExtension, activateDoomPiGrepExtension as default, installDoomPiGrepRuntime };
9
+ export { activateDoomPiGrepExtension as default };
10
10
  //# sourceMappingURL=extension.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"extension.d.cts","names":[],"sources":["../../../src/adapters/pi/extension.ts"],"mappings":";;;;iBAYgB,yBAAyB,QAAQ,SAAS,IAAI;;iBAkBxC,4BAA4B,IAAI,eAAe"}
1
+ {"version":3,"file":"extension.d.cts","names":[],"sources":["../../../src/adapters/pi/extension.ts"],"mappings":";;;;wBAYgB,yBAAyB,QAAQ,SAAS,IAAI;;wBAkBxC,4BAA4B,IAAI,eAAe"}
@@ -2,9 +2,9 @@ import { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
2
  import { Context } from "@deepseek-ai/cordis";
3
3
  //#region src/adapters/pi/extension.d.ts
4
4
  /** Install the hashline grep replacement after claiming its Pi tool name. */
5
- declare function installDoomPiGrepRuntime(cordis: Context, pi: ExtensionAPI): void;
5
+ export declare function installDoomPiGrepRuntime(cordis: Context, pi: ExtensionAPI): void;
6
6
  /** Connect the package's standard Pi entry to DoomPi's shared Cordis host. */
7
- declare function activateDoomPiGrepExtension(pi: ExtensionAPI): Promise<void>;
7
+ export declare function activateDoomPiGrepExtension(pi: ExtensionAPI): Promise<void>;
8
8
  //#endregion
9
- export { activateDoomPiGrepExtension, activateDoomPiGrepExtension as default, installDoomPiGrepRuntime };
9
+ export { activateDoomPiGrepExtension as default };
10
10
  //# sourceMappingURL=extension.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"extension.d.mts","names":[],"sources":["../../../src/adapters/pi/extension.ts"],"mappings":";;;;iBAYgB,yBAAyB,QAAQ,SAAS,IAAI;;iBAkBxC,4BAA4B,IAAI,eAAe"}
1
+ {"version":3,"file":"extension.d.mts","names":[],"sources":["../../../src/adapters/pi/extension.ts"],"mappings":";;;;wBAYgB,yBAAyB,QAAQ,SAAS,IAAI;;wBAkBxC,4BAA4B,IAAI,eAAe"}
@@ -3,7 +3,6 @@ import { ExtensionAPI } from "@earendil-works/pi-coding-agent";
3
3
  //#region src/adapters/pi/grepTool.d.ts
4
4
  type WritableCheck = (path: string) => Promise<boolean>;
5
5
  /** Register only the snapshot-bound replacement for Pi's grep tool. */
6
- declare function registerHashlineGrepTool(pi: Pick<ExtensionAPI, 'registerTool'>, writable?: WritableCheck): void;
6
+ export declare function registerHashlineGrepTool(pi: Pick<ExtensionAPI, 'registerTool'>, writable?: WritableCheck): void;
7
7
  //#endregion
8
- export { registerHashlineGrepTool };
9
8
  //# sourceMappingURL=grepTool.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"grepTool.d.cts","names":[],"sources":["../../../src/adapters/pi/grepTool.ts"],"mappings":";;;KAwCK,iBAAiB,iBAAiB;;iBAGvB,yBACd,IAAI,KAAK,+BACT,WAAU"}
1
+ {"version":3,"file":"grepTool.d.cts","names":[],"sources":["../../../src/adapters/pi/grepTool.ts"],"mappings":";;;KAwCK,iBAAiB,iBAAiB;;wBAGvB,yBACd,IAAI,KAAK,+BACT,WAAU"}
@@ -3,7 +3,6 @@ import { ExtensionAPI, createGrepToolDefinition } from "@earendil-works/pi-codin
3
3
  //#region src/adapters/pi/grepTool.d.ts
4
4
  type WritableCheck = (path: string) => Promise<boolean>;
5
5
  /** Register only the snapshot-bound replacement for Pi's grep tool. */
6
- declare function registerHashlineGrepTool(pi: Pick<ExtensionAPI, 'registerTool'>, writable?: WritableCheck): void;
6
+ export declare function registerHashlineGrepTool(pi: Pick<ExtensionAPI, 'registerTool'>, writable?: WritableCheck): void;
7
7
  //#endregion
8
- export { registerHashlineGrepTool };
9
8
  //# sourceMappingURL=grepTool.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"grepTool.d.mts","names":[],"sources":["../../../src/adapters/pi/grepTool.ts"],"mappings":";;;KAwCK,iBAAiB,iBAAiB;;iBAGvB,yBACd,IAAI,KAAK,+BACT,WAAU"}
1
+ {"version":3,"file":"grepTool.d.mts","names":[],"sources":["../../../src/adapters/pi/grepTool.ts"],"mappings":";;;KAwCK,iBAAiB,iBAAiB;;wBAGvB,yBACd,IAAI,KAAK,+BACT,WAAU"}
@@ -1,6 +1,6 @@
1
1
  import { Static, Type } from "typebox";
2
2
  //#region src/schemas/grepTool.d.ts
3
- declare const GrepParamsSchema: Type.TObject<{
3
+ export declare const GrepParamsSchema: Type.TObject<{
4
4
  pattern: Type.TString;
5
5
  path: Type.TOptional<Type.TString>;
6
6
  glob: Type.TOptional<Type.TString>;
@@ -9,7 +9,6 @@ declare const GrepParamsSchema: Type.TObject<{
9
9
  context: Type.TOptional<Type.TInteger>;
10
10
  limit: Type.TOptional<Type.TInteger>;
11
11
  }>;
12
- type GrepParams = Static<typeof GrepParamsSchema>;
12
+ export type GrepParams = Static<typeof GrepParamsSchema>;
13
13
  //#endregion
14
- export { GrepParams, GrepParamsSchema };
15
14
  //# sourceMappingURL=grepTool.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"grepTool.d.cts","names":[],"sources":["../../src/schemas/grepTool.ts"],"mappings":";;cAEa,kBAAgB,KAAA;;;;;;;;;KAUjB,aAAa,cAAc"}
1
+ {"version":3,"file":"grepTool.d.cts","names":[],"sources":["../../src/schemas/grepTool.ts"],"mappings":";;qBAEa,kBAAgB,KAAA;;;;;;;;;YAUjB,aAAa,cAAc"}
@@ -1,6 +1,6 @@
1
1
  import { Static, Type } from "typebox";
2
2
  //#region src/schemas/grepTool.d.ts
3
- declare const GrepParamsSchema: Type.TObject<{
3
+ export declare const GrepParamsSchema: Type.TObject<{
4
4
  pattern: Type.TString;
5
5
  path: Type.TOptional<Type.TString>;
6
6
  glob: Type.TOptional<Type.TString>;
@@ -9,7 +9,6 @@ declare const GrepParamsSchema: Type.TObject<{
9
9
  context: Type.TOptional<Type.TInteger>;
10
10
  limit: Type.TOptional<Type.TInteger>;
11
11
  }>;
12
- type GrepParams = Static<typeof GrepParamsSchema>;
12
+ export type GrepParams = Static<typeof GrepParamsSchema>;
13
13
  //#endregion
14
- export { GrepParams, GrepParamsSchema };
15
14
  //# sourceMappingURL=grepTool.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"grepTool.d.mts","names":[],"sources":["../../src/schemas/grepTool.ts"],"mappings":";;cAEa,kBAAgB,KAAA;;;;;;;;;KAUjB,aAAa,cAAc"}
1
+ {"version":3,"file":"grepTool.d.mts","names":[],"sources":["../../src/schemas/grepTool.ts"],"mappings":";;qBAEa,kBAAgB,KAAA;;;;;;;;;YAUjB,aAAa,cAAc"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agimon-ai/doompi-grep",
3
- "version": "0.0.1-alpha.4",
3
+ "version": "0.0.1-alpha.41",
4
4
  "description": "Snapshot-bound hashline grep for Pi and DoomPi.",
5
5
  "keywords": [
6
6
  "ai",
@@ -14,10 +14,21 @@
14
14
  "pi-package"
15
15
  ],
16
16
  "homepage": "https://agimon.ai",
17
+ "bugs": {
18
+ "url": "https://github.com/AgiFlow/doompi/issues"
19
+ },
17
20
  "license": "MIT",
18
21
  "author": "Vuong Ngo",
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/AgiFlow/doompi.git",
25
+ "directory": "packages/default/doompi-grep"
26
+ },
19
27
  "files": [
20
- "dist"
28
+ "dist",
29
+ "src/web",
30
+ "src/exports/webClient.ts",
31
+ "!src/web/**/*.stories.tsx"
21
32
  ],
22
33
  "type": "module",
23
34
  "main": "./dist/index.cjs",
@@ -40,24 +51,32 @@
40
51
  "access": "public"
41
52
  },
42
53
  "dependencies": {
43
- "@deepseek-ai/cordis": "4.0.1",
44
- "typebox": "1.3.16",
45
- "@agimon-ai/doompi-extension-contracts": "0.0.1-alpha.32",
46
- "@agimon-ai/doompi-ui": "0.0.1-alpha.32",
47
- "@agimon-ai/doompi-hashline": "0.0.1-alpha.4"
54
+ "@deepseek-ai/cordis": "4.0.2",
55
+ "typebox": "1.3.25",
56
+ "@agimon-ai/doompi-extension-contracts": "0.0.1-alpha.68",
57
+ "@agimon-ai/doompi-hashline": "0.0.1-alpha.39",
58
+ "@agimon-ai/doompi-ui": "0.0.1-alpha.69",
59
+ "@agimon-ai/doompi-web-components": "0.0.1-alpha.28",
60
+ "@agimon-ai/doompi-web-contracts": "0.0.1-alpha.31"
48
61
  },
49
62
  "devDependencies": {
50
- "@earendil-works/pi-coding-agent": "0.84.2",
51
- "@earendil-works/pi-tui": "0.84.2",
52
- "@types/node": "26.2.0",
53
- "@vitest/coverage-v8": "4.1.11",
54
- "tsdown": "0.22.14",
63
+ "@earendil-works/pi-coding-agent": "0.85.1",
64
+ "@earendil-works/pi-tui": "0.85.1",
65
+ "@tanstack/react-store": "0.11.1",
66
+ "@tanstack/store": "0.11.1",
67
+ "@types/node": "26.4.1",
68
+ "@types/react": "19.2.18",
69
+ "@vitest/coverage-v8": "5.0.0",
70
+ "@vscode/ripgrep": "1.18.0",
71
+ "react": "19.2.8",
72
+ "react-dom": "19.2.8",
73
+ "tsdown": "0.23.0",
55
74
  "typescript": "7.0.2",
56
- "vitest": "4.1.11"
75
+ "vitest": "5.0.0"
57
76
  },
58
77
  "peerDependencies": {
59
- "@earendil-works/pi-coding-agent": "0.84.2",
60
- "@earendil-works/pi-tui": "0.84.2"
78
+ "@earendil-works/pi-coding-agent": "0.85.1",
79
+ "@earendil-works/pi-tui": "0.85.1"
61
80
  },
62
81
  "peerDependenciesMeta": {
63
82
  "@earendil-works/pi-coding-agent": {
@@ -70,6 +89,11 @@
70
89
  "engines": {
71
90
  "node": ">=22.19.0"
72
91
  },
92
+ "doompiWeb": {
93
+ "pluginId": "grep",
94
+ "channels": [],
95
+ "client": "./src/exports/webClient.ts"
96
+ },
73
97
  "pi": {
74
98
  "extensions": [
75
99
  "./dist/extensions/pi.mjs"
@@ -78,7 +102,7 @@
78
102
  "scripts": {
79
103
  "build": "tsdown",
80
104
  "test": "vitest --run",
81
- "typecheck": "tsc --noEmit",
105
+ "typecheck": "tsc --noEmit && tsc --noEmit -p src/web/tsconfig.json",
82
106
  "lint": "oxlint . && oxfmt . --check",
83
107
  "fixcode": "oxlint . --fix && oxfmt ."
84
108
  }
@@ -0,0 +1 @@
1
+ export { webPlugin } from '../web/index.ts';
@@ -0,0 +1,64 @@
1
+ import {
2
+ HashlineLines,
3
+ hashlineBody,
4
+ MessageItem,
5
+ MessageItemBody,
6
+ MessageItemHeader,
7
+ MessageItemStatus,
8
+ resultTextLines,
9
+ toolTone,
10
+ } from '@agimon-ai/doompi-web-components';
11
+ import type { ToolMessageRenderProps } from '@agimon-ai/doompi-web-contracts';
12
+ import { grepCallView } from '../lib/grepToolView.ts';
13
+
14
+ /**
15
+ * The grep tool's timeline item, the web half of its renderCall and
16
+ * renderResult: the call summary in the header and, when expanded, the
17
+ * anchored matches with a line-number gutter in the body. A failure shows the
18
+ * tool's message in red inside the expanded body instead.
19
+ */
20
+ export function GrepToolMessage({ args, result, output, running, isError }: ToolMessageRenderProps) {
21
+ const view = grepCallView(args);
22
+ const body = result === null || isError ? null : hashlineBody(result, output, 'grep', true);
23
+ return (
24
+ <MessageItem tone={toolTone({ running, isError })} expandable defaultExpanded={false}>
25
+ {({ expanded }) => {
26
+ return (
27
+ <>
28
+ <MessageItemHeader title="grep">
29
+ <span data-testid="tool-call-grep" className="flex min-w-0 flex-1 items-center gap-2">
30
+ <span className="truncate text-doom-text">{view.pattern}</span>
31
+ {view.details.length > 0 ? (
32
+ <span className="shrink-0 text-doom-faint">· {view.details.join(' · ')}</span>
33
+ ) : null}
34
+ </span>
35
+ </MessageItemHeader>
36
+ {expanded ? (
37
+ isError ? (
38
+ <MessageItemBody data-testid="tool-result-grep" className="flex flex-col">
39
+ <MessageItemStatus tone="error">failed</MessageItemStatus>
40
+ {resultTextLines(result, output).map((line, index) => (
41
+ <span key={`${String(index)}-${line}`} className="whitespace-pre-wrap break-words text-doom-red">
42
+ {line}
43
+ </span>
44
+ ))}
45
+ </MessageItemBody>
46
+ ) : body === null ? (
47
+ running ? (
48
+ <MessageItemBody data-testid="tool-result-grep">
49
+ <MessageItemStatus tone="running">running</MessageItemStatus>
50
+ </MessageItemBody>
51
+ ) : null
52
+ ) : body.shown.length === 0 && body.notice === undefined ? null : (
53
+ <MessageItemBody data-testid="tool-result-grep" className="flex flex-col gap-1">
54
+ <HashlineLines lines={body.shown} gutter={body.gutter} />
55
+ {body.notice !== undefined ? <span className="text-doom-faint">{body.notice}</span> : null}
56
+ </MessageItemBody>
57
+ )
58
+ ) : null}
59
+ </>
60
+ );
61
+ }}
62
+ </MessageItem>
63
+ );
64
+ }
@@ -0,0 +1,11 @@
1
+ import { defineWebPlugin } from '@agimon-ai/doompi-web-contracts';
2
+ import { GrepToolMessage } from './components/GrepToolMessage.tsx';
3
+
4
+ /**
5
+ * This package's cockpit presence: the grep tool's timeline card, the web
6
+ * half of the TUI's renderCall and renderResult for hashline searches.
7
+ */
8
+ export const webPlugin = defineWebPlugin({
9
+ id: 'grep',
10
+ toolRenderers: [{ tools: ['grep'], message: GrepToolMessage }],
11
+ });
@@ -0,0 +1,21 @@
1
+ import { compactDetails } from '@agimon-ai/doompi-web-components';
2
+
3
+ export interface GrepCallView {
4
+ readonly pattern: string;
5
+ /** Search path, glob, case flag, and limit, as the TUI's call heading lists them. */
6
+ readonly details: readonly string[];
7
+ }
8
+
9
+ /** What the grep call heading shows: the pattern, then where and how it searched. */
10
+ export function grepCallView(args: Readonly<Record<string, unknown>>): GrepCallView {
11
+ const limit = typeof args.limit === 'number' && Number.isFinite(args.limit) ? args.limit : undefined;
12
+ return {
13
+ pattern: typeof args.pattern === 'string' ? args.pattern : '',
14
+ details: compactDetails([
15
+ typeof args.path === 'string' && args.path.length > 0 ? args.path : '.',
16
+ typeof args.glob === 'string' ? args.glob : undefined,
17
+ args.ignoreCase === true ? 'ignore case' : undefined,
18
+ limit === undefined ? undefined : `${limit} matches`,
19
+ ]),
20
+ };
21
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "lib": ["ES2023", "DOM", "DOM.Iterable"],
5
+ "module": "ESNext",
6
+ "moduleResolution": "Bundler",
7
+ "jsx": "react-jsx",
8
+ "strict": true,
9
+ "noImplicitAny": true,
10
+ "noUnusedLocals": true,
11
+ "noUnusedParameters": true,
12
+ "noImplicitReturns": true,
13
+ "noFallthroughCasesInSwitch": true,
14
+ "noEmit": true,
15
+ "resolveJsonModule": true,
16
+ "esModuleInterop": true,
17
+ "skipLibCheck": true,
18
+ "allowImportingTsExtensions": true,
19
+ "forceConsistentCasingInFileNames": true,
20
+ "types": ["node"]
21
+ },
22
+ "include": [".", "../types", "../exports/webClient.ts"]
23
+ }