runline 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/commands/actions.d.ts +1 -0
- package/dist/commands/actions.js +17 -4
- package/dist/main.js +3 -2
- package/dist/plugin/loader.d.ts +23 -1
- package/dist/plugin/loader.js +11 -4
- package/dist/sdk.d.ts +20 -2
- package/dist/sdk.js +23 -3
- package/package.json +1 -1
package/dist/commands/actions.js
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
|
+
import { loadConfig } from "../config/loader.js";
|
|
2
3
|
import { loadAllPlugins } from "../plugin/loader.js";
|
|
3
4
|
import { registry } from "../plugin/registry.js";
|
|
4
5
|
import { printJson } from "../utils/output.js";
|
|
5
6
|
export async function actions(options) {
|
|
6
7
|
await loadAllPlugins();
|
|
7
8
|
const all = registry.getAllActions();
|
|
9
|
+
const connectedPlugins = options.connected
|
|
10
|
+
? new Set(loadConfig().connections.map((c) => c.plugin))
|
|
11
|
+
: null;
|
|
12
|
+
const filtered = connectedPlugins
|
|
13
|
+
? all.filter(({ plugin }) => connectedPlugins.has(plugin))
|
|
14
|
+
: all;
|
|
8
15
|
if (options.json) {
|
|
9
|
-
printJson(
|
|
16
|
+
printJson(filtered.map(({ plugin, action }) => ({
|
|
10
17
|
plugin,
|
|
11
18
|
action: action.name,
|
|
12
19
|
description: action.description,
|
|
@@ -14,12 +21,18 @@ export async function actions(options) {
|
|
|
14
21
|
})));
|
|
15
22
|
return;
|
|
16
23
|
}
|
|
17
|
-
if (
|
|
18
|
-
|
|
24
|
+
if (filtered.length === 0) {
|
|
25
|
+
if (options.connected) {
|
|
26
|
+
console.log("No actions found for connected services.");
|
|
27
|
+
console.log("Add a connection first: runline connection add <name> -p <plugin>");
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
console.log("No actions registered. Install a plugin first.");
|
|
31
|
+
}
|
|
19
32
|
return;
|
|
20
33
|
}
|
|
21
34
|
const grouped = new Map();
|
|
22
|
-
for (const entry of
|
|
35
|
+
for (const entry of filtered) {
|
|
23
36
|
const list = grouped.get(entry.plugin) ?? [];
|
|
24
37
|
list.push(entry);
|
|
25
38
|
grouped.set(entry.plugin, list);
|
package/dist/main.js
CHANGED
|
@@ -55,9 +55,10 @@ Examples:
|
|
|
55
55
|
program
|
|
56
56
|
.command("actions")
|
|
57
57
|
.description("List all available actions and their schemas")
|
|
58
|
-
.
|
|
58
|
+
.option("-c, --connected", "Only show actions for plugins with configured connections")
|
|
59
|
+
.action(async (opts, cmd) => {
|
|
59
60
|
const globals = cmd.optsWithGlobals();
|
|
60
|
-
await actions({ json: globals.json });
|
|
61
|
+
await actions({ json: globals.json, connected: opts.connected });
|
|
61
62
|
});
|
|
62
63
|
// ── connection ──────────────────────────────────────────
|
|
63
64
|
const connCmd = program
|
package/dist/plugin/loader.d.ts
CHANGED
|
@@ -1,11 +1,33 @@
|
|
|
1
1
|
import type { PluginDef } from "./types.js";
|
|
2
2
|
export declare function loadPluginFromPath(path: string): Promise<PluginDef>;
|
|
3
3
|
export declare function loadPluginsFromConfig(configDir: string): Promise<PluginDef[]>;
|
|
4
|
+
export interface DiscoverOptions {
|
|
5
|
+
/**
|
|
6
|
+
* When supplied, only built-in plugins whose name is in this set
|
|
7
|
+
* are loaded. Plugins discovered in the project dir, `plugins.json`,
|
|
8
|
+
* or `~/.runline/plugins` are always loaded — users put them there
|
|
9
|
+
* deliberately — but the 188 bundled builtins are gated so agents
|
|
10
|
+
* don't see every possible action regardless of configuration.
|
|
11
|
+
*
|
|
12
|
+
* Omit to load every builtin (CLI default: `runline actions` etc.
|
|
13
|
+
* surfaces the full catalog).
|
|
14
|
+
*/
|
|
15
|
+
builtinAllowlist?: Set<string> | null;
|
|
16
|
+
/**
|
|
17
|
+
* Override the directory where bundled plugins live. Default is
|
|
18
|
+
* `<loader>/../plugins`, which resolves to `dist/plugins/` at
|
|
19
|
+
* runtime. Tests set this so they can exercise allowlist logic
|
|
20
|
+
* without depending on the real bundled catalog.
|
|
21
|
+
*/
|
|
22
|
+
builtinDir?: string;
|
|
23
|
+
}
|
|
24
|
+
/** Default path to the bundled plugin directory. */
|
|
25
|
+
export declare function defaultBuiltinDir(): string;
|
|
4
26
|
/**
|
|
5
27
|
* Discover and return all plugins from a config directory and global dir.
|
|
6
28
|
* Does NOT mutate any global state.
|
|
7
29
|
*/
|
|
8
|
-
export declare function discoverPlugins(configDir?: string | null): Promise<PluginDef[]>;
|
|
30
|
+
export declare function discoverPlugins(configDir?: string | null, options?: DiscoverOptions): Promise<PluginDef[]>;
|
|
9
31
|
/**
|
|
10
32
|
* Load all plugins and register them into the global registry.
|
|
11
33
|
* Used by the CLI.
|
package/dist/plugin/loader.js
CHANGED
|
@@ -118,11 +118,15 @@ export async function loadPluginsFromConfig(configDir) {
|
|
|
118
118
|
}
|
|
119
119
|
return plugins;
|
|
120
120
|
}
|
|
121
|
+
/** Default path to the bundled plugin directory. */
|
|
122
|
+
export function defaultBuiltinDir() {
|
|
123
|
+
return join(__dirname, "..", "plugins");
|
|
124
|
+
}
|
|
121
125
|
/**
|
|
122
126
|
* Discover and return all plugins from a config directory and global dir.
|
|
123
127
|
* Does NOT mutate any global state.
|
|
124
128
|
*/
|
|
125
|
-
export async function discoverPlugins(configDir) {
|
|
129
|
+
export async function discoverPlugins(configDir, options = {}) {
|
|
126
130
|
const loaded = new Set();
|
|
127
131
|
const result = [];
|
|
128
132
|
function addIfNew(plugin) {
|
|
@@ -144,11 +148,14 @@ export async function discoverPlugins(configDir) {
|
|
|
144
148
|
const globalPlugins = await loadFromDirectory(globalDir);
|
|
145
149
|
for (const p of globalPlugins)
|
|
146
150
|
addIfNew(p);
|
|
147
|
-
|
|
148
|
-
const builtinDir = join(__dirname, "..", "plugins");
|
|
151
|
+
const builtinDir = options.builtinDir ?? defaultBuiltinDir();
|
|
149
152
|
const builtinPlugins = await loadFromDirectory(builtinDir);
|
|
150
|
-
for (const p of builtinPlugins)
|
|
153
|
+
for (const p of builtinPlugins) {
|
|
154
|
+
if (options.builtinAllowlist && !options.builtinAllowlist.has(p.name)) {
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
151
157
|
addIfNew(p);
|
|
158
|
+
}
|
|
152
159
|
return result;
|
|
153
160
|
}
|
|
154
161
|
/**
|
package/dist/sdk.d.ts
CHANGED
|
@@ -34,8 +34,26 @@ export declare class Runline {
|
|
|
34
34
|
connections(): ConnectionConfig[];
|
|
35
35
|
/**
|
|
36
36
|
* Load runline from a project directory.
|
|
37
|
-
*
|
|
37
|
+
*
|
|
38
|
+
* Discovers the `.runline/` config and registers:
|
|
39
|
+
* - every plugin dropped into `.runline/plugins/`,
|
|
40
|
+
* - every plugin listed in `.runline/plugins.json`,
|
|
41
|
+
* - every plugin in `~/.runline/plugins/`,
|
|
42
|
+
* - and — from the 188 builtins shipped with the package — only
|
|
43
|
+
* the ones named in `config.connections[].plugin`.
|
|
44
|
+
*
|
|
45
|
+
* Gating the builtins keeps `runline.actions()` scoped to what the
|
|
46
|
+
* project actually configured. Without this, a project with a
|
|
47
|
+
* single connection would still expose every bundled action to an
|
|
48
|
+
* agent, which is both noisy and a privacy problem (the agent sees
|
|
49
|
+
* surface area it has no credentials for).
|
|
50
|
+
*
|
|
51
|
+
* `options.builtinDir` is a test-only hook; production callers
|
|
52
|
+
* should rely on the default path to the bundled plugins.
|
|
53
|
+
*
|
|
38
54
|
* Fully self-contained — does not mutate global state.
|
|
39
55
|
*/
|
|
40
|
-
static fromProject(cwd?: string
|
|
56
|
+
static fromProject(cwd?: string, options?: {
|
|
57
|
+
builtinDir?: string;
|
|
58
|
+
}): Promise<Runline | null>;
|
|
41
59
|
}
|
package/dist/sdk.js
CHANGED
|
@@ -63,16 +63,36 @@ export class Runline {
|
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
65
|
* Load runline from a project directory.
|
|
66
|
-
*
|
|
66
|
+
*
|
|
67
|
+
* Discovers the `.runline/` config and registers:
|
|
68
|
+
* - every plugin dropped into `.runline/plugins/`,
|
|
69
|
+
* - every plugin listed in `.runline/plugins.json`,
|
|
70
|
+
* - every plugin in `~/.runline/plugins/`,
|
|
71
|
+
* - and — from the 188 builtins shipped with the package — only
|
|
72
|
+
* the ones named in `config.connections[].plugin`.
|
|
73
|
+
*
|
|
74
|
+
* Gating the builtins keeps `runline.actions()` scoped to what the
|
|
75
|
+
* project actually configured. Without this, a project with a
|
|
76
|
+
* single connection would still expose every bundled action to an
|
|
77
|
+
* agent, which is both noisy and a privacy problem (the agent sees
|
|
78
|
+
* surface area it has no credentials for).
|
|
79
|
+
*
|
|
80
|
+
* `options.builtinDir` is a test-only hook; production callers
|
|
81
|
+
* should rely on the default path to the bundled plugins.
|
|
82
|
+
*
|
|
67
83
|
* Fully self-contained — does not mutate global state.
|
|
68
84
|
*/
|
|
69
|
-
static async fromProject(cwd) {
|
|
85
|
+
static async fromProject(cwd, options = {}) {
|
|
70
86
|
const dir = cwd ?? process.cwd();
|
|
71
87
|
const configDir = findRunlineDir(dir);
|
|
72
88
|
if (!configDir)
|
|
73
89
|
return null;
|
|
74
90
|
const config = loadConfigFrom(configDir);
|
|
75
|
-
const
|
|
91
|
+
const builtinAllowlist = new Set(config.connections.map((c) => c.plugin));
|
|
92
|
+
const plugins = await discoverPlugins(configDir, {
|
|
93
|
+
builtinAllowlist,
|
|
94
|
+
builtinDir: options.builtinDir,
|
|
95
|
+
});
|
|
76
96
|
const rl = new Runline({
|
|
77
97
|
connections: config.connections,
|
|
78
98
|
timeoutMs: config.timeoutMs,
|