dev: puterjs exec module

This commit is contained in:
KernelDeimos 2025-01-29 13:57:50 -05:00
parent 77d6bb2d8c
commit cbe02a4489
3 changed files with 18 additions and 10 deletions

View File

@ -44,17 +44,22 @@ class Judge0Client {
path = `/${path}`;
}
const resp = await axios.request({
method: 'POST',
url: `${this.baseURL}${path}`,
headers: {
Authorization: `Bearer ${this.token}`,
'Content-Type': 'application/json',
},
data,
});
try {
const resp = await axios.request({
method: 'POST',
url: `${this.baseURL}${path}`,
headers: {
Authorization: `Bearer ${this.token}`,
'Content-Type': 'application/json',
},
data,
});
return resp.data;
return resp.data;
} catch (e) {
console.error('error response', e.response.data);
throw e;
}
}
}

View File

@ -216,6 +216,7 @@ class DriverService extends BaseService {
['puter-tts']: 'aws-polly',
['puter-chat-completion']: 'openai-completion',
['puter-image-generation']: 'openai-image-generation',
'puter-exec': 'judge0',
'puter-apps': 'es:app',
'puter-subdomains': 'es:subdomain',
'puter-notifications': 'es:notification',

View File

@ -23,6 +23,7 @@ import { PSocket, wispInfo } from './modules/networking/PSocket.js';
import { PTLSSocket } from "./modules/networking/PTLS.js"
import { PWispHandler } from './modules/networking/PWispHandler.js';
import { make_http_api } from './lib/http.js';
import Exec from './modules/Exec.js';
// TODO: This is for a safe-guard below; we should check if we can
// generalize this behavior rather than hard-coding it.
@ -98,6 +99,7 @@ window.puter = (function() {
this.registerModule('kv', KV);
this.registerModule('drivers', Drivers);
this.registerModule('debug', Debug);
this.registerModule('exec', Exec);
// Path
this.path = path;