@radheim/plugin 0.0.0-stage → 2.4.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/README.md +19 -3
- package/dist/app.d.ts +5 -0
- package/dist/app.js +0 -0
- package/dist/effect/agent.d.ts +15 -0
- package/dist/effect/agent.js +0 -0
- package/dist/effect/aisdk.d.ts +20 -0
- package/dist/effect/aisdk.js +0 -0
- package/dist/effect/artifact.d.ts +42 -0
- package/dist/effect/artifact.js +0 -0
- package/dist/effect/command.d.ts +23 -0
- package/dist/effect/command.js +0 -0
- package/dist/effect/event.d.ts +9 -0
- package/dist/effect/event.js +0 -0
- package/dist/effect/index.d.ts +20 -0
- package/dist/effect/index.js +19 -0
- package/dist/effect/integration.d.ts +103 -0
- package/dist/effect/integration.js +3 -0
- package/dist/effect/mcp.d.ts +15 -0
- package/dist/effect/mcp.js +0 -0
- package/dist/effect/model.d.ts +29 -0
- package/dist/effect/model.js +0 -0
- package/dist/effect/permission.d.ts +30 -0
- package/dist/effect/permission.js +0 -0
- package/dist/effect/plugin.d.ts +69 -0
- package/dist/effect/plugin.js +3 -0
- package/dist/effect/provider.d.ts +34 -0
- package/dist/effect/provider.js +0 -0
- package/dist/effect/push.d.ts +52 -0
- package/dist/effect/push.js +0 -0
- package/dist/effect/reference.d.ts +14 -0
- package/dist/effect/reference.js +0 -0
- package/dist/effect/registration.d.ts +13 -0
- package/dist/effect/registration.js +0 -0
- package/dist/effect/rpc.d.ts +19 -0
- package/dist/effect/rpc.js +0 -0
- package/dist/effect/session.d.ts +217 -0
- package/dist/effect/session.js +0 -0
- package/dist/effect/shell.d.ts +14 -0
- package/dist/effect/shell.js +0 -0
- package/dist/effect/skill.d.ts +15 -0
- package/dist/effect/skill.js +1 -0
- package/dist/effect/storage.d.ts +8 -0
- package/dist/effect/storage.js +0 -0
- package/dist/effect/tool.d.ts +60 -0
- package/dist/effect/tool.js +1 -0
- package/dist/effect/vcs.d.ts +43 -0
- package/dist/effect/vcs.js +0 -0
- package/dist/effect/websearch.d.ts +20 -0
- package/dist/effect/websearch.js +0 -0
- package/dist/effect/worktree.d.ts +18 -0
- package/dist/effect/worktree.js +0 -0
- package/dist/gui/browser.d.ts +54 -0
- package/dist/gui/browser.js +3 -0
- package/dist/gui/context.d.ts +287 -0
- package/dist/gui/context.js +0 -0
- package/dist/gui/core.d.ts +581 -0
- package/dist/gui/core.js +86 -0
- package/dist/gui/declarations.d.ts +47 -0
- package/dist/gui/declarations.js +0 -0
- package/dist/gui/file.d.ts +122 -0
- package/dist/gui/file.js +7 -0
- package/dist/gui/host-apis.d.ts +2239 -0
- package/dist/gui/host-apis.js +0 -0
- package/dist/gui/icon-name.d.ts +2 -0
- package/dist/gui/icon-name.js +1 -0
- package/dist/gui/index.d.ts +7 -0
- package/dist/gui/index.js +6 -0
- package/dist/gui/internal.d.ts +44 -0
- package/dist/gui/internal.js +33 -0
- package/dist/gui/main.d.ts +279 -0
- package/dist/gui/main.js +20 -0
- package/dist/gui/modules.d.ts +15 -0
- package/dist/gui/modules.js +30 -0
- package/dist/gui/plugin.d.ts +87 -0
- package/dist/gui/plugin.js +9 -0
- package/dist/gui/reactive.d.ts +93 -0
- package/dist/gui/reactive.js +130 -0
- package/dist/gui/registries.d.ts +1045 -0
- package/dist/gui/registries.js +153 -0
- package/dist/gui/review.d.ts +74 -0
- package/dist/gui/review.js +3 -0
- package/dist/gui/scope.d.ts +64 -0
- package/dist/gui/scope.js +85 -0
- package/dist/gui/solid.d.ts +111 -0
- package/dist/gui/solid.js +74 -0
- package/dist/gui/vite.d.ts +24 -0
- package/dist/gui/vite.js +49 -0
- package/dist/host.d.ts +23 -0
- package/dist/host.js +65 -0
- package/dist/options.d.ts +1 -0
- package/dist/options.js +0 -0
- package/dist/permission.d.ts +22 -0
- package/dist/permission.js +12 -0
- package/dist/promise/adapter.d.ts +12 -0
- package/dist/promise/adapter.js +576 -0
- package/dist/promise/agent.d.ts +15 -0
- package/dist/promise/agent.js +0 -0
- package/dist/promise/aisdk.d.ts +20 -0
- package/dist/promise/aisdk.js +0 -0
- package/dist/promise/artifact.d.ts +49 -0
- package/dist/promise/artifact.js +0 -0
- package/dist/promise/command.d.ts +22 -0
- package/dist/promise/command.js +0 -0
- package/dist/promise/event.d.ts +7 -0
- package/dist/promise/event.js +0 -0
- package/dist/promise/index.d.ts +20 -0
- package/dist/promise/index.js +18 -0
- package/dist/promise/integration.d.ts +102 -0
- package/dist/promise/integration.js +3 -0
- package/dist/promise/mcp.d.ts +15 -0
- package/dist/promise/mcp.js +0 -0
- package/dist/promise/model.d.ts +29 -0
- package/dist/promise/model.js +0 -0
- package/dist/promise/permission.d.ts +29 -0
- package/dist/promise/permission.js +0 -0
- package/dist/promise/plugin.d.ts +70 -0
- package/dist/promise/plugin.js +3 -0
- package/dist/promise/provider.d.ts +34 -0
- package/dist/promise/provider.js +0 -0
- package/dist/promise/push.d.ts +50 -0
- package/dist/promise/push.js +0 -0
- package/dist/promise/reference.d.ts +13 -0
- package/dist/promise/reference.js +0 -0
- package/dist/promise/registration.d.ts +12 -0
- package/dist/promise/registration.js +0 -0
- package/dist/promise/rpc.d.ts +22 -0
- package/dist/promise/rpc.js +0 -0
- package/dist/promise/session.d.ts +217 -0
- package/dist/promise/session.js +0 -0
- package/dist/promise/shell.d.ts +14 -0
- package/dist/promise/shell.js +0 -0
- package/dist/promise/skill.d.ts +15 -0
- package/dist/promise/skill.js +0 -0
- package/dist/promise/storage.d.ts +8 -0
- package/dist/promise/storage.js +0 -0
- package/dist/promise/tool.d.ts +71 -0
- package/dist/promise/tool.js +2 -0
- package/dist/promise/vcs.d.ts +53 -0
- package/dist/promise/vcs.js +0 -0
- package/dist/promise/websearch.d.ts +21 -0
- package/dist/promise/websearch.js +0 -0
- package/dist/promise/worktree.d.ts +23 -0
- package/dist/promise/worktree.js +0 -0
- package/dist/rpc.d.ts +1 -0
- package/dist/rpc.js +1 -0
- package/dist/runtime-modules.d.ts +6 -0
- package/dist/runtime-modules.js +103 -0
- package/dist/runtime.d.ts +4 -0
- package/dist/runtime.js +46 -0
- package/dist/source.bun.d.ts +4 -0
- package/dist/source.bun.js +75 -0
- package/dist/source.d.ts +8 -0
- package/dist/source.js +59 -0
- package/dist/source.node.d.ts +5 -0
- package/dist/source.node.js +55 -0
- package/dist/source.package.d.ts +1 -0
- package/dist/source.package.js +15 -0
- package/dist/storage.d.ts +14 -0
- package/dist/storage.js +0 -0
- package/dist/tui/context.d.ts +500 -0
- package/dist/tui/context.js +0 -0
- package/dist/tui/index.d.ts +2 -0
- package/dist/tui/index.js +2 -0
- package/dist/tui/plugin.d.ts +8 -0
- package/dist/tui/plugin.js +3 -0
- package/dist/tui/solid.d.ts +7 -0
- package/dist/tui/solid.js +16 -0
- package/dist/worktree.d.ts +18 -0
- package/dist/worktree.js +0 -0
- package/package.json +137 -4
package/dist/host.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export * as Host from "./host.js";
|
|
2
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { Option, Schema } from "effect";
|
|
5
|
+
import { importModule, resolveModule } from "@radheim/util/runtime-import";
|
|
6
|
+
export function resolve(input) {
|
|
7
|
+
// A local directory whose package.json names the package and maps `exports` resolves through them, like the
|
|
8
|
+
// published package; without them it uses the conventional file names at its root.
|
|
9
|
+
const manifest = input.name ? undefined : packageManifest(input.directory);
|
|
10
|
+
const target = typeof manifest?.name === "string" && manifest.exports !== undefined ? { ...input, name: manifest.name } : input;
|
|
11
|
+
const entry = (subpaths) => {
|
|
12
|
+
for (const subpath of subpaths) {
|
|
13
|
+
const specifier = target.name
|
|
14
|
+
? [target.name, subpath].filter(Boolean).join("/")
|
|
15
|
+
: path.resolve(target.directory, subpath || "index");
|
|
16
|
+
try {
|
|
17
|
+
return resolveModule(specifier, target.directory);
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
if (!(error instanceof Error) ||
|
|
21
|
+
!("code" in error) ||
|
|
22
|
+
![
|
|
23
|
+
"ENOENT",
|
|
24
|
+
"ENOTDIR",
|
|
25
|
+
"MODULE_NOT_FOUND",
|
|
26
|
+
"ERR_MODULE_NOT_FOUND",
|
|
27
|
+
"ERR_PACKAGE_PATH_NOT_EXPORTED",
|
|
28
|
+
"ERR_UNSUPPORTED_DIR_IMPORT",
|
|
29
|
+
].includes(String(error.code)))
|
|
30
|
+
throw error;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return undefined;
|
|
34
|
+
};
|
|
35
|
+
return {
|
|
36
|
+
server: entry(["server", ""]),
|
|
37
|
+
tui: entry(["tui"]),
|
|
38
|
+
rpc: entry(["rpc"]),
|
|
39
|
+
// The app evaluates the bundle as CommonJS text, so a TypeScript source or an ES module is never a GUI entry.
|
|
40
|
+
gui: [target.name ? entry(["gui-experimental"]) : entry(["gui-experimental.cjs", "gui-experimental.js"])].find((file) => file && /\.c?js$/.test(file)),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export function load(entrypoint) {
|
|
44
|
+
return importModule(entrypoint);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The id of a plugin without a server part: its package name, or a local directory's name when it has no
|
|
48
|
+
* package.json name. A server part names its plugin in `Plugin.define` instead.
|
|
49
|
+
*/
|
|
50
|
+
export function packageID(target) {
|
|
51
|
+
if (target.name)
|
|
52
|
+
return target.name;
|
|
53
|
+
const name = packageManifest(target.directory)?.name;
|
|
54
|
+
return typeof name === "string" && name ? name : path.basename(target.directory);
|
|
55
|
+
}
|
|
56
|
+
// The fields resolution reads from a local directory's package.json.
|
|
57
|
+
const Manifest = Schema.fromJsonString(Schema.Struct({ name: Schema.optional(Schema.Unknown), exports: Schema.optional(Schema.Unknown) }));
|
|
58
|
+
// A package.json that is not a JSON object counts as missing, so one broken plugin directory never stops the rest
|
|
59
|
+
// from resolving: it falls back to the conventional root file names.
|
|
60
|
+
function packageManifest(directory) {
|
|
61
|
+
const file = path.join(directory, "package.json");
|
|
62
|
+
if (!existsSync(file))
|
|
63
|
+
return undefined;
|
|
64
|
+
return Option.getOrUndefined(Schema.decodeUnknownOption(Manifest)(readFileSync(file, "utf8")));
|
|
65
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type PluginOptions = Readonly<Record<string, any>>;
|
package/dist/options.js
ADDED
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
export declare const AssertInput: Schema.Struct<{
|
|
3
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
4
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
5
|
+
};
|
|
6
|
+
readonly agent: Schema.optional<Schema.brand<Schema.String, "Agent.ID">>;
|
|
7
|
+
readonly action: Schema.String;
|
|
8
|
+
readonly resources: Schema.$Array<Schema.String>;
|
|
9
|
+
readonly save: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.String>>>, Schema.optionalKey<Schema.$Array<Schema.String>>, never, never>;
|
|
10
|
+
readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
|
|
11
|
+
readonly source: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
|
|
12
|
+
readonly type: Schema.Literal<"tool">;
|
|
13
|
+
readonly messageID: Schema.String;
|
|
14
|
+
readonly id: Schema.String;
|
|
15
|
+
}>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
|
|
16
|
+
readonly type: Schema.Literal<"tool">;
|
|
17
|
+
readonly messageID: Schema.String;
|
|
18
|
+
readonly id: Schema.String;
|
|
19
|
+
}>]>>, never, never>;
|
|
20
|
+
}>;
|
|
21
|
+
export interface AssertInput extends Schema.Schema.Type<typeof AssertInput> {
|
|
22
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Agent } from "@radheim/schema/agent";
|
|
2
|
+
import { Permission } from "@radheim/schema/permission";
|
|
3
|
+
import { Schema } from "effect";
|
|
4
|
+
export const AssertInput = Schema.Struct({
|
|
5
|
+
sessionID: Permission.Request.fields.sessionID,
|
|
6
|
+
agent: Agent.ID.pipe(Schema.optional),
|
|
7
|
+
action: Permission.Request.fields.action,
|
|
8
|
+
resources: Permission.Request.fields.resources,
|
|
9
|
+
save: Permission.Request.fields.save,
|
|
10
|
+
metadata: Permission.Request.fields.metadata,
|
|
11
|
+
source: Permission.Request.fields.source,
|
|
12
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Scope } from "effect";
|
|
2
|
+
import type { Plugin } from "./plugin.js";
|
|
3
|
+
/**
|
|
4
|
+
* Adapts a Promise plugin into an Effect plugin so the existing Effect-only
|
|
5
|
+
* Core plugin runtime can run it unchanged.
|
|
6
|
+
*
|
|
7
|
+
* Hook registrations created during the async `setup` attach to the plugin's
|
|
8
|
+
* scope, so unloading the plugin disposes them. The captured fiber context
|
|
9
|
+
* preserves boot-time batching, so Promise-plugin transforms still coalesce
|
|
10
|
+
* into one reload per domain.
|
|
11
|
+
*/
|
|
12
|
+
export declare function fromPromise(plugin: Plugin): import("../effect/plugin.js").Plugin<Scope.Scope>;
|