feat: add manifest schema, TypeScript types, PluginAPI, RPC client, event schemas, sync schemas

This commit is contained in:
2026-06-16 11:55:47 +08:00
parent 622fcf6625
commit 2f02db00f5
15 changed files with 1913 additions and 0 deletions
+131
View File
@@ -0,0 +1,131 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.mirv.top/verstak/verstak-sdk/schemas/events/browser.json",
"title": "Verstak Browser Events",
"description": "Event schemas for browser extension and browser-inbox plugin communication",
"type": "object",
"properties": {
"events": {
"type": "array",
"items": {
"$ref": "#/$defs/BrowserEvent"
}
}
},
"$defs": {
"BrowserEvent": {
"type": "object",
"properties": {
"name": { "type": "string" },
"description": { "type": "string" },
"schema": {
"type": "object",
"properties": {
"type": { "type": "string", "const": "object" },
"properties": {
"type": "object",
"additionalProperties": {
"oneOf": [
{ "type": "string" },
{ "type": "integer" },
{ "type": "boolean" },
{ "type": "array" },
{ "type": "object" }
]
}
},
"required": {
"type": "array",
"items": { "type": "string" }
}
},
"required": ["type", "properties", "required"]
}
},
"required": ["name", "description", "schema"]
}
},
"events": [
{
"name": "browser.capture.page",
"description": "Full page capture sent from browser extension",
"schema": {
"type": "object",
"properties": {
"url": { "type": "string", "description": "Page URL" },
"title": { "type": "string", "description": "Page title" },
"html": { "type": "string", "description": "Page HTML content" },
"text": { "type": "string", "description": "Page text content" },
"capturedAt": { "type": "string", "description": "ISO 8601 timestamp" },
"domain": { "type": "string", "description": "Extracted domain" }
},
"required": ["url", "title", "capturedAt"]
}
},
{
"name": "browser.capture.selection",
"description": "Selected text sent from browser extension",
"schema": {
"type": "object",
"properties": {
"url": { "type": "string", "description": "Source page URL" },
"title": { "type": "string", "description": "Source page title" },
"text": { "type": "string", "description": "Selected text content" },
"capturedAt": { "type": "string", "description": "ISO 8601 timestamp" },
"domain": { "type": "string", "description": "Extracted domain" }
},
"required": ["url", "title", "text", "capturedAt"]
}
},
{
"name": "browser.capture.link",
"description": "Link sent from browser extension",
"schema": {
"type": "object",
"properties": {
"url": { "type": "string", "description": "Link URL" },
"title": { "type": "string", "description": "Link text/title" },
"capturedAt": { "type": "string", "description": "ISO 8601 timestamp" },
"domain": { "type": "string", "description": "Extracted domain" }
},
"required": ["url", "capturedAt"]
}
},
{
"name": "browser.desktop.status",
"description": "Desktop status response to browser extension ping",
"schema": {
"type": "object",
"properties": {
"online": { "type": "boolean", "description": "Whether desktop is reachable" },
"version": { "type": "string", "description": "Desktop version" },
"checkedAt": { "type": "string", "description": "ISO 8601 timestamp" }
},
"required": ["online", "checkedAt"]
}
},
{
"name": "browser.pending.flush",
"description": "Flush pending captures from browser queue to desktop",
"schema": {
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": { "type": "string", "enum": ["page", "selection", "link"] },
"payload": { "type": "object" },
"queuedAt": { "type": "string" }
},
"required": ["type", "payload"]
}
},
"flushedAt": { "type": "string", "description": "ISO 8601 timestamp" }
},
"required": ["items", "flushedAt"]
}
}
]
}
+145
View File
@@ -0,0 +1,145 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.mirv.top/verstak/verstak-sdk/schemas/events/lifecycle.json",
"title": "Verstak Lifecycle Events",
"description": "Event schemas for plugin and application lifecycle events",
"type": "object",
"properties": {
"events": {
"type": "array",
"items": {
"$ref": "#/$defs/LifecycleEvent"
}
}
},
"$defs": {
"LifecycleEvent": {
"type": "object",
"properties": {
"name": { "type": "string" },
"description": { "type": "string" },
"schema": {
"type": "object",
"properties": {
"type": { "type": "string", "const": "object" },
"properties": { "type": "object" },
"required": { "type": "array", "items": { "type": "string" } }
},
"required": ["type", "properties", "required"]
}
},
"required": ["name", "description", "schema"]
}
},
"events": [
{
"name": "plugin.enabled",
"description": "A plugin has been enabled",
"schema": {
"type": "object",
"properties": {
"pluginId": { "type": "string", "description": "Plugin identifier" },
"version": { "type": "string", "description": "Plugin version" },
"enabledAt": { "type": "string", "description": "ISO 8601 timestamp" }
},
"required": ["pluginId", "enabledAt"]
}
},
{
"name": "plugin.disabled",
"description": "A plugin has been disabled",
"schema": {
"type": "object",
"properties": {
"pluginId": { "type": "string", "description": "Plugin identifier" },
"disabledAt": { "type": "string", "description": "ISO 8601 timestamp" }
},
"required": ["pluginId", "disabledAt"]
}
},
{
"name": "plugin.failed",
"description": "A plugin has failed to load or run",
"schema": {
"type": "object",
"properties": {
"pluginId": { "type": "string", "description": "Plugin identifier" },
"error": { "type": "string", "description": "Error message" },
"phase": {
"type": "string",
"description": "Lifecycle phase where failure occurred",
"enum": ["discovery", "validation", "dependency", "permissions", "sidecar", "frontend", "registration", "runtime"]
},
"failedAt": { "type": "string", "description": "ISO 8601 timestamp" }
},
"required": ["pluginId", "error", "phase", "failedAt"]
}
},
{
"name": "plugin.installed",
"description": "A new plugin has been installed",
"schema": {
"type": "object",
"properties": {
"pluginId": { "type": "string" },
"version": { "type": "string" },
"source": { "type": "string", "enum": ["official", "local", "third-party"] },
"installedAt": { "type": "string" }
},
"required": ["pluginId", "version", "source", "installedAt"]
}
},
{
"name": "plugin.uninstalled",
"description": "A plugin has been uninstalled",
"schema": {
"type": "object",
"properties": {
"pluginId": { "type": "string" },
"preserveData": { "type": "boolean", "description": "Whether user chose to keep data" },
"uninstalledAt": { "type": "string" }
},
"required": ["pluginId", "uninstalledAt"]
}
},
{
"name": "app.started",
"description": "Application has started",
"schema": {
"type": "object",
"properties": {
"version": { "type": "string", "description": "Application version" },
"startedAt": { "type": "string", "description": "ISO 8601 timestamp" },
"pluginsLoaded": { "type": "integer", "description": "Number of plugins loaded" },
"pluginsFailed": { "type": "integer", "description": "Number of plugins failed" }
},
"required": ["version", "startedAt"]
}
},
{
"name": "app.shuttingdown",
"description": "Application is shutting down",
"schema": {
"type": "object",
"properties": {
"shutdownAt": { "type": "string", "description": "ISO 8601 timestamp" },
"reason": { "type": "string", "description": "Shutdown reason" }
},
"required": ["shutdownAt"]
}
},
{
"name": "capability.changed",
"description": "Available capabilities have changed (plugin enabled/disabled)",
"schema": {
"type": "object",
"properties": {
"added": { "type": "array", "items": { "type": "string" }, "description": "Capabilities that became available" },
"removed": { "type": "array", "items": { "type": "string" }, "description": "Capabilities that were removed" },
"changedAt": { "type": "string", "description": "ISO 8601 timestamp" }
},
"required": ["changedAt"]
}
}
]
}
+159
View File
@@ -0,0 +1,159 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.mirv.top/verstak/verstak-sdk/schemas/events/vault.json",
"title": "Verstak Vault Events",
"description": "Event schemas for vault and case lifecycle events",
"type": "object",
"properties": {
"events": {
"type": "array",
"items": {
"$ref": "#/$defs/VaultEvent"
}
}
},
"$defs": {
"VaultEvent": {
"type": "object",
"properties": {
"name": { "type": "string" },
"description": { "type": "string" },
"schema": {
"type": "object",
"properties": {
"type": { "type": "string", "const": "object" },
"properties": { "type": "object" },
"required": { "type": "array", "items": { "type": "string" } }
},
"required": ["type", "properties", "required"]
}
},
"required": ["name", "description", "schema"]
}
},
"events": [
{
"name": "vault.opened",
"description": "Vault has been opened and is ready",
"schema": {
"type": "object",
"properties": {
"path": { "type": "string", "description": "Absolute path to vault root" },
"version": { "type": "string", "description": "Vault schema version" },
"openedAt": { "type": "string", "description": "ISO 8601 timestamp" }
},
"required": ["path", "openedAt"]
}
},
{
"name": "vault.closed",
"description": "Vault is about to close",
"schema": {
"type": "object",
"properties": {
"closedAt": { "type": "string", "description": "ISO 8601 timestamp" },
"clean": { "type": "boolean", "description": "Whether vault closed cleanly" }
},
"required": ["closedAt"]
}
},
{
"name": "case.selected",
"description": "A case has been selected in the navigation",
"schema": {
"type": "object",
"properties": {
"caseId": { "type": "string", "description": "Case identifier" },
"casePath": { "type": "string", "description": "Case filesystem path" },
"caseType": { "type": "string", "description": "Case type (client, project, etc.)" },
"selectedAt": { "type": "string", "description": "ISO 8601 timestamp" }
},
"required": ["caseId", "casePath"]
}
},
{
"name": "file.added",
"description": "A file has been added to the vault",
"schema": {
"type": "object",
"properties": {
"path": { "type": "string", "description": "File path relative to vault" },
"size": { "type": "integer", "description": "File size in bytes" },
"mimeType": { "type": "string", "description": "File MIME type" },
"caseId": { "type": "string", "description": "Associated case identifier" },
"addedAt": { "type": "string", "description": "ISO 8601 timestamp" }
},
"required": ["path", "addedAt"]
}
},
{
"name": "file.changed",
"description": "A file in the vault has been modified",
"schema": {
"type": "object",
"properties": {
"path": { "type": "string", "description": "File path relative to vault" },
"size": { "type": "integer", "description": "New file size" },
"changedAt": { "type": "string", "description": "ISO 8601 timestamp" }
},
"required": ["path", "changedAt"]
}
},
{
"name": "file.deleted",
"description": "A file has been deleted from the vault",
"schema": {
"type": "object",
"properties": {
"path": { "type": "string", "description": "File path relative to vault" },
"deletedAt": { "type": "string", "description": "ISO 8601 timestamp" }
},
"required": ["path", "deletedAt"]
}
},
{
"name": "note.saved",
"description": "A note has been saved",
"schema": {
"type": "object",
"properties": {
"noteId": { "type": "string", "description": "Note identifier" },
"title": { "type": "string", "description": "Note title" },
"path": { "type": "string", "description": "Note file path relative to vault" },
"caseId": { "type": "string", "description": "Associated case identifier" },
"savedAt": { "type": "string", "description": "ISO 8601 timestamp" }
},
"required": ["noteId", "path", "savedAt"]
}
},
{
"name": "activity.recorded",
"description": "An activity event has been recorded",
"schema": {
"type": "object",
"properties": {
"type": { "type": "string", "description": "Activity type (file.opened, note.saved, etc.)" },
"caseId": { "type": "string", "description": "Associated case" },
"details": { "type": "object", "description": "Activity-specific details" },
"recordedAt": { "type": "string", "description": "ISO 8601 timestamp" }
},
"required": ["type", "recordedAt"]
}
},
{
"name": "case.created",
"description": "A new case has been created",
"schema": {
"type": "object",
"properties": {
"caseId": { "type": "string" },
"casePath": { "type": "string" },
"caseType": { "type": "string" },
"template": { "type": "string", "description": "Template used, if any" },
"createdAt": { "type": "string" }
},
"required": ["caseId", "casePath", "createdAt"]
}
}
]
}