forked from openclaw/openclaw
-
Notifications
You must be signed in to change notification settings - Fork 19
release: fix packaged release-check workflow #124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| 900c26a9b060f1dfa712abfba877bd3bf9c7b0c9f2294faf9834038283ec24b6 config-baseline.json | ||
| d956a1d60f776bba712cb04374a4f5657cad95bb088b536c5e3e4e29d4a21328 config-baseline.core.json | ||
| ef83a06633fc001b5b2535566939186ecb49d05cd1a90b40e54cc58d3e6e44e3 config-baseline.channel.json | ||
| 5f5d4e850df6e9854a85b5d008236854ce185c707fdbb566efcf00f8c08b36e3 config-baseline.plugin.json | ||
| a877055a70d2089a7c823caf909b51e3c1e589dc62f4a5f82ff0457caed9c916 config-baseline.json | ||
| a3f1abce6515f78ae7f4100bb1c9d32c85729687bf7cb0f4142bfe54c8d5d167 config-baseline.core.json | ||
| 5a9d96d617732a6e93ef22259d0359c1e14c9b2f2624a6880639f7012fbedfcd config-baseline.channel.json | ||
| 77639c2fa47bfa62452779cd9286a1ec6fa95ef4f975b71abce3e4aac34005f4 config-baseline.plugin.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| 73091009a0a45c72eded8003fdf9cf4c10e9470c4a055592a98ea00d55cd45d1 plugin-sdk-api-baseline.json | ||
| 9c9d59ffc0b3b6677794cb8fd5afd0208dbc9f3cd1ad59b30ee627f6f6352929 plugin-sdk-api-baseline.jsonl | ||
| 9e1ab526b7683e8790ce6edc3ea4d90b4b73e30505849f73da63c7dd7804eaa3 plugin-sdk-api-baseline.json | ||
| 3d02b27553993312e83747bfe862db1d597aff8efea59352f5e5f84498c5d843 plugin-sdk-api-baseline.jsonl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| import { buildChannelConfigSchema, GoogleChatConfigSchema } from "openclaw/plugin-sdk/googlechat"; | ||
| import { | ||
| buildChannelConfigSchema, | ||
| GoogleChatConfigSchema, | ||
| } from "openclaw/plugin-sdk/channel-config-schema"; | ||
|
|
||
| export const GoogleChatChannelConfigSchema = buildChannelConfigSchema(GoogleChatConfigSchema); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // Keep bundled channel entry imports narrow so package discovery does not load | ||
| // the wider X runtime and onboarding graph just to read the entry contract. | ||
| export { xPlugin } from "./src/plugin.js"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import { describe, expect, it } from "vitest"; | ||
| import entry from "./index.js"; | ||
|
|
||
| describe("x bundled entries", () => { | ||
| it("declares the channel entry without importing the broad api barrel", () => { | ||
| expect(entry.kind).toBe("bundled-channel-entry"); | ||
| expect(entry.id).toBe("x"); | ||
| expect(entry.name).toBe("X (Twitter)"); | ||
| expect(typeof entry.loadChannelPlugin).toBe("function"); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,19 @@ | ||
| import type { OpenClawPluginApi } from "openclaw/plugin-sdk/core"; | ||
| import { emptyPluginConfigSchema } from "openclaw/plugin-sdk/core"; | ||
| import { xPlugin } from "./src/plugin.js"; | ||
| import { setXRuntime } from "./src/runtime.js"; | ||
| import { buildChannelConfigSchema } from "openclaw/plugin-sdk/channel-config-schema"; | ||
| import { defineBundledChannelEntry } from "openclaw/plugin-sdk/channel-entry-contract"; | ||
| import { XConfigSchema } from "./src/config-schema.js"; | ||
|
|
||
| const plugin = { | ||
| export default defineBundledChannelEntry({ | ||
| id: "x", | ||
| name: "X (Twitter)", | ||
| description: "X (Twitter) channel plugin - monitor mentions and reply to tweets", | ||
| configSchema: emptyPluginConfigSchema(), | ||
| register(api: OpenClawPluginApi) { | ||
| setXRuntime(api.runtime); | ||
| api.registerChannel({ plugin: xPlugin }); | ||
| description: "X (Twitter) channel plugin", | ||
| importMetaUrl: import.meta.url, | ||
| configSchema: buildChannelConfigSchema(XConfigSchema), | ||
| plugin: { | ||
| specifier: "./channel-plugin-api.js", | ||
| exportName: "xPlugin", | ||
| }, | ||
| }; | ||
|
|
||
| export default plugin; | ||
| runtime: { | ||
| specifier: "./runtime-api.js", | ||
| exportName: "setXRuntime", | ||
| }, | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // Keep runtime activation narrow so the bundled channel entry only imports the | ||
| // X runtime setter when the host actually initializes the plugin. | ||
| export { setXRuntime } from "./src/runtime.js"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,6 @@ let monolithicSdk = null; | |
| let diagnosticEventsModule = null; | ||
| const jitiLoaders = new Map(); | ||
| const pluginSdkSubpathsCache = new Map(); | ||
| const pluginSdkPackageNames = ["openclaw/plugin-sdk", "@openclaw/plugin-sdk"]; | ||
| const pluginSdkSourceExtensions = [".ts", ".mts", ".js", ".mjs", ".cts", ".cjs"]; | ||
| const isDistRootAlias = __filename.includes( | ||
| `${path.sep}dist${path.sep}plugin-sdk${path.sep}root-alias.cjs`, | ||
|
|
@@ -88,6 +87,22 @@ function getPackageRoot() { | |
| return path.resolve(__dirname, "..", ".."); | ||
| } | ||
|
|
||
| function listPluginSdkPackageNames() { | ||
| const packageNames = new Set(["openclaw/plugin-sdk", "@openclaw/plugin-sdk"]); | ||
| try { | ||
| const packageJson = JSON.parse( | ||
| fs.readFileSync(path.join(getPackageRoot(), "package.json"), "utf8"), | ||
| ); | ||
| const rootPackageName = typeof packageJson?.name === "string" ? packageJson.name.trim() : ""; | ||
| if (rootPackageName) { | ||
| packageNames.add(`${rootPackageName}/plugin-sdk`); | ||
| } | ||
| } catch { | ||
| // Keep the canonical aliases even if package.json is unavailable. | ||
| } | ||
| return [...packageNames]; | ||
| } | ||
|
Comment on lines
+90
to
+104
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Implement caching in |
||
|
|
||
| function findDistChunkByPrefix(prefix) { | ||
| const distRoot = path.join(getPackageRoot(), "dist"); | ||
| try { | ||
|
|
@@ -133,14 +148,14 @@ function buildPluginSdkAliasMap(useDist) { | |
| const normalizeTarget = (target) => | ||
| process.platform === "win32" ? target.replace(/\\/g, "/") : target; | ||
| const aliasMap = Object.fromEntries( | ||
| pluginSdkPackageNames.map((packageName) => [packageName, normalizeTarget(__filename)]), | ||
| listPluginSdkPackageNames().map((packageName) => [packageName, normalizeTarget(__filename)]), | ||
| ); | ||
|
|
||
| for (const subpath of listPluginSdkExportedSubpaths()) { | ||
| if (useDist) { | ||
| const candidate = path.join(pluginSdkDir, `${subpath}.js`); | ||
| if (fs.existsSync(candidate)) { | ||
| for (const packageName of pluginSdkPackageNames) { | ||
| for (const packageName of listPluginSdkPackageNames()) { | ||
| aliasMap[`${packageName}/${subpath}`] = normalizeTarget(candidate); | ||
| } | ||
| } | ||
|
|
@@ -151,7 +166,7 @@ function buildPluginSdkAliasMap(useDist) { | |
| if (!fs.existsSync(candidate)) { | ||
| continue; | ||
| } | ||
| for (const packageName of pluginSdkPackageNames) { | ||
| for (const packageName of listPluginSdkPackageNames()) { | ||
| aliasMap[`${packageName}/${subpath}`] = normalizeTarget(candidate); | ||
| } | ||
| break; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hardcoded
pluginSdkPackageNamesconstant was removed in favor of a dynamic lookup, but the new lookup functionlistPluginSdkPackageNamesis called repeatedly within loops inbuildPluginSdkAliasMap. Since it performs synchronous disk I/O to readpackage.json, this can significantly impact performance during plugin loading.I suggest adding a cache variable at the top level to store the resolved package names.