Skip to content

Commit 9dd2d10

Browse files
authored
Fix action command handler with no parameters (#640)
Also fix the test script that should call test:local in package.json
1 parent b7aacdd commit 9dd2d10

File tree

15 files changed

+29
-14
lines changed

15 files changed

+29
-14
lines changed

ts/examples/memoryProviders/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"clean": "rimraf --glob dist *.tsbuildinfo *.done.build.log",
2222
"prettier": "prettier --check . --ignore-path ../../.prettierignore",
2323
"prettier:fix": "prettier --write . --ignore-path ../../.prettierignore",
24-
"test": "npm run test",
24+
"test": "npm run test:local",
2525
"test:local": "node --no-warnings --experimental-vm-modules ./node_modules/jest/bin/jest.js --testPathPattern=\".*\\.spec\\.js\"",
2626
"test:local:debug": "node --inspect-brk --no-warnings --experimental-vm-modules ./node_modules/jest/bin/jest.js --testPathPattern=\".*\\.spec\\.js\"",
2727
"tsc": "tsc -b"

ts/packages/actionSchema/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"clean": "rimraf --glob dist *.tsbuildinfo *.done.build.log",
2424
"prettier": "prettier --check . --ignore-path ../../.prettierignore",
2525
"prettier:fix": "prettier --write . --ignore-path ../../prettierignore",
26-
"test": "npm run test",
26+
"test": "npm run test:local",
2727
"test:local": "node --no-warnings --experimental-vm-modules ./node_modules/jest/bin/jest.js --testPathPattern=\".*\\.spec\\.js\"",
2828
"test:local:debug": "node --inspect-brk --no-warnings --experimental-vm-modules ./node_modules/jest/bin/jest.js --testPathPattern=\".*\\.spec\\.js\"",
2929
"tsc": "tsc -b"

ts/packages/actionSchema/src/validate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ function validateObject(
147147
ignoreExtraneous?.includes(actualField) !== true
148148
) {
149149
const fullName = name ? `${name}.${actualField}` : actualField;
150-
throw new Error(`Extraneous property ${fullName}`);
150+
throw new Error(`Extraneous property '${fullName}'`);
151151
}
152152
}
153153
}

ts/packages/agents/test/src/handler.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ async function executeAction(
5252
case "add":
5353
const { a, b } = action.parameters;
5454
return createActionResult(`The sum of ${a} and ${b} is ${a + b}`);
55+
case "random":
56+
return createActionResult(`Random number: ${Math.random()}`);
5557
default:
56-
throw new Error(`Unknown action: ${action.actionName}`);
58+
throw new Error(`Unknown action: ${(action as any).actionName}`);
5759
}
5860
}

ts/packages/agents/test/src/schema.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4-
export type TestActions = AddAction;
4+
export type TestActions = AddAction | RandomNumberAction;
55
type AddAction = {
66
actionName: "add";
77
parameters: {
88
a: number;
99
b: number;
1010
};
1111
};
12+
13+
type RandomNumberAction = {
14+
actionName: "random";
15+
};

ts/packages/aiclient/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"clean": "rimraf --glob dist *.tsbuildinfo *.done.build.log",
2323
"prettier": "prettier --check . --ignore-path ../../.prettierignore",
2424
"prettier:fix": "prettier --write . --ignore-path ../../prettierignore",
25-
"test": "npm run test",
25+
"test": "npm run test:local",
2626
"test:local": "node --no-warnings --experimental-vm-modules ./node_modules/jest/bin/jest.js --testPathPattern=\".*\\.spec\\.js\"",
2727
"test:local:debug": "node --inspect-brk --no-warnings --experimental-vm-modules ./node_modules/jest/bin/jest.js --testPathPattern=\".*\\.spec\\.js\"",
2828
"tsc": "tsc -b"

ts/packages/api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"prettier": "prettier --check . --ignore-path ../../.prettierignore",
1919
"prettier:fix": "prettier --write . --ignore-path ../../.prettierignore",
2020
"start": "node ./dist/index.js",
21-
"test": "npm run test",
21+
"test": "npm run test:local",
2222
"test:local": "node --no-warnings --experimental-vm-modules ./node_modules/jest/bin/jest.js --testPathPattern=\".*\\.spec\\.js\"",
2323
"test:local:debug": "node --inspect-brk --no-warnings --experimental-vm-modules ./node_modules/jest/bin/jest.js --testPathPattern=\".*\\.spec\\.js\"",
2424
"tsc": "tsc -b"

ts/packages/cache/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"clean": "rimraf --glob dist *.tsbuildinfo *.done.build.log",
2323
"prettier": "prettier --check . --ignore-path ../../.prettierignore",
2424
"prettier:fix": "prettier --write . --ignore-path ../../.prettierignore",
25-
"test": "npm run test",
25+
"test": "npm run test:local",
2626
"test:local": "node --no-warnings --experimental-vm-modules ./node_modules/jest/bin/jest.js --testPathPattern=\".*\\.spec\\.js\"",
2727
"test:local:debug": "node --inspect-brk --no-warnings --experimental-vm-modules ./node_modules/jest/bin/jest.js --testPathPattern=\".*\\.spec\\.js\"",
2828
"tsc": "tsc -b"

ts/packages/commonUtils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"clean": "rimraf --glob dist *.tsbuildinfo *.done.build.log",
2424
"prettier": "prettier --check . --ignore-path ../../.prettierignore",
2525
"prettier:fix": "prettier --write . --ignore-path ../../.prettierignore",
26-
"test": "npm run test",
26+
"test": "npm run test:local",
2727
"test:local": "node --no-warnings --experimental-vm-modules ./node_modules/jest/bin/jest.js --testPathPattern=\".*\\.spec\\.js\"",
2828
"test:local:debug": "node --inspect-brk --no-warnings --experimental-vm-modules ./node_modules/jest/bin/jest.js --testPathPattern=\".*\\.spec\\.js\"",
2929
"tsc": "tsc -b"

ts/packages/dispatcher/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"clean": "rimraf --glob dist *.tsbuildinfo *.done.build.log",
2828
"prettier": "prettier --check . --ignore-path ../../.prettierignore",
2929
"prettier:fix": "prettier --write . --ignore-path ../../.prettierignore",
30-
"test": "npm run test",
30+
"test": "npm run test:local",
3131
"test:local": "node --no-warnings --experimental-vm-modules ./node_modules/jest/bin/jest.js --testPathPattern=\".*\\.spec\\.js\"",
3232
"test:local:debug": "node --inspect-brk --no-warnings --experimental-vm-modules ./node_modules/jest/bin/jest.js --testPathPattern=\".*\\.spec\\.js\"",
3333
"tsc": "tsc -b"

0 commit comments

Comments
 (0)