Skip to content

Commit 32e242e

Browse files
author
raidendotai
committed
ts-cua: lint & openai types update *
1 parent 3031c96 commit 32e242e

File tree

5 files changed

+19
-27
lines changed

5 files changed

+19
-27
lines changed

templates/typescript/cua/.eslintrc.cjs

Lines changed: 0 additions & 10 deletions
This file was deleted.

templates/typescript/cua/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface CuaOutput {
1414
}
1515

1616
const kernel = new Kernel();
17-
const app = kernel.app('ts-cua');
17+
const app = kernel.app('ts-cua-dev');
1818

1919
if (!process.env.OPENAI_API_KEY) {
2020
throw new Error('OPENAI_API_KEY is not set');
@@ -30,7 +30,7 @@ if (!process.env.OPENAI_API_KEY) {
3030
* Invoke this via CLI:
3131
* export KERNEL_API_KEY=<your_api_key>
3232
* kernel deploy index.ts -e OPENAI_API_KEY=XXXXX --force
33-
* kernel invoke ts-cua cua-task -p "{\"task\":\"go to ebay.com and find the current market price range for a dreamcast\"}"
33+
* kernel invoke ts-cua cua-task -p "{\"task\":\"current market price range for a used dreamcast\"}"
3434
* kernel logs ts-cua -f # Open in separate tab
3535
*/
3636

@@ -49,7 +49,7 @@ app.action<CuaInput, CuaOutput>(
4949
model: 'computer-use-preview',
5050
computer,
5151
tools: [],
52-
acknowledge_safety_check_callback: (m: string) => {
52+
acknowledge_safety_check_callback: (m: string): boolean => {
5353
console.log(`> safety check: ${m}`);
5454
return true;
5555
},

templates/typescript/cua/lib/agent.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export class Agent {
4141
this.model = opts.model ?? 'computer-use-preview';
4242
this.computer = opts.computer;
4343
this.tools = [...toolset.shared, ...(opts.tools ?? [])] as ComputerTool[];
44-
this.ackCb = opts.acknowledge_safety_check_callback ?? (() => true);
44+
this.ackCb = opts.acknowledge_safety_check_callback ?? ((): boolean => true);
4545

4646
if (this.computer) {
4747
const [w, h] = this.computer.getDimensions();
@@ -62,7 +62,7 @@ export class Agent {
6262
args.map((msg) => utils.sanitizeMessage(msg as ResponseItem)),
6363
{ depth: null },
6464
);
65-
} catch (e) {
65+
} catch {
6666
console.dir(args, { depth: null });
6767
}
6868
}

templates/typescript/cua/package.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
"type": "module",
33
"private": true,
44
"scripts": {
5-
"build": "tsc",
6-
"lint": "eslint . --ext .ts",
7-
"lint:fix": "eslint . --ext .ts --fix"
5+
"build": "tsc"
86
},
97
"dependencies": {
108
"@onkernel/sdk": "^0.6.0",
@@ -15,10 +13,6 @@
1513
},
1614
"devDependencies": {
1715
"@types/node": "^24.0.3",
18-
"@typescript-eslint/eslint-plugin": "^5.0.0",
19-
"@typescript-eslint/parser": "^5.0.0",
20-
"eslint": "^8.0.0",
21-
"eslint-config-prettier": "^8.8.0",
2216
"typescript": "^5.8.3"
2317
}
2418
}

templates/typescript/cua/test.local.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@ import computers from './lib/computers';
66
to run a local browser test before deploying to kernel
77
*/
88

9-
async function test() {
9+
async function test(): Promise<void> {
1010
const { computer } = await computers.create({ type: 'local' });
1111
const agent = new Agent({
1212
model: 'computer-use-preview',
1313
computer,
1414
tools: [],
15-
acknowledge_safety_check_callback: (m: string) => { console.log(`> safety check: ${m}`); return true; },
15+
acknowledge_safety_check_callback: (m: string): boolean => {
16+
console.log(`> safety check: ${m}`);
17+
return true;
18+
},
1619
});
1720

1821
// run agent and get response
@@ -22,13 +25,18 @@ async function test() {
2225
role: 'system',
2326
content: `- Current date and time: ${new Date().toISOString()} (${new Date().toLocaleDateString(
2427
'en-US',
25-
{ weekday: 'long' }
28+
{ weekday: 'long' },
2629
)})`,
2730
},
2831
{
2932
type: 'message',
3033
role: 'user',
31-
content: [{ type: 'input_text', text: "go to ebay.com and look up oberheim ob-x prices and give me a report" }],
34+
content: [
35+
{
36+
type: 'input_text',
37+
text: 'go to ebay.com and look up oberheim ob-x prices and give me a report',
38+
},
39+
],
3240
},
3341
],
3442
print_steps: true,
@@ -38,4 +46,4 @@ async function test() {
3846
console.dir(logs, { depth: null });
3947
}
4048

41-
test();
49+
test();

0 commit comments

Comments
 (0)