@agentclientprotocol/claude-agent-acp 0.90.1-preview.1 → 0.90.1-preview.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- package/dist/acp-agent.d.ts +113 -16
- package/dist/acp-agent.d.ts.map +1 -1
- package/dist/acp-agent.js +393 -67
- package/dist/gateway-models.d.ts +62 -0
- package/dist/gateway-models.d.ts.map +1 -0
- package/dist/gateway-models.js +180 -0
- package/dist/native-subagents.d.ts +15 -3
- package/dist/native-subagents.d.ts.map +1 -1
- package/dist/native-subagents.js +21 -4
- package/dist/session-model.d.ts +21 -1
- package/dist/session-model.d.ts.map +1 -1
- package/dist/session-model.js +89 -11
- package/dist/tool-calls/renderer.d.ts +14 -1
- package/dist/tool-calls/renderer.d.ts.map +1 -1
- package/dist/tool-calls/renderer.js +28 -5
- package/dist/turn-events.d.ts +5 -1
- package/dist/turn-events.d.ts.map +1 -1
- package/dist/v2/prompt.d.ts +2 -1
- package/dist/v2/prompt.d.ts.map +1 -1
- package/dist/v2/prompt.js +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model discovery for a gateway set via `providers/set`.
|
|
3
|
+
*
|
|
4
|
+
* An organization can restrict which models its gateway serves, and the
|
|
5
|
+
* gateway's listing returns only those: `GET /v1/models` for an `anthropic`
|
|
6
|
+
* gateway, `GET /foundation-models` (Bedrock `ListFoundationModels`) for a
|
|
7
|
+
* `bedrock` one. The adapter lists them once when the provider is set, and the
|
|
8
|
+
* model picker then offers only the SDK models the gateway listed (see
|
|
9
|
+
* `narrowToGatewayModels` in `session-model.ts`). A listing that fails fails
|
|
10
|
+
* `providers/set` with a {@link GatewayListingError}.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* The bearer token `createEnvForProvider` sets as `ANTHROPIC_AUTH_TOKEN` and
|
|
14
|
+
* `AWS_BEARER_TOKEN_BEDROCK`, so the CLI sends `Authorization: Bearer acp-proxy`
|
|
15
|
+
* unless the provider headers replace it. The listing sends the same, so the
|
|
16
|
+
* gateway sees the same auth as on chat requests.
|
|
17
|
+
*/
|
|
18
|
+
export declare const PROVIDER_AUTH_TOKEN_PLACEHOLDER = "acp-proxy";
|
|
19
|
+
type ListingLogger = {
|
|
20
|
+
log: (...args: any[]) => void;
|
|
21
|
+
error: (...args: any[]) => void;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* A gateway listing that failed: a network error, a status other than 2xx or
|
|
25
|
+
* 4xx, a body that is not the expected listing, or the 10 s timeout. The
|
|
26
|
+
* message names the request path and the reason, never a header value.
|
|
27
|
+
*/
|
|
28
|
+
export declare class GatewayListingError extends Error {
|
|
29
|
+
name: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Lists the model ids an `anthropic` gateway at `baseUrl` serves, following
|
|
33
|
+
* `has_more` / `last_id` pagination. Returns `undefined` when the gateway
|
|
34
|
+
* answers 4xx: it has no listing, and nothing is narrowed. Throws a
|
|
35
|
+
* {@link GatewayListingError} when the listing fails. Header values are never
|
|
36
|
+
* logged.
|
|
37
|
+
*/
|
|
38
|
+
export declare function listGatewayModels(baseUrl: string, providerHeaders: Record<string, string>, logger: ListingLogger): Promise<string[] | undefined>;
|
|
39
|
+
/**
|
|
40
|
+
* Lists the Anthropic models a `bedrock` gateway at `baseUrl` serves
|
|
41
|
+
* (`GET /foundation-models`, Bedrock `ListFoundationModels`, one page), the
|
|
42
|
+
* listing AI Router answers on its Bedrock route. Returns the listed ids, such
|
|
43
|
+
* as `global.anthropic.claude-sonnet-5-5`; `undefined` and the errors are
|
|
44
|
+
* those of {@link listGatewayModels}.
|
|
45
|
+
*/
|
|
46
|
+
export declare function listBedrockModels(baseUrl: string, providerHeaders: Record<string, string>, logger: ListingLogger): Promise<string[] | undefined>;
|
|
47
|
+
/** The cross-region prefix of a Bedrock model id or ARN, if it has one. */
|
|
48
|
+
export declare function bedrockRegionPrefix(modelId: string): string | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Picks the region of the listed Bedrock models: `global` when the gateway
|
|
51
|
+
* lists it, else the prefix of the first id that has one. A gateway that lists
|
|
52
|
+
* `eu.*` and `us.*` ids gets the prefix that comes first, and the ids of the
|
|
53
|
+
* other prefixes are dropped, so the picker offers only models the CLI can
|
|
54
|
+
* call under that prefix. Ids without a prefix (`anthropic.claude-…`) are
|
|
55
|
+
* dropped too once a prefix is picked; without any prefix every id is kept.
|
|
56
|
+
*/
|
|
57
|
+
export declare function selectBedrockRegion(modelIds: readonly string[]): {
|
|
58
|
+
regionPrefix?: string;
|
|
59
|
+
modelIds: string[];
|
|
60
|
+
};
|
|
61
|
+
export {};
|
|
62
|
+
//# sourceMappingURL=gateway-models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gateway-models.d.ts","sourceRoot":"","sources":["../src/gateway-models.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAQH;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B,cAAc,CAAC;AAW3D,KAAK,aAAa,GAAG;IAAE,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;IAAC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;CAAE,CAAC;AAIxF;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;IACnC,IAAI,SAAyB;CACvC;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,EACf,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACvC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,CAkB/B;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,EACf,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACvC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,CAa/B;AAED,2EAA2E;AAC3E,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGvE;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG;IAChE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAUA"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model discovery for a gateway set via `providers/set`.
|
|
3
|
+
*
|
|
4
|
+
* An organization can restrict which models its gateway serves, and the
|
|
5
|
+
* gateway's listing returns only those: `GET /v1/models` for an `anthropic`
|
|
6
|
+
* gateway, `GET /foundation-models` (Bedrock `ListFoundationModels`) for a
|
|
7
|
+
* `bedrock` one. The adapter lists them once when the provider is set, and the
|
|
8
|
+
* model picker then offers only the SDK models the gateway listed (see
|
|
9
|
+
* `narrowToGatewayModels` in `session-model.ts`). A listing that fails fails
|
|
10
|
+
* `providers/set` with a {@link GatewayListingError}.
|
|
11
|
+
*/
|
|
12
|
+
const LISTING_TIMEOUT_MS = 10_000;
|
|
13
|
+
const ANTHROPIC_PAGE_LIMIT = "1000";
|
|
14
|
+
const MAX_LISTING_PAGES = 20;
|
|
15
|
+
const MAX_LOGGED_BODY_CHARS = 500;
|
|
16
|
+
const ANTHROPIC_VERSION = "2023-06-01";
|
|
17
|
+
/**
|
|
18
|
+
* The bearer token `createEnvForProvider` sets as `ANTHROPIC_AUTH_TOKEN` and
|
|
19
|
+
* `AWS_BEARER_TOKEN_BEDROCK`, so the CLI sends `Authorization: Bearer acp-proxy`
|
|
20
|
+
* unless the provider headers replace it. The listing sends the same, so the
|
|
21
|
+
* gateway sees the same auth as on chat requests.
|
|
22
|
+
*/
|
|
23
|
+
export const PROVIDER_AUTH_TOKEN_PLACEHOLDER = "acp-proxy";
|
|
24
|
+
/**
|
|
25
|
+
* The cross-region inference profile prefixes the CLI knows:
|
|
26
|
+
* `eu.anthropic.claude-sonnet-5`. `ANTHROPIC_BEDROCK_REGION_PREFIX` accepts all
|
|
27
|
+
* of them but `us-gov`, which the CLI takes only from a `us-gov-*` AWS region;
|
|
28
|
+
* a gateway listing only `us-gov.*` ids would then get an empty picker. That
|
|
29
|
+
* case is theoretical, so it is left as is.
|
|
30
|
+
*/
|
|
31
|
+
const BEDROCK_REGION_PREFIXES = ["us", "eu", "apac", "jp", "au", "us-gov", "global"];
|
|
32
|
+
/**
|
|
33
|
+
* A gateway listing that failed: a network error, a status other than 2xx or
|
|
34
|
+
* 4xx, a body that is not the expected listing, or the 10 s timeout. The
|
|
35
|
+
* message names the request path and the reason, never a header value.
|
|
36
|
+
*/
|
|
37
|
+
export class GatewayListingError extends Error {
|
|
38
|
+
name = "GatewayListingError";
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Lists the model ids an `anthropic` gateway at `baseUrl` serves, following
|
|
42
|
+
* `has_more` / `last_id` pagination. Returns `undefined` when the gateway
|
|
43
|
+
* answers 4xx: it has no listing, and nothing is narrowed. Throws a
|
|
44
|
+
* {@link GatewayListingError} when the listing fails. Header values are never
|
|
45
|
+
* logged.
|
|
46
|
+
*/
|
|
47
|
+
export async function listGatewayModels(baseUrl, providerHeaders, logger) {
|
|
48
|
+
return listPages(`${baseUrl.replace(/\/+$/, "")}/v1/models`, { limit: ANTHROPIC_PAGE_LIMIT }, listingHeaders(providerHeaders, { "anthropic-version": ANTHROPIC_VERSION }), logger, (body) => {
|
|
49
|
+
const page = body;
|
|
50
|
+
if (!Array.isArray(page.data))
|
|
51
|
+
return undefined;
|
|
52
|
+
return {
|
|
53
|
+
ids: stringField(page.data, "id"),
|
|
54
|
+
nextQuery: page.has_more === true && typeof page.last_id === "string"
|
|
55
|
+
? { limit: ANTHROPIC_PAGE_LIMIT, after_id: page.last_id }
|
|
56
|
+
: undefined,
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Lists the Anthropic models a `bedrock` gateway at `baseUrl` serves
|
|
62
|
+
* (`GET /foundation-models`, Bedrock `ListFoundationModels`, one page), the
|
|
63
|
+
* listing AI Router answers on its Bedrock route. Returns the listed ids, such
|
|
64
|
+
* as `global.anthropic.claude-sonnet-5-5`; `undefined` and the errors are
|
|
65
|
+
* those of {@link listGatewayModels}.
|
|
66
|
+
*/
|
|
67
|
+
export async function listBedrockModels(baseUrl, providerHeaders, logger) {
|
|
68
|
+
const ids = await listPages(`${baseUrl.replace(/\/+$/, "")}/foundation-models`, {}, listingHeaders(providerHeaders, {}), logger, (body) => {
|
|
69
|
+
const page = body;
|
|
70
|
+
if (!Array.isArray(page.modelSummaries))
|
|
71
|
+
return undefined;
|
|
72
|
+
return { ids: stringField(page.modelSummaries, "modelId") };
|
|
73
|
+
});
|
|
74
|
+
return ids?.filter((id) => id.includes("anthropic."));
|
|
75
|
+
}
|
|
76
|
+
/** The cross-region prefix of a Bedrock model id or ARN, if it has one. */
|
|
77
|
+
export function bedrockRegionPrefix(modelId) {
|
|
78
|
+
const id = modelId.slice(modelId.lastIndexOf("/") + 1).toLowerCase();
|
|
79
|
+
return BEDROCK_REGION_PREFIXES.find((prefix) => id.startsWith(`${prefix}.anthropic.`));
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Picks the region of the listed Bedrock models: `global` when the gateway
|
|
83
|
+
* lists it, else the prefix of the first id that has one. A gateway that lists
|
|
84
|
+
* `eu.*` and `us.*` ids gets the prefix that comes first, and the ids of the
|
|
85
|
+
* other prefixes are dropped, so the picker offers only models the CLI can
|
|
86
|
+
* call under that prefix. Ids without a prefix (`anthropic.claude-…`) are
|
|
87
|
+
* dropped too once a prefix is picked; without any prefix every id is kept.
|
|
88
|
+
*/
|
|
89
|
+
export function selectBedrockRegion(modelIds) {
|
|
90
|
+
const prefixes = modelIds.map(bedrockRegionPrefix);
|
|
91
|
+
const regionPrefix = prefixes.includes("global")
|
|
92
|
+
? "global"
|
|
93
|
+
: prefixes.find((prefix) => prefix !== undefined);
|
|
94
|
+
if (!regionPrefix)
|
|
95
|
+
return { modelIds: [...modelIds] };
|
|
96
|
+
return {
|
|
97
|
+
regionPrefix,
|
|
98
|
+
modelIds: modelIds.filter((id) => bedrockRegionPrefix(id) === regionPrefix),
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
// Provider headers win over the defaults, matched case-insensitively, the way
|
|
102
|
+
// `ANTHROPIC_CUSTOM_HEADERS` overrides the CLI's own headers.
|
|
103
|
+
function listingHeaders(providerHeaders, protocolHeaders) {
|
|
104
|
+
const headers = new Headers({
|
|
105
|
+
authorization: `Bearer ${PROVIDER_AUTH_TOKEN_PLACEHOLDER}`,
|
|
106
|
+
accept: "application/json",
|
|
107
|
+
...protocolHeaders,
|
|
108
|
+
});
|
|
109
|
+
for (const [name, value] of Object.entries(providerHeaders)) {
|
|
110
|
+
// `Headers.set` puts an invalid value into its error message, so name only the header.
|
|
111
|
+
try {
|
|
112
|
+
headers.set(name, value);
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
throw new GatewayListingError(`Model listing cannot send the invalid header "${name}"`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return headers;
|
|
119
|
+
}
|
|
120
|
+
function stringField(entries, field) {
|
|
121
|
+
return entries.flatMap((entry) => {
|
|
122
|
+
const value = entry?.[field];
|
|
123
|
+
return typeof value === "string" && value.trim() !== "" ? [value] : [];
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Reads `endpoint` page by page; `parse` returns `undefined` for a body it does
|
|
128
|
+
* not understand. A 4xx answer on any page means the gateway has no listing:
|
|
129
|
+
* the result is `undefined`, and nothing is narrowed.
|
|
130
|
+
*/
|
|
131
|
+
async function listPages(endpoint, firstQuery, headers, logger, parse) {
|
|
132
|
+
const { pathname: path, username, password } = new URL(endpoint);
|
|
133
|
+
const failure = (reason) => {
|
|
134
|
+
const error = new GatewayListingError(`Model listing GET ${path} ${reason}`);
|
|
135
|
+
logger.error(`[providers/set] ${error.message}`);
|
|
136
|
+
return error;
|
|
137
|
+
};
|
|
138
|
+
// fetch refuses such a URL and repeats it, credentials included, in its error.
|
|
139
|
+
if (username || password)
|
|
140
|
+
throw failure("cannot be sent: the base URL carries credentials");
|
|
141
|
+
const signal = AbortSignal.timeout(LISTING_TIMEOUT_MS);
|
|
142
|
+
const ids = [];
|
|
143
|
+
let query = firstQuery;
|
|
144
|
+
for (let page = 0; page < MAX_LISTING_PAGES && query; page++) {
|
|
145
|
+
const url = new URL(endpoint);
|
|
146
|
+
for (const [name, value] of Object.entries(query))
|
|
147
|
+
url.searchParams.set(name, value);
|
|
148
|
+
let response;
|
|
149
|
+
let body;
|
|
150
|
+
try {
|
|
151
|
+
response = await fetch(url, { headers, signal });
|
|
152
|
+
body = await response.text();
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
throw failure(`failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
156
|
+
}
|
|
157
|
+
if (response.status >= 400 && response.status < 500) {
|
|
158
|
+
logger.log(`[providers/set] Model listing GET ${path} returned ${response.status}: the gateway has no listing, models are not narrowed`);
|
|
159
|
+
return undefined;
|
|
160
|
+
}
|
|
161
|
+
if (!response.ok) {
|
|
162
|
+
throw failure(`returned ${response.status}: ${body.slice(0, MAX_LOGGED_BODY_CHARS)}`);
|
|
163
|
+
}
|
|
164
|
+
let parsed;
|
|
165
|
+
try {
|
|
166
|
+
parsed = parse(JSON.parse(body));
|
|
167
|
+
}
|
|
168
|
+
catch {
|
|
169
|
+
parsed = undefined;
|
|
170
|
+
}
|
|
171
|
+
if (!parsed)
|
|
172
|
+
throw failure("returned an unexpected body");
|
|
173
|
+
ids.push(...parsed.ids);
|
|
174
|
+
query = parsed.nextQuery;
|
|
175
|
+
}
|
|
176
|
+
if (query) {
|
|
177
|
+
logger.error(`[providers/set] Model listing GET ${path} still had more pages after ${MAX_LISTING_PAGES}; using what was read`);
|
|
178
|
+
}
|
|
179
|
+
return ids;
|
|
180
|
+
}
|
|
@@ -121,6 +121,8 @@ export declare class NativeSubagentRuntime {
|
|
|
121
121
|
private readonly generationByTaskId;
|
|
122
122
|
private readonly pending;
|
|
123
123
|
private pendingCount;
|
|
124
|
+
/** The RFD form: how many times the parent was cancelled (see {@link awaitingUser}). */
|
|
125
|
+
private parentCancels;
|
|
124
126
|
/**
|
|
125
127
|
* `form` is undefined for a client without native subagent sessions. The RFD
|
|
126
128
|
* form restores an agent from before a load or resume with `lineage`.
|
|
@@ -179,15 +181,25 @@ export declare class NativeSubagentRuntime {
|
|
|
179
181
|
* foreground children that the turn waits on and, currently, background
|
|
180
182
|
* children too, and the SDK's task events report each as cancelled. A child
|
|
181
183
|
* that keeps running keeps its open requests
|
|
182
|
-
* (agentclientprotocol/agent-client-protocol#2308).
|
|
184
|
+
* (agentclientprotocol/agent-client-protocol#2308). The RFD form only counts
|
|
185
|
+
* the cancel, for {@link awaitingUser}.
|
|
183
186
|
*/
|
|
184
187
|
parentCancelled(deliver: Publish): Promise<void>;
|
|
185
188
|
/**
|
|
186
189
|
* Runs `request`, a permission or question request of the session
|
|
187
190
|
* `sessionId`. In the RFD form, a child waiting on it is `requires_action`
|
|
188
|
-
* until its last open request ends.
|
|
191
|
+
* until its last open request ends, and then `running` again.
|
|
192
|
+
*
|
|
193
|
+
* `signal` aborts when Claude Code withdraws the request, which is not an
|
|
194
|
+
* answer. If the parent was cancelled while the request was open, Claude
|
|
195
|
+
* Code's interrupt withdrew it as it stopped the child, and the SDK's events
|
|
196
|
+
* report the child `idle` next. The end of the request then reports no
|
|
197
|
+
* `running`, which would show a child that is being stopped as working.
|
|
198
|
+
* Without a cancel, something else answered the request in the user's place,
|
|
199
|
+
* such as a `PermissionRequest` hook, and the child runs on, so the end
|
|
200
|
+
* reports `running`.
|
|
189
201
|
*/
|
|
190
|
-
awaitingUser<T>(sessionId: string, request: () => Promise<T
|
|
202
|
+
awaitingUser<T>(sessionId: string, request: () => Promise<T>, signal?: AbortSignal): Promise<T>;
|
|
191
203
|
discardPending(parentToolUseId: string): void;
|
|
192
204
|
/**
|
|
193
205
|
* The RFD form: restores the agent `agentId` when the SendMessage call
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-subagents.d.ts","sourceRoot":"","sources":["../src/native-subagents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAClF,OAAO,KAAK,EAAE,sBAAsB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAG9F,kFAAkF;AAClF,MAAM,MAAM,SAAS,GAAG,WAAW,CACjC,OAAO,CAAC,mBAAmB,CAAC,QAAQ,CAAC,EAAE;IAAE,aAAa,EAAE,iBAAiB,CAAA;CAAE,CAAC,CAAC,OAAO,CAAC,CACtF,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+EAA+E;IAC/E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IAC/B;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB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CAC/B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG,SAAS,CAAC,EACtE,OAAO,EAAE,MAAM,EACf,gBAAgB,GAAE,SAAS,MAAM,EAAO,GACvC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAkBlD;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,aAAa,GAAG,SAAS,CAM9E;AAED,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,sBAAsB,CAAC,QAAQ,CAAC,GACvC,MAAM,IAAI,OAAO,CAClB,sBAAsB,CAAC,QAAQ,CAAC,EAChC;IAAE,aAAa,EAAE,WAAW,GAAG,kBAAkB,CAAA;CAAE,CACpD,CASA;AAED,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAEtE"}
|
package/dist/native-subagents.js
CHANGED
|
@@ -36,6 +36,8 @@ export class NativeSubagentRuntime {
|
|
|
36
36
|
generationByTaskId = new Map();
|
|
37
37
|
pending = new Map();
|
|
38
38
|
pendingCount = 0;
|
|
39
|
+
/** The RFD form: how many times the parent was cancelled (see {@link awaitingUser}). */
|
|
40
|
+
parentCancels = 0;
|
|
39
41
|
/**
|
|
40
42
|
* `form` is undefined for a client without native subagent sessions. The RFD
|
|
41
43
|
* form restores an agent from before a load or resume with `lineage`.
|
|
@@ -361,21 +363,34 @@ export class NativeSubagentRuntime {
|
|
|
361
363
|
* foreground children that the turn waits on and, currently, background
|
|
362
364
|
* children too, and the SDK's task events report each as cancelled. A child
|
|
363
365
|
* that keeps running keeps its open requests
|
|
364
|
-
* (agentclientprotocol/agent-client-protocol#2308).
|
|
366
|
+
* (agentclientprotocol/agent-client-protocol#2308). The RFD form only counts
|
|
367
|
+
* the cancel, for {@link awaitingUser}.
|
|
365
368
|
*/
|
|
366
369
|
async parentCancelled(deliver) {
|
|
367
370
|
if (this.form === "air")
|
|
368
371
|
await this.finishAll("cancelled", deliver);
|
|
372
|
+
else
|
|
373
|
+
this.parentCancels++;
|
|
369
374
|
}
|
|
370
375
|
/**
|
|
371
376
|
* Runs `request`, a permission or question request of the session
|
|
372
377
|
* `sessionId`. In the RFD form, a child waiting on it is `requires_action`
|
|
373
|
-
* until its last open request ends.
|
|
378
|
+
* until its last open request ends, and then `running` again.
|
|
379
|
+
*
|
|
380
|
+
* `signal` aborts when Claude Code withdraws the request, which is not an
|
|
381
|
+
* answer. If the parent was cancelled while the request was open, Claude
|
|
382
|
+
* Code's interrupt withdrew it as it stopped the child, and the SDK's events
|
|
383
|
+
* report the child `idle` next. The end of the request then reports no
|
|
384
|
+
* `running`, which would show a child that is being stopped as working.
|
|
385
|
+
* Without a cancel, something else answered the request in the user's place,
|
|
386
|
+
* such as a `PermissionRequest` hook, and the child runs on, so the end
|
|
387
|
+
* reports `running`.
|
|
374
388
|
*/
|
|
375
|
-
async awaitingUser(sessionId, request) {
|
|
389
|
+
async awaitingUser(sessionId, request, signal) {
|
|
376
390
|
const child = this.form === "rfd" ? this.childOfSession(sessionId) : undefined;
|
|
377
391
|
if (!child?.announced)
|
|
378
392
|
return request();
|
|
393
|
+
const cancelsAtOpen = this.parentCancels;
|
|
379
394
|
child.openRequests = (child.openRequests ?? 0) + 1;
|
|
380
395
|
if (child.openRequests === 1 && child.workState === "running") {
|
|
381
396
|
await this.reportState(child, { state: "requires_action" }).catch((error) => this.logger.log(`Failed to report that subagent ${child.sessionId} waits: ${error}`));
|
|
@@ -385,7 +400,9 @@ export class NativeSubagentRuntime {
|
|
|
385
400
|
}
|
|
386
401
|
finally {
|
|
387
402
|
child.openRequests = (child.openRequests ?? 1) - 1;
|
|
388
|
-
|
|
403
|
+
// Withdrawn after a cancel that came while the request was open.
|
|
404
|
+
const stopped = signal?.aborted === true && this.parentCancels !== cancelsAtOpen;
|
|
405
|
+
if (child.openRequests === 0 && child.workState === "requires_action" && !stopped) {
|
|
389
406
|
await this.reportState(child, { state: "running" }).catch((error) => this.logger.log(`Failed to report that subagent ${child.sessionId} runs: ${error}`));
|
|
390
407
|
}
|
|
391
408
|
}
|
package/dist/session-model.d.ts
CHANGED
|
@@ -46,6 +46,26 @@ export declare function isDeniedModel(modelId: string, deniedModels: readonly st
|
|
|
46
46
|
* dropped even though the CLI would otherwise leave it unmatched.
|
|
47
47
|
*/
|
|
48
48
|
export declare function applyAvailableModelsAllowlist(sdkModels: ModelInfo[], allowlist: string[], settingsModelOverrides?: Record<string, string>, deniedModels?: readonly string[]): ModelInfo[];
|
|
49
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Keep the SDK models the `providers/set` gateway listed (`listGatewayModels`,
|
|
51
|
+
* `listBedrockModels`). A row matches when its `resolvedModel` (or
|
|
52
|
+
* its `value` when the SDK gives none) names a listed model in any spelling:
|
|
53
|
+
* `claude-sonnet-5[1m]` matches a listed `claude-sonnet-5-20260101`, and
|
|
54
|
+
* `eu.anthropic.claude-sonnet-5` matches a listed `eu.anthropic.claude-sonnet-5-v1:0`.
|
|
55
|
+
*
|
|
56
|
+
* With a Bedrock `regionPrefix`, a row resolved to another cross-region prefix
|
|
57
|
+
* (`us.anthropic.claude-sonnet-5` under `eu`) is dropped even when the same
|
|
58
|
+
* model is listed under `eu`: the CLI would call it in the other region.
|
|
59
|
+
*
|
|
60
|
+
* A row the SDK gives no `resolvedModel` names its model only by an alias, so
|
|
61
|
+
* it is checked as far as the alias allows: `default` is kept, and a family
|
|
62
|
+
* alias such as `opus` is kept when the gateway lists a model of that family.
|
|
63
|
+
*
|
|
64
|
+
* When no row matches by its model (a `default` row kept only for lacking a
|
|
65
|
+
* `resolvedModel` does not count), the gateway serves none of the SDK's
|
|
66
|
+
* models, and nothing is left: the session offers no model.
|
|
67
|
+
*/
|
|
68
|
+
export declare function narrowToGatewayModels(models: ModelInfo[], listedModelIds: readonly string[], regionPrefix?: string): ModelInfo[];
|
|
69
|
+
export declare function getAvailableModels(query: Query, models: ModelInfo[], sdkModels: ModelInfo[], settingsManager: ModelSettingsSource, logger: ModelLogger, isResumedSession: boolean, sessionId: string, resumedModelHint?: string, narrowedByGateway?: boolean): Promise<SessionModelState>;
|
|
50
70
|
export {};
|
|
51
71
|
//# sourceMappingURL=session-model.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-model.d.ts","sourceRoot":"","sources":["../src/session-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"session-model.d.ts","sourceRoot":"","sources":["../src/session-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAIjF,eAAO,MAAM,eAAe,UAAU,CAAC;AAEvC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,eAAe,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChF,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IAClC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;CACrC,CAAC;AACF,KAAK,mBAAmB,GAAG;IAAE,WAAW,IAAI,QAAQ,CAAA;CAAE,CAAC;AAmGvD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,S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AirMeta } from "./air-extension.js";
|
|
2
|
+
import { bedrockRegionPrefix } from "./gateway-models.js";
|
|
2
3
|
export const MODEL_CONFIG_ID = "model";
|
|
3
4
|
const MODEL_CONTEXT_HINT_PATTERN = /\[(\d+m)\]$/i;
|
|
4
5
|
const CONTEXT_HINT_SUFFIX_PATTERN = /-(\d+m)$/i;
|
|
@@ -218,9 +219,10 @@ function resolveSettingsModel(models, settingsModel, logger) {
|
|
|
218
219
|
return resolveModelPreference(models, settingsModel);
|
|
219
220
|
}
|
|
220
221
|
const MODEL_FAMILY_ALIASES = new Set(["opus", "sonnet", "haiku", "fable"]);
|
|
221
|
-
/** A model id without the spellings
|
|
222
|
-
* prefixes, dates, version suffixes, `-fast` and context hints.
|
|
223
|
-
|
|
222
|
+
/** A model id without the spellings that name the same model: provider
|
|
223
|
+
* prefixes, dates, version suffixes, `-fast` and context hints. `deniedModels`
|
|
224
|
+
* and gateway listings both match on it. */
|
|
225
|
+
function normalizeModelId(value) {
|
|
224
226
|
let id = stripContextHints(value.trim().toLowerCase());
|
|
225
227
|
const providerPrefix = id.lastIndexOf("anthropic.");
|
|
226
228
|
if (providerPrefix !== -1)
|
|
@@ -239,11 +241,11 @@ function normalizeDeniedModelId(value) {
|
|
|
239
241
|
* the enforcer; this only keeps the picker from offering a refused row.
|
|
240
242
|
*/
|
|
241
243
|
export function isDeniedModel(modelId, deniedModels) {
|
|
242
|
-
const id =
|
|
244
|
+
const id = normalizeModelId(modelId);
|
|
243
245
|
if (!id)
|
|
244
246
|
return false;
|
|
245
247
|
return deniedModels.some((entry) => {
|
|
246
|
-
const denied =
|
|
248
|
+
const denied = normalizeModelId(entry);
|
|
247
249
|
if (!denied)
|
|
248
250
|
return false;
|
|
249
251
|
if (MODEL_FAMILY_ALIASES.has(denied))
|
|
@@ -324,6 +326,46 @@ export function applyAvailableModelsAllowlist(sdkModels, allowlist, settingsMode
|
|
|
324
326
|
}
|
|
325
327
|
return result;
|
|
326
328
|
}
|
|
329
|
+
/**
|
|
330
|
+
* Keep the SDK models the `providers/set` gateway listed (`listGatewayModels`,
|
|
331
|
+
* `listBedrockModels`). A row matches when its `resolvedModel` (or
|
|
332
|
+
* its `value` when the SDK gives none) names a listed model in any spelling:
|
|
333
|
+
* `claude-sonnet-5[1m]` matches a listed `claude-sonnet-5-20260101`, and
|
|
334
|
+
* `eu.anthropic.claude-sonnet-5` matches a listed `eu.anthropic.claude-sonnet-5-v1:0`.
|
|
335
|
+
*
|
|
336
|
+
* With a Bedrock `regionPrefix`, a row resolved to another cross-region prefix
|
|
337
|
+
* (`us.anthropic.claude-sonnet-5` under `eu`) is dropped even when the same
|
|
338
|
+
* model is listed under `eu`: the CLI would call it in the other region.
|
|
339
|
+
*
|
|
340
|
+
* A row the SDK gives no `resolvedModel` names its model only by an alias, so
|
|
341
|
+
* it is checked as far as the alias allows: `default` is kept, and a family
|
|
342
|
+
* alias such as `opus` is kept when the gateway lists a model of that family.
|
|
343
|
+
*
|
|
344
|
+
* When no row matches by its model (a `default` row kept only for lacking a
|
|
345
|
+
* `resolvedModel` does not count), the gateway serves none of the SDK's
|
|
346
|
+
* models, and nothing is left: the session offers no model.
|
|
347
|
+
*/
|
|
348
|
+
export function narrowToGatewayModels(models, listedModelIds, regionPrefix) {
|
|
349
|
+
const listed = new Set(listedModelIds.map(normalizeModelId).filter(Boolean));
|
|
350
|
+
const narrowed = models.filter((model) => {
|
|
351
|
+
const modelId = model.resolvedModel ?? model.value;
|
|
352
|
+
const prefix = bedrockRegionPrefix(modelId);
|
|
353
|
+
if (regionPrefix !== undefined && prefix !== undefined && prefix !== regionPrefix) {
|
|
354
|
+
return false;
|
|
355
|
+
}
|
|
356
|
+
const id = normalizeModelId(modelId);
|
|
357
|
+
if (listed.has(id))
|
|
358
|
+
return true;
|
|
359
|
+
if (model.resolvedModel !== undefined)
|
|
360
|
+
return false;
|
|
361
|
+
if (model.value === "default")
|
|
362
|
+
return true;
|
|
363
|
+
return MODEL_FAMILY_ALIASES.has(id) && [...listed].some((entry) => entry.includes(`-${id}`));
|
|
364
|
+
});
|
|
365
|
+
return narrowed.some((model) => listed.has(normalizeModelId(model.resolvedModel ?? model.value)))
|
|
366
|
+
? narrowed
|
|
367
|
+
: [];
|
|
368
|
+
}
|
|
327
369
|
/** Whether a rejected `setModel` was vetoed by a user-configured
|
|
328
370
|
* PreModelSwitch hook. The CLI's rejection message is the stable,
|
|
329
371
|
* distinguishable marker ("Model switch blocked by a PreModelSwitch hook:
|
|
@@ -332,7 +374,16 @@ export function applyAvailableModelsAllowlist(sdkModels, allowlist, settingsMode
|
|
|
332
374
|
function isPreModelSwitchHookBlock(error) {
|
|
333
375
|
return error instanceof Error && error.message.includes("blocked by a PreModelSwitch hook");
|
|
334
376
|
}
|
|
335
|
-
export async function getAvailableModels(query, models, sdkModels, settingsManager, logger, isResumedSession, sessionId, resumedModelHint) {
|
|
377
|
+
export async function getAvailableModels(query, models, sdkModels, settingsManager, logger, isResumedSession, sessionId, resumedModelHint, narrowedByGateway = false) {
|
|
378
|
+
// A gateway that lists none of the SDK's models leaves none to offer
|
|
379
|
+
// (`narrowToGatewayModels`). The session stays on the model the SDK runs,
|
|
380
|
+
// and the gateway refuses its requests.
|
|
381
|
+
if (models.length === 0) {
|
|
382
|
+
return {
|
|
383
|
+
availableModels: [],
|
|
384
|
+
currentModelId: (isResumedSession && resumedModelHint) || sdkModels[0]?.value || "default",
|
|
385
|
+
};
|
|
386
|
+
}
|
|
336
387
|
const settings = settingsManager.getSettings();
|
|
337
388
|
let currentModel = models[0];
|
|
338
389
|
let resolvedFromInput;
|
|
@@ -377,8 +428,31 @@ export async function getAvailableModels(query, models, sdkModels, settingsManag
|
|
|
377
428
|
// be re-asserted to keep the reported model truthful.
|
|
378
429
|
// Anything else (fuzzy match, allowlist-synthesized value, alias) gets a
|
|
379
430
|
// setModel call so we don't drift from the user's intended pin.
|
|
431
|
+
// Case (a) does not hold when `narrowToGatewayModels` left the SDK on a
|
|
432
|
+
// model the gateway does not list: the dropped `default` row of a fresh or
|
|
433
|
+
// transcript-less session, or a resumed transcript model outside the list.
|
|
434
|
+
// Such a session switches to models[0].
|
|
380
435
|
const sdkSawSameValue = sdkModels.some((m) => m.value === currentModel.value);
|
|
381
|
-
const
|
|
436
|
+
const sdkDefault = sdkModels.find((m) => m.value === "default");
|
|
437
|
+
const sdkDefaultDropped = sdkDefault !== undefined && !models.some((m) => m.value === "default");
|
|
438
|
+
let switchToListed = false;
|
|
439
|
+
if (resolvedFromInput === undefined) {
|
|
440
|
+
if (!isResumedSession || !resumedModelHint) {
|
|
441
|
+
switchToListed = sdkDefaultDropped;
|
|
442
|
+
}
|
|
443
|
+
else if (narrowedByGateway &&
|
|
444
|
+
(!models.some((m) => m.value === currentModel.value) ||
|
|
445
|
+
// A loose match can map the transcript's model onto a listed row of
|
|
446
|
+
// another version, which the CLI does not resume on.
|
|
447
|
+
(currentModel.resolvedModel !== undefined &&
|
|
448
|
+
normalizeModelId(currentModel.resolvedModel) !== normalizeModelId(resumedModelHint)))) {
|
|
449
|
+
currentModel = models[0];
|
|
450
|
+
switchToListed = true;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
// When the switch fails, the SDK stays on the model it ran before it.
|
|
454
|
+
const modelBeforeSwitch = () => switchToListed && sdkDefault !== undefined ? sdkDefault : models[0];
|
|
455
|
+
const skipSetModel = (resolvedFromInput === undefined && !switchToListed) ||
|
|
382
456
|
(!isResumedSession && currentModel.value === resolvedFromInput && sdkSawSameValue);
|
|
383
457
|
if (!skipSetModel) {
|
|
384
458
|
const setModelStartedAt = performance.now();
|
|
@@ -407,14 +481,18 @@ export async function getAvailableModels(query, models, sdkModels, settingsManag
|
|
|
407
481
|
// live model back on this path: getContextUsage isn't serviced on a
|
|
408
482
|
// fresh session until the first prompt turn (issues #886/#880).
|
|
409
483
|
if (!isResumedSession) {
|
|
410
|
-
|
|
484
|
+
// A switch onto a listed model is advisory too: the session stays on
|
|
485
|
+
// the model the SDK runs and reports it.
|
|
486
|
+
if (!switchToListed && !isPreModelSwitchHookBlock(error))
|
|
411
487
|
throw error;
|
|
412
|
-
logger.error(`Model
|
|
413
|
-
currentModel =
|
|
488
|
+
logger.error(`Model switch to "${currentModel.value}" failed or was vetoed by a PreModelSwitch hook; staying on the default model:`, error);
|
|
489
|
+
currentModel = modelBeforeSwitch();
|
|
414
490
|
}
|
|
415
491
|
else {
|
|
416
492
|
logger.error(`Failed to re-assert model "${currentModel.value}" on resume:`, error);
|
|
417
|
-
currentModel = resumedModelHint
|
|
493
|
+
currentModel = resumedModelHint
|
|
494
|
+
? matchResumedModel(models, resumedModelHint)
|
|
495
|
+
: modelBeforeSwitch();
|
|
418
496
|
}
|
|
419
497
|
}
|
|
420
498
|
}
|
|
@@ -90,6 +90,11 @@ export declare class AcpToolCallRenderer {
|
|
|
90
90
|
* the tool call's content already shows, which it would otherwise keep.
|
|
91
91
|
*/
|
|
92
92
|
private get keepsMeta();
|
|
93
|
+
/**
|
|
94
|
+
* Whether a tool call with these facts gets a display terminal: a command, for a client
|
|
95
|
+
* that renders terminals.
|
|
96
|
+
*/
|
|
97
|
+
private hasTerminal;
|
|
93
98
|
/**
|
|
94
99
|
* The status of a tool result. Claude Code reports a run that it aborted in
|
|
95
100
|
* one of three ways:
|
|
@@ -223,13 +228,21 @@ export declare class AcpToolCallRenderer {
|
|
|
223
228
|
* client `failed`, since v1 has no `cancelled`. If Claude Code ran it but
|
|
224
229
|
* returned no result, it failed, unless a `session/cancel` ended the turn
|
|
225
230
|
* (`cancelled`): the cancel stopped the run, so a v2 client gets `cancelled`
|
|
226
|
-
* for it too.
|
|
231
|
+
* for it too. The report does not end the call's terminal: see {@link terminalExit}.
|
|
227
232
|
*/
|
|
228
233
|
unfinished(call: {
|
|
229
234
|
toolCallId: string;
|
|
230
235
|
ran: boolean;
|
|
231
236
|
cancelled?: boolean;
|
|
232
237
|
}): ToolCallUpdate;
|
|
238
|
+
/**
|
|
239
|
+
* The `_meta` that ends the display terminal of a command whose tool call gets no result, to
|
|
240
|
+
* add to the report from {@link unfinished}. Undefined when the tool call has no terminal
|
|
241
|
+
* (see {@link toolCall}). The exit code is unknown, since the command ended without a result:
|
|
242
|
+
* null, or 1 for AIR, which always gets a number and reads 1 for a command that did not
|
|
243
|
+
* succeed.
|
|
244
|
+
*/
|
|
245
|
+
terminalExit(toolUse: ToolUse): Pick<ToolUpdateMeta, "terminal_exit"> | undefined;
|
|
233
246
|
/**
|
|
234
247
|
* The report of a tool progress beat. The field tracker sends the
|
|
235
248
|
* `in_progress` status once, so a later beat carries only the progress.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../src/tool-calls/renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,IAAI,qBAAqB,EAC3C,wBAAwB,EACxB,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACf,MAAM,0BAA0B,CAAC;AAQlC,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAM5F,MAAM,MAAM,cAAc,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;AAa3D,wFAAwF;AACxF,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAExF;AAED,yCAAyC;AACzC,MAAM,MAAM,cAAc,GAAG;IAC3B,UAAU,CAAC,EAAE;QAKX,QAAQ,CAAC,EAAE,MAAM,CAAC;QAKlB,YAAY,CAAC,EAAE,OAAO,CAAC;QAIvB,eAAe,CAAC,EAAE,MAAM,CAAC;QAMzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAG1B,YAAY,CAAC,EAAE,MAAM,CAAC;QAEtB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