@rynx-ai/daemon 0.1.11-beta.1 → 0.1.11-beta.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/bundled-plugins/.rynx-plugin/marketplace.json +10 -0
- package/bundled-plugins/plugins/lark/.rynx-plugin/plugin.json +37 -0
- package/bundled-plugins/plugins/lark/dist/cli-mirror/mirror-index.d.ts +48 -0
- package/bundled-plugins/plugins/lark/dist/cli-mirror/mirror-index.js +54 -0
- package/bundled-plugins/plugins/lark/dist/cli-mirror/rollout-mirror.d.ts +85 -0
- package/bundled-plugins/plugins/lark/dist/cli-mirror/rollout-mirror.js +333 -0
- package/bundled-plugins/plugins/lark/dist/cli-mirror/rollout-watcher.d.ts +109 -0
- package/bundled-plugins/plugins/lark/dist/cli-mirror/rollout-watcher.js +347 -0
- package/bundled-plugins/plugins/lark/dist/host-adapters.d.ts +95 -0
- package/bundled-plugins/plugins/lark/dist/host-adapters.js +504 -0
- package/bundled-plugins/plugins/lark/dist/index.d.ts +7 -0
- package/bundled-plugins/plugins/lark/dist/index.js +7 -0
- package/bundled-plugins/plugins/lark/dist/lark-card-stream.d.ts +363 -0
- package/bundled-plugins/plugins/lark/dist/lark-card-stream.js +1335 -0
- package/bundled-plugins/plugins/lark/dist/lark-config-store.d.ts +30 -0
- package/bundled-plugins/plugins/lark/dist/lark-config-store.js +135 -0
- package/bundled-plugins/plugins/lark/dist/lark-content.d.ts +30 -0
- package/bundled-plugins/plugins/lark/dist/lark-content.js +138 -0
- package/bundled-plugins/plugins/lark/dist/lark-conversation-directory.d.ts +65 -0
- package/bundled-plugins/plugins/lark/dist/lark-conversation-directory.js +106 -0
- package/bundled-plugins/plugins/lark/dist/lark-diff-card.d.ts +25 -0
- package/bundled-plugins/plugins/lark/dist/lark-diff-card.js +58 -0
- package/bundled-plugins/plugins/lark/dist/lark-fork-transcript.d.ts +16 -0
- package/bundled-plugins/plugins/lark/dist/lark-fork-transcript.js +141 -0
- package/bundled-plugins/plugins/lark/dist/lark-resume-card.d.ts +31 -0
- package/bundled-plugins/plugins/lark/dist/lark-resume-card.js +105 -0
- package/bundled-plugins/plugins/lark/dist/lark-runtime-state-store.d.ts +18 -0
- package/bundled-plugins/plugins/lark/dist/lark-runtime-state-store.js +95 -0
- package/bundled-plugins/plugins/lark/dist/lark-sdk/client.d.ts +8 -0
- package/bundled-plugins/plugins/lark/dist/lark-sdk/client.js +32 -0
- package/bundled-plugins/plugins/lark/dist/lark-sdk/index.d.ts +1 -0
- package/bundled-plugins/plugins/lark/dist/lark-sdk/index.js +1 -0
- package/bundled-plugins/plugins/lark/dist/lark-sender.d.ts +114 -0
- package/bundled-plugins/plugins/lark/dist/lark-sender.js +323 -0
- package/bundled-plugins/plugins/lark/dist/lark-session-store.d.ts +13 -0
- package/bundled-plugins/plugins/lark/dist/lark-session-store.js +14 -0
- package/bundled-plugins/plugins/lark/dist/lark-settings-card.d.ts +55 -0
- package/bundled-plugins/plugins/lark/dist/lark-settings-card.js +158 -0
- package/bundled-plugins/plugins/lark/dist/lark-setup.d.ts +39 -0
- package/bundled-plugins/plugins/lark/dist/lark-setup.js +103 -0
- package/bundled-plugins/plugins/lark/dist/lark.d.ts +507 -0
- package/bundled-plugins/plugins/lark/dist/lark.js +1977 -0
- package/bundled-plugins/plugins/lark/dist/runtime.d.ts +13 -0
- package/bundled-plugins/plugins/lark/dist/runtime.js +131313 -0
- package/bundled-plugins/plugins/lark/dist/settings.d.ts +7 -0
- package/bundled-plugins/plugins/lark/dist/settings.js +126958 -0
- package/bundled-plugins/plugins/lark/package.json +57 -0
- package/bundled-plugins/plugins/lark/ui/assets/index-B2dhMlMU.css +1 -0
- package/bundled-plugins/plugins/lark/ui/assets/index-D9N-AkLX.js +201 -0
- package/bundled-plugins/plugins/lark/ui/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- package/bundled-plugins/plugins/lark/ui/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- package/bundled-plugins/plugins/lark/ui/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- package/bundled-plugins/plugins/lark/ui/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- package/bundled-plugins/plugins/lark/ui/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/bundled-plugins/plugins/lark/ui/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/bundled-plugins/plugins/lark/ui/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- package/bundled-plugins/plugins/lark/ui/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/bundled-plugins/plugins/lark/ui/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/bundled-plugins/plugins/lark/ui/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/bundled-plugins/plugins/lark/ui/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/bundled-plugins/plugins/lark/ui/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/bundled-plugins/plugins/lark/ui/index.html +13 -0
- package/dist/browser-artifact-management.d.ts +4 -1
- package/dist/browser-artifact-management.js +18 -10
- package/dist/browser-artifacts.d.ts +1 -0
- package/dist/browser-artifacts.js +1 -0
- package/dist/bundled-plugins.d.ts +15 -0
- package/dist/bundled-plugins.js +134 -0
- package/dist/chrome-for-testing-runtime.d.ts +27 -0
- package/dist/chrome-for-testing-runtime.js +193 -0
- package/dist/chrome-for-testing-store.d.ts +2 -0
- package/dist/chrome-for-testing-store.js +9 -0
- package/dist/control-deps.js +2 -79
- package/dist/daemon-server.d.ts +7 -1
- package/dist/daemon-server.js +299 -84
- package/dist/db.js +147 -124
- package/dist/entry-path.d.ts +3 -0
- package/dist/entry-path.js +12 -0
- package/dist/index-daemon.js +3 -66
- package/dist/lifecycle.d.ts +12 -0
- package/dist/lifecycle.js +16 -0
- package/dist/maintenance-lease.d.ts +39 -0
- package/dist/maintenance-lease.js +250 -0
- package/dist/migrations/cleanup-legacy-sessions.d.ts +1 -1
- package/dist/migrations/cleanup-legacy-sessions.js +33 -15
- package/dist/official-plugins.d.ts +2 -0
- package/dist/official-plugins.js +2 -0
- package/dist/plugin-cli.d.ts +1 -3
- package/dist/plugin-cli.js +56 -45
- package/dist/plugin-host-leases.d.ts +4 -0
- package/dist/plugin-host-leases.js +7 -0
- package/dist/plugin-host-rpc.d.ts +60 -4
- package/dist/plugin-host-rpc.js +300 -50
- package/dist/plugin-installer.d.ts +24 -55
- package/dist/plugin-installer.js +258 -412
- package/dist/plugin-management-service.d.ts +30 -23
- package/dist/plugin-management-service.js +290 -105
- package/dist/plugin-marketplace.d.ts +35 -0
- package/dist/plugin-marketplace.js +299 -0
- package/dist/plugin-package.d.ts +22 -24
- package/dist/plugin-package.js +520 -571
- package/dist/plugin-skill-context.d.ts +4 -0
- package/dist/plugin-skill-context.js +35 -0
- package/dist/plugin-store.d.ts +36 -37
- package/dist/plugin-store.js +140 -92
- package/dist/plugin-supervisor.d.ts +50 -125
- package/dist/plugin-supervisor.js +682 -1030
- package/dist/pm2.d.ts +11 -2
- package/dist/pm2.js +130 -28
- package/dist/process.d.ts +12 -0
- package/dist/process.js +91 -0
- package/dist/runtime-project-store.d.ts +9 -0
- package/dist/runtime-project-store.js +83 -0
- package/dist/session-fallback-workspace.d.ts +22 -0
- package/dist/session-fallback-workspace.js +120 -0
- package/dist/session-fork-store.d.ts +41 -0
- package/dist/session-fork-store.js +288 -0
- package/dist/session-launch-operations.d.ts +23 -2
- package/dist/session-launch-operations.js +48 -7
- package/dist/session-meta-store.d.ts +7 -9
- package/dist/session-meta-store.js +28 -49
- package/dist/setup-service.d.ts +20 -0
- package/dist/setup-service.js +38 -0
- package/package.json +36 -20
- package/dist/browser-cli-args.d.ts +0 -20
- package/dist/browser-cli-args.js +0 -100
- package/dist/channel-store.d.ts +0 -22
- package/dist/channel-store.js +0 -65
- package/dist/cli.d.ts +0 -2
- package/dist/cli.js +0 -732
- package/dist/control-client.d.ts +0 -122
- package/dist/control-client.js +0 -855
- package/dist/control-endpoint.d.ts +0 -14
- package/dist/control-endpoint.js +0 -124
- package/dist/desktop-browser-host-client.d.ts +0 -35
- package/dist/desktop-browser-host-client.js +0 -415
- package/dist/instance-store.d.ts +0 -38
- package/dist/instance-store.js +0 -85
- package/dist/plugin-install-restart.d.ts +0 -13
- package/dist/plugin-install-restart.js +0 -24
- package/dist/plugin-runtime-control.d.ts +0 -2
- package/dist/plugin-runtime-control.js +0 -37
- package/dist/registry.d.ts +0 -10
- package/dist/registry.js +0 -52
- package/dist/setup.d.ts +0 -20
- package/dist/setup.js +0 -374
- package/dist/update.d.ts +0 -25
- package/dist/update.js +0 -133
package/package.json
CHANGED
|
@@ -1,50 +1,66 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rynx-ai/daemon",
|
|
3
|
-
"version": "0.1.11-beta.
|
|
3
|
+
"version": "0.1.11-beta.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/rynx-ai/rynx.git",
|
|
7
7
|
"directory": "packages/daemon"
|
|
8
8
|
},
|
|
9
|
-
"description": "Rynx
|
|
9
|
+
"description": "Rynx resident control-plane service and standalone lifecycle implementation.",
|
|
10
10
|
"type": "module",
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=22"
|
|
13
|
+
},
|
|
11
14
|
"publishConfig": {
|
|
12
15
|
"registry": "https://registry.npmjs.org/",
|
|
13
16
|
"access": "public"
|
|
14
17
|
},
|
|
15
18
|
"files": [
|
|
16
|
-
"dist"
|
|
19
|
+
"dist",
|
|
20
|
+
"bundled-plugins"
|
|
17
21
|
],
|
|
18
|
-
"bin": {
|
|
19
|
-
"rynx": "./dist/cli.js"
|
|
20
|
-
},
|
|
21
|
-
"main": "./dist/index-daemon.js",
|
|
22
22
|
"exports": {
|
|
23
|
-
"./
|
|
24
|
-
"types": "./dist/
|
|
25
|
-
"default": "./dist/
|
|
23
|
+
"./entry-path": {
|
|
24
|
+
"types": "./dist/entry-path.d.ts",
|
|
25
|
+
"default": "./dist/entry-path.js"
|
|
26
|
+
},
|
|
27
|
+
"./lifecycle": {
|
|
28
|
+
"types": "./dist/lifecycle.d.ts",
|
|
29
|
+
"default": "./dist/lifecycle.js"
|
|
30
|
+
},
|
|
31
|
+
"./browser-artifacts": {
|
|
32
|
+
"types": "./dist/browser-artifacts.d.ts",
|
|
33
|
+
"default": "./dist/browser-artifacts.js"
|
|
34
|
+
},
|
|
35
|
+
"./setup-service": {
|
|
36
|
+
"types": "./dist/setup-service.d.ts",
|
|
37
|
+
"default": "./dist/setup-service.js"
|
|
38
|
+
},
|
|
39
|
+
"./internal/process": {
|
|
40
|
+
"types": "./dist/process.d.ts",
|
|
41
|
+
"default": "./dist/process.js"
|
|
26
42
|
}
|
|
27
43
|
},
|
|
28
44
|
"dependencies": {
|
|
29
|
-
"@clack/prompts": "^1.6.0",
|
|
30
45
|
"better-sqlite3": "^12.11.1",
|
|
31
46
|
"extract-zip": "2.0.1",
|
|
32
47
|
"pm2": "^6.0.0",
|
|
33
48
|
"tar": "^7.5.19",
|
|
34
49
|
"ws": "^8.21.0",
|
|
35
|
-
"@rynx-ai/core": "0.1.11-beta.
|
|
36
|
-
"@rynx-ai/emulator": "0.1.11-beta.
|
|
37
|
-
"@rynx-ai/plugin-runner": "0.1.11-beta.
|
|
38
|
-
"@rynx-ai/
|
|
39
|
-
"@rynx-ai/
|
|
40
|
-
"@rynx-ai/
|
|
41
|
-
"@rynx-ai/server": "0.1.11-beta.
|
|
50
|
+
"@rynx-ai/core": "0.1.11-beta.3",
|
|
51
|
+
"@rynx-ai/emulator": "0.1.11-beta.3",
|
|
52
|
+
"@rynx-ai/plugin-runner": "0.1.11-beta.3",
|
|
53
|
+
"@rynx-ai/protocol": "0.1.11-beta.3",
|
|
54
|
+
"@rynx-ai/remote-runtime-client": "0.1.11-beta.3",
|
|
55
|
+
"@rynx-ai/plugin-sdk": "0.1.11-beta.3",
|
|
56
|
+
"@rynx-ai/server": "0.1.11-beta.3"
|
|
42
57
|
},
|
|
43
58
|
"devDependencies": {
|
|
44
|
-
"@types/ws": "^8.18.1"
|
|
59
|
+
"@types/ws": "^8.18.1",
|
|
60
|
+
"@rynx-ai/plugin-channel-lark": "0.1.11-beta.3"
|
|
45
61
|
},
|
|
46
62
|
"scripts": {
|
|
47
|
-
"build": "rm -rf dist && tsc -p tsconfig.json && chmod +x dist/
|
|
63
|
+
"build": "rm -rf dist bundled-plugins && tsc -p tsconfig.json && chmod +x dist/index-daemon.js && node ../../scripts/stage-bundled-plugins.mjs",
|
|
48
64
|
"dev": "tsx watch --tsconfig ../../tsconfig.json src/index-daemon.ts"
|
|
49
65
|
}
|
|
50
66
|
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export type BrowserCliSubcommand = "install" | "update" | "version" | "clean" | "open" | "status" | "pages" | "endpoint" | "close";
|
|
2
|
-
export interface BrowserCliArgs {
|
|
3
|
-
subcommand: BrowserCliSubcommand;
|
|
4
|
-
json: boolean;
|
|
5
|
-
ensure: boolean;
|
|
6
|
-
channel?: string;
|
|
7
|
-
version?: string;
|
|
8
|
-
runtime?: string;
|
|
9
|
-
session?: string;
|
|
10
|
-
url?: string;
|
|
11
|
-
}
|
|
12
|
-
export interface BrowserCliTarget {
|
|
13
|
-
runtimeSelector: string;
|
|
14
|
-
sessionId: string;
|
|
15
|
-
credential?: RuntimeBrowserBootstrapCredential;
|
|
16
|
-
}
|
|
17
|
-
export declare function parseBrowserCliArgs(args: readonly string[]): BrowserCliArgs;
|
|
18
|
-
/** Resolve authority without ever turning a managed Session into an operator. */
|
|
19
|
-
export declare function resolveBrowserCliTarget(args: BrowserCliArgs, managedCredential: RuntimeBrowserBootstrapCredential | undefined): BrowserCliTarget;
|
|
20
|
-
import type { RuntimeBrowserBootstrapCredential } from "@rynx-ai/protocol/runtime-browser-bootstrap";
|
package/dist/browser-cli-args.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
const SPECS = {
|
|
2
|
-
install: { values: ["--channel", "--version"], flags: ["--json"] },
|
|
3
|
-
update: { values: ["--channel"], flags: ["--json"] },
|
|
4
|
-
version: { values: [], flags: ["--json"] },
|
|
5
|
-
clean: { values: [], flags: ["--json"] },
|
|
6
|
-
open: {
|
|
7
|
-
values: ["--url", "--session", "--runtime"],
|
|
8
|
-
flags: ["--json"],
|
|
9
|
-
positionalUrl: true,
|
|
10
|
-
},
|
|
11
|
-
status: { values: ["--session", "--runtime"], flags: ["--json"] },
|
|
12
|
-
pages: { values: ["--session", "--runtime"], flags: ["--json"] },
|
|
13
|
-
endpoint: { values: ["--session"], flags: ["--ensure", "--json"] },
|
|
14
|
-
close: { values: ["--session", "--runtime"], flags: ["--json"] },
|
|
15
|
-
};
|
|
16
|
-
export function parseBrowserCliArgs(args) {
|
|
17
|
-
const subcommand = args[0];
|
|
18
|
-
if (!isBrowserSubcommand(subcommand)) {
|
|
19
|
-
throw new Error("browser: expected install, update, version, clean, open, status, pages, endpoint, or close");
|
|
20
|
-
}
|
|
21
|
-
const spec = SPECS[subcommand];
|
|
22
|
-
const values = new Map();
|
|
23
|
-
const flags = new Set();
|
|
24
|
-
const positionals = [];
|
|
25
|
-
for (let index = 1; index < args.length; index += 1) {
|
|
26
|
-
const arg = args[index];
|
|
27
|
-
if (arg.startsWith("--")) {
|
|
28
|
-
if (spec.flags.includes(arg)) {
|
|
29
|
-
if (flags.has(arg))
|
|
30
|
-
throw new Error(`browser ${subcommand}: duplicate option ${arg}`);
|
|
31
|
-
flags.add(arg);
|
|
32
|
-
continue;
|
|
33
|
-
}
|
|
34
|
-
if (spec.values.includes(arg)) {
|
|
35
|
-
if (values.has(arg))
|
|
36
|
-
throw new Error(`browser ${subcommand}: duplicate option ${arg}`);
|
|
37
|
-
const value = args[index + 1];
|
|
38
|
-
if (!value || value.startsWith("--")) {
|
|
39
|
-
throw new Error(`browser ${subcommand}: ${arg} requires a value`);
|
|
40
|
-
}
|
|
41
|
-
values.set(arg, value);
|
|
42
|
-
index += 1;
|
|
43
|
-
continue;
|
|
44
|
-
}
|
|
45
|
-
throw new Error(`browser ${subcommand}: unknown option ${arg}`);
|
|
46
|
-
}
|
|
47
|
-
positionals.push(arg);
|
|
48
|
-
}
|
|
49
|
-
if (!spec.positionalUrl && positionals.length > 0) {
|
|
50
|
-
throw new Error(`browser ${subcommand}: unexpected argument ${positionals[0]}`);
|
|
51
|
-
}
|
|
52
|
-
if (positionals.length > 1) {
|
|
53
|
-
throw new Error(`browser ${subcommand}: unexpected extra argument ${positionals[1]}`);
|
|
54
|
-
}
|
|
55
|
-
if (positionals.length === 1 && values.has("--url")) {
|
|
56
|
-
throw new Error("browser open: pass the URL once, either positionally or with --url");
|
|
57
|
-
}
|
|
58
|
-
return {
|
|
59
|
-
subcommand,
|
|
60
|
-
json: flags.has("--json"),
|
|
61
|
-
ensure: flags.has("--ensure"),
|
|
62
|
-
...(values.has("--channel") ? { channel: values.get("--channel") } : {}),
|
|
63
|
-
...(values.has("--version") ? { version: values.get("--version") } : {}),
|
|
64
|
-
...(values.has("--runtime") ? { runtime: values.get("--runtime") } : {}),
|
|
65
|
-
...(values.has("--session") ? { session: values.get("--session") } : {}),
|
|
66
|
-
...(values.has("--url") || positionals[0]
|
|
67
|
-
? { url: values.get("--url") ?? positionals[0] }
|
|
68
|
-
: {}),
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
/** Resolve authority without ever turning a managed Session into an operator. */
|
|
72
|
-
export function resolveBrowserCliTarget(args, managedCredential) {
|
|
73
|
-
const runtimeSelector = args.runtime ?? "local";
|
|
74
|
-
if (runtimeSelector !== "local") {
|
|
75
|
-
if (managedCredential) {
|
|
76
|
-
throw new Error("browser: a managed Session cannot select another Runtime");
|
|
77
|
-
}
|
|
78
|
-
if (!args.session) {
|
|
79
|
-
throw new Error("browser: --session is required when selecting a remote Runtime");
|
|
80
|
-
}
|
|
81
|
-
return { runtimeSelector, sessionId: args.session };
|
|
82
|
-
}
|
|
83
|
-
if (managedCredential) {
|
|
84
|
-
if (args.session && args.session !== managedCredential.sessionId) {
|
|
85
|
-
throw new Error("browser: a managed Session cannot control another Session with --session");
|
|
86
|
-
}
|
|
87
|
-
return {
|
|
88
|
-
runtimeSelector: "local",
|
|
89
|
-
sessionId: managedCredential.sessionId,
|
|
90
|
-
credential: managedCredential,
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
if (!args.session) {
|
|
94
|
-
throw new Error("browser: run inside a managed Rynx Session or pass --session for operator access");
|
|
95
|
-
}
|
|
96
|
-
return { runtimeSelector: "local", sessionId: args.session };
|
|
97
|
-
}
|
|
98
|
-
function isBrowserSubcommand(value) {
|
|
99
|
-
return value !== undefined && Object.hasOwn(SPECS, value);
|
|
100
|
-
}
|
package/dist/channel-store.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export interface ChannelConfig {
|
|
2
|
-
/** Stable system-assigned id (never changes). */
|
|
3
|
-
id: string;
|
|
4
|
-
/** Human-visible, unique, editable label. */
|
|
5
|
-
name: string;
|
|
6
|
-
/** Channel type (which plugin-contributed factory). */
|
|
7
|
-
type: string;
|
|
8
|
-
options?: Record<string, unknown>;
|
|
9
|
-
}
|
|
10
|
-
export declare function listChannels(): ChannelConfig[];
|
|
11
|
-
export declare function getChannel(id: string): ChannelConfig | undefined;
|
|
12
|
-
/** Create a channel with a system-assigned id and a unique `name` label. */
|
|
13
|
-
export declare function createChannel(input: {
|
|
14
|
-
name: string;
|
|
15
|
-
type: string;
|
|
16
|
-
options?: Record<string, unknown>;
|
|
17
|
-
}): ChannelConfig;
|
|
18
|
-
export declare function renameChannel(id: string, name: string): void;
|
|
19
|
-
/** Merge credentials/options into a channel (e.g. the result of an authorize flow). */
|
|
20
|
-
export declare function setChannelOptions(id: string, options: Record<string, unknown>): void;
|
|
21
|
-
/** Remove a channel; its bound instance (if any) cascades away (FK ON DELETE CASCADE). */
|
|
22
|
-
export declare function removeChannel(id: string): void;
|
package/dist/channel-store.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `channels` table CRUD — a channel is a plugin type + its config/credentials
|
|
3
|
-
* (`options`), configured and authorized on its own. No agent binding here;
|
|
4
|
-
* that lives on an {@link import("./instance-store.js")} instance.
|
|
5
|
-
*
|
|
6
|
-
* Credentials stay in each channel's `options` and are sent only to that
|
|
7
|
-
* plugin runner instance; they are never copied into the daemon environment.
|
|
8
|
-
*/
|
|
9
|
-
import { randomUUID } from "node:crypto";
|
|
10
|
-
import { db } from "./db.js";
|
|
11
|
-
function parseOptions(raw) {
|
|
12
|
-
if (!raw)
|
|
13
|
-
return undefined;
|
|
14
|
-
try {
|
|
15
|
-
const parsed = JSON.parse(raw);
|
|
16
|
-
return parsed && typeof parsed === "object" ? parsed : undefined;
|
|
17
|
-
}
|
|
18
|
-
catch {
|
|
19
|
-
return undefined;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
function toConfig(row) {
|
|
23
|
-
return { id: row.id, name: row.name, type: row.type, options: parseOptions(row.options) };
|
|
24
|
-
}
|
|
25
|
-
export function listChannels() {
|
|
26
|
-
const rows = db().prepare("SELECT * FROM channels ORDER BY name").all();
|
|
27
|
-
return rows.map(toConfig);
|
|
28
|
-
}
|
|
29
|
-
export function getChannel(id) {
|
|
30
|
-
const row = db().prepare("SELECT * FROM channels WHERE id = ?").get(id);
|
|
31
|
-
return row ? toConfig(row) : undefined;
|
|
32
|
-
}
|
|
33
|
-
/** Create a channel with a system-assigned id and a unique `name` label. */
|
|
34
|
-
export function createChannel(input) {
|
|
35
|
-
const id = randomUUID();
|
|
36
|
-
const now = new Date().toISOString();
|
|
37
|
-
db()
|
|
38
|
-
.prepare(`INSERT INTO channels (id, name, type, options, created_at, updated_at)
|
|
39
|
-
VALUES (@id, @name, @type, @options, @now, @now)`)
|
|
40
|
-
.run({
|
|
41
|
-
id,
|
|
42
|
-
name: input.name,
|
|
43
|
-
type: input.type,
|
|
44
|
-
options: input.options ? JSON.stringify(input.options) : null,
|
|
45
|
-
now,
|
|
46
|
-
});
|
|
47
|
-
return getChannel(id);
|
|
48
|
-
}
|
|
49
|
-
export function renameChannel(id, name) {
|
|
50
|
-
db().prepare("UPDATE channels SET name = ?, updated_at = ? WHERE id = ?").run(name, new Date().toISOString(), id);
|
|
51
|
-
}
|
|
52
|
-
/** Merge credentials/options into a channel (e.g. the result of an authorize flow). */
|
|
53
|
-
export function setChannelOptions(id, options) {
|
|
54
|
-
const current = getChannel(id);
|
|
55
|
-
if (!current)
|
|
56
|
-
return;
|
|
57
|
-
const merged = { ...(current.options ?? {}), ...options };
|
|
58
|
-
db()
|
|
59
|
-
.prepare("UPDATE channels SET options = ?, updated_at = ? WHERE id = ?")
|
|
60
|
-
.run(JSON.stringify(merged), new Date().toISOString(), id);
|
|
61
|
-
}
|
|
62
|
-
/** Remove a channel; its bound instance (if any) cascades away (FK ON DELETE CASCADE). */
|
|
63
|
-
export function removeChannel(id) {
|
|
64
|
-
db().prepare("DELETE FROM channels WHERE id = ?").run(id);
|
|
65
|
-
}
|
package/dist/cli.d.ts
DELETED