Skip to content

Commit ec7bb47

Browse files
authored
feat: add unstable session config option handling (#56)
1 parent ec4b095 commit ec7bb47

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

src/acp.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,14 @@ export class AgentSideConnection {
111111
const result = await agent.unstable_setSessionModel(validatedParams);
112112
return result ?? {};
113113
}
114+
case schema.AGENT_METHODS.session_set_config_option: {
115+
if (!agent.unstable_setSessionConfigOption) {
116+
throw RequestError.methodNotFound(method);
117+
}
118+
const validatedParams =
119+
validate.zSetSessionConfigOptionRequest.parse(params);
120+
return agent.unstable_setSessionConfigOption(validatedParams);
121+
}
114122
default:
115123
if (agent.extMethod) {
116124
return agent.extMethod(method, params as Record<string, unknown>);
@@ -718,6 +726,27 @@ export class ClientSideConnection implements Agent {
718726
);
719727
}
720728

729+
/**
730+
* **UNSTABLE**
731+
*
732+
* This capability is not part of the spec yet, and may be removed or changed at any point.
733+
*
734+
* Set a configuration option for a given session.
735+
*
736+
* The response contains the full set of configuration options and their current values,
737+
* as changing one option may affect the available values or state of other options.
738+
*
739+
* @experimental
740+
*/
741+
async unstable_setSessionConfigOption(
742+
params: schema.SetSessionConfigOptionRequest,
743+
): Promise<schema.SetSessionConfigOptionResponse> {
744+
return await this.#connection.sendRequest(
745+
schema.AGENT_METHODS.session_set_config_option,
746+
params,
747+
);
748+
}
749+
721750
/**
722751
* Authenticates the client using the specified authentication method.
723752
*
@@ -1522,6 +1551,21 @@ export interface Agent {
15221551
unstable_setSessionModel?(
15231552
params: schema.SetSessionModelRequest,
15241553
): Promise<schema.SetSessionModelResponse | void>;
1554+
/**
1555+
* **UNSTABLE**
1556+
*
1557+
* This capability is not part of the spec yet, and may be removed or changed at any point.
1558+
*
1559+
* Set a configuration option for a given session.
1560+
*
1561+
* The response contains the full set of configuration options and their current values,
1562+
* as changing one option may affect the available values or state of other options.
1563+
*
1564+
* @experimental
1565+
*/
1566+
unstable_setSessionConfigOption?(
1567+
params: schema.SetSessionConfigOptionRequest,
1568+
): Promise<schema.SetSessionConfigOptionResponse>;
15251569
/**
15261570
* Authenticates the client using the specified authentication method.
15271571
*

0 commit comments

Comments
 (0)