refactor(reply): clarify explicit reply tags in off mode (#16189)
* refactor(reply): clarify explicit reply tags in off mode * fix(plugin-sdk): alias account-id subpath for extensions
This commit is contained in:
committed by
GitHub
parent
6f7d31c426
commit
ef70a55b7a
@@ -74,6 +74,37 @@ const resolvePluginSdkAlias = (): string | null => {
|
||||
return null;
|
||||
};
|
||||
|
||||
const resolvePluginSdkAccountIdAlias = (): string | null => {
|
||||
try {
|
||||
const modulePath = fileURLToPath(import.meta.url);
|
||||
const isProduction = process.env.NODE_ENV === "production";
|
||||
const isTest = process.env.VITEST || process.env.NODE_ENV === "test";
|
||||
let cursor = path.dirname(modulePath);
|
||||
for (let i = 0; i < 6; i += 1) {
|
||||
const srcCandidate = path.join(cursor, "src", "plugin-sdk", "account-id.ts");
|
||||
const distCandidate = path.join(cursor, "dist", "plugin-sdk", "account-id.js");
|
||||
const orderedCandidates = isProduction
|
||||
? isTest
|
||||
? [distCandidate, srcCandidate]
|
||||
: [distCandidate]
|
||||
: [srcCandidate, distCandidate];
|
||||
for (const candidate of orderedCandidates) {
|
||||
if (fs.existsSync(candidate)) {
|
||||
return candidate;
|
||||
}
|
||||
}
|
||||
const parent = path.dirname(cursor);
|
||||
if (parent === cursor) {
|
||||
break;
|
||||
}
|
||||
cursor = parent;
|
||||
}
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
function buildCacheKey(params: {
|
||||
workspaceDir?: string;
|
||||
plugins: NormalizedPluginsConfig;
|
||||
@@ -211,12 +242,18 @@ export function loadOpenClawPlugins(options: PluginLoadOptions = {}): PluginRegi
|
||||
pushDiagnostics(registry.diagnostics, manifestRegistry.diagnostics);
|
||||
|
||||
const pluginSdkAlias = resolvePluginSdkAlias();
|
||||
const pluginSdkAccountIdAlias = resolvePluginSdkAccountIdAlias();
|
||||
const jiti = createJiti(import.meta.url, {
|
||||
interopDefault: true,
|
||||
extensions: [".ts", ".tsx", ".mts", ".cts", ".mtsx", ".ctsx", ".js", ".mjs", ".cjs", ".json"],
|
||||
...(pluginSdkAlias
|
||||
...(pluginSdkAlias || pluginSdkAccountIdAlias
|
||||
? {
|
||||
alias: { "openclaw/plugin-sdk": pluginSdkAlias },
|
||||
alias: {
|
||||
...(pluginSdkAlias ? { "openclaw/plugin-sdk": pluginSdkAlias } : {}),
|
||||
...(pluginSdkAccountIdAlias
|
||||
? { "openclaw/plugin-sdk/account-id": pluginSdkAccountIdAlias }
|
||||
: {}),
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user