fix(plugin-sdk): preserve absolute plugin entrypoints (#1323)

Authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
Ryanba
2026-03-15 01:57:07 +08:00
committed by GitHub
parent c702c1f8e5
commit aac7a31599
2 changed files with 18 additions and 2 deletions
@@ -116,6 +116,22 @@ describe('for FileSystemPluginHost', () => {
})).toBe('/tmp/plugin/electron-entry.ts')
})
it('should preserve absolute runtime entrypoints', () => {
const host = new FileSystemLoader()
expect(host.resolveEntrypointFor({
apiVersion: 'v1',
kind: 'manifest.plugin.airi.moeru.ai',
name: 'test-plugin',
entrypoints: {
node: '/opt/plugins/entry.ts',
},
}, {
cwd: '/tmp/plugin',
runtime: 'node',
})).toBe('/opt/plugins/entry.ts')
})
it('should throw deterministic error when no runtime entrypoint exists', () => {
const host = new FileSystemLoader()
+2 -2
View File
@@ -13,7 +13,7 @@ import type { CapabilityDescriptor } from '../plugin/apis/protocol'
import type { Plugin } from '../plugin/shared'
import type { PluginTransport } from './transports'
import { join } from 'node:path'
import { isAbsolute, join } from 'node:path'
import { cwd } from 'node:process'
import { defineInvokeHandler } from '@moeru/eventa'
@@ -1080,7 +1080,7 @@ export class FileSystemLoader {
)
}
return join(root, entrypoint)
return isAbsolute(entrypoint) ? entrypoint : join(root, entrypoint)
}
/**