@okdoc-ai/plugin-sdk 1.4.0
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/LICENSE +191 -0
- package/README.md +131 -0
- package/dist/angular.d.ts +36 -0
- package/dist/angular.d.ts.map +1 -0
- package/dist/angular.js +38 -0
- package/dist/angular.js.map +1 -0
- package/dist/converters/gemini.d.ts +26 -0
- package/dist/converters/gemini.d.ts.map +1 -0
- package/dist/converters/gemini.js +66 -0
- package/dist/converters/gemini.js.map +1 -0
- package/dist/converters/index.d.ts +3 -0
- package/dist/converters/index.d.ts.map +1 -0
- package/dist/converters/index.js +6 -0
- package/dist/converters/index.js.map +1 -0
- package/dist/converters/openai.d.ts +25 -0
- package/dist/converters/openai.d.ts.map +1 -0
- package/dist/converters/openai.js +36 -0
- package/dist/converters/openai.js.map +1 -0
- package/dist/decorators.d.ts +50 -0
- package/dist/decorators.d.ts.map +1 -0
- package/dist/decorators.js +78 -0
- package/dist/decorators.js.map +1 -0
- package/dist/handler.d.ts +5 -0
- package/dist/handler.d.ts.map +1 -0
- package/dist/handler.js +8 -0
- package/dist/handler.js.map +1 -0
- package/dist/iframe-sdk-types.d.ts +104 -0
- package/dist/iframe-sdk-types.d.ts.map +1 -0
- package/dist/iframe-sdk-types.js +15 -0
- package/dist/iframe-sdk-types.js.map +1 -0
- package/dist/iframe-sdk.d.ts +2 -0
- package/dist/iframe-sdk.d.ts.map +1 -0
- package/dist/iframe-sdk.js +202 -0
- package/dist/iframe-sdk.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/metadata.d.ts +22 -0
- package/dist/metadata.d.ts.map +1 -0
- package/dist/metadata.js +53 -0
- package/dist/metadata.js.map +1 -0
- package/dist/okdoc-iframe-sdk-global.d.ts +116 -0
- package/dist/okdoc-iframe-sdk.js +1 -0
- package/dist/register-remote.d.ts +50 -0
- package/dist/register-remote.d.ts.map +1 -0
- package/dist/register-remote.js +84 -0
- package/dist/register-remote.js.map +1 -0
- package/dist/symbols.d.ts +5 -0
- package/dist/symbols.d.ts.map +1 -0
- package/dist/symbols.js +8 -0
- package/dist/symbols.js.map +1 -0
- package/dist/types.d.ts +298 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +17 -0
- package/dist/types.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +4 -0
- package/dist/version.js.map +1 -0
- package/package.json +76 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// @okdoc-ai/plugin-sdk — Iframe SDK Global Type Declarations (AUTO-GENERATED)
|
|
3
|
+
//
|
|
4
|
+
// DO NOT EDIT THIS FILE MANUALLY.
|
|
5
|
+
// Generated by scripts/build-iframe-sdk.mjs from src/iframe-sdk-types.ts.
|
|
6
|
+
// To update, edit that file and run: npm run build:all
|
|
7
|
+
//
|
|
8
|
+
// Usage in iframe plugin projects:
|
|
9
|
+
// Copy this file into your project's src/ directory, OR reference it
|
|
10
|
+
// in tsconfig.json → "include": ["path/to/okdoc-iframe-sdk-global.d.ts"]
|
|
11
|
+
// ============================================================================
|
|
12
|
+
interface OkDocJsonSchemaProperty {
|
|
13
|
+
type?: string | string[];
|
|
14
|
+
description?: string;
|
|
15
|
+
enum?: unknown[];
|
|
16
|
+
const?: unknown;
|
|
17
|
+
default?: unknown;
|
|
18
|
+
minLength?: number;
|
|
19
|
+
maxLength?: number;
|
|
20
|
+
pattern?: string;
|
|
21
|
+
format?: string;
|
|
22
|
+
minimum?: number;
|
|
23
|
+
maximum?: number;
|
|
24
|
+
items?: OkDocJsonSchemaProperty | OkDocJsonSchemaProperty[];
|
|
25
|
+
minItems?: number;
|
|
26
|
+
maxItems?: number;
|
|
27
|
+
properties?: Record<string, OkDocJsonSchemaProperty>;
|
|
28
|
+
required?: string[];
|
|
29
|
+
additionalProperties?: boolean | OkDocJsonSchemaProperty;
|
|
30
|
+
oneOf?: OkDocJsonSchemaProperty[];
|
|
31
|
+
anyOf?: OkDocJsonSchemaProperty[];
|
|
32
|
+
allOf?: OkDocJsonSchemaProperty[];
|
|
33
|
+
not?: OkDocJsonSchemaProperty;
|
|
34
|
+
[key: string]: unknown;
|
|
35
|
+
}
|
|
36
|
+
interface OkDocToolInputSchema {
|
|
37
|
+
type: 'object';
|
|
38
|
+
properties?: Record<string, OkDocJsonSchemaProperty>;
|
|
39
|
+
required?: string[];
|
|
40
|
+
}
|
|
41
|
+
interface OkDocAnnotations {
|
|
42
|
+
audience?: ('user' | 'assistant')[];
|
|
43
|
+
priority?: number;
|
|
44
|
+
lastModified?: string;
|
|
45
|
+
}
|
|
46
|
+
interface OkDocToolAnnotations {
|
|
47
|
+
title?: string;
|
|
48
|
+
readOnlyHint?: boolean;
|
|
49
|
+
destructiveHint?: boolean;
|
|
50
|
+
idempotentHint?: boolean;
|
|
51
|
+
openWorldHint?: boolean;
|
|
52
|
+
}
|
|
53
|
+
interface OkDocContentBlock {
|
|
54
|
+
type: 'text' | 'image' | 'audio' | 'resource' | 'resource_link';
|
|
55
|
+
text?: string;
|
|
56
|
+
data?: string;
|
|
57
|
+
mimeType?: string;
|
|
58
|
+
uri?: string;
|
|
59
|
+
name?: string;
|
|
60
|
+
description?: string;
|
|
61
|
+
resource?: {
|
|
62
|
+
uri: string;
|
|
63
|
+
mimeType?: string;
|
|
64
|
+
text?: string;
|
|
65
|
+
blob?: string;
|
|
66
|
+
};
|
|
67
|
+
annotations?: OkDocAnnotations;
|
|
68
|
+
}
|
|
69
|
+
interface OkDocToolResult {
|
|
70
|
+
content: OkDocContentBlock[];
|
|
71
|
+
structuredContent?: Record<string, unknown>;
|
|
72
|
+
isError?: boolean;
|
|
73
|
+
}
|
|
74
|
+
interface OkDocToolConfig {
|
|
75
|
+
description: string;
|
|
76
|
+
inputSchema?: OkDocToolInputSchema;
|
|
77
|
+
annotations?: OkDocToolAnnotations;
|
|
78
|
+
handler: (args: Record<string, unknown>) => Promise<OkDocToolResult>;
|
|
79
|
+
}
|
|
80
|
+
interface OkDocInitOptions {
|
|
81
|
+
/** Unique plugin identifier */
|
|
82
|
+
id: string;
|
|
83
|
+
/** Display name shown in the Plugin Store */
|
|
84
|
+
name: string;
|
|
85
|
+
/** Short description */
|
|
86
|
+
description?: string;
|
|
87
|
+
/** Semver version of the plugin */
|
|
88
|
+
version: string;
|
|
89
|
+
/** Ionicon name for the store card */
|
|
90
|
+
icon?: string;
|
|
91
|
+
/** MCP namespace prefix for all tools */
|
|
92
|
+
namespace: string;
|
|
93
|
+
/** Display mode: foreground (visible UI) or background (hidden) */
|
|
94
|
+
mode?: 'foreground' | 'background';
|
|
95
|
+
/** Allowed origins for the host handshake. If omitted, any origin is accepted. */
|
|
96
|
+
allowedOrigins?: string[];
|
|
97
|
+
}
|
|
98
|
+
interface OkDocIframeSDK {
|
|
99
|
+
/** Initialize the plugin with its manifest. Must be called before registerTool(). */
|
|
100
|
+
init(options: OkDocInitOptions): void;
|
|
101
|
+
/** Register a tool that the host app (AI) can call. */
|
|
102
|
+
registerTool(name: string, config: OkDocToolConfig): void;
|
|
103
|
+
/**
|
|
104
|
+
* Send a notification message to the AI.
|
|
105
|
+
* Only works after the host has connected via handshake.
|
|
106
|
+
*/
|
|
107
|
+
notify(message: string): void;
|
|
108
|
+
/** Clean up the SDK: remove event listeners, close port, clear state. */
|
|
109
|
+
destroy(): void;
|
|
110
|
+
/** Current iframe protocol version */
|
|
111
|
+
readonly version: number;
|
|
112
|
+
/** MCP protocol version this SDK targets */
|
|
113
|
+
readonly mcpProtocolVersion: string;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
declare var OkDoc: OkDocIframeSDK;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var _okdocIframeSDK=(()=>{var f="2025-03-26",s=null,a=null,c=new Map,t=null,i=null;function m(){let o=[];return c.forEach((n,e)=>{let r={name:e,description:n.description};n.inputSchema&&(r.inputSchema=n.inputSchema),n.annotations&&(r.annotations=n.annotations),o.push(r)}),o}function p(o){s&&o.postMessage({type:"okdoc:manifest",sdkVersion:2,manifest:{...s,description:s.description??"",tools:m(),sdkVersion:"1.4.0",mcpProtocolVersion:f}})}function d(){!t||!s||(i!==null&&clearTimeout(i),i=setTimeout(()=>{i=null,t&&s&&p(t)},150))}async function y(o,n,e,r){let u=c.get(e);if(!u){o.postMessage({type:"okdoc:result",id:n,result:{content:[{type:"text",text:`Tool "${e}" not found in this plugin.`}],isError:!0}});return}try{let l=await u.handler(r);o.postMessage({type:"okdoc:result",id:n,result:l})}catch(l){let O=l instanceof Error?l.message:String(l);o.postMessage({type:"okdoc:result",id:n,result:{content:[{type:"text",text:`Tool "${e}" error: ${O}`}],isError:!0}})}}function S(o){let n=o.data;!n||typeof n.type!="string"||n.type==="okdoc:call"&&y(t,n.id,n.tool,n.args??{})}function g(o){let n=o.data;if(!(!n||n.type!=="okdoc:handshake")&&!(!o.ports||o.ports.length===0)){if(a){if(!a.includes(o.origin)){console.warn(`[OkDoc SDK] Rejected handshake from untrusted origin: ${o.origin}`);return}}else console.warn("[OkDoc SDK] No allowedOrigins configured \u2014 accepting handshake from any origin. Set allowedOrigins in OkDoc.init() for production use.");t=o.ports[0],t.onmessage=S,p(t)}}window.addEventListener("message",g);var h={init(o){let{allowedOrigins:n,...e}=o;s=e,a=n??null,d()},registerTool(o,n){c.set(o,n),d()},notify(o){t?(console.log("[OkDoc SDK] Sending notification to host:",o),t.postMessage({type:"okdoc:notify",message:o})):console.warn("[OkDoc SDK] notify() called but no port connected \u2014 handshake not completed yet.")},destroy(){window.removeEventListener("message",g),i!==null&&(clearTimeout(i),i=null),t&&(t.close(),t=null),s=null,a=null,c.clear()},version:2,mcpProtocolVersion:f};Object.defineProperty(window,"OkDoc",{value:Object.freeze(h),writable:!1,configurable:!1});})();
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { RemotePluginBundle, RemotePluginManifest, McpStaticToolDeclaration, OkDocPluginGlobal } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Input type for registerRemotePlugin — tools are optional because the SDK
|
|
4
|
+
* can derive them from toolHandlers keys. After registration the manifest
|
|
5
|
+
* is guaranteed to have tools populated.
|
|
6
|
+
*/
|
|
7
|
+
export type RemotePluginBundleInput = {
|
|
8
|
+
manifest: Omit<RemotePluginManifest, 'tools'> & {
|
|
9
|
+
tools?: McpStaticToolDeclaration[];
|
|
10
|
+
};
|
|
11
|
+
toolHandlers: RemotePluginBundle['toolHandlers'];
|
|
12
|
+
};
|
|
13
|
+
declare global {
|
|
14
|
+
interface Window {
|
|
15
|
+
__OKDOC_PLUGINS__?: OkDocPluginGlobal;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Register a remote plugin so the OkDoc host app can discover it.
|
|
20
|
+
*
|
|
21
|
+
* Call this at the end of your plugin bundle after calling
|
|
22
|
+
* `customElements.define(...)`. The host reads the registered bundle
|
|
23
|
+
* to obtain the manifest (identity + tool declarations) and tool handlers.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* import { registerRemotePlugin } from '@okdoc-ai/plugin-sdk';
|
|
28
|
+
*
|
|
29
|
+
* customElements.define('okdoc-my-plugin', MyPluginElement);
|
|
30
|
+
*
|
|
31
|
+
* registerRemotePlugin({
|
|
32
|
+
* manifest: {
|
|
33
|
+
* id: 'my-plugin',
|
|
34
|
+
* name: 'My Plugin',
|
|
35
|
+
* description: 'Does cool stuff',
|
|
36
|
+
* version: '1.0.0',
|
|
37
|
+
* icon: 'sparkles-outline',
|
|
38
|
+
* namespace: 'my_plugin',
|
|
39
|
+
* elementTag: 'okdoc-my-plugin',
|
|
40
|
+
* },
|
|
41
|
+
* toolHandlers: {
|
|
42
|
+
* do_something: async (args) => ({
|
|
43
|
+
* content: [{ type: 'text', text: 'Done!' }],
|
|
44
|
+
* }),
|
|
45
|
+
* },
|
|
46
|
+
* });
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function registerRemotePlugin(bundle: RemotePluginBundleInput): void;
|
|
50
|
+
//# sourceMappingURL=register-remote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-remote.d.ts","sourceRoot":"","sources":["../src/register-remote.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,iBAAiB,EAAiD,MAAM,YAAY,CAAC;AAElK;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG;IAClC,QAAQ,EAAE,IAAI,CAAC,oBAAoB,EAAE,OAAO,CAAC,GAAG;QAAE,KAAK,CAAC,EAAE,wBAAwB,EAAE,CAAA;KAAE,CAAC;IACvF,YAAY,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;CACpD,CAAC;AAEF,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;QACZ,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;KACzC;CACJ;AAKD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,uBAAuB,GAAG,IAAI,CAqD1E"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// @okdoc-ai/plugin-sdk — Remote Plugin Registration
|
|
3
|
+
//
|
|
4
|
+
// Call registerRemotePlugin() at the end of your plugin bundle's entry point
|
|
5
|
+
// to make it discoverable by the OkDoc host application.
|
|
6
|
+
// ============================================================================
|
|
7
|
+
import { OKDOC_SDK_VERSION, OKDOC_MCP_PROTOCOL_VERSION } from './types.js';
|
|
8
|
+
const ELEMENT_TAG_RE = /^[a-z][a-z0-9]*-[a-z0-9-]*$/;
|
|
9
|
+
const NAMESPACE_RE = /^[a-z][a-z0-9_]*$/;
|
|
10
|
+
/**
|
|
11
|
+
* Register a remote plugin so the OkDoc host app can discover it.
|
|
12
|
+
*
|
|
13
|
+
* Call this at the end of your plugin bundle after calling
|
|
14
|
+
* `customElements.define(...)`. The host reads the registered bundle
|
|
15
|
+
* to obtain the manifest (identity + tool declarations) and tool handlers.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* import { registerRemotePlugin } from '@okdoc-ai/plugin-sdk';
|
|
20
|
+
*
|
|
21
|
+
* customElements.define('okdoc-my-plugin', MyPluginElement);
|
|
22
|
+
*
|
|
23
|
+
* registerRemotePlugin({
|
|
24
|
+
* manifest: {
|
|
25
|
+
* id: 'my-plugin',
|
|
26
|
+
* name: 'My Plugin',
|
|
27
|
+
* description: 'Does cool stuff',
|
|
28
|
+
* version: '1.0.0',
|
|
29
|
+
* icon: 'sparkles-outline',
|
|
30
|
+
* namespace: 'my_plugin',
|
|
31
|
+
* elementTag: 'okdoc-my-plugin',
|
|
32
|
+
* },
|
|
33
|
+
* toolHandlers: {
|
|
34
|
+
* do_something: async (args) => ({
|
|
35
|
+
* content: [{ type: 'text', text: 'Done!' }],
|
|
36
|
+
* }),
|
|
37
|
+
* },
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export function registerRemotePlugin(bundle) {
|
|
42
|
+
const m = bundle.manifest;
|
|
43
|
+
if (!m?.id) {
|
|
44
|
+
throw new Error('[OkDoc SDK] registerRemotePlugin: manifest.id is required');
|
|
45
|
+
}
|
|
46
|
+
if (!m.elementTag) {
|
|
47
|
+
throw new Error('[OkDoc SDK] registerRemotePlugin: manifest.elementTag is required');
|
|
48
|
+
}
|
|
49
|
+
if (!ELEMENT_TAG_RE.test(m.elementTag)) {
|
|
50
|
+
throw new Error(`[OkDoc SDK] registerRemotePlugin: elementTag "${m.elementTag}" must be a valid custom element name (lowercase, must contain a hyphen)`);
|
|
51
|
+
}
|
|
52
|
+
if (m.namespace && !NAMESPACE_RE.test(m.namespace)) {
|
|
53
|
+
throw new Error(`[OkDoc SDK] registerRemotePlugin: namespace "${m.namespace}" must be lowercase alphanumeric with underscores`);
|
|
54
|
+
}
|
|
55
|
+
// Auto-populate SDK version info
|
|
56
|
+
if (!m.sdkVersion)
|
|
57
|
+
m.sdkVersion = OKDOC_SDK_VERSION;
|
|
58
|
+
if (!m.mcpProtocolVersion)
|
|
59
|
+
m.mcpProtocolVersion = OKDOC_MCP_PROTOCOL_VERSION;
|
|
60
|
+
// Auto-populate tools from handler keys if not declared
|
|
61
|
+
if (!m.tools || m.tools.length === 0) {
|
|
62
|
+
m.tools = Object.keys(bundle.toolHandlers).map(name => ({
|
|
63
|
+
name,
|
|
64
|
+
description: `Tool "${name}" from ${m.name}`,
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
// Warn if toolHandlers don't match declared tools
|
|
68
|
+
if (m.tools && m.tools.length > 0) {
|
|
69
|
+
const declaredNames = new Set(m.tools.map(t => t.name));
|
|
70
|
+
for (const handlerName of Object.keys(bundle.toolHandlers)) {
|
|
71
|
+
if (!declaredNames.has(handlerName)) {
|
|
72
|
+
console.warn(`[OkDoc SDK] registerRemotePlugin: toolHandler "${handlerName}" has no matching tool declaration in manifest.tools`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (!window.__OKDOC_PLUGINS__) {
|
|
77
|
+
window.__OKDOC_PLUGINS__ = {};
|
|
78
|
+
}
|
|
79
|
+
if (window.__OKDOC_PLUGINS__[m.id]) {
|
|
80
|
+
console.warn(`[OkDoc SDK] registerRemotePlugin: plugin "${m.id}" is already registered, overwriting`);
|
|
81
|
+
}
|
|
82
|
+
window.__OKDOC_PLUGINS__[m.id] = bundle;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=register-remote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-remote.js","sourceRoot":"","sources":["../src/register-remote.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,oDAAo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AG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACpD,IAAI;YACJ,WAAW,EAAE,SAAS,IAAI,UAAU,CAAC,CAAC,IAAI,EAAE;SAC/C,CAAC,CAAC,CAAC;IACR,CAAC;IAED,kDAAkD;IAClD,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAChC,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QACxD,KAAK,MAAM,WAAW,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC;YACzD,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;gBAClC,OAAO,CAAC,IAAI,CACR,kDAAkD,WAAW,sDAAsD,CACtH,CAAC;YACN,CAAC;QACL,CAAC;IACL,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;QAC5B,MAAM,CAAC,iBAAiB,GAAG,EAAE,CAAC;IAClC,CAAC;IAED,IAAI,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;QACjC,OAAO,CAAC,IAAI,CAAC,6CAA6C,CAAC,CAAC,EAAE,sCAAsC,CAAC,CAAC;IAC1G,CAAC;IAED,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,MAA4B,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Symbol key for @OkDocPlugin metadata stored on the class constructor */
|
|
2
|
+
export declare const OKDOC_PLUGIN_KEY: unique symbol;
|
|
3
|
+
/** Symbol key for @McpTool metadata stored on the class prototype */
|
|
4
|
+
export declare const MCP_TOOLS_KEY: unique symbol;
|
|
5
|
+
//# sourceMappingURL=symbols.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbols.d.ts","sourceRoot":"","sources":["../src/symbols.ts"],"names":[],"mappings":"AAIA,2EAA2E;AAC3E,eAAO,MAAM,gBAAgB,EAAE,OAAO,MAA8B,CAAC;AAErE,qEAAqE;AACrE,eAAO,MAAM,aAAa,EAAE,OAAO,MAA2B,CAAC"}
|
package/dist/symbols.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// @okdoc-ai/plugin-sdk — Metadata keys (Symbols)
|
|
3
|
+
// ============================================================================
|
|
4
|
+
/** Symbol key for @OkDocPlugin metadata stored on the class constructor */
|
|
5
|
+
export const OKDOC_PLUGIN_KEY = Symbol('OkDocPlugin');
|
|
6
|
+
/** Symbol key for @McpTool metadata stored on the class prototype */
|
|
7
|
+
export const MCP_TOOLS_KEY = Symbol('McpTools');
|
|
8
|
+
//# sourceMappingURL=symbols.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbols.js","sourceRoot":"","sources":["../src/symbols.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,iDAAiD;AACjD,+EAA+E;AAE/E,2EAA2E;AAC3E,MAAM,CAAC,MAAM,gBAAgB,GAAkB,MAAM,CAAC,aAAa,CAAC,CAAC;AAErE,qEAAqE;AACrE,MAAM,CAAC,MAAM,aAAa,GAAkB,MAAM,CAAC,UAAU,CAAC,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
/** The MCP protocol version this SDK targets */
|
|
2
|
+
export declare const OKDOC_MCP_PROTOCOL_VERSION = "2025-03-26";
|
|
3
|
+
/** The OkDoc SDK version (semver) — auto-generated from package.json by stamp-version */
|
|
4
|
+
export { OKDOC_SDK_VERSION } from './version.js';
|
|
5
|
+
/**
|
|
6
|
+
* Current protocol version for iframe plugin communication.
|
|
7
|
+
* Bumped (integer) only on breaking changes to the message format.
|
|
8
|
+
*/
|
|
9
|
+
export declare const OKDOC_IFRAME_PROTOCOL_VERSION = 2;
|
|
10
|
+
/** A JSON Schema property definition (subset of JSON Schema 2020-12). */
|
|
11
|
+
export interface JsonSchemaProperty {
|
|
12
|
+
type?: string | string[];
|
|
13
|
+
description?: string;
|
|
14
|
+
enum?: unknown[];
|
|
15
|
+
const?: unknown;
|
|
16
|
+
default?: unknown;
|
|
17
|
+
minLength?: number;
|
|
18
|
+
maxLength?: number;
|
|
19
|
+
pattern?: string;
|
|
20
|
+
format?: string;
|
|
21
|
+
minimum?: number;
|
|
22
|
+
maximum?: number;
|
|
23
|
+
exclusiveMinimum?: number;
|
|
24
|
+
exclusiveMaximum?: number;
|
|
25
|
+
multipleOf?: number;
|
|
26
|
+
items?: JsonSchemaProperty | JsonSchemaProperty[];
|
|
27
|
+
minItems?: number;
|
|
28
|
+
maxItems?: number;
|
|
29
|
+
uniqueItems?: boolean;
|
|
30
|
+
properties?: Record<string, JsonSchemaProperty>;
|
|
31
|
+
required?: string[];
|
|
32
|
+
additionalProperties?: boolean | JsonSchemaProperty;
|
|
33
|
+
oneOf?: JsonSchemaProperty[];
|
|
34
|
+
anyOf?: JsonSchemaProperty[];
|
|
35
|
+
allOf?: JsonSchemaProperty[];
|
|
36
|
+
not?: JsonSchemaProperty;
|
|
37
|
+
[key: string]: unknown;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* JSON Schema for MCP tool input parameters.
|
|
41
|
+
* Must be `type: 'object'` at the root level per MCP spec.
|
|
42
|
+
*/
|
|
43
|
+
export interface McpToolInputSchema {
|
|
44
|
+
type: 'object';
|
|
45
|
+
properties?: Record<string, JsonSchemaProperty>;
|
|
46
|
+
required?: string[];
|
|
47
|
+
additionalProperties?: boolean | JsonSchemaProperty;
|
|
48
|
+
$schema?: string;
|
|
49
|
+
}
|
|
50
|
+
/** Optional annotations on content blocks and resources. */
|
|
51
|
+
export interface McpAnnotations {
|
|
52
|
+
/** Intended audience(s) for the content. */
|
|
53
|
+
audience?: ('user' | 'assistant')[];
|
|
54
|
+
/** Importance hint, 0 (least) to 1 (most). */
|
|
55
|
+
priority?: number;
|
|
56
|
+
/** ISO 8601 timestamp for the most recent modification. */
|
|
57
|
+
lastModified?: string;
|
|
58
|
+
}
|
|
59
|
+
/** Text provided to or from the LLM. */
|
|
60
|
+
export interface McpTextContent {
|
|
61
|
+
type: 'text';
|
|
62
|
+
text: string;
|
|
63
|
+
annotations?: McpAnnotations;
|
|
64
|
+
}
|
|
65
|
+
/** An image (base64-encoded). */
|
|
66
|
+
export interface McpImageContent {
|
|
67
|
+
type: 'image';
|
|
68
|
+
data: string;
|
|
69
|
+
/** MIME type of the image (required per MCP spec). */
|
|
70
|
+
mimeType: string;
|
|
71
|
+
annotations?: McpAnnotations;
|
|
72
|
+
}
|
|
73
|
+
/** Audio data (base64-encoded). */
|
|
74
|
+
export interface McpAudioContent {
|
|
75
|
+
type: 'audio';
|
|
76
|
+
data: string;
|
|
77
|
+
/** MIME type of the audio (required per MCP spec). */
|
|
78
|
+
mimeType: string;
|
|
79
|
+
annotations?: McpAnnotations;
|
|
80
|
+
}
|
|
81
|
+
/** The contents of a resource, embedded into a tool result. */
|
|
82
|
+
export interface McpEmbeddedResource {
|
|
83
|
+
type: 'resource';
|
|
84
|
+
resource: {
|
|
85
|
+
uri: string;
|
|
86
|
+
mimeType?: string;
|
|
87
|
+
text?: string;
|
|
88
|
+
blob?: string;
|
|
89
|
+
};
|
|
90
|
+
annotations?: McpAnnotations;
|
|
91
|
+
}
|
|
92
|
+
/** A resource link (2025-11-25). */
|
|
93
|
+
export interface McpResourceLink {
|
|
94
|
+
type: 'resource_link';
|
|
95
|
+
uri: string;
|
|
96
|
+
name: string;
|
|
97
|
+
description?: string;
|
|
98
|
+
mimeType?: string;
|
|
99
|
+
annotations?: McpAnnotations;
|
|
100
|
+
}
|
|
101
|
+
/** Union of all MCP content block types. */
|
|
102
|
+
export type McpContentBlock = McpTextContent | McpImageContent | McpAudioContent | McpEmbeddedResource | McpResourceLink;
|
|
103
|
+
/**
|
|
104
|
+
* Additional properties describing a Tool to clients.
|
|
105
|
+
* All properties are **hints** — not guaranteed to be faithful.
|
|
106
|
+
*/
|
|
107
|
+
export interface McpToolAnnotations {
|
|
108
|
+
/** A human-readable title for the tool. */
|
|
109
|
+
title?: string;
|
|
110
|
+
/** If true, the tool does not modify its environment. Default: false. */
|
|
111
|
+
readOnlyHint?: boolean;
|
|
112
|
+
/** If true, the tool may perform destructive updates. Default: true. */
|
|
113
|
+
destructiveHint?: boolean;
|
|
114
|
+
/** If true, calling repeatedly with same args has no additional effect. Default: false. */
|
|
115
|
+
idempotentHint?: boolean;
|
|
116
|
+
/** If true, the tool may interact with an open world of external entities. Default: true. */
|
|
117
|
+
openWorldHint?: boolean;
|
|
118
|
+
}
|
|
119
|
+
/** Result returned by a tool handler. */
|
|
120
|
+
export interface McpToolResult {
|
|
121
|
+
content: McpContentBlock[];
|
|
122
|
+
/** Structured output matching `outputSchema`, if declared (2025-11-25). */
|
|
123
|
+
structuredContent?: Record<string, unknown>;
|
|
124
|
+
/** Whether the tool call ended in an error. */
|
|
125
|
+
isError?: boolean;
|
|
126
|
+
}
|
|
127
|
+
/** Metadata stored by @OkDocPlugin on the class constructor. */
|
|
128
|
+
export interface OkDocPluginMetadata {
|
|
129
|
+
/** Unique plugin identifier (e.g. 'simple-audio-player') */
|
|
130
|
+
id: string;
|
|
131
|
+
/** Display name shown in the Plugin Store */
|
|
132
|
+
name: string;
|
|
133
|
+
/** Short description shown in the Plugin Store */
|
|
134
|
+
description: string;
|
|
135
|
+
/** Semver version string */
|
|
136
|
+
version: string;
|
|
137
|
+
/** Ionicon name for the store card (e.g. 'musical-notes-outline') */
|
|
138
|
+
icon?: string;
|
|
139
|
+
/** MCP namespace prefix for all tools (e.g. 'audio_player') */
|
|
140
|
+
namespace: string;
|
|
141
|
+
/** Semver of the @okdoc-ai/plugin-sdk this plugin was built with */
|
|
142
|
+
sdkVersion?: string;
|
|
143
|
+
/** MCP protocol version this plugin conforms to (e.g. '2025-03-26') */
|
|
144
|
+
mcpProtocolVersion?: string;
|
|
145
|
+
}
|
|
146
|
+
/** Metadata stored by @McpTool on each method. */
|
|
147
|
+
export interface McpToolMetadata {
|
|
148
|
+
/** Method name on the class (set by the decorator) */
|
|
149
|
+
methodName: string;
|
|
150
|
+
/** Tool name override. Defaults to methodName. */
|
|
151
|
+
name?: string;
|
|
152
|
+
/** Human-readable description for the AI */
|
|
153
|
+
description: string;
|
|
154
|
+
/** JSON Schema for tool arguments */
|
|
155
|
+
inputSchema?: McpToolInputSchema;
|
|
156
|
+
/** Additional tool annotations (hints for clients) */
|
|
157
|
+
annotations?: McpToolAnnotations;
|
|
158
|
+
}
|
|
159
|
+
/** Static tool declaration (no handler) — derived from @McpTool metadata. */
|
|
160
|
+
export interface McpStaticToolDeclaration {
|
|
161
|
+
name: string;
|
|
162
|
+
description: string;
|
|
163
|
+
inputSchema?: McpToolInputSchema;
|
|
164
|
+
/** Output schema for typed results (2025-11-25). */
|
|
165
|
+
outputSchema?: McpToolInputSchema;
|
|
166
|
+
/** Additional tool annotations (hints for clients). */
|
|
167
|
+
annotations?: McpToolAnnotations;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* A resolved plugin manifest: identity metadata + tool declarations.
|
|
171
|
+
*
|
|
172
|
+
* This is the base for all concrete manifest types (remote, iframe, host-side).
|
|
173
|
+
* Unlike `OkDocPluginMetadata` (which is the decorator config and has no tools),
|
|
174
|
+
* a manifest always carries its tool declarations.
|
|
175
|
+
*/
|
|
176
|
+
export interface OkDocPluginManifest extends OkDocPluginMetadata {
|
|
177
|
+
/** Static tool declarations for this plugin */
|
|
178
|
+
tools: McpStaticToolDeclaration[];
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Manifest for a remotely-loaded plugin (Web Component boundary).
|
|
182
|
+
*
|
|
183
|
+
* Unlike bundled plugins (which use @OkDocPlugin decorator on an Angular class),
|
|
184
|
+
* remote plugins register via `window.__OKDOC_PLUGINS__[id]` and render as
|
|
185
|
+
* Custom Elements. This manifest describes the plugin for the host app.
|
|
186
|
+
*/
|
|
187
|
+
export interface RemotePluginManifest extends OkDocPluginManifest {
|
|
188
|
+
/** Custom element tag name (must contain a hyphen, e.g. 'okdoc-timer') */
|
|
189
|
+
elementTag: string;
|
|
190
|
+
/** Framework used to build the plugin (informational) */
|
|
191
|
+
framework?: 'angular' | 'react' | 'vanilla';
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* The bundle object that a remote plugin registers on `window.__OKDOC_PLUGINS__`.
|
|
195
|
+
*
|
|
196
|
+
* Plugin developers call `registerRemotePlugin(bundle)` at the end of their
|
|
197
|
+
* bundle's entry point.
|
|
198
|
+
*/
|
|
199
|
+
export interface RemotePluginBundle {
|
|
200
|
+
/** Plugin manifest with identity, tools, and element tag */
|
|
201
|
+
manifest: RemotePluginManifest;
|
|
202
|
+
/** Map of tool name → handler function. Tool names must match manifest tool names. */
|
|
203
|
+
toolHandlers: Record<string, (args: Record<string, unknown>) => Promise<McpToolResult>>;
|
|
204
|
+
}
|
|
205
|
+
/** Shape of the global plugin registry on `window`. */
|
|
206
|
+
export interface OkDocPluginGlobal {
|
|
207
|
+
[pluginId: string]: RemotePluginBundle;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Manifest for an iframe-based plugin.
|
|
211
|
+
*
|
|
212
|
+
* Iframe plugins run inside a cross-origin `<iframe>`. The host discovers
|
|
213
|
+
* tools via a MessageChannel handshake, then destroys the iframe. On tool
|
|
214
|
+
* call the iframe is re-created and the tool is invoked via the port.
|
|
215
|
+
*/
|
|
216
|
+
export interface IframePluginManifest extends OkDocPluginManifest {
|
|
217
|
+
/** Display mode: foreground (visible UI) or background (hidden) */
|
|
218
|
+
mode?: 'foreground' | 'background';
|
|
219
|
+
}
|
|
220
|
+
/** Host → iframe: initial handshake (sent via window.postMessage with port2). */
|
|
221
|
+
export interface OkDocIframeHandshake {
|
|
222
|
+
type: 'okdoc:handshake';
|
|
223
|
+
/** Iframe protocol version the host supports */
|
|
224
|
+
version: number;
|
|
225
|
+
/** MCP protocol version the host supports */
|
|
226
|
+
mcpProtocolVersion?: string;
|
|
227
|
+
/** SDK version the host is running */
|
|
228
|
+
hostSdkVersion?: string;
|
|
229
|
+
}
|
|
230
|
+
/** iframe → host: manifest response (sent on the MessageChannel port). */
|
|
231
|
+
export interface OkDocIframeManifestMessage {
|
|
232
|
+
type: 'okdoc:manifest';
|
|
233
|
+
/** Protocol version the iframe SDK implements */
|
|
234
|
+
sdkVersion: number;
|
|
235
|
+
/** Plugin manifest with tool declarations */
|
|
236
|
+
manifest: IframePluginManifest;
|
|
237
|
+
}
|
|
238
|
+
/** host → iframe: tool call request (sent on the MessageChannel port). */
|
|
239
|
+
export interface OkDocIframeCallMessage {
|
|
240
|
+
type: 'okdoc:call';
|
|
241
|
+
/** Unique call ID for correlating the response */
|
|
242
|
+
id: string;
|
|
243
|
+
/** Tool name (within namespace, e.g. 'getWeather') */
|
|
244
|
+
tool: string;
|
|
245
|
+
/** Tool arguments */
|
|
246
|
+
args: Record<string, unknown>;
|
|
247
|
+
}
|
|
248
|
+
/** iframe → host: tool call result (sent on the MessageChannel port). */
|
|
249
|
+
export interface OkDocIframeResultMessage {
|
|
250
|
+
type: 'okdoc:result';
|
|
251
|
+
/** Correlates with the call ID */
|
|
252
|
+
id: string;
|
|
253
|
+
/** Tool execution result */
|
|
254
|
+
result: McpToolResult;
|
|
255
|
+
}
|
|
256
|
+
/** iframe → host: push notification to AI (sent on the MessageChannel port). */
|
|
257
|
+
export interface OkDocIframeNotifyMessage {
|
|
258
|
+
type: 'okdoc:notify';
|
|
259
|
+
/** Notification text for the AI */
|
|
260
|
+
message: string;
|
|
261
|
+
}
|
|
262
|
+
/** Union of all messages that flow over the MessageChannel port. */
|
|
263
|
+
export type OkDocIframePortMessage = OkDocIframeManifestMessage | OkDocIframeCallMessage | OkDocIframeResultMessage | OkDocIframeNotifyMessage;
|
|
264
|
+
/**
|
|
265
|
+
* Contract that plugin components/services implement to expose MCP tools.
|
|
266
|
+
* The host registry reads tools from this interface during registration.
|
|
267
|
+
*/
|
|
268
|
+
export interface McpToolProvider {
|
|
269
|
+
getMcpTools(): McpToolDefinition[];
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* A single tool definition exposed by a plugin at runtime.
|
|
273
|
+
*
|
|
274
|
+
* Extends the static declaration with host-side fields: a namespace,
|
|
275
|
+
* a fully-qualified name, and an optional live handler.
|
|
276
|
+
*/
|
|
277
|
+
export interface McpToolDefinition {
|
|
278
|
+
/** Tool name within namespace (e.g. 'play') */
|
|
279
|
+
name: string;
|
|
280
|
+
/** Fully qualified name (e.g. 'audio_player_play'). Set by the host registry. */
|
|
281
|
+
fullName?: string;
|
|
282
|
+
/** Namespace this tool belongs to. Set by the host registry. */
|
|
283
|
+
namespace?: string;
|
|
284
|
+
/** Human-readable description for the AI */
|
|
285
|
+
description: string;
|
|
286
|
+
/** JSON Schema describing input parameters (omit for no-arg tools) */
|
|
287
|
+
inputSchema?: McpToolInputSchema;
|
|
288
|
+
/** Tool annotations — hints for AI clients (readOnlyHint, destructiveHint, etc.) */
|
|
289
|
+
annotations?: McpToolAnnotations;
|
|
290
|
+
/** The handler function invoked when the AI calls this tool. Absent for deferred (manifest-only) tools. */
|
|
291
|
+
handler?: (args: Record<string, unknown>) => Promise<McpToolResult>;
|
|
292
|
+
}
|
|
293
|
+
/** Configuration passed when registering a plugin component with the host registry. */
|
|
294
|
+
export interface McpComponentConfig {
|
|
295
|
+
/** Namespace prefix for tool names (e.g. 'audio_player') */
|
|
296
|
+
namespace: string;
|
|
297
|
+
}
|
|
298
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.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IACrB,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,oEAAoE;AACpE,MAAM,MAAM,sBAAsB,GAC5B,0BAA0B,GAC1B,sBAAsB,GACtB,wBAAwB,GACxB,wBAAwB,CAAC;AAM/B;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC5B,WAAW,IAAI,iBAAiB,EAAE,CAAC;CACtC;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAC9B,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,iFAAiF;IACjF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,sEAAsE;IACtE,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,oFAAoF;IACpF,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,2GAA2G;IAC3G,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;CACvE;AAED,uFAAuF;AACvF,MAAM,WAAW,kBAAkB;IAC/B,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAC;CACrB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// @okdoc-ai/plugin-sdk — Types
|
|
3
|
+
//
|
|
4
|
+
// Aligned with MCP spec 2025-03-26 (baseline) with forward hooks
|
|
5
|
+
// for 2025-11-25 features (outputSchema, structuredContent, resource_link).
|
|
6
|
+
// ============================================================================
|
|
7
|
+
// ── Version Constants ───────────────────────────────────────────────────────
|
|
8
|
+
/** The MCP protocol version this SDK targets */
|
|
9
|
+
export const OKDOC_MCP_PROTOCOL_VERSION = '2025-03-26';
|
|
10
|
+
/** The OkDoc SDK version (semver) — auto-generated from package.json by stamp-version */
|
|
11
|
+
export { OKDOC_SDK_VERSION } from './version.js';
|
|
12
|
+
/**
|
|
13
|
+
* Current protocol version for iframe plugin communication.
|
|
14
|
+
* Bumped (integer) only on breaking changes to the message format.
|
|
15
|
+
*/
|
|
16
|
+
export const OKDOC_IFRAME_PROTOCOL_VERSION = 2;
|
|
17
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,+BAA+B;AAC/B,EAAE;AACF,iEAAiE;AACjE,4EAA4E;AAC5E,+EAA+E;AAE/E,+EAA+E;AAE/E,gDAAgD;AAChD,MAAM,CAAC,MAAM,0BAA0B,GAAG,YAAY,CAAC;AAEvD,yFAAyF;AACzF,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,UAAU,CAAC"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,iDAAiD;AACjD,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAC"}
|