@roubo/plugin-sdk 0.1.0 → 0.1.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.
@@ -0,0 +1,33 @@
1
+ import type { MessageConnection } from "vscode-jsonrpc/node.js";
2
+ import type { ComponentHostClient } from "./types.js";
3
+ /**
4
+ * The routing key the host needs to dispatch a broker call to the right bench
5
+ * (and, for reportLog, the right component). A component plugin is spawned once
6
+ * and multiplexes benches over one shared connection, so the broker params must
7
+ * name the bench the call acts for (#685). The SDK stamps this from the
8
+ * in-flight lifecycle call rather than burdening plugin authors with passing it
9
+ * by hand: each lifecycle handler dispatch sets the routing context for the
10
+ * duration of the call (see defineComponentPlugin), and every outgoing host.*
11
+ * request/notification reads it back here.
12
+ */
13
+ export interface HostRoutingContext {
14
+ benchId: number;
15
+ componentName: string;
16
+ }
17
+ /**
18
+ * Run `fn` with the given routing context bound, so any host.* call it makes
19
+ * (synchronously or via awaited continuations) stamps `benchId` /
20
+ * `componentName` onto its params. Used by defineComponentPlugin to wrap each
21
+ * lifecycle handler dispatch.
22
+ */
23
+ export declare function runWithHostRoutingContext<T>(ctx: HostRoutingContext, fn: () => T): T;
24
+ export declare function bindComponentHostConnection(connection: MessageConnection): void;
25
+ export declare function unbindComponentHostConnection(connection: MessageConnection): void;
26
+ /**
27
+ * The host broker surface a component plugin drives over JSON-RPC. The host
28
+ * owns every process and container handle; these calls ask the host to act on
29
+ * the plugin's behalf. `reportStatus` / `reportLog` are notifications (push,
30
+ * fire-and-forget); everything else is a request that resolves with a result.
31
+ */
32
+ export declare const host: ComponentHostClient;
33
+ //# sourceMappingURL=component-host-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-host-client.d.ts","sourceRoot":"","sources":["../src/component-host-client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAEV,mBAAmB,EAIpB,MAAM,YAAY,CAAC;AAIpB;;;;;;;;;GASG;AACH,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;CACvB;AAID;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,GAAG,EAAE,kBAAkB,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAEpF;AAED,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,iBAAiB,GAAG,IAAI,CAE/E;AAED,wBAAgB,6BAA6B,CAAC,UAAU,EAAE,iBAAiB,GAAG,IAAI,CAIjF;AAoCD;;;;;GAKG;AACH,eAAO,MAAM,IAAI,EAAE,mBA2JjB,CAAC"}
@@ -0,0 +1,168 @@
1
+ import { AsyncLocalStorage } from "node:async_hooks";
2
+ let activeConnection = null;
3
+ const routingStore = new AsyncLocalStorage();
4
+ /**
5
+ * Run `fn` with the given routing context bound, so any host.* call it makes
6
+ * (synchronously or via awaited continuations) stamps `benchId` /
7
+ * `componentName` onto its params. Used by defineComponentPlugin to wrap each
8
+ * lifecycle handler dispatch.
9
+ */
10
+ export function runWithHostRoutingContext(ctx, fn) {
11
+ return routingStore.run(ctx, fn);
12
+ }
13
+ export function bindComponentHostConnection(connection) {
14
+ activeConnection = connection;
15
+ }
16
+ export function unbindComponentHostConnection(connection) {
17
+ if (activeConnection === connection) {
18
+ activeConnection = null;
19
+ }
20
+ }
21
+ function requireConnection() {
22
+ if (!activeConnection) {
23
+ throw new Error("@roubo/plugin-sdk: host.* called before defineComponentPlugin(). Call defineComponentPlugin({...}) once at module top level.");
24
+ }
25
+ return activeConnection;
26
+ }
27
+ /**
28
+ * The bench this broker call acts for. A host.* call made outside any lifecycle
29
+ * handler (no ambient routing context) cannot be routed, so it throws here
30
+ * rather than silently mis-resolving: the host has no way to attribute it.
31
+ */
32
+ function requireBenchId(method) {
33
+ const ctx = routingStore.getStore();
34
+ if (!ctx) {
35
+ throw new Error(`@roubo/plugin-sdk: ${method} called outside a lifecycle handler; the host cannot route it to a bench.`);
36
+ }
37
+ return ctx.benchId;
38
+ }
39
+ function requireComponentName(method) {
40
+ const ctx = routingStore.getStore();
41
+ if (!ctx) {
42
+ throw new Error(`@roubo/plugin-sdk: ${method} called outside a lifecycle handler; the host cannot route it to a component.`);
43
+ }
44
+ return ctx.componentName;
45
+ }
46
+ /**
47
+ * The host broker surface a component plugin drives over JSON-RPC. The host
48
+ * owns every process and container handle; these calls ask the host to act on
49
+ * the plugin's behalf. `reportStatus` / `reportLog` are notifications (push,
50
+ * fire-and-forget); everything else is a request that resolves with a result.
51
+ */
52
+ export const host = Object.freeze({
53
+ process: Object.freeze({
54
+ async start(params) {
55
+ const method = "host.process.start";
56
+ return requireConnection().sendRequest(method, {
57
+ ...params,
58
+ benchId: requireBenchId(method),
59
+ });
60
+ },
61
+ async run(params) {
62
+ const method = "host.process.run";
63
+ return requireConnection().sendRequest(method, {
64
+ ...params,
65
+ benchId: requireBenchId(method),
66
+ });
67
+ },
68
+ async stop(params) {
69
+ const method = "host.process.stop";
70
+ await requireConnection().sendRequest(method, {
71
+ ...params,
72
+ benchId: requireBenchId(method),
73
+ });
74
+ },
75
+ async status(params) {
76
+ const method = "host.process.status";
77
+ return requireConnection().sendRequest(method, {
78
+ ...params,
79
+ benchId: requireBenchId(method),
80
+ });
81
+ },
82
+ async logs(params) {
83
+ const method = "host.process.logs";
84
+ return requireConnection().sendRequest(method, {
85
+ ...params,
86
+ benchId: requireBenchId(method),
87
+ });
88
+ },
89
+ }),
90
+ docker: Object.freeze({
91
+ async composeUp(params) {
92
+ const method = "host.docker.composeUp";
93
+ return requireConnection().sendRequest(method, {
94
+ ...params,
95
+ benchId: requireBenchId(method),
96
+ });
97
+ },
98
+ async waitForHealthy(params) {
99
+ const method = "host.docker.waitForHealthy";
100
+ return requireConnection().sendRequest(method, {
101
+ ...params,
102
+ benchId: requireBenchId(method),
103
+ });
104
+ },
105
+ async composeRunInit(params) {
106
+ const method = "host.docker.composeRunInit";
107
+ await requireConnection().sendRequest(method, {
108
+ ...params,
109
+ benchId: requireBenchId(method),
110
+ });
111
+ },
112
+ async composeStop(params) {
113
+ const method = "host.docker.composeStop";
114
+ await requireConnection().sendRequest(method, {
115
+ ...params,
116
+ benchId: requireBenchId(method),
117
+ });
118
+ },
119
+ async composeDown(params) {
120
+ const method = "host.docker.composeDown";
121
+ await requireConnection().sendRequest(method, {
122
+ ...params,
123
+ benchId: requireBenchId(method),
124
+ });
125
+ },
126
+ async assignContainer(params) {
127
+ const method = "host.docker.assignContainer";
128
+ await requireConnection().sendRequest(method, {
129
+ ...params,
130
+ benchId: requireBenchId(method),
131
+ });
132
+ },
133
+ }),
134
+ ports: Object.freeze({
135
+ async get(params) {
136
+ const method = "host.ports.get";
137
+ return requireConnection().sendRequest(method, {
138
+ ...params,
139
+ benchId: requireBenchId(method),
140
+ });
141
+ },
142
+ }),
143
+ component: Object.freeze({
144
+ reportStatus(status) {
145
+ const method = "host.component.reportStatus";
146
+ void requireConnection().sendNotification(method, {
147
+ ...status,
148
+ benchId: requireBenchId(method),
149
+ });
150
+ },
151
+ reportLog(params) {
152
+ const method = "host.component.reportLog";
153
+ void requireConnection().sendNotification(method, {
154
+ ...params,
155
+ benchId: requireBenchId(method),
156
+ componentName: requireComponentName(method),
157
+ });
158
+ },
159
+ }),
160
+ capability: Object.freeze({
161
+ async query(params) {
162
+ // capability.query is not bench-routed (it answers a static version gate),
163
+ // so it carries no benchId and works outside a lifecycle handler.
164
+ return requireConnection().sendRequest("host.capability.query", params);
165
+ },
166
+ }),
167
+ });
168
+ //# sourceMappingURL=component-host-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-host-client.js","sourceRoot":"","sources":["../src/component-host-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAUrD,IAAI,gBAAgB,GAA6B,IAAI,CAAC;AAiBtD,MAAM,YAAY,GAAG,IAAI,iBAAi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AC,MAAM,CAAC;QACnB,KAAK,CAAC,GAAG,CAAC,MAAiC;YACzC,MAAM,MAAM,GAAG,gBAAgB,CAAC;YAChC,OAAO,iBAAiB,EAAE,CAAC,WAAW,CAAS,MAAM,EAAE;gBACrD,GAAG,MAAM;gBACT,OAAO,EAAE,cAAc,CAAC,MAAM,CAAC;aAChC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;IACF,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC;QACvB,YAAY,CAAC,MAAuB;YAClC,MAAM,MAAM,GAAG,6BAA6B,CAAC;YAC7C,KAAK,iBAAiB,EAAE,CAAC,gBAAgB,CAAC,MAAM,EAAE;gBAChD,GAAG,MAAM;gBACT,OAAO,EAAE,cAAc,CAAC,MAAM,CAAC;aAChC,CAAC,CAAC;QACL,CAAC;QACD,SAAS,CAAC,MAAiE;YACzE,MAAM,MAAM,GAAG,0BAA0B,CAAC;YAC1C,KAAK,iBAAiB,EAAE,CAAC,gBAAgB,CAAC,MAAM,EAAE;gBAChD,GAAG,MAAM;gBACT,OAAO,EAAE,cAAc,CAAC,MAAM,CAAC;gBAC/B,aAAa,EAAE,oBAAoB,CAAC,MAAM,CAAC;aAC5C,CAAC,CAAC;QACL,CAAC;KACF,CAAC;IACF,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC;QACxB,KAAK,CAAC,KAAK,CAAC,MAA0B;YACpC,2EAA2E;YAC3E,kEAAkE;YAClE,OAAO,iBAAiB,EAAE,CAAC,WAAW,CACpC,uBAAuB,EACvB,MAAM,CACP,CAAC;QACJ,CAAC;KACF,CAAC;CACH,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { type MessageConnection } from "vscode-jsonrpc/node.js";
2
+ /**
3
+ * Optional stdio-stream override shared by every `define*Plugin` entry point.
4
+ * Test harnesses inject paired in-memory streams; production plugin code
5
+ * leaves this unset and the bootstrap defaults to `process.stdin` /
6
+ * `process.stdout`.
7
+ */
8
+ export interface PluginStreams {
9
+ input: NodeJS.ReadableStream;
10
+ output: NodeJS.WritableStream;
11
+ }
12
+ /**
13
+ * Resolve the JSON-RPC streams (defaulting to process stdio) and create the
14
+ * vscode-jsonrpc message connection. This is the shared plumbing that both
15
+ * `definePlugin` and `defineComponentPlugin` use so the transport lives in one
16
+ * place. The caller registers its own `onRequest` handlers, binds the host
17
+ * client, and calls `connection.listen()`.
18
+ */
19
+ export declare function createPluginConnection(streams?: PluginStreams): MessageConnection;
20
+ //# sourceMappingURL=connection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,wBAAwB,CAAC;AAEhC;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC,cAAc,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,iBAAiB,CAOjF"}
@@ -0,0 +1,16 @@
1
+ import { createMessageConnection, StreamMessageReader, StreamMessageWriter, } from "vscode-jsonrpc/node.js";
2
+ /**
3
+ * Resolve the JSON-RPC streams (defaulting to process stdio) and create the
4
+ * vscode-jsonrpc message connection. This is the shared plumbing that both
5
+ * `definePlugin` and `defineComponentPlugin` use so the transport lives in one
6
+ * place. The caller registers its own `onRequest` handlers, binds the host
7
+ * client, and calls `connection.listen()`.
8
+ */
9
+ export function createPluginConnection(streams) {
10
+ const input = streams?.input ?? process.stdin;
11
+ const output = streams?.output ?? process.stdout;
12
+ const reader = new StreamMessageReader(input);
13
+ const writer = new StreamMessageWriter(output);
14
+ return createMessageConnection(reader, writer);
15
+ }
16
+ //# sourceMappingURL=connection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.js","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,GAEpB,MAAM,wBAAwB,CAAC;AAahC;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAAuB;IAC5D,MAAM,KAAK,GAAG,OAAO,EAAE,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC;IAC9C,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;IAEjD,MAAM,MAAM,GAAG,IAAI,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC/C,OAAO,uBAAuB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACjD,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { type ComponentContract, type ComponentPluginHandle, type DefineComponentPluginOptions } from "./types.js";
2
+ /**
3
+ * Register a component plugin's contract over the host JSON-RPC channel,
4
+ * parallel to `definePlugin()`. Plugin authors call this once, at module
5
+ * top-level, after defining their contract.
6
+ *
7
+ * A component plugin is written in one of two mutually exclusive modes:
8
+ *
9
+ * - **Declarative (preferred):** implement `translate({ config, context })`,
10
+ * returning a `ProvisionDescriptor` the host's LifecycleEngine executes.
11
+ * - **Imperative (escape hatch):** implement all four lifecycle hooks
12
+ * `start` / `stop` / `health` / `cleanup`, driving the host broker
13
+ * (`componentHost.process.*`, `componentHost.docker.*`,
14
+ * `componentHost.ports.*`) from inside them.
15
+ *
16
+ * ```ts
17
+ * import { defineComponentPlugin, componentHost } from "@roubo/plugin-sdk";
18
+ *
19
+ * // declarative
20
+ * defineComponentPlugin({
21
+ * translate({ config, context }) {
22
+ * return { schemaVersion: 1, kind: "process", command: config.command as string };
23
+ * },
24
+ * });
25
+ * ```
26
+ *
27
+ * Validation is synchronous (throws at definition time, never at call time):
28
+ *
29
+ * - An incompatible `contractVersion` is rejected (it must equal
30
+ * `SUPPORTED_CONTRACT_VERSION`).
31
+ * - Implementing `translate` AND any imperative hook is rejected (translate XOR
32
+ * hooks; never silently both).
33
+ * - The imperative mode must implement ALL of `start` / `stop` / `health` /
34
+ * `cleanup`; a plugin missing one (e.g. `stop`) is rejected here, not at
35
+ * stop-time.
36
+ */
37
+ export declare function defineComponentPlugin(contract: ComponentContract, options?: DefineComponentPluginOptions): ComponentPluginHandle;
38
+ //# sourceMappingURL=define-component-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define-component-plugin.d.ts","sourceRoot":"","sources":["../src/define-component-plugin.ts"],"names":[],"mappings":"AASA,OAAO,EAEL,KAAK,iBAAiB,EAGtB,KAAK,qBAAqB,EAC1B,KAAK,4BAA4B,EAClC,MAAM,YAAY,CAAC;AAkCpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,iBAAiB,EAC3B,OAAO,GAAE,4BAAiC,GACzC,qBAAqB,CAkEvB"}
@@ -0,0 +1,120 @@
1
+ import { bindComponentHostConnection, host, runWithHostRoutingContext, unbindComponentHostConnection, } from "./component-host-client.js";
2
+ import { createPluginConnection } from "./connection.js";
3
+ import { SUPPORTED_CONTRACT_VERSION, } from "./types.js";
4
+ const IMPERATIVE_HOOKS = [
5
+ "start",
6
+ "stop",
7
+ "health",
8
+ "cleanup",
9
+ ];
10
+ const COMPONENT_CONTRACT_METHODS = [
11
+ "translate",
12
+ ...IMPERATIVE_HOOKS,
13
+ ];
14
+ /** Pull the `context` field out of a `translate` call's `{ config, context }`. */
15
+ function extractContext(params) {
16
+ return params && typeof params === "object" ? params.context : params;
17
+ }
18
+ /**
19
+ * Read the bench routing key (benchId + componentName) off a lifecycle call's
20
+ * BenchContext. Returns null when the shape does not carry both, so the handler
21
+ * runs without an ambient routing context rather than with a partial one.
22
+ */
23
+ function readRouting(benchContext) {
24
+ if (!benchContext || typeof benchContext !== "object")
25
+ return null;
26
+ const { benchId, componentName } = benchContext;
27
+ if (typeof benchId !== "number" || typeof componentName !== "string")
28
+ return null;
29
+ return { benchId, componentName };
30
+ }
31
+ /**
32
+ * Register a component plugin's contract over the host JSON-RPC channel,
33
+ * parallel to `definePlugin()`. Plugin authors call this once, at module
34
+ * top-level, after defining their contract.
35
+ *
36
+ * A component plugin is written in one of two mutually exclusive modes:
37
+ *
38
+ * - **Declarative (preferred):** implement `translate({ config, context })`,
39
+ * returning a `ProvisionDescriptor` the host's LifecycleEngine executes.
40
+ * - **Imperative (escape hatch):** implement all four lifecycle hooks
41
+ * `start` / `stop` / `health` / `cleanup`, driving the host broker
42
+ * (`componentHost.process.*`, `componentHost.docker.*`,
43
+ * `componentHost.ports.*`) from inside them.
44
+ *
45
+ * ```ts
46
+ * import { defineComponentPlugin, componentHost } from "@roubo/plugin-sdk";
47
+ *
48
+ * // declarative
49
+ * defineComponentPlugin({
50
+ * translate({ config, context }) {
51
+ * return { schemaVersion: 1, kind: "process", command: config.command as string };
52
+ * },
53
+ * });
54
+ * ```
55
+ *
56
+ * Validation is synchronous (throws at definition time, never at call time):
57
+ *
58
+ * - An incompatible `contractVersion` is rejected (it must equal
59
+ * `SUPPORTED_CONTRACT_VERSION`).
60
+ * - Implementing `translate` AND any imperative hook is rejected (translate XOR
61
+ * hooks; never silently both).
62
+ * - The imperative mode must implement ALL of `start` / `stop` / `health` /
63
+ * `cleanup`; a plugin missing one (e.g. `stop`) is rejected here, not at
64
+ * stop-time.
65
+ */
66
+ export function defineComponentPlugin(contract, options = {}) {
67
+ const contractVersion = options.contractVersion ?? SUPPORTED_CONTRACT_VERSION;
68
+ if (contractVersion !== SUPPORTED_CONTRACT_VERSION) {
69
+ throw new Error(`@roubo/plugin-sdk: defineComponentPlugin contractVersion ${contractVersion} is incompatible with the host (supported: ${SUPPORTED_CONTRACT_VERSION}). Rejected at validation.`);
70
+ }
71
+ const fields = contract;
72
+ const hasTranslate = typeof fields.translate === "function";
73
+ const implementedHooks = IMPERATIVE_HOOKS.filter((hook) => typeof fields[hook] === "function");
74
+ if (hasTranslate && implementedHooks.length > 0) {
75
+ throw new Error("@roubo/plugin-sdk: a component plugin implements translate OR the imperative hooks (start/stop/health/cleanup), not both. Rejected at validation.");
76
+ }
77
+ if (!hasTranslate) {
78
+ if (implementedHooks.length === 0) {
79
+ throw new Error("@roubo/plugin-sdk: a component plugin must implement either translate or the imperative hooks (start/stop/health/cleanup). Rejected at validation.");
80
+ }
81
+ const missing = IMPERATIVE_HOOKS.filter((hook) => !implementedHooks.includes(hook));
82
+ if (missing.length > 0) {
83
+ throw new Error(`@roubo/plugin-sdk: an imperative component plugin must implement all lifecycle hooks; missing ${missing.join(", ")}. Rejected at validation.`);
84
+ }
85
+ }
86
+ const connection = createPluginConnection(options.streams);
87
+ for (const method of COMPONENT_CONTRACT_METHODS) {
88
+ const handler = fields[method];
89
+ if (typeof handler !== "function")
90
+ continue;
91
+ connection.onRequest(method, (params) => {
92
+ // Bind the in-flight lifecycle call's routing context for the duration of
93
+ // the handler, so any host.* broker call it makes is stamped with this
94
+ // bench/component (#685). `translate` receives `{ config, context }`; the
95
+ // imperative hooks receive the BenchContext directly. Both carry benchId
96
+ // and componentName. When the params do not carry a usable context (an
97
+ // unexpected shape), dispatch the handler without a routing context: a
98
+ // broker call inside it then throws the "outside a lifecycle handler"
99
+ // error rather than mis-routing.
100
+ const benchContext = method === "translate" ? extractContext(params) : params;
101
+ const routing = readRouting(benchContext);
102
+ const invoke = () => handler(params);
103
+ return routing ? runWithHostRoutingContext(routing, invoke) : invoke();
104
+ });
105
+ }
106
+ bindComponentHostConnection(connection);
107
+ connection.listen();
108
+ return Object.freeze({
109
+ host: host,
110
+ dispose() {
111
+ try {
112
+ connection.dispose();
113
+ }
114
+ finally {
115
+ unbindComponentHostConnection(connection);
116
+ }
117
+ },
118
+ });
119
+ }
120
+ //# sourceMappingURL=define-component-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define-component-plugin.js","sourceRoot":"","sources":["../src/define-component-plugin.ts"],"names":[],"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KAAK,WAAW,CAAC,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;YAC9E,MAAM,OAAO,GAAG,WAAW,CAAC,YAAY,CAAC,CAAC;YAC1C,MAAM,MAAM,GAAG,GAAG,EAAE,CAAE,OAAmC,CAAC,MAAe,CAAC,CAAC;YAC3E,OAAO,OAAO,CAAC,CAAC,CAAC,yBAAyB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QACzE,CAAC,CAAC,CAAC;IACL,CAAC;IAED,2BAA2B,CAAC,UAAU,CAAC,CAAC;IACxC,UAAU,CAAC,MAAM,EAAE,CAAC;IAEpB,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,IAA2B;QACjC,OAAO;YACL,IAAI,CAAC;gBACH,UAAU,CAAC,OAAO,EAAE,CAAC;YACvB,CAAC;oBAAS,CAAC;gBACT,6BAA6B,CAAC,UAAU,CAAC,CAAC;YAC5C,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"define-plugin.d.ts","sourceRoot":"","sources":["../src/define-plugin.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAEV,mBAAmB,EAEnB,cAAc,EACd,YAAY,EACb,MAAM,YAAY,CAAC;AAiBpB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,cAAc,EACxB,OAAO,GAAE,mBAAwB,GAChC,YAAY,CA6Bd"}
1
+ {"version":3,"file":"define-plugin.d.ts","sourceRoot":"","sources":["../src/define-plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,mBAAmB,EAEnB,cAAc,EACd,YAAY,EACb,MAAM,YAAY,CAAC;AA4BpB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,cAAc,EACxB,OAAO,GAAE,mBAAwB,GAChC,YAAY,CAwBd"}
@@ -1,18 +1,29 @@
1
- import { createMessageConnection, StreamMessageReader, StreamMessageWriter, } from "vscode-jsonrpc/node.js";
1
+ import { createPluginConnection } from "./connection.js";
2
2
  import { bindHostConnection, host, unbindHostConnection } from "./host-client.js";
3
3
  const CONTRACT_METHODS = [
4
4
  "listSourceCandidates",
5
+ "getSourceOptions",
5
6
  "listIssues",
6
7
  "getIssue",
7
8
  "getComments",
8
9
  "getCurrentUser",
9
10
  "validateConfig",
11
+ "setActiveConfig",
10
12
  "applyTransition",
13
+ "createIssue",
14
+ "addBlockedBy",
11
15
  "assignIssue",
12
16
  "unassignIssue",
13
17
  "getAvailableTransitions",
14
18
  "listIssueTypes",
19
+ "listStatusCategories",
15
20
  "listLabels",
21
+ "getConnectionStatus",
22
+ "probeAlertCategories",
23
+ "probeRepoAccess",
24
+ "filterFacets",
25
+ "getFacetOptions",
26
+ "getSortFields",
16
27
  ];
17
28
  /**
18
29
  * Register the plugin contract and start listening on the host JSON-RPC
@@ -36,11 +47,7 @@ const CONTRACT_METHODS = [
36
47
  * established here. Calling `host.*` before `definePlugin` throws.
37
48
  */
38
49
  export function definePlugin(contract, options = {}) {
39
- const input = options.streams?.input ?? process.stdin;
40
- const output = options.streams?.output ?? process.stdout;
41
- const reader = new StreamMessageReader(input);
42
- const writer = new StreamMessageWriter(output);
43
- const connection = createMessageConnection(reader, writer);
50
+ const connection = createPluginConnection(options.streams);
44
51
  for (const method of CONTRACT_METHODS) {
45
52
  const handler = contract[method];
46
53
  if (typeof handler !== "function")
@@ -1 +1 @@
1
- {"version":3,"file":"define-plugin.js","sourceRoot":"","sources":["../src/define-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,GAEpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AASlF,MAAM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B,CAAC,UAAU,CAAC,CAAC;YACnC,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,7 @@
1
1
  export { definePlugin } from "./define-plugin.js";
2
+ export { defineComponentPlugin } from "./define-component-plugin.js";
2
3
  export { host } from "./host-client.js";
3
- export type { ContractMethodName, CurrentUser, DefinePluginOptions, FetchInit, FetchResult, HostClient, IssueTypeOption, ListIssuesParams, ListIssuesResult, LogPayload, NormalizedComment, NormalizedIssue, PluginContract, PluginHandle, SourceCandidate, ValidateConfigResult, } from "./types.js";
4
+ export { host as componentHost } from "./component-host-client.js";
5
+ export { SUPPORTED_CONTRACT_VERSION } from "./types.js";
6
+ export type { BenchContext, CapabilityQueryResult, ComponentContract, ComponentContractMethodName, ComponentHostClient, ComponentPluginHandle, ComponentStatus, ConfiguredSource, DeclarativeComponentContract, DefineComponentPluginOptions, DockerProvisionDescriptor, ImperativeComponentContract, OneshotProvisionDescriptor, ProcessProvisionDescriptor, ProcessRunResult, ProcessStatusResult, ProvisionDescriptor, ConnectionStatus, ContractMethodName, CreateIssueResult, CurrentUser, DefinePluginOptions, FetchInit, FetchResult, FilterFacet, FilterFacetOption, GetFacetOptionsParams, GetSourceOptionsParams, HostClient, IssueTypeOption, ListIssueTypesParams, ListIssuesParams, ListIssuesResult, ListIssuesWarning, ListIssuesWarningCode, ListLabelsParams, LogPayload, NormalizedComment, NormalizedIssue, PluginContract, PluginHandle, ProbeAlertCategoriesParams, ProbeAlertCategoriesResult, ProbeAlertCategory, ProbeAlertCategoryReport, ProbeAlertCategoryStatus, ProbeRepoAccessResult, SearchableSourceCategory, SetActiveConfigResult, SourceCandidateCategory, SourceCandidateIcon, SourceCandidateItem, SourceCandidatesResponse, SourceCandidatesShape, SortField, SourceCategoryOption, SourceOptionsResult, ValidateConfigResult, } from "./types.js";
4
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,YAAY,EACV,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,SAAS,EACT,WAAW,EACX,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,YAAY,EACZ,eAAe,EACf,oBAAoB,GACrB,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,IAAI,IAAI,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AACxD,YAAY,EACV,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,EACjB,2BAA2B,EAC3B,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,EACf,gBAAgB,EAChB,4BAA4B,EAC5B,4BAA4B,EAC5B,yBAAyB,EACzB,2BAA2B,EAC3B,0BAA0B,EAC1B,0BAA0B,EAC1B,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,WAAW,EACX,mBAAmB,EACnB,SAAS,EACT,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,qBAAqB,EACrB,sBAAsB,EACtB,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,YAAY,EACZ,0BAA0B,EAC1B,0BAA0B,EAC1B,kBAAkB,EAClB,wBAAwB,EACxB,wBAAwB,EACxB,qBAAqB,EACrB,wBAAwB,EACxB,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,qBAAqB,EACrB,SAAS,EACT,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -1,3 +1,6 @@
1
1
  export { definePlugin } from "./define-plugin.js";
2
+ export { defineComponentPlugin } from "./define-component-plugin.js";
2
3
  export { host } from "./host-client.js";
4
+ export { host as componentHost } from "./component-host-client.js";
5
+ export { SUPPORTED_CONTRACT_VERSION } from "./types.js";
3
6
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,IAAI,IAAI,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC"}