@pinixai/core 0.5.0 → 0.5.1
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/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/manifest.ts +26 -2
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -4,6 +4,6 @@ export { command } from "./command";
|
|
|
4
4
|
export { handler, type HandlerDef, type Stream } from "./handler";
|
|
5
5
|
export { serveHTTP } from "./http";
|
|
6
6
|
export { serveIPC, invoke, redirectConsoleToStderr } from "./ipc";
|
|
7
|
-
export type { IPCManifest } from "./manifest";
|
|
7
|
+
export type { IPCCommandInfo, IPCManifest } from "./manifest";
|
|
8
8
|
export { serveMCP } from "./mcp";
|
|
9
9
|
export { z } from "zod";
|
package/src/manifest.ts
CHANGED
|
@@ -3,10 +3,17 @@ import { dirname, join } from "node:path";
|
|
|
3
3
|
import { z, type ZodType } from "zod";
|
|
4
4
|
import { getClipName, type Clip } from "./clip";
|
|
5
5
|
|
|
6
|
+
export interface IPCCommandInfo {
|
|
7
|
+
name: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
input?: string;
|
|
10
|
+
output?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
6
13
|
export interface IPCManifest {
|
|
7
14
|
domain: string;
|
|
8
15
|
description?: string;
|
|
9
|
-
commands:
|
|
16
|
+
commands: IPCCommandInfo[];
|
|
10
17
|
dependencies: Record<string, { package: string; version: string }>;
|
|
11
18
|
package?: string;
|
|
12
19
|
version?: string;
|
|
@@ -183,9 +190,26 @@ function asString(value: unknown): string | undefined {
|
|
|
183
190
|
export function createIPCManifest(clip: Clip): IPCManifest {
|
|
184
191
|
const pkgInfo = resolvePackageInfo();
|
|
185
192
|
|
|
193
|
+
const commands: IPCCommandInfo[] = [];
|
|
194
|
+
|
|
195
|
+
for (const [name, handler] of clip.getCommands()) {
|
|
196
|
+
const description = clip.getCommandDescription(name);
|
|
197
|
+
const cmd: IPCCommandInfo = { name };
|
|
198
|
+
if (description) cmd.description = description;
|
|
199
|
+
|
|
200
|
+
try {
|
|
201
|
+
cmd.input = JSON.stringify(z.toJSONSchema(handler.input));
|
|
202
|
+
} catch {}
|
|
203
|
+
try {
|
|
204
|
+
cmd.output = JSON.stringify(z.toJSONSchema(handler.output));
|
|
205
|
+
} catch {}
|
|
206
|
+
|
|
207
|
+
commands.push(cmd);
|
|
208
|
+
}
|
|
209
|
+
|
|
186
210
|
return {
|
|
187
211
|
domain: clip.domain,
|
|
188
|
-
commands
|
|
212
|
+
commands,
|
|
189
213
|
dependencies: clip.dependencies,
|
|
190
214
|
...pkgInfo,
|
|
191
215
|
};
|