@dobby.ai/dobby 0.1.1 → 0.1.2
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 +20 -7
- package/dist/src/agent/event-forwarder.js +185 -16
- package/dist/src/cli/commands/cron.js +39 -35
- package/dist/src/cli/program.js +0 -6
- package/dist/src/core/types.js +2 -0
- package/dist/src/cron/config.js +2 -2
- package/dist/src/cron/service.js +87 -23
- package/dist/src/cron/store.js +1 -1
- package/package.json +9 -3
- package/.env.example +0 -8
- package/AGENTS.md +0 -267
- package/ROADMAP.md +0 -34
- package/config/cron.example.json +0 -9
- package/config/gateway.example.json +0 -132
- package/dist/plugins/connector-discord/src/mapper.js +0 -75
- package/dist/src/cli/tests/config-command.test.js +0 -42
- package/dist/src/cli/tests/config-io.test.js +0 -64
- package/dist/src/cli/tests/config-mutators.test.js +0 -47
- package/dist/src/cli/tests/discord-mapper.test.js +0 -90
- package/dist/src/cli/tests/doctor.test.js +0 -252
- package/dist/src/cli/tests/init-catalog.test.js +0 -134
- package/dist/src/cli/tests/program-options.test.js +0 -78
- package/dist/src/cli/tests/routing-config.test.js +0 -254
- package/dist/src/core/tests/control-command.test.js +0 -17
- package/dist/src/core/tests/runtime-registry.test.js +0 -116
- package/dist/src/core/tests/typing-controller.test.js +0 -103
- package/docs/BOXLITE_SANDBOX_FEASIBILITY.md +0 -175
- package/docs/CRON_SCHEDULER_DESIGN.md +0 -374
- package/docs/DOCKER_SANDBOX_vs_BOXLITE.md +0 -77
- package/docs/EXTENSION_SYSTEM_ARCHITECTURE.md +0 -119
- package/docs/MVP.md +0 -135
- package/docs/RUNBOOK.md +0 -243
- package/docs/TEAMWORK_HANDOFF_DESIGN.md +0 -440
- package/plugins/connector-discord/dobby.manifest.json +0 -18
- package/plugins/connector-discord/index.js +0 -1
- package/plugins/connector-discord/package-lock.json +0 -360
- package/plugins/connector-discord/package.json +0 -38
- package/plugins/connector-discord/src/connector.ts +0 -345
- package/plugins/connector-discord/src/contribution.ts +0 -21
- package/plugins/connector-discord/src/mapper.ts +0 -101
- package/plugins/connector-discord/tsconfig.json +0 -19
- package/plugins/connector-feishu/dobby.manifest.json +0 -18
- package/plugins/connector-feishu/index.js +0 -1
- package/plugins/connector-feishu/package-lock.json +0 -618
- package/plugins/connector-feishu/package.json +0 -38
- package/plugins/connector-feishu/src/connector.ts +0 -343
- package/plugins/connector-feishu/src/contribution.ts +0 -26
- package/plugins/connector-feishu/src/mapper.ts +0 -401
- package/plugins/connector-feishu/tsconfig.json +0 -19
- package/plugins/plugin-sdk/index.d.ts +0 -261
- package/plugins/plugin-sdk/index.js +0 -1
- package/plugins/plugin-sdk/package-lock.json +0 -12
- package/plugins/plugin-sdk/package.json +0 -22
- package/plugins/provider-claude/dobby.manifest.json +0 -17
- package/plugins/provider-claude/index.js +0 -1
- package/plugins/provider-claude/package-lock.json +0 -3398
- package/plugins/provider-claude/package.json +0 -39
- package/plugins/provider-claude/src/contribution.ts +0 -1018
- package/plugins/provider-claude/tsconfig.json +0 -19
- package/plugins/provider-claude-cli/dobby.manifest.json +0 -17
- package/plugins/provider-claude-cli/index.js +0 -1
- package/plugins/provider-claude-cli/package-lock.json +0 -2898
- package/plugins/provider-claude-cli/package.json +0 -38
- package/plugins/provider-claude-cli/src/contribution.ts +0 -1673
- package/plugins/provider-claude-cli/tsconfig.json +0 -19
- package/plugins/provider-pi/dobby.manifest.json +0 -17
- package/plugins/provider-pi/index.js +0 -1
- package/plugins/provider-pi/package-lock.json +0 -3877
- package/plugins/provider-pi/package.json +0 -40
- package/plugins/provider-pi/src/contribution.ts +0 -606
- package/plugins/provider-pi/tsconfig.json +0 -19
- package/plugins/sandbox-core/boxlite.js +0 -1
- package/plugins/sandbox-core/dobby.manifest.json +0 -17
- package/plugins/sandbox-core/docker.js +0 -1
- package/plugins/sandbox-core/package-lock.json +0 -136
- package/plugins/sandbox-core/package.json +0 -39
- package/plugins/sandbox-core/src/boxlite-context.ts +0 -2
- package/plugins/sandbox-core/src/boxlite-contribution.ts +0 -53
- package/plugins/sandbox-core/src/boxlite-executor.ts +0 -911
- package/plugins/sandbox-core/src/docker-contribution.ts +0 -43
- package/plugins/sandbox-core/src/docker-executor.ts +0 -217
- package/plugins/sandbox-core/tsconfig.json +0 -19
- package/scripts/local-extensions.mjs +0 -168
- package/src/agent/event-forwarder.ts +0 -414
- package/src/cli/commands/config.ts +0 -328
- package/src/cli/commands/configure.ts +0 -92
- package/src/cli/commands/cron.ts +0 -410
- package/src/cli/commands/doctor.ts +0 -331
- package/src/cli/commands/extension.ts +0 -207
- package/src/cli/commands/init.ts +0 -211
- package/src/cli/commands/start.ts +0 -223
- package/src/cli/commands/topology.ts +0 -415
- package/src/cli/index.ts +0 -9
- package/src/cli/program.ts +0 -314
- package/src/cli/shared/config-io.ts +0 -245
- package/src/cli/shared/config-mutators.ts +0 -470
- package/src/cli/shared/config-schema.ts +0 -228
- package/src/cli/shared/config-types.ts +0 -129
- package/src/cli/shared/configure-sections.ts +0 -595
- package/src/cli/shared/discord-config.ts +0 -14
- package/src/cli/shared/init-catalog.ts +0 -249
- package/src/cli/shared/local-extension-specs.ts +0 -108
- package/src/cli/shared/runtime.ts +0 -33
- package/src/cli/shared/schema-prompts.ts +0 -443
- package/src/cli/tests/config-command.test.ts +0 -56
- package/src/cli/tests/config-io.test.ts +0 -92
- package/src/cli/tests/config-mutators.test.ts +0 -59
- package/src/cli/tests/discord-mapper.test.ts +0 -128
- package/src/cli/tests/doctor.test.ts +0 -269
- package/src/cli/tests/init-catalog.test.ts +0 -144
- package/src/cli/tests/program-options.test.ts +0 -95
- package/src/cli/tests/routing-config.test.ts +0 -281
- package/src/core/control-command.ts +0 -12
- package/src/core/dedup-store.ts +0 -103
- package/src/core/gateway.ts +0 -609
- package/src/core/routing.ts +0 -404
- package/src/core/runtime-registry.ts +0 -141
- package/src/core/tests/control-command.test.ts +0 -20
- package/src/core/tests/runtime-registry.test.ts +0 -140
- package/src/core/tests/typing-controller.test.ts +0 -129
- package/src/core/types.ts +0 -324
- package/src/core/typing-controller.ts +0 -119
- package/src/cron/config.ts +0 -154
- package/src/cron/schedule.ts +0 -61
- package/src/cron/service.ts +0 -249
- package/src/cron/store.ts +0 -155
- package/src/cron/types.ts +0 -60
- package/src/extension/loader.ts +0 -145
- package/src/extension/manager.ts +0 -355
- package/src/extension/manifest.ts +0 -26
- package/src/extension/registry.ts +0 -229
- package/src/main.ts +0 -8
- package/src/sandbox/executor.ts +0 -44
- package/src/sandbox/host-executor.ts +0 -118
- package/src/shared/dobby-repo.ts +0 -48
- package/tsconfig.json +0 -18
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { spawn } from "node:child_process";
|
|
2
|
-
import type { GatewayLogger } from "../core/types.js";
|
|
3
|
-
import type { ExecOptions, ExecResult, Executor, SpawnOptions, SpawnedProcess } from "./executor.js";
|
|
4
|
-
|
|
5
|
-
function shellEscape(value: string): string {
|
|
6
|
-
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export class HostExecutor implements Executor {
|
|
10
|
-
constructor(private readonly logger: GatewayLogger) {}
|
|
11
|
-
|
|
12
|
-
async exec(command: string, cwd: string, options: ExecOptions = {}): Promise<ExecResult> {
|
|
13
|
-
const wrapped = `cd ${shellEscape(cwd)} && ${command}`;
|
|
14
|
-
|
|
15
|
-
return new Promise<ExecResult>((resolve, reject) => {
|
|
16
|
-
const child = spawn("sh", ["-lc", wrapped], {
|
|
17
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
18
|
-
env: options.env ?? process.env,
|
|
19
|
-
detached: true,
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
let stdout = "";
|
|
23
|
-
let stderr = "";
|
|
24
|
-
let killed = false;
|
|
25
|
-
|
|
26
|
-
const onAbort = () => {
|
|
27
|
-
killed = true;
|
|
28
|
-
if (child.pid) {
|
|
29
|
-
try {
|
|
30
|
-
process.kill(-child.pid, "SIGKILL");
|
|
31
|
-
} catch {
|
|
32
|
-
try {
|
|
33
|
-
process.kill(child.pid, "SIGKILL");
|
|
34
|
-
} catch {
|
|
35
|
-
// Process already exited.
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
let timeoutHandle: NodeJS.Timeout | undefined;
|
|
42
|
-
if (options.timeoutSeconds && options.timeoutSeconds > 0) {
|
|
43
|
-
timeoutHandle = setTimeout(onAbort, options.timeoutSeconds * 1000);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (options.signal) {
|
|
47
|
-
if (options.signal.aborted) {
|
|
48
|
-
onAbort();
|
|
49
|
-
} else {
|
|
50
|
-
options.signal.addEventListener("abort", onAbort, { once: true });
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
child.stdout.on("data", (chunk) => {
|
|
55
|
-
stdout += String(chunk);
|
|
56
|
-
});
|
|
57
|
-
child.stderr.on("data", (chunk) => {
|
|
58
|
-
stderr += String(chunk);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
child.on("error", (error) => {
|
|
62
|
-
if (timeoutHandle) clearTimeout(timeoutHandle);
|
|
63
|
-
if (options.signal) options.signal.removeEventListener("abort", onAbort);
|
|
64
|
-
reject(error);
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
child.on("close", (code) => {
|
|
68
|
-
if (timeoutHandle) clearTimeout(timeoutHandle);
|
|
69
|
-
if (options.signal) options.signal.removeEventListener("abort", onAbort);
|
|
70
|
-
resolve({ stdout, stderr, code: code ?? 0, killed });
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
spawn(options: SpawnOptions): SpawnedProcess {
|
|
76
|
-
const cwd = options.cwd;
|
|
77
|
-
const child = spawn(options.command, options.args, {
|
|
78
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
79
|
-
...(cwd ? { cwd } : {}),
|
|
80
|
-
env: options.env ?? process.env,
|
|
81
|
-
detached: true,
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
const onAbort = () => {
|
|
85
|
-
if (child.pid) {
|
|
86
|
-
try {
|
|
87
|
-
process.kill(-child.pid, "SIGKILL");
|
|
88
|
-
return;
|
|
89
|
-
} catch {
|
|
90
|
-
// Fall through to direct child kill.
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
child.kill("SIGKILL");
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
if (options.signal) {
|
|
97
|
-
if (options.signal.aborted) {
|
|
98
|
-
onAbort();
|
|
99
|
-
} else {
|
|
100
|
-
options.signal.addEventListener("abort", onAbort, { once: true });
|
|
101
|
-
child.once("exit", () => {
|
|
102
|
-
options.signal?.removeEventListener("abort", onAbort);
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (!child.stdin || !child.stdout || !child.stderr) {
|
|
108
|
-
child.kill("SIGKILL");
|
|
109
|
-
throw new Error("Host executor failed to create stdio pipes for spawned process");
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return child as unknown as SpawnedProcess;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
async close(): Promise<void> {
|
|
116
|
-
this.logger.debug("HostExecutor closed");
|
|
117
|
-
}
|
|
118
|
-
}
|
package/src/shared/dobby-repo.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
-
import { dirname, resolve } from "node:path";
|
|
3
|
-
|
|
4
|
-
const DOBBY_REPO_PACKAGE_NAMES = new Set(["dobby", "@dobby.ai/dobby"]);
|
|
5
|
-
|
|
6
|
-
function readPackageName(candidateDir: string): string | undefined {
|
|
7
|
-
const packageJsonPath = resolve(candidateDir, "package.json");
|
|
8
|
-
if (!existsSync(packageJsonPath)) {
|
|
9
|
-
return undefined;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
try {
|
|
13
|
-
const packageJsonRaw = readFileSync(packageJsonPath, "utf-8");
|
|
14
|
-
const parsed = JSON.parse(packageJsonRaw) as { name?: unknown };
|
|
15
|
-
return typeof parsed.name === "string" ? parsed.name : undefined;
|
|
16
|
-
} catch {
|
|
17
|
-
return undefined;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function isDobbyRepoRoot(candidateDir: string): boolean {
|
|
22
|
-
const repoConfigPath = resolve(candidateDir, "config", "gateway.json");
|
|
23
|
-
const repoConfigExamplePath = resolve(candidateDir, "config", "gateway.example.json");
|
|
24
|
-
const localExtensionsScriptPath = resolve(candidateDir, "scripts", "local-extensions.mjs");
|
|
25
|
-
|
|
26
|
-
if ((!existsSync(repoConfigPath) && !existsSync(repoConfigExamplePath)) || !existsSync(localExtensionsScriptPath)) {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const packageName = readPackageName(candidateDir);
|
|
31
|
-
return packageName !== undefined && DOBBY_REPO_PACKAGE_NAMES.has(packageName);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function findDobbyRepoRoot(startDir: string): string | null {
|
|
35
|
-
let currentDir = resolve(startDir);
|
|
36
|
-
|
|
37
|
-
while (true) {
|
|
38
|
-
if (isDobbyRepoRoot(currentDir)) {
|
|
39
|
-
return currentDir;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const parentDir = dirname(currentDir);
|
|
43
|
-
if (parentDir === currentDir) {
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
currentDir = parentDir;
|
|
47
|
-
}
|
|
48
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "NodeNext",
|
|
5
|
-
"moduleResolution": "NodeNext",
|
|
6
|
-
"outDir": "dist",
|
|
7
|
-
"rootDir": ".",
|
|
8
|
-
"strict": true,
|
|
9
|
-
"esModuleInterop": true,
|
|
10
|
-
"forceConsistentCasingInFileNames": true,
|
|
11
|
-
"skipLibCheck": true,
|
|
12
|
-
"noUncheckedIndexedAccess": true,
|
|
13
|
-
"exactOptionalPropertyTypes": true,
|
|
14
|
-
"resolveJsonModule": true
|
|
15
|
-
},
|
|
16
|
-
"include": ["src/**/*.ts"],
|
|
17
|
-
"exclude": ["dist", "node_modules"]
|
|
18
|
-
}
|