{"modulePath":"github.com/GoCodeAlone/workflow","version":"v0.87.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package contract\n\nPackage contract contains host/plugin shared types that must stay free of workflow host runtime dependencies.\n\n## Constants\n\n```go\nconst (\n\t// ProtocolVersion is the plugin protocol version.\n\t// Increment this when making breaking changes to the gRPC interface.\n\tProtocolVersion = 1\n\n\t// MagicCookieKey is the environment variable used for the handshake.\n\tMagicCookieKey = \"WORKFLOW_PLUGIN\"\n\n\t// MagicCookieValue is the expected value for the handshake cookie.\n\tMagicCookieValue = \"workflow-external-plugin-v1\"\n)\n```\n\n## Variables\n\n```go\nvar Handshake = goplugin.HandshakeConfig{\n\tProtocolVersion:  ProtocolVersion,\n\tMagicCookieKey:   MagicCookieKey,\n\tMagicCookieValue: MagicCookieValue,\n}\n```\nHandshake is the shared handshake configuration between host and plugins. Both the host client and plugin server must use identical values.\n\n## Types\n\n```go\ntype UIManifest struct {\n\t// Name is the plugin identifier. Must match the plugin directory name.\n\tName string `json:\"name\"`\n\t// Version is the plugin version string (e.g. \"1.0.0\").\n\tVersion string `json:\"version\"`\n\t// Description is a short human-readable description of the plugin.\n\tDescription string `json:\"description,omitempty\"`\n\t// NavItems declares navigation entries contributed to the admin UI.\n\tNavItems []UINavItem `json:\"navItems,omitempty\"`\n\t// AssetDir is the subdirectory within the plugin directory that holds\n\t// static assets. Defaults to \"assets\" when empty.\n\tAssetDir string `json:\"assetDir,omitempty\"`\n}\n```\nUIManifest describes the UI contribution of a go-plugin UI plugin. Place this as \"ui.json\" in the plugin directory alongside \"plugin.json\".\n\n### Directory Layout {#hdr-Directory_Layout}\n\n\tplugins/\n\t  my-ui-plugin/\n\t    my-ui-plugin  (binary, required for API handlers; optional for asset-only plugins)\n\t    plugin.json   (gRPC plugin manifest; required when binary is present)\n\t    ui.json       (UI manifest: nav items and asset location)\n\t    assets/       (static files: HTML, CSS, JS, images, etc.)\n\t      index.html\n\t      main.js\n\n### Asset Versioning {#hdr-Asset_Versioning}\n\nInclude a version hash in asset filenames (e.g. main.abc123.js) and reference them from index.html so browsers pick up new files after hot-deploy.\n\n### Hot-Reload {#hdr-Hot_Reload}\n\nAfter updating assets or ui.json, call:\n\n\tPOST /api/v1/plugins/ui/{name}/reload\n\nThis re-reads the manifest and serves the new files without restarting the workflow engine.\n\n### Hot-Deploy {#hdr-Hot_Deploy}\n\nReplace the plugin binary and/or assets directory with the new version, then call the reload endpoint above.\n\n```go\ntype UINavItem struct {\n\t// ID is the unique page identifier (e.g. \"my-plugin-dashboard\").\n\tID string `json:\"id\"`\n\t// Label is the human-readable navigation label shown in the sidebar.\n\tLabel string `json:\"label\"`\n\t// Icon is an emoji or icon token rendered alongside the label.\n\tIcon string `json:\"icon,omitempty\"`\n\t// Category groups navigation entries:\n\t//   \"global\"   - always visible top-level entries\n\t//   \"workflow\" - shown only when a workflow is open\n\t//   \"plugin\"   - plugin-contributed entries (default)\n\t//   \"tools\"    - administrative tooling entries\n\tCategory string `json:\"category,omitempty\"`\n\t// Order controls the sort position within the category (lower = higher up).\n\tOrder int `json:\"order,omitempty\"`\n\t// RequiredRole is the minimum role needed to see this page\n\t// (e.g. \"viewer\", \"editor\", \"admin\", \"operator\").\n\tRequiredRole string `json:\"requiredRole,omitempty\"`\n\t// RequiredPermission is a specific permission key required to see this page\n\t// (e.g. \"plugins.manage\").\n\tRequiredPermission string `json:\"requiredPermission,omitempty\"`\n}\n```\nUINavItem describes a single entry in the admin UI navigation sidebar.\n\n","path":"github.com/GoCodeAlone/workflow/plugin/external/contract","name":"contract","synopsis":"Package contract contains host/plugin shared types that must stay free of workflow host runtime dependencies.","isRedistributable":true}
