Skip to content

Commit 721c450

Browse files
SteffenDEbenbrandt
andauthored
feat(unstable): add resumeSession support (#41)
* feat(unstable): add resumeSession support Similar to #37. * Try putting config paths in * format --------- Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
1 parent 628cea5 commit 721c450

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

.github/workflows/publish.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ jobs:
2929
with:
3030
token: ${{ steps.generate-token.outputs.token }}
3131
release-type: node
32+
config-file: release-please-config.json
33+
manifest-file: .release-please-manifest.json
3234
outputs:
3335
release_created: ${{ steps.release.outputs.release_created }}
3436
publish:

src/acp.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ export class AgentSideConnection {
7171
const validatedParams = validate.zForkSessionRequest.parse(params);
7272
return agent.forkSession(validatedParams);
7373
}
74+
case schema.AGENT_METHODS.session_resume: {
75+
if (!agent.resumeSession) {
76+
throw RequestError.methodNotFound(method);
77+
}
78+
const validatedParams = validate.zResumeSessionRequest.parse(params);
79+
return agent.resumeSession(validatedParams);
80+
}
7481
case schema.AGENT_METHODS.session_set_mode: {
7582
if (!agent.setSessionMode) {
7683
throw RequestError.methodNotFound(method);
@@ -631,6 +638,27 @@ export class ClientSideConnection implements Agent {
631638
);
632639
}
633640

641+
/**
642+
* **UNSTABLE**
643+
*
644+
* This capability is not part of the spec yet, and may be removed or changed at any point.
645+
*
646+
* Resumes an existing session without returning previous messages.
647+
*
648+
* This method is only available if the agent advertises the `session.resume` capability.
649+
*
650+
* The agent should resume the session context, allowing the conversation to continue
651+
* without replaying the message history (unlike `session/load`).
652+
*/
653+
async resumeSession(
654+
params: schema.ResumeSessionRequest,
655+
): Promise<schema.ResumeSessionResponse> {
656+
return await this.#connection.sendRequest(
657+
schema.AGENT_METHODS.session_resume,
658+
params,
659+
);
660+
}
661+
634662
/**
635663
* Sets the operational mode for a session.
636664
*
@@ -1416,6 +1444,21 @@ export interface Agent {
14161444
forkSession?(
14171445
params: schema.ForkSessionRequest,
14181446
): Promise<schema.ForkSessionResponse>;
1447+
/**
1448+
* **UNSTABLE**
1449+
*
1450+
* This capability is not part of the spec yet, and may be removed or changed at any point.
1451+
*
1452+
* Resumes an existing session without returning previous messages.
1453+
*
1454+
* This method is only available if the agent advertises the `session.resume` capability.
1455+
*
1456+
* The agent should resume the session context, allowing the conversation to continue
1457+
* without replaying the message history (unlike `session/load`).
1458+
*/
1459+
resumeSession?(
1460+
params: schema.ResumeSessionRequest,
1461+
): Promise<schema.ResumeSessionResponse>;
14191462
/**
14201463
* Sets the operational mode for a session.
14211464
*

0 commit comments

Comments
 (0)