@agimon-ai/doompi-read 0.0.1-alpha.44 → 0.0.1-alpha.47

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 (77) hide show
  1. package/package.json +21 -14
  2. package/dist/api-contracts.cjs +0 -1
  3. package/dist/api-contracts.d.cts +0 -2
  4. package/dist/api-contracts.d.mts +0 -2
  5. package/dist/api-contracts.mjs +0 -1
  6. package/dist/constants/package.cjs +0 -2
  7. package/dist/constants/package.cjs.map +0 -1
  8. package/dist/constants/package.mjs +0 -2
  9. package/dist/constants/package.mjs.map +0 -1
  10. package/dist/extensions/pi.cjs +0 -2
  11. package/dist/extensions/pi.cjs.map +0 -1
  12. package/dist/extensions/pi.d.cts +0 -5
  13. package/dist/extensions/pi.d.cts.map +0 -1
  14. package/dist/extensions/pi.d.mts +0 -5
  15. package/dist/extensions/pi.d.mts.map +0 -1
  16. package/dist/extensions/pi.mjs +0 -2
  17. package/dist/extensions/pi.mjs.map +0 -1
  18. package/dist/extensions/server.cjs +0 -2
  19. package/dist/extensions/server.cjs.map +0 -1
  20. package/dist/extensions/server.d.cts +0 -5
  21. package/dist/extensions/server.d.cts.map +0 -1
  22. package/dist/extensions/server.d.mts +0 -5
  23. package/dist/extensions/server.d.mts.map +0 -1
  24. package/dist/extensions/server.mjs +0 -2
  25. package/dist/extensions/server.mjs.map +0 -1
  26. package/dist/index.cjs +0 -1
  27. package/dist/index.d.cts +0 -4
  28. package/dist/index.d.mts +0 -4
  29. package/dist/index.mjs +0 -1
  30. package/dist/schemas/apiContracts.cjs +0 -2
  31. package/dist/schemas/apiContracts.cjs.map +0 -1
  32. package/dist/schemas/apiContracts.d.cts +0 -53
  33. package/dist/schemas/apiContracts.d.cts.map +0 -1
  34. package/dist/schemas/apiContracts.d.mts +0 -53
  35. package/dist/schemas/apiContracts.d.mts.map +0 -1
  36. package/dist/schemas/apiContracts.mjs +0 -2
  37. package/dist/schemas/apiContracts.mjs.map +0 -1
  38. package/dist/schemas/readTool.cjs +0 -2
  39. package/dist/schemas/readTool.cjs.map +0 -1
  40. package/dist/schemas/readTool.d.cts +0 -10
  41. package/dist/schemas/readTool.d.cts.map +0 -1
  42. package/dist/schemas/readTool.d.mts +0 -10
  43. package/dist/schemas/readTool.d.mts.map +0 -1
  44. package/dist/schemas/readTool.mjs +0 -2
  45. package/dist/schemas/readTool.mjs.map +0 -1
  46. package/dist/services/piReadImage/index.cjs +0 -2
  47. package/dist/services/piReadImage/index.cjs.map +0 -1
  48. package/dist/services/piReadImage/index.mjs +0 -2
  49. package/dist/services/piReadImage/index.mjs.map +0 -1
  50. package/dist/services/readImage/index.cjs +0 -2
  51. package/dist/services/readImage/index.cjs.map +0 -1
  52. package/dist/services/readImage/index.d.cts +0 -14
  53. package/dist/services/readImage/index.d.cts.map +0 -1
  54. package/dist/services/readImage/index.d.mts +0 -14
  55. package/dist/services/readImage/index.d.mts.map +0 -1
  56. package/dist/services/readImage/index.mjs +0 -2
  57. package/dist/services/readImage/index.mjs.map +0 -1
  58. package/dist/services/readTool/index.cjs +0 -3
  59. package/dist/services/readTool/index.cjs.map +0 -1
  60. package/dist/services/readTool/index.d.cts +0 -13
  61. package/dist/services/readTool/index.d.cts.map +0 -1
  62. package/dist/services/readTool/index.d.mts +0 -13
  63. package/dist/services/readTool/index.d.mts.map +0 -1
  64. package/dist/services/readTool/index.mjs +0 -3
  65. package/dist/services/readTool/index.mjs.map +0 -1
  66. package/dist/tools/piRead.cjs +0 -2
  67. package/dist/tools/piRead.cjs.map +0 -1
  68. package/dist/tools/piRead.d.cts +0 -9
  69. package/dist/tools/piRead.d.cts.map +0 -1
  70. package/dist/tools/piRead.d.mts +0 -9
  71. package/dist/tools/piRead.d.mts.map +0 -1
  72. package/dist/tools/piRead.mjs +0 -2
  73. package/dist/tools/piRead.mjs.map +0 -1
  74. package/src/extensions/web.ts +0 -14
  75. package/src/web/components/ReadToolMessage.tsx +0 -116
  76. package/src/web/lib/readToolView.ts +0 -24
  77. package/src/web/tsconfig.json +0 -23
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agimon-ai/doompi-read",
3
- "version": "0.0.1-alpha.44",
3
+ "version": "0.0.1-alpha.47",
4
4
  "description": "Snapshot-bound hashline read tool for Pi and DoomPi.",
5
5
  "keywords": [
6
6
  "ai",
@@ -25,14 +25,12 @@
25
25
  "directory": "packages/default/doompi-read"
26
26
  },
27
27
  "files": [
28
- "dist",
29
- "src/web",
30
- "src/extensions/web.ts",
31
- "!src/web/**/*.stories.tsx"
28
+ "dist"
32
29
  ],
33
30
  "type": "module",
34
31
  "main": "./dist/index.cjs",
35
- "types": "./dist/index.d.mts",
32
+ "module": "./dist/index.mjs",
33
+ "types": "./dist/index.d.cts",
36
34
  "jsnext:main": "./dist/index.mjs",
37
35
  "exports": {
38
36
  ".": {
@@ -40,6 +38,11 @@
40
38
  "import": "./dist/index.mjs",
41
39
  "require": "./dist/index.cjs"
42
40
  },
41
+ "./api-contracts": {
42
+ "types": "./dist/api-contracts.d.mts",
43
+ "import": "./dist/api-contracts.mjs",
44
+ "require": "./dist/api-contracts.cjs"
45
+ },
43
46
  "./extensions/pi": {
44
47
  "types": "./dist/extensions/pi.d.mts",
45
48
  "import": "./dist/extensions/pi.mjs",
@@ -50,21 +53,25 @@
50
53
  "import": "./dist/extensions/server.mjs",
51
54
  "require": "./dist/extensions/server.cjs"
52
55
  },
56
+ "./extensions/web": {
57
+ "import": "./dist/extensions/web.mjs"
58
+ },
53
59
  "./package.json": "./package.json"
54
60
  },
55
61
  "publishConfig": {
56
62
  "access": "public"
57
63
  },
58
64
  "dependencies": {
59
- "@agimon-ai/doompi-config": "0.0.1-alpha.71",
60
- "@agimon-ai/doompi-core": "0.0.1-alpha.72",
61
- "@agimon-ai/doompi-hashline": "0.0.1-alpha.41",
62
- "@agimon-ai/doompi-ui": "0.0.1-alpha.72",
63
- "@agimon-ai/doompi-web-components": "0.0.1-alpha.30",
65
+ "@agimon-ai/doompi-config": "0.0.1-alpha.74",
66
+ "@agimon-ai/doompi-core": "0.0.1-alpha.75",
67
+ "@agimon-ai/doompi-hashline": "0.0.1-alpha.44",
68
+ "@agimon-ai/doompi-ui": "0.0.1-alpha.75",
69
+ "@agimon-ai/doompi-web-components": "0.0.1-alpha.33",
64
70
  "@deepseek-ai/cordis": "4.0.2",
65
71
  "typebox": "1.3.30"
66
72
  },
67
73
  "devDependencies": {
74
+ "@agimon-ai/doompi-build": "0.0.1-alpha.4",
68
75
  "@earendil-works/pi-coding-agent": "0.85.1",
69
76
  "@earendil-works/pi-tui": "0.85.1",
70
77
  "@tanstack/react-store": "0.11.1",
@@ -94,7 +101,7 @@
94
101
  "node": ">=22.19.0"
95
102
  },
