Skip to content

Commit f191905

Browse files
committed
Add release workflow and SDK coverage
1 parent 00a67c1 commit f191905

3 files changed

Lines changed: 129 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Publish
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "Package version to publish, for example 0.1.0"
8+
required: true
9+
10+
permissions:
11+
contents: read
12+
id-token: write
13+
14+
jobs:
15+
publish:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: 22
22+
registry-url: https://registry.npmjs.org
23+
cache: npm
24+
- run: npm ci
25+
- run: npm run typecheck
26+
- run: npm test
27+
- run: npm run build
28+
- run: npm version "${{ inputs.version }}" --no-git-tag-version
29+
- run: npm publish --provenance --access public
30+
env:
31+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

docs/release.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Release Workflow
2+
3+
`@agentdispatch/sdk` is published after `@agentdispatch/core`.
4+
5+
## Prerequisites
6+
7+
- Publish `@agentdispatch/core` for the target compatibility line.
8+
- Add an npm automation token as `NPM_TOKEN` in repository secrets.
9+
- Replace bootstrap `file:../agentdispatch-core` development links with the published core version before the first registry release.
10+
11+
## Publish
12+
13+
Use the `Publish` GitHub Actions workflow with the target version. The workflow validates typecheck, tests, and build before publishing with npm provenance.

test/client.test.ts

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
import { describe, expect, it } from "vitest";
2+
import type { DispatchRequest, RuntimeService } from "@agentdispatch/core";
3+
import { AgentDispatchClient } from "../src/index.js";
4+
5+
const request: DispatchRequest = {
6+
provider: "aws",
7+
accountProfile: "dev-aws",
8+
capability: "agent-runtime",
9+
taskType: "agent.run",
10+
target: { mode: "session" },
11+
input: { instruction: "run a long task" }
12+
};
13+
14+
describe("AgentDispatchClient", () => {
15+
it("delegates task lifecycle calls to the configured runtime service", async () => {
16+
const calls: string[] = [];
17+
const runtime = {
18+
dispatchTask: async (dispatchRequest: DispatchRequest) => {
19+
calls.push(`dispatch:${dispatchRequest.provider}`);
20+
return {
21+
taskId: "task_sdk",
22+
status: "provisioning",
23+
provider: dispatchRequest.provider,
24+
accountProfile: dispatchRequest.accountProfile,
25+
capability: dispatchRequest.capability,
26+
backend: "aws-agentcore",
27+
poll: {
28+
statusTool: "get_task_status",
29+
logsTool: "get_task_logs",
30+
resultTool: "get_task_result"
31+
}
32+
};
33+
},
34+
getTaskStatus: async (taskId: string) => {
35+
calls.push(`status:${taskId}`);
36+
return { id: taskId, status: "running" };
37+
},
38+
getTaskLogs: async (taskId: string, cursor?: number, limit?: number) => {
39+
calls.push(`logs:${taskId}:${cursor}:${limit}`);
40+
return { taskId, cursor, nextCursor: 5, data: "hello" };
41+
},
42+
getTaskResult: async (taskId: string) => {
43+
calls.push(`result:${taskId}`);
44+
return { taskId, status: "succeeded", artifacts: [] };
45+
},
46+
cancelTask: async (taskId: string) => {
47+
calls.push(`cancel:${taskId}`);
48+
return { status: "cancelled" };
49+
},
50+
listProviders: () => {
51+
calls.push("providers");
52+
return ["aws"];
53+
},
54+
listCapabilities: (provider?: string) => {
55+
calls.push(`capabilities:${provider}`);
56+
return [{ adapter: "aws-agentcore", provider: "aws", capability: "agent-runtime", taskTypes: ["agent.run"], targetModes: ["session"] }];
57+
},
58+
listAccountProfiles: () => {
59+
calls.push("accounts");
60+
return [{ name: "dev-aws", provider: "aws", credentialSource: "aws-sdk-default" }];
61+
}
62+
} as unknown as RuntimeService;
63+
64+
const client = new AgentDispatchClient(runtime);
65+
66+
await expect(client.dispatchTask(request)).resolves.toMatchObject({ taskId: "task_sdk", backend: "aws-agentcore" });
67+
await expect(client.getTaskStatus("task_sdk")).resolves.toMatchObject({ status: "running" });
68+
await expect(client.getTaskLogs("task_sdk", 0, 128)).resolves.toMatchObject({ data: "hello" });
69+
await expect(client.getTaskResult("task_sdk")).resolves.toMatchObject({ status: "succeeded" });
70+
await expect(client.cancelTask("task_sdk")).resolves.toMatchObject({ status: "cancelled" });
71+
expect(client.listProviders()).toEqual(["aws"]);
72+
expect(client.listCapabilities("aws")).toHaveLength(1);
73+
expect(client.listAccountProfiles()).toHaveLength(1);
74+
expect(calls).toEqual([
75+
"dispatch:aws",
76+
"status:task_sdk",
77+
"logs:task_sdk:0:128",
78+
"result:task_sdk",
79+
"cancel:task_sdk",
80+
"providers",
81+
"capabilities:aws",
82+
"accounts"
83+
]);
84+
});
85+
});

0 commit comments

Comments
 (0)