@cyber-dash-tech/revela 0.6.2 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -1
- package/README.zh-CN.md +20 -1
- package/lib/commands/edit.ts +31 -0
- package/lib/commands/help.ts +1 -0
- package/lib/config.ts +1 -1
- package/lib/edit/deck-state.ts +125 -0
- package/lib/edit/open.ts +76 -0
- package/lib/edit/prompt.ts +81 -0
- package/lib/edit/resolve-deck.ts +99 -0
- package/lib/edit/server.ts +851 -0
- package/package.json +1 -1
- package/plugin.ts +7 -0
- package/tools/edit.ts +61 -0
package/package.json
CHANGED
package/plugin.ts
CHANGED
|
@@ -45,6 +45,7 @@ import {
|
|
|
45
45
|
} from "./lib/commands/domains"
|
|
46
46
|
import { handlePdf } from "./lib/commands/pdf"
|
|
47
47
|
import { handlePptx } from "./lib/commands/pptx"
|
|
48
|
+
import { handleEdit } from "./lib/commands/edit"
|
|
48
49
|
import { handleDesignsPreview } from "./lib/commands/designs-preview"
|
|
49
50
|
import {
|
|
50
51
|
parseDesignsNewArgs,
|
|
@@ -82,6 +83,7 @@ import extractDocumentMaterialsTool from "./tools/extract-document-materials"
|
|
|
82
83
|
import qaTool from "./tools/qa"
|
|
83
84
|
import pdfTool from "./tools/pdf"
|
|
84
85
|
import pptxTool from "./tools/pptx"
|
|
86
|
+
import createEditTool from "./tools/edit"
|
|
85
87
|
import { RESEARCH_PROMPT, RESEARCH_AGENT_SIGNATURE } from "./lib/agents/research-prompt"
|
|
86
88
|
import { runQA, formatReport } from "./lib/qa"
|
|
87
89
|
import { extractDesignClasses } from "./lib/design/designs"
|
|
@@ -243,6 +245,10 @@ const server: Plugin = (async (pluginCtx) => {
|
|
|
243
245
|
} as any)
|
|
244
246
|
return
|
|
245
247
|
}
|
|
248
|
+
if (sub === "edit") {
|
|
249
|
+
await handleEdit(param, { client, sessionID, workspaceRoot }, send)
|
|
250
|
+
throw new Error("__REVELA_EDIT_HANDLED__")
|
|
251
|
+
}
|
|
246
252
|
if (sub === "designs" && !param) {
|
|
247
253
|
await handleDesignsList(send)
|
|
248
254
|
throw new Error("__REVELA_DESIGNS_LIST_HANDLED__")
|
|
@@ -333,6 +339,7 @@ const server: Plugin = (async (pluginCtx) => {
|
|
|
333
339
|
"revela-qa": qaTool,
|
|
334
340
|
"revela-pdf": pdfTool,
|
|
335
341
|
"revela-pptx": pptxTool,
|
|
342
|
+
"revela-edit": createEditTool({ client, workspaceRoot }),
|
|
336
343
|
},
|
|
337
344
|
|
|
338
345
|
// ── chat.message: intercept @-referenced / pasted binary files ────────
|
package/tools/edit.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* tools/edit.ts
|
|
3
|
+
*
|
|
4
|
+
* revela-edit — Open Revela's visual comment editor for an existing deck.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { tool } from "@opencode-ai/plugin"
|
|
8
|
+
import { openEditableDeck } from "../lib/edit/open"
|
|
9
|
+
|
|
10
|
+
export function createEditTool(options: { client: any; workspaceRoot: string; openBrowser?: boolean }) {
|
|
11
|
+
return tool({
|
|
12
|
+
description:
|
|
13
|
+
"Open Revela's visual comment editor for an existing slide deck. " +
|
|
14
|
+
"Use this when the user asks to edit, revise, annotate, or visually comment on a deck, " +
|
|
15
|
+
"including when they reference a decks/*.html file with @. " +
|
|
16
|
+
"Accepts either a deck slug from DECKS.json or a workspace-relative decks/*.html path. " +
|
|
17
|
+
"This opens a local browser editor where the user can Ctrl/Cmd-click deck elements, write comments, " +
|
|
18
|
+
"and send precise edit requests back to the current OpenCode session.",
|
|
19
|
+
args: {
|
|
20
|
+
target: tool.schema
|
|
21
|
+
.string()
|
|
22
|
+
.describe("Deck slug or workspace-relative deck HTML path, e.g. investor-update or decks/investor-update.html."),
|
|
23
|
+
},
|
|
24
|
+
async execute({ target }, context: any) {
|
|
25
|
+
const sessionID = context?.sessionID ?? context?.session?.id ?? ""
|
|
26
|
+
if (!sessionID) {
|
|
27
|
+
return JSON.stringify({
|
|
28
|
+
ok: false,
|
|
29
|
+
error: "Cannot open visual editor because the current OpenCode session id is unavailable.",
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
const result = openEditableDeck(target, {
|
|
35
|
+
client: options.client,
|
|
36
|
+
sessionID,
|
|
37
|
+
workspaceRoot: options.workspaceRoot,
|
|
38
|
+
openBrowser: options.openBrowser,
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
return JSON.stringify({
|
|
42
|
+
ok: true,
|
|
43
|
+
deck: result.deck.slug,
|
|
44
|
+
file: result.deck.file,
|
|
45
|
+
source: result.source,
|
|
46
|
+
url: result.url,
|
|
47
|
+
message:
|
|
48
|
+
`${result.stateNote} Opened visual editor. ` +
|
|
49
|
+
"Ask the user to use Ctrl/Cmd + click in the browser to reference elements, write a comment, then send comments.",
|
|
50
|
+
}, null, 2)
|
|
51
|
+
} catch (error) {
|
|
52
|
+
return JSON.stringify({
|
|
53
|
+
ok: false,
|
|
54
|
+
error: error instanceof Error ? error.message : String(error),
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export default createEditTool
|