@agimon-ai/doompi-author 0.0.1-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +37 -0
- package/dist/_virtual/_rolldown/runtime.cjs +1 -0
- package/dist/adapters/authorApi.cjs +2 -0
- package/dist/adapters/authorApi.cjs.map +1 -0
- package/dist/adapters/authorBridgeApi.cjs +2 -0
- package/dist/adapters/authorBridgeApi.cjs.map +1 -0
- package/dist/adapters/authorDocumentApi.cjs +2 -0
- package/dist/adapters/authorDocumentApi.cjs.map +1 -0
- package/dist/adapters/pi/authorBridgeClient.cjs +2 -0
- package/dist/adapters/pi/authorBridgeClient.cjs.map +1 -0
- package/dist/adapters/pi/authorTools.cjs +2 -0
- package/dist/adapters/pi/authorTools.cjs.map +1 -0
- package/dist/adapters/pi/extension.cjs +2 -0
- package/dist/adapters/pi/extension.cjs.map +1 -0
- package/dist/adapters/structuredDocuments/common.cjs +2 -0
- package/dist/adapters/structuredDocuments/common.cjs.map +1 -0
- package/dist/adapters/structuredDocuments/csv.cjs +7 -0
- package/dist/adapters/structuredDocuments/csv.cjs.map +1 -0
- package/dist/adapters/structuredDocuments/index.cjs +2 -0
- package/dist/adapters/structuredDocuments/index.cjs.map +1 -0
- package/dist/adapters/structuredDocuments/markdownSlides.cjs +6 -0
- package/dist/adapters/structuredDocuments/markdownSlides.cjs.map +1 -0
- package/dist/adapters/structuredDocuments/ooxmlArchive.cjs +2 -0
- package/dist/adapters/structuredDocuments/ooxmlArchive.cjs.map +1 -0
- package/dist/adapters/structuredDocuments/pptx.cjs +2 -0
- package/dist/adapters/structuredDocuments/pptx.cjs.map +1 -0
- package/dist/adapters/structuredDocuments/xlsx.cjs +2 -0
- package/dist/adapters/structuredDocuments/xlsx.cjs.map +1 -0
- package/dist/adapters/structuredDocuments/xmlText.cjs +2 -0
- package/dist/adapters/structuredDocuments/xmlText.cjs.map +1 -0
- package/dist/adapters/webAuthorChannel.cjs +2 -0
- package/dist/adapters/webAuthorChannel.cjs.map +1 -0
- package/dist/commands/doomAuthorCommand.cjs +2 -0
- package/dist/commands/doomAuthorCommand.cjs.map +1 -0
- package/dist/container/index.cjs +2 -0
- package/dist/container/index.cjs.map +1 -0
- package/dist/extensions/pi.cjs +1 -0
- package/dist/extensions/pi.d.cts +2 -0
- package/dist/extensions/pi.d.mts +2 -0
- package/dist/extensions/pi.mjs +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +21 -0
- package/dist/index.d.mts +21 -0
- package/dist/index.mjs +1 -0
- package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/engine/helpers/union.d.cts +6 -0
- package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/engine/helpers/union.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/engine/helpers/union.d.mts +6 -0
- package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/engine/helpers/union.d.mts.map +1 -0
- package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/_optional.d.cts +7 -0
- package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/_optional.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/_optional.d.mts +7 -0
- package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/_optional.d.mts.map +1 -0
- package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/object.d.cts +12 -0
- package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/object.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/object.d.mts +12 -0
- package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/object.d.mts.map +1 -0
- package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/properties.d.cts +12 -0
- package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/properties.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/properties.d.mts +12 -0
- package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/properties.d.mts.map +1 -0
- package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/record.d.cts +9 -0
- package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/record.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/record.d.mts +9 -0
- package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/record.d.mts.map +1 -0
- package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/schema.d.cts +4 -0
- package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/schema.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/schema.d.mts +4 -0
- package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/schema.d.mts.map +1 -0
- package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/string.d.cts +9 -0
- package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/string.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/string.d.mts +9 -0
- package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/string.d.mts.map +1 -0
- package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/unknown.d.cts +8 -0
- package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/unknown.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/unknown.d.mts +8 -0
- package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/unknown.d.mts.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/authorApi.d.cts +15 -0
- package/dist/packages/minor/doompi-author/src/adapters/authorApi.d.cts.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/authorApi.d.mts +15 -0
- package/dist/packages/minor/doompi-author/src/adapters/authorApi.d.mts.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/authorApi.mjs +2 -0
- package/dist/packages/minor/doompi-author/src/adapters/authorApi.mjs.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/authorBridgeApi.d.cts +6 -0
- package/dist/packages/minor/doompi-author/src/adapters/authorBridgeApi.d.cts.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/authorBridgeApi.d.mts +6 -0
- package/dist/packages/minor/doompi-author/src/adapters/authorBridgeApi.d.mts.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/authorBridgeApi.mjs +2 -0
- package/dist/packages/minor/doompi-author/src/adapters/authorBridgeApi.mjs.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/authorDocumentApi.d.cts +11 -0
- package/dist/packages/minor/doompi-author/src/adapters/authorDocumentApi.d.cts.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/authorDocumentApi.d.mts +11 -0
- package/dist/packages/minor/doompi-author/src/adapters/authorDocumentApi.d.mts.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/authorDocumentApi.mjs +2 -0
- package/dist/packages/minor/doompi-author/src/adapters/authorDocumentApi.mjs.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/pi/authorBridgeClient.d.cts +18 -0
- package/dist/packages/minor/doompi-author/src/adapters/pi/authorBridgeClient.d.cts.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/pi/authorBridgeClient.d.mts +18 -0
- package/dist/packages/minor/doompi-author/src/adapters/pi/authorBridgeClient.d.mts.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/pi/authorBridgeClient.mjs +2 -0
- package/dist/packages/minor/doompi-author/src/adapters/pi/authorBridgeClient.mjs.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/pi/authorTools.d.cts +9 -0
- package/dist/packages/minor/doompi-author/src/adapters/pi/authorTools.d.cts.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/pi/authorTools.d.mts +9 -0
- package/dist/packages/minor/doompi-author/src/adapters/pi/authorTools.d.mts.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/pi/authorTools.mjs +2 -0
- package/dist/packages/minor/doompi-author/src/adapters/pi/authorTools.mjs.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/pi/extension.d.cts +19 -0
- package/dist/packages/minor/doompi-author/src/adapters/pi/extension.d.cts.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/pi/extension.d.mts +19 -0
- package/dist/packages/minor/doompi-author/src/adapters/pi/extension.d.mts.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/pi/extension.mjs +2 -0
- package/dist/packages/minor/doompi-author/src/adapters/pi/extension.mjs.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/common.mjs +2 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/common.mjs.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/csv.d.cts +7 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/csv.d.cts.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/csv.d.mts +7 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/csv.d.mts.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/csv.mjs +7 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/csv.mjs.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/index.d.cts +13 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/index.d.cts.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/index.d.mts +13 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/index.d.mts.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/index.mjs +2 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/index.mjs.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/markdownSlides.d.cts +7 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/markdownSlides.d.cts.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/markdownSlides.d.mts +7 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/markdownSlides.d.mts.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/markdownSlides.mjs +6 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/markdownSlides.mjs.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/ooxmlArchive.d.cts +13 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/ooxmlArchive.d.cts.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/ooxmlArchive.d.mts +13 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/ooxmlArchive.d.mts.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/ooxmlArchive.mjs +2 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/ooxmlArchive.mjs.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/pptx.d.cts +7 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/pptx.d.cts.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/pptx.d.mts +7 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/pptx.d.mts.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/pptx.mjs +2 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/pptx.mjs.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/xlsx.d.cts +7 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/xlsx.d.cts.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/xlsx.d.mts +7 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/xlsx.d.mts.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/xlsx.mjs +2 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/xlsx.mjs.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/xmlText.mjs +2 -0
- package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/xmlText.mjs.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/webAuthorChannel.d.cts +6 -0
- package/dist/packages/minor/doompi-author/src/adapters/webAuthorChannel.d.cts.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/webAuthorChannel.d.mts +6 -0
- package/dist/packages/minor/doompi-author/src/adapters/webAuthorChannel.d.mts.map +1 -0
- package/dist/packages/minor/doompi-author/src/adapters/webAuthorChannel.mjs +2 -0
- package/dist/packages/minor/doompi-author/src/adapters/webAuthorChannel.mjs.map +1 -0
- package/dist/packages/minor/doompi-author/src/commands/doomAuthorCommand.mjs +2 -0
- package/dist/packages/minor/doompi-author/src/commands/doomAuthorCommand.mjs.map +1 -0
- package/dist/packages/minor/doompi-author/src/container/index.d.cts +5 -0
- package/dist/packages/minor/doompi-author/src/container/index.d.cts.map +1 -0
- package/dist/packages/minor/doompi-author/src/container/index.d.mts +5 -0
- package/dist/packages/minor/doompi-author/src/container/index.d.mts.map +1 -0
- package/dist/packages/minor/doompi-author/src/container/index.mjs +2 -0
- package/dist/packages/minor/doompi-author/src/container/index.mjs.map +1 -0
- package/dist/packages/minor/doompi-author/src/schemas/authorTools.d.cts +16 -0
- package/dist/packages/minor/doompi-author/src/schemas/authorTools.d.cts.map +1 -0
- package/dist/packages/minor/doompi-author/src/schemas/authorTools.d.mts +16 -0
- package/dist/packages/minor/doompi-author/src/schemas/authorTools.d.mts.map +1 -0
- package/dist/packages/minor/doompi-author/src/schemas/authorTools.mjs +2 -0
- package/dist/packages/minor/doompi-author/src/schemas/authorTools.mjs.map +1 -0
- package/dist/packages/minor/doompi-author/src/services/authorBridgeState.d.cts +31 -0
- package/dist/packages/minor/doompi-author/src/services/authorBridgeState.d.cts.map +1 -0
- package/dist/packages/minor/doompi-author/src/services/authorBridgeState.d.mts +31 -0
- package/dist/packages/minor/doompi-author/src/services/authorBridgeState.d.mts.map +1 -0
- package/dist/packages/minor/doompi-author/src/services/authorBridgeState.mjs +2 -0
- package/dist/packages/minor/doompi-author/src/services/authorBridgeState.mjs.map +1 -0
- package/dist/packages/minor/doompi-author/src/services/authorCatalog.d.cts +10 -0
- package/dist/packages/minor/doompi-author/src/services/authorCatalog.d.cts.map +1 -0
- package/dist/packages/minor/doompi-author/src/services/authorCatalog.d.mts +10 -0
- package/dist/packages/minor/doompi-author/src/services/authorCatalog.d.mts.map +1 -0
- package/dist/packages/minor/doompi-author/src/services/authorMode.d.cts +19 -0
- package/dist/packages/minor/doompi-author/src/services/authorMode.d.cts.map +1 -0
- package/dist/packages/minor/doompi-author/src/services/authorMode.d.mts +19 -0
- package/dist/packages/minor/doompi-author/src/services/authorMode.d.mts.map +1 -0
- package/dist/packages/minor/doompi-author/src/services/authorMode.mjs +3 -0
- package/dist/packages/minor/doompi-author/src/services/authorMode.mjs.map +1 -0
- package/dist/packages/minor/doompi-author/src/services/extensionService.d.cts +7 -0
- package/dist/packages/minor/doompi-author/src/services/extensionService.d.cts.map +1 -0
- package/dist/packages/minor/doompi-author/src/services/extensionService.d.mts +7 -0
- package/dist/packages/minor/doompi-author/src/services/extensionService.d.mts.map +1 -0
- package/dist/packages/minor/doompi-author/src/services/extensionService.mjs +2 -0
- package/dist/packages/minor/doompi-author/src/services/extensionService.mjs.map +1 -0
- package/dist/packages/minor/doompi-author/src/types/author.d.cts +39 -0
- package/dist/packages/minor/doompi-author/src/types/author.d.cts.map +1 -0
- package/dist/packages/minor/doompi-author/src/types/author.d.mts +39 -0
- package/dist/packages/minor/doompi-author/src/types/author.d.mts.map +1 -0
- package/dist/packages/minor/doompi-author/src/types/author.mjs +2 -0
- package/dist/packages/minor/doompi-author/src/types/author.mjs.map +1 -0
- package/dist/packages/minor/doompi-author/src/types/authorApi.d.cts +23 -0
- package/dist/packages/minor/doompi-author/src/types/authorApi.d.cts.map +1 -0
- package/dist/packages/minor/doompi-author/src/types/authorApi.d.mts +23 -0
- package/dist/packages/minor/doompi-author/src/types/authorApi.d.mts.map +1 -0
- package/dist/packages/minor/doompi-author/src/types/authorApi.mjs +2 -0
- package/dist/packages/minor/doompi-author/src/types/authorApi.mjs.map +1 -0
- package/dist/packages/minor/doompi-author/src/types/extension.d.cts +16 -0
- package/dist/packages/minor/doompi-author/src/types/extension.d.cts.map +1 -0
- package/dist/packages/minor/doompi-author/src/types/extension.d.mts +16 -0
- package/dist/packages/minor/doompi-author/src/types/extension.d.mts.map +1 -0
- package/dist/packages/minor/doompi-author/src/types/structuredDocuments.d.cts +60 -0
- package/dist/packages/minor/doompi-author/src/types/structuredDocuments.d.cts.map +1 -0
- package/dist/packages/minor/doompi-author/src/types/structuredDocuments.d.mts +60 -0
- package/dist/packages/minor/doompi-author/src/types/structuredDocuments.d.mts.map +1 -0
- package/dist/packages/minor/doompi-author/src/types/webAuthor.d.cts +67 -0
- package/dist/packages/minor/doompi-author/src/types/webAuthor.d.cts.map +1 -0
- package/dist/packages/minor/doompi-author/src/types/webAuthor.d.mts +67 -0
- package/dist/packages/minor/doompi-author/src/types/webAuthor.d.mts.map +1 -0
- package/dist/packages/minor/doompi-author/src/types/webAuthor.mjs +2 -0
- package/dist/packages/minor/doompi-author/src/types/webAuthor.mjs.map +1 -0
- package/dist/schemas/authorTools.cjs +2 -0
- package/dist/schemas/authorTools.cjs.map +1 -0
- package/dist/services/authorBridgeState.cjs +2 -0
- package/dist/services/authorBridgeState.cjs.map +1 -0
- package/dist/services/authorMode.cjs +3 -0
- package/dist/services/authorMode.cjs.map +1 -0
- package/dist/services/extensionService.cjs +2 -0
- package/dist/services/extensionService.cjs.map +1 -0
- package/dist/sessionApi.cjs +1 -0
- package/dist/sessionApi.d.cts +7 -0
- package/dist/sessionApi.d.mts +7 -0
- package/dist/sessionApi.mjs +1 -0
- package/dist/types/author.cjs +2 -0
- package/dist/types/author.cjs.map +1 -0
- package/dist/types/authorApi.cjs +2 -0
- package/dist/types/authorApi.cjs.map +1 -0
- package/dist/types/webAuthor.cjs +2 -0
- package/dist/types/webAuthor.cjs.map +1 -0
- package/dist/webHub.cjs +1 -0
- package/dist/webHub.d.cts +2 -0
- package/dist/webHub.d.mts +2 -0
- package/dist/webHub.mjs +1 -0
- package/llms.txt +11 -0
- package/package.json +140 -0
- package/src/exports/webClient.ts +76 -0
- package/src/prompts/doompi-use-author/SKILL.md +17 -0
- package/src/types/author.ts +45 -0
- package/src/types/structuredDocuments.ts +63 -0
- package/src/types/webAuthor.ts +85 -0
- package/src/web/api/authorBroker.ts +14 -0
- package/src/web/api/authorBrowserBridge.ts +225 -0
- package/src/web/api/authorFiles.ts +219 -0
- package/src/web/api/authorMedia.ts +19 -0
- package/src/web/api/authorRuntime.ts +164 -0
- package/src/web/components/AuthorDocumentPanel.tsx +232 -0
- package/src/web/components/AuthorGridOverlay.tsx +81 -0
- package/src/web/components/AuthorMediaPreview.tsx +41 -0
- package/src/web/components/AuthorMediaView.tsx +356 -0
- package/src/web/components/AuthorPanel.tsx +105 -0
- package/src/web/components/AuthorRegionDrafts.tsx +102 -0
- package/src/web/components/AuthorRequestLog.tsx +179 -0
- package/src/web/components/AuthorStructuredView.tsx +121 -0
- package/src/web/components/AuthorTextView.tsx +97 -0
- package/src/web/components/AuthorToolPalette.tsx +103 -0
- package/src/web/components/AuthorVideoControls.tsx +111 -0
- package/src/web/components/DescribeAuthorToolsToolCard.tsx +50 -0
- package/src/web/components/OpenAuthoringFileToolCard.tsx +66 -0
- package/src/web/components/UseAuthorToolsToolCard.tsx +50 -0
- package/src/web/index.ts +68 -0
- package/src/web/lib/authorGrid.ts +124 -0
- package/src/web/lib/authorRegions.ts +30 -0
- package/src/web/lib/authorViewportTypes.ts +202 -0
- package/src/web/lib/describeAuthorToolsToolRender.ts +20 -0
- package/src/web/lib/useAuthorToolsToolRender.ts +20 -0
- package/src/web/stores/authorCapture.ts +322 -0
- package/src/web/stores/authorGridTools.ts +316 -0
- package/src/web/stores/authorProfiles.ts +130 -0
- package/src/web/stores/authorRequestLifecycle.ts +82 -0
- package/src/web/stores/authorStore.ts +60 -0
- package/src/web/stores/authorWorkspaceStore.ts +525 -0
- package/src/web/tsconfig.json +22 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export { AuthorClientBroker } from '../web/api/authorBroker.ts';
|
|
2
|
+
export { authorFileTab } from '../web/components/AuthorDocumentPanel.tsx';
|
|
3
|
+
export { AuthorRuntime, AUTHOR_RUNTIME_BINDING_IDS } from '../web/api/authorRuntime.ts';
|
|
4
|
+
export { AUTHOR_TRUSTED_PROFILES } from '../web/stores/authorProfiles.ts';
|
|
5
|
+
export {
|
|
6
|
+
AUTHOR_CAPTURE_MAX_BYTES,
|
|
7
|
+
AUTHOR_CAPTURE_MAX_DIMENSION,
|
|
8
|
+
AUTHOR_COMMENT_MAX_BYTES,
|
|
9
|
+
AUTHOR_PACKET_MAX_BYTES,
|
|
10
|
+
AUTHOR_QUOTE_MAX_BYTES,
|
|
11
|
+
attachAuthorCapture,
|
|
12
|
+
authorCaptureContext,
|
|
13
|
+
createAuthorCapturePacket,
|
|
14
|
+
imageCaptureProvider,
|
|
15
|
+
multiRegionCaptureProvider,
|
|
16
|
+
} from '../web/stores/authorCapture.ts';
|
|
17
|
+
export type {
|
|
18
|
+
AuthorCapturePacket,
|
|
19
|
+
AuthorCapturePacketRegion,
|
|
20
|
+
AuthorCaptureProvider,
|
|
21
|
+
} from '../web/stores/authorCapture.ts';
|
|
22
|
+
export {
|
|
23
|
+
AUTHOR_GRID_COLUMNS,
|
|
24
|
+
AUTHOR_GRID_SIZE,
|
|
25
|
+
authorGrid,
|
|
26
|
+
authorGridGeometry,
|
|
27
|
+
clearAuthorGridGeometry,
|
|
28
|
+
parseAuthorGridCell,
|
|
29
|
+
resolveAuthorGridCell,
|
|
30
|
+
updateAuthorGridGeometry,
|
|
31
|
+
} from '../web/lib/authorGrid.ts';
|
|
32
|
+
export type { AuthorGridCellResolution, AuthorGridGeometry } from '../web/lib/authorGrid.ts';
|
|
33
|
+
export {
|
|
34
|
+
addAuthorAnnotation,
|
|
35
|
+
addAuthorRegion,
|
|
36
|
+
authorDocument,
|
|
37
|
+
authorSessionWorkspace,
|
|
38
|
+
authorWorkspace,
|
|
39
|
+
dropAuthorSession,
|
|
40
|
+
focusAuthorDocument,
|
|
41
|
+
normalizeAuthorPath,
|
|
42
|
+
putAuthorDocument,
|
|
43
|
+
putAuthorRequest,
|
|
44
|
+
releaseAuthorDocumentFocus,
|
|
45
|
+
removeAuthorRegion,
|
|
46
|
+
requestAuthorSave,
|
|
47
|
+
reviseAuthorDocument,
|
|
48
|
+
setAuthorCrop,
|
|
49
|
+
syncAuthorDocumentFocus,
|
|
50
|
+
updateAuthorRegionComment,
|
|
51
|
+
updateAuthorRequest,
|
|
52
|
+
} from '../web/stores/authorWorkspaceStore.ts';
|
|
53
|
+
export { webPlugin } from '../web/index.ts';
|
|
54
|
+
export type {
|
|
55
|
+
AuthorAnnotation,
|
|
56
|
+
AuthorCellAnchor,
|
|
57
|
+
AuthorCrop,
|
|
58
|
+
AuthorDocumentInput,
|
|
59
|
+
AuthorDocumentKind,
|
|
60
|
+
AuthorDraftRevision,
|
|
61
|
+
AuthorFocusedDocument,
|
|
62
|
+
AuthorImageRectAnchor,
|
|
63
|
+
AuthorNativeAnchor,
|
|
64
|
+
AuthorNormalizedRect,
|
|
65
|
+
AuthorPdfPageRectAnchor,
|
|
66
|
+
AuthorRegionDraft,
|
|
67
|
+
AuthorRequestRecord,
|
|
68
|
+
AuthorRequestStatus,
|
|
69
|
+
AuthorSlideElementAnchor,
|
|
70
|
+
AuthorTextRangeAnchor,
|
|
71
|
+
AuthorTrustedProfile,
|
|
72
|
+
AuthorTrustedTool,
|
|
73
|
+
AuthorVideoTimeRectAnchor,
|
|
74
|
+
AuthorViewportSnapshot,
|
|
75
|
+
AuthorVoiceGridEvidence,
|
|
76
|
+
} from '../web/lib/authorViewportTypes.ts';
|
|
@@ -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.ts';
|
|
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-web-contracts';
|
|
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,225 @@
|
|
|
1
|
+
import type { WebPluginRuntime } from '@agimon-ai/doompi-web-contracts';
|
|
2
|
+
import { Store } from '@tanstack/store';
|
|
3
|
+
import type { AuthorHubMessage } from '../../types/webAuthor.ts';
|
|
4
|
+
import { authorChannelType } from '../../types/webAuthor.ts';
|
|
5
|
+
import { AuthorRuntime } from './authorRuntime.ts';
|
|
6
|
+
import type { AuthorTrustedProfile } from '../lib/authorViewportTypes.ts';
|
|
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: Record<string, unknown>): void {
|
|
174
|
+
this.#host.sendHubFrame({ type: authorChannelType, sessionId, payload });
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
#current(active: ActiveViewport, requestId: string, controller: AbortController): boolean {
|
|
178
|
+
return this.#active === active && this.#pending.get(requestId) === controller;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
#clearActive(): void {
|
|
182
|
+
clearTimeout(this.#leaseTimer);
|
|
183
|
+
this.#leaseTimer = undefined;
|
|
184
|
+
const active = this.#active;
|
|
185
|
+
if (active !== undefined) {
|
|
186
|
+
this.#send(active.sessionId, { kind: 'release', generation: active.generation });
|
|
187
|
+
active.release();
|
|
188
|
+
}
|
|
189
|
+
this.#active = undefined;
|
|
190
|
+
for (const controller of this.#pending.values()) controller.abort(new Error('Author viewport changed'));
|
|
191
|
+
this.#pending.clear();
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const authorBridgeRuntime = new Store<AuthorBrowserBridge | undefined>(undefined);
|
|
196
|
+
|
|
197
|
+
export function startAuthorBrowserBridge(runtime: WebPluginRuntime): () => void {
|
|
198
|
+
authorBridgeRuntime.state?.dispose();
|
|
199
|
+
const next = new AuthorBrowserBridge(runtime);
|
|
200
|
+
authorBridgeRuntime.setState(() => next);
|
|
201
|
+
return () => {
|
|
202
|
+
if (authorBridgeRuntime.state !== next) return;
|
|
203
|
+
next.dispose();
|
|
204
|
+
authorBridgeRuntime.setState(() => undefined);
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export async function focusAuthorViewport(
|
|
209
|
+
sessionId: string,
|
|
210
|
+
profiles: readonly AuthorTrustedProfile[],
|
|
211
|
+
): Promise<() => void> {
|
|
212
|
+
return (await authorBridgeRuntime.state?.focus(sessionId, profiles)) ?? (() => undefined);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export function applyAuthorHubMessage(sessionId: string, message: AuthorHubMessage): void {
|
|
216
|
+
authorBridgeRuntime.state?.apply(sessionId, message);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export function dropAuthorViewportSession(sessionId: string): void {
|
|
220
|
+
authorBridgeRuntime.state?.drop(sessionId);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export function authorBridgeView(sessionId: string): { activation: 'inactive' | 'active'; capabilityCount: number } {
|
|
224
|
+
return authorBridgeRuntime.state?.activeView(sessionId) ?? { activation: 'inactive', capabilityCount: 0 };
|
|
225
|
+
}
|