Releases: aiperceivable/tiptap-apcore
Releases · aiperceivable/tiptap-apcore
Release 0.3.1
Changed
- Rebrand: aipartnerup → aiperceivable
Release 0.3.0
Release version 0.3.0
Release 0.2.1
Release version 0.2.1
Release 0.2.0
Changed
- BREAKING: Upgraded
apcore-jspeer dependency from^0.6.0to^0.13.0. - BREAKING: Upgraded
apcore-mcppeer dependency from^0.7.0to^0.10.0. - BREAKING: Removed
ExplorerHandlerandExplorerHandlerOptionsre-exports fromtiptap-apcore/server— these no longer exist in apcore-mcp 0.10.0 (replaced bymcp-embedded-ui). - Query command annotations now include
cacheable: trueto leverage apcore-mcp 0.10.0 caching support.
Added
- Re-export
asyncServe()fromtiptap-apcore/server— embeddable MCP HTTP handler for mounting into existing servers (new in apcore-mcp 0.9.0). - Re-export
AsyncServeOptionsandAsyncServeApptypes from bothtiptap-apcoreandtiptap-apcore/server.
Dependencies
- Peer:
apcore-js^0.13.0 (was ^0.6.0),apcore-mcp^0.10.0 (was ^0.7.0).
Release 0.1.0
Initial release of tiptap-apcore — let AI safely control your TipTap editor through standardized, schema-validated, access-controlled modules.
Added
Core API
withApcore(editor, options?)factory function — single entry point that returns an APCoreRegistry+Executorfrom any TipTap editor instance.- Configurable options:
acl,prefix,includeUnsafe,logger,sanitizeHtml. - Server-only exports via
tiptap-apcore/server:serve(),toOpenaiTools(),resolveRegistry(),resolveExecutor(),ExplorerHandler.
Command Coverage — 79 Built-in Commands across 6 Categories
- Query (10):
getHTML,getJSON,getText,isActive,getAttributes,isEmpty,isEditable,isFocused,getCharacterCount,getWordCount— read-only, idempotent. - Format (36):
toggleBold,toggleItalic,toggleStrike,toggleCode,toggleUnderline,toggleSubscript,toggleSuperscript,toggleHighlight,toggleHeading,toggleBulletList,toggleOrderedList,toggleTaskList,toggleCodeBlock,toggleBlockquote,setTextAlign,setBold,setItalic,setStrike,setCode,setLink,setMark,setHeading,setParagraph,setBlockquote,setHardBreak,setHorizontalRule,unsetBold,unsetItalic,unsetStrike,unsetCode,unsetLink,unsetMark,unsetAllMarks,unsetBlockquote,clearNodes,updateAttributes. - Content (15):
insertContent,insertContentAt,setNode,splitBlock,liftListItem,sinkListItem,wrapIn,joinBackward,joinForward,lift,splitListItem,wrapInList,toggleList,exitCode,deleteNode. - Destructive (6):
clearContent,setContent,deleteSelection,deleteRange,deleteCurrentNode,cut— markeddestructive: true,requiresApproval: true. - Selection (10):
setTextSelection,setNodeSelection,selectAll,selectParentNode,selectTextblockStart,selectTextblockEnd,selectText,focus,blur,scrollIntoView. - History (2):
undo,redo.
Custom APCore Command: selectText
- Semantic text search and selection — not a native TipTap command.
- Parameters:
text(required string),occurrence(optional, 1-based integer, defaults to 1). - Returns
{ found: boolean, from?: number, to?: number }. - Substring matching via
doc.descendants()traversal.
Selection Effect Metadata
- New
SelectionEffecttype (require|preserve|destroy|none) added toAnnotationEntry. - Every command annotated with its selection behavior at the source level (
AnnotationCatalog). - Exposed via
ModuleDescriptor.metadata.selectionEffectfor external consumers to read dynamically.
Automatic Extension Discovery
ExtensionScannerintrospectseditor.extensionManager.extensionsat runtime.- Discovers commands from
addCommands()on each extension. - Detects node, mark, and extension types.
- Dynamic re-discovery via
registry.discover()— only emits events for changed modules.
Module Builder & Schema Catalog
ModuleBuildertransforms command names into completeModuleDescriptorobjects.- Module ID pattern:
{prefix}.{category}.{commandName}(e.g.,tiptap.format.toggleBold). SchemaCatalogprovides strict JSON Schema definitions for all 79 commands —additionalProperties: falsefor OpenAI strict mode compatibility.- Human-readable descriptions auto-generated from camelCase names.
- Documentation links auto-generated:
https://tiptap.dev/docs/editor/api/commands/{commandName}.
Safety Annotations
- 6 safety flags per command:
readonly,destructive,idempotent,requiresApproval,openWorld,streaming. AnnotationCatalogprovides static metadata for all known commands.- Unknown commands excluded by default (
includeUnsafe: false).
Role-Based Access Control (ACL)
AclGuardwith 3 preset roles:readonly— query commands only.editor— query + format + content + history + selection.admin— all categories including destructive.- Fine-grained overrides:
allowTags,denyTags,allowModules,denyModules. - Precedence:
denyModules>allowModules>denyTags>allowTags> role defaults. - Detailed denial reasons for diagnostics.
Security Hardening
- URL protocol validation for
setLink— allowshttp,https,mailto,tel, and relative paths. - Prototype pollution guard — blocks
__proto__,constructor,prototypein property names. - Optional
sanitizeHtmlcallback forinsertContent,insertContentAt,setContent. - Input validation: non-empty strings, finite numbers, required field enforcement.
Error Handling
TiptapModuleErrorwith 7 error codes:MODULE_NOT_FOUND,COMMAND_NOT_FOUND,SCHEMA_VALIDATION_ERROR,ACL_DENIED,EDITOR_NOT_READY,COMMAND_FAILED,INTERNAL_ERROR.- Errors include
moduleId,code, and contextual details.
Registry & Event System
TiptapRegistrywith full module lifecycle:register(),unregister(),list(),getDefinition(),iter().- Filtering by tags (OR logic) and module ID prefix.
- Event system:
on('register'),on('unregister')with cleanup viaoff()andremoveAllListeners().
Integration Exports
- MCP Server via
serve(executor)— supports stdio, HTTP streaming, SSE transports. - OpenAI Function Calling via
toOpenaiTools(executor). ExplorerHandlerfor interactive module discovery UI.
Demo Application
- Multi-Provider LLM Support: OpenAI (GPT-4o, GPT-4.1, GPT-5.1), Anthropic (Claude Sonnet 4.5, Haiku 4.5, Opus 4.5), Google Gemini (2.5 Flash, 2.5 Pro, 2.0 Flash).
- Dynamic System Prompt: Built at request time from registry metadata — command list, selection behavior classification, task patterns, anti-patterns. No hardcoded command names.
- Gemini Schema Sanitization: Deep-clone sanitizer that removes
additionalProperties, converts type arrays, flattensanyOf, filtersrequired, and preserves empty object schemas from SDK stripping. - Headless TipTap Editor: JSDOM-based server-side editor for AI command execution, created and destroyed per request.
- Frontend Undo/Version Stack:
useRef-based HTML history buffer (max 50 entries) with undo and clear controls. - Model Selector: Grouped dropdown populated from
/api/healthwith per-provider API key detection. - Chat UI: Multi-turn conversation, tool call inspection (expandable details), loading animation, keyboard shortcuts.
- Demo Scenarios: AI-driven insert, format, and clear with confirmation dialog for destructive operations.
- Tool Panel: Registry-driven command browser with category badges and manual execution.
- ACL Switcher: Live role switching with APCore re-initialization.
- Responsive Layout: 4-column grid with breakpoints at 1400px and 1024px.
Test Suite
- 925 tests across 10 test files (9 unit, 1 integration).
- Coverage: unit tests for every public class and function.
- Components tested:
TiptapModuleError,AnnotationCatalog,SchemaCatalog,ModuleBuilder,ExtensionScanner,TiptapRegistry,AclGuard,TiptapExecutor,withApcore, integration workflows.
Dependencies
- Peer:
@tiptap/core^2.0.0,apcore-js^0.6.0,apcore-mcp^0.7.0. - Runtime: Node.js >= 18.0.0.
- License: Apache-2.0.