-
Notifications
You must be signed in to change notification settings - Fork 2
Branch remote runner plugin fixed #54
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
base: main
Are you sure you want to change the base?
Changes from all commits
fddcd14
bfcea05
d0883bd
04bb38f
e9a67bd
806e6c2
b713b50
75af89b
3c206eb
ec51966
549c5b3
90026d3
19fd917
3d467f1
de8bd92
08b2202
00bce74
a04d4be
2b1b555
5a62899
575669d
f979647
c318438
572ea84
5a257b0
764ee5b
a9f681f
960563e
cbfc00e
9121847
912589b
f3b30c0
f32084b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,24 +1,2 @@ | ||
| import { CHANNEL_ID, RUNNER_ID, type PySlangMessage } from "@sourceacademy/common-test"; | ||
| import type { IPlugin, IChannel, IConduit } from "@sourceacademy/conductor/conduit"; | ||
| import { EV3Engine } from "py-slang/src/engines/ev3/EV3Engine"; | ||
|
|
||
| export class remoteRunnerPlugin implements IPlugin { | ||
| readonly id: string = RUNNER_ID; | ||
| static readonly channelAttach = [CHANNEL_ID]; | ||
| private readonly __channel: IChannel<PySlangMessage>; | ||
| private readonly engine: EV3Engine; | ||
|
|
||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| constructor(_conduit: IConduit, [channel]: IChannel<any>[]) { | ||
| this.__channel = channel; | ||
| this.engine = new EV3Engine(); | ||
|
|
||
| this.__channel.subscribe(async message => { | ||
| if (message.type === "run") { | ||
| const result = await this.engine.execute(message.code); | ||
| console.log("Engine response:", result); | ||
| this.__channel.send({ type: "result", output: JSON.stringify(result) }); | ||
| } | ||
| }); | ||
| } | ||
| } | ||
| export { RemoteExecutionPlugin } from "./src"; | ||
| export type { ConnectionStatus, ConnectionStatusMessage } from "./src"; |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -22,20 +22,20 @@ | |||||||||||||||||||||||||||||||||||||
| "build": "rollup -c", | ||||||||||||||||||||||||||||||||||||||
| "prepack": "yarn build" | ||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||
| "dependencies": { | ||||||||||||||||||||||||||||||||||||||
| "py-slang": "github:proto-aiken-13/py-slang#branch-ev3-engine" | ||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||
| "peerDependencies": { | ||||||||||||||||||||||||||||||||||||||
| "@sourceacademy/conductor": ">=0.3.0" | ||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||
| "devDependencies": { | ||||||||||||||||||||||||||||||||||||||
| "@rollup/plugin-commonjs": "^29.0.3", | ||||||||||||||||||||||||||||||||||||||
| "@rollup/plugin-node-resolve": "^16.0.3", | ||||||||||||||||||||||||||||||||||||||
| "@rollup/plugin-terser": "^1.0.0", | ||||||||||||||||||||||||||||||||||||||
| "@rollup/plugin-typescript": "^12.3.0", | ||||||||||||||||||||||||||||||||||||||
| "@sourceacademy/common-test": "workspace:*", | ||||||||||||||||||||||||||||||||||||||
| "@sourceacademy/conductor": ">=0.3.0", | ||||||||||||||||||||||||||||||||||||||
| "@vitest/coverage-istanbul": "^4.1.9", | ||||||||||||||||||||||||||||||||||||||
| "rollup": "^4.60.2", | ||||||||||||||||||||||||||||||||||||||
| "esbuild": "^0.28.1", | ||||||||||||||||||||||||||||||||||||||
| "rollup": "^4.62.2", | ||||||||||||||||||||||||||||||||||||||
| "rollup-plugin-esbuild": "^6.2.1", | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+29
to
+38
Contributor
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. If the second rollup build target for the worker bundle is removed from
Suggested change
|
||||||||||||||||||||||||||||||||||||||
| "tslib": "^2.8.1", | ||||||||||||||||||||||||||||||||||||||
| "typescript": "^6.0.3", | ||||||||||||||||||||||||||||||||||||||
| "vitest": "^4.1.9" | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,25 @@ | ||
| export { remoteRunnerPlugin } from "../index"; | ||
| import { | ||
| CHANNEL_ID, | ||
| RUNNER_ID, | ||
| MESSAGE_TYPE_CONNECTION_STATUS, | ||
| type ConnectionStatusMessage, | ||
| type ConnectionStatus, | ||
| } from "@sourceacademy/common-remote-execution"; | ||
| import type { IPlugin, IChannel, IConduit } from "@sourceacademy/conductor/conduit"; | ||
|
|
||
| export class RemoteExecutionPlugin implements IPlugin { | ||
| readonly id: string = RUNNER_ID; | ||
| static readonly channelAttach = [CHANNEL_ID]; | ||
| private readonly __channel: IChannel<ConnectionStatusMessage>; | ||
|
|
||
| constructor(_conduit: IConduit, [channel]: IChannel<any>[]) { | ||
| if (!channel) { | ||
| throw new Error("Remote execution channel is required but was not provided."); | ||
| } | ||
| this.__channel = channel; | ||
| } | ||
|
|
||
| sendConnectionStatus(status: ConnectionStatus): void { | ||
| this.__channel.send({ type: MESSAGE_TYPE_CONNECTION_STATUS, status }); | ||
| } | ||
| } | ||
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 package imports from
@sourceacademy/common-remote-executioninsrc/runner/remoteExecution/src/index.ts, but this dependency is not declared inpackage.json(neither independenciesnorpeerDependencies). This will cause module resolution errors during build or runtime, especially in a monorepo environment with strict dependency resolution (like Yarn PnP). Please add@sourceacademy/common-remote-executiontopeerDependencies.