Compare commits
3 Commits
main
...
fix/extens
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
80facc5144 | ||
|
|
857cb27f13 | ||
|
|
e39e258d0c |
@ -1,6 +1,6 @@
|
|||||||
|
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
|
||||||
|
import type { DirectoryConfigParams } from "openclaw/plugin-sdk/directory-runtime";
|
||||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
import type { OpenClawConfig } from "../../../src/config/config.js";
|
|
||||||
import type { DirectoryConfigParams } from "../../../src/plugin-sdk/directory-runtime.js";
|
|
||||||
import { listDiscordDirectoryGroupsLive, listDiscordDirectoryPeersLive } from "./directory-live.js";
|
import { listDiscordDirectoryGroupsLive, listDiscordDirectoryPeersLive } from "./directory-live.js";
|
||||||
|
|
||||||
function makeParams(overrides: Partial<DirectoryConfigParams> = {}): DirectoryConfigParams {
|
function makeParams(overrides: Partial<DirectoryConfigParams> = {}): DirectoryConfigParams {
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import { createNonExitingRuntime } from "openclaw/plugin-sdk/runtime-env";
|
||||||
import type { OpenClawConfig } from "openclaw/plugin-sdk/slack";
|
import type { OpenClawConfig } from "openclaw/plugin-sdk/slack";
|
||||||
import { describe, expect, it, vi } from "vitest";
|
import { describe, expect, it, vi } from "vitest";
|
||||||
import { slackOutbound } from "./outbound-adapter.js";
|
import { slackOutbound } from "./outbound-adapter.js";
|
||||||
@ -16,6 +17,8 @@ vi.mock("./runtime.js", () => ({
|
|||||||
|
|
||||||
import { slackPlugin } from "./channel.js";
|
import { slackPlugin } from "./channel.js";
|
||||||
|
|
||||||
|
const runtime = createNonExitingRuntime();
|
||||||
|
|
||||||
async function getSlackConfiguredState(cfg: OpenClawConfig) {
|
async function getSlackConfiguredState(cfg: OpenClawConfig) {
|
||||||
const account = slackPlugin.config.resolveAccount(cfg, "default");
|
const account = slackPlugin.config.resolveAccount(cfg, "default");
|
||||||
return {
|
return {
|
||||||
@ -261,7 +264,7 @@ describe("slackPlugin directory", () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
runtime: undefined,
|
runtime,
|
||||||
}),
|
}),
|
||||||
).resolves.toEqual([{ id: "user:u123", kind: "user" }]);
|
).resolves.toEqual([{ id: "user:u123", kind: "user" }]);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -94,6 +94,10 @@
|
|||||||
"types": "./dist/plugin-sdk/reply-runtime.d.ts",
|
"types": "./dist/plugin-sdk/reply-runtime.d.ts",
|
||||||
"default": "./dist/plugin-sdk/reply-runtime.js"
|
"default": "./dist/plugin-sdk/reply-runtime.js"
|
||||||
},
|
},
|
||||||
|
"./plugin-sdk/reply-payload": {
|
||||||
|
"types": "./dist/plugin-sdk/reply-payload.d.ts",
|
||||||
|
"default": "./dist/plugin-sdk/reply-payload.js"
|
||||||
|
},
|
||||||
"./plugin-sdk/channel-runtime": {
|
"./plugin-sdk/channel-runtime": {
|
||||||
"types": "./dist/plugin-sdk/channel-runtime.d.ts",
|
"types": "./dist/plugin-sdk/channel-runtime.d.ts",
|
||||||
"default": "./dist/plugin-sdk/channel-runtime.js"
|
"default": "./dist/plugin-sdk/channel-runtime.js"
|
||||||
@ -394,6 +398,10 @@
|
|||||||
"types": "./dist/plugin-sdk/channel-policy.d.ts",
|
"types": "./dist/plugin-sdk/channel-policy.d.ts",
|
||||||
"default": "./dist/plugin-sdk/channel-policy.js"
|
"default": "./dist/plugin-sdk/channel-policy.js"
|
||||||
},
|
},
|
||||||
|
"./plugin-sdk/channel-send-result": {
|
||||||
|
"types": "./dist/plugin-sdk/channel-send-result.d.ts",
|
||||||
|
"default": "./dist/plugin-sdk/channel-send-result.js"
|
||||||
|
},
|
||||||
"./plugin-sdk/group-access": {
|
"./plugin-sdk/group-access": {
|
||||||
"types": "./dist/plugin-sdk/group-access.d.ts",
|
"types": "./dist/plugin-sdk/group-access.d.ts",
|
||||||
"default": "./dist/plugin-sdk/group-access.js"
|
"default": "./dist/plugin-sdk/group-access.js"
|
||||||
|
|||||||
@ -25,6 +25,30 @@ function normalizePath(filePath) {
|
|||||||
return path.relative(repoRoot, filePath).split(path.sep).join("/");
|
return path.relative(repoRoot, filePath).split(path.sep).join("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function readDefaultTsconfigFiles() {
|
||||||
|
const tsconfigPath = path.join(repoRoot, "tsconfig.json");
|
||||||
|
const readTsConfigFile = (filePath) => ts.sys.readFile(filePath);
|
||||||
|
const parsedConfig = ts.readConfigFile(tsconfigPath, readTsConfigFile);
|
||||||
|
if (parsedConfig.error) {
|
||||||
|
throw new Error(ts.flattenDiagnosticMessageText(parsedConfig.error.messageText, "\n"));
|
||||||
|
}
|
||||||
|
const resolvedConfig = ts.parseJsonConfigFileContent(
|
||||||
|
parsedConfig.config,
|
||||||
|
ts.sys,
|
||||||
|
repoRoot,
|
||||||
|
undefined,
|
||||||
|
tsconfigPath,
|
||||||
|
);
|
||||||
|
if (resolvedConfig.errors.length > 0) {
|
||||||
|
throw new Error(
|
||||||
|
resolvedConfig.errors
|
||||||
|
.map((error) => ts.flattenDiagnosticMessageText(error.messageText, "\n"))
|
||||||
|
.join("\n"),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return new Set(resolvedConfig.fileNames.map((fileName) => normalizePath(fileName)));
|
||||||
|
}
|
||||||
|
|
||||||
function isCodeFile(fileName) {
|
function isCodeFile(fileName) {
|
||||||
return /\.(ts|tsx|mts|cts|js|jsx|mjs|cjs)$/.test(fileName);
|
return /\.(ts|tsx|mts|cts|js|jsx|mjs|cjs)$/.test(fileName);
|
||||||
}
|
}
|
||||||
@ -337,8 +361,30 @@ function packageClusterMeta(relativePackagePath) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function workspaceSourcePrefix(relativePackagePath) {
|
||||||
|
if (relativePackagePath === "ui/package.json") {
|
||||||
|
return "ui/";
|
||||||
|
}
|
||||||
|
const cluster = relativePackagePath.split("/")[1];
|
||||||
|
return `extensions/${cluster}/`;
|
||||||
|
}
|
||||||
|
|
||||||
function classifyMissingPackageCluster(params) {
|
function classifyMissingPackageCluster(params) {
|
||||||
if (optionalBundledClusterSet.has(params.cluster)) {
|
if (optionalBundledClusterSet.has(params.cluster)) {
|
||||||
|
if (!params.defaultGraphReachable) {
|
||||||
|
if (params.cluster === "ui") {
|
||||||
|
return {
|
||||||
|
decision: "optional",
|
||||||
|
reason:
|
||||||
|
"Private UI workspace is excluded from the default tsconfig graph, so repo-wide check/build does not require UI-only packages by default.",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
decision: "optional",
|
||||||
|
reason:
|
||||||
|
"Workspace package is excluded from the default tsconfig graph, so repo-wide check/build does not require its plugin-local dependencies by default.",
|
||||||
|
};
|
||||||
|
}
|
||||||
if (params.cluster === "ui") {
|
if (params.cluster === "ui") {
|
||||||
return {
|
return {
|
||||||
decision: "optional",
|
decision: "optional",
|
||||||
@ -375,6 +421,7 @@ async function buildMissingPackages() {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
const pluginSdkEntrySources = await walkCodeFiles(path.join(repoRoot, "src", "plugin-sdk"));
|
const pluginSdkEntrySources = await walkCodeFiles(path.join(repoRoot, "src", "plugin-sdk"));
|
||||||
|
const defaultTsconfigFiles = readDefaultTsconfigFiles();
|
||||||
const pluginSdkReachability = new Map();
|
const pluginSdkReachability = new Map();
|
||||||
for (const filePath of pluginSdkEntrySources) {
|
for (const filePath of pluginSdkEntrySources) {
|
||||||
const source = await fs.readFile(filePath, "utf8");
|
const source = await fs.readFile(filePath, "utf8");
|
||||||
@ -403,6 +450,9 @@ async function buildMissingPackages() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const meta = packageClusterMeta(relativePackagePath);
|
const meta = packageClusterMeta(relativePackagePath);
|
||||||
|
const defaultGraphIncludedFileCount = [...defaultTsconfigFiles].filter((filePath) =>
|
||||||
|
filePath.startsWith(workspaceSourcePrefix(relativePackagePath)),
|
||||||
|
).length;
|
||||||
const rootDependencyMirrorAllowlist = (
|
const rootDependencyMirrorAllowlist = (
|
||||||
pkg.openclaw?.releaseChecks?.rootDependencyMirrorAllowlist ?? []
|
pkg.openclaw?.releaseChecks?.rootDependencyMirrorAllowlist ?? []
|
||||||
).toSorted(compareStrings);
|
).toSorted(compareStrings);
|
||||||
@ -411,12 +461,15 @@ async function buildMissingPackages() {
|
|||||||
);
|
);
|
||||||
const classification = classifyMissingPackageCluster({
|
const classification = classifyMissingPackageCluster({
|
||||||
cluster: meta.cluster,
|
cluster: meta.cluster,
|
||||||
|
defaultGraphReachable: defaultGraphIncludedFileCount > 0,
|
||||||
pluginSdkEntries,
|
pluginSdkEntries,
|
||||||
});
|
});
|
||||||
output.push({
|
output.push({
|
||||||
cluster: meta.cluster,
|
cluster: meta.cluster,
|
||||||
decision: classification.decision,
|
decision: classification.decision,
|
||||||
decisionReason: classification.reason,
|
decisionReason: classification.reason,
|
||||||
|
defaultGraphIncludedFileCount,
|
||||||
|
defaultGraphStatus: defaultGraphIncludedFileCount > 0 ? "included" : "excluded",
|
||||||
packageName: pkg.name ?? meta.packageName,
|
packageName: pkg.name ?? meta.packageName,
|
||||||
packagePath: relativePackagePath,
|
packagePath: relativePackagePath,
|
||||||
npmSpec: pkg.openclaw?.install?.npmSpec ?? null,
|
npmSpec: pkg.openclaw?.install?.npmSpec ?? null,
|
||||||
|
|||||||
@ -23,6 +23,21 @@
|
|||||||
"openclaw/plugin-sdk/account-id": ["./src/plugin-sdk/account-id.ts"]
|
"openclaw/plugin-sdk/account-id": ["./src/plugin-sdk/account-id.ts"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": ["src/**/*", "ui/**/*", "extensions/**/*"],
|
"include": ["src/**/*", "extensions/**/*"],
|
||||||
"exclude": ["node_modules", "dist"]
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"dist",
|
||||||
|
"ui",
|
||||||
|
"extensions/acpx",
|
||||||
|
"extensions/diagnostics-otel",
|
||||||
|
"extensions/diffs",
|
||||||
|
"extensions/googlechat",
|
||||||
|
"extensions/matrix",
|
||||||
|
"extensions/memory-lancedb",
|
||||||
|
"extensions/msteams",
|
||||||
|
"extensions/nostr",
|
||||||
|
"extensions/tlon",
|
||||||
|
"extensions/twitch",
|
||||||
|
"extensions/zalouser"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user