@ycodium-ai/plugin-api 0.1.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/README.md +106 -0
- package/dist/index.d.ts +1870 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -0
- package/dist/ui.d.ts +225 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +112 -0
- package/dist/ui.js.map +1 -0
- package/package.json +36 -0
package/README.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# @ycodium-ai/plugin-api
|
|
2
|
+
|
|
3
|
+
Types and `definePlugin` for writing Ycodium plugins. Zero runtime dependencies.
|
|
4
|
+
|
|
5
|
+
A plugin is a normal npm package that a Ycodium machine loads into its server. It can add
|
|
6
|
+
agent tools, react to things that happen, contribute a settings card or a page, and keep its
|
|
7
|
+
own state across restarts.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
npm install --save-dev @ycodium-ai/plugin-api
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
This package is types only at build time — nothing of it ends up in your bundle.
|
|
16
|
+
|
|
17
|
+
## A plugin is an npm package
|
|
18
|
+
|
|
19
|
+
Declare the entry file under `ycodium.plugin`:
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"name": "my-ycodium-plugin",
|
|
24
|
+
"version": "0.1.0",
|
|
25
|
+
"type": "module",
|
|
26
|
+
"keywords": ["ycodium-plugin"],
|
|
27
|
+
"files": ["dist"],
|
|
28
|
+
"ycodium": {
|
|
29
|
+
"plugin": "./dist/index.js",
|
|
30
|
+
"displayName": "My plugin",
|
|
31
|
+
"description": "One line about what it does.",
|
|
32
|
+
"permissions": []
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
And export the definition:
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import { definePlugin, PLUGIN_API_VERSION } from "@ycodium-ai/plugin-api";
|
|
41
|
+
|
|
42
|
+
export default definePlugin({
|
|
43
|
+
id: "my-plugin",
|
|
44
|
+
apiVersion: PLUGIN_API_VERSION,
|
|
45
|
+
activate: (ctx) => {
|
|
46
|
+
ctx.log.info("hello");
|
|
47
|
+
|
|
48
|
+
ctx.reactor({
|
|
49
|
+
name: "greet",
|
|
50
|
+
events: ["thread.created"],
|
|
51
|
+
handle: async (event) => {
|
|
52
|
+
ctx.log.info("a thread appeared", { threadId: event.aggregateId });
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
ctx.onDispose(() => {
|
|
57
|
+
// Release anything you opened. The host calls this on unload and on upgrade.
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Publish it to npmjs.com under your own name. There is no submission and no review. Users
|
|
64
|
+
install it with:
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
ycodium plugin add my-ycodium-plugin
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Bundle your entry file
|
|
71
|
+
|
|
72
|
+
The host loads your entry by absolute path, from a directory inside the user's Ycodium home
|
|
73
|
+
— not inside your package's dependency tree. A bare `import` at runtime will not resolve
|
|
74
|
+
there.
|
|
75
|
+
|
|
76
|
+
**Bundle your entry into one ESM file with no runtime imports.** Types from this package are
|
|
77
|
+
compile-time only and erase during bundling, so importing it for types is fine.
|
|
78
|
+
|
|
79
|
+
## Permissions
|
|
80
|
+
|
|
81
|
+
Anything that reaches outside the plugin is declared in `ycodium.permissions` and shown to
|
|
82
|
+
the user before they install. Reading files under a prefix, spawning a named program,
|
|
83
|
+
reading credentials — each is a separate declaration. Declare nothing you do not use: the
|
|
84
|
+
list is the first thing a user reads about your plugin.
|
|
85
|
+
|
|
86
|
+
## Being found
|
|
87
|
+
|
|
88
|
+
Add `ycodium-plugin` to your `keywords`:
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
npm search keywords:ycodium-plugin
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Ycodium's plugin settings search the same way, so a published package with that keyword
|
|
95
|
+
shows up there without anyone registering it.
|
|
96
|
+
|
|
97
|
+
## THERE WILL BE COMPATIBILITY-BREAKING CHANGES
|
|
98
|
+
|
|
99
|
+
`PLUGIN_API_VERSION` is checked for **exact equality**. The current API is 2. Plugins targeting
|
|
100
|
+
API 1 are refused before activation. API 2 replaces the Teams-specific host methods with generic
|
|
101
|
+
execution ownership, command receipts, notifications, and plugin contributions. Update plugins
|
|
102
|
+
against the current types and republish; there is no compatibility layer.
|
|
103
|
+
|
|
104
|
+
## License
|
|
105
|
+
|
|
106
|
+
UNLICENSED.
|