From ae7d93adc4d4741d3e33339dac81cc484dca903f Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 27 Mar 2026 20:30:27 +0000 Subject: [PATCH] fix(ci): restore green check after upstream API changes --- extensions/line/src/setup-surface.test.ts | 122 +++------------------- src/agents/skills/source.ts | 2 +- 2 files changed, 18 insertions(+), 106 deletions(-) diff --git a/extensions/line/src/setup-surface.test.ts b/extensions/line/src/setup-surface.test.ts index 09e3be0e753..8cafb2877d3 100644 --- a/extensions/line/src/setup-surface.test.ts +++ b/extensions/line/src/setup-surface.test.ts @@ -88,101 +88,6 @@ function collectModuleExportNames(filePath: string): string[] { return Array.from(names).toSorted(); } -function collectRuntimeApiOverlapExports(params: { - lineRuntimePath: string; - runtimeApiPath: string; -}): string[] { - const runtimeApiSource = readFileSync(params.runtimeApiPath, "utf8"); - const runtimeApiFile = ts.createSourceFile( - params.runtimeApiPath, - runtimeApiSource, - ts.ScriptTarget.Latest, - true, - ); - const runtimeApiLocalModules = new Set(); - let pluginSdkLineRuntimeSeen = false; - - for (const statement of runtimeApiFile.statements) { - if (!ts.isExportDeclaration(statement)) { - continue; - } - const moduleSpecifier = - statement.moduleSpecifier && ts.isStringLiteral(statement.moduleSpecifier) - ? statement.moduleSpecifier.text - : undefined; - if (!moduleSpecifier) { - continue; - } - if (moduleSpecifier === "openclaw/plugin-sdk/line-runtime") { - pluginSdkLineRuntimeSeen = true; - continue; - } - if (!pluginSdkLineRuntimeSeen) { - continue; - } - const normalized = normalizeModuleSpecifier(moduleSpecifier); - if (normalized) { - runtimeApiLocalModules.add(normalized); - } - } - - const lineRuntimeSource = readFileSync(params.lineRuntimePath, "utf8"); - const lineRuntimeFile = ts.createSourceFile( - params.lineRuntimePath, - lineRuntimeSource, - ts.ScriptTarget.Latest, - true, - ); - const overlapExports = new Set(); - - for (const statement of lineRuntimeFile.statements) { - if (!ts.isExportDeclaration(statement)) { - continue; - } - const moduleSpecifier = - statement.moduleSpecifier && ts.isStringLiteral(statement.moduleSpecifier) - ? statement.moduleSpecifier.text - : undefined; - if ( - moduleSpecifier === "../../extensions/line/runtime-api.js" && - statement.exportClause && - ts.isNamedExports(statement.exportClause) - ) { - for (const element of statement.exportClause.elements) { - if (!element.isTypeOnly) { - overlapExports.add(element.name.text); - } - } - continue; - } - const normalized = moduleSpecifier ? normalizeModuleSpecifier(moduleSpecifier) : null; - if (!normalized || !runtimeApiLocalModules.has(normalized)) { - continue; - } - - if (!statement.exportClause) { - for (const name of collectModuleExportNames( - path.join(process.cwd(), "extensions", "line", normalized), - )) { - overlapExports.add(name); - } - continue; - } - - if (!ts.isNamedExports(statement.exportClause)) { - continue; - } - - for (const element of statement.exportClause.elements) { - if (!element.isTypeOnly) { - overlapExports.add(element.name.text); - } - } - } - - return Array.from(overlapExports).toSorted(); -} - function collectRuntimeApiPreExports(runtimeApiPath: string): string[] { const runtimeApiSource = readFileSync(runtimeApiPath, "utf8"); const runtimeApiFile = ts.createSourceFile( @@ -210,9 +115,23 @@ function collectRuntimeApiPreExports(runtimeApiPath: string): string[] { break; } const normalized = normalizeModuleSpecifier(moduleSpecifier); - if (!normalized || !statement.exportClause || !ts.isNamedExports(statement.exportClause)) { + if (!normalized) { continue; } + + if (!statement.exportClause) { + for (const name of collectModuleExportNames( + path.join(process.cwd(), "extensions", "line", normalized), + )) { + preExports.add(name); + } + continue; + } + + if (!ts.isNamedExports(statement.exportClause)) { + continue; + } + for (const element of statement.exportClause.elements) { if (!element.isTypeOnly) { preExports.add(element.name.text); @@ -323,16 +242,9 @@ describe("line runtime api", () => { }); }, 240_000); - it("keeps the LINE pre-export block aligned with plugin-sdk/line-runtime overlap", () => { + it("keeps the LINE runtime barrel self-contained ahead of the plugin-sdk facade", () => { const runtimeApiPath = path.join(process.cwd(), "extensions", "line", "runtime-api.ts"); - const lineRuntimePath = path.join(process.cwd(), "src", "plugin-sdk", "line-runtime.ts"); - - expect(collectRuntimeApiPreExports(runtimeApiPath)).toEqual( - collectRuntimeApiOverlapExports({ - lineRuntimePath, - runtimeApiPath, - }), - ); + expect(collectRuntimeApiPreExports(runtimeApiPath)).toEqual([]); }); }); diff --git a/src/agents/skills/source.ts b/src/agents/skills/source.ts index 076c10bb8ec..5db39e3d440 100644 --- a/src/agents/skills/source.ts +++ b/src/agents/skills/source.ts @@ -1,5 +1,5 @@ import type { Skill } from "@mariozechner/pi-coding-agent"; export function resolveSkillSource(skill: Skill): string { - return skill.source; + return skill.sourceInfo.source; }