96
103
  "doompiServer": {
97
- "entry": "./src/extensions/server.ts",
104
+ "entry": "./generated/server.ts",
98
105
  "dist": "./dist/extensions/server.mjs",
99
106
  "scopes": [
100
107
  "session"
@@ -107,7 +114,7 @@
107
114
  "doompiWeb": {
108
115
  "pluginId": "read",
109
116
  "channels": [],
110
- "client": "./src/extensions/web.ts",
117
+ "client": "./dist/extensions/web.mjs",
111
118
  "scopes": [
112
119
  "session"
113
120
  ]
@@ -120,7 +127,7 @@
120
127
  "scripts": {
121
128
  "build": "tsdown",
122
129
  "test": "vitest --run",
123
- "typecheck": "tsc --noEmit && tsc --noEmit -p src/web/tsconfig.json",
130
+ "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.web.json",
124
131
  "lint": "oxlint . && oxfmt . --check",
125
132
  "fixcode": "oxlint . --fix && oxfmt ."
126
133
  }
@@ -1 +0,0 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./schemas/apiContracts.cjs");exports.apiContracts=e.apiContracts,exports.default=e.apiContracts;
@@ -1,2 +0,0 @@
1
- import { apiContracts } from "./schemas/apiContracts.cjs";
2
- export { apiContracts, apiContracts as default };
@@ -1,2 +0,0 @@
1
- import { apiContracts } from "./schemas/apiContracts.mjs";
2
- export { apiContracts, apiContracts as default };
@@ -1 +0,0 @@
1
- import{apiContracts as e}from"./schemas/apiContracts.mjs";export{e as apiContracts,e as default};
@@ -1,2 +0,0 @@
1
- exports.PACKAGE_SOURCE=`@agimon-ai/doompi-read`;
2
- //# sourceMappingURL=package.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"package.cjs","names":[],"sources":["../../src/constants/package.ts"],"sourcesContent":["export const PACKAGE_SOURCE = '@agimon-ai/doompi-read';\n"],"mappings":""}
@@ -1,2 +0,0 @@
1
- const e=`@agimon-ai/doompi-read`;export{e as PACKAGE_SOURCE};
2
- //# sourceMappingURL=package.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"package.mjs","names":[],"sources":["../../src/constants/package.ts"],"sourcesContent":["export const PACKAGE_SOURCE = '@agimon-ai/doompi-read';\n"],"mappings":"AAAA,MAAa,EAAiB"}
@@ -1,2 +0,0 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../tools/piRead.cjs"),t=require("../constants/package.cjs");let n=require("@agimon-ai/doompi-core/pi-extension");const r=(0,n.definePiExtension)(t.PACKAGE_SOURCE,()=>({toolOverrides:[{source:t.PACKAGE_SOURCE,tools:[`read`],replacements:[(0,n.definePiTool)(e.createHashlineReadTool())]}]}));exports.activateDoomPiReadExtension=r,exports.default=r;
2
- //# sourceMappingURL=pi.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pi.cjs","names":["definePiExtension","PACKAGE_SOURCE","definePiTool","createHashlineReadTool"],"sources":["../../src/extensions/pi.ts"],"sourcesContent":["import { definePiExtension, definePiTool } from '@agimon-ai/doompi-core/pi-extension';\n\nimport { PACKAGE_SOURCE } from '../constants/package';\nimport { createHashlineReadTool } from '../tools/piRead';\n\nexport const activateDoomPiReadExtension = definePiExtension(PACKAGE_SOURCE, () => ({\n toolOverrides: [{ source: PACKAGE_SOURCE, tools: ['read'], replacements: [definePiTool(createHashlineReadTool())] }],\n}));\nexport default activateDoomPiReadExtension;\n"],"mappings":"iOAKA,MAAa,GAAA,EAA8BA,EAAAA,kBAAAA,CAAkBC,EAAAA,oBAAuB,CAClF,cAAe,CAAC,CAAE,OAAQA,EAAAA,eAAgB,MAAO,CAAC,MAAM,EAAG,aAAc,EAAA,EAACC,EAAAA,aAAAA,CAAaC,EAAAA,uBAAuB,CAAC,CAAC,CAAE,CAAC,CACrH,EAAE"}
@@ -1,5 +0,0 @@
1
- //#region src/extensions/pi.d.ts
2
- export declare const activateDoomPiReadExtension: import("@agimon-ai/doompi-core/runtime-pi-extension").DefinedPiExtension<undefined>;
3
- //#endregion
4
- export { activateDoomPiReadExtension as default };
5
- //# sourceMappingURL=pi.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pi.d.cts","names":[],"sources":["../../src/extensions/pi.ts"],"mappings":";qBAKa,mFAA2B"}
@@ -1,5 +0,0 @@
1
- //#region src/extensions/pi.d.ts
2
- export declare const activateDoomPiReadExtension: import("@agimon-ai/doompi-core/runtime-pi-extension").DefinedPiExtension<undefined>;
3
- //#endregion
4
- export { activateDoomPiReadExtension as default };
5
- //# sourceMappingURL=pi.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pi.d.mts","names":[],"sources":["../../src/extensions/pi.ts"],"mappings":";qBAKa,mFAA2B"}
@@ -1,2 +0,0 @@
1
- import{createHashlineReadTool as e}from"../tools/piRead.mjs";import{PACKAGE_SOURCE as t}from"../constants/package.mjs";import{definePiExtension as n,definePiTool as r}from"@agimon-ai/doompi-core/pi-extension";const i=n(t,()=>({toolOverrides:[{source:t,tools:[`read`],replacements:[r(e())]}]}));export{i as activateDoomPiReadExtension,i as default};
2
- //# sourceMappingURL=pi.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pi.mjs","names":[],"sources":["../../src/extensions/pi.ts"],"sourcesContent":["import { definePiExtension, definePiTool } from '@agimon-ai/doompi-core/pi-extension';\n\nimport { PACKAGE_SOURCE } from '../constants/package';\nimport { createHashlineReadTool } from '../tools/piRead';\n\nexport const activateDoomPiReadExtension = definePiExtension(PACKAGE_SOURCE, () => ({\n toolOverrides: [{ source: PACKAGE_SOURCE, tools: ['read'], replacements: [definePiTool(createHashlineReadTool())] }],\n}));\nexport default activateDoomPiReadExtension;\n"],"mappings":"iNAKA,MAAa,EAA8B,EAAkB,OAAuB,CAClF,cAAe,CAAC,CAAE,OAAQ,EAAgB,MAAO,CAAC,MAAM,EAAG,aAAc,CAAC,EAAa,EAAuB,CAAC,CAAC,CAAE,CAAC,CACrH,EAAE"}
@@ -1,2 +0,0 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../services/readTool/index.cjs"),t=require("../constants/package.cjs"),n=(0,require("@agimon-ai/doompi-core/server-facet").defineServerPlugin)({name:t.PACKAGE_SOURCE,session:()=>({tools:[e.createHeadlessReadTool()]})});exports.default=n,exports.readServerFacet=n;
2
- //# sourceMappingURL=server.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"server.cjs","names":["defineServerPlugin","PACKAGE_SOURCE","createHeadlessReadTool"],"sources":["../../src/extensions/server.ts"],"sourcesContent":["import { defineServerPlugin } from '@agimon-ai/doompi-core/server-facet';\n\nimport { PACKAGE_SOURCE } from '../constants/package';\nimport { createHeadlessReadTool } from '../services/readTool';\n\nexport const readServerFacet = defineServerPlugin({\n name: PACKAGE_SOURCE,\n session: () => ({ tools: [createHeadlessReadTool()] }),\n});\nexport default readServerFacet;\n"],"mappings":"uLAKa,GAAA,+CAAkBA,CAAAA,CAAAA,mBAAAA,CAAmB,CAChD,KAAMC,EAAAA,eACN,aAAgB,CAAE,MAAO,CAACC,EAAAA,uBAAuB,CAAC,CAAE,EACtD,CAAC"}
@@ -1,5 +0,0 @@
1
- //#region src/extensions/server.d.ts
2
- export declare const readServerFacet: import("@agimon-ai/doompi-core/server-facet").DoomServerFacet;
3
- //#endregion
4
- export { readServerFacet as default };
5
- //# sourceMappingURL=server.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"server.d.cts","names":[],"sources":["../../src/extensions/server.ts"],"mappings":";qBAKa,+DAAe"}
@@ -1,5 +0,0 @@
1
- //#region src/extensions/server.d.ts
2
- export declare const readServerFacet: import("@agimon-ai/doompi-core/server-facet").DoomServerFacet;
3
- //#endregion
4
- export { readServerFacet as default };
5
- //# sourceMappingURL=server.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"server.d.mts","names":[],"sources":["../../src/extensions/server.ts"],"mappings":";qBAKa,+DAAe"}
@@ -1,2 +0,0 @@
1
- import{createHeadlessReadTool as e}from"../services/readTool/index.mjs";import{PACKAGE_SOURCE as t}from"../constants/package.mjs";import{defineServerPlugin as n}from"@agimon-ai/doompi-core/server-facet";const r=n({name:t,session:()=>({tools:[e()]})});export{r as default,r as readServerFacet};
2
- //# sourceMappingURL=server.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"server.mjs","names":[],"sources":["../../src/extensions/server.ts"],"sourcesContent":["import { defineServerPlugin } from '@agimon-ai/doompi-core/server-facet';\n\nimport { PACKAGE_SOURCE } from '../constants/package';\nimport { createHeadlessReadTool } from '../services/readTool';\n\nexport const readServerFacet = defineServerPlugin({\n name: PACKAGE_SOURCE,\n session: () => ({ tools: [createHeadlessReadTool()] }),\n});\nexport default readServerFacet;\n"],"mappings":"2MAKA,MAAa,EAAkB,EAAmB,CAChD,KAAM,EACN,aAAgB,CAAE,MAAO,CAAC,EAAuB,CAAC,CAAE,EACtD,CAAC"}
package/dist/index.cjs DELETED
@@ -1 +0,0 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./schemas/readTool.cjs"),t=require("./services/readTool/index.cjs"),n=require("./tools/piRead.cjs");exports.ReadParamsSchema=e.ReadParamsSchema,exports.createHashlineReadTool=n.createHashlineReadTool,exports.createHeadlessReadTool=t.createHeadlessReadTool,exports.executeHeadlessRead=t.executeHeadlessRead;
package/dist/index.d.cts DELETED
@@ -1,4 +0,0 @@
1
- import { ReadParams, ReadParamsSchema } from "./schemas/readTool.cjs";
2
- import { createHeadlessReadTool, executeHeadlessRead } from "./services/readTool/index.cjs";
3
- import { createHashlineReadTool } from "./tools/piRead.cjs";
4
- export { type ReadParams, ReadParamsSchema, createHashlineReadTool, createHeadlessReadTool, executeHeadlessRead };
package/dist/index.d.mts DELETED
@@ -1,4 +0,0 @@
1
- import { ReadParams, ReadParamsSchema } from "./schemas/readTool.mjs";
2
- import { createHeadlessReadTool, executeHeadlessRead } from "./services/readTool/index.mjs";
3
- import { createHashlineReadTool } from "./tools/piRead.mjs";
4
- export { type ReadParams, ReadParamsSchema, createHashlineReadTool, createHeadlessReadTool, executeHeadlessRead };
package/dist/index.mjs DELETED
@@ -1 +0,0 @@
1
- import{ReadParamsSchema as e}from"./schemas/readTool.mjs";import{createHeadlessReadTool as t,executeHeadlessRead as n}from"./services/readTool/index.mjs";import{createHashlineReadTool as r}from"./tools/piRead.mjs";export{e as ReadParamsSchema,r as createHashlineReadTool,t as createHeadlessReadTool,n as executeHeadlessRead};
@@ -1,2 +0,0 @@
1
- const e=(0,require("@agimon-ai/doompi-core/api-contracts").defineApiContract)({version:1,http:[],sockets:[],dynamic:[]});exports.apiContracts=e,exports.default=e;
2
- //# sourceMappingURL=apiContracts.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"apiContracts.cjs","names":["defineApiContract"],"sources":["../../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract } from '@agimon-ai/doompi-core/api-contracts';\n\n/** This facet contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */\nexport const apiContracts = defineApiContract({ version: 1, http: [], sockets: [], dynamic: [] });\nexport default apiContracts;\n"],"mappings":"AAGA,MAAa,GAAA,gDAAeA,CAAAA,CAAAA,kBAAAA,CAAkB,CAAE,QAAS,EAAG,KAAM,CAAC,EAAG,QAAS,CAAC,EAAG,QAAS,CAAC,CAAE,CAAC"}
@@ -1,53 +0,0 @@
1
- //#region src/schemas/apiContracts.d.ts
2
- /** This facet contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */
3
- export declare const apiContracts: {
4
- version: 1;
5
- protocols?: Record<string, string> | undefined;
6
- schemas?: Record<string, boolean | object> | undefined;
7
- http: {
8
- id: string;
9
- scope: "global" | "session" | "workspace";
10
- basePath?: string | undefined;
11
- path: string;
12
- method: "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT";
13
- description: string;
14
- availability?: string | undefined;
15
- authentication: "device" | "none" | "owner";
16
- parameters?: {
17
- name: string;
18
- in: "header" | "path" | "query";
19
- required: boolean;
20
- schema: boolean | object;
21
- }[] | undefined;
22
- body?: {
23
- contentType: string;
24
- contentTypes?: string[] | undefined;
25
- required: boolean;
26
- schema: boolean | object;
27
- } | undefined;
28
- responses: Record<string, {
29
- description: string;
30
- contentType?: string | undefined;
31
- schema?: boolean | object | undefined;
32
- events?: Record<string, boolean | object> | undefined;
33
- }>;
34
- }[];
35
- sockets: {
36
- id: string;
37
- scope: "global" | "session" | "workspace";
38
- description: string;
39
- availability?: string | undefined;
40
- service: string;
41
- member: string;
42
- direction: "client-to-server" | "server-to-client";
43
- kind: "channel" | "method" | "state";
44
- input: boolean | object;
45
- output?: boolean | object | undefined;
46
- errors?: boolean | object | undefined;
47
- }[];
48
- dynamic: string[];
49
- gaps?: string[] | undefined;
50
- };
51
- //#endregion
52
- export { apiContracts as default };
53
- //# sourceMappingURL=apiContracts.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"apiContracts.d.cts","names":[],"sources":["../../src/schemas/apiContracts.ts"],"mappings":";;qBAGa"}
@@ -1,53 +0,0 @@
1
- //#region src/schemas/apiContracts.d.ts
2
- /** This facet contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */
3
- export declare const apiContracts: {
4
- version: 1;
5
- protocols?: Record<string, string> | undefined;
6
- schemas?: Record<string, boolean | object> | undefined;
7
- http: {
8
- id: string;
9
- scope: "global" | "session" | "workspace";
10
- basePath?: string | undefined;
11
- path: string;
12
- method: "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT";
13
- description: string;
14
- availability?: string | undefined;
15
- authentication: "device" | "none" | "owner";
16
- parameters?: {
17
- name: string;
18
- in: "header" | "path" | "query";
19
- required: boolean;
20
- schema: boolean | object;
21
- }[] | undefined;
22
- body?: {
23
- contentType: string;
24
- contentTypes?: string[] | undefined;
25
- required: boolean;
26
- schema: boolean | object;
27
- } | undefined;
28
- responses: Record<string, {
29
- description: string;
30
- contentType?: string | undefined;
31
- schema?: boolean | object | undefined;
32
- events?: Record<string, boolean | object> | undefined;
33
- }>;
34
- }[];
35
- sockets: {
36
- id: string;
37
- scope: "global" | "session" | "workspace";
38
- description: string;
39
- availability?: string | undefined;
40
- service: string;
41
- member: string;
42
- direction: "client-to-server" | "server-to-client";
43
- kind: "channel" | "method" | "state";
44
- input: boolean | object;
45
- output?: boolean | object | undefined;
46
- errors?: boolean | object | undefined;
47
- }[];
48
- dynamic: string[];
49
- gaps?: string[] | undefined;
50
- };
51
- //#endregion
52
- export { apiContracts as default };
53
- //# sourceMappingURL=apiContracts.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"apiContracts.d.mts","names":[],"sources":["../../src/schemas/apiContracts.ts"],"mappings":";;qBAGa"}
@@ -1,2 +0,0 @@
1
- import{defineApiContract as e}from"@agimon-ai/doompi-core/api-contracts";const t=e({version:1,http:[],sockets:[],dynamic:[]});export{t as apiContracts,t as default};
2
- //# sourceMappingURL=apiContracts.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"apiContracts.mjs","names":[],"sources":["../../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract } from '@agimon-ai/doompi-core/api-contracts';\n\n/** This facet contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */\nexport const apiContracts = defineApiContract({ version: 1, http: [], sockets: [], dynamic: [] });\nexport default apiContracts;\n"],"mappings":"yEAGA,MAAa,EAAe,EAAkB,CAAE,QAAS,EAAG,KAAM,CAAC,EAAG,QAAS,CAAC,EAAG,QAAS,CAAC,CAAE,CAAC"}
@@ -1,2 +0,0 @@
1
- let e=require("typebox");const t=e.Type.Object({path:e.Type.String({description:`Path to the file to read.`}),offset:e.Type.Optional(e.Type.Integer({minimum:1,description:`One-based line offset.`})),limit:e.Type.Optional(e.Type.Integer({minimum:1,description:`Maximum number of lines to return.`}))});exports.ReadParamsSchema=t;
2
- //# sourceMappingURL=readTool.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"readTool.cjs","names":["Type"],"sources":["../../src/schemas/readTool.ts"],"sourcesContent":["import { type Static, Type } from 'typebox';\n\nexport const ReadParamsSchema = Type.Object({\n path: Type.String({ description: 'Path to the file to read.' }),\n offset: Type.Optional(Type.Integer({ minimum: 1, description: 'One-based line offset.' })),\n limit: Type.Optional(Type.Integer({ minimum: 1, description: 'Maximum number of lines to return.' })),\n});\n\nexport type ReadParams = Static<typeof ReadParamsSchema>;\n"],"mappings":"yBAEA,MAAa,EAAmBA,EAAAA,KAAK,OAAO,CAC1C,KAAMA,EAAAA,KAAK,OAAO,CAAE,YAAa,2BAA4B,CAAC,EAC9D,OAAQA,EAAAA,KAAK,SAASA,EAAAA,KAAK,QAAQ,CAAE,QAAS,EAAG,YAAa,wBAAyB,CAAC,CAAC,EACzF,MAAOA,EAAAA,KAAK,SAASA,EAAAA,KAAK,QAAQ,CAAE,QAAS,EAAG,YAAa,oCAAqC,CAAC,CAAC,CACtG,CAAC"}
@@ -1,10 +0,0 @@
1
- import { Static, Type } from "typebox";
2
- //#region src/schemas/readTool.d.ts
3
- export declare const ReadParamsSchema: Type.TObject<{
4
- path: Type.TString;
5
- offset: Type.TOptional<Type.TInteger>;
6
- limit: Type.TOptional<Type.TInteger>;
7
- }>;
8
- export type ReadParams = Static<typeof ReadParamsSchema>;
9
- //#endregion
10
- //# sourceMappingURL=readTool.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"readTool.d.cts","names":[],"sources":["../../src/schemas/readTool.ts"],"mappings":";;qBAEa,kBAAgB,KAAA;;;;;YAMjB,aAAa,cAAc"}
@@ -1,10 +0,0 @@
1
- import { Static, Type } from "typebox";
2
- //#region src/schemas/readTool.d.ts
3
- export declare const ReadParamsSchema: Type.TObject<{
4
- path: Type.TString;
5
- offset: Type.TOptional<Type.TInteger>;
6
- limit: Type.TOptional<Type.TInteger>;
7
- }>;
8
- export type ReadParams = Static<typeof ReadParamsSchema>;
9
- //#endregion
10
- //# sourceMappingURL=readTool.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"readTool.d.mts","names":[],"sources":["../../src/schemas/readTool.ts"],"mappings":";;qBAEa,kBAAgB,KAAA;;;;;YAMjB,aAAa,cAAc"}
@@ -1,2 +0,0 @@
1
- import{Type as e}from"typebox";const t=e.Object({path:e.String({description:`Path to the file to read.`}),offset:e.Optional(e.Integer({minimum:1,description:`One-based line offset.`})),limit:e.Optional(e.Integer({minimum:1,description:`Maximum number of lines to return.`}))});export{t as ReadParamsSchema};
2
- //# sourceMappingURL=readTool.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"readTool.mjs","names":[],"sources":["../../src/schemas/readTool.ts"],"sourcesContent":["import { type Static, Type } from 'typebox';\n\nexport const ReadParamsSchema = Type.Object({\n path: Type.String({ description: 'Path to the file to read.' }),\n offset: Type.Optional(Type.Integer({ minimum: 1, description: 'One-based line offset.' })),\n limit: Type.Optional(Type.Integer({ minimum: 1, description: 'Maximum number of lines to return.' })),\n});\n\nexport type ReadParams = Static<typeof ReadParamsSchema>;\n"],"mappings":"+BAEA,MAAa,EAAmB,EAAK,OAAO,CAC1C,KAAM,EAAK,OAAO,CAAE,YAAa,2BAA4B,CAAC,EAC9D,OAAQ,EAAK,SAAS,EAAK,QAAQ,CAAE,QAAS,EAAG,YAAa,wBAAyB,CAAC,CAAC,EACzF,MAAO,EAAK,SAAS,EAAK,QAAQ,CAAE,QAAS,EAAG,YAAa,oCAAqC,CAAC,CAAC,CACtG,CAAC"}
@@ -1,2 +0,0 @@
1
- const e=require("../readImage/index.cjs");let t=require("@earendil-works/pi-coding-agent");const n={resize:t.resizeImage,formatDimensionNote:e=>(0,t.formatDimensionNote)(e)};function r(t,r){return e.applyImageLimits(t,r,n)}exports.applyImageLimits=r,exports.imageLimits=e.imageLimits;
2
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","names":["resizeImage","formatDimensionNote","applyServiceImageLimits"],"sources":["../../../src/services/piReadImage/index.ts"],"sourcesContent":["import { formatDimensionNote, resizeImage } from '@earendil-works/pi-coding-agent';\n\nimport {\n applyImageLimits as applyServiceImageLimits,\n type ReadContentPart,\n type ReadImageResizeOperations,\n type ReadImageResizeResult,\n} from '../readImage';\n\nexport { imageLimits, type ReadContentPart, type ReadImagePart, type ReadTextPart } from '../readImage';\n\nconst resizeOperations: ReadImageResizeOperations = {\n resize: resizeImage,\n formatDimensionNote: (result: ReadImageResizeResult) => formatDimensionNote(result),\n};\n\nexport function applyImageLimits(\n content: ReadContentPart[],\n limits: Parameters<typeof applyServiceImageLimits>[1],\n): Promise<ReadContentPart[]> {\n return applyServiceImageLimits(content, limits, resizeOperations);\n}\n"],"mappings":"2FAWA,MAAM,EAA8C,CAClD,OAAQA,EAAAA,YACR,oBAAsB,IAAA,EAAkCC,EAAAA,oBAAAA,CAAoB,CAAM,CACpF,EAEA,SAAgB,EACd,EACA,EAC4B,CAC5B,OAAOC,EAAAA,iBAAwB,EAAS,EAAQ,CAAgB,CAClE"}
@@ -1,2 +0,0 @@
1
- import{applyImageLimits as e,imageLimits as t}from"../readImage/index.mjs";import{formatDimensionNote as n,resizeImage as r}from"@earendil-works/pi-coding-agent";const i={resize:r,formatDimensionNote:e=>n(e)};function a(t,n){return e(t,n,i)}export{a as applyImageLimits,t as imageLimits};
2
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":["applyServiceImageLimits"],"sources":["../../../src/services/piReadImage/index.ts"],"sourcesContent":["import { formatDimensionNote, resizeImage } from '@earendil-works/pi-coding-agent';\n\nimport {\n applyImageLimits as applyServiceImageLimits,\n type ReadContentPart,\n type ReadImageResizeOperations,\n type ReadImageResizeResult,\n} from '../readImage';\n\nexport { imageLimits, type ReadContentPart, type ReadImagePart, type ReadTextPart } from '../readImage';\n\nconst resizeOperations: ReadImageResizeOperations = {\n resize: resizeImage,\n formatDimensionNote: (result: ReadImageResizeResult) => formatDimensionNote(result),\n};\n\nexport function applyImageLimits(\n content: ReadContentPart[],\n limits: Parameters<typeof applyServiceImageLimits>[1],\n): Promise<ReadContentPart[]> {\n return applyServiceImageLimits(content, limits, resizeOperations);\n}\n"],"mappings":"kKAWA,MAAM,EAA8C,CAClD,OAAQ,EACR,oBAAsB,GAAkC,EAAoB,CAAM,CACpF,EAEA,SAAgB,EACd,EACA,EAC4B,CAC5B,OAAOA,EAAwB,EAAS,EAAQ,CAAgB,CAClE"}
@@ -1,2 +0,0 @@
1
- let e=require("@agimon-ai/doompi-config/pi-config");function t(){return(0,e.loadPiImageSettings)()}async function n(e,t,n){if(!t.autoResize||!e.some(e=>e.type===`image`))return e;let r=[];for(let i of e){if(i.type!==`image`){r.push(i);continue}let e=await n.resize(Buffer.from(i.data,`base64`),i.mimeType,{maxWidth:t.maxDimension,maxHeight:t.maxDimension});if(!e){r.push({type:`text`,text:`[Image omitted: could not be resized below the inline image size limit.]`});continue}r.push({type:`image`,data:e.data,mimeType:e.mimeType});let a=n.formatDimensionNote(e);a&&r.push({type:`text`,text:a})}return r}exports.applyImageLimits=n,exports.imageLimits=t;
2
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","names":["loadPiImageSettings"],"sources":["../../../src/services/readImage/index.ts"],"sourcesContent":["import { loadPiImageSettings, type PiImageSettings } from '@agimon-ai/doompi-config/pi-config';\n\nconst OMITTED_NOTE = '[Image omitted: could not be resized below the inline image size limit.]';\n\nexport interface ReadTextPart {\n type: 'text';\n text: string;\n}\n\nexport interface ReadImagePart {\n type: 'image';\n data: string;\n mimeType: string;\n}\n\nexport type ReadContentPart = ReadTextPart | ReadImagePart;\n\nexport interface ReadImageResizeResult {\n readonly data: string;\n readonly mimeType: string;\n readonly originalWidth: number;\n readonly originalHeight: number;\n readonly width: number;\n readonly height: number;\n readonly wasResized: boolean;\n}\n\nexport interface ReadImageResizeOperations {\n resize(\n inputBytes: Uint8Array,\n mimeType: string,\n options: { readonly maxWidth: number; readonly maxHeight: number },\n ): Promise<ReadImageResizeResult | null>;\n formatDimensionNote(result: ReadImageResizeResult): string | undefined;\n}\n\nexport function imageLimits(): PiImageSettings {\n return loadPiImageSettings();\n}\n\nexport async function applyImageLimits(\n content: ReadContentPart[],\n limits: PiImageSettings,\n operations: ReadImageResizeOperations,\n): Promise<ReadContentPart[]> {\n if (!limits.autoResize || !content.some((part) => part.type === 'image')) return content;\n const resolved: ReadContentPart[] = [];\n for (const part of content) {\n if (part.type !== 'image') {\n resolved.push(part);\n continue;\n }\n const resized = await operations.resize(Buffer.from(part.data, 'base64'), part.mimeType, {\n maxWidth: limits.maxDimension,\n maxHeight: limits.maxDimension,\n });\n if (!resized) {\n resolved.push({ type: 'text', text: OMITTED_NOTE });\n continue;\n }\n resolved.push({ type: 'image', data: resized.data, mimeType: resized.mimeType });\n const note = operations.formatDimensionNote(resized);\n if (note) resolved.push({ type: 'text', text: note });\n }\n return resolved;\n}\n"],"mappings":"oDAoCA,SAAgB,GAA+B,CAC7C,OAAA,EAAOA,EAAAA,oBAAAA,CAAoB,CAC7B,CAEA,eAAsB,EACpB,EACA,EACA,EAC4B,CAC5B,GAAI,CAAC,EAAO,YAAc,CAAC,EAAQ,KAAM,GAAS,EAAK,OAAS,OAAO,EAAG,OAAO,EACjF,IAAM,EAA8B,CAAC,EACrC,IAAK,IAAM,KAAQ,EAAS,CAC1B,GAAI,EAAK,OAAS,QAAS,CACzB,EAAS,KAAK,CAAI,EAClB,QACF,CACA,IAAM,EAAU,MAAM,EAAW,OAAO,OAAO,KAAK,EAAK,KAAM,QAAQ,EAAG,EAAK,SAAU,CACvF,SAAU,EAAO,aACjB,UAAW,EAAO,YACpB,CAAC,EACD,GAAI,CAAC,EAAS,CACZ,EAAS,KAAK,CAAE,KAAM,OAAQ,KAAM,0EAAa,CAAC,EAClD,QACF,CACA,EAAS,KAAK,CAAE,KAAM,QAAS,KAAM,EAAQ,KAAM,SAAU,EAAQ,QAAS,CAAC,EAC/E,IAAM,EAAO,EAAW,oBAAoB,CAAO,EAC/C,GAAM,EAAS,KAAK,CAAE,KAAM,OAAQ,KAAM,CAAK,CAAC,CACtD,CACA,OAAO,CACT"}
@@ -1,14 +0,0 @@
1
- import "@agimon-ai/doompi-config/pi-config";
2
- //#region src/services/readImage/index.d.ts
3
- export interface ReadTextPart {
4
- type: 'text';
5
- text: string;
6
- }
7
- export interface ReadImagePart {
8
- type: 'image';
9
- data: string;
10
- mimeType: string;
11
- }
12
- export type ReadContentPart = ReadTextPart | ReadImagePart;
13
- //#endregion
14
- //# sourceMappingURL=index.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../../../src/services/readImage/index.ts"],"mappings":";;iBAIiB;EACf;EACA;;iBAGe;EACf;EACA;EACA;;YAGU,kBAAkB,eAAe"}
@@ -1,14 +0,0 @@
1
- import "@agimon-ai/doompi-config/pi-config";
2
- //#region src/services/readImage/index.d.ts
3
- export interface ReadTextPart {
4
- type: 'text';
5
- text: string;
6
- }
7
- export interface ReadImagePart {
8
- type: 'image';
9
- data: string;
10
- mimeType: string;
11
- }
12
- export type ReadContentPart = ReadTextPart | ReadImagePart;
13
- //#endregion
14
- //# sourceMappingURL=index.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/services/readImage/index.ts"],"mappings":";;iBAIiB;EACf;EACA;;iBAGe;EACf;EACA;EACA;;YAGU,kBAAkB,eAAe"}
@@ -1,2 +0,0 @@
1
- import{loadPiImageSettings as e}from"@agimon-ai/doompi-config/pi-config";function t(){return e()}async function n(e,t,n){if(!t.autoResize||!e.some(e=>e.type===`image`))return e;let r=[];for(let i of e){if(i.type!==`image`){r.push(i);continue}let e=await n.resize(Buffer.from(i.data,`base64`),i.mimeType,{maxWidth:t.maxDimension,maxHeight:t.maxDimension});if(!e){r.push({type:`text`,text:`[Image omitted: could not be resized below the inline image size limit.]`});continue}r.push({type:`image`,data:e.data,mimeType:e.mimeType});let a=n.formatDimensionNote(e);a&&r.push({type:`text`,text:a})}return r}export{n as applyImageLimits,t as imageLimits};
2
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/services/readImage/index.ts"],"sourcesContent":["import { loadPiImageSettings, type PiImageSettings } from '@agimon-ai/doompi-config/pi-config';\n\nconst OMITTED_NOTE = '[Image omitted: could not be resized below the inline image size limit.]';\n\nexport interface ReadTextPart {\n type: 'text';\n text: string;\n}\n\nexport interface ReadImagePart {\n type: 'image';\n data: string;\n mimeType: string;\n}\n\nexport type ReadContentPart = ReadTextPart | ReadImagePart;\n\nexport interface ReadImageResizeResult {\n readonly data: string;\n readonly mimeType: string;\n readonly originalWidth: number;\n readonly originalHeight: number;\n readonly width: number;\n readonly height: number;\n readonly wasResized: boolean;\n}\n\nexport interface ReadImageResizeOperations {\n resize(\n inputBytes: Uint8Array,\n mimeType: string,\n options: { readonly maxWidth: number; readonly maxHeight: number },\n ): Promise<ReadImageResizeResult | null>;\n formatDimensionNote(result: ReadImageResizeResult): string | undefined;\n}\n\nexport function imageLimits(): PiImageSettings {\n return loadPiImageSettings();\n}\n\nexport async function applyImageLimits(\n content: ReadContentPart[],\n limits: PiImageSettings,\n operations: ReadImageResizeOperations,\n): Promise<ReadContentPart[]> {\n if (!limits.autoResize || !content.some((part) => part.type === 'image')) return content;\n const resolved: ReadContentPart[] = [];\n for (const part of content) {\n if (part.type !== 'image') {\n resolved.push(part);\n continue;\n }\n const resized = await operations.resize(Buffer.from(part.data, 'base64'), part.mimeType, {\n maxWidth: limits.maxDimension,\n maxHeight: limits.maxDimension,\n });\n if (!resized) {\n resolved.push({ type: 'text', text: OMITTED_NOTE });\n continue;\n }\n resolved.push({ type: 'image', data: resized.data, mimeType: resized.mimeType });\n const note = operations.formatDimensionNote(resized);\n if (note) resolved.push({ type: 'text', text: note });\n }\n return resolved;\n}\n"],"mappings":"yEAoCA,SAAgB,GAA+B,CAC7C,OAAO,EAAoB,CAC7B,CAEA,eAAsB,EACpB,EACA,EACA,EAC4B,CAC5B,GAAI,CAAC,EAAO,YAAc,CAAC,EAAQ,KAAM,GAAS,EAAK,OAAS,OAAO,EAAG,OAAO,EACjF,IAAM,EAA8B,CAAC,EACrC,IAAK,IAAM,KAAQ,EAAS,CAC1B,GAAI,EAAK,OAAS,QAAS,CACzB,EAAS,KAAK,CAAI,EAClB,QACF,CACA,IAAM,EAAU,MAAM,EAAW,OAAO,OAAO,KAAK,EAAK,KAAM,QAAQ,EAAG,EAAK,SAAU,CACvF,SAAU,EAAO,aACjB,UAAW,EAAO,YACpB,CAAC,EACD,GAAI,CAAC,EAAS,CACZ,EAAS,KAAK,CAAE,KAAM,OAAQ,KAAM,0EAAa,CAAC,EAClD,QACF,CACA,EAAS,KAAK,CAAE,KAAM,QAAS,KAAM,EAAQ,KAAM,SAAU,EAAQ,QAAS,CAAC,EAC/E,IAAM,EAAO,EAAW,oBAAoB,CAAO,EAC/C,GAAM,EAAS,KAAK,CAAE,KAAM,OAAQ,KAAM,CAAK,CAAC,CACtD,CACA,OAAO,CACT"}
@@ -1,3 +0,0 @@
1
- const e=require("../../schemas/readTool.cjs"),t=require("../readImage/index.cjs");let n=require("node:fs/promises"),r=require("@agimon-ai/doompi-hashline/files"),i=require("@earendil-works/pi-coding-agent"),a=require("@agimon-ai/doompi-hashline");const o={resize:i.resizeImage,formatDimensionNote:e=>(0,i.formatDimensionNote)(e)};function s(e){if(e?.aborted)throw Error(`Operation aborted`)}function c(e){let t=e.toLowerCase().match(/\.([a-z0-9]+)$/u)?.[1];if(t)return{avif:`image/avif`,gif:`image/gif`,jpeg:`image/jpeg`,jpg:`image/jpeg`,png:`image/png`,webp:`image/webp`}[t]}async function l(e,i,a){s(a);let l=await(0,r.resolveReadInputPath)(e.path,i),d=await(0,n.readFile)(l);s(a);let f=c(l);if(f){let e=[{type:`text`,text:`Read image file ${(0,r.displayPath)(l,i)} [${f}]`},{type:`image`,data:d.toString(`base64`),mimeType:f}];return{content:await t.applyImageLimits(e,t.imageLimits(),o)}}return await(0,r.isWritableFile)(l)?u(d,(0,r.displayPath)(l,i),e):{content:[{type:`text`,text:(0,r.decodeUtf8)(d,(0,r.displayPath)(l,i))}]}}function u(e,t,n){let o=(0,a.splitLines)((0,r.decodeUtf8)(e,t)),s=n.offset===void 0?0:n.offset-1;if(s>=o.length)throw Error(`Offset ${n.offset} is beyond end of file (${o.length} lines total).`);let c=n.limit===void 0?o.length:Math.min(o.length,s+n.limit),l=o.slice(s,c),u=(0,a.formatFileHeader)(t,(0,r.computeFileTag)(e)),d=[],f=Buffer.byteLength(u,`utf8`)+1,p=l.map((e,t)=>{let n=s+t+1,r=(0,a.formatTaggedLine)(e,n);return Buffer.byteLength(r,`utf8`)<=i.DEFAULT_MAX_BYTES-f?r:(d.push(n),(0,a.formatTaggedLine)((0,i.truncateLine)(e).text,n,``,e))}),m=(0,i.truncateHead)([u,...p].join(`
2
- `)),h=m.content,g;if(m.truncated){let e=Math.max(0,m.outputLines-1),t=s+e+1,n=m.truncatedBy===`bytes`?`, ${(0,i.formatSize)(i.DEFAULT_MAX_BYTES)} limit`:``;h+=`\n\n[Showing ${e} anchored lines${n}. Use offset=${t} to continue.]`,g={truncation:m}}else{let e=[];d.length>0&&e.push(`Lines ${d.join(`, `)} shown compactly. Their anchors hash the full original lines`),c<o.length&&e.push(`${o.length-c} more lines in file. Use offset=${c+1} to continue`),e.length>0&&(h+=`\n\n[${e.join(`. `)}.]`)}return{content:[{type:`text`,text:h}],details:g}}function d(e){return e.some(e=>e.type===`image`||e.text?.startsWith(`Read image file`)===!0)}function f(){return{name:`read`,label:`read`,description:`Read a writable text file with an exact-byte file tag and stable line anchors. Non-writable files and images return native-compatible content. Text is truncated to 50.0KB.`,promptSnippet:`Read file contents with snapshot-bound line anchors`,promptGuidelines:[`Use read before edit. When hashline metadata is present, preserve the @file hash and anchors such as 5#abc exactly.`,`Continue large reads with offset until the required anchored lines are visible.`],parameters:e.ReadParamsSchema,executionMode:`parallel`,execute:async(e,t,n,r,i)=>l(t,i.cwd,n)}}exports.assertNotAborted=s,exports.createHeadlessReadTool=f,exports.createTaggedReadResult=u,exports.executeHeadlessRead=l,exports.isImagePath=c,exports.isImageRead=d;
3
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","names":["resizeImage","formatDimensionNote","resolveReadInputPath","readFile","displayPath","applyImageLimits","imageLimits","isWritableFile","decodeUtf8","splitLines","formatFileHeader","computeFileTag","formatTaggedLine","DEFAULT_MAX_BYTES","truncateLine","truncateHead","formatSize","ReadParamsSchema"],"sources":["../../../src/services/readTool/index.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\n\nimport type {\n DoomHeadlessExecutionContext,\n DoomHeadlessTool,\n DoomHeadlessToolResult,\n} from '@agimon-ai/doompi-core/headless';\nimport { formatFileHeader, formatTaggedLine, splitLines } from '@agimon-ai/doompi-hashline';\nimport {\n computeFileTag,\n decodeUtf8,\n displayPath,\n isWritableFile,\n resolveReadInputPath,\n} from '@agimon-ai/doompi-hashline/files';\nimport {\n DEFAULT_MAX_BYTES,\n formatSize,\n truncateHead,\n truncateLine,\n type ReadToolDetails,\n} from '@earendil-works/pi-coding-agent';\nimport { formatDimensionNote, resizeImage } from '@earendil-works/pi-coding-agent';\n\nimport { ReadParamsSchema, type ReadParams } from '../../schemas/readTool';\nimport {\n applyImageLimits,\n imageLimits,\n type ReadContentPart,\n type ReadImageResizeOperations,\n type ReadTextPart,\n} from '../readImage';\n\nconst resizeOperations: ReadImageResizeOperations = {\n resize: resizeImage,\n formatDimensionNote: (result) => formatDimensionNote(result),\n};\n\nexport interface ReadToolResult {\n content: ReadContentPart[];\n details?: ReadToolDetails;\n}\n\ninterface ReadTextToolResult {\n content: ReadTextPart[];\n details?: ReadToolDetails;\n}\n\nexport function assertNotAborted(signal: AbortSignal | undefined): void {\n if (signal?.aborted) throw new Error('Operation aborted');\n}\n\nexport function isImagePath(filePath: string): string | undefined {\n const extension = filePath.toLowerCase().match(/\\.([a-z0-9]+)$/u)?.[1];\n if (!extension) return undefined;\n const mimeTypes: Record<string, string> = {\n avif: 'image/avif',\n gif: 'image/gif',\n jpeg: 'image/jpeg',\n jpg: 'image/jpeg',\n png: 'image/png',\n webp: 'image/webp',\n };\n return mimeTypes[extension];\n}\n\nexport async function executeHeadlessRead(\n params: ReadParams,\n cwd: string,\n signal: AbortSignal | undefined,\n): Promise<ReadToolResult> {\n assertNotAborted(signal);\n const absolutePath = await resolveReadInputPath(params.path, cwd);\n const bytes = await readFile(absolutePath);\n assertNotAborted(signal);\n const mimeType = isImagePath(absolutePath);\n if (mimeType) {\n const content: ReadContentPart[] = [\n { type: 'text', text: `Read image file ${displayPath(absolutePath, cwd)} [${mimeType}]` },\n { type: 'image', data: bytes.toString('base64'), mimeType },\n ];\n return { content: await applyImageLimits(content, imageLimits(), resizeOperations) };\n }\n if (!(await isWritableFile(absolutePath))) {\n return { content: [{ type: 'text', text: decodeUtf8(bytes, displayPath(absolutePath, cwd)) }] };\n }\n return createTaggedReadResult(bytes, displayPath(absolutePath, cwd), params);\n}\n\nexport function createTaggedReadResult(bytes: Buffer, path: string, params: ReadParams): ReadTextToolResult {\n const lines = splitLines(decodeUtf8(bytes, path));\n const startIndex = params.offset === undefined ? 0 : params.offset - 1;\n if (startIndex >= lines.length) {\n throw new Error(`Offset ${params.offset} is beyond end of file (${lines.length} lines total).`);\n }\n\n const endIndex = params.limit === undefined ? lines.length : Math.min(lines.length, startIndex + params.limit);\n const selected = lines.slice(startIndex, endIndex);\n const header = formatFileHeader(path, computeFileTag(bytes));\n const compactedLines: number[] = [];\n const headerBytes = Buffer.byteLength(header, 'utf8') + 1;\n const tagged = selected.map((line, index) => {\n const lineNumber = startIndex + index + 1;\n const full = formatTaggedLine(line, lineNumber);\n if (Buffer.byteLength(full, 'utf8') <= DEFAULT_MAX_BYTES - headerBytes) return full;\n compactedLines.push(lineNumber);\n return formatTaggedLine(truncateLine(line).text, lineNumber, '', line);\n });\n const truncation = truncateHead([header, ...tagged].join('\\n'));\n let text = truncation.content;\n let details: ReadToolDetails | undefined;\n\n if (truncation.truncated) {\n const shownLines = Math.max(0, truncation.outputLines - 1);\n const nextOffset = startIndex + shownLines + 1;\n const reason = truncation.truncatedBy === 'bytes' ? `, ${formatSize(DEFAULT_MAX_BYTES)} limit` : '';\n text += `\\n\\n[Showing ${shownLines} anchored lines${reason}. Use offset=${nextOffset} to continue.]`;\n details = { truncation };\n } else {\n const notices: string[] = [];\n if (compactedLines.length > 0) {\n notices.push(`Lines ${compactedLines.join(', ')} shown compactly. Their anchors hash the full original lines`);\n }\n if (endIndex < lines.length) {\n notices.push(`${lines.length - endIndex} more lines in file. Use offset=${endIndex + 1} to continue`);\n }\n if (notices.length > 0) text += `\\n\\n[${notices.join('. ')}.]`;\n }\n\n return { content: [{ type: 'text', text }], details };\n}\n\nexport function isImageRead(content: readonly { readonly type: string; readonly text?: string }[]): boolean {\n return content.some((part) => part.type === 'image' || part.text?.startsWith('Read image file') === true);\n}\n\nexport function createHeadlessReadTool(): DoomHeadlessTool<typeof ReadParamsSchema> {\n return {\n name: 'read',\n label: 'read',\n description:\n 'Read a writable text file with an exact-byte file tag and stable line anchors. Non-writable files and images return native-compatible content. Text is truncated to 50.0KB.',\n promptSnippet: 'Read file contents with snapshot-bound line anchors',\n promptGuidelines: [\n 'Use read before edit. When hashline metadata is present, preserve the @file hash and anchors such as 5#abc exactly.',\n 'Continue large reads with offset until the required anchored lines are visible.',\n ],\n parameters: ReadParamsSchema,\n executionMode: 'parallel',\n execute: async (\n _toolCallId: string,\n params: ReadParams,\n signal: AbortSignal | undefined,\n _onUpdate: ((result: DoomHeadlessToolResult) => void) | undefined,\n context: DoomHeadlessExecutionContext,\n ) => executeHeadlessRead(params, context.cwd, signal),\n };\n}\n"],"mappings":"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"}
@@ -1,13 +0,0 @@
1
- import { ReadParams, ReadParamsSchema } from "../../schemas/readTool.cjs";
2
- import { ReadContentPart } from "../readImage/index.cjs";
3
- import { ReadToolDetails } from "@earendil-works/pi-coding-agent";
4
- import { DoomHeadlessTool } from "@agimon-ai/doompi-core/headless";
5
- //#region src/services/readTool/index.d.ts
6
- export interface ReadToolResult {
7
- content: ReadContentPart[];
8
- details?: ReadToolDetails;
9
- }
10
- export declare function executeHeadlessRead(params: ReadParams, cwd: string, signal: AbortSignal | undefined): Promise<ReadToolResult>;
11
- export declare function createHeadlessReadTool(): DoomHeadlessTool<typeof ReadParamsSchema>;
12
- //#endregion
13
- //# sourceMappingURL=index.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../../../src/services/readTool/index.ts"],"mappings":";;;;;iBAsCiB;EACf,SAAS;EACT,UAAU;;wBA0BU,oBACpB,QAAQ,YACR,aACA,QAAQ,0BACP,QAAQ;wBAkEK,0BAA0B,wBAAwB"}
@@ -1,13 +0,0 @@
1
- import { ReadParams, ReadParamsSchema } from "../../schemas/readTool.mjs";
2
- import { ReadContentPart } from "../readImage/index.mjs";
3
- import { ReadToolDetails } from "@earendil-works/pi-coding-agent";
4
- import { DoomHeadlessTool } from "@agimon-ai/doompi-core/headless";
5
- //#region src/services/readTool/index.d.ts
6
- export interface ReadToolResult {
7
- content: ReadContentPart[];
8
- details?: ReadToolDetails;
9
- }
10
- export declare function executeHeadlessRead(params: ReadParams, cwd: string, signal: AbortSignal | undefined): Promise<ReadToolResult>;
11
- export declare function createHeadlessReadTool(): DoomHeadlessTool<typeof ReadParamsSchema>;
12
- //#endregion
13
- //# sourceMappingURL=index.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/services/readTool/index.ts"],"mappings":";;;;;iBAsCiB;EACf,SAAS;EACT,UAAU;;wBA0BU,oBACpB,QAAQ,YACR,aACA,QAAQ,0BACP,QAAQ;wBAkEK,0BAA0B,wBAAwB"}
@@ -1,3 +0,0 @@
1
- import{ReadParamsSchema as e}from"../../schemas/readTool.mjs";import{applyImageLimits as t,imageLimits as n}from"../readImage/index.mjs";import{readFile as r}from"node:fs/promises";import{computeFileTag as i,decodeUtf8 as a,displayPath as o,isWritableFile as s,resolveReadInputPath as c}from"@agimon-ai/doompi-hashline/files";import{DEFAULT_MAX_BYTES as l,formatDimensionNote as u,formatSize as d,resizeImage as f,truncateHead as p,truncateLine as m}from"@earendil-works/pi-coding-agent";import{formatFileHeader as h,formatTaggedLine as g,splitLines as _}from"@agimon-ai/doompi-hashline";const v={resize:f,formatDimensionNote:e=>u(e)};function y(e){if(e?.aborted)throw Error(`Operation aborted`)}function b(e){let t=e.toLowerCase().match(/\.([a-z0-9]+)$/u)?.[1];if(t)return{avif:`image/avif`,gif:`image/gif`,jpeg:`image/jpeg`,jpg:`image/jpeg`,png:`image/png`,webp:`image/webp`}[t]}async function x(e,i,l){y(l);let u=await c(e.path,i),d=await r(u);y(l);let f=b(u);if(f){let e=[{type:`text`,text:`Read image file ${o(u,i)} [${f}]`},{type:`image`,data:d.toString(`base64`),mimeType:f}];return{content:await t(e,n(),v)}}return await s(u)?S(d,o(u,i),e):{content:[{type:`text`,text:a(d,o(u,i))}]}}function S(e,t,n){let r=_(a(e,t)),o=n.offset===void 0?0:n.offset-1;if(o>=r.length)throw Error(`Offset ${n.offset} is beyond end of file (${r.length} lines total).`);let s=n.limit===void 0?r.length:Math.min(r.length,o+n.limit),c=r.slice(o,s),u=h(t,i(e)),f=[],v=Buffer.byteLength(u,`utf8`)+1,y=c.map((e,t)=>{let n=o+t+1,r=g(e,n);return Buffer.byteLength(r,`utf8`)<=l-v?r:(f.push(n),g(m(e).text,n,``,e))}),b=p([u,...y].join(`
2
- `)),x=b.content,S;if(b.truncated){let e=Math.max(0,b.outputLines-1),t=o+e+1,n=b.truncatedBy===`bytes`?`, ${d(l)} limit`:``;x+=`\n\n[Showing ${e} anchored lines${n}. Use offset=${t} to continue.]`,S={truncation:b}}else{let e=[];f.length>0&&e.push(`Lines ${f.join(`, `)} shown compactly. Their anchors hash the full original lines`),s<r.length&&e.push(`${r.length-s} more lines in file. Use offset=${s+1} to continue`),e.length>0&&(x+=`\n\n[${e.join(`. `)}.]`)}return{content:[{type:`text`,text:x}],details:S}}function C(e){return e.some(e=>e.type===`image`||e.text?.startsWith(`Read image file`)===!0)}function w(){return{name:`read`,label:`read`,description:`Read a writable text file with an exact-byte file tag and stable line anchors. Non-writable files and images return native-compatible content. Text is truncated to 50.0KB.`,promptSnippet:`Read file contents with snapshot-bound line anchors`,promptGuidelines:[`Use read before edit. When hashline metadata is present, preserve the @file hash and anchors such as 5#abc exactly.`,`Continue large reads with offset until the required anchored lines are visible.`],parameters:e,executionMode:`parallel`,execute:async(e,t,n,r,i)=>x(t,i.cwd,n)}}export{y as assertNotAborted,w as createHeadlessReadTool,S as createTaggedReadResult,x as executeHeadlessRead,b as isImagePath,C as isImageRead};
3
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/services/readTool/index.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\n\nimport type {\n DoomHeadlessExecutionContext,\n DoomHeadlessTool,\n DoomHeadlessToolResult,\n} from '@agimon-ai/doompi-core/headless';\nimport { formatFileHeader, formatTaggedLine, splitLines } from '@agimon-ai/doompi-hashline';\nimport {\n computeFileTag,\n decodeUtf8,\n displayPath,\n isWritableFile,\n resolveReadInputPath,\n} from '@agimon-ai/doompi-hashline/files';\nimport {\n DEFAULT_MAX_BYTES,\n formatSize,\n truncateHead,\n truncateLine,\n type ReadToolDetails,\n} from '@earendil-works/pi-coding-agent';\nimport { formatDimensionNote, resizeImage } from '@earendil-works/pi-coding-agent';\n\nimport { ReadParamsSchema, type ReadParams } from '../../schemas/readTool';\nimport {\n applyImageLimits,\n imageLimits,\n type ReadContentPart,\n type ReadImageResizeOperations,\n type ReadTextPart,\n} from '../readImage';\n\nconst resizeOperations: ReadImageResizeOperations = {\n resize: resizeImage,\n formatDimensionNote: (result) => formatDimensionNote(result),\n};\n\nexport interface ReadToolResult {\n content: ReadContentPart[];\n details?: ReadToolDetails;\n}\n\ninterface ReadTextToolResult {\n content: ReadTextPart[];\n details?: ReadToolDetails;\n}\n\nexport function assertNotAborted(signal: AbortSignal | undefined): void {\n if (signal?.aborted) throw new Error('Operation aborted');\n}\n\nexport function isImagePath(filePath: string): string | undefined {\n const extension = filePath.toLowerCase().match(/\\.([a-z0-9]+)$/u)?.[1];\n if (!extension) return undefined;\n const mimeTypes: Record<string, string> = {\n avif: 'image/avif',\n gif: 'image/gif',\n jpeg: 'image/jpeg',\n jpg: 'image/jpeg',\n png: 'image/png',\n webp: 'image/webp',\n };\n return mimeTypes[extension];\n}\n\nexport async function executeHeadlessRead(\n params: ReadParams,\n cwd: string,\n signal: AbortSignal | undefined,\n): Promise<ReadToolResult> {\n assertNotAborted(signal);\n const absolutePath = await resolveReadInputPath(params.path, cwd);\n const bytes = await readFile(absolutePath);\n assertNotAborted(signal);\n const mimeType = isImagePath(absolutePath);\n if (mimeType) {\n const content: ReadContentPart[] = [\n { type: 'text', text: `Read image file ${displayPath(absolutePath, cwd)} [${mimeType}]` },\n { type: 'image', data: bytes.toString('base64'), mimeType },\n ];\n return { content: await applyImageLimits(content, imageLimits(), resizeOperations) };\n }\n if (!(await isWritableFile(absolutePath))) {\n return { content: [{ type: 'text', text: decodeUtf8(bytes, displayPath(absolutePath, cwd)) }] };\n }\n return createTaggedReadResult(bytes, displayPath(absolutePath, cwd), params);\n}\n\nexport function createTaggedReadResult(bytes: Buffer, path: string, params: ReadParams): ReadTextToolResult {\n const lines = splitLines(decodeUtf8(bytes, path));\n const startIndex = params.offset === undefined ? 0 : params.offset - 1;\n if (startIndex >= lines.length) {\n throw new Error(`Offset ${params.offset} is beyond end of file (${lines.length} lines total).`);\n }\n\n const endIndex = params.limit === undefined ? lines.length : Math.min(lines.length, startIndex + params.limit);\n const selected = lines.slice(startIndex, endIndex);\n const header = formatFileHeader(path, computeFileTag(bytes));\n const compactedLines: number[] = [];\n const headerBytes = Buffer.byteLength(header, 'utf8') + 1;\n const tagged = selected.map((line, index) => {\n const lineNumber = startIndex + index + 1;\n const full = formatTaggedLine(line, lineNumber);\n if (Buffer.byteLength(full, 'utf8') <= DEFAULT_MAX_BYTES - headerBytes) return full;\n compactedLines.push(lineNumber);\n return formatTaggedLine(truncateLine(line).text, lineNumber, '', line);\n });\n const truncation = truncateHead([header, ...tagged].join('\\n'));\n let text = truncation.content;\n let details: ReadToolDetails | undefined;\n\n if (truncation.truncated) {\n const shownLines = Math.max(0, truncation.outputLines - 1);\n const nextOffset = startIndex + shownLines + 1;\n const reason = truncation.truncatedBy === 'bytes' ? `, ${formatSize(DEFAULT_MAX_BYTES)} limit` : '';\n text += `\\n\\n[Showing ${shownLines} anchored lines${reason}. Use offset=${nextOffset} to continue.]`;\n details = { truncation };\n } else {\n const notices: string[] = [];\n if (compactedLines.length > 0) {\n notices.push(`Lines ${compactedLines.join(', ')} shown compactly. Their anchors hash the full original lines`);\n }\n if (endIndex < lines.length) {\n notices.push(`${lines.length - endIndex} more lines in file. Use offset=${endIndex + 1} to continue`);\n }\n if (notices.length > 0) text += `\\n\\n[${notices.join('. ')}.]`;\n }\n\n return { content: [{ type: 'text', text }], details };\n}\n\nexport function isImageRead(content: readonly { readonly type: string; readonly text?: string }[]): boolean {\n return content.some((part) => part.type === 'image' || part.text?.startsWith('Read image file') === true);\n}\n\nexport function createHeadlessReadTool(): DoomHeadlessTool<typeof ReadParamsSchema> {\n return {\n name: 'read',\n label: 'read',\n description:\n 'Read a writable text file with an exact-byte file tag and stable line anchors. Non-writable files and images return native-compatible content. Text is truncated to 50.0KB.',\n promptSnippet: 'Read file contents with snapshot-bound line anchors',\n promptGuidelines: [\n 'Use read before edit. When hashline metadata is present, preserve the @file hash and anchors such as 5#abc exactly.',\n 'Continue large reads with offset until the required anchored lines are visible.',\n ],\n parameters: ReadParamsSchema,\n executionMode: 'parallel',\n execute: async (\n _toolCallId: string,\n params: ReadParams,\n signal: AbortSignal | undefined,\n _onUpdate: ((result: DoomHeadlessToolResult) => void) | undefined,\n context: DoomHeadlessExecutionContext,\n ) => executeHeadlessRead(params, context.cwd, signal),\n };\n}\n"],"mappings":"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"}
@@ -1,2 +0,0 @@
1
- const e=require("../schemas/readTool.cjs"),t=require("../services/readImage/index.cjs"),n=require("../services/piReadImage/index.cjs"),r=require("../services/readTool/index.cjs");let i=require("node:fs/promises"),a=require("@agimon-ai/doompi-hashline/files"),o=require("@agimon-ai/doompi-ui/hashlineRendering"),s=require("@earendil-works/pi-coding-agent");function c(c=a.isWritableFile){return{name:`read`,label:`read`,description:`Read a writable text file with an exact-byte file tag and stable line anchors. Non-writable files and images retain Pi's native behavior. Text is truncated to ${(0,s.formatSize)(s.DEFAULT_MAX_BYTES)}.`,promptSnippet:`Read file contents with snapshot-bound line anchors`,promptGuidelines:[`Use read before edit. When hashline metadata is present, preserve the @file hash and anchors such as 5#abc exactly.`,`Continue large reads with offset until the required anchored lines are visible.`],parameters:e.ReadParamsSchema,executionMode:`parallel`,renderShell:`self`,async execute(e,o,l,u,d){let f=o;r.assertNotAborted(l);let p=await(0,a.resolveReadInputPath)(f.path,d.cwd),m=await(0,s.createReadToolDefinition)(d.cwd,{autoResizeImages:!1}).execute(e,{...f,path:p},l,u,d);if(r.isImageRead(m.content))return r.assertNotAborted(l),{...m,content:await n.applyImageLimits(m.content,t.imageLimits())};r.assertNotAborted(l);let h=await c(p);if(r.assertNotAborted(l),!h)return m;let g=await(0,i.readFile)(p);return r.assertNotAborted(l),r.createTaggedReadResult(g,(0,a.displayPath)(p,d.cwd),f)},renderCall(e,t){let n=e,r=[n.offset===void 0?void 0:`from ${n.offset}`,n.limit===void 0?void 0:`${n.limit} lines`].filter(e=>e!==void 0);return(0,o.renderHashlineCall)(`read`,n.path,r,t)},renderResult(e,t,n,r){return(0,o.renderHashlineResult)(e,t,n,r,`read`)}}}exports.createHashlineReadTool=c;
2
- //# sourceMappingURL=piRead.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"piRead.cjs","names":["isWritableFile","formatSize","DEFAULT_MAX_BYTES","ReadParamsSchema","resolveReadInputPath","createReadToolDefinition","isImageRead","applyImageLimits","imageLimits","readFile","createTaggedReadResult","displayPath","renderHashlineCall","renderHashlineResult"],"sources":["../../src/tools/piRead.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\n\nimport { displayPath, isWritableFile, resolveReadInputPath } from '@agimon-ai/doompi-hashline/files';\nimport { renderHashlineCall, renderHashlineResult } from '@agimon-ai/doompi-ui/hashlineRendering';\nimport {\n createReadToolDefinition,\n DEFAULT_MAX_BYTES,\n formatSize,\n type AgentToolResult,\n type ToolDefinition,\n} from '@earendil-works/pi-coding-agent';\n\nimport { ReadParamsSchema, type ReadParams } from '../schemas/readTool';\nimport { applyImageLimits, imageLimits } from '../services/piReadImage';\nimport { assertNotAborted, createTaggedReadResult, isImageRead } from '../services/readTool';\nexport { assertNotAborted, createTaggedReadResult, isImageRead } from '../services/readTool';\n\ntype WritableCheck = (path: string) => Promise<boolean>;\n\n/** Register the snapshot-bound replacement for Pi's read tool. */\nexport function createHashlineReadTool(\n writable: WritableCheck = isWritableFile,\n): ToolDefinition<typeof ReadParamsSchema> {\n return {\n name: 'read',\n label: 'read',\n description: `Read a writable text file with an exact-byte file tag and stable line anchors. Non-writable files and images retain Pi's native behavior. Text is truncated to ${formatSize(DEFAULT_MAX_BYTES)}.`,\n promptSnippet: 'Read file contents with snapshot-bound line anchors',\n promptGuidelines: [\n 'Use read before edit. When hashline metadata is present, preserve the @file hash and anchors such as 5#abc exactly.',\n 'Continue large reads with offset until the required anchored lines are visible.',\n ],\n parameters: ReadParamsSchema,\n executionMode: 'parallel',\n renderShell: 'self',\n async execute(toolCallId, params, signal, onUpdate, ctx) {\n const input = params as ReadParams;\n assertNotAborted(signal);\n const absolutePath = await resolveReadInputPath(input.path, ctx.cwd);\n // Pi resizes at a cap it hardcodes, so it is told not to: the block comes\n // back converted but full size, and the machine's configured cap is\n // applied below. Everything else about the native read is kept.\n const nativeRead = createReadToolDefinition(ctx.cwd, { autoResizeImages: false });\n const nativeResult = await nativeRead.execute(\n toolCallId,\n { ...input, path: absolutePath },\n signal,\n onUpdate,\n ctx,\n );\n if (isImageRead(nativeResult.content)) {\n assertNotAborted(signal);\n return { ...nativeResult, content: await applyImageLimits(nativeResult.content, imageLimits()) };\n }\n\n assertNotAborted(signal);\n const canEdit = await writable(absolutePath);\n assertNotAborted(signal);\n if (!canEdit) return nativeResult;\n const bytes = await readFile(absolutePath);\n assertNotAborted(signal);\n return createTaggedReadResult(\n bytes,\n displayPath(absolutePath, ctx.cwd),\n input,\n ) as unknown as AgentToolResult<unknown>;\n },\n renderCall(args, theme) {\n const input = args as ReadParams;\n const details = [\n input.offset === undefined ? undefined : `from ${input.offset}`,\n input.limit === undefined ? undefined : `${input.limit} lines`,\n ].filter((value): value is string => value !== undefined);\n return renderHashlineCall('read', input.path, details, theme);\n },\n renderResult(result, options, theme, context) {\n return renderHashlineResult(result, options, theme, context, 'read');\n },\n };\n}\n"],"mappings":"oWAoBA,SAAgB,EACd,EAA0BA,EAAAA,eACe,CACzC,MAAO,CACL,KAAM,OACN,MAAO,OACP,YAAa,mKAAA,EAAkKC,EAAAA,WAAAA,CAAWC,EAAAA,iBAAiB,EAAE,GAC7M,cAAe,sDACf,iBAAkB,CAChB,sHACA,iFACF,EACA,WAAYC,EAAAA,iBACZ,cAAe,WACf,YAAa,OACb,MAAM,QAAQ,EAAY,EAAQ,EAAQ,EAAU,EAAK,CACvD,IAAM,EAAQ,EACd,EAAA,iBAAiB,CAAM,EACvB,IAAM,EAAe,MAAA,EAAMC,EAAAA,qBAAAA,CAAqB,EAAM,KAAM,EAAI,GAAG,EAK7D,EAAe,MAAA,EADFC,EAAAA,yBAAAA,CAAyB,EAAI,IAAK,CAAE,iBAAkB,EAAM,CAC3C,CAAC,CAAC,QACpC,EACA,CAAE,GAAG,EAAO,KAAM,CAAa,EAC/B,EACA,EACA,CACF,EACA,GAAIC,EAAAA,YAAY,EAAa,OAAO,EAElC,OADA,EAAA,iBAAiB,CAAM,EAChB,CAAE,GAAG,EAAc,QAAS,MAAMC,EAAAA,iBAAiB,EAAa,QAASC,EAAAA,YAAY,CAAC,CAAE,EAGjG,EAAA,iBAAiB,CAAM,EACvB,IAAM,EAAU,MAAM,EAAS,CAAY,EAE3C,GADA,EAAA,iBAAiB,CAAM,EACnB,CAAC,EAAS,OAAO,EACrB,IAAM,EAAQ,MAAA,EAAMC,EAAAA,SAAAA,CAAS,CAAY,EAEzC,OADA,EAAA,iBAAiB,CAAM,EAChBC,EAAAA,uBACL,GAAA,EACAC,EAAAA,YAAAA,CAAY,EAAc,EAAI,GAAG,EACjC,CACF,CACF,EACA,WAAW,EAAM,EAAO,CACtB,IAAM,EAAQ,EACR,EAAU,CACd,EAAM,SAAW,IAAA,GAAY,IAAA,GAAY,QAAQ,EAAM,SACvD,EAAM,QAAU,IAAA,GAAY,IAAA,GAAY,GAAG,EAAM,MAAM,OACzD,CAAC,CAAC,OAAQ,GAA2B,IAAU,IAAA,EAAS,EACxD,OAAA,EAAOC,EAAAA,mBAAAA,CAAmB,OAAQ,EAAM,KAAM,EAAS,CAAK,CAC9D,EACA,aAAa,EAAQ,EAAS,EAAO,EAAS,CAC5C,OAAA,EAAOC,EAAAA,qBAAAA,CAAqB,EAAQ,EAAS,EAAO,EAAS,MAAM,CACrE,CACF,CACF"}
@@ -1,9 +0,0 @@
1
- import { ReadParamsSchema } from "../schemas/readTool.cjs";
2
- import "../services/readTool/index.cjs";
3
- import { ToolDefinition } from "@earendil-works/pi-coding-agent";
4
- //#region src/tools/piRead.d.ts
5
- type WritableCheck = (path: string) => Promise<boolean>;
6
- /** Register the snapshot-bound replacement for Pi's read tool. */
7
- export declare function createHashlineReadTool(writable?: WritableCheck): ToolDefinition<typeof ReadParamsSchema>;
8
- //#endregion
9
- //# sourceMappingURL=piRead.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"piRead.d.cts","names":[],"sources":["../../src/tools/piRead.ts"],"mappings":";;;;KAiBK,iBAAiB,iBAAiB;;wBAGvB,uBACd,WAAU,gBACT,sBAAsB"}
@@ -1,9 +0,0 @@
1
- import { ReadParamsSchema } from "../schemas/readTool.mjs";
2
- import "../services/readTool/index.mjs";
3
- import { ToolDefinition } from "@earendil-works/pi-coding-agent";
4
- //#region src/tools/piRead.d.ts
5
- type WritableCheck = (path: string) => Promise<boolean>;
6
- /** Register the snapshot-bound replacement for Pi's read tool. */
7
- export declare function createHashlineReadTool(writable?: WritableCheck): ToolDefinition<typeof ReadParamsSchema>;
8
- //#endregion
9
- //# sourceMappingURL=piRead.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"piRead.d.mts","names":[],"sources":["../../src/tools/piRead.ts"],"mappings":";;;;KAiBK,iBAAiB,iBAAiB;;wBAGvB,uBACd,WAAU,gBACT,sBAAsB"}
@@ -1,2 +0,0 @@
1
- import{ReadParamsSchema as e}from"../schemas/readTool.mjs";import{imageLimits as t}from"../services/readImage/index.mjs";import{applyImageLimits as n}from"../services/piReadImage/index.mjs";import{assertNotAborted as r,createTaggedReadResult as i,isImageRead as a}from"../services/readTool/index.mjs";import{readFile as o}from"node:fs/promises";import{displayPath as s,isWritableFile as c,resolveReadInputPath as l}from"@agimon-ai/doompi-hashline/files";import{renderHashlineCall as u,renderHashlineResult as d}from"@agimon-ai/doompi-ui/hashlineRendering";import{DEFAULT_MAX_BYTES as f,createReadToolDefinition as p,formatSize as m}from"@earendil-works/pi-coding-agent";function h(h=c){return{name:`read`,label:`read`,description:`Read a writable text file with an exact-byte file tag and stable line anchors. Non-writable files and images retain Pi's native behavior. Text is truncated to ${m(f)}.`,promptSnippet:`Read file contents with snapshot-bound line anchors`,promptGuidelines:[`Use read before edit. When hashline metadata is present, preserve the @file hash and anchors such as 5#abc exactly.`,`Continue large reads with offset until the required anchored lines are visible.`],parameters:e,executionMode:`parallel`,renderShell:`self`,async execute(e,c,u,d,f){let m=c;r(u);let g=await l(m.path,f.cwd),_=await p(f.cwd,{autoResizeImages:!1}).execute(e,{...m,path:g},u,d,f);if(a(_.content))return r(u),{..._,content:await n(_.content,t())};r(u);let v=await h(g);if(r(u),!v)return _;let y=await o(g);return r(u),i(y,s(g,f.cwd),m)},renderCall(e,t){let n=e,r=[n.offset===void 0?void 0:`from ${n.offset}`,n.limit===void 0?void 0:`${n.limit} lines`].filter(e=>e!==void 0);return u(`read`,n.path,r,t)},renderResult(e,t,n,r){return d(e,t,n,r,`read`)}}}export{h as createHashlineReadTool};
2
- //# sourceMappingURL=piRead.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"piRead.mjs","names":[],"sources":["../../src/tools/piRead.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\n\nimport { displayPath, isWritableFile, resolveReadInputPath } from '@agimon-ai/doompi-hashline/files';\nimport { renderHashlineCall, renderHashlineResult } from '@agimon-ai/doompi-ui/hashlineRendering';\nimport {\n createReadToolDefinition,\n DEFAULT_MAX_BYTES,\n formatSize,\n type AgentToolResult,\n type ToolDefinition,\n} from '@earendil-works/pi-coding-agent';\n\nimport { ReadParamsSchema, type ReadParams } from '../schemas/readTool';\nimport { applyImageLimits, imageLimits } from '../services/piReadImage';\nimport { assertNotAborted, createTaggedReadResult, isImageRead } from '../services/readTool';\nexport { assertNotAborted, createTaggedReadResult, isImageRead } from '../services/readTool';\n\ntype WritableCheck = (path: string) => Promise<boolean>;\n\n/** Register the snapshot-bound replacement for Pi's read tool. */\nexport function createHashlineReadTool(\n writable: WritableCheck = isWritableFile,\n): ToolDefinition<typeof ReadParamsSchema> {\n return {\n name: 'read',\n label: 'read',\n description: `Read a writable text file with an exact-byte file tag and stable line anchors. Non-writable files and images retain Pi's native behavior. Text is truncated to ${formatSize(DEFAULT_MAX_BYTES)}.`,\n promptSnippet: 'Read file contents with snapshot-bound line anchors',\n promptGuidelines: [\n 'Use read before edit. When hashline metadata is present, preserve the @file hash and anchors such as 5#abc exactly.',\n 'Continue large reads with offset until the required anchored lines are visible.',\n ],\n parameters: ReadParamsSchema,\n executionMode: 'parallel',\n renderShell: 'self',\n async execute(toolCallId, params, signal, onUpdate, ctx) {\n const input = params as ReadParams;\n assertNotAborted(signal);\n const absolutePath = await resolveReadInputPath(input.path, ctx.cwd);\n // Pi resizes at a cap it hardcodes, so it is told not to: the block comes\n // back converted but full size, and the machine's configured cap is\n // applied below. Everything else about the native read is kept.\n const nativeRead = createReadToolDefinition(ctx.cwd, { autoResizeImages: false });\n const nativeResult = await nativeRead.execute(\n toolCallId,\n { ...input, path: absolutePath },\n signal,\n onUpdate,\n ctx,\n );\n if (isImageRead(nativeResult.content)) {\n assertNotAborted(signal);\n return { ...nativeResult, content: await applyImageLimits(nativeResult.content, imageLimits()) };\n }\n\n assertNotAborted(signal);\n const canEdit = await writable(absolutePath);\n assertNotAborted(signal);\n if (!canEdit) return nativeResult;\n const bytes = await readFile(absolutePath);\n assertNotAborted(signal);\n return createTaggedReadResult(\n bytes,\n displayPath(absolutePath, ctx.cwd),\n input,\n ) as unknown as AgentToolResult<unknown>;\n },\n renderCall(args, theme) {\n const input = args as ReadParams;\n const details = [\n input.offset === undefined ? undefined : `from ${input.offset}`,\n input.limit === undefined ? undefined : `${input.limit} lines`,\n ].filter((value): value is string => value !== undefined);\n return renderHashlineCall('read', input.path, details, theme);\n },\n renderResult(result, options, theme, context) {\n return renderHashlineResult(result, options, theme, context, 'read');\n },\n };\n}\n"],"mappings":"8pBAoBA,SAAgB,EACd,EAA0B,EACe,CACzC,MAAO,CACL,KAAM,OACN,MAAO,OACP,YAAa,kKAAkK,EAAW,CAAiB,EAAE,GAC7M,cAAe,sDACf,iBAAkB,CAChB,sHACA,iFACF,EACA,WAAY,EACZ,cAAe,WACf,YAAa,OACb,MAAM,QAAQ,EAAY,EAAQ,EAAQ,EAAU,EAAK,CACvD,IAAM,EAAQ,EACd,EAAiB,CAAM,EACvB,IAAM,EAAe,MAAM,EAAqB,EAAM,KAAM,EAAI,GAAG,EAK7D,EAAe,MADF,EAAyB,EAAI,IAAK,CAAE,iBAAkB,EAAM,CAC3C,CAAC,CAAC,QACpC,EACA,CAAE,GAAG,EAAO,KAAM,CAAa,EAC/B,EACA,EACA,CACF,EACA,GAAI,EAAY,EAAa,OAAO,EAElC,OADA,EAAiB,CAAM,EAChB,CAAE,GAAG,EAAc,QAAS,MAAM,EAAiB,EAAa,QAAS,EAAY,CAAC,CAAE,EAGjG,EAAiB,CAAM,EACvB,IAAM,EAAU,MAAM,EAAS,CAAY,EAE3C,GADA,EAAiB,CAAM,EACnB,CAAC,EAAS,OAAO,EACrB,IAAM,EAAQ,MAAM,EAAS,CAAY,EAEzC,OADA,EAAiB,CAAM,EAChB,EACL,EACA,EAAY,EAAc,EAAI,GAAG,EACjC,CACF,CACF,EACA,WAAW,EAAM,EAAO,CACtB,IAAM,EAAQ,EACR,EAAU,CACd,EAAM,SAAW,IAAA,GAAY,IAAA,GAAY,QAAQ,EAAM,SACvD,EAAM,QAAU,IAAA,GAAY,IAAA,GAAY,GAAG,EAAM,MAAM,OACzD,CAAC,CAAC,OAAQ,GAA2B,IAAU,IAAA,EAAS,EACxD,OAAO,EAAmB,OAAQ,EAAM,KAAM,EAAS,CAAK,CAC9D,EACA,aAAa,EAAQ,EAAS,EAAO,EAAS,CAC5C,OAAO,EAAqB,EAAQ,EAAS,EAAO,EAAS,MAAM,CACrE,CACF,CACF"}
@@ -1,14 +0,0 @@
1
- import { defineWebPlugin } from '@agimon-ai/doompi-core/web';
2
-
3
- import { ReadToolMessage } from '../web/components/ReadToolMessage';
4
-
5
- /**
6
- * This package's cockpit presence: the read tool's timeline card, the web
7
- * half of the TUI's renderCall and renderResult for hashline reads.
8
- */
9
- export const webPlugin = defineWebPlugin({
10
- id: 'read',
11
- session: {
12
- toolRenderers: [{ tools: ['read'], message: ReadToolMessage }],
13
- },
14
- });
@@ -1,116 +0,0 @@
1
- import type { ToolMessageRenderProps } from '@agimon-ai/doompi-core/web';
2
- import {
3
- HashlineLines,
4
- hashlineBody,
5
- MessageItem,
6
- MessageItemBody,
7
- MessageItemHeader,
8
- MessageItemStatus,
9
- resultTextLines,
10
- ToolPathLink,
11
- toolTone,
12
- } from '@agimon-ai/doompi-web-components';
13
-
14
- import { readCallView } from '../lib/readToolView';
15
-
16
- const IMAGE_MIME_TYPES = new Set(['image/png', 'image/jpeg', 'image/gif', 'image/webp']);
17
-
18
- function resultImages(content: readonly unknown[]): Array<{ data: string; mimeType: string }> {
19
- return content.flatMap((block) => {
20
- if (typeof block !== 'object' || block === null || Array.isArray(block)) return [];
21
- const value = block as Record<string, unknown>;
22
- return value.type === 'image' &&
23
- typeof value.data === 'string' &&
24
- typeof value.mimeType === 'string' &&
25
- IMAGE_MIME_TYPES.has(value.mimeType)
26
- ? [{ data: value.data, mimeType: value.mimeType }]
27
- : [];
28
- });
29
- }
30
- /**
31
- * The read tool's timeline item, the web half of its renderCall and
32
- * renderResult: the call summary in the header and, when expanded, the
33
- * anchored lines with a line-number gutter in the body. A failure shows the
34
- * tool's message in red inside the expanded body instead.
35
- */
36
- export function ReadToolMessage({
37
- args,
38
- result,
39
- output,
40
- running,
41
- isError,
42
- fileTabFor,
43
- openTransientTab,
44
- }: ToolMessageRenderProps) {
45
- const view = readCallView(args);
46
- const images = resultImages(result?.content ?? []);
47
- // A read is the one call whose file the session usually has not changed, so
48
- // this is the link that opens it read-only rather than in its history.
49
- const tab = fileTabFor(view.path);
50
- const body = result === null || isError ? null : hashlineBody(result, output, 'read', true);
51
- return (
52
- <MessageItem tone={toolTone({ running, isError })} expandable defaultExpanded={false}>
53
- {({ expanded }) => {
54
- return (
55
- <>
56
- <MessageItemHeader title="read">
57
- <span data-testid="tool-call-read" className="flex min-w-0 flex-1 items-center gap-2">
58
- <ToolPathLink
59
- path={view.path}
60
- {...(tab === undefined ? {} : { onOpen: () => openTransientTab(tab) })}
61
- />
62
- {view.details.length > 0 ? (
63
- <span className="shrink-0 text-doom-faint">· {view.details.join(' · ')}</span>
64
- ) : null}
65
- </span>
66
- </MessageItemHeader>
67
- {expanded ? (
68
- isError ? (
69
- <MessageItemBody data-testid="tool-result-read" className="flex flex-col">
70
- <MessageItemStatus tone="error">failed</MessageItemStatus>
71
- {resultTextLines(result, output).map((line, index) => (
72
- <span key={`${String(index)}-${line}`} className="whitespace-pre-wrap break-words text-doom-red">
73
- {line}
74
- </span>
75
- ))}
76
- </MessageItemBody>
77
- ) : body === null ? (
78
- running ? (
79
- <MessageItemBody data-testid="tool-result-read">
80
- <MessageItemStatus tone="running">running</MessageItemStatus>
81
- </MessageItemBody>
82
- ) : null
83
- ) : body.shown.length === 0 && body.notice === undefined && images.length === 0 ? null : (
84
- <MessageItemBody data-testid="tool-result-read" className="flex flex-col gap-1">
85
- {/* A read body is one file with no heading of its own, so the
86
- call's path is what names the grammar for it. */}
87
- <HashlineLines lines={body.shown} gutter={body.gutter} path={view.path} />
88
- {images.map((image, index) => {
89
- const url = `data:${image.mimeType};base64,${image.data}`;
90
- return (
91
- <a
92
- key={`${image.mimeType}:${String(index)}`}
93
- href={url}
94
- target="_blank"
95
- rel="noreferrer"
96
- className="self-start"
97
- >
98
- <img
99
- src={url}
100
- alt={`Read result ${String(index + 1)}`}
101
- data-testid="tool-result-read-image"
102
- className="h-auto max-h-96 max-w-full rounded-md border border-doom-border-soft object-contain"
103
- />
104
- </a>
105
- );
106
- })}
107
- {body.notice !== undefined ? <span className="text-doom-faint">{body.notice}</span> : null}
108
- </MessageItemBody>
109
- )
110
- ) : null}
111
- </>
112
- );
113
- }}
114
- </MessageItem>
115
- );
116
- }
@@ -1,24 +0,0 @@
1
- import { compactDetails } from '@agimon-ai/doompi-web-components';
2
-
3
- export interface ReadCallView {
4
- readonly path: string;
5
- /** `from N` and `N lines`, as the TUI's call heading lists them. */
6
- readonly details: readonly string[];
7
- }
8
-
9
- function optionalNumber(value: unknown): number | undefined {
10
- return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
11
- }
12
-
13
- /** What the read call heading shows: the path, then the offset and limit when given. */
14
- export function readCallView(args: Readonly<Record<string, unknown>>): ReadCallView {
15
- const offset = optionalNumber(args.offset);
16
- const limit = optionalNumber(args.limit);
17
- return {
18
- path: typeof args.path === 'string' ? args.path : '',
19
- details: compactDetails([
20
- offset === undefined ? undefined : `from ${offset}`,
21
- limit === undefined ? undefined : `${limit} lines`,
22
- ]),
23
- };
24
- }
@@ -1,23 +0,0 @@
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", "../extensions/web.ts"]
23
- }