Skip to content

Commit 7af89ab

Browse files
Kowserclaude
andcommitted
feat(agents)!: delete ScheduleClient/SchedulerFetcher — schedules ride SchedulerClient
BREAKING CHANGE (agent layer, no backward compatibility): the raw-fetch ScheduleClient class and SchedulerFetcher interface are gone from the ./agents surface. SchedulerClient — which absorbed the same typed lifecycle methods (save/get/listForAgent/pause/resume/delete/runNow/ previewNext/reconcile) in the previous commit — is re-exported from ./agents in their place; every method call site keeps its name and signature. The scheduling e2e suite needed exactly two lines (import + one type annotation); the schedules.* module facade, runtime schedulesClient(), deploy({schedules}) reconciliation and AgentClient.schedule() are unchanged. AgentClient.schedules now hands its memoized Conductor-client promise to SchedulerClient (single transport; the SchedulerFetcher raw-fetch path is deleted, _rawRequestUntyped remains for /agent/* control-plane calls). An absence test pins the deletion, mirroring the Python SDK's test_agent_schedule_client_is_gone. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent a00ecd7 commit 7af89ab

9 files changed

Lines changed: 118 additions & 240 deletions

File tree

e2e/test_suite21_scheduling.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { describe, it, expect, beforeAll, beforeEach, afterAll } from '@jest/glo
1111
import {
1212
AgentRuntime,
1313
Schedule,
14-
ScheduleClient,
14+
SchedulerClient,
1515
ScheduleNameConflict,
1616
ScheduleNotFound,
1717
} from '@io-orkes/conductor-javascript/agents';
@@ -40,7 +40,7 @@ describe('Suite 21: scheduling', () => {
4040
});
4141
const agentName = `e2e_ts_sched_noop_${Math.random().toString(36).slice(2, 10)}`;
4242
let runtime: AgentRuntime;
43-
let client: ScheduleClient;
43+
let client: SchedulerClient;
4444

4545
beforeAll(async () => {
4646
runtime = new AgentRuntime();
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* The agent-layer `ScheduleClient` (raw-fetch transport) and its
3+
* `SchedulerFetcher` interface were deleted in favor of the SDK's
4+
* `SchedulerClient` (no backward compatibility). This pins the absence so
5+
* they don't silently reappear — the Python SDK enforces the same deletion
6+
* (`test_agent_schedule_client_is_gone`).
7+
*/
8+
import { describe, expect, it } from "@jest/globals";
9+
import * as agents from "../index.js";
10+
import { OrkesClients } from "../../sdk/OrkesClients";
11+
12+
describe("ScheduleClient deletion (no backward compatibility)", () => {
13+
it("the agents barrel no longer exports ScheduleClient", () => {
14+
expect((agents as Record<string, unknown>).ScheduleClient).toBeUndefined();
15+
});
16+
17+
it("the agents barrel re-exports SchedulerClient in its place", () => {
18+
expect(agents.SchedulerClient).toBeDefined();
19+
});
20+
21+
it("OrkesClients grew no getAgentScheduleClient getter", () => {
22+
expect(
23+
(OrkesClients.prototype as unknown as Record<string, unknown>)
24+
.getAgentScheduleClient,
25+
).toBeUndefined();
26+
});
27+
});

src/agents/__tests__/schedules-api.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import { describe, it, expect, jest } from "@jest/globals";
55
import * as schedules from "../schedules-api.js";
66
import type { AgentRuntime } from "../runtime.js";
7-
import type { ScheduleInfo } from "../schedule.js";
7+
import type { ScheduleInfo } from "../../sdk/clients/agent/schedule.js";
88
import type { AgentResult } from "../types.js";
99

1010
const INFO: ScheduleInfo = {

src/agents/agent-client.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ import { detectFramework } from "./frameworks/detect.js";
3131
import { serializeFrameworkAgent } from "./frameworks/serializer.js";
3232
import { serializeLangGraph } from "./frameworks/langgraph-serializer.js";
3333
import { serializeLangChain } from "./frameworks/langchain-serializer.js";
34-
import { Schedule, ScheduleClient } from "./schedule.js";
35-
import type { SchedulerFetcher } from "./schedule.js";
34+
import { Schedule } from "../sdk/clients/agent/schedule.js";
35+
import { SchedulerClient } from "../sdk/clients/scheduler/SchedulerClient.js";
3636
import { WorkflowClient } from "./workflow-client.js";
3737
import { makeAgentResult, TERMINAL_STATUSES } from "./result.js";
3838
import { AgentStream } from "./stream.js";
@@ -82,7 +82,7 @@ export class AgentClient {
8282

8383
private _clientPromise?: Promise<ConductorClient>;
8484
private _workflowClient?: WorkflowClient;
85-
private _scheduleClient?: ScheduleClient;
85+
private _scheduleClient?: SchedulerClient;
8686
private readonly serializer: AgentConfigSerializer;
8787

8888
// Cached minted JWT (auth-key/secret path).
@@ -127,13 +127,10 @@ export class AgentClient {
127127
return this._workflowClient;
128128
}
129129

130-
/** Cron schedule lifecycle client (shares this client's HTTP plumbing). */
131-
get schedules(): ScheduleClient {
130+
/** Cron schedule lifecycle client (shares this client's Conductor client). */
131+
get schedules(): SchedulerClient {
132132
if (!this._scheduleClient) {
133-
const fetcher: SchedulerFetcher = {
134-
request: (method, path, body) => this._rawRequestUntyped(method, path, body),
135-
};
136-
this._scheduleClient = new ScheduleClient(fetcher);
133+
this._scheduleClient = new SchedulerClient(this.getClient());
137134
}
138135
return this._scheduleClient;
139136
}
@@ -249,7 +246,7 @@ export class AgentClient {
249246
}
250247
}
251248

252-
/** Untyped request (scheduler endpoints sometimes return arrays). */
249+
/** Untyped request against the agent control-plane (used by the runtime). */
253250
async _rawRequestUntyped(method: string, path: string, body?: unknown): Promise<unknown> {
254251
const url = `${this.config.serverUrl}${path}`;
255252
const headers: Record<string, string> = {
@@ -397,7 +394,7 @@ export class AgentClient {
397394
* Deploy *agent* and reconcile its cron *schedules* declaratively.
398395
*
399396
* Upserts the listed schedules and prunes the others; `[]` purges all;
400-
* `null`/`undefined` leaves them untouched. Reuses the {@link ScheduleClient}.
397+
* `null`/`undefined` leaves them untouched. Reuses the {@link SchedulerClient}.
401398
*/
402399
async schedule(
403400
agent: Agent | object,

src/agents/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,13 @@ export { WorkflowClient } from "./workflow-client.js";
154154
// ── Scheduling ──────────────────────────────────────────
155155
export {
156156
Schedule,
157-
ScheduleClient,
158157
ScheduleError,
159158
ScheduleNameConflict,
160159
ScheduleNotFound,
161160
InvalidCronExpression,
162-
} from "./schedule.js";
163-
export type { ScheduleOptions, ScheduleInfo, SchedulerFetcher } from "./schedule.js";
161+
} from "../sdk/clients/agent/schedule.js";
162+
export type { ScheduleOptions, ScheduleInfo } from "../sdk/clients/agent/schedule.js";
163+
export { SchedulerClient } from "../sdk/clients/scheduler/SchedulerClient.js";
164164
import * as schedules from "./schedules-api.js";
165165
export { schedules };
166166

src/agents/runtime.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ import { TERMINAL_STATUSES } from "./result.js";
2222
import type { TerminationCondition } from "./termination.js";
2323
import type { HandoffContext } from "./handoff.js";
2424
import { detectFramework } from "./frameworks/detect.js";
25-
import { Schedule, ScheduleClient } from "./schedule.js";
25+
import type { Schedule } from "../sdk/clients/agent/schedule.js";
26+
import type { SchedulerClient } from "../sdk/clients/scheduler/SchedulerClient.js";
2627
import { AgentClient } from "./agent-client.js";
2728
import { WorkflowClient } from "./workflow-client.js";
2829
import { serializeFrameworkAgent } from "./frameworks/serializer.js";
@@ -425,8 +426,8 @@ export class AgentRuntime {
425426
return info;
426427
}
427428

428-
/** `ScheduleClient` — shares the control-plane client's schedule surface. */
429-
schedulesClient(): ScheduleClient {
429+
/** `SchedulerClient` — shares the control-plane client's Conductor client. */
430+
schedulesClient(): SchedulerClient {
430431
return this.client.schedules;
431432
}
432433

src/agents/schedule.ts

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

src/agents/schedules-api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515

1616
import { getRuntime, AgentRuntime } from "./runtime.js";
17-
import type { Schedule as ScheduleClass, ScheduleInfo } from "./schedule.js";
17+
import type { Schedule as ScheduleClass, ScheduleInfo } from "../sdk/clients/agent/schedule.js";
1818
import type { AgentResult, Status } from "./types.js";
1919
import { makeAgentResult, TERMINAL_STATUSES } from "./result.js";
2020

0 commit comments

Comments
 (0)