fix(plugin-sdk): preserve absolute plugin entrypoints (#1323)
Authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user