@akonwi/kit 0.3.1 → 0.3.3

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/dist/kit CHANGED
Binary file
package/dist/plugin.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ export { Type } from "typebox";
2
+
1
3
  import type { AgentMessage } from "@earendil-works/pi-agent-core";
2
4
  import type { Api, Model, Static, TSchema } from "@earendil-works/pi-ai";
3
5
  import type { ToastInput } from "./toasts";
package/dist/plugin.js CHANGED
@@ -1,3 +1,3 @@
1
- // Runtime placeholder for the type-only @akonwi/kit/plugin SDK.
2
- // Use `import type` when consuming plugin API types.
3
- export {};
1
+ // Runtime surface for the public @akonwi/kit/plugin SDK.
2
+ // Plugin API shapes are type-only; runtime helpers are explicitly exported here.
3
+ export { Type } from "typebox";
@@ -17,6 +17,28 @@ If an external plugin registers a command, tool, or debug section that already e
17
17
 
18
18
  Kit does **not** load plugins from `.agents/plugins/`. Plugins execute code and are Kit-specific functionality, while `.agents/` is reserved for compatibility-oriented resources such as prompts, skills, and MCP config.
19
19
 
20
+ ## Plugin dependencies
21
+
22
+ Plugin directories may have their own `package.json`, lockfile, and `node_modules`:
23
+
24
+ ```text
25
+ ~/.kit/plugins/
26
+ package.json
27
+ bun.lock
28
+ node_modules/
29
+ my-plugin.ts
30
+
31
+ project/.kit/plugins/
32
+ package.json
33
+ bun.lock
34
+ node_modules/
35
+ project-plugin.ts
36
+ ```
37
+
38
+ Kit automatically installs dependencies for each plugin directory before bundling. It uses `bun install` when the `bun` CLI is available and falls back to `npm install` otherwise.
39
+
40
+ Kit bundles each plugin from its absolute file path before loading it, so package imports resolve from the plugin file's directory and then walk up through normal Bun/Node module resolution. This lets user and project plugins depend on packages that Kit itself does not ship.
41
+
20
42
  ## Trust model
21
43
 
22
44
  Plugins execute local code in the Kit process. Only use plugins from people and projects you trust.
@@ -28,7 +50,7 @@ A failed user/project plugin does not stop Kit from starting. Kit shows a persis
28
50
  A plugin is a TypeScript file with a default function export. Import public SDK types from `@akonwi/kit/plugin`; do not import from Kit source paths such as `src/plugins`.
29
51
 
30
52
  ```ts
31
- import type { PluginAPI } from "@akonwi/kit/plugin";
53
+ import { Type, type PluginAPI } from "@akonwi/kit/plugin";
32
54
 
33
55
  export default function MyPlugin(kit: PluginAPI) {
34
56
  kit.registerCommand(
@@ -42,6 +64,18 @@ export default function MyPlugin(kit: PluginAPI) {
42
64
  });
43
65
  },
44
66
  );
67
+
68
+ kit.registerTool({
69
+ name: "echo_plugin",
70
+ description: "Echo text from a plugin tool.",
71
+ parameters: Type.Object({ text: Type.String() }),
72
+ async execute(_id, params) {
73
+ return {
74
+ content: [{ type: "text", text: params.text }],
75
+ details: {},
76
+ };
77
+ },
78
+ });
45
79
  }
46
80
  ```
47
81
 
@@ -121,8 +155,8 @@ kit.onToolCall(async (toolCall, ctx) => {
121
155
 
122
156
  ## Reloading
123
157
 
124
- Use `/reload` after editing plugin files. Kit re-discovers plugin files and reloads them with cache busting so changed `.ts` contents are picked up.
158
+ Use `/reload` after editing plugin files. Kit re-discovers plugin files, re-bundles them into Kit's plugin cache, and imports the fresh bundles so changed `.ts` contents are picked up.
125
159
 
126
160
  Plugin modules are loaded synchronously, so top-level `await` is not supported in plugin files. Async command, event, and tool handlers are supported.
127
161
 
128
- `@akonwi/kit/plugin` is a type-only SDK surface in v1. Use `import type`; value imports from `@akonwi/kit/plugin` are not part of the public runtime API.
162
+ `@akonwi/kit/plugin` exports plugin API types and the runtime `Type` schema helper. Use `import type` for types such as `PluginAPI`, and use the value import `Type` when defining tool parameter schemas.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akonwi/kit",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "author": "Akonwi Ngoh <akonwi@gmail.com>",
5
5
  "description": "A TUI coding agent",
6
6
  "license": "MIT",
@@ -59,6 +59,7 @@
59
59
  "glob": "^13.0.6",
60
60
  "ignore": "^7.0.5",
61
61
  "solid-js": "1.9.12",
62
+ "typebox": "^1.1.24",
62
63
  "web-tree-sitter": "0.25.10",
63
64
  "yaml": "^2.8.3"
64
65
  },