@agimon-ai/doompi-author 0.0.1-alpha.10

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 (269) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +41 -0
  3. package/dist/_virtual/_rolldown/runtime.cjs +1 -0
  4. package/dist/api-contracts.cjs +1 -0
  5. package/dist/api-contracts.d.cts +2 -0
  6. package/dist/api-contracts.d.mts +2 -0
  7. package/dist/api-contracts.mjs +1 -0
  8. package/dist/authorFacade.cjs +1 -0
  9. package/dist/authorFacade.d.cts +3 -0
  10. package/dist/authorFacade.d.mts +3 -0
  11. package/dist/authorFacade.mjs +1 -0
  12. package/dist/constants/author.cjs +4 -0
  13. package/dist/constants/author.cjs.map +1 -0
  14. package/dist/constants/author.mjs +4 -0
  15. package/dist/constants/author.mjs.map +1 -0
  16. package/dist/controllers/authorApi.cjs +2 -0
  17. package/dist/controllers/authorApi.cjs.map +1 -0
  18. package/dist/controllers/authorApi.mjs +2 -0
  19. package/dist/controllers/authorApi.mjs.map +1 -0
  20. package/dist/controllers/authorBridgeApi.cjs +2 -0
  21. package/dist/controllers/authorBridgeApi.cjs.map +1 -0
  22. package/dist/controllers/authorBridgeApi.mjs +2 -0
  23. package/dist/controllers/authorBridgeApi.mjs.map +1 -0
  24. package/dist/controllers/authorBridgeMethod.cjs +2 -0
  25. package/dist/controllers/authorBridgeMethod.cjs.map +1 -0
  26. package/dist/controllers/authorBridgeMethod.mjs +2 -0
  27. package/dist/controllers/authorBridgeMethod.mjs.map +1 -0
  28. package/dist/controllers/authorDocumentApi.cjs +2 -0
  29. package/dist/controllers/authorDocumentApi.cjs.map +1 -0
  30. package/dist/controllers/authorDocumentApi.mjs +2 -0
  31. package/dist/controllers/authorDocumentApi.mjs.map +1 -0
  32. package/dist/controllers/authorPiMode.cjs +2 -0
  33. package/dist/controllers/authorPiMode.cjs.map +1 -0
  34. package/dist/controllers/authorPiMode.mjs +2 -0
  35. package/dist/controllers/authorPiMode.mjs.map +1 -0
  36. package/dist/controllers/doomAuthorCommand.cjs +2 -0
  37. package/dist/controllers/doomAuthorCommand.cjs.map +1 -0
  38. package/dist/controllers/doomAuthorCommand.d.cts +5 -0
  39. package/dist/controllers/doomAuthorCommand.d.cts.map +1 -0
  40. package/dist/controllers/doomAuthorCommand.d.mts +5 -0
  41. package/dist/controllers/doomAuthorCommand.d.mts.map +1 -0
  42. package/dist/controllers/doomAuthorCommand.mjs +2 -0
  43. package/dist/controllers/doomAuthorCommand.mjs.map +1 -0
  44. package/dist/controllers/webAuthorChannel.cjs +2 -0
  45. package/dist/controllers/webAuthorChannel.cjs.map +1 -0
  46. package/dist/controllers/webAuthorChannel.mjs +2 -0
  47. package/dist/controllers/webAuthorChannel.mjs.map +1 -0
  48. package/dist/extensions/pi.cjs +2 -0
  49. package/dist/extensions/pi.cjs.map +1 -0
  50. package/dist/extensions/pi.d.cts +7 -0
  51. package/dist/extensions/pi.d.cts.map +1 -0
  52. package/dist/extensions/pi.d.mts +7 -0
  53. package/dist/extensions/pi.d.mts.map +1 -0
  54. package/dist/extensions/pi.mjs +2 -0
  55. package/dist/extensions/pi.mjs.map +1 -0
  56. package/dist/extensions/server.cjs +2 -0
  57. package/dist/extensions/server.cjs.map +1 -0
  58. package/dist/extensions/server.d.cts +5 -0
  59. package/dist/extensions/server.d.cts.map +1 -0
  60. package/dist/extensions/server.d.mts +5 -0
  61. package/dist/extensions/server.d.mts.map +1 -0
  62. package/dist/extensions/server.mjs +2 -0
  63. package/dist/extensions/server.mjs.map +1 -0
  64. package/dist/index.cjs +1 -0
  65. package/dist/index.d.cts +20 -0
  66. package/dist/index.d.mts +20 -0
  67. package/dist/index.mjs +1 -0
  68. package/dist/models/authorBridgeState.cjs +2 -0
  69. package/dist/models/authorBridgeState.cjs.map +1 -0
  70. package/dist/models/authorBridgeState.d.cts +31 -0
  71. package/dist/models/authorBridgeState.d.cts.map +1 -0
  72. package/dist/models/authorBridgeState.d.mts +31 -0
  73. package/dist/models/authorBridgeState.d.mts.map +1 -0
  74. package/dist/models/authorBridgeState.mjs +2 -0
  75. package/dist/models/authorBridgeState.mjs.map +1 -0
  76. package/dist/models/authorMode.cjs +2 -0
  77. package/dist/models/authorMode.cjs.map +1 -0
  78. package/dist/models/authorMode.d.cts +9 -0
  79. package/dist/models/authorMode.d.cts.map +1 -0
  80. package/dist/models/authorMode.d.mts +9 -0
  81. package/dist/models/authorMode.d.mts.map +1 -0
  82. package/dist/models/authorMode.mjs +2 -0
  83. package/dist/models/authorMode.mjs.map +1 -0
  84. package/dist/schemas/apiContracts.cjs +4 -0
  85. package/dist/schemas/apiContracts.cjs.map +1 -0
  86. package/dist/schemas/apiContracts.d.cts +53 -0
  87. package/dist/schemas/apiContracts.d.cts.map +1 -0
  88. package/dist/schemas/apiContracts.d.mts +53 -0
  89. package/dist/schemas/apiContracts.d.mts.map +1 -0
  90. package/dist/schemas/apiContracts.mjs +4 -0
  91. package/dist/schemas/apiContracts.mjs.map +1 -0
  92. package/dist/schemas/authorFacade.cjs +2 -0
  93. package/dist/schemas/authorFacade.cjs.map +1 -0
  94. package/dist/schemas/authorFacade.d.cts +112 -0
  95. package/dist/schemas/authorFacade.d.cts.map +1 -0
  96. package/dist/schemas/authorFacade.d.mts +112 -0
  97. package/dist/schemas/authorFacade.d.mts.map +1 -0
  98. package/dist/schemas/authorFacade.mjs +2 -0
  99. package/dist/schemas/authorFacade.mjs.map +1 -0
  100. package/dist/schemas/authorTools.cjs +2 -0
  101. package/dist/schemas/authorTools.cjs.map +1 -0
  102. package/dist/schemas/authorTools.d.cts +12 -0
  103. package/dist/schemas/authorTools.d.cts.map +1 -0
  104. package/dist/schemas/authorTools.d.mts +12 -0
  105. package/dist/schemas/authorTools.d.mts.map +1 -0
  106. package/dist/schemas/authorTools.mjs +2 -0
  107. package/dist/schemas/authorTools.mjs.map +1 -0
  108. package/dist/services/authorCatalog/index.cjs +2 -0
  109. package/dist/services/authorCatalog/index.cjs.map +1 -0
  110. package/dist/services/authorCatalog/index.d.cts +6 -0
  111. package/dist/services/authorCatalog/index.d.cts.map +1 -0
  112. package/dist/services/authorCatalog/index.d.mts +6 -0
  113. package/dist/services/authorCatalog/index.d.mts.map +1 -0
  114. package/dist/services/authorCatalog/index.mjs +2 -0
  115. package/dist/services/authorCatalog/index.mjs.map +1 -0
  116. package/dist/services/authorCatalog/monitor.cjs +2 -0
  117. package/dist/services/authorCatalog/monitor.cjs.map +1 -0
  118. package/dist/services/authorCatalog/monitor.d.cts +20 -0
  119. package/dist/services/authorCatalog/monitor.d.cts.map +1 -0
  120. package/dist/services/authorCatalog/monitor.d.mts +20 -0
  121. package/dist/services/authorCatalog/monitor.d.mts.map +1 -0
  122. package/dist/services/authorCatalog/monitor.mjs +2 -0
  123. package/dist/services/authorCatalog/monitor.mjs.map +1 -0
  124. package/dist/services/authorCatalog/type.d.cts +10 -0
  125. package/dist/services/authorCatalog/type.d.cts.map +1 -0
  126. package/dist/services/authorCatalog/type.d.mts +10 -0
  127. package/dist/services/authorCatalog/type.d.mts.map +1 -0
  128. package/dist/services/authorPrompt/index.cjs +2 -0
  129. package/dist/services/authorPrompt/index.cjs.map +1 -0
  130. package/dist/services/authorPrompt/index.mjs +2 -0
  131. package/dist/services/authorPrompt/index.mjs.map +1 -0
  132. package/dist/services/structuredDocuments/common.cjs +2 -0
  133. package/dist/services/structuredDocuments/common.cjs.map +1 -0
  134. package/dist/services/structuredDocuments/common.mjs +2 -0
  135. package/dist/services/structuredDocuments/common.mjs.map +1 -0
  136. package/dist/services/structuredDocuments/csv.cjs +7 -0
  137. package/dist/services/structuredDocuments/csv.cjs.map +1 -0
  138. package/dist/services/structuredDocuments/csv.d.cts +7 -0
  139. package/dist/services/structuredDocuments/csv.d.cts.map +1 -0
  140. package/dist/services/structuredDocuments/csv.d.mts +7 -0
  141. package/dist/services/structuredDocuments/csv.d.mts.map +1 -0
  142. package/dist/services/structuredDocuments/csv.mjs +7 -0
  143. package/dist/services/structuredDocuments/csv.mjs.map +1 -0
  144. package/dist/services/structuredDocuments/document.cjs +2 -0
  145. package/dist/services/structuredDocuments/document.cjs.map +1 -0
  146. package/dist/services/structuredDocuments/document.mjs +2 -0
  147. package/dist/services/structuredDocuments/document.mjs.map +1 -0
  148. package/dist/services/structuredDocuments/index.cjs +2 -0
  149. package/dist/services/structuredDocuments/index.cjs.map +1 -0
  150. package/dist/services/structuredDocuments/index.d.cts +13 -0
  151. package/dist/services/structuredDocuments/index.d.cts.map +1 -0
  152. package/dist/services/structuredDocuments/index.d.mts +13 -0
  153. package/dist/services/structuredDocuments/index.d.mts.map +1 -0
  154. package/dist/services/structuredDocuments/index.mjs +2 -0
  155. package/dist/services/structuredDocuments/index.mjs.map +1 -0
  156. package/dist/services/structuredDocuments/markdownSlides.cjs +6 -0
  157. package/dist/services/structuredDocuments/markdownSlides.cjs.map +1 -0
  158. package/dist/services/structuredDocuments/markdownSlides.d.cts +7 -0
  159. package/dist/services/structuredDocuments/markdownSlides.d.cts.map +1 -0
  160. package/dist/services/structuredDocuments/markdownSlides.d.mts +7 -0
  161. package/dist/services/structuredDocuments/markdownSlides.d.mts.map +1 -0
  162. package/dist/services/structuredDocuments/markdownSlides.mjs +6 -0
  163. package/dist/services/structuredDocuments/markdownSlides.mjs.map +1 -0
  164. package/dist/services/structuredDocuments/ooxmlArchive.cjs +2 -0
  165. package/dist/services/structuredDocuments/ooxmlArchive.cjs.map +1 -0
  166. package/dist/services/structuredDocuments/ooxmlArchive.d.cts +13 -0
  167. package/dist/services/structuredDocuments/ooxmlArchive.d.cts.map +1 -0
  168. package/dist/services/structuredDocuments/ooxmlArchive.d.mts +13 -0
  169. package/dist/services/structuredDocuments/ooxmlArchive.d.mts.map +1 -0
  170. package/dist/services/structuredDocuments/ooxmlArchive.mjs +2 -0
  171. package/dist/services/structuredDocuments/ooxmlArchive.mjs.map +1 -0
  172. package/dist/services/structuredDocuments/pptx.cjs +2 -0
  173. package/dist/services/structuredDocuments/pptx.cjs.map +1 -0
  174. package/dist/services/structuredDocuments/pptx.d.cts +7 -0
  175. package/dist/services/structuredDocuments/pptx.d.cts.map +1 -0
  176. package/dist/services/structuredDocuments/pptx.d.mts +7 -0
  177. package/dist/services/structuredDocuments/pptx.d.mts.map +1 -0
  178. package/dist/services/structuredDocuments/pptx.mjs +2 -0
  179. package/dist/services/structuredDocuments/pptx.mjs.map +1 -0
  180. package/dist/services/structuredDocuments/xlsx.cjs +2 -0
  181. package/dist/services/structuredDocuments/xlsx.cjs.map +1 -0
  182. package/dist/services/structuredDocuments/xlsx.d.cts +7 -0
  183. package/dist/services/structuredDocuments/xlsx.d.cts.map +1 -0
  184. package/dist/services/structuredDocuments/xlsx.d.mts +7 -0
  185. package/dist/services/structuredDocuments/xlsx.d.mts.map +1 -0
  186. package/dist/services/structuredDocuments/xlsx.mjs +2 -0
  187. package/dist/services/structuredDocuments/xlsx.mjs.map +1 -0
  188. package/dist/services/structuredDocuments/xmlText.cjs +2 -0
  189. package/dist/services/structuredDocuments/xmlText.cjs.map +1 -0
  190. package/dist/services/structuredDocuments/xmlText.mjs +2 -0
  191. package/dist/services/structuredDocuments/xmlText.mjs.map +1 -0
  192. package/dist/tools/authorTools.cjs +2 -0
  193. package/dist/tools/authorTools.cjs.map +1 -0
  194. package/dist/tools/authorTools.d.cts +6 -0
  195. package/dist/tools/authorTools.d.cts.map +1 -0
  196. package/dist/tools/authorTools.d.mts +6 -0
  197. package/dist/tools/authorTools.d.mts.map +1 -0
  198. package/dist/tools/authorTools.mjs +2 -0
  199. package/dist/tools/authorTools.mjs.map +1 -0
  200. package/dist/types/author.cjs +2 -0
  201. package/dist/types/author.cjs.map +1 -0
  202. package/dist/types/author.d.cts +39 -0
  203. package/dist/types/author.d.cts.map +1 -0
  204. package/dist/types/author.d.mts +39 -0
  205. package/dist/types/author.d.mts.map +1 -0
  206. package/dist/types/author.mjs +2 -0
  207. package/dist/types/author.mjs.map +1 -0
  208. package/dist/types/authorApi.cjs +2 -0
  209. package/dist/types/authorApi.cjs.map +1 -0
  210. package/dist/types/authorApi.d.cts +23 -0
  211. package/dist/types/authorApi.d.cts.map +1 -0
  212. package/dist/types/authorApi.d.mts +23 -0
  213. package/dist/types/authorApi.d.mts.map +1 -0
  214. package/dist/types/authorApi.mjs +2 -0
  215. package/dist/types/authorApi.mjs.map +1 -0
  216. package/dist/types/extension.d.cts +16 -0
  217. package/dist/types/extension.d.cts.map +1 -0
  218. package/dist/types/extension.d.mts +16 -0
  219. package/dist/types/extension.d.mts.map +1 -0
  220. package/dist/types/structuredDocuments.d.cts +60 -0
  221. package/dist/types/structuredDocuments.d.cts.map +1 -0
  222. package/dist/types/structuredDocuments.d.mts +60 -0
  223. package/dist/types/structuredDocuments.d.mts.map +1 -0
  224. package/dist/types/webAuthor.cjs +2 -0
  225. package/dist/types/webAuthor.cjs.map +1 -0
  226. package/dist/types/webAuthor.d.cts +67 -0
  227. package/dist/types/webAuthor.d.cts.map +1 -0
  228. package/dist/types/webAuthor.d.mts +67 -0
  229. package/dist/types/webAuthor.d.mts.map +1 -0
  230. package/dist/types/webAuthor.mjs +2 -0
  231. package/dist/types/webAuthor.mjs.map +1 -0
  232. package/llms.txt +11 -0
  233. package/package.json +147 -0
  234. package/src/extensions/web.ts +71 -0
  235. package/src/prompts/doompi-use-author/SKILL.md +17 -0
  236. package/src/types/author.ts +45 -0
  237. package/src/types/structuredDocuments.ts +63 -0
  238. package/src/types/webAuthor.ts +85 -0
  239. package/src/web/api/authorBroker.ts +14 -0
  240. package/src/web/api/authorBrowserBridge.ts +229 -0
  241. package/src/web/api/authorFiles.ts +221 -0
  242. package/src/web/api/authorMedia.ts +19 -0
  243. package/src/web/api/authorRuntime.ts +165 -0
  244. package/src/web/components/AuthorDocumentPanel.tsx +233 -0
  245. package/src/web/components/AuthorGridOverlay.tsx +82 -0
  246. package/src/web/components/AuthorMediaPreview.tsx +42 -0
  247. package/src/web/components/AuthorMediaView.tsx +357 -0
  248. package/src/web/components/AuthorPanel.tsx +102 -0
  249. package/src/web/components/AuthorRegionDrafts.tsx +103 -0
  250. package/src/web/components/AuthorRequestLog.tsx +179 -0
  251. package/src/web/components/AuthorStructuredView.tsx +122 -0
  252. package/src/web/components/AuthorTextView.tsx +98 -0
  253. package/src/web/components/AuthorToolPalette.tsx +104 -0
  254. package/src/web/components/AuthorVideoControls.tsx +111 -0
  255. package/src/web/components/DescribeAuthorToolsToolCard.tsx +51 -0
  256. package/src/web/components/OpenAuthoringFileToolCard.tsx +67 -0
  257. package/src/web/components/UseAuthorToolsToolCard.tsx +51 -0
  258. package/src/web/lib/authorGrid.ts +125 -0
  259. package/src/web/lib/authorRegions.ts +30 -0
  260. package/src/web/lib/authorViewportTypes.ts +202 -0
  261. package/src/web/lib/describeAuthorToolsToolRender.ts +20 -0
  262. package/src/web/lib/useAuthorToolsToolRender.ts +20 -0
  263. package/src/web/stores/authorCapture.ts +323 -0
  264. package/src/web/stores/authorGridTools.ts +316 -0
  265. package/src/web/stores/authorProfiles.ts +130 -0
  266. package/src/web/stores/authorRequestLifecycle.ts +83 -0
  267. package/src/web/stores/authorStore.ts +61 -0
  268. package/src/web/stores/authorWorkspaceStore.ts +526 -0
  269. package/src/web/tsconfig.json +22 -0
