Repository navigation
Conversation
Plugins are separate programs speaking JSON-RPC 2.0 over stdio, described by plugin.json. They add formula functions (via calc::external, cached unless volatile, with timeouts, restarts and a failed state), commands that answer with engine commands run as one undo step with rollback, ribbon groups on built-in or new tabs, and items in the cell, row, column and sheet-tab menus. - crates/plugin (L4): manifest, process host, wire values, example plugin - engine: plugins.list/load/unload/run; home.addIns lists plugins - ui-egui: Automate › Add-ins dialog, plugin_ui (ribbon and menus) - apps: --plugin DIR, GRIDCRAFT_PLUGIN_PATH, settings plugins folder - docs: plugins.md; architecture, gaps, roadmap, parity, CLI, ROADMAP Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
File › Options lists the installed plugins with a documentation link (manifest `homepage`, `author`) and Activate / Deactivate. A plugin turned off stays listed but loses its functions, commands, ribbon and menu items, and its process stops; prefs.json remembers it. New commands plugins.setEnabled and plugins.openHomepage. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…d-in list
plugins.install {url, dir?} downloads a plugin from GitHub (release asset
for this platform, else the source zipball), unpacks it safely into the
plugins folder and loads it. Options › Add-ins and the Add-ins dialog get
an install field with a confirmation step, and full-width plugin cards.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Use case from a finance/PE user, in case it helps shape the plugin API. The add-ins I rely on in Excel, Word and PowerPoint are the Claude and ChatGPT Office add-ins (Office.js task panes) and Macabacus (formatting, auditing and Excel-to-PowerPoint/Word linking). Anything in this space is what keeps me on Excel. Two questions: is Office.js add-in compatibility a goal, or is the plugin API intended to replace it? And would the plugin protocol be able to cover Macabacus-style features like formatting shortcuts and model auditing? I'd be happy to build a small plugin as a test once this lands. |
|
I am already looking into the integration of office.js add-ins, as it is very broad. The idea is to keep the "native" protocol and add the office.js wrapper to make that compatible. Some elements could be natively replaced, but I think that it could be a next step. Consider that the add-in system I am working on is shared across all three apps (word,grid and deck). |
The manifest and protocol are now the craft plugin protocol WordCraft speaks too: `apps` names the apps a plugin is for (others refuse it), `uiFor.gridcraft` replaces `ui` when present, `initialize` carries `host.id`, and the process gets CRAFT_HOST and CRAFT_PLUGIN_DIR. The install record is `.craft-source.json`. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ffice.sync, task panes) An Office add-in's manifest.xml loads as a plugin: its ribbon buttons, menus and cell items are plugin items and its commands open its task pane (or call a function) instead of starting a process. office.sync runs one context.sync() of the pane (paths from the workbook to ranges, formats, worksheets, the common API's selection and settings) as one undo step, bounded by the manifest's permissions. ui-egui shows the pane and pumps its messages through Services::office; the desktop app hosts the page in a wry web view on macOS and Windows. docs/officejs.md. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…and wasm-clean install.rs The bootstrap defines stand-ins for Office and Excel that hold the page's first calls until the wasm library is ready, then hands them over (Office.initialize included). Approved by the owner as the single hand-written JavaScript exception (docs/officejs.md). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…loper tab
Plugins may ask the host while they work (host/sync with the Office
bridge's object paths, the workbook's vbaProject.bin, messages, log);
all of it is one undoable step, taken back if the plugin fails. A
plugin declaring "macros": {"language": ...} answers macros/* and
brings the Developer tab: Visual Basic (modules in an editor), Macros
(run, edit, create), Record Macro, Macro Security (prompt by default,
with the Enable Content bar). The language lives in the add-in
(craft-vba for VBA); GridCraft draws the interface. Also: the bridge
reads the model's RGB colours as #RRGGBB.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…t in the message) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
context.formulas sits next to context.values: each cell's formula text
("=B2*1.1"), or null for a cell without a formula. Plugins can then tell
inputs from calculations, which colour coding and model auditing need
(hard-coded numbers in blue, formulas in black, links to other sheets in
green).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
context.activeSheet, context.sheets ([{index, name, visibility, usedRange}],
hidden sheets included) and context.names ([{name, scope, hidden,
refersTo}], at most 10,000 with namesTruncated) next to the selection.
document.inspect already computes these; plugins couldn't see them, so
they couldn't unhide every sheet, list sheets, clean up names or trim used
ranges.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Awesome - good to know. This would cover addins that i would like to see (Claude + ChatGPT). In the meantime, i'm working on a macabacus style plugin on the craft protocol. Happy to test the wrapper against some real excel files/ppts when it is ready. Love what you're doing here! |
… .xlsm
- The workbook's ribbon part (customUI14.xml / customUI.xml) is modelled when it
is tabs, groups and macro buttons (model::Ribbon, xlsx custom_ui.rs): read,
edited and written back, so Excel shows the buttons too. A richer ribbon stays
kept content; its buttons still show and run.
- developer.ribbon / addRibbonButton / editRibbonButton / removeRibbonButton /
pressRibbonButton; macros/run gets the button as control {id, tag}
(Sub Go(control As IRibbonControl)).
- UI: the workbook's buttons on their tabs (built-in or their own), Developer ›
Ribbon Buttons, Add to Ribbon in the Macros window.
- file.save writes a workbook with macros as .xlsm (.xltx as .xltm) instead of
dropping them, and says so (renamedFrom); autosave covers .xlsm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… in Insert Function formulas::function_list() adds the enabled plugins' functions (category Add-ins, their signature and description) to the built-in ones; the formula editor's autocomplete and argument hint read them each time, so they follow plugins being loaded, turned off and unloaded. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Feat/officejs
Plugin commands see the selection's formulas (context.formulas)
Plugin commands see the workbook's sheets and names
…ent events)
Implements the craft plugin protocol 1.2 shared with WordCraft, DeckCraft
and craft-nextcloud:
- initialize: host.features ["dialogs","open","events","document"] and
host.language (the UI language, BCP 47).
- context.document {path, name, dirty} in commands/run, and a brief context
(workbook, sheet, active, selection, document) in macros/run.
- Command results `open` and `dialog` (gridcraft_plugin::dialog): validated
as hostile input, truncated at the spec's limits, malformed ones fail the
command; a dialog may only run the plugin's declared commands. The open
path must be absolute, an existing regular file GridCraft opens, checked
before the step runs. plugins.run returns both; from the UI (ribbon,
menus, Add-ins, a dialog's OK/buttons) run_or_alert opens the file via
the normal open path (label in the status bar) and draws the dialog
(list with icons, filter over 20 items, multi-select; form with
text/secret/number/checkbox/choice; message) with theme tokens, chaining.
- Manifest `events` and events/documentOpened|documentSaved|documentClosed
sent after the fact from a worker thread (30 s / 5 s), never holding up
the open, save or close; not for AutoSave; documentClosed on file.close
and on quit (best effort, 5 s); host/sync and host/vbaProject refused
with AccessDenied during an event; answers shown in the status bar,
errors in the info bar.
- Tests: plugin unit tests, engine plugin_protocol test (fake plugin
binary), UI test that a ribbon button's dialog shows and its OK runs the
next command, with combined message/result/dialog fields.
- Docs: plugins.md Protocol 1.2 section and manifest `events`; gaps.md,
ROADMAP progress log.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…, collab.* commands - crates/plugin: a continuous reader per plugin process; notifications and anytime requests (collab/snapshot, host/log) go to a queue the app drains (push.rs), answers still go to the waiting request; notify/respond without the connection's lock; 64 MiB lines, flood cut-off; host.features push/collab, host.collab; manifest `collab`; `collab.join` in command results. - crates/collab (L3, wasm-safe): the workbook as a Yjs document (GridCraft schema 1 on yrs, matching craft-collab 2.0.1: block ids ~b.i, first-occurrence dedup, names, styles by content hash), one transaction per committed command by diffing, remote updates mapped back incrementally, per-user undo (yrs UndoManager), awareness (y-protocols), AES-256-GCM, gap holding, foreign-meta refusal. - crates/engine: rooms, collab.share/join/leave/status/setUser, Session::collab_poll, per-user Undo/Redo in a room, read-only while joining, recovery, in-memory transports. - Tests: replica convergence fuzz (2 and 3 peers, reordered and duplicated updates), engine command-sequence convergence fuzz, craft-collab conformance transcripts, a fake relay transport through the push channel, loopback end to end. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…d selections, docs - Review tab Share group (Start Live Session, Join, Leave) and the Share dialog. - Status bar: the session's state and the people in it; others' selections drawn in their colours with name tags; others' edits highlighted for two seconds. - The desktop app keeps rooms' state in <settings>/recovery every 30 s. - docs/collab.md (schema 1, normative, and behaviour); plugins.md Protocol 2 section; gaps.md, ROADMAP.md, architecture.md. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Title bar: Share at the right end. Not in a session it opens the Share dialog; in one it shows the state (green live, amber connecting/joining, grey offline) and opens the session popover (room, state, transport, encryption, people with "(you)", Copy invitation, Leave). - The session's people as overlapping circles (initials on their colour, black or white text), at most four then "+N", yourself last; hover names, click goes to their selection (switching sheet) and flashes it. - Narrow windows: the theme switch, Comments and Search give way, then circles; the title is truncated with "…" between the controls. Full screen on macOS drops the traffic-light gap. Export / Save a Copy moved to the title bar's More commands. - Share dialog: the transport's own Start / Join from an Invitation, or a room by name; with no transport add-in it explains, names craft-mqtt (sirmmo/craft-collab) and opens Add-ins. - A transport command's collab.join is now joined by the interface; result.link kept as the room's invitation. - Review › Share group removed (collab.* commands unchanged); the status bar keeps only read-only reasons and problems. Theme tokens presence_online / presence_connecting. - Tests: title_bar_share.rs (kittest, in-memory peers), circle/initials/contrast and title-bar planning unit tests. Docs: collab.md, ui-parity.md, gaps.md, ROADMAP.md. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Manifests gain `requires` (apps, protocol, features, other add-ins with Cargo-style version ranges). All installed add-ins are resolved together: unmet requirements block an add-in with structured reasons (its functions, commands and ribbon items absent), required add-ins start first, cycles and chains deeper than 8 are blocked, and blocking re-evaluates on install, load, turning on/off, unload and failure. initialize gains host.protocol and addins. plugins.list reports state/blockedBy/requires/requiredBy; new plugins.requirements and plugins.installMissing; plugins.install gains withRequirements, force and version (newest release whose tag is in range); plugins.load refuses out-of-range updates unless force. Office add-ins' <Requirements> sets and methods are checked against Office.js's table. UI: blocked add-ins show why with Install Missing, the install flow offers the required add-ins, and turning off a needed add-in asks first. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ople circles and name tags Selections on a sheet with no row/column ids, and past the last ones, travel in awareness as the deterministic block ids (~<block>.<i>) those rows and columns would get; readers resolve blocks they don't have yet. Nothing is written to the document (schema 1 clarified in craft-collab ea58f3e). People circles are slightly larger with less overlap and clearer initials. Name tags sit above the selection's top edge (in the column headers at the top of the view), fade 3 s after the person last moved, and come back on hover over their outline. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Two threads refreshing at once could let the older snapshot win (found while porting manifest 1.3 to DeckCraft). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Microsoft's office.js never runs in a task pane: the bootstrap gives
<script>s from its CDNs (and npm copies) an empty script, whether parsed
or made by the page's code, and defines Office/Excel/OfficeExtension/
OfficeRuntime as non-replaceable accessors that hold early calls
(onReady, Excel.run, initialize, actions.associate) until the wasm
library adopts them; a foreign Office assigned anyway is ignored (its
initialize is kept).
- office.sync accepts the 148 CSS colour names (any case) and #RGB
wherever it takes #RRGGBB; reads still answer #RRGGBB.
- ExecuteFunction commands end to end: the control id is kept from the
manifest; the function file loads hidden, the library says it's ready,
then __craftOfficeRunFunction calls the associated (or global) function
with event.source.id and event.completed(); the host waits up to 5
minutes and reports functions that are missing, throw or never finish.
- Common API: context.host, new Excel.RequestContext(), the enums from
the API reference (EventType, Index, GoToType, HostType, CoercionType,
StartupBehavior, BindingType...), set({...}) on proxies, worksheets.add()
without a name (next SheetN, at the end, active sheet kept), initialize
assigned late, DocumentSelectionChanged handlers, NotSupported/
NotImplemented answers for missing *Async, Office.addin, Office.ribbon.
- AddinCommands 1.1 and DocumentEvents 1.1 reported; ExcelApi 1.4
documented as the subset it is.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…hosts to nothing As DeckCraft does: WebView2 gets --host-resolver-rules for the two CDN hosts, keeping wry's default arguments. On macOS the bootstrap stays the only guard. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…l app - Control channel: office.panes, office.open, office.close and office.eval (runs JavaScript in an add-in's page; Promises awaited; the answer comes back through the page's IPC channel, with a timeout and a 1 MiB bound), through a new OfficeHost::eval and office_pane::EvalRouter; the wry host routes answers. - bootstrap.js: read-only __craftOfficeInfo (Office is GridCraft's, blocked office.js script URLs). - cargo xtask office-samples: starts the app per scenario on a fresh profile, loads each hosted sample manifest, opens its pane, checks the page's Office, clicks the sample's buttons, checks the workbook, runs ExecuteFunction, takes screenshots, writes results.json and summary.md; crashes are reported and the next scenario gets a fresh app. Scenario table with must-pass and expected-unsupported checks; --dry-run drives a fake app. - Docs: officejs.md "Testing with Microsoft's samples", control-protocol.md. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Document chat (craft-collab docs/chat.md, protocol 2.1): the workbook's chat in the model (Workbook::chat), saved in XLSX as /craft/chat.json (urn:craft:relationships:chat, application/vnd.craft.chat+json; a damaged part skipped with a warning) and in the native JSON format; shared in live sessions through the chat/chatMeta roots (seeded on share, the room's on join, outside the undo scope, viewers can chat); commands chat.list/send/edit/delete/clear/export/typing and view.chat; never an undo step but marking the workbook modified; awareness typing. The Chat pane (messages with author circle, time, replies, edited/deleted, links, mentions; Enter sends, Shift+Enter new line; Export, Clear chat... asking first, the Office note) and the title bar's chat button with the unread count and a flash for mentions. Tests: model, xlsx round trip, replicas, engine commands and sessions (two/three peers, clear, join, encrypted, viewer, typing), chat in the convergence fuzz, craft-collab's chat transcripts in the conformance replay, kittest for the pane and the unread count. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…, follow RunAction's cycle, collect page diagnostics
- Fills: cell.get writes the colour as {"Rgb": n} (Windows reported 16776960,
which is #FFFF00); compare RRGGBB instead of searching the JSON text.
- keyboard-shortcuts RunAction: expect the next colour in the sample's cycle
after the cell's current fill (a blank cell reads #FFFFFF, so #C7CC7A).
- When a waited-for page state never comes, ask the page for
__craftOfficeInfo and DOM facts, save them under diagnostics/, and put the
gist (readyState, onReady calls/done, callback errors, failed scripts,
problems) in the report.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…tstrap records page problems
On macOS the library (and the settings round trip) can be ready before the
page's HTML is parsed. Samples whose taskpane.js runs in <head> (add-in
commands, save custom settings) then had their Office.onReady callback run
while document.getElementById('run') was still null: the callback threw and
the buttons were never wired. Office calls onReady and initialize after the
DOM is ready, and so does GridCraft's library now (the host's ready event too).
For tests, the bootstrap now keeps uncaught errors, unhandled rejections,
console errors and warnings, script load results and the document state in
__craftOfficeInfo, with the library's onReady bookkeeping
(__craftOfficeState: calls, callbacks run, the last callback error).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…live
craft-live (a WOPI editor that replaces Collabora in Nextcloud Office) frames
the web build with #craft-live=1&ws=…&room=…&token=…; the web build now
speaks its embed contract (craft-live docs/design.md §9):
- gridcraft_engine::live: the contract without I/O (LiveClient): fragment and
craft-live:config, y-websocket lib0 framing and control messages (type 100),
seeding from the file (collab.share semantics, read-only until the room has
the seed) or joining (Joining… until sync step 2), reseed/prepare, a lost
lease, save {id,url,name,format} answered with a PUT of the file in its own
format (xlsx/xlsm/xltx/xltm; anything else as .xlsx, which craft-live keeps
as a copy), saveResult on failure, saveNow, closing after the room saved,
close codes 4401/4403 and reconnecting with backoff, shell messages
(loaded, modified, saved, peers, close, error). The engine's room is served
in memory: one update per committed command, awareness as on the desktop.
- apps/gridcraft-web/src/live.rs: the browser I/O (postMessage with the shell,
web_sys::WebSocket, fetch); Save asks the room to save, exports download.
- ui-egui: Services::close (the title bar's Close, File › Close through the
host) and HostSession (the session's popover names Nextcloud, shows the file,
person, saved state and connection, and offers Close instead of Leave).
- Desktop: collab/snapshot {file: true, format} writes the asked format when
GridCraft can and reports the format written.
- collab: random numbers from the browser's crypto on wasm (client ids).
- Tests: native tests against a fake craft-live room, wasm-bindgen tests of the
client compiled to wasm, a kittest for the host's Close and popover, and
apps/gridcraft-web/e2e (not a workspace member) against the real craft-live
server and its fake Nextcloud with proof keys.
- Docs: collab.md (In Nextcloud), packaging/web/README.md (the bundle craft-live
serves), gaps §16/§21, ROADMAP progress log.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…eady waits for DOMContentLoaded Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ields, blank results, literal text, invalidation
Plugin protocol 2.2 (2.1 is the shared protocol's document chat), found by the R add-in:
- functions/call carries document {path, name, id}; results are kept per workbook and file;
context.document and the document events carry the same session id
- documentOpened is delivered before an opened workbook's first calculation (at most 10 s per
plugin)
- form fields: multiline, code, rows (bounded)
- {"empty": true} results show blank when the formula is the call itself; null stays 0 as in Excel
- range.setValues {literal: true}
- host/functions/invalidate {names?} during commands, events and on the push channel
host.features: functionDocument, openedBeforeCalc, multiline, emptyResult, literalValues,
invalidate.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
What this changes
GridCraft gets an add-in system and what is built on it:
It fills gaps.md #21. The reference docs are docs/plugins.md (the protocol), docs/officejs.md (Office add-ins) and docs/collab.md (co-editing and chat). WordCraft (storytold/wordcraft#2586) and DeckCraft (storytold/deckcraft#919) get the same system, so one add-in can serve all three apps. The cross-app specs (co-editing, chat, add-in requirements, protocol 2.2) live in sirmmo/craft-collab.
The add-ins are separate programs in any language. GridCraft starts them and talks JSON-RPC 2.0 over stdin/stdout, so an add-in that crashes, hangs or answers badly costs a cell an error value, never the workbook. That follows the never-crash rule: timeouts, restarts,
failedafter 3 failures, bounded input everywhere, no panics. Everything is a command: the add-ins' features are reachable from the UI, the CLI, MCP and the control channel, and programmatic calls never open dialogs.Step by step
The commits are grouped by feature. Each builds and passes the gates on its own:
apps,uiFor,host.id).manifest.xml) load as add-ins whose task panes open in a web view (macOS and Windows), through theoffice.syncbridge.crates/office-jsis a Rust/wasm replacement for Office.js (the Excel namespace).crates/office-js/bootstrap.jsis the repo's one hand-written JavaScript file, approved by the project owner as the single exception to Rust-only.host/sync, the VBA project, messages, log), all in the same undo step.customUI14.xml..xlsm(.xltxas.xltm) instead of losing them.context.document.yrs, MIT): rows and columns have stable ids, so inserts don't shift anyone's references.office.js, which sample pages load, can no longer replace ours; on Windows its hosts resolve to nothing.ExecuteFunctionribbon commands work, colour names are accepted, and more of the common API is in.cargo xtask office-samplesdrives Microsoft's hosted add-in samples in GridCraft's real task-pane web view through the control channel (office.panes,office.eval).Office.onReadyfired before the page's HTML was parsed on macOS..xlsx(/craft/chat.json) until someone clears it explicitly.functions/callcarriesdocument.range.setValuescan write literal text, and a plugin can invalidate its cached results.Docs, gaps, ROADMAP and the parity checklists are updated with their timestamp lines and revision histories.
Add-ins that work with this today
docAPI.Testing
cargo fmt, clippy with-D warnings, the workspace tests, andxtask layers,assetsandwasmall pass.bootstrap.js;ExecuteFunction), save/read custom settings and keyboard-shortcut actions pass;office.jsis confirmed never to run.Notes for reviewers
crates/plugin,crates/collab,crates/office-js) plus engine commands and UI panels. Existing behaviour changes only in that workbooks with macros save as.xlsm, and in the title bar's right side, which now holds Share. Export moved to the More menu.🤖 Generated with Claude Code