@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
package/LICENSE
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding any notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
Copyright 2025 okDoc AI
|
|
180
|
+
|
|
181
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
182
|
+
you may not use this file except in compliance with the License.
|
|
183
|
+
You may obtain a copy of the License at
|
|
184
|
+
|
|
185
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
186
|
+
|
|
187
|
+
Unless required by applicable law or agreed to in writing, software
|
|
188
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
189
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
190
|
+
See the License for the specific language governing permissions and
|
|
191
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# @okdoc-ai/plugin-sdk
|
|
2
|
+
|
|
3
|
+
[](https://github.com/okDoc-ai/plugin-sdk/actions/workflows/ci.yml)
|
|
4
|
+
[](https://github.com/okDoc-ai/plugin-sdk/releases)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
7
|
+
SDK for building **okDoc AI-powered plugins**. Provides MCP-aligned types, decorators, AI format converters, and a standalone iframe SDK for creating plugins that integrate with the okDoc voice assistant.
|
|
8
|
+
|
|
9
|
+
## Plugin types
|
|
10
|
+
|
|
11
|
+
| Type | Runtime | Best for |
|
|
12
|
+
|------|---------|----------|
|
|
13
|
+
| **Iframe plugin** | Standalone HTML page in an `<iframe>` | Third-party developers, any tech stack, full isolation |
|
|
14
|
+
| **Remote plugin** | Angular web component loaded at runtime | First-party / trusted plugins, deep host integration |
|
|
15
|
+
|
|
16
|
+
## Quick start — Iframe plugin (no npm required)
|
|
17
|
+
|
|
18
|
+
Add a single `<script>` tag and declare your tools:
|
|
19
|
+
|
|
20
|
+
```html
|
|
21
|
+
<script src="https://cdn.jsdelivr.net/gh/okDoc-ai/plugin-sdk@1.0.0/cdn/okdoc-iframe-sdk.js"></script>
|
|
22
|
+
<script>
|
|
23
|
+
const sdk = OkDocIframeSDK.create({
|
|
24
|
+
pluginId: 'my-plugin',
|
|
25
|
+
displayName: 'My Plugin',
|
|
26
|
+
tools: [
|
|
27
|
+
{
|
|
28
|
+
name: 'greet',
|
|
29
|
+
description: 'Say hello',
|
|
30
|
+
inputSchema: {
|
|
31
|
+
type: 'object',
|
|
32
|
+
properties: { name: { type: 'string', description: 'Name to greet' } },
|
|
33
|
+
required: ['name'],
|
|
34
|
+
},
|
|
35
|
+
handler: async ({ name }) => ({
|
|
36
|
+
content: [{ type: 'text', text: `Hello, ${name}!` }],
|
|
37
|
+
}),
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
});
|
|
41
|
+
</script>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
> **TypeScript support:** Drop [`okdoc-iframe-sdk-global.d.ts`](cdn/okdoc-iframe-sdk-global.d.ts) into your project for full autocompletion.
|
|
45
|
+
|
|
46
|
+
See the full guide: [DOCS/IframePluginGuide.md](DOCS/IframePluginGuide.md)
|
|
47
|
+
|
|
48
|
+
## Quick start — Remote plugin (Angular)
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm install @okdoc-ai/plugin-sdk
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
import { OkDocPlugin, McpTool } from '@okdoc-ai/plugin-sdk';
|
|
56
|
+
|
|
57
|
+
@OkDocPlugin({
|
|
58
|
+
pluginId: 'weather',
|
|
59
|
+
displayName: 'Weather Plugin',
|
|
60
|
+
version: '1.0.0',
|
|
61
|
+
})
|
|
62
|
+
class WeatherPlugin {
|
|
63
|
+
@McpTool({
|
|
64
|
+
name: 'get_weather',
|
|
65
|
+
description: 'Get the current weather for a city',
|
|
66
|
+
inputSchema: {
|
|
67
|
+
type: 'object',
|
|
68
|
+
properties: { city: { type: 'string', description: 'City name' } },
|
|
69
|
+
required: ['city'],
|
|
70
|
+
},
|
|
71
|
+
})
|
|
72
|
+
async getWeather({ city }: { city: string }) {
|
|
73
|
+
return { content: [{ type: 'text', text: `Weather in ${city}: Sunny, 25°C` }] };
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
See the full guide: [DOCS/RemotePluginGuide.md](DOCS/RemotePluginGuide.md)
|
|
79
|
+
|
|
80
|
+
## Exports
|
|
81
|
+
|
|
82
|
+
| Import path | Purpose |
|
|
83
|
+
|-------------|---------|
|
|
84
|
+
| `@okdoc-ai/plugin-sdk` | Core types, decorators (`@OkDocPlugin`, `@McpTool`), metadata readers, registration |
|
|
85
|
+
| `@okdoc-ai/plugin-sdk/angular` | Angular integration (`OkDocNotifier`, `OKDOC_NOTIFIER_TOKEN`) |
|
|
86
|
+
| `@okdoc-ai/plugin-sdk/handler` | Host-side AI format converters (`toGeminiFunctionDeclarations`, `toOpenAiFunctions`) |
|
|
87
|
+
|
|
88
|
+
## CDN / jsdelivr
|
|
89
|
+
|
|
90
|
+
The standalone iframe SDK is served via [jsdelivr](https://www.jsdelivr.com/):
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
https://cdn.jsdelivr.net/gh/okDoc-ai/plugin-sdk@<version>/cdn/okdoc-iframe-sdk.js
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Replace `<version>` with a specific tag (e.g. `1.0.0`) or use semver ranges (`@1`, `@1.0`).
|
|
97
|
+
|
|
98
|
+
## Documentation
|
|
99
|
+
|
|
100
|
+
| Guide | Description |
|
|
101
|
+
|-------|-------------|
|
|
102
|
+
| [Iframe Plugin Guide](DOCS/IframePluginGuide.md) | Build iframe plugins (any tech stack, no npm) |
|
|
103
|
+
| [Remote Plugin Guide](DOCS/RemotePluginGuide.md) | Build Angular remote plugins |
|
|
104
|
+
| [Sample Remote Component Guide](DOCS/SampleRemoteComponentDevelopmentGuide.md) | Step-by-step sample remote component |
|
|
105
|
+
| [Ionic Angular Project Setup](DOCS/IonicAngularProjectSetup.md) | Host app project setup reference |
|
|
106
|
+
|
|
107
|
+
## Building from source
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
npm install
|
|
111
|
+
npm run build:all # TypeScript compilation + iframe SDK bundle
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Build outputs:
|
|
115
|
+
- `dist/` — ES module library (main SDK)
|
|
116
|
+
- `dist/okdoc-iframe-sdk.js` — Standalone IIFE bundle for `<script>` tags
|
|
117
|
+
- `cdn/` — jsdelivr-ready copies of the iframe SDK files
|
|
118
|
+
|
|
119
|
+
## Releasing
|
|
120
|
+
|
|
121
|
+
Use the interactive release script:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
npm run release 1.2.0
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The script walks you through each step (version bump → build → commit → tag → push) with **yes / skip / cancel** prompts. On push, GitHub Actions creates the release automatically.
|
|
128
|
+
|
|
129
|
+
## License
|
|
130
|
+
|
|
131
|
+
[Apache License 2.0](LICENSE) — Copyright 2025 okDoc AI
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
/**
|
|
3
|
+
* Abstract notifier that plugins inject to send bidirectional messages to the AI.
|
|
4
|
+
*
|
|
5
|
+
* Usage in a plugin:
|
|
6
|
+
* ```typescript
|
|
7
|
+
* import { OkDocNotifier } from '@okdoc-ai/plugin-sdk/angular';
|
|
8
|
+
*
|
|
9
|
+
* export class MyPluginComponent {
|
|
10
|
+
* private notifier = inject(OkDocNotifier);
|
|
11
|
+
*
|
|
12
|
+
* onTrackFinished() {
|
|
13
|
+
* this.notifier.notify('Track finished playing', 'audio_player');
|
|
14
|
+
* }
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* The host app provides the implementation:
|
|
19
|
+
* ```typescript
|
|
20
|
+
* provideOkDocNotifier(() => inject(McpRegistryService))
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare abstract class OkDocNotifier {
|
|
24
|
+
/**
|
|
25
|
+
* Send a notification message to the AI.
|
|
26
|
+
* @param message Human-readable message describing the event
|
|
27
|
+
* @param namespace Plugin namespace (e.g. 'audio_player')
|
|
28
|
+
*/
|
|
29
|
+
abstract notify(message: string, namespace?: string): void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* InjectionToken for providing OkDocNotifier.
|
|
33
|
+
* Host app must provide this; plugins inject OkDocNotifier directly.
|
|
34
|
+
*/
|
|
35
|
+
export declare const OKDOC_NOTIFIER_TOKEN: InjectionToken<OkDocNotifier>;
|
|
36
|
+
//# sourceMappingURL=angular.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"angular.d.ts","sourceRoot":"","sources":["../src/angular.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,8BAAsB,aAAa;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI;CAC7D;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,+BAAqD,CAAC"}
|
package/dist/angular.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// @okdoc-ai/plugin-sdk/angular — Angular-specific exports
|
|
3
|
+
//
|
|
4
|
+
// This subpath export isolates @angular/core dependency so non-Angular
|
|
5
|
+
// consumers can use the SDK without peer dependency warnings.
|
|
6
|
+
//
|
|
7
|
+
// Import from '@okdoc-ai/plugin-sdk/angular' instead of '@okdoc-ai/plugin-sdk'.
|
|
8
|
+
// ============================================================================
|
|
9
|
+
import { InjectionToken } from '@angular/core';
|
|
10
|
+
/**
|
|
11
|
+
* Abstract notifier that plugins inject to send bidirectional messages to the AI.
|
|
12
|
+
*
|
|
13
|
+
* Usage in a plugin:
|
|
14
|
+
* ```typescript
|
|
15
|
+
* import { OkDocNotifier } from '@okdoc-ai/plugin-sdk/angular';
|
|
16
|
+
*
|
|
17
|
+
* export class MyPluginComponent {
|
|
18
|
+
* private notifier = inject(OkDocNotifier);
|
|
19
|
+
*
|
|
20
|
+
* onTrackFinished() {
|
|
21
|
+
* this.notifier.notify('Track finished playing', 'audio_player');
|
|
22
|
+
* }
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* The host app provides the implementation:
|
|
27
|
+
* ```typescript
|
|
28
|
+
* provideOkDocNotifier(() => inject(McpRegistryService))
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export class OkDocNotifier {
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* InjectionToken for providing OkDocNotifier.
|
|
35
|
+
* Host app must provide this; plugins inject OkDocNotifier directly.
|
|
36
|
+
*/
|
|
37
|
+
export const OKDOC_NOTIFIER_TOKEN = new InjectionToken('OkDocNotifier');
|
|
38
|
+
//# sourceMappingURL=angular.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"angular.js","sourceRoot":"","sources":["../src/angular.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,0DAA0D;AAC1D,EAAE;AACF,uEAAuE;AACvE,8DAA8D;AAC9D,EAAE;AACF,gFAAgF;AAChF,+EAA+E;AAE/E,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAgB,aAAa;CAOlC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,cAAc,CAAgB,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { McpStaticToolDeclaration } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Gemini Schema type enum.
|
|
4
|
+
* @see https://ai.google.dev/api/rest/v1beta/Schema#Type
|
|
5
|
+
*/
|
|
6
|
+
export type GeminiSchemaType = 'STRING' | 'NUMBER' | 'INTEGER' | 'BOOLEAN' | 'ARRAY' | 'OBJECT';
|
|
7
|
+
/** Gemini Schema (subset matching FunctionDeclaration.parameters). */
|
|
8
|
+
export interface GeminiSchema {
|
|
9
|
+
type: GeminiSchemaType;
|
|
10
|
+
description?: string;
|
|
11
|
+
enum?: string[];
|
|
12
|
+
items?: GeminiSchema;
|
|
13
|
+
properties?: Record<string, GeminiSchema>;
|
|
14
|
+
required?: string[];
|
|
15
|
+
}
|
|
16
|
+
/** Gemini FunctionDeclaration. */
|
|
17
|
+
export interface GeminiFunctionDeclaration {
|
|
18
|
+
name: string;
|
|
19
|
+
description: string;
|
|
20
|
+
parameters?: GeminiSchema;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Convert MCP tool declarations to Gemini FunctionDeclaration format.
|
|
24
|
+
*/
|
|
25
|
+
export declare function toGeminiFunctionDeclarations(tools: McpStaticToolDeclaration[]): GeminiFunctionDeclaration[];
|
|
26
|
+
//# sourceMappingURL=gemini.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gemini.d.ts","sourceRoot":"","sources":["../../src/converters/gemini.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,wBAAwB,EAAsB,MAAM,aAAa,CAAC;AAI3E;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEhG,sEAAsE;AACtE,MAAM,WAAW,YAAY;IACzB,IAAI,EAAE,gBAAgB,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAC1C,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,kCAAkC;AAClC,MAAM,WAAW,yBAAyB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,YAAY,CAAC;CAC7B;AA4CD;;GAEG;AACH,wBAAgB,4BAA4B,CACxC,KAAK,EAAE,wBAAwB,EAAE,GAClC,yBAAyB,EAAE,CAuB7B"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// @okdoc-ai/plugin-sdk — Gemini Format Converter
|
|
3
|
+
//
|
|
4
|
+
// Converts MCP tool declarations to Google Gemini FunctionDeclaration format.
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// ── Conversion ──────────────────────────────────────────────────────────────
|
|
7
|
+
const TYPE_MAP = {
|
|
8
|
+
string: 'STRING',
|
|
9
|
+
number: 'NUMBER',
|
|
10
|
+
integer: 'INTEGER',
|
|
11
|
+
boolean: 'BOOLEAN',
|
|
12
|
+
array: 'ARRAY',
|
|
13
|
+
object: 'OBJECT',
|
|
14
|
+
};
|
|
15
|
+
function mapType(jsonType) {
|
|
16
|
+
if (!jsonType)
|
|
17
|
+
return 'STRING';
|
|
18
|
+
const t = Array.isArray(jsonType) ? jsonType[0] : jsonType;
|
|
19
|
+
return TYPE_MAP[t] ?? 'STRING';
|
|
20
|
+
}
|
|
21
|
+
function convertProperty(prop) {
|
|
22
|
+
const schema = { type: mapType(prop.type) };
|
|
23
|
+
if (prop.description)
|
|
24
|
+
schema.description = prop.description;
|
|
25
|
+
if (prop.enum && prop.enum.every(v => typeof v === 'string')) {
|
|
26
|
+
schema.enum = prop.enum;
|
|
27
|
+
}
|
|
28
|
+
if (prop.items && !Array.isArray(prop.items)) {
|
|
29
|
+
schema.items = convertProperty(prop.items);
|
|
30
|
+
}
|
|
31
|
+
if (prop.properties) {
|
|
32
|
+
schema.properties = {};
|
|
33
|
+
for (const [key, val] of Object.entries(prop.properties)) {
|
|
34
|
+
schema.properties[key] = convertProperty(val);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (prop.required)
|
|
38
|
+
schema.required = prop.required;
|
|
39
|
+
return schema;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Convert MCP tool declarations to Gemini FunctionDeclaration format.
|
|
43
|
+
*/
|
|
44
|
+
export function toGeminiFunctionDeclarations(tools) {
|
|
45
|
+
return tools.map(tool => {
|
|
46
|
+
const decl = {
|
|
47
|
+
name: tool.name,
|
|
48
|
+
description: tool.description,
|
|
49
|
+
};
|
|
50
|
+
if (tool.inputSchema) {
|
|
51
|
+
const params = { type: 'OBJECT' };
|
|
52
|
+
if (tool.inputSchema.properties) {
|
|
53
|
+
params.properties = {};
|
|
54
|
+
for (const [key, val] of Object.entries(tool.inputSchema.properties)) {
|
|
55
|
+
params.properties[key] = convertProperty(val);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (tool.inputSchema.required) {
|
|
59
|
+
params.required = tool.inputSchema.required;
|
|
60
|
+
}
|
|
61
|
+
decl.parameters = params;
|
|
62
|
+
}
|
|
63
|
+
return decl;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=gemini.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gemini.js","sourceRoot":"","sources":["../../src/converters/gemini.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/converters/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,4BAA4B,EAC5B,yBAAyB,EACzB,YAAY,EACZ,gBAAgB,GACnB,MAAM,aAAa,CAAC;AAErB,OAAO,EACH,iBAAiB,EACjB,kBAAkB,EAClB,wBAAwB,EACxB,gBAAgB,GACnB,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// @okdoc-ai/plugin-sdk — Converters barrel export
|
|
3
|
+
// ============================================================================
|
|
4
|
+
export { toGeminiFunctionDeclarations, } from './gemini.js';
|
|
5
|
+
export { toOpenAiFunctions, } from './openai.js';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/converters/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,kDAAkD;AAClD,+EAA+E;AAE/E,OAAO,EACH,4BAA4B,GAI/B,MAAM,aAAa,CAAC;AAErB,OAAO,EACH,iBAAiB,GAIpB,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { McpStaticToolDeclaration } from '../types.js';
|
|
2
|
+
/** OpenAI function definition (inside a tool object). */
|
|
3
|
+
export interface OpenAiFunctionDefinition {
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
parameters?: OpenAiJsonSchema;
|
|
7
|
+
strict?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** OpenAI tool object with type "function". */
|
|
10
|
+
export interface OpenAiFunctionTool {
|
|
11
|
+
type: 'function';
|
|
12
|
+
function: OpenAiFunctionDefinition;
|
|
13
|
+
}
|
|
14
|
+
/** JSON Schema as accepted by OpenAI (passthrough — OpenAI uses standard JSON Schema). */
|
|
15
|
+
export interface OpenAiJsonSchema {
|
|
16
|
+
type: 'object';
|
|
17
|
+
properties?: Record<string, unknown>;
|
|
18
|
+
required?: string[];
|
|
19
|
+
additionalProperties?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Convert MCP tool declarations to OpenAI function tool format.
|
|
23
|
+
*/
|
|
24
|
+
export declare function toOpenAiFunctions(tools: McpStaticToolDeclaration[]): OpenAiFunctionTool[];
|
|
25
|
+
//# sourceMappingURL=openai.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../src/converters/openai.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,wBAAwB,EAAsB,MAAM,aAAa,CAAC;AAI3E,yDAAyD;AACzD,MAAM,WAAW,wBAAwB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,+CAA+C;AAC/C,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,wBAAwB,CAAC;CACtC;AAED,0FAA0F;AAC1F,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,QAAQ,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAClC;AAsBD;;GAEG;AACH,wBAAgB,iBAAiB,CAC7B,KAAK,EAAE,wBAAwB,EAAE,GAClC,kBAAkB,EAAE,CAYtB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// @okdoc-ai/plugin-sdk — OpenAI Format Converter
|
|
3
|
+
//
|
|
4
|
+
// Converts MCP tool declarations to OpenAI function calling format.
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// ── Conversion ──────────────────────────────────────────────────────────────
|
|
7
|
+
function convertInputSchema(schema) {
|
|
8
|
+
const result = { type: 'object' };
|
|
9
|
+
if (schema.properties) {
|
|
10
|
+
result.properties = schema.properties;
|
|
11
|
+
}
|
|
12
|
+
if (schema.required) {
|
|
13
|
+
result.required = schema.required;
|
|
14
|
+
}
|
|
15
|
+
if (schema.additionalProperties !== undefined) {
|
|
16
|
+
result.additionalProperties = typeof schema.additionalProperties === 'boolean'
|
|
17
|
+
? schema.additionalProperties
|
|
18
|
+
: false;
|
|
19
|
+
}
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Convert MCP tool declarations to OpenAI function tool format.
|
|
24
|
+
*/
|
|
25
|
+
export function toOpenAiFunctions(tools) {
|
|
26
|
+
return tools.map(tool => {
|
|
27
|
+
const fn = { name: tool.name };
|
|
28
|
+
if (tool.description)
|
|
29
|
+
fn.description = tool.description;
|
|
30
|
+
if (tool.inputSchema) {
|
|
31
|
+
fn.parameters = convertInputSchema(tool.inputSchema);
|
|
32
|
+
}
|
|
33
|
+
return { type: 'function', function: fn };
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=openai.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openai.js","sourceRoot":"","sources":["../../src/converters/openai.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,iDAAiD;AACjD,EAAE;AACF,oEAAoE;AACpE,+EAA+E;AA4B/E,+EAA+E;AAE/E,SAAS,kBAAkB,CAAC,MAA0B;IAClD,MAAM,MAAM,GAAqB,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IAEpD,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;QACpB,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;IAC1C,CAAC;IACD,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QAClB,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IACtC,CAAC;IACD,IAAI,MAAM,CAAC,oBAAoB,KAAK,SAAS,EAAE,CAAC;QAC5C,MAAM,CAAC,oBAAoB,GAAG,OAAO,MAAM,CAAC,oBAAoB,KAAK,SAAS;YAC1E,CAAC,CAAC,MAAM,CAAC,oBAAoB;YAC7B,CAAC,CAAC,KAAK,CAAC;IAChB,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC7B,KAAiC;IAEjC,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QACpB,MAAM,EAAE,GAA6B,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;QAEzD,IAAI,IAAI,CAAC,WAAW;YAAE,EAAE,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QAExD,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACnB,EAAE,CAAC,UAAU,GAAG,kBAAkB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACzD,CAAC;QAED,OAAO,EAAE,IAAI,EAAE,UAAmB,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IACvD,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { OkDocPluginMetadata, McpToolInputSchema, McpToolAnnotations } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Class decorator that marks an Angular component as an OkDoc plugin.
|
|
4
|
+
*
|
|
5
|
+
* Stores manifest metadata on the class constructor so the host framework
|
|
6
|
+
* can discover plugin identity, namespace, and icon without instantiation.
|
|
7
|
+
*
|
|
8
|
+
* ```typescript
|
|
9
|
+
* @OkDocPlugin({
|
|
10
|
+
* id: 'audio-player',
|
|
11
|
+
* name: 'Audio Player',
|
|
12
|
+
* description: 'Plays audio files via URL',
|
|
13
|
+
* version: '1.0.0',
|
|
14
|
+
* icon: 'musical-notes-outline',
|
|
15
|
+
* namespace: 'audio_player',
|
|
16
|
+
* })
|
|
17
|
+
* @Component({ selector: 'okdoc-audio-player', standalone: true, ... })
|
|
18
|
+
* export class AudioPlayerComponent { ... }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare function OkDocPlugin(metadata: OkDocPluginMetadata): ClassDecorator;
|
|
22
|
+
export interface McpToolOptions {
|
|
23
|
+
/** Tool name override. Defaults to the method name. */
|
|
24
|
+
name?: string;
|
|
25
|
+
/** Human-readable description of this tool. */
|
|
26
|
+
description: string;
|
|
27
|
+
/** JSON Schema for tool arguments. Omit if the tool takes no arguments. */
|
|
28
|
+
inputSchema?: McpToolInputSchema;
|
|
29
|
+
/** Additional tool annotations (hints for clients). */
|
|
30
|
+
annotations?: McpToolAnnotations;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Method decorator that marks a method as an MCP-callable tool.
|
|
34
|
+
*
|
|
35
|
+
* Stores metadata on the class prototype under MCP_TOOLS_KEY so the host
|
|
36
|
+
* framework can discover tool declarations without instantiation.
|
|
37
|
+
*
|
|
38
|
+
* The method becomes the tool handler when the component is live.
|
|
39
|
+
* It receives parsed arguments and must return `Promise<McpToolResult>`.
|
|
40
|
+
*
|
|
41
|
+
* ```typescript
|
|
42
|
+
* @McpTool({ description: 'Start audio playback' })
|
|
43
|
+
* async play(): Promise<McpToolResult> {
|
|
44
|
+
* this.audioRef.nativeElement.play();
|
|
45
|
+
* return { content: [{ type: 'text', text: 'Playing' }] };
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function McpTool(options: McpToolOptions): MethodDecorator;
|
|
50
|
+
//# sourceMappingURL=decorators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAmB,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAK1G;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,mBAAmB,GAAG,cAAc,CASzE;AAID,MAAM,WAAW,cAAc;IAC3B,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,WAAW,EAAE,MAAM,CAAC;IACpB,2EAA2E;IAC3E,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,uDAAuD;IACvD,WAAW,CAAC,EAAE,kBAAkB,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,eAAe,CA4BhE"}
|