package/package.json ADDED
@@ -0,0 +1,147 @@
1
+ {
2
+ "name": "@agimon-ai/doompi-author",
3
+ "version": "0.0.1-alpha.10",
4
+ "description": "Visual steering workspace for focused document review and bounded authoring",
5
+ "keywords": [
6
+ "ai",
7
+ "authoring",
8
+ "coding-agent",
9
+ "developer-tools",
10
+ "doompi",
11
+ "pi-coding-agent",
12
+ "pi-extension",
13
+ "pi-package",
14
+ "typescript"
15
+ ],
16
+ "homepage": "https://agimon.ai",
17
+ "bugs": {
18
+ "url": "https://github.com/AgiFlow/doompi/issues"
19
+ },
20
+ "license": "MIT",
21
+ "author": "Vuong Ngo",
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/AgiFlow/doompi.git",
25
+ "directory": "packages/minor/doompi-author"
26
+ },
27
+ "files": [
28
+ "dist",
29
+ "src/web",
30
+ "src/types/author.ts",
31
+ "src/types/webAuthor.ts",
32
+ "src/types/structuredDocuments.ts",
33
+ "src/extensions/web.ts",
34
+ "src/prompts",
35
+ "llms.txt",
36
+ "README.md",
37
+ "LICENSE",
38
+ "package.json",
39
+ "!src/web/**/*.stories.tsx"
40
+ ],
41
+ "type": "module",
42
+ "main": "./dist/index.cjs",
43
+ "types": "./dist/index.d.mts",
44
+ "jsnext:main": "./dist/index.mjs",
45
+ "exports": {
46
+ ".": {
47
+ "types": "./dist/index.d.mts",
48
+ "import": "./dist/index.mjs",
49
+ "require": "./dist/index.cjs"
50
+ },
51
+ "./extensions/pi": {
52
+ "types": "./dist/extensions/pi.d.mts",
53
+ "import": "./dist/extensions/pi.mjs",
54
+ "require": "./dist/extensions/pi.cjs"
55
+ },
56
+ "./extensions/server": {
57
+ "types": "./dist/extensions/server.d.mts",
58
+ "import": "./dist/extensions/server.mjs",
59
+ "require": "./dist/extensions/server.cjs"
60
+ },
61
+ "./package.json": "./package.json",
62
+ "./author-facade": {
63
+ "types": "./dist/authorFacade.d.mts",
64
+ "import": "./dist/authorFacade.mjs",
65
+ "require": "./dist/authorFacade.cjs"
66
+ }
67
+ },
68
+ "publishConfig": {
69
+ "access": "public"
70
+ },
71
+ "dependencies": {
72
+ "@agimon-ai/doompi-core": "0.0.1-alpha.72",
73
+ "@agimon-ai/doompi-minor-mode": "0.0.1-alpha.72",
74
+ "@agimon-ai/doompi-web-components": "0.0.1-alpha.30",
75
+ "@agimon-ai/doompi-web-security": "0.0.1-alpha.32",
76
+ "@deepseek-ai/cordis": "4.0.2",
77
+ "csv-parse": "7.0.2",
78
+ "hono": "4.13.7",
79
+ "saxes": "6.0.0",
80
+ "typebox": "1.3.30",
81
+ "yauzl": "3.4.0",
82
+ "yazl": "3.3.1"
83
+ },
84
+ "devDependencies": {
85
+ "@agimon-ai/vibe-lint-plugin-doom-extension": "0.0.1-alpha.67",
86
+ "@earendil-works/pi-coding-agent": "0.85.1",
87
+ "@tanstack/react-store": "0.11.1",
88
+ "@tanstack/store": "0.11.1",
89
+ "@types/node": "26.5.1",
90
+ "@types/react": "19.3.0",
91
+ "@types/react-dom": "19.3.0",
92
+ "@types/yauzl": "3.4.0",
93
+ "@types/yazl": "3.3.1",
94
+ "@vitest/coverage-v8": "5.0.0",
95
+ "react": "19.3.0",
96
+ "react-dom": "19.3.0",
97
+ "tsdown": "0.23.0",
98
+ "typescript": "7.0.2",
99
+ "vitest": "5.0.0"
100
+ },
101
+ "peerDependencies": {
102
+ "@earendil-works/pi-coding-agent": "0.85.1"
103
+ },
104
+ "peerDependenciesMeta": {
105
+ "@earendil-works/pi-coding-agent": {
106
+ "optional": true
107
+ }
108
+ },
109
+ "engines": {
110
+ "node": ">=22.19.0"
111
+ },
112
+ "doompiServer": {
113
+ "entry": "./src/extensions/server.ts",
114
+ "dist": "./dist/extensions/server.mjs",
115
+ "scopes": [
116
+ "global",
117
+ "workspace",
118
+ "session"
119
+ ],
120
+ "contracts": {
121
+ "entry": "./src/exports/apiContracts.ts",
122
+ "dist": "./dist/api-contracts.mjs"
123
+ }
124
+ },
125
+ "doompiWeb": {
126
+ "pluginId": "author",
127
+ "channels": [
128
+ "author_webmcp"
129
+ ],
130
+ "client": "./src/extensions/web.ts",
131
+ "scopes": [
132
+ "session"
133
+ ]
134
+ },
135
+ "pi": {
136
+ "extensions": [
137
+ "./dist/extensions/pi.mjs"
138
+ ]
139
+ },
140
+ "scripts": {
141
+ "build": "tsdown",
142
+ "test": "vitest --run",
143
+ "typecheck": "tsc --noEmit && tsc --noEmit -p src/web/tsconfig.json",
144
+ "lint": "oxlint . && oxfmt . --check",
145
+ "fixcode": "oxlint . --fix && oxfmt ."
146
+ }
147
+ }
@@ -0,0 +1,71 @@
1
+ import { defineWebPlugin, type WebPluginRuntime } from '@agimon-ai/doompi-core/web';
2
+
3
+ import { startAuthorBrowserBridge } from '../web/api/authorBrowserBridge';
4
+ import { authorFileLinks } from '../web/components/AuthorDocumentPanel';
5
+ import { AuthorPanel } from '../web/components/AuthorPanel';
6
+ import { DescribeAuthorToolsToolCard } from '../web/components/DescribeAuthorToolsToolCard';
7
+ import { OpenAuthoringFileToolCard } from '../web/components/OpenAuthoringFileToolCard';
8
+ import { UseAuthorToolsToolCard } from '../web/components/UseAuthorToolsToolCard';
9
+ import { recordAuthorCaptureStatus, recordAuthorComposerSubmission } from '../web/stores/authorRequestLifecycle';
10
+ import { authorChannel } from '../web/stores/authorStore';
11
+ import { authorWorkspace } from '../web/stores/authorWorkspaceStore';
12
+
13
+ /**
14
+ * This package's cockpit presence: the named export the generated plugin
15
+ * registry imports. Plugins are independent, so nothing here depends on
16
+ * install order; every relation to another plugin resolves by name.
17
+ */
18
+ function startAuthor(runtime: WebPluginRuntime): () => void {
19
+ const stopBridge = startAuthorBrowserBridge(runtime);
20
+ const stopSubmissions = runtime.onComposerSubmitted?.(recordAuthorComposerSubmission) ?? (() => undefined);
21
+ const stopCaptureStatus = runtime.onCaptureStatus?.(recordAuthorCaptureStatus) ?? (() => undefined);
22
+ return () => {
23
+ stopSubmissions();
24
+ stopCaptureStatus();
25
+ stopBridge();
26
+ };
27
+ }
28
+
29
+ export const webPlugin = defineWebPlugin({
30
+ id: 'author',
31
+ session: {
32
+ dockFaces: [
33
+ {
34
+ id: 'authoring',
35
+ label: 'authoring',
36
+ order: 30,
37
+ autoSelect: true,
38
+ panel: AuthorPanel,
39
+ requiredMinorMode: 'author',
40
+ visibility: {
41
+ subscribe(listener) {
42
+ const subscription = authorWorkspace.store.subscribe(listener);
43
+ return () => subscription.unsubscribe();
44
+ },
45
+ isVisible(sessionId) {
46
+ return sessionId !== null && authorWorkspace.store.state.sessions[sessionId]?.focusedDocument !== undefined;
47
+ },
48
+ },
49
+ },
50
+ ],
51
+ minorModes: [{ name: 'author', keys: 'o a', order: 45 }],
52
+ leaderBindings: [
53
+ {
54
+ id: 'author.toggle',
55
+ path: [
56
+ { key: 'o', label: 'other', detail: 'optional modes and tools' },
57
+ { key: 'a', label: 'author', detail: 'enable or disable focused document authoring' },
58
+ ],
59
+ command: 'minor author',
60
+ },
61
+ ],
62
+ channels: [authorChannel],
63
+ fileLinks: authorFileLinks,
64
+ toolRenderers: [
65
+ { tools: ['open_authoring_file'], message: OpenAuthoringFileToolCard },
66
+ { tools: ['describe_author_tools'], message: DescribeAuthorToolsToolCard },
67
+ { tools: ['use_author_tools'], message: UseAuthorToolsToolCard },
68
+ ],
69
+ start: startAuthor,
70
+ },
71
+ });
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: doompi-use-author
3
+ description: 'Use @agimon-ai/doompi-author: Visual steering workspace for focused document review and bounded authoring'
4
+ ---
5
+
6
+ # Use Author
7
+
8
+ Read the package [README](../../../README.md) for its exact installation, command, configuration, and behavior.
9
+
10
+ ## Guidance
11
+
12
+ - Use `/doom-author` as the package's primary Pi entrypoint.
13
+ - Treat the package README and its linked resources as the source of truth for package-specific behavior.
14
+ - Do not require DoomPi Help for runtime activation. Help only makes this package guidance discoverable while the minor mode is active.
15
+ - Autonomous Voice coordinates are evidence, not mutation authority. Call `author_describe_grid`, then `author_resolve_grid_cell` with the returned geometry token and the user's verbatim instruction.
16
+ - Mutate only through the resulting `regionId` with `author_apply_region`, passing the expected revision and source digest. Apply multi-region requests sequentially and use the revision returned by each successful mutation for the next region. On `STALE_GRID`, `STALE_DOCUMENT`, or `STALE_REGION`, describe and resolve again.
17
+ - Text, Markdown, editable cells, slide text, and image crop support mutation. PDF and video regions are capture-only.
@@ -0,0 +1,45 @@
1
+ export const AUTHOR_MODE_ID = 'author' as const;
2
+ export const OPEN_AUTHORING_FILE_TOOL_NAME = 'open_authoring_file' as const;
3
+
4
+ export type AuthorModeActivation = 'inactive' | 'active';
5
+
6
+ export interface AuthorModeSnapshot {
7
+ activation: AuthorModeActivation;
8
+ catalogToken: string;
9
+ capabilityCount: number;
10
+ }
11
+
12
+ export type AuthorJsonSchema = Readonly<Record<string, unknown>>;
13
+
14
+ export interface AuthorViewportCapabilityDescriptor {
15
+ name: string;
16
+ label: string;
17
+ description: string;
18
+ inputSchema: AuthorJsonSchema;
19
+ }
20
+
21
+ export interface AuthorViewportCapability extends AuthorViewportCapabilityDescriptor {
22
+ execute(argumentsValue: Record<string, unknown>, signal?: AbortSignal): Promise<unknown>;
23
+ }
24
+
25
+ export interface AuthorViewportCatalogSnapshot {
26
+ catalogToken: string;
27
+ tools: AuthorViewportCapabilityDescriptor[];
28
+ }
29
+
30
+ export interface AuthorOpenFileResult {
31
+ path: string;
32
+ byteLength: number;
33
+ }
34
+
35
+ export interface UseAuthorToolInput {
36
+ catalogToken: string;
37
+ name: string;
38
+ arguments: Record<string, unknown>;
39
+ }
40
+
41
+ export interface AuthorToolResult {
42
+ catalogToken: string;
43
+ name: string;
44
+ result: unknown;
45
+ }
@@ -0,0 +1,63 @@
1
+ export type StructuredDocumentFormat = 'markdown-slides' | 'csv' | 'pptx' | 'xlsx';
2
+
3
+ export interface DocumentManifest {
4
+ format: StructuredDocumentFormat;
5
+ sourceDigest: string;
6
+ byteLength: number;
7
+ fragmentCount: number;
8
+ metadata: Record<string, string | number | boolean>;
9
+ }
10
+
11
+ export interface DocumentFragment {
12
+ id: string;
13
+ kind: 'slide' | 'cell' | 'text-run';
14
+ text: string;
15
+ readOnly?: boolean;
16
+ location: string;
17
+ }
18
+
19
+ export interface DocumentRenderModel {
20
+ format: StructuredDocumentFormat;
21
+ blocks: Array<{ id: string; text: string; readOnly: boolean }>;
22
+ }
23
+
24
+ export interface DocumentOperation {
25
+ fragmentId: string;
26
+ replacement: string;
27
+ }
28
+
29
+ export interface DocumentOperationLogEntry extends DocumentOperation {
30
+ previous: string;
31
+ }
32
+
33
+ export interface DocumentPreflightIssue {
34
+ code: string;
35
+ message: string;
36
+ fragmentId?: string;
37
+ }
38
+
39
+ export interface DocumentPreflightReport {
40
+ accepted: boolean;
41
+ digest: string;
42
+ sourceDigest: string;
43
+ operations: DocumentOperationLogEntry[];
44
+ issues: DocumentPreflightIssue[];
45
+ }
46
+
47
+ export interface ParsedStructuredDocument {
48
+ manifest: DocumentManifest;
49
+ fragments: DocumentFragment[];
50
+ renderModel: DocumentRenderModel;
51
+ }
52
+
53
+ export interface SerializedStructuredDocument {
54
+ bytes: Uint8Array;
55
+ operationLog: DocumentOperationLogEntry[];
56
+ manifest: DocumentManifest;
57
+ }
58
+
59
+ export interface CsvDialect {
60
+ delimiter: ',' | ';' | '\t' | '|';
61
+ quote: '"' | "'";
62
+ recordDelimiter: '\n' | '\r\n';
63
+ }
@@ -0,0 +1,85 @@
1
+ import type { AuthorViewportCapabilityDescriptor } from './author';
2
+
3
+ export const authorChannelType = 'author_webmcp';
4
+
5
+ export interface AuthorRegisterMessage {
6
+ kind: 'register';
7
+ generation: number;
8
+ }
9
+
10
+ export interface AuthorReleaseMessage {
11
+ kind: 'release';
12
+ generation: number;
13
+ }
14
+ export interface AuthorCatalogMessage {
15
+ kind: 'catalog';
16
+ generation: number;
17
+ ownerToken: string;
18
+ tools: AuthorViewportCapabilityDescriptor[];
19
+ }
20
+
21
+ export interface AuthorResultMessage {
22
+ kind: 'result';
23
+ generation: number;
24
+ ownerToken: string;
25
+ catalogToken: string;
26
+ requestId: string;
27
+ result: unknown;
28
+ }
29
+
30
+ export interface AuthorCancelledMessage {
31
+ kind: 'cancelled';
32
+ generation: number;
33
+ ownerToken: string;
34
+ catalogToken: string;
35
+ requestId: string;
36
+ }
37
+
38
+ export type AuthorBrowserMessage =
39
+ | AuthorRegisterMessage
40
+ | AuthorReleaseMessage
41
+ | AuthorCatalogMessage
42
+ | AuthorResultMessage
43
+ | AuthorCancelledMessage;
44
+
45
+ export interface AuthorAcceptedMessage {
46
+ kind: 'accepted';
47
+ generation: number;
48
+ ownerToken: string;
49
+ catalogToken?: string;
50
+ leaseMs: number;
51
+ }
52
+
53
+ export interface AuthorRequestMessage {
54
+ kind: 'request';
55
+ generation: number;
56
+ ownerToken: string;
57
+ catalogToken: string;
58
+ requestId: string;
59
+ name: string;
60
+ arguments: Record<string, unknown>;
61
+ }
62
+
63
+ export interface AuthorCancelMessage {
64
+ kind: 'cancel';
65
+ generation: number;
66
+ ownerToken: string;
67
+ catalogToken: string;
68
+ requestId: string;
69
+ }
70
+
71
+ export interface AuthorRejectedMessage {
72
+ kind: 'rejected';
73
+ reason: string;
74
+ }
75
+
76
+ export type AuthorHubMessage =
77
+ | AuthorAcceptedMessage
78
+ | AuthorRequestMessage
79
+ | AuthorCancelMessage
80
+ | AuthorRejectedMessage;
81
+
82
+ export interface AuthorWebView {
83
+ activation: 'inactive' | 'active';
84
+ capabilityCount: number;
85
+ }
@@ -0,0 +1,14 @@
1
+ import type { ModelContext } from '@agimon-ai/doompi-core/web';
2
+
3
+ /** Client-side broker transport. Calls always cross Model Context's execution boundary. */
4
+ export class AuthorClientBroker {
5
+ readonly #modelContext: ModelContext;
6
+
7
+ constructor(modelContext: ModelContext) {
8
+ this.#modelContext = modelContext;
9
+ }
10
+
11
+ execute(name: string, input: unknown, signal: AbortSignal): Promise<unknown> {
12
+ return this.#modelContext.executeTool(name, JSON.stringify(input), { signal });
13
+ }
14
+ }
@@ -0,0 +1,229 @@
1
+ import type { WebPluginRuntime } from '@agimon-ai/doompi-core/web';
2
+ import { Store } from '@tanstack/store';
3
+
4
+ import type { AuthorBrowserMessage, AuthorHubMessage } from '../../types/webAuthor';
5
+ import type { AuthorTrustedProfile } from '../lib/authorViewportTypes';
6
+ import { AuthorRuntime } from './authorRuntime';
7
+
8
+ interface ActiveViewport {
9
+ sessionId: string;
10
+ generation: number;
11
+ profiles: readonly AuthorTrustedProfile[];
12
+ release: () => void;
13
+ ownerToken?: string;
14
+ catalogToken?: string;
15
+ }
16
+
17
+ class AuthorBrowserBridge {
18
+ readonly #host: WebPluginRuntime;
19
+ readonly #runtime: AuthorRuntime;
20
+ readonly #pending = new Map<string, AbortController>();
21
+ #active: ActiveViewport | undefined;
22
+ #generation = 0;
23
+ #disposed = false;
24
+ readonly #releaseConnected: () => void;
25
+ #leaseTimer: ReturnType<typeof setTimeout> | undefined;
26
+
27
+ constructor(host: WebPluginRuntime) {
28
+ this.#host = host;
29
+ this.#runtime = new AuthorRuntime(host);
30
+ this.#releaseConnected = host.onHubConnected(() => {
31
+ if (this.#active !== undefined) {
32
+ this.#active.ownerToken = undefined;
33
+ this.#active.catalogToken = undefined;
34
+ }
35
+ this.#register();
36
+ });
37
+ }
38
+
39
+ async focus(sessionId: string, profiles: readonly AuthorTrustedProfile[]): Promise<() => void> {
40
+ if (this.#disposed) throw new Error('Author browser bridge is disposed');
41
+ const generation = ++this.#generation;
42
+ const release = await this.#runtime.replaceProfiles(profiles);
43
+ if (this.#disposed || generation !== this.#generation) {
44
+ release();
45
+ return () => undefined;
46
+ }
47
+ this.#clearActive();
48
+ this.#active = { sessionId, generation, profiles, release };
49
+ this.#register();
50
+ return () => {
51
+ if (this.#active?.generation !== generation) return;
52
+ this.#clearActive();
53
+ this.#generation += 1;
54
+ };
55
+ }
56
+
57
+ drop(sessionId: string): void {
58
+ if (this.#active?.sessionId !== sessionId) return;
59
+ this.#clearActive();
60
+ this.#generation += 1;
61
+ }
62
+
63
+ apply(sessionId: string, message: AuthorHubMessage): void {
64
+ const active = this.#active;
65
+ if (active === undefined || active.sessionId !== sessionId || message.kind === 'rejected') return;
66
+ if (
67
+ message.generation !== active.generation ||
68
+ (message.ownerToken !== active.ownerToken && active.ownerToken !== undefined)
69
+ )
70
+ return;
71
+ if (message.kind === 'accepted') {
72
+ active.ownerToken = message.ownerToken;
73
+ clearTimeout(this.#leaseTimer);
74
+ this.#leaseTimer = setTimeout(() => this.#register(), Math.max(1000, Math.floor(message.leaseMs / 2)));
75
+ if (message.catalogToken === undefined) this.#sendCatalog(active);
76
+ else active.catalogToken = message.catalogToken;
77
+ return;
78
+ }
79
+ if (message.catalogToken !== active.catalogToken) return;
80
+ if (message.kind === 'cancel') {
81
+ this.#pending.get(message.requestId)?.abort(new Error('Author tool request cancelled'));
82
+ return;
83
+ }
84
+ if (message.kind !== 'request' || this.#pending.has(message.requestId)) return;
85
+ const controller = new AbortController();
86
+ this.#pending.set(message.requestId, controller);
87
+ void this.#runtime
88
+ .execute(message.name, message.arguments, controller.signal)
89
+ .then((result) => {
90
+ if (!this.#current(active, message.requestId, controller)) return;
91
+ if (controller.signal.aborted) this.#sendCancelled(active, message.requestId);
92
+ else
93
+ this.#send(active.sessionId, {
94
+ kind: 'result',
95
+ generation: active.generation,
96
+ ownerToken: active.ownerToken!,
97
+ catalogToken: active.catalogToken!,
98
+ requestId: message.requestId,
99
+ result,
100
+ });
101
+ })
102
+ .catch((error: unknown) => {
103
+ if (!this.#current(active, message.requestId, controller)) return;
104
+ if (controller.signal.aborted) this.#sendCancelled(active, message.requestId);
105
+ else {
106
+ const messageText = error instanceof Error ? error.message : String(error);
107
+ const code = /^([A-Z][A-Z_]+):/u.exec(messageText)?.[1] ?? 'AUTHOR_TOOL_ERROR';
108
+ this.#send(active.sessionId, {
109
+ kind: 'result',
110
+ generation: active.generation,
111
+ ownerToken: active.ownerToken!,
112
+ catalogToken: active.catalogToken!,
113
+ requestId: message.requestId,
114
+ result: { error: { code, message: messageText } },
115
+ });
116
+ }
117
+ })
118
+ .finally(() => {
119
+ if (this.#pending.get(message.requestId) === controller) this.#pending.delete(message.requestId);
120
+ });
121
+ }
122
+
123
+ activeView(sessionId: string): { activation: 'inactive' | 'active'; capabilityCount: number } {
124
+ const active = this.#active;
125
+ return active?.sessionId === sessionId && active.catalogToken !== undefined
126
+ ? {
127
+ activation: 'active',
128
+ capabilityCount: active.profiles.reduce((count, profile) => count + profile.tools.length, 0),
129
+ }
130
+ : { activation: 'inactive', capabilityCount: 0 };
131
+ }
132
+
133
+ dispose(): void {
134
+ if (this.#disposed) return;
135
+ this.#disposed = true;
136
+ clearTimeout(this.#leaseTimer);
137
+ this.#releaseConnected();
138
+ this.#clearActive();
139
+ this.#runtime.dispose();
140
+ }
141
+
142
+ #register(): void {
143
+ const active = this.#active;
144
+ if (active !== undefined) this.#send(active.sessionId, { kind: 'register', generation: active.generation });
145
+ }
146
+
147
+ #sendCatalog(active: ActiveViewport): void {
148
+ this.#send(active.sessionId, {
149
+ kind: 'catalog',
150
+ generation: active.generation,
151
+ ownerToken: active.ownerToken!,
152
+ tools: active.profiles.flatMap((profile) =>
153
+ profile.tools.map((tool) => ({
154
+ name: tool.name,
155
+ label: tool.label ?? tool.name,
156
+ description: tool.description,
157
+ inputSchema: tool.inputSchema,
158
+ })),
159
+ ),
160
+ });
161
+ }
162
+
163
+ #sendCancelled(active: ActiveViewport, requestId: string): void {
164
+ this.#send(active.sessionId, {
165
+ kind: 'cancelled',
166
+ generation: active.generation,
167
+ ownerToken: active.ownerToken!,
168
+ catalogToken: active.catalogToken!,
169
+ requestId,
170
+ });
171
+ }
172
+
173
+ #send(sessionId: string, payload: AuthorBrowserMessage): void {
174
+ const workspaceId = this.#host.mount?.scope === 'session' ? this.#host.mount.workspaceId : undefined;
175
+ const mount = workspaceId ? { scope: 'workspace' as const, workspaceId } : { scope: 'global' as const };
176
+ void this.#host
177
+ .invokeServerMethod({ mount, service: 'author.bridge', method: 'send', input: { sessionId, message: payload } })
178
+ .catch(() => undefined);
179
+ }
180
+
181
+ #current(active: ActiveViewport, requestId: string, controller: AbortController): boolean {
182
+ return this.#active === active && this.#pending.get(requestId) === controller;
183
+ }
184
+
185
+ #clearActive(): void {
186
+ clearTimeout(this.#leaseTimer);
187
+ this.#leaseTimer = undefined;
188
+ const active = this.#active;
189
+ if (active !== undefined) {
190
+ this.#send(active.sessionId, { kind: 'release', generation: active.generation });
191
+ active.release();
192
+ }
193
+ this.#active = undefined;
194
+ for (const controller of this.#pending.values()) controller.abort(new Error('Author viewport changed'));
195
+ this.#pending.clear();
196
+ }
197
+ }
198
+
199
+ const authorBridgeRuntime = new Store<AuthorBrowserBridge | undefined>(undefined);
200
+
201
+ export function startAuthorBrowserBridge(runtime: WebPluginRuntime): () => void {
202
+ authorBridgeRuntime.state?.dispose();
203
+ const next = new AuthorBrowserBridge(runtime);
204
+ authorBridgeRuntime.setState(() => next);
205
+ return () => {
206
+ if (authorBridgeRuntime.state !== next) return;
207
+ next.dispose();
208
+ authorBridgeRuntime.setState(() => undefined);
209
+ };
210
+ }
211
+
212
+ export async function focusAuthorViewport(
213
+ sessionId: string,
214
+ profiles: readonly AuthorTrustedProfile[],
215
+ ): Promise<() => void> {
216
+ return (await authorBridgeRuntime.state?.focus(sessionId, profiles)) ?? (() => undefined);
217
+ }
218
+
219
+ export function applyAuthorHubMessage(sessionId: string, message: AuthorHubMessage): void {
220
+ authorBridgeRuntime.state?.apply(sessionId, message);
221
+ }
222
+
223
+ export function dropAuthorViewportSession(sessionId: string): void {
224
+ authorBridgeRuntime.state?.drop(sessionId);
225
+ }
226
+
227
+ export function authorBridgeView(sessionId: string): { activation: 'inactive' | 'active'; capabilityCount: number } {
228
+ return authorBridgeRuntime.state?.activeView(sessionId) ?? { activation: 'inactive', capabilityCount: 0 };
229
+ }