Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
363 changes: 182 additions & 181 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,16 @@
"devDependencies": {
"@eslint/js": "^10.0.1",
"@hey-api/openapi-ts": "^0.99.0",
"@types/node": "^26.0.0",
"@types/node": "^26.0.1",
"@types/ws": "^8.5.13",
"@typescript-eslint/eslint-plugin": "^8.57.1",
"@typescript-eslint/parser": "^8.57.1",
"@typescript-eslint/eslint-plugin": "^8.62.1",
"@typescript-eslint/parser": "^8.62.1",
"concurrently": "^10.0.0",
"eslint": "^10.0.3",
"eslint": "^10.6.0",
"eslint-config-prettier": "^10.1.8",
"globals": "^17.4.0",
"globals": "^17.7.0",
"http-server": "^14.1.1",
"prettier": "^3.8.1",
"prettier": "^3.9.4",
"tsx": "^4.21.0",
"typedoc": "^0.28.16",
"typedoc-github-theme": "^0.4.0",
Expand Down
2 changes: 1 addition & 1 deletion release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"packages": {
".": {
"changelog-path": "CHANGELOG.md",
"release-type": "node",
"release-type": "node"
}
},
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
Expand Down
617 changes: 489 additions & 128 deletions schema/schema.json

Large diffs are not rendered by default.

15 changes: 13 additions & 2 deletions scripts/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as fs from "fs/promises";
import { dirname } from "path";
import * as prettier from "prettier";

const CURRENT_SCHEMA_RELEASE = "schema-v1.16.0";
const CURRENT_SCHEMA_RELEASE = "schema-v1.17.0";

await main();

Expand Down Expand Up @@ -383,7 +383,10 @@ function fallbackFunctionExpression(ctx, schema, isRequired) {

function fallbackValueExpression(ctx, schema, isRequired) {
if (Object.hasOwn(schema, "default")) {
return ctx.$.fromValue(schema.default);
const value = ctx.$.fromValue(schema.default);
return isPrimitiveLiteral(schema.default)
? ctx.$(value).as("const")
: value;
}

if (isArraySchema(schema) && (isRequired || !isNullableSchema(schema))) {
Expand All @@ -393,6 +396,14 @@ function fallbackValueExpression(ctx, schema, isRequired) {
return ctx.$.id("undefined");
}

function isPrimitiveLiteral(value) {
return (
typeof value === "string" ||
typeof value === "number" ||
typeof value === "boolean"
);
}

function isArraySchema(schema) {
return schema.type === "array";
}
Expand Down
34 changes: 18 additions & 16 deletions src/acp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,7 @@ export class AgentContext extends AcpContext {
options?: SendRequestOptions,
): Promise<unknown> {
const spec = clientRequestSpecsByMethod[method] as
| AcpRequestSpec<unknown, unknown, unknown>
| undefined;
AcpRequestSpec<unknown, unknown, unknown> | undefined;
return this.sendRequest(method, params, spec?.mapResponse, options);
}

Expand Down Expand Up @@ -392,8 +391,7 @@ export class ClientContext extends AcpContext {
options?: SendRequestOptions,
): Promise<unknown> {
const spec = agentRequestSpecsByMethod[method] as
| AcpRequestSpec<unknown, unknown, unknown>
| undefined;
AcpRequestSpec<unknown, unknown, unknown> | undefined;
return this.sendRequest(method, params, spec?.mapResponse, options);
}

Expand Down Expand Up @@ -1567,7 +1565,9 @@ export type AgentRequestResponsesByMethod = {
* Agent notification params keyed by ACP protocol method name.
*/
export type AgentNotificationParamsByMethod = {
[Method in AgentNotificationMethod]: AgentNotificationHandlersByMethod[Method] extends (
[
Method in AgentNotificationMethod
]: AgentNotificationHandlersByMethod[Method] extends (
context: infer Context,
) => MaybePromise<void>
? Context extends { params: infer Params }
Expand All @@ -1580,7 +1580,9 @@ export type AgentNotificationParamsByMethod = {
* Client request params keyed by ACP protocol method name.
*/
export type ClientRequestParamsByMethod = {
[Method in ClientRequestMethod]: ClientRequestHandlersByMethod[Method] extends (
[
Method in ClientRequestMethod
]: ClientRequestHandlersByMethod[Method] extends (
context: infer Context,
) => MaybePromise<unknown>
? Context extends { params: infer Params }
Expand All @@ -1593,7 +1595,9 @@ export type ClientRequestParamsByMethod = {
* Client request responses keyed by ACP protocol method name.
*/
export type ClientRequestResponsesByMethod = {
[Method in ClientRequestMethod]: ClientRequestHandlersByMethod[Method] extends (
[
Method in ClientRequestMethod
]: ClientRequestHandlersByMethod[Method] extends (
context: infer _Context,
) => MaybePromise<infer Response>
? Exclude<Response, void>
Expand All @@ -1604,7 +1608,9 @@ export type ClientRequestResponsesByMethod = {
* Client notification params keyed by ACP protocol method name.
*/
export type ClientNotificationParamsByMethod = {
[Method in ClientNotificationMethod]: ClientNotificationHandlersByMethod[Method] extends (
[
Method in ClientNotificationMethod
]: ClientNotificationHandlersByMethod[Method] extends (
context: infer Context,
) => MaybePromise<void>
? Context extends { params: infer Params }
Expand Down Expand Up @@ -1882,8 +1888,7 @@ export class AgentApp {
onRequest<Params, Response>(
method: string,
handlerOrParams:
| AgentRequestHandlersByMethod[AgentRequestMethod]
| ParamsParser<Params>,
AgentRequestHandlersByMethod[AgentRequestMethod] | ParamsParser<Params>,
handler?: AgentRequestHandler<Params, Response>,
): this {
if (handler) {
Expand Down Expand Up @@ -2132,8 +2137,7 @@ export class ClientApp {
onRequest<Params, Response>(
method: string,
handlerOrParams:
| ClientRequestHandlersByMethod[ClientRequestMethod]
| ParamsParser<Params>,
ClientRequestHandlersByMethod[ClientRequestMethod] | ParamsParser<Params>,
handler?: ClientRequestHandler<Params, Response>,
): this {
if (handler) {
Expand Down Expand Up @@ -2799,8 +2803,7 @@ export class AgentSideConnection {
options?: SendRequestOptions,
): Promise<unknown> {
const spec = clientRequestSpecsByMethod[method] as
| AcpRequestSpec<unknown, unknown, unknown>
| undefined;
AcpRequestSpec<unknown, unknown, unknown> | undefined;
return this.connection.sendRequest(
method,
params,
Expand Down Expand Up @@ -3570,8 +3573,7 @@ export class ClientSideConnection implements Agent {
options?: SendRequestOptions,
): Promise<unknown> {
const spec = agentRequestSpecsByMethod[method] as
| AcpRequestSpec<unknown, unknown, unknown>
| undefined;
AcpRequestSpec<unknown, unknown, unknown> | undefined;
return this.connection.sendRequest(
method,
params,
Expand Down
3 changes: 1 addition & 2 deletions src/http-stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ class HttpStreamTransport {
private readonly pendingSessionRequests = new Map<string, string>();

private readableController:
| ReadableStreamDefaultController<AnyMessage>
| undefined;
ReadableStreamDefaultController<AnyMessage> | undefined;
private connectionId: string | undefined;
private isClosed = false;
private writeChain: Promise<void> = Promise.resolve();
Expand Down
5 changes: 2 additions & 3 deletions src/schema-deserialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ export function vecSkipError<ItemSchema extends z.ZodType>(
) {
return z
.array(itemSchema.catch(skippedItem as never))
.transform(
(items): Array<z.output<ItemSchema>> =>
items.filter((item) => item !== skippedItem),
.transform((items): Array<z.output<ItemSchema>> =>
items.filter((item) => item !== skippedItem),
);
}
62 changes: 14 additions & 48 deletions src/schema/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,7 @@ export type ResourceLink = {
* Resource content that can be embedded in a message.
*/
export type EmbeddedResourceResource =
| TextResourceContents
| BlobResourceContents;
TextResourceContents | BlobResourceContents;

/**
* Text-based resource contents.
Expand Down Expand Up @@ -692,10 +691,7 @@ export type PermissionOptionId = string;
* Helps clients choose appropriate icons and UI treatment.
*/
export type PermissionOptionKind =
| "allow_once"
| "allow_always"
| "reject_once"
| "reject_always";
"allow_once" | "allow_always" | "reject_once" | "reject_always";

/**
* Request to create a new terminal and execute a command.
Expand Down Expand Up @@ -1200,8 +1196,7 @@ export type BooleanPropertySchema = {
* Items for a multi-select (array) property schema.
*/
export type MultiSelectItems =
| UntitledMultiSelectItems
| TitledMultiSelectItems;
UntitledMultiSelectItems | TitledMultiSelectItems;

/**
* Items definition for untitled multi-select enum properties.
Expand Down Expand Up @@ -1302,8 +1297,7 @@ export type MultiSelectPropertySchema = {
* @experimental
*/
export type ElicitationFormMode = (
| ElicitationSessionScope
| ElicitationRequestScope
ElicitationSessionScope | ElicitationRequestScope
) & {
/**
* A JSON Schema describing the form fields to present to the user.
Expand Down Expand Up @@ -1332,8 +1326,7 @@ export type ElicitationId = string;
* @experimental
*/
export type ElicitationUrlMode = (
| ElicitationSessionScope
| ElicitationRequestScope
ElicitationSessionScope | ElicitationRequestScope
) & {
/**
* The unique identifier for this elicitation.
Expand Down Expand Up @@ -2465,7 +2458,7 @@ export type AuthMethodAgent = {

/**
* Metadata about the implementation of the client or agent.
* Describes the name and version of an MCP implementation, with an optional
* Describes the name and version of an ACP implementation, with an optional
* title for UI representation.
*/
export type Implementation = {
Expand Down Expand Up @@ -2595,12 +2588,7 @@ export type ProviderInfo = {
* @experimental
*/
export type LlmProtocol =
| "anthropic"
| "openai"
| "azure"
| "vertex"
| "bedrock"
| string;
"anthropic" | "openai" | "azure" | "vertex" | "bedrock" | string;

/**
* **UNSTABLE**
Expand Down Expand Up @@ -2841,11 +2829,7 @@ export type SessionConfigId = string;
* Category names that do not begin with `_` are reserved for the ACP spec.
*/
export type SessionConfigOptionCategory =
| "mode"
| "model"
| "model_config"
| "thought_level"
| string;
"mode" | "model" | "model_config" | "thought_level" | string;

/**
* Unique identifier for a session configuration option value.
Expand All @@ -2856,8 +2840,7 @@ export type SessionConfigValueId = string;
* Possible values for a session configuration option.
*/
export type SessionConfigSelectOptions =
| Array<SessionConfigSelectOption>
| Array<SessionConfigSelectGroup>;
Array<SessionConfigSelectOption> | Array<SessionConfigSelectGroup>;

/**
* A possible value for a session configuration option.
Expand Down Expand Up @@ -3209,11 +3192,7 @@ export type PromptResponse = {
* See protocol docs: [Stop Reasons](https://agentclientprotocol.com/protocol/prompt-turn#stop-reasons)
*/
export type StopReason =
| "end_turn"
| "max_tokens"
| "max_turn_requests"
| "refusal"
| "cancelled";
"end_turn" | "max_tokens" | "max_turn_requests" | "refusal" | "cancelled";

/**
* **UNSTABLE**
Expand Down Expand Up @@ -5808,10 +5787,7 @@ export type NesDiagnostic = {
* Severity of a diagnostic.
*/
export type NesDiagnosticSeverity =
| "error"
| "warning"
| "information"
| "hint";
"error" | "warning" | "information" | "hint";

/**
* Request to close an NES session.
Expand Down Expand Up @@ -5860,8 +5836,8 @@ export type ClientResponse =
| CreateElicitationResponse
| ConnectMcpResponse
| DisconnectMcpResponse
| ExtResponse
| MessageMcpResponse;
| MessageMcpResponse
| ExtResponse;
}
| {
/**
Expand Down Expand Up @@ -6125,11 +6101,7 @@ export type CreateElicitationResponse = (
* Allowed wire representations for [`ElicitationContentValue`].
*/
export type ElicitationContentValue =
| string
| number
| number
| boolean
| Array<string>;
string | number | number | boolean | Array<string>;

/**
* **UNSTABLE**
Expand Down Expand Up @@ -6481,15 +6453,9 @@ export type RejectNesNotification = {
export type NesRejectReason = "rejected" | "ignored" | "replaced" | "cancelled";

/**
* **UNSTABLE**
*
* This capability is not part of the spec yet, and may be removed or changed at any point.
*
* Notification to cancel an ongoing request.
*
* See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/cancellation)
*
* @experimental
*/
export type CancelRequestNotification = {
/**
Expand Down
Loading