Skip to content

Commit

Permalink
Build Fix (#526)
Browse files Browse the repository at this point in the history
Ensure libsecret-1-0 is installed on build machines.  
Re-enabled tests
Updated some package versions that depend on libsecret.
  • Loading branch information
robgruen authored Jan 7, 2025
1 parent eba05d0 commit 36be2ef
Show file tree
Hide file tree
Showing 8 changed files with 351 additions and 293 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build-ts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ jobs:

runs-on: ${{ matrix.os }}
steps:
- if: runner.os == 'Linux'
run: |
sudo apt install libsecret-1-0
- name: Setup Git LF
run: |
git config --global core.autocrlf false
Expand Down
1 change: 1 addition & 0 deletions ts/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.vscode-test
.cert/
prod/
coverage/
4 changes: 2 additions & 2 deletions ts/packages/agents/agentUtils/graphUtils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
},
"dependencies": {
"@azure/identity": "^4.2.1",
"@azure/identity-cache-persistence": "^1.1.0",
"@azure/identity-cache-persistence": "^1.1.1",
"@azure/logger": "^1.1.0",
"@microsoft/microsoft-graph-client": "^3.0.7",
"aiclient": "workspace:*",
"chalk": "^5.3.0",
"common-utils": "workspace:*",
"date-fns": "^3.4.0",
"date-fns": "^4.1.0",
"debug": "^4.3.4",
"dotenv": "^16.3.1",
"find-config": "^1.0.0",
Expand Down
6 changes: 0 additions & 6 deletions ts/packages/api/test/api.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

/* this is breaking ... need to fix
import assert from "assert";
import { TypeAgentServer } from "../src/typeAgentServer.js";
import findConfig from "find-config";
Expand Down Expand Up @@ -33,8 +32,3 @@ describe.skip("api web/ws server", () => {
}
});
});
*/
// for now null test
test("null test", () => {
expect(true).toBe(true);
});
2 changes: 1 addition & 1 deletion ts/packages/coda/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"@types/ws": "^8.5.10",
"@vscode/test-cli": "^0.0.8",
"@vscode/test-electron": "^2.3.9",
"@vscode/vsce": "^2.24.0",
"@vscode/vsce": "^3.2.1",
"esbuild": "^0.20.2",
"mkdirp": "^3.0.1",
"prettier": "^3.2.5",
Expand Down
2 changes: 1 addition & 1 deletion ts/packages/dispatcher/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"tsc": "tsc -b"
},
"dependencies": {
"@azure/msal-node-extensions": "^1.0.12",
"@azure/msal-node-extensions": "^1.5.0",
"@typeagent/agent-sdk": "workspace:*",
"action-schema": "workspace:*",
"agent-cache": "workspace:*",
Expand Down
239 changes: 116 additions & 123 deletions ts/packages/dispatcher/test/basic.spec.ts
Original file line number Diff line number Diff line change
@@ -1,135 +1,128 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

describe("dispatcher disabled", () => {
it("empty test", () => {
expect(true);
});
});

// Temporarily Disabled
// import { createNpmAppAgentProvider } from "../src/agentProvider/npmAgentProvider.js";
// import { createDispatcher, Dispatcher } from "../src/dispatcher.js";
// import { fileURLToPath } from "node:url";
// import { getBuiltinAppAgentProvider } from "../src/utils/defaultAppProviders.js";
// import {
// ClientIO,
// IAgentMessage,
// nullClientIO,
// } from "../src/context/interactiveIO.js";
import { createNpmAppAgentProvider } from "../src/agentProvider/npmAgentProvider.js";
import { createDispatcher, Dispatcher } from "../src/dispatcher.js";
import { fileURLToPath } from "node:url";
import { getBuiltinAppAgentProvider } from "../src/utils/defaultAppProviders.js";
import {
ClientIO,
IAgentMessage,
nullClientIO,
} from "../src/context/interactiveIO.js";

// const testAppAgentProvider = createNpmAppAgentProvider(
// {
// test: {
// name: "test-agent",
// path: fileURLToPath(
// new URL("../../../agents/test", import.meta.url),
// ),
// },
// },
// import.meta.url,
// );
const testAppAgentProvider = createNpmAppAgentProvider(
{
test: {
name: "test-agent",
path: fileURLToPath(
new URL("../../../agents/test", import.meta.url),
),
},
},
import.meta.url,
);

// function createTestClientIO(data: IAgentMessage[]): ClientIO {
// return {
// ...nullClientIO,
// setDisplay: (message: IAgentMessage) => data.push(message),
// appendDisplay: (message: IAgentMessage) => data.push(message),
// };
// }
function createTestClientIO(data: IAgentMessage[]): ClientIO {
return {
...nullClientIO,
setDisplay: (message: IAgentMessage) => data.push(message),
appendDisplay: (message: IAgentMessage) => data.push(message),
};
}

// describe("dispatcher", () => {
// describe("Built-in Provider", () => {
// it("startup and shutdown", async () => {
// const dispatcher = await createDispatcher("test", {
// appAgentProviders: [getBuiltinAppAgentProvider()],
// });
// await dispatcher.close();
// });
// });
describe("dispatcher", () => {
describe("Built-in Provider", () => {
it("startup and shutdown", async () => {
const dispatcher = await createDispatcher("test", {
appAgentProviders: [getBuiltinAppAgentProvider()],
});
await dispatcher.close();
});
});

// describe("Custom Provider", () => {
// describe("Command", () => {
// const output: IAgentMessage[] = [];
// let dispatcher: Dispatcher;
// beforeAll(async () => {
// dispatcher = await createDispatcher("test", {
// appAgentProviders: [testAppAgentProvider],
// commands: { test: true },
// clientIO: createTestClientIO(output),
// });
// });
// beforeEach(() => {
// output.length = 0;
// });
// afterAll(async () => {
// if (dispatcher) {
// await dispatcher.close();
// }
// });
// it("action command", async () => {
// await dispatcher.processCommand(
// '@action test add --parameters \'{"a": 1, "b": 2}\'',
// );
describe("Custom Provider", () => {
describe("Command", () => {
const output: IAgentMessage[] = [];
let dispatcher: Dispatcher;
beforeAll(async () => {
dispatcher = await createDispatcher("test", {
appAgentProviders: [testAppAgentProvider],
commands: { test: true },
clientIO: createTestClientIO(output),
});
});
beforeEach(() => {
output.length = 0;
});
afterAll(async () => {
if (dispatcher) {
await dispatcher.close();
}
});
it("action command", async () => {
await dispatcher.processCommand(
'@action test add --parameters \'{"a": 1, "b": 2}\'',
);

// expect(output).toHaveLength(2);
// expect(output[1].message).toBe("The sum of 1 and 2 is 3");
// });
expect(output).toHaveLength(2);
expect(output[1].message).toBe("The sum of 1 and 2 is 3");
});

// const errorCommands = [
// {
// name: "Empty Command",
// command: "@",
// match: /^ERROR: Command or agent name required./,
// },
// {
// name: "Invalid agent name",
// command: "@something",
// match: /^ERROR: Command or agent name required./,
// },
// {
// name: "Missing subcommand",
// command: "@test",
// match: /^ERROR: '@test' requires a subcommand./,
// },
// {
// name: "Invalid subcommand",
// command: "@test sub",
// match: /^ERROR: 'sub' is not a subcommand for '@test'./,
// },
// {
// name: "Disable command",
// command: "@dispatcher something",
// match: /^ERROR: Command for 'dispatcher' is disabled./,
// },
// ];
const errorCommands = [
{
name: "Empty Command",
command: "@",
match: /^ERROR: Command or agent name required./,
},
{
name: "Invalid agent name",
command: "@something",
match: /^ERROR: Command or agent name required./,
},
{
name: "Missing subcommand",
command: "@test",
match: /^ERROR: '@test' requires a subcommand./,
},
{
name: "Invalid subcommand",
command: "@test sub",
match: /^ERROR: 'sub' is not a subcommand for '@test'./,
},
{
name: "Disable command",
command: "@dispatcher something",
match: /^ERROR: Command for 'dispatcher' is disabled./,
},
];

// it.each(errorCommands)("$name", async ({ command, match }) => {
// await dispatcher.processCommand(command);
// expect(output).toHaveLength(1);
// expect(typeof output[0].message).toBe("object");
// const content = output[0].message as any;
// expect(content.type).toBe("text");
// expect(content.kind).toBe("error");
// expect(content.content).toMatch(match);
// });
// });
it.each(errorCommands)("$name", async ({ command, match }) => {
await dispatcher.processCommand(command);
expect(output).toHaveLength(1);
expect(typeof output[0].message).toBe("object");
const content = output[0].message as any;
expect(content.type).toBe("text");
expect(content.kind).toBe("error");
expect(content.content).toMatch(match);
});
});

// it("Alternate request handler", async () => {
// const output: IAgentMessage[] = [];
// const dispatcher = await createDispatcher("test", {
// appAgentProviders: [testAppAgentProvider],
// clientIO: createTestClientIO(output),
// });
// await dispatcher.processCommand("@config request test");
// await dispatcher.processCommand("test");
// await dispatcher.close();
it("Alternate request handler", async () => {
const output: IAgentMessage[] = [];
const dispatcher = await createDispatcher("test", {
appAgentProviders: [testAppAgentProvider],
clientIO: createTestClientIO(output),
});
await dispatcher.processCommand("@config request test");
await dispatcher.processCommand("test");
await dispatcher.close();

// expect(output).toHaveLength(2);
// expect(output[0].message).toBe(
// "Natural langue request handling agent is set to 'test'",
// );
// expect(output[1].message).toBe("test");
// });
// });
// });
expect(output).toHaveLength(2);
expect(output[0].message).toBe(
"Natural langue request handling agent is set to 'test'",
);
expect(output[1].message).toBe("test");
});
});
});
Loading

0 comments on commit 36be2ef

Please sign in to comment.