@opencow-ai/opencow-agent-sdk 0.4.5 → 0.4.7
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/dist/capabilities/mcp/types.d.ts +1 -1
- package/dist/capabilities/tools/AgentTool/agentMerge.d.ts +8 -0
- package/dist/capabilities/tools/AgentTool/builtInAgents.d.ts +15 -0
- package/dist/capabilities/tools/AgentTool/runAgent.d.ts +13 -2
- package/dist/cli.mjs +477 -244
- package/dist/client.d.ts +10 -0
- package/dist/client.js +466 -216
- package/dist/constants/tools.d.ts +1 -1
- package/dist/controller/hooks.d.ts +17 -2
- package/dist/controller/loop.d.ts +2 -5
- package/dist/entrypoints/sdk/controlSchemas.d.ts +73 -1
- package/dist/entrypoints/sdk/coreSchemas.d.ts +17 -1
- package/dist/entrypoints/sdk/runtimeTypes.d.ts +22 -0
- package/dist/lib/envDynamic.d.ts +1 -1
- package/dist/lib/schemaSanitizer.d.ts +43 -0
- package/dist/providers/anthropic/teleport/api.d.ts +1 -1
- package/dist/providers/codex/shim.d.ts +1 -1
- package/dist/providers/openai/schema.d.ts +1 -1
- package/dist/providers/openai/shim.d.ts +2 -5
- package/dist/providers/openai/wire.d.ts +1 -1
- package/dist/providers/provider.d.ts +2 -5
- package/dist/providers/shared/clientFactory.d.ts +2 -5
- package/dist/providers/shared/routing.d.ts +37 -6
- package/dist/sdk.js +466 -216
- package/dist/session/backgroundAbortRegistry.d.ts +23 -0
- package/dist/types/toolRuntime.d.ts +8 -5
- package/package.json +1 -1
package/dist/sdk.js
CHANGED
|
@@ -63345,7 +63345,7 @@ function getToolNameForPermissionCheck(tool) {
|
|
|
63345
63345
|
var init_mcpStringUtils = () => {};
|
|
63346
63346
|
|
|
63347
63347
|
// src/constants/toolNames.ts
|
|
63348
|
-
var
|
|
63348
|
+
var AGENT_TOOL_NAME = "Agent", ASK_USER_QUESTION_TOOL_NAME = "AskUserQuestion", BASH_TOOL_NAME = "Bash", ENTER_PLAN_MODE_TOOL_NAME = "EnterPlanMode", ENTER_WORKTREE_TOOL_NAME = "EnterWorktree", EXIT_PLAN_MODE_TOOL_NAME = "ExitPlanMode", EXIT_PLAN_MODE_V2_TOOL_NAME = "ExitPlanMode", EXIT_WORKTREE_TOOL_NAME = "ExitWorktree", FILE_EDIT_TOOL_NAME = "Edit", FILE_READ_TOOL_NAME = "Read", FILE_WRITE_TOOL_NAME = "Write", GLOB_TOOL_NAME = "Glob", GREP_TOOL_NAME = "Grep", NOTEBOOK_EDIT_TOOL_NAME = "NotebookEdit", POWERSHELL_TOOL_NAME = "PowerShell", REPL_TOOL_NAME = "REPL", SEND_MESSAGE_TOOL_NAME = "SendMessage", SKILL_TOOL_NAME = "Skill", SLEEP_TOOL_NAME = "Sleep", SYNTHETIC_OUTPUT_TOOL_NAME = "StructuredOutput", TASK_CREATE_TOOL_NAME = "TaskCreate", TASK_GET_TOOL_NAME = "TaskGet", TASK_LIST_TOOL_NAME = "TaskList", TASK_OUTPUT_TOOL_NAME = "TaskOutput", TASK_STOP_TOOL_NAME = "TaskStop", TASK_UPDATE_TOOL_NAME = "TaskUpdate", TEAM_CREATE_TOOL_NAME = "TeamCreate", TEAM_DELETE_TOOL_NAME = "TeamDelete", TODO_WRITE_TOOL_NAME = "TodoWrite", TOOL_SEARCH_TOOL_NAME = "ToolSearch", EXPLORE_AGENT_TYPE = "Explore", PLAN_AGENT_TYPE = "Plan", WEB_FETCH_TOOL_NAME = "WebFetch", WEB_SEARCH_TOOL_NAME = "WebSearch";
|
|
63349
63349
|
|
|
63350
63350
|
// src/permissions/permissionRuleParser.ts
|
|
63351
63351
|
function normalizeLegacyToolName(name) {
|
|
@@ -63430,7 +63430,7 @@ function findLastUnescapedChar(str, char) {
|
|
|
63430
63430
|
var LEGACY_TOOL_NAME_ALIASES;
|
|
63431
63431
|
var init_permissionRuleParser = __esm(() => {
|
|
63432
63432
|
LEGACY_TOOL_NAME_ALIASES = {
|
|
63433
|
-
Task:
|
|
63433
|
+
Task: AGENT_TOOL_NAME,
|
|
63434
63434
|
KillShell: TASK_STOP_TOOL_NAME,
|
|
63435
63435
|
AgentOutputTool: TASK_OUTPUT_TOOL_NAME,
|
|
63436
63436
|
BashOutputTool: TASK_OUTPUT_TOOL_NAME,
|
|
@@ -95053,7 +95053,8 @@ function sanitizeSchemaForOpenAICompat(schema) {
|
|
|
95053
95053
|
}
|
|
95054
95054
|
}
|
|
95055
95055
|
if (Array.isArray(record3.required) && isSchemaRecord(record3.properties)) {
|
|
95056
|
-
|
|
95056
|
+
const properties = record3.properties;
|
|
95057
|
+
record3.required = record3.required.filter((value) => typeof value === "string" && (value in properties));
|
|
95057
95058
|
}
|
|
95058
95059
|
const schemaWithoutEnum = { ...record3 };
|
|
95059
95060
|
delete schemaWithoutEnum.enum;
|
|
@@ -95072,6 +95073,77 @@ function sanitizeSchemaForOpenAICompat(schema) {
|
|
|
95072
95073
|
}
|
|
95073
95074
|
return record3;
|
|
95074
95075
|
}
|
|
95076
|
+
function isEmptyStrictObject(schema) {
|
|
95077
|
+
if (schema.type !== "object" || schema.additionalProperties !== false) {
|
|
95078
|
+
return false;
|
|
95079
|
+
}
|
|
95080
|
+
const props = schema.properties;
|
|
95081
|
+
return !props || isSchemaRecord(props) && Object.keys(props).length === 0;
|
|
95082
|
+
}
|
|
95083
|
+
function strictifySchemaNode(schema, options, topLevel) {
|
|
95084
|
+
const {
|
|
95085
|
+
gemini = false,
|
|
95086
|
+
strict = true,
|
|
95087
|
+
stripUriFormat = false,
|
|
95088
|
+
dropEmptyObjectProperties = false,
|
|
95089
|
+
normalizeBareObjects = false
|
|
95090
|
+
} = options;
|
|
95091
|
+
let record3 = sanitizeSchemaForOpenAICompat(schema);
|
|
95092
|
+
if (gemini) {
|
|
95093
|
+
record3 = splitTypeArrayToAnyOf(record3);
|
|
95094
|
+
}
|
|
95095
|
+
if (stripUriFormat && record3.format === "uri") {
|
|
95096
|
+
delete record3.format;
|
|
95097
|
+
}
|
|
95098
|
+
if (record3.type === "object") {
|
|
95099
|
+
const props = isSchemaRecord(record3.properties) ? record3.properties : null;
|
|
95100
|
+
if (props) {
|
|
95101
|
+
const originalRequired = Array.isArray(record3.required) ? record3.required.filter((key) => typeof key === "string") : [];
|
|
95102
|
+
const enforcedProps = {};
|
|
95103
|
+
for (const [key, value] of Object.entries(props)) {
|
|
95104
|
+
const strictValue = strictifySchemaNode(value, options, false);
|
|
95105
|
+
if (dropEmptyObjectProperties && isEmptyStrictObject(strictValue)) {
|
|
95106
|
+
continue;
|
|
95107
|
+
}
|
|
95108
|
+
enforcedProps[key] = strictValue;
|
|
95109
|
+
}
|
|
95110
|
+
record3.properties = enforcedProps;
|
|
95111
|
+
if (strict) {
|
|
95112
|
+
record3.additionalProperties = false;
|
|
95113
|
+
record3.required = Object.keys(enforcedProps);
|
|
95114
|
+
if (topLevel) {
|
|
95115
|
+
const style = gemini ? "nullable" : "union";
|
|
95116
|
+
for (const key of Object.keys(enforcedProps)) {
|
|
95117
|
+
if (!originalRequired.includes(key)) {
|
|
95118
|
+
enforcedProps[key] = makeSchemaNullable(enforcedProps[key], style);
|
|
95119
|
+
}
|
|
95120
|
+
}
|
|
95121
|
+
}
|
|
95122
|
+
} else {
|
|
95123
|
+
record3.required = originalRequired.filter((key) => (key in enforcedProps));
|
|
95124
|
+
}
|
|
95125
|
+
} else if (normalizeBareObjects) {
|
|
95126
|
+
record3.additionalProperties = false;
|
|
95127
|
+
record3.required = [];
|
|
95128
|
+
}
|
|
95129
|
+
}
|
|
95130
|
+
if ("items" in record3) {
|
|
95131
|
+
if (Array.isArray(record3.items)) {
|
|
95132
|
+
record3.items = record3.items.map((item) => strictifySchemaNode(item, options, false));
|
|
95133
|
+
} else {
|
|
95134
|
+
record3.items = strictifySchemaNode(record3.items, options, false);
|
|
95135
|
+
}
|
|
95136
|
+
}
|
|
95137
|
+
for (const key of ["anyOf", "oneOf", "allOf"]) {
|
|
95138
|
+
if (key in record3 && Array.isArray(record3[key])) {
|
|
95139
|
+
record3[key] = record3[key].map((item) => strictifySchemaNode(item, options, false));
|
|
95140
|
+
}
|
|
95141
|
+
}
|
|
95142
|
+
return record3;
|
|
95143
|
+
}
|
|
95144
|
+
function strictifyJsonSchema(schema, options = {}) {
|
|
95145
|
+
return strictifySchemaNode(schema, options, true);
|
|
95146
|
+
}
|
|
95075
95147
|
var OPENAI_INCOMPATIBLE_SCHEMA_KEYWORDS;
|
|
95076
95148
|
var init_schemaSanitizer = __esm(() => {
|
|
95077
95149
|
OPENAI_INCOMPATIBLE_SCHEMA_KEYWORDS = new Set([
|
|
@@ -95100,6 +95172,51 @@ var init_schema = __esm(() => {
|
|
|
95100
95172
|
init_schemaSanitizer();
|
|
95101
95173
|
});
|
|
95102
95174
|
|
|
95175
|
+
// src/providers/openai/capabilities.ts
|
|
95176
|
+
function supportsReasoningEffort(model) {
|
|
95177
|
+
return /^(o\d|gpt-5|gpt-4\.5)/i.test(model);
|
|
95178
|
+
}
|
|
95179
|
+
function isGeminiLikeModel(model) {
|
|
95180
|
+
const normalized = (model ?? "").trim().toLowerCase();
|
|
95181
|
+
return normalized.startsWith("gemini-") || normalized.includes("/gemini-");
|
|
95182
|
+
}
|
|
95183
|
+
function isGeminiTarget(model) {
|
|
95184
|
+
if (isEnvTruthy(getQueryEnvVar("CLAUDE_CODE_USE_GEMINI")))
|
|
95185
|
+
return true;
|
|
95186
|
+
return isGeminiLikeModel(model);
|
|
95187
|
+
}
|
|
95188
|
+
function supportsParallelToolCalls(model) {
|
|
95189
|
+
return !isGeminiTarget(model);
|
|
95190
|
+
}
|
|
95191
|
+
function getOpenAICompatMaxOutputTokens(model) {
|
|
95192
|
+
const max = getOpenAIMaxOutputTokens(model);
|
|
95193
|
+
if (max === undefined)
|
|
95194
|
+
return null;
|
|
95195
|
+
return { default: max, upperLimit: max };
|
|
95196
|
+
}
|
|
95197
|
+
function getOpenAICompatContextWindow(model) {
|
|
95198
|
+
return getOpenAIContextWindow(model) ?? null;
|
|
95199
|
+
}
|
|
95200
|
+
function openAICompatSupports(feature, model) {
|
|
95201
|
+
if (feature === "reasoning-effort")
|
|
95202
|
+
return supportsReasoningEffort(model);
|
|
95203
|
+
if (feature === "parallel-tool-calls")
|
|
95204
|
+
return supportsParallelToolCalls(model);
|
|
95205
|
+
return FEATURES_OPENAI_COMPAT.includes(feature);
|
|
95206
|
+
}
|
|
95207
|
+
var FEATURES_OPENAI_COMPAT;
|
|
95208
|
+
var init_capabilities2 = __esm(() => {
|
|
95209
|
+
init_openaiContextWindows();
|
|
95210
|
+
init_envUtils();
|
|
95211
|
+
init_state2();
|
|
95212
|
+
FEATURES_OPENAI_COMPAT = Object.freeze([
|
|
95213
|
+
"streaming",
|
|
95214
|
+
"tool-use",
|
|
95215
|
+
"image-input",
|
|
95216
|
+
"system-message-top-level"
|
|
95217
|
+
]);
|
|
95218
|
+
});
|
|
95219
|
+
|
|
95103
95220
|
// src/providers/codex/shim.ts
|
|
95104
95221
|
function parseSseChunk(chunk) {
|
|
95105
95222
|
const lines = chunk.split(`
|
|
@@ -95342,58 +95459,23 @@ function convertAnthropicMessagesToResponsesInput(messages) {
|
|
|
95342
95459
|
}
|
|
95343
95460
|
return items.filter((item) => item.type !== "message" || item.content.length > 0);
|
|
95344
95461
|
}
|
|
95345
|
-
function
|
|
95346
|
-
|
|
95347
|
-
|
|
95348
|
-
|
|
95349
|
-
|
|
95350
|
-
|
|
95351
|
-
|
|
95352
|
-
|
|
95353
|
-
const props = record3.properties;
|
|
95354
|
-
const originalRequired = Array.isArray(record3.required) ? record3.required.filter((key) => typeof key === "string") : [];
|
|
95355
|
-
const enforcedProps = {};
|
|
95356
|
-
for (const [key, value] of Object.entries(props)) {
|
|
95357
|
-
const strictValue = enforceStrictSchema(value, false);
|
|
95358
|
-
if (strictValue && typeof strictValue === "object" && strictValue.type === "object" && strictValue.additionalProperties === false && (!strictValue.properties || Object.keys(strictValue.properties).length === 0)) {
|
|
95359
|
-
continue;
|
|
95360
|
-
}
|
|
95361
|
-
enforcedProps[key] = strictValue;
|
|
95362
|
-
}
|
|
95363
|
-
record3.properties = enforcedProps;
|
|
95364
|
-
record3.required = Object.keys(enforcedProps);
|
|
95365
|
-
if (topLevel) {
|
|
95366
|
-
for (const key of Object.keys(enforcedProps)) {
|
|
95367
|
-
if (!originalRequired.includes(key)) {
|
|
95368
|
-
enforcedProps[key] = makeSchemaNullable(enforcedProps[key]);
|
|
95369
|
-
}
|
|
95370
|
-
}
|
|
95371
|
-
}
|
|
95372
|
-
} else {
|
|
95373
|
-
record3.required = [];
|
|
95374
|
-
}
|
|
95375
|
-
}
|
|
95376
|
-
if ("items" in record3) {
|
|
95377
|
-
if (Array.isArray(record3.items)) {
|
|
95378
|
-
record3.items = record3.items.map((item) => enforceStrictSchema(item, false));
|
|
95379
|
-
} else {
|
|
95380
|
-
record3.items = enforceStrictSchema(record3.items, false);
|
|
95381
|
-
}
|
|
95382
|
-
}
|
|
95383
|
-
for (const key of ["anyOf", "oneOf", "allOf"]) {
|
|
95384
|
-
if (key in record3 && Array.isArray(record3[key])) {
|
|
95385
|
-
record3[key] = record3[key].map((item) => enforceStrictSchema(item, false));
|
|
95386
|
-
}
|
|
95387
|
-
}
|
|
95388
|
-
return record3;
|
|
95462
|
+
function toResponsesParameters(schema, geminiTarget) {
|
|
95463
|
+
return strictifyJsonSchema(schema, {
|
|
95464
|
+
strict: true,
|
|
95465
|
+
gemini: geminiTarget,
|
|
95466
|
+
stripUriFormat: true,
|
|
95467
|
+
dropEmptyObjectProperties: true,
|
|
95468
|
+
normalizeBareObjects: true
|
|
95469
|
+
});
|
|
95389
95470
|
}
|
|
95390
|
-
function convertToolsToResponsesTools(tools) {
|
|
95471
|
+
function convertToolsToResponsesTools(tools, model = "") {
|
|
95472
|
+
const geminiTarget = isGeminiTarget(model);
|
|
95391
95473
|
return tools.flatMap((tool) => {
|
|
95392
95474
|
if (tool.input_schema && (!tool.type || tool.type === "function")) {
|
|
95393
95475
|
if (!tool.name || tool.name === "ToolSearchTool")
|
|
95394
95476
|
return [];
|
|
95395
95477
|
const rawParameters = tool.input_schema ?? { type: "object", properties: {} };
|
|
95396
|
-
const parameters =
|
|
95478
|
+
const parameters = toResponsesParameters(rawParameters, geminiTarget);
|
|
95397
95479
|
return [
|
|
95398
95480
|
{
|
|
95399
95481
|
type: "function",
|
|
@@ -95408,7 +95490,7 @@ function convertToolsToResponsesTools(tools) {
|
|
|
95408
95490
|
return [tool];
|
|
95409
95491
|
}
|
|
95410
95492
|
if (tool.name && tool.name !== "ToolSearchTool" && (!tool.type || tool.type === "function")) {
|
|
95411
|
-
const parameters =
|
|
95493
|
+
const parameters = toResponsesParameters({ type: "object", properties: {} }, geminiTarget);
|
|
95412
95494
|
return [
|
|
95413
95495
|
{
|
|
95414
95496
|
type: "function",
|
|
@@ -95475,10 +95557,10 @@ async function performCodexRequest(options) {
|
|
|
95475
95557
|
body.tool_choice = toolChoice;
|
|
95476
95558
|
}
|
|
95477
95559
|
if (options.params.tools && options.params.tools.length > 0) {
|
|
95478
|
-
const convertedTools = convertToolsToResponsesTools(options.params.tools);
|
|
95560
|
+
const convertedTools = convertToolsToResponsesTools(options.params.tools, options.request.resolvedModel);
|
|
95479
95561
|
if (convertedTools.length > 0) {
|
|
95480
95562
|
body.tools = convertedTools;
|
|
95481
|
-
body.parallel_tool_calls =
|
|
95563
|
+
body.parallel_tool_calls = !isGeminiTarget(options.request.resolvedModel);
|
|
95482
95564
|
body.tool_choice ??= "auto";
|
|
95483
95565
|
}
|
|
95484
95566
|
}
|
|
@@ -95848,6 +95930,7 @@ function convertCodexResponseToAnthropicMessage(data, model) {
|
|
|
95848
95930
|
var init_shim = __esm(() => {
|
|
95849
95931
|
init_sdk();
|
|
95850
95932
|
init_schema();
|
|
95933
|
+
init_capabilities2();
|
|
95851
95934
|
});
|
|
95852
95935
|
|
|
95853
95936
|
// src/providers/shared/providerRecommendation.ts
|
|
@@ -95925,51 +96008,6 @@ var init_providerProfile = __esm(() => {
|
|
|
95925
96008
|
];
|
|
95926
96009
|
});
|
|
95927
96010
|
|
|
95928
|
-
// src/providers/openai/capabilities.ts
|
|
95929
|
-
function supportsReasoningEffort(model) {
|
|
95930
|
-
return /^(o\d|gpt-5|gpt-4\.5)/i.test(model);
|
|
95931
|
-
}
|
|
95932
|
-
function isGeminiLikeModel(model) {
|
|
95933
|
-
const normalized = (model ?? "").trim().toLowerCase();
|
|
95934
|
-
return normalized.startsWith("gemini-") || normalized.includes("/gemini-");
|
|
95935
|
-
}
|
|
95936
|
-
function isGeminiTarget(model) {
|
|
95937
|
-
if (isEnvTruthy(getQueryEnvVar("CLAUDE_CODE_USE_GEMINI")))
|
|
95938
|
-
return true;
|
|
95939
|
-
return isGeminiLikeModel(model);
|
|
95940
|
-
}
|
|
95941
|
-
function supportsParallelToolCalls(model) {
|
|
95942
|
-
return !isGeminiTarget(model);
|
|
95943
|
-
}
|
|
95944
|
-
function getOpenAICompatMaxOutputTokens(model) {
|
|
95945
|
-
const max = getOpenAIMaxOutputTokens(model);
|
|
95946
|
-
if (max === undefined)
|
|
95947
|
-
return null;
|
|
95948
|
-
return { default: max, upperLimit: max };
|
|
95949
|
-
}
|
|
95950
|
-
function getOpenAICompatContextWindow(model) {
|
|
95951
|
-
return getOpenAIContextWindow(model) ?? null;
|
|
95952
|
-
}
|
|
95953
|
-
function openAICompatSupports(feature, model) {
|
|
95954
|
-
if (feature === "reasoning-effort")
|
|
95955
|
-
return supportsReasoningEffort(model);
|
|
95956
|
-
if (feature === "parallel-tool-calls")
|
|
95957
|
-
return supportsParallelToolCalls(model);
|
|
95958
|
-
return FEATURES_OPENAI_COMPAT.includes(feature);
|
|
95959
|
-
}
|
|
95960
|
-
var FEATURES_OPENAI_COMPAT;
|
|
95961
|
-
var init_capabilities2 = __esm(() => {
|
|
95962
|
-
init_openaiContextWindows();
|
|
95963
|
-
init_envUtils();
|
|
95964
|
-
init_state2();
|
|
95965
|
-
FEATURES_OPENAI_COMPAT = Object.freeze([
|
|
95966
|
-
"streaming",
|
|
95967
|
-
"tool-use",
|
|
95968
|
-
"image-input",
|
|
95969
|
-
"system-message-top-level"
|
|
95970
|
-
]);
|
|
95971
|
-
});
|
|
95972
|
-
|
|
95973
96011
|
// src/providers/openai/shim.ts
|
|
95974
96012
|
var exports_shim = {};
|
|
95975
96013
|
__export(exports_shim, {
|
|
@@ -96197,49 +96235,6 @@ function convertMessages(messages, system) {
|
|
|
96197
96235
|
}
|
|
96198
96236
|
return result;
|
|
96199
96237
|
}
|
|
96200
|
-
function normalizeSchemaForOpenAI(schema, strict = true, topLevel = true, geminiTarget = false) {
|
|
96201
|
-
let record3 = sanitizeSchemaForOpenAICompat(schema);
|
|
96202
|
-
if (geminiTarget) {
|
|
96203
|
-
record3 = splitTypeArrayToAnyOf(record3);
|
|
96204
|
-
}
|
|
96205
|
-
if (record3.type === "object" && record3.properties) {
|
|
96206
|
-
const properties = record3.properties;
|
|
96207
|
-
const existingRequired = Array.isArray(record3.required) ? record3.required : [];
|
|
96208
|
-
const normalizedProps = {};
|
|
96209
|
-
for (const [key, value] of Object.entries(properties)) {
|
|
96210
|
-
normalizedProps[key] = normalizeSchemaForOpenAI(value, strict, false, geminiTarget);
|
|
96211
|
-
}
|
|
96212
|
-
record3.properties = normalizedProps;
|
|
96213
|
-
if (strict) {
|
|
96214
|
-
const allKeys = Object.keys(normalizedProps);
|
|
96215
|
-
record3.required = Array.from(new Set([...existingRequired, ...allKeys]));
|
|
96216
|
-
record3.additionalProperties = false;
|
|
96217
|
-
if (topLevel) {
|
|
96218
|
-
const style = geminiTarget ? "nullable" : "union";
|
|
96219
|
-
for (const key of allKeys) {
|
|
96220
|
-
if (!existingRequired.includes(key)) {
|
|
96221
|
-
normalizedProps[key] = makeSchemaNullable(normalizedProps[key], style);
|
|
96222
|
-
}
|
|
96223
|
-
}
|
|
96224
|
-
}
|
|
96225
|
-
} else {
|
|
96226
|
-
record3.required = existingRequired.filter((k) => (k in normalizedProps));
|
|
96227
|
-
}
|
|
96228
|
-
}
|
|
96229
|
-
if ("items" in record3) {
|
|
96230
|
-
if (Array.isArray(record3.items)) {
|
|
96231
|
-
record3.items = record3.items.map((item) => normalizeSchemaForOpenAI(item, strict, false, geminiTarget));
|
|
96232
|
-
} else {
|
|
96233
|
-
record3.items = normalizeSchemaForOpenAI(record3.items, strict, false, geminiTarget);
|
|
96234
|
-
}
|
|
96235
|
-
}
|
|
96236
|
-
for (const key of ["anyOf", "oneOf", "allOf"]) {
|
|
96237
|
-
if (key in record3 && Array.isArray(record3[key])) {
|
|
96238
|
-
record3[key] = record3[key].map((item) => normalizeSchemaForOpenAI(item, strict, false, geminiTarget));
|
|
96239
|
-
}
|
|
96240
|
-
}
|
|
96241
|
-
return record3;
|
|
96242
|
-
}
|
|
96243
96238
|
function convertTools(tools, model = "") {
|
|
96244
96239
|
const isGemini = isEnvTruthy(getQueryEnvVar("CLAUDE_CODE_USE_GEMINI"));
|
|
96245
96240
|
const geminiTarget = isGeminiTarget(model);
|
|
@@ -96260,7 +96255,7 @@ function convertTools(tools, model = "") {
|
|
|
96260
96255
|
function: {
|
|
96261
96256
|
name: t.name,
|
|
96262
96257
|
description: t.description ?? "",
|
|
96263
|
-
parameters:
|
|
96258
|
+
parameters: strictifyJsonSchema(schema, { strict: !isGemini, gemini: geminiTarget })
|
|
96264
96259
|
}
|
|
96265
96260
|
};
|
|
96266
96261
|
});
|
|
@@ -96699,7 +96694,8 @@ class OpenAIShimMessages {
|
|
|
96699
96694
|
const self2 = this;
|
|
96700
96695
|
let httpResponse;
|
|
96701
96696
|
const promise3 = (async () => {
|
|
96702
|
-
const
|
|
96697
|
+
const overrideTransport = self2.providerOverride?.transport === "anthropic" ? undefined : self2.providerOverride?.transport;
|
|
96698
|
+
const request = resolveProviderRequest({ model: self2.providerOverride?.model ?? params.model, baseUrl: self2.providerOverride?.baseURL, reasoningEffortOverride: self2.reasoningEffort, transportOverride: overrideTransport });
|
|
96703
96699
|
const response = await self2._doRequest(request, params, options);
|
|
96704
96700
|
httpResponse = response;
|
|
96705
96701
|
if (params.stream) {
|
|
@@ -96724,7 +96720,7 @@ class OpenAIShimMessages {
|
|
|
96724
96720
|
}
|
|
96725
96721
|
async _doRequest(request, params, options) {
|
|
96726
96722
|
if (request.transport === "openai_responses") {
|
|
96727
|
-
const credentials = resolveOpenAIResponsesCredentials();
|
|
96723
|
+
const credentials = this.providerOverride?.apiKey ? { apiKey: this.providerOverride.apiKey, source: "env-openai" } : resolveOpenAIResponsesCredentials();
|
|
96728
96724
|
if (!credentials.apiKey) {
|
|
96729
96725
|
const safeModel = redactSecretValueForDisplay(request.requestedModel, process.env) ?? "the requested model";
|
|
96730
96726
|
const codexAuthHint = credentials.authPath ? `, set CODEX_API_KEY, or place a Codex auth.json at ${credentials.authPath}` : " or set CODEX_API_KEY";
|
|
@@ -96743,7 +96739,7 @@ class OpenAIShimMessages {
|
|
|
96743
96739
|
...options?.headers ?? {}
|
|
96744
96740
|
},
|
|
96745
96741
|
signal: options?.signal,
|
|
96746
|
-
providerSpecific: readOpenAIResponsesProviderSpecific()
|
|
96742
|
+
providerSpecific: this.providerOverride?.providerSpecific?.openaiResponses ?? readOpenAIResponsesProviderSpecific()
|
|
96747
96743
|
});
|
|
96748
96744
|
}
|
|
96749
96745
|
return this._doOpenAIRequest(request, params, options);
|
|
@@ -97050,7 +97046,6 @@ async function getNormalizedClient({
|
|
|
97050
97046
|
}
|
|
97051
97047
|
};
|
|
97052
97048
|
if (providerOverride) {
|
|
97053
|
-
const { createOpenAIShimClient: createOpenAIShimClient2 } = await Promise.resolve().then(() => (init_shim2(), exports_shim));
|
|
97054
97049
|
const safeHeaders = {};
|
|
97055
97050
|
for (const [k, v] of Object.entries(defaultHeaders)) {
|
|
97056
97051
|
const lower = k.toLowerCase();
|
|
@@ -97058,6 +97053,18 @@ async function getNormalizedClient({
|
|
|
97058
97053
|
continue;
|
|
97059
97054
|
safeHeaders[k] = v;
|
|
97060
97055
|
}
|
|
97056
|
+
if (providerOverride.transport === "anthropic") {
|
|
97057
|
+
const overrideToken = providerOverride.apiKey ?? getQueryEnvVar("ANTHROPIC_AUTH_TOKEN");
|
|
97058
|
+
return new Anthropic({
|
|
97059
|
+
apiKey: null,
|
|
97060
|
+
...overrideToken ? { authToken: overrideToken } : {},
|
|
97061
|
+
...providerOverride.baseURL ? { baseURL: providerOverride.baseURL } : {},
|
|
97062
|
+
...ARGS,
|
|
97063
|
+
defaultHeaders: safeHeaders,
|
|
97064
|
+
...isDebugToStdErr() && { logger: createStderrLogger() }
|
|
97065
|
+
});
|
|
97066
|
+
}
|
|
97067
|
+
const { createOpenAIShimClient: createOpenAIShimClient2 } = await Promise.resolve().then(() => (init_shim2(), exports_shim));
|
|
97061
97068
|
return createOpenAIShimClient2({
|
|
97062
97069
|
defaultHeaders: safeHeaders,
|
|
97063
97070
|
maxRetries,
|
|
@@ -97535,6 +97542,13 @@ function resolveProviderFromEnv(envOverride) {
|
|
|
97535
97542
|
const model = readEnv2(envOverride, "OPENAI_MODEL")?.trim() ?? "";
|
|
97536
97543
|
return model && isCodexAlias(model) ? providers.codex() : providers.openai();
|
|
97537
97544
|
}
|
|
97545
|
+
const transport = readEnv2(envOverride, QUERY_ENV_KEY_TRANSPORT_OVERRIDE)?.trim();
|
|
97546
|
+
if (transport === "openai_responses" || transport === "codex_responses") {
|
|
97547
|
+
return providers.codex();
|
|
97548
|
+
}
|
|
97549
|
+
if (transport === "chat_completions") {
|
|
97550
|
+
return providers.openai();
|
|
97551
|
+
}
|
|
97538
97552
|
if (envOverride) {
|
|
97539
97553
|
const hasOAuthToken = Boolean(readEnv2(envOverride, "CLAUDE_CODE_OAUTH_TOKEN"));
|
|
97540
97554
|
return providers.anthropic({
|
|
@@ -107607,7 +107621,7 @@ var init_paths2 = __esm(() => {
|
|
|
107607
107621
|
});
|
|
107608
107622
|
|
|
107609
107623
|
// src/capabilities/tools/AgentTool/constants.ts
|
|
107610
|
-
var
|
|
107624
|
+
var AGENT_TOOL_NAME2 = "Agent", LEGACY_AGENT_TOOL_NAME = "Task", VERIFICATION_AGENT_TYPE = "verification", ONE_SHOT_BUILTIN_AGENT_TYPES;
|
|
107611
107625
|
var init_constants4 = __esm(() => {
|
|
107612
107626
|
ONE_SHOT_BUILTIN_AGENT_TYPES = new Set([
|
|
107613
107627
|
"Explore",
|
|
@@ -107719,7 +107733,7 @@ function getDescription() {
|
|
|
107719
107733
|
- Supports full regex syntax (e.g., "log.*Error", "function\\s+\\w+")
|
|
107720
107734
|
- Filter files with glob parameter (e.g., "*.js", "**/*.tsx") or type parameter (e.g., "js", "py", "rust")
|
|
107721
107735
|
- Output modes: "content" shows matching lines, "files_with_matches" shows only file paths (default), "count" shows match counts
|
|
107722
|
-
- Use ${
|
|
107736
|
+
- Use ${AGENT_TOOL_NAME2} tool for open-ended searches requiring multiple rounds
|
|
107723
107737
|
- Pattern syntax: Uses ripgrep (not grep) - literal braces need escaping (use \`interface\\{\\}\` to find \`interface{}\` in Go code)
|
|
107724
107738
|
- Multiline matching: By default patterns match within single lines only. For cross-line patterns like \`struct \\{[\\s\\S]*?field\`, use \`multiline: true\`
|
|
107725
107739
|
`;
|
|
@@ -107756,7 +107770,7 @@ var init_constants5 = __esm(() => {
|
|
|
107756
107770
|
GREP_TOOL_NAME2,
|
|
107757
107771
|
BASH_TOOL_NAME2,
|
|
107758
107772
|
NOTEBOOK_EDIT_TOOL_NAME2,
|
|
107759
|
-
|
|
107773
|
+
AGENT_TOOL_NAME2
|
|
107760
107774
|
]);
|
|
107761
107775
|
});
|
|
107762
107776
|
|
|
@@ -223852,7 +223866,7 @@ var init_tools = __esm(() => {
|
|
|
223852
223866
|
TASK_OUTPUT_TOOL_NAME,
|
|
223853
223867
|
EXIT_PLAN_MODE_V2_TOOL_NAME,
|
|
223854
223868
|
ENTER_PLAN_MODE_TOOL_NAME,
|
|
223855
|
-
...process.env.USER_TYPE === "ant" ? [] : [
|
|
223869
|
+
...process.env.USER_TYPE === "ant" ? [] : [AGENT_TOOL_NAME],
|
|
223856
223870
|
ASK_USER_QUESTION_TOOL_NAME,
|
|
223857
223871
|
TASK_STOP_TOOL_NAME,
|
|
223858
223872
|
...[]
|
|
@@ -223886,7 +223900,7 @@ var init_tools = __esm(() => {
|
|
|
223886
223900
|
...[]
|
|
223887
223901
|
]);
|
|
223888
223902
|
COORDINATOR_MODE_ALLOWED_TOOLS = new Set([
|
|
223889
|
-
|
|
223903
|
+
AGENT_TOOL_NAME,
|
|
223890
223904
|
TASK_STOP_TOOL_NAME,
|
|
223891
223905
|
SEND_MESSAGE_TOOL_NAME,
|
|
223892
223906
|
SYNTHETIC_OUTPUT_TOOL_NAME
|
|
@@ -231974,7 +231988,7 @@ var init_exploreAgent = __esm(() => {
|
|
|
231974
231988
|
agentType: "Explore",
|
|
231975
231989
|
whenToUse: EXPLORE_WHEN_TO_USE,
|
|
231976
231990
|
disallowedTools: [
|
|
231977
|
-
|
|
231991
|
+
AGENT_TOOL_NAME,
|
|
231978
231992
|
EXIT_PLAN_MODE_TOOL_NAME,
|
|
231979
231993
|
FILE_EDIT_TOOL_NAME,
|
|
231980
231994
|
FILE_WRITE_TOOL_NAME,
|
|
@@ -232080,7 +232094,7 @@ var init_planAgent = __esm(() => {
|
|
|
232080
232094
|
agentType: "Plan",
|
|
232081
232095
|
whenToUse: "Software architect agent for designing implementation plans. Use this when you need to plan the implementation strategy for a task. Returns step-by-step plans, identifies critical files, and considers architectural trade-offs.",
|
|
232082
232096
|
disallowedTools: [
|
|
232083
|
-
|
|
232097
|
+
AGENT_TOOL_NAME2,
|
|
232084
232098
|
EXIT_PLAN_MODE_TOOL_NAME,
|
|
232085
232099
|
FILE_EDIT_TOOL_NAME,
|
|
232086
232100
|
FILE_WRITE_TOOL_NAME,
|
|
@@ -232368,7 +232382,23 @@ Use the literal string \`VERDICT: \` followed by exactly one of \`PASS\`, \`FAIL
|
|
|
232368
232382
|
- **PARTIAL**: what was verified, what could not be and why (missing tool/env), what the implementer should know.`;
|
|
232369
232383
|
});
|
|
232370
232384
|
|
|
232385
|
+
// src/capabilities/tools/AgentTool/agentMerge.ts
|
|
232386
|
+
function mergeAgentsByType(base2, override) {
|
|
232387
|
+
const byType = new Map;
|
|
232388
|
+
for (const agent of base2)
|
|
232389
|
+
byType.set(agent.agentType, agent);
|
|
232390
|
+
for (const agent of override)
|
|
232391
|
+
byType.set(agent.agentType, agent);
|
|
232392
|
+
return [...byType.values()];
|
|
232393
|
+
}
|
|
232394
|
+
|
|
232371
232395
|
// src/capabilities/tools/AgentTool/builtInAgents.ts
|
|
232396
|
+
var exports_builtInAgents = {};
|
|
232397
|
+
__export(exports_builtInAgents, {
|
|
232398
|
+
resolveSdkAgents: () => resolveSdkAgents,
|
|
232399
|
+
getBuiltInAgents: () => getBuiltInAgents,
|
|
232400
|
+
areExplorePlanAgentsEnabled: () => areExplorePlanAgentsEnabled
|
|
232401
|
+
});
|
|
232372
232402
|
function areExplorePlanAgentsEnabled() {
|
|
232373
232403
|
if (false) {}
|
|
232374
232404
|
return false;
|
|
@@ -232392,6 +232422,9 @@ function getBuiltInAgents() {
|
|
|
232392
232422
|
if (false) {}
|
|
232393
232423
|
return agents;
|
|
232394
232424
|
}
|
|
232425
|
+
function resolveSdkAgents(hostAgents) {
|
|
232426
|
+
return mergeAgentsByType(getBuiltInAgents(), hostAgents);
|
|
232427
|
+
}
|
|
232395
232428
|
var init_builtInAgents = __esm(() => {
|
|
232396
232429
|
init_state();
|
|
232397
232430
|
init_envUtils();
|
|
@@ -234462,6 +234495,34 @@ var init_registerFrontmatterHooks = __esm(() => {
|
|
|
234462
234495
|
init_sessionHooks();
|
|
234463
234496
|
});
|
|
234464
234497
|
|
|
234498
|
+
// src/session/backgroundAbortRegistry.ts
|
|
234499
|
+
function registerBackgroundAgentAbort(agentId, controller) {
|
|
234500
|
+
runs.set(agentId, { controller, stopFired: false });
|
|
234501
|
+
}
|
|
234502
|
+
function unregisterBackgroundAgentAbort(agentId) {
|
|
234503
|
+
runs.delete(agentId);
|
|
234504
|
+
}
|
|
234505
|
+
function abortBackgroundAgentById(agentId) {
|
|
234506
|
+
const run = runs.get(agentId);
|
|
234507
|
+
if (!run)
|
|
234508
|
+
return false;
|
|
234509
|
+
run.controller.abort();
|
|
234510
|
+
return true;
|
|
234511
|
+
}
|
|
234512
|
+
function markSubagentStopFired(agentId) {
|
|
234513
|
+
const run = runs.get(agentId);
|
|
234514
|
+
if (run) {
|
|
234515
|
+
run.stopFired = true;
|
|
234516
|
+
}
|
|
234517
|
+
}
|
|
234518
|
+
function hasSubagentStopFired(agentId) {
|
|
234519
|
+
return runs.get(agentId)?.stopFired ?? false;
|
|
234520
|
+
}
|
|
234521
|
+
var runs;
|
|
234522
|
+
var init_backgroundAbortRegistry = __esm(() => {
|
|
234523
|
+
runs = new Map;
|
|
234524
|
+
});
|
|
234525
|
+
|
|
234465
234526
|
// src/providers/shared/model/agent.ts
|
|
234466
234527
|
function getDefaultSubagentModel() {
|
|
234467
234528
|
return "inherit";
|
|
@@ -234513,6 +234574,12 @@ var init_agent = __esm(() => {
|
|
|
234513
234574
|
});
|
|
234514
234575
|
|
|
234515
234576
|
// src/providers/shared/routing.ts
|
|
234577
|
+
function resolveModelProvider(model, modelProviders) {
|
|
234578
|
+
const config2 = modelProviders?.[model];
|
|
234579
|
+
if (!config2)
|
|
234580
|
+
return null;
|
|
234581
|
+
return { model, ...config2 };
|
|
234582
|
+
}
|
|
234516
234583
|
function normalize10(key) {
|
|
234517
234584
|
return key.toLowerCase().replace(/[-_]/g, "");
|
|
234518
234585
|
}
|
|
@@ -234816,6 +234883,12 @@ var init_caching = __esm(() => {
|
|
|
234816
234883
|
});
|
|
234817
234884
|
|
|
234818
234885
|
// src/providers/shared/model/antModels.ts
|
|
234886
|
+
function getAntModelOverrideConfig2() {
|
|
234887
|
+
if (process.env.USER_TYPE !== "ant") {
|
|
234888
|
+
return null;
|
|
234889
|
+
}
|
|
234890
|
+
return getFeatureValue_CACHED_MAY_BE_STALE("tengu_ant_model_override", null);
|
|
234891
|
+
}
|
|
234819
234892
|
var init_antModels = () => {};
|
|
234820
234893
|
|
|
234821
234894
|
// src/lib/fingerprint.ts
|
|
@@ -235048,7 +235121,7 @@ function filterToolsForAgent({
|
|
|
235048
235121
|
}
|
|
235049
235122
|
if (isAsync2 && !ASYNC_AGENT_ALLOWED_TOOLS.has(tool.name)) {
|
|
235050
235123
|
if (isAgentSwarmsEnabled() && isInProcessTeammate()) {
|
|
235051
|
-
if (toolMatchesName(tool,
|
|
235124
|
+
if (toolMatchesName(tool, AGENT_TOOL_NAME2)) {
|
|
235052
235125
|
return true;
|
|
235053
235126
|
}
|
|
235054
235127
|
if (IN_PROCESS_TEAMMATE_ALLOWED_TOOLS.has(tool.name)) {
|
|
@@ -235098,7 +235171,7 @@ function resolveAgentTools(agentDefinition, availableTools, isAsync2 = false, is
|
|
|
235098
235171
|
let allowedAgentTypes;
|
|
235099
235172
|
for (const toolSpec of agentTools) {
|
|
235100
235173
|
const { toolName, ruleContent } = permissionRuleValueFromString(toolSpec);
|
|
235101
|
-
if (toolName ===
|
|
235174
|
+
if (toolName === AGENT_TOOL_NAME2) {
|
|
235102
235175
|
if (ruleContent) {
|
|
235103
235176
|
allowedAgentTypes = ruleContent.split(",").map((s) => s.trim());
|
|
235104
235177
|
}
|
|
@@ -235317,6 +235390,8 @@ async function runAsyncAgentLifecycle({
|
|
|
235317
235390
|
return;
|
|
235318
235391
|
}
|
|
235319
235392
|
const msg = errorMessage(error41);
|
|
235393
|
+
logForDebugging(`Background agent ${taskId} failed: ${msg}
|
|
235394
|
+
${error41 instanceof Error ? error41.stack ?? "" : ""}`, { level: "error" });
|
|
235320
235395
|
failAgentTask(taskId, msg, rootSetAppState);
|
|
235321
235396
|
const worktreeResult = await getWorktreeResult();
|
|
235322
235397
|
enqueueAgentNotification({
|
|
@@ -235471,6 +235546,49 @@ async function initializeAgentMcpServers(agentDefinition, parentClients) {
|
|
|
235471
235546
|
function isRecordableMessage(msg) {
|
|
235472
235547
|
return msg.type === "assistant" || msg.type === "user" || msg.type === "progress" || msg.type === "system" && "subtype" in msg && msg.subtype === "compact_boundary";
|
|
235473
235548
|
}
|
|
235549
|
+
function simplifySubagentMessageBlocks(msg) {
|
|
235550
|
+
const content = msg.message.content;
|
|
235551
|
+
if (!Array.isArray(content))
|
|
235552
|
+
return [];
|
|
235553
|
+
const out = [];
|
|
235554
|
+
for (const raw of content) {
|
|
235555
|
+
if (!raw || typeof raw !== "object")
|
|
235556
|
+
continue;
|
|
235557
|
+
const block2 = raw;
|
|
235558
|
+
switch (block2.type) {
|
|
235559
|
+
case "text":
|
|
235560
|
+
if (typeof block2.text === "string" && block2.text) {
|
|
235561
|
+
out.push({ type: "text", text: block2.text });
|
|
235562
|
+
}
|
|
235563
|
+
break;
|
|
235564
|
+
case "thinking":
|
|
235565
|
+
if (typeof block2.thinking === "string" && block2.thinking) {
|
|
235566
|
+
out.push({ type: "thinking", thinking: block2.thinking });
|
|
235567
|
+
}
|
|
235568
|
+
break;
|
|
235569
|
+
case "tool_use":
|
|
235570
|
+
out.push({
|
|
235571
|
+
type: "tool_use",
|
|
235572
|
+
tool_use_id: block2.id,
|
|
235573
|
+
name: block2.name,
|
|
235574
|
+
input: block2.input ?? {}
|
|
235575
|
+
});
|
|
235576
|
+
break;
|
|
235577
|
+
case "tool_result": {
|
|
235578
|
+
const c6 = block2.content;
|
|
235579
|
+
const text = typeof c6 === "string" ? c6 : Array.isArray(c6) ? c6.map((p) => p && typeof p === "object" && p.type === "text" ? String(p.text ?? "") : "").join("") : "";
|
|
235580
|
+
out.push({
|
|
235581
|
+
type: "tool_result",
|
|
235582
|
+
tool_use_id: block2.tool_use_id,
|
|
235583
|
+
content: text,
|
|
235584
|
+
is_error: Boolean(block2.is_error)
|
|
235585
|
+
});
|
|
235586
|
+
break;
|
|
235587
|
+
}
|
|
235588
|
+
}
|
|
235589
|
+
}
|
|
235590
|
+
return out;
|
|
235591
|
+
}
|
|
235474
235592
|
async function* runAgent({
|
|
235475
235593
|
agentDefinition,
|
|
235476
235594
|
promptMessages,
|
|
@@ -235493,13 +235611,14 @@ async function* runAgent({
|
|
|
235493
235611
|
description,
|
|
235494
235612
|
transcriptSubdir,
|
|
235495
235613
|
onQueryProgress,
|
|
235614
|
+
onPartialAssistant,
|
|
235496
235615
|
agentName
|
|
235497
235616
|
}) {
|
|
235498
235617
|
const appState = toolUseContext.getAppState();
|
|
235499
235618
|
const permissionMode = appState.toolPermissionContext.mode;
|
|
235500
235619
|
const rootSetAppState = toolUseContext.setAppStateForTasks ?? toolUseContext.setAppState;
|
|
235501
235620
|
const resolvedAgentModel = getAgentModel(agentDefinition.model, toolUseContext.options.mainLoopModel, model, permissionMode);
|
|
235502
|
-
const providerOverride = resolveAgentProvider(agentName, agentDefinition.agentType, getInitialSettings());
|
|
235621
|
+
const providerOverride = resolveAgentProvider(agentName, agentDefinition.agentType, getInitialSettings()) ?? resolveModelProvider(resolvedAgentModel, toolUseContext.options.modelProviders);
|
|
235503
235622
|
const effectiveModel = providerOverride ? providerOverride.model : resolvedAgentModel;
|
|
235504
235623
|
const agentId = override?.agentId ? override.agentId : createAgentId();
|
|
235505
235624
|
if (transcriptSubdir) {
|
|
@@ -235570,8 +235689,11 @@ async function* runAgent({
|
|
|
235570
235689
|
const additionalWorkingDirectories = Array.from(appState.toolPermissionContext.additionalWorkingDirectories.keys());
|
|
235571
235690
|
const agentSystemPrompt = override?.systemPrompt ? override.systemPrompt : asSystemPrompt(await getAgentSystemPrompt(agentDefinition, toolUseContext, resolvedAgentModel, additionalWorkingDirectories, resolvedTools));
|
|
235572
235691
|
const agentAbortController = override?.abortController ? override.abortController : isAsync2 ? new AbortController : toolUseContext.abortController;
|
|
235692
|
+
if (isAsync2) {
|
|
235693
|
+
registerBackgroundAgentAbort(agentId, agentAbortController);
|
|
235694
|
+
}
|
|
235573
235695
|
const additionalContexts = [];
|
|
235574
|
-
for await (const hookResult of executeSubagentStartHooks(agentId, agentDefinition.agentType, agentAbortController.signal)) {
|
|
235696
|
+
for await (const hookResult of executeSubagentStartHooks(agentId, agentDefinition.agentType, agentAbortController.signal, undefined, toolUseContext.toolUseId, isAsync2)) {
|
|
235575
235697
|
if (hookResult.additionalContexts && hookResult.additionalContexts.length > 0) {
|
|
235576
235698
|
additionalContexts.push(...hookResult.additionalContexts);
|
|
235577
235699
|
}
|
|
@@ -235636,7 +235758,7 @@ async function* runAgent({
|
|
|
235636
235758
|
verbose: toolUseContext.options.verbose,
|
|
235637
235759
|
mainLoopModel: effectiveModel,
|
|
235638
235760
|
providerOverride: providerOverride ?? undefined,
|
|
235639
|
-
thinkingConfig:
|
|
235761
|
+
thinkingConfig: toolUseContext.options.thinkingConfig,
|
|
235640
235762
|
mcpClients: mergedMcpClients,
|
|
235641
235763
|
mcpResources: toolUseContext.options.mcpResources,
|
|
235642
235764
|
agentDefinitions: toolUseContext.options.agentDefinitions,
|
|
@@ -235674,6 +235796,12 @@ async function* runAgent({
|
|
|
235674
235796
|
...description && { description }
|
|
235675
235797
|
}).catch((_err) => logForDebugging(`Failed to write agent metadata: ${_err}`));
|
|
235676
235798
|
let lastRecordedUuid = initialMessages.at(-1)?.uuid ?? null;
|
|
235799
|
+
let partialBaseMessage = null;
|
|
235800
|
+
const partialTextByIndex = new Map;
|
|
235801
|
+
const PARTIAL_PROGRESS_HOOK_INTERVAL_MS = 100;
|
|
235802
|
+
let lastPartialProgressHookAt = 0;
|
|
235803
|
+
let lastAssistantForFallback = null;
|
|
235804
|
+
let agentRunError;
|
|
235677
235805
|
try {
|
|
235678
235806
|
for await (const message of query({
|
|
235679
235807
|
messages: initialMessages,
|
|
@@ -235686,8 +235814,37 @@ async function* runAgent({
|
|
|
235686
235814
|
maxTurns: maxTurns ?? agentDefinition.maxTurns
|
|
235687
235815
|
})) {
|
|
235688
235816
|
onQueryProgress?.();
|
|
235689
|
-
if (message.type === "stream_event"
|
|
235690
|
-
|
|
235817
|
+
if (message.type === "stream_event") {
|
|
235818
|
+
const ev = message.event;
|
|
235819
|
+
if (ev.type === "message_start") {
|
|
235820
|
+
if (message.ttftMs != null) {
|
|
235821
|
+
toolUseContext.pushApiMetricsEntry?.(message.ttftMs);
|
|
235822
|
+
}
|
|
235823
|
+
if ((onPartialAssistant || isAsync2) && ev.message) {
|
|
235824
|
+
partialBaseMessage = ev.message;
|
|
235825
|
+
partialTextByIndex.clear();
|
|
235826
|
+
}
|
|
235827
|
+
} else if ((onPartialAssistant || isAsync2) && partialBaseMessage && ev.type === "content_block_delta" && ev.delta?.type === "text_delta" && typeof ev.delta.text === "string") {
|
|
235828
|
+
const idx = ev.index ?? 0;
|
|
235829
|
+
const acc = (partialTextByIndex.get(idx) ?? "") + ev.delta.text;
|
|
235830
|
+
partialTextByIndex.set(idx, acc);
|
|
235831
|
+
onPartialAssistant?.({
|
|
235832
|
+
type: "assistant",
|
|
235833
|
+
message: {
|
|
235834
|
+
...partialBaseMessage,
|
|
235835
|
+
content: [{ type: "text", text: acc, citations: null }]
|
|
235836
|
+
},
|
|
235837
|
+
uuid: randomUUID6(),
|
|
235838
|
+
timestamp: new Date().toISOString()
|
|
235839
|
+
});
|
|
235840
|
+
if (isAsync2) {
|
|
235841
|
+
const now = Date.now();
|
|
235842
|
+
if (now - lastPartialProgressHookAt >= PARTIAL_PROGRESS_HOOK_INTERVAL_MS) {
|
|
235843
|
+
lastPartialProgressHookAt = now;
|
|
235844
|
+
executeSubagentProgressHooks(agentId, agentDefinition.agentType, partialBaseMessage.id, toolUseContext.toolUseId, [{ type: "text", text: acc }]).catch(() => {});
|
|
235845
|
+
}
|
|
235846
|
+
}
|
|
235847
|
+
}
|
|
235691
235848
|
continue;
|
|
235692
235849
|
}
|
|
235693
235850
|
if (message.type === "attachment") {
|
|
@@ -235712,6 +235869,16 @@ async function* runAgent({
|
|
|
235712
235869
|
if (message.type !== "progress") {
|
|
235713
235870
|
lastRecordedUuid = message.uuid;
|
|
235714
235871
|
}
|
|
235872
|
+
if (isAsync2 && message.type === "assistant" && message.message.content.some((b) => b.type === "text" && b.text.trim().length > 0)) {
|
|
235873
|
+
lastAssistantForFallback = message;
|
|
235874
|
+
}
|
|
235875
|
+
if (isAsync2 && (message.type === "assistant" || message.type === "user")) {
|
|
235876
|
+
const blocks = simplifySubagentMessageBlocks(message);
|
|
235877
|
+
if (blocks.length > 0) {
|
|
235878
|
+
const messageId = (message.type === "assistant" ? message.message.id : undefined) ?? message.uuid;
|
|
235879
|
+
executeSubagentProgressHooks(agentId, agentDefinition.agentType, messageId, toolUseContext.toolUseId, blocks).catch(() => {});
|
|
235880
|
+
}
|
|
235881
|
+
}
|
|
235715
235882
|
yield message;
|
|
235716
235883
|
}
|
|
235717
235884
|
}
|
|
@@ -235721,7 +235888,30 @@ async function* runAgent({
|
|
|
235721
235888
|
if (isBuiltInAgent(agentDefinition) && agentDefinition.callback) {
|
|
235722
235889
|
agentDefinition.callback();
|
|
235723
235890
|
}
|
|
235891
|
+
} catch (err2) {
|
|
235892
|
+
agentRunError = err2;
|
|
235893
|
+
throw err2;
|
|
235724
235894
|
} finally {
|
|
235895
|
+
const naturalStopAlreadyFired = isAsync2 && hasSubagentStopFired(agentId);
|
|
235896
|
+
if (isAsync2) {
|
|
235897
|
+
unregisterBackgroundAgentAbort(agentId);
|
|
235898
|
+
}
|
|
235899
|
+
if (isAsync2 && agentRunError !== undefined) {
|
|
235900
|
+
logForDebugging(`Background agent ${agentId} crashed: ${errorMessage(agentRunError)}
|
|
235901
|
+
${agentRunError instanceof Error ? agentRunError.stack ?? "" : ""}`, { level: "error" });
|
|
235902
|
+
}
|
|
235903
|
+
if (isAsync2 && !naturalStopAlreadyFired) {
|
|
235904
|
+
try {
|
|
235905
|
+
const fallbackAppState = agentToolRuntimeContext.getAppState();
|
|
235906
|
+
const terminal = agentAbortController.signal.aborted ? { status: "stopped" } : agentRunError !== undefined ? { status: "failed", errorMessage: errorMessage(agentRunError) } : { status: "completed" };
|
|
235907
|
+
const fallbackStop = executeStopHooks(fallbackAppState.toolPermissionContext.mode, undefined, undefined, false, agentId, agentToolRuntimeContext, lastAssistantForFallback ? [lastAssistantForFallback] : undefined, agentDefinition.agentType, undefined, terminal);
|
|
235908
|
+
for await (const evt of fallbackStop) {}
|
|
235909
|
+
} catch (err2) {
|
|
235910
|
+
logForDebugging(`Fallback SubagentStop failed for ${agentId}: ${err2}`, {
|
|
235911
|
+
level: "warn"
|
|
235912
|
+
});
|
|
235913
|
+
}
|
|
235914
|
+
}
|
|
235725
235915
|
await mcpCleanup();
|
|
235726
235916
|
if (agentDefinition.hooks) {
|
|
235727
235917
|
clearSessionHooks(rootSetAppState, agentId);
|
|
@@ -235817,6 +236007,7 @@ var init_runAgent = __esm(() => {
|
|
|
235817
236007
|
init_registerFrontmatterHooks();
|
|
235818
236008
|
init_sessionHooks();
|
|
235819
236009
|
init_hooks2();
|
|
236010
|
+
init_backgroundAbortRegistry();
|
|
235820
236011
|
init_messages4();
|
|
235821
236012
|
init_agent();
|
|
235822
236013
|
init_settings2();
|
|
@@ -236602,7 +236793,7 @@ var init_TodoWriteTool = __esm(() => {
|
|
|
236602
236793
|
const base2 = `Todos have been modified successfully. Ensure that you continue to use the todo list to track your progress. Please proceed with the current tasks if applicable`;
|
|
236603
236794
|
const nudge = verificationNudgeNeeded ? `
|
|
236604
236795
|
|
|
236605
|
-
NOTE: You just closed out 3+ tasks and none of them was a verification step. Before writing your final summary, spawn the verification agent (subagent_type="${
|
|
236796
|
+
NOTE: You just closed out 3+ tasks and none of them was a verification step. Before writing your final summary, spawn the verification agent (subagent_type="${VERIFICATION_AGENT_TYPE}"). You cannot self-assign PARTIAL by listing caveats in your summary — only the verifier issues a verdict.` : "";
|
|
236606
236797
|
return {
|
|
236607
236798
|
tool_use_id: toolUseID,
|
|
236608
236799
|
type: "tool_result",
|
|
@@ -238527,7 +238718,9 @@ var init_coreSchemas = __esm(() => {
|
|
|
238527
238718
|
SubagentStartHookInputSchema = lazySchema(() => BaseHookInputSchema().and(exports_external2.object({
|
|
238528
238719
|
hook_event_name: exports_external2.literal("SubagentStart"),
|
|
238529
238720
|
agent_id: exports_external2.string(),
|
|
238530
|
-
agent_type: exports_external2.string()
|
|
238721
|
+
agent_type: exports_external2.string(),
|
|
238722
|
+
tool_use_id: exports_external2.string().optional().describe("tool_use id of the Agent tool call that launched this subagent. " + "Lets hosts correlate the subagent lifecycle back to the launching " + "tool call (e.g. to render an inline running indicator on its pill)."),
|
|
238723
|
+
is_background: exports_external2.boolean().optional().describe("True when the subagent was launched with run_in_background (async). " + "Lets hosts scope background-specific UI/notifications to async agents.")
|
|
238531
238724
|
})));
|
|
238532
238725
|
SubagentStopHookInputSchema = lazySchema(() => BaseHookInputSchema().and(exports_external2.object({
|
|
238533
238726
|
hook_event_name: exports_external2.literal("SubagentStop"),
|
|
@@ -238535,7 +238728,9 @@ var init_coreSchemas = __esm(() => {
|
|
|
238535
238728
|
agent_id: exports_external2.string(),
|
|
238536
238729
|
agent_transcript_path: exports_external2.string(),
|
|
238537
238730
|
agent_type: exports_external2.string(),
|
|
238538
|
-
last_assistant_message: exports_external2.string().optional().describe("Text content of the last assistant message before stopping. " + "Avoids the need to read and parse the transcript file.")
|
|
238731
|
+
last_assistant_message: exports_external2.string().optional().describe("Text content of the last assistant message before stopping. " + "Avoids the need to read and parse the transcript file."),
|
|
238732
|
+
status: exports_external2.enum(["completed", "failed", "stopped"]).optional().describe("Terminal outcome carried by the guaranteed terminal delivery for " + "background subagents (fired from the run teardown). Absent on the " + "natural-stop path — hosts treat a missing status as completed."),
|
|
238733
|
+
error_message: exports_external2.string().optional().describe("Present when status is failed: the error that aborted the run.")
|
|
238539
238734
|
})));
|
|
238540
238735
|
PreCompactHookInputSchema = lazySchema(() => BaseHookInputSchema().and(exports_external2.object({
|
|
238541
238736
|
hook_event_name: exports_external2.literal("PreCompact"),
|
|
@@ -250249,7 +250444,7 @@ ${forkEnabled ? "For fresh agents, terse" : "Terse"} command-style prompts produ
|
|
|
250249
250444
|
<example>
|
|
250250
250445
|
user: "What's left on this branch before we can ship?"
|
|
250251
250446
|
assistant: <thinking>Forking this — it's a survey question. I want the punch list, not the git output in my context.</thinking>
|
|
250252
|
-
${
|
|
250447
|
+
${AGENT_TOOL_NAME2}({
|
|
250253
250448
|
name: "ship-audit",
|
|
250254
250449
|
description: "Branch ship-readiness audit",
|
|
250255
250450
|
prompt: "Audit what's left before this branch can ship. Check: uncommitted changes, commits ahead of main, whether tests exist, whether the GrowthBook gate is wired up, whether CI-relevant files changed. Report a punch list — done vs. missing. Under 200 words."
|
|
@@ -250276,7 +250471,7 @@ assistant: <thinking>I'll ask the code-reviewer agent — it won't see my analys
|
|
|
250276
250471
|
<commentary>
|
|
250277
250472
|
A subagent_type is specified, so the agent starts fresh. It needs full context in the prompt. The briefing explains what to assess and why.
|
|
250278
250473
|
</commentary>
|
|
250279
|
-
${
|
|
250474
|
+
${AGENT_TOOL_NAME2}({
|
|
250280
250475
|
name: "migration-review",
|
|
250281
250476
|
description: "Independent migration review",
|
|
250282
250477
|
subagent_type: "code-reviewer",
|
|
@@ -250306,7 +250501,7 @@ function isPrime(n) {
|
|
|
250306
250501
|
<commentary>
|
|
250307
250502
|
Since a significant piece of code was written and the task was completed, now use the test-runner agent to run the tests
|
|
250308
250503
|
</commentary>
|
|
250309
|
-
assistant: Uses the ${
|
|
250504
|
+
assistant: Uses the ${AGENT_TOOL_NAME2} tool to launch the test-runner agent
|
|
250310
250505
|
</example>
|
|
250311
250506
|
|
|
250312
250507
|
<example>
|
|
@@ -250314,7 +250509,7 @@ user: "Hello"
|
|
|
250314
250509
|
<commentary>
|
|
250315
250510
|
Since the user is greeting, use the greeting-responder agent to respond with a friendly joke
|
|
250316
250511
|
</commentary>
|
|
250317
|
-
assistant: "I'm going to use the ${
|
|
250512
|
+
assistant: "I'm going to use the ${AGENT_TOOL_NAME2} tool to launch the greeting-responder agent"
|
|
250318
250513
|
</example>
|
|
250319
250514
|
`;
|
|
250320
250515
|
const listViaAttachment = shouldInjectAgentListInMessages();
|
|
@@ -250323,11 +250518,11 @@ ${effectiveAgents.map((agent) => formatAgentLine(agent)).join(`
|
|
|
250323
250518
|
`)}`;
|
|
250324
250519
|
const shared2 = `Launch a new agent to handle complex, multi-step tasks autonomously.
|
|
250325
250520
|
|
|
250326
|
-
The ${
|
|
250521
|
+
The ${AGENT_TOOL_NAME2} tool launches specialized agents (subprocesses) that autonomously handle complex tasks. Each agent type has specific capabilities and tools available to it.
|
|
250327
250522
|
|
|
250328
250523
|
${agentListSection}
|
|
250329
250524
|
|
|
250330
|
-
${forkEnabled ? `When using the ${
|
|
250525
|
+
${forkEnabled ? `When using the ${AGENT_TOOL_NAME2} tool, specify a subagent_type to use a specialized agent, or omit it to fork yourself — a fork inherits your full conversation context.` : `When using the ${AGENT_TOOL_NAME2} tool, specify a subagent_type parameter to select which agent type to use. If omitted, the general-purpose agent is used.`}`;
|
|
250331
250526
|
if (isCoordinator) {
|
|
250332
250527
|
return shared2;
|
|
250333
250528
|
}
|
|
@@ -250335,10 +250530,10 @@ ${forkEnabled ? `When using the ${AGENT_TOOL_NAME3} tool, specify a subagent_typ
|
|
|
250335
250530
|
const fileSearchHint = embedded ? "`find` via the Bash tool" : `the ${GLOB_TOOL_NAME2} tool`;
|
|
250336
250531
|
const contentSearchHint = embedded ? "`grep` via the Bash tool" : `the ${GLOB_TOOL_NAME2} tool`;
|
|
250337
250532
|
const whenNotToUseSection = forkEnabled ? "" : `
|
|
250338
|
-
When NOT to use the ${
|
|
250339
|
-
- If you want to read a specific file path, use the ${FILE_READ_TOOL_NAME2} tool or ${fileSearchHint} instead of the ${
|
|
250533
|
+
When NOT to use the ${AGENT_TOOL_NAME2} tool:
|
|
250534
|
+
- If you want to read a specific file path, use the ${FILE_READ_TOOL_NAME2} tool or ${fileSearchHint} instead of the ${AGENT_TOOL_NAME2} tool, to find the match more quickly
|
|
250340
250535
|
- If you are searching for a specific class definition like "class Foo", use ${contentSearchHint} instead, to find the match more quickly
|
|
250341
|
-
- If you are searching for code within a specific file or set of 2-3 files, use the ${FILE_READ_TOOL_NAME2} tool instead of the ${
|
|
250536
|
+
- If you are searching for code within a specific file or set of 2-3 files, use the ${FILE_READ_TOOL_NAME2} tool instead of the ${AGENT_TOOL_NAME2} tool, to find the match more quickly
|
|
250342
250537
|
- Other tasks that are not related to the agent descriptions above
|
|
250343
250538
|
`;
|
|
250344
250539
|
const concurrencyNote = !listViaAttachment && getSubscriptionType() !== "pro" ? `
|
|
@@ -250355,7 +250550,7 @@ Usage notes:
|
|
|
250355
250550
|
- The agent's outputs should generally be trusted
|
|
250356
250551
|
- Clearly tell the agent whether you expect it to write code or just to do research (search, file reads, web fetches, etc.)${forkEnabled ? "" : ", since it is not aware of the user's intent"}
|
|
250357
250552
|
- If the agent description mentions that it should be used proactively, then you should try your best to use it without the user having to ask for it first. Use your judgement.
|
|
250358
|
-
- If the user specifies that they want you to run agents "in parallel", you MUST send a single message with multiple ${
|
|
250553
|
+
- If the user specifies that they want you to run agents "in parallel", you MUST send a single message with multiple ${AGENT_TOOL_NAME2} tool use content blocks. For example, if you need to launch both a build-validator agent and a test-runner agent in parallel, send a single message with both tool calls.
|
|
250359
250554
|
- You can optionally set \`isolation: "worktree"\` to run the agent in a temporary git worktree, giving it an isolated copy of the repository. The worktree is automatically cleaned up if the agent makes no changes; if changes are made, the worktree path and branch are returned in the result.${process.env.USER_TYPE === "ant" ? `
|
|
250360
250555
|
- You can set \`isolation: "remote"\` to run the agent in a remote CCR environment. This is always a background task; you'll be notified when it completes. Use for long-running tasks that need a fresh sandbox.` : ""}${isInProcessTeammate() ? `
|
|
250361
250556
|
- The run_in_background, name, team_name, and mode parameters are not available in this context. Only synchronous subagents are supported.` : isTeammate() ? `
|
|
@@ -250505,11 +250700,11 @@ var init_AgentTool = __esm(() => {
|
|
|
250505
250700
|
}
|
|
250506
250701
|
}
|
|
250507
250702
|
const agentsWithMcpRequirementsMet = filterAgentsByMcpRequirements(agents, mcpServersWithTools);
|
|
250508
|
-
const filteredAgents = filterDeniedAgents(agentsWithMcpRequirementsMet, toolPermissionContext,
|
|
250703
|
+
const filteredAgents = filterDeniedAgents(agentsWithMcpRequirementsMet, toolPermissionContext, AGENT_TOOL_NAME2);
|
|
250509
250704
|
const isCoordinator = false;
|
|
250510
250705
|
return await getPrompt2(filteredAgents, isCoordinator, allowedAgentTypes);
|
|
250511
250706
|
},
|
|
250512
|
-
name:
|
|
250707
|
+
name: AGENT_TOOL_NAME2,
|
|
250513
250708
|
searchHint: "delegate work to a subagent",
|
|
250514
250709
|
aliases: [LEGACY_AGENT_TOOL_NAME],
|
|
250515
250710
|
maxResultSizeChars: 1e5,
|
|
@@ -250589,13 +250784,13 @@ var init_AgentTool = __esm(() => {
|
|
|
250589
250784
|
const {
|
|
250590
250785
|
allowedAgentTypes
|
|
250591
250786
|
} = toolUseContext.options.agentDefinitions;
|
|
250592
|
-
const agents = filterDeniedAgents(allowedAgentTypes ? allAgents.filter((a2) => allowedAgentTypes.includes(a2.agentType)) : allAgents, appState.toolPermissionContext,
|
|
250787
|
+
const agents = filterDeniedAgents(allowedAgentTypes ? allAgents.filter((a2) => allowedAgentTypes.includes(a2.agentType)) : allAgents, appState.toolPermissionContext, AGENT_TOOL_NAME2);
|
|
250593
250788
|
const found = agents.find((agent) => agent.agentType === effectiveType);
|
|
250594
250789
|
if (!found) {
|
|
250595
250790
|
const agentExistsButDenied = allAgents.find((agent) => agent.agentType === effectiveType);
|
|
250596
250791
|
if (agentExistsButDenied) {
|
|
250597
|
-
const denyRule = getDenyRuleForAgent(appState.toolPermissionContext,
|
|
250598
|
-
throw new Error(`Agent type '${effectiveType}' has been denied by permission rule '${
|
|
250792
|
+
const denyRule = getDenyRuleForAgent(appState.toolPermissionContext, AGENT_TOOL_NAME2, effectiveType);
|
|
250793
|
+
throw new Error(`Agent type '${effectiveType}' has been denied by permission rule '${AGENT_TOOL_NAME2}(${effectiveType})' from ${denyRule?.source ?? "settings"}.`);
|
|
250599
250794
|
}
|
|
250600
250795
|
throw new Error(`Agent type '${effectiveType}' not found. Available agents: ${agents.map((a2) => a2.agentType).join(", ")}`);
|
|
250601
250796
|
}
|
|
@@ -250966,6 +251161,19 @@ ${reasons}`);
|
|
|
250966
251161
|
...runAgentParams.override,
|
|
250967
251162
|
agentId: syncAgentId
|
|
250968
251163
|
},
|
|
251164
|
+
onPartialAssistant: onProgress ? (partial2) => {
|
|
251165
|
+
if (partial2.message.content.length === 0)
|
|
251166
|
+
return;
|
|
251167
|
+
onProgress({
|
|
251168
|
+
toolUseID: `agent_${assistantMessage.message.id}`,
|
|
251169
|
+
data: {
|
|
251170
|
+
message: partial2,
|
|
251171
|
+
type: "agent_progress",
|
|
251172
|
+
prompt: "",
|
|
251173
|
+
agentId: syncAgentId
|
|
251174
|
+
}
|
|
251175
|
+
});
|
|
251176
|
+
} : undefined,
|
|
250969
251177
|
onCacheSafeParams: summaryTaskId && getSdkAgentProgressSummariesEnabled() ? (params) => {
|
|
250970
251178
|
const {
|
|
250971
251179
|
stop
|
|
@@ -251148,21 +251356,16 @@ ${reasons}`);
|
|
|
251148
251356
|
}
|
|
251149
251357
|
const normalizedNew = normalizeMessages([message]);
|
|
251150
251358
|
for (const m of normalizedNew) {
|
|
251151
|
-
|
|
251152
|
-
|
|
251153
|
-
|
|
251154
|
-
|
|
251155
|
-
|
|
251156
|
-
|
|
251157
|
-
|
|
251158
|
-
|
|
251159
|
-
|
|
251160
|
-
|
|
251161
|
-
prompt: "",
|
|
251162
|
-
agentId: syncAgentId
|
|
251163
|
-
}
|
|
251164
|
-
});
|
|
251165
|
-
}
|
|
251359
|
+
if (onProgress && m.message.content.length > 0) {
|
|
251360
|
+
onProgress({
|
|
251361
|
+
toolUseID: `agent_${assistantMessage.message.id}`,
|
|
251362
|
+
data: {
|
|
251363
|
+
message: m,
|
|
251364
|
+
type: "agent_progress",
|
|
251365
|
+
prompt: "",
|
|
251366
|
+
agentId: syncAgentId
|
|
251367
|
+
}
|
|
251368
|
+
});
|
|
251166
251369
|
}
|
|
251167
251370
|
}
|
|
251168
251371
|
}
|
|
@@ -251310,10 +251513,9 @@ Briefly tell the user what you launched and end your response.`
|
|
|
251310
251513
|
if (data.status === "async_launched") {
|
|
251311
251514
|
const prefix = `Async agent launched successfully.
|
|
251312
251515
|
agentId: ${data.agentId} (internal ID - do not mention to user. Use SendMessage with to: '${data.agentId}' to continue this agent.)
|
|
251313
|
-
The agent is working in the background.
|
|
251314
|
-
const instructions =
|
|
251315
|
-
|
|
251316
|
-
If asked, you can check progress before completion by using ${FILE_READ_TOOL_NAME2} or ${BASH_TOOL_NAME2} tail on the output file.` : `Briefly tell the user what you launched and end your response. Do not generate any other text — agent results will arrive in a subsequent message.`;
|
|
251516
|
+
The agent is working in the background. Its result will be delivered to you automatically when it completes.`;
|
|
251517
|
+
const instructions = `Do not duplicate this agent's work — avoid working with the same files or topics it is using. Work on non-overlapping tasks, or briefly tell the user what you launched and end your response.
|
|
251518
|
+
Do NOT read its output/transcript file to check progress — its result will arrive automatically in a subsequent message.`;
|
|
251317
251519
|
const text = `${prefix}
|
|
251318
251520
|
${instructions}`;
|
|
251319
251521
|
return {
|
|
@@ -256814,7 +257016,7 @@ function toComparable(p) {
|
|
|
256814
257016
|
return IS_WINDOWS ? posixForm.toLowerCase() : posixForm;
|
|
256815
257017
|
}
|
|
256816
257018
|
function detectSessionFileType(filePath) {
|
|
256817
|
-
const configDir =
|
|
257019
|
+
const configDir = resolveConfigHomeDir();
|
|
256818
257020
|
const normalized = toComparable(filePath);
|
|
256819
257021
|
const configDirCmp = toComparable(configDir);
|
|
256820
257022
|
if (!normalized.startsWith(configDirCmp)) {
|
|
@@ -256860,6 +257062,7 @@ var init_memoryFileDetection = __esm(() => {
|
|
|
256860
257062
|
init_agentMemory();
|
|
256861
257063
|
init_state2();
|
|
256862
257064
|
init_paths();
|
|
257065
|
+
init_envUtils();
|
|
256863
257066
|
init_windowsPaths();
|
|
256864
257067
|
IS_WINDOWS = process.platform === "win32";
|
|
256865
257068
|
});
|
|
@@ -258100,7 +258303,7 @@ Git Safety Protocol:
|
|
|
258100
258303
|
|
|
258101
258304
|
Important notes:
|
|
258102
258305
|
- NEVER run additional commands to read or explore code, besides git bash commands
|
|
258103
|
-
- NEVER use the ${TodoWriteTool.name} or ${
|
|
258306
|
+
- NEVER use the ${TodoWriteTool.name} or ${AGENT_TOOL_NAME2} tools
|
|
258104
258307
|
- DO NOT push to the remote repository unless the user explicitly asks you to do so
|
|
258105
258308
|
- IMPORTANT: Never use git commands with the -i flag (like git rebase -i or git add -i) since they require interactive input which is not supported.
|
|
258106
258309
|
- IMPORTANT: Do not use --no-edit with git rebase commands, as the --no-edit flag is not a valid option for git rebase.
|
|
@@ -258146,7 +258349,7 @@ EOF
|
|
|
258146
258349
|
</example>
|
|
258147
258350
|
|
|
258148
258351
|
Important:
|
|
258149
|
-
- DO NOT use the ${TodoWriteTool.name} or ${
|
|
258352
|
+
- DO NOT use the ${TodoWriteTool.name} or ${AGENT_TOOL_NAME2} tools
|
|
258150
258353
|
- Return the PR URL when you're done, so the user can see it
|
|
258151
258354
|
|
|
258152
258355
|
# Other common operations
|
|
@@ -282271,7 +282474,7 @@ function getAnthropicEnvMetadata() {
|
|
|
282271
282474
|
function getBuildAgeMinutes() {
|
|
282272
282475
|
if (false)
|
|
282273
282476
|
;
|
|
282274
|
-
const buildTime = new Date("2026-06-
|
|
282477
|
+
const buildTime = new Date("2026-06-10T13:40:16.658Z").getTime();
|
|
282275
282478
|
if (isNaN(buildTime))
|
|
282276
282479
|
return;
|
|
282277
282480
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -286663,7 +286866,7 @@ function getDeferredToolsDeltaAttachment(tools, model, messages, scanContext) {
|
|
|
286663
286866
|
function getAgentListingDeltaAttachment(toolUseContext, messages) {
|
|
286664
286867
|
if (!shouldInjectAgentListInMessages())
|
|
286665
286868
|
return [];
|
|
286666
|
-
if (!toolUseContext.options.tools.some((t) => toolMatchesName2(t,
|
|
286869
|
+
if (!toolUseContext.options.tools.some((t) => toolMatchesName2(t, AGENT_TOOL_NAME))) {
|
|
286667
286870
|
return [];
|
|
286668
286871
|
}
|
|
286669
286872
|
const { activeAgents, allowedAgentTypes } = toolUseContext.options.agentDefinitions;
|
|
@@ -286674,7 +286877,7 @@ function getAgentListingDeltaAttachment(toolUseContext, messages) {
|
|
|
286674
286877
|
mcpServers.add(info.serverName);
|
|
286675
286878
|
}
|
|
286676
286879
|
const permissionContext = toolUseContext.getAppState().toolPermissionContext;
|
|
286677
|
-
let filtered = filterDeniedAgents(filterAgentsByMcpRequirements(activeAgents, [...mcpServers]), permissionContext,
|
|
286880
|
+
let filtered = filterDeniedAgents(filterAgentsByMcpRequirements(activeAgents, [...mcpServers]), permissionContext, AGENT_TOOL_NAME);
|
|
286678
286881
|
if (allowedAgentTypes) {
|
|
286679
286882
|
filtered = filtered.filter((a2) => allowedAgentTypes.includes(a2.agentType));
|
|
286680
286883
|
}
|
|
@@ -288801,6 +289004,7 @@ __export(exports_hooks, {
|
|
|
288801
289004
|
executeTaskCreatedHooks: () => executeTaskCreatedHooks,
|
|
288802
289005
|
executeTaskCompletedHooks: () => executeTaskCompletedHooks,
|
|
288803
289006
|
executeSubagentStartHooks: () => executeSubagentStartHooks,
|
|
289007
|
+
executeSubagentProgressHooks: () => executeSubagentProgressHooks,
|
|
288804
289008
|
executeStopHooks: () => executeStopHooks,
|
|
288805
289009
|
executeStopFailureHooks: () => executeStopFailureHooks,
|
|
288806
289010
|
executeStatusLineCommand: () => executeStatusLineCommand,
|
|
@@ -290861,13 +291065,16 @@ async function executeStopFailureHooks(lastMessage, toolUseContext, timeoutMs =
|
|
|
290861
291065
|
matchQuery: error41
|
|
290862
291066
|
});
|
|
290863
291067
|
}
|
|
290864
|
-
async function* executeStopHooks(permissionMode, signal, timeoutMs = TOOL_HOOK_EXECUTION_TIMEOUT_MS, stopHookActive = false, subagentId, toolUseContext, messages, agentType, requestPrompt) {
|
|
291068
|
+
async function* executeStopHooks(permissionMode, signal, timeoutMs = TOOL_HOOK_EXECUTION_TIMEOUT_MS, stopHookActive = false, subagentId, toolUseContext, messages, agentType, requestPrompt, terminal2) {
|
|
290865
291069
|
const hookEvent = subagentId ? "SubagentStop" : "Stop";
|
|
290866
291070
|
const appState = toolUseContext?.getAppState();
|
|
290867
291071
|
const sessionId = toolUseContext?.agentId ?? getSessionId();
|
|
290868
291072
|
if (!hasHookForEvent(hookEvent, appState, sessionId)) {
|
|
290869
291073
|
return;
|
|
290870
291074
|
}
|
|
291075
|
+
if (subagentId) {
|
|
291076
|
+
markSubagentStopFired(subagentId);
|
|
291077
|
+
}
|
|
290871
291078
|
const lastAssistantMessage = messages ? getLastAssistantMessage(messages) : undefined;
|
|
290872
291079
|
const lastAssistantText = lastAssistantMessage ? extractTextContent(lastAssistantMessage.message.content, `
|
|
290873
291080
|
`).trim() || undefined : undefined;
|
|
@@ -290878,7 +291085,8 @@ async function* executeStopHooks(permissionMode, signal, timeoutMs = TOOL_HOOK_E
|
|
|
290878
291085
|
agent_id: subagentId,
|
|
290879
291086
|
agent_transcript_path: getAgentTranscriptPath(subagentId),
|
|
290880
291087
|
agent_type: agentType ?? "",
|
|
290881
|
-
last_assistant_message: lastAssistantText
|
|
291088
|
+
last_assistant_message: lastAssistantText,
|
|
291089
|
+
...terminal2 ? { status: terminal2.status, error_message: terminal2.errorMessage } : {}
|
|
290882
291090
|
} : {
|
|
290883
291091
|
...createBaseHookInput(permissionMode),
|
|
290884
291092
|
hook_event_name: "Stop",
|
|
@@ -290997,12 +291205,14 @@ async function* executeSetupHooks(trigger, signal, timeoutMs = TOOL_HOOK_EXECUTI
|
|
|
290997
291205
|
forceSyncExecution
|
|
290998
291206
|
});
|
|
290999
291207
|
}
|
|
291000
|
-
async function* executeSubagentStartHooks(agentId, agentType, signal, timeoutMs = TOOL_HOOK_EXECUTION_TIMEOUT_MS) {
|
|
291208
|
+
async function* executeSubagentStartHooks(agentId, agentType, signal, timeoutMs = TOOL_HOOK_EXECUTION_TIMEOUT_MS, toolUseId, isBackground) {
|
|
291001
291209
|
const hookInput = {
|
|
291002
291210
|
...createBaseHookInput(undefined),
|
|
291003
291211
|
hook_event_name: "SubagentStart",
|
|
291004
291212
|
agent_id: agentId,
|
|
291005
|
-
agent_type: agentType
|
|
291213
|
+
agent_type: agentType,
|
|
291214
|
+
...toolUseId !== undefined ? { tool_use_id: toolUseId } : {},
|
|
291215
|
+
...isBackground !== undefined ? { is_background: isBackground } : {}
|
|
291006
291216
|
};
|
|
291007
291217
|
yield* executeHooks({
|
|
291008
291218
|
hookInput,
|
|
@@ -291012,6 +291222,24 @@ async function* executeSubagentStartHooks(agentId, agentType, signal, timeoutMs
|
|
|
291012
291222
|
timeoutMs
|
|
291013
291223
|
});
|
|
291014
291224
|
}
|
|
291225
|
+
async function executeSubagentProgressHooks(agentId, agentType, messageId, parentToolUseId, blocks, signal) {
|
|
291226
|
+
const hookInput = {
|
|
291227
|
+
...createBaseHookInput(undefined),
|
|
291228
|
+
hook_event_name: "SubagentProgress",
|
|
291229
|
+
agent_id: agentId,
|
|
291230
|
+
agent_type: agentType,
|
|
291231
|
+
message_id: messageId,
|
|
291232
|
+
...parentToolUseId !== undefined ? { parent_tool_use_id: parentToolUseId } : {},
|
|
291233
|
+
blocks
|
|
291234
|
+
};
|
|
291235
|
+
for await (const _hookResult of executeHooks({
|
|
291236
|
+
hookInput,
|
|
291237
|
+
toolUseID: randomUUID16(),
|
|
291238
|
+
matchQuery: agentType,
|
|
291239
|
+
signal,
|
|
291240
|
+
timeoutMs: TOOL_HOOK_EXECUTION_TIMEOUT_MS
|
|
291241
|
+
})) {}
|
|
291242
|
+
}
|
|
291015
291243
|
async function executePreCompactHooks(compactData, signal, timeoutMs = TOOL_HOOK_EXECUTION_TIMEOUT_MS) {
|
|
291016
291244
|
const hookInput = {
|
|
291017
291245
|
...createBaseHookInput(undefined),
|
|
@@ -291651,6 +291879,7 @@ var init_hooks2 = __esm(() => {
|
|
|
291651
291879
|
init_envUtils();
|
|
291652
291880
|
init_errors5();
|
|
291653
291881
|
init_state2();
|
|
291882
|
+
init_backgroundAbortRegistry();
|
|
291654
291883
|
TOOL_HOOK_EXECUTION_TIMEOUT_MS = 10 * 60 * 1000;
|
|
291655
291884
|
});
|
|
291656
291885
|
|
|
@@ -292017,7 +292246,7 @@ function getAntModelOverrideSection() {
|
|
|
292017
292246
|
return null;
|
|
292018
292247
|
if (isUndercover())
|
|
292019
292248
|
return null;
|
|
292020
|
-
return
|
|
292249
|
+
return getAntModelOverrideConfig2()?.defaultSystemPromptSuffix || null;
|
|
292021
292250
|
}
|
|
292022
292251
|
function getLanguageSection(languagePreference) {
|
|
292023
292252
|
if (!languagePreference)
|
|
@@ -292436,6 +292665,7 @@ var init_prompts2 = __esm(() => {
|
|
|
292436
292665
|
init_debug();
|
|
292437
292666
|
init_memdir();
|
|
292438
292667
|
init_mcpInstructionsDelta();
|
|
292668
|
+
init_antModels();
|
|
292439
292669
|
init_state2();
|
|
292440
292670
|
CLAUDE_4_5_OR_4_6_MODEL_IDS = {
|
|
292441
292671
|
opus: "claude-opus-4-6",
|
|
@@ -292799,7 +293029,7 @@ var init_api3 = __esm(() => {
|
|
|
292799
293029
|
init_zodToJsonSchema2();
|
|
292800
293030
|
SWARM_FIELDS_BY_TOOL = {
|
|
292801
293031
|
[EXIT_PLAN_MODE_V2_TOOL_NAME]: ["launchSwarm", "teammateCount"],
|
|
292802
|
-
[
|
|
293032
|
+
[AGENT_TOOL_NAME]: ["name", "team_name", "mode"]
|
|
292803
293033
|
};
|
|
292804
293034
|
});
|
|
292805
293035
|
|
|
@@ -298117,7 +298347,7 @@ ${attachment.removedNames.join(`
|
|
|
298117
298347
|
}
|
|
298118
298348
|
case "verify_plan_reminder": {
|
|
298119
298349
|
const toolName = resolveEnvVar("VERIFY_PLAN") === "true" ? "VerifyPlanExecution" : "";
|
|
298120
|
-
const content = `You have completed implementing the plan. Please call the "${toolName}" tool directly (NOT the ${
|
|
298350
|
+
const content = `You have completed implementing the plan. Please call the "${toolName}" tool directly (NOT the ${AGENT_TOOL_NAME} tool or an agent) to verify that all plan items were completed correctly.`;
|
|
298121
298351
|
return wrapMessagesInSystemReminder([
|
|
298122
298352
|
createUserMessage({ content, isMeta: true })
|
|
298123
298353
|
]);
|
|
@@ -299398,7 +299628,7 @@ var init_mappers = __esm(() => {
|
|
|
299398
299628
|
// src/session/messages/systemInit.ts
|
|
299399
299629
|
import { randomUUID as randomUUID22 } from "crypto";
|
|
299400
299630
|
function sdkCompatToolName(name) {
|
|
299401
|
-
return name ===
|
|
299631
|
+
return name === AGENT_TOOL_NAME2 ? LEGACY_AGENT_TOOL_NAME : name;
|
|
299402
299632
|
}
|
|
299403
299633
|
function buildSystemInitMessage(inputs) {
|
|
299404
299634
|
const settings = getSettings_DEPRECATED();
|
|
@@ -299567,7 +299797,8 @@ class QueryEngine {
|
|
|
299567
299797
|
theme: resolveThemeSetting(getGlobalConfig().theme),
|
|
299568
299798
|
maxBudgetUsd,
|
|
299569
299799
|
maxOutputTokens,
|
|
299570
|
-
contextWindow
|
|
299800
|
+
contextWindow,
|
|
299801
|
+
modelProviders: this.config.modelProviders
|
|
299571
299802
|
},
|
|
299572
299803
|
getAppState,
|
|
299573
299804
|
setAppState,
|
|
@@ -299669,7 +299900,8 @@ class QueryEngine {
|
|
|
299669
299900
|
agentDefinitions: { activeAgents: agents, allAgents: [] },
|
|
299670
299901
|
maxBudgetUsd,
|
|
299671
299902
|
maxOutputTokens,
|
|
299672
|
-
contextWindow
|
|
299903
|
+
contextWindow,
|
|
299904
|
+
modelProviders: this.config.modelProviders
|
|
299673
299905
|
},
|
|
299674
299906
|
getAppState,
|
|
299675
299907
|
setAppState,
|
|
@@ -300164,6 +300396,7 @@ async function* ask({
|
|
|
300164
300396
|
appendSystemPrompt,
|
|
300165
300397
|
userSpecifiedModel,
|
|
300166
300398
|
fallbackModel,
|
|
300399
|
+
modelProviders,
|
|
300167
300400
|
jsonSchema,
|
|
300168
300401
|
getAppState,
|
|
300169
300402
|
setAppState,
|
|
@@ -300191,6 +300424,7 @@ async function* ask({
|
|
|
300191
300424
|
appendSystemPrompt,
|
|
300192
300425
|
userSpecifiedModel,
|
|
300193
300426
|
fallbackModel,
|
|
300427
|
+
modelProviders,
|
|
300194
300428
|
thinkingConfig,
|
|
300195
300429
|
maxTurns,
|
|
300196
300430
|
maxBudgetUsd,
|
|
@@ -328907,6 +329141,8 @@ function registerSdkInlineSkillHandler() {
|
|
|
328907
329141
|
}
|
|
328908
329142
|
|
|
328909
329143
|
// src/session/sdkRuntime.ts
|
|
329144
|
+
init_LocalAgentTask();
|
|
329145
|
+
init_backgroundAbortRegistry();
|
|
328910
329146
|
init_hooks2();
|
|
328911
329147
|
init_debug();
|
|
328912
329148
|
init_errors5();
|
|
@@ -329216,6 +329452,10 @@ function createQueryLike(generator, runtimeState, onClose) {
|
|
|
329216
329452
|
runtimeState.abortController.abort();
|
|
329217
329453
|
runtimeState.abortController = createAbortController();
|
|
329218
329454
|
},
|
|
329455
|
+
killAgent(agentId) {
|
|
329456
|
+
abortBackgroundAgentById(agentId);
|
|
329457
|
+
killAsyncAgent(agentId, runtimeState.setAppState);
|
|
329458
|
+
},
|
|
329219
329459
|
async close() {
|
|
329220
329460
|
if (runtimeState.closed)
|
|
329221
329461
|
return;
|
|
@@ -329383,6 +329623,9 @@ function runSdkQueryRuntime(params) {
|
|
|
329383
329623
|
break;
|
|
329384
329624
|
}
|
|
329385
329625
|
runtimeState.runningTurn = true;
|
|
329626
|
+
const { resolveSdkAgents: resolveSdkAgents2 } = (init_builtInAgents(), __toCommonJS(exports_builtInAgents));
|
|
329627
|
+
const hostProvidedAgents = Array.isArray(options2.agents) ? options2.agents : [];
|
|
329628
|
+
const mergedAgents = resolveSdkAgents2(hostProvidedAgents);
|
|
329386
329629
|
for await (const message of getAsk()({
|
|
329387
329630
|
commands: allCommands,
|
|
329388
329631
|
prompt: turn.prompt,
|
|
@@ -329408,12 +329651,13 @@ function runSdkQueryRuntime(params) {
|
|
|
329408
329651
|
userSpecifiedModel: typeof options2.model === "string" && options2.model.length > 0 ? options2.model : undefined,
|
|
329409
329652
|
fallbackModel: typeof options2.fallbackModel === "string" && options2.fallbackModel.length > 0 ? options2.fallbackModel : undefined,
|
|
329410
329653
|
jsonSchema: options2.jsonSchema && typeof options2.jsonSchema === "object" ? options2.jsonSchema : undefined,
|
|
329654
|
+
modelProviders: options2.modelProviders && typeof options2.modelProviders === "object" ? options2.modelProviders : undefined,
|
|
329411
329655
|
getAppState: appStateStore.getAppState,
|
|
329412
329656
|
setAppState: appStateStore.setAppState,
|
|
329413
329657
|
abortController: runtimeState.abortController,
|
|
329414
329658
|
replayUserMessages: Boolean(options2.replayUserMessages),
|
|
329415
329659
|
includePartialMessages: Boolean(options2.includePartialMessages),
|
|
329416
|
-
agents:
|
|
329660
|
+
agents: mergedAgents,
|
|
329417
329661
|
onToolInvoke: typeof options2.onToolInvoke === "function" ? options2.onToolInvoke : undefined
|
|
329418
329662
|
})) {
|
|
329419
329663
|
if (runtimeState.closed)
|
|
@@ -329589,6 +329833,7 @@ function createSession(options2) {
|
|
|
329589
329833
|
|
|
329590
329834
|
// src/client.ts
|
|
329591
329835
|
init_observer();
|
|
329836
|
+
init_backgroundAbortRegistry();
|
|
329592
329837
|
init_log2();
|
|
329593
329838
|
init_log2();
|
|
329594
329839
|
init_coreTypes();
|
|
@@ -331991,6 +332236,7 @@ function getTaskByType(type) {
|
|
|
331991
332236
|
|
|
331992
332237
|
// src/tasks/stopTask.ts
|
|
331993
332238
|
init_sdkEventQueue();
|
|
332239
|
+
init_backgroundAbortRegistry();
|
|
331994
332240
|
|
|
331995
332241
|
class StopTaskError extends Error {
|
|
331996
332242
|
code;
|
|
@@ -332005,6 +332251,9 @@ async function stopTask(taskId, context4) {
|
|
|
332005
332251
|
const appState = getAppState();
|
|
332006
332252
|
const task = appState.tasks?.[taskId];
|
|
332007
332253
|
if (!task) {
|
|
332254
|
+
if (abortBackgroundAgentById(taskId)) {
|
|
332255
|
+
return { taskId, taskType: "local_agent", command: undefined };
|
|
332256
|
+
}
|
|
332008
332257
|
throw new StopTaskError(`No task found with ID: ${taskId}`, "not_found");
|
|
332009
332258
|
}
|
|
332010
332259
|
if (task.status !== "running") {
|
|
@@ -332392,7 +332641,7 @@ var ExitPlanModeV2Tool = buildToolRuntime({
|
|
|
332392
332641
|
}
|
|
332393
332642
|
};
|
|
332394
332643
|
});
|
|
332395
|
-
const hasTaskTool = isAgentSwarmsEnabled() && context4.options.tools.some((t) => toolMatchesName(t,
|
|
332644
|
+
const hasTaskTool = isAgentSwarmsEnabled() && context4.options.tools.some((t) => toolMatchesName(t, AGENT_TOOL_NAME2));
|
|
332396
332645
|
return {
|
|
332397
332646
|
data: {
|
|
332398
332647
|
plan,
|
|
@@ -333333,7 +333582,7 @@ Task completed. Call TaskList now to find your next available task or see if you
|
|
|
333333
333582
|
if (verificationNudgeNeeded) {
|
|
333334
333583
|
resultContent += `
|
|
333335
333584
|
|
|
333336
|
-
NOTE: You just closed out 3+ tasks and none of them was a verification step. Before writing your final summary, spawn the verification agent (subagent_type="${
|
|
333585
|
+
NOTE: You just closed out 3+ tasks and none of them was a verification step. Before writing your final summary, spawn the verification agent (subagent_type="${VERIFICATION_AGENT_TYPE}"). You cannot self-assign PARTIAL by listing caveats in your summary — only the verifier issues a verdict.`;
|
|
333337
333586
|
}
|
|
333338
333587
|
return {
|
|
333339
333588
|
tool_use_id: toolUseID,
|
|
@@ -335408,6 +335657,7 @@ export {
|
|
|
335408
335657
|
query2 as query,
|
|
335409
335658
|
parseScopes,
|
|
335410
335659
|
listSessions,
|
|
335660
|
+
abortBackgroundAgentById as killBackgroundAgent,
|
|
335411
335661
|
isOAuthTokenExpired,
|
|
335412
335662
|
getSessionMessages2 as getSessionMessages,
|
|
335413
335663
|
getSessionInfo,
|
|
@@ -335452,4 +335702,4 @@ export {
|
|
|
335452
335702
|
AbortError2 as AbortError
|
|
335453
335703
|
};
|
|
335454
335704
|
|
|
335455
|
-
//# debugId=
|
|
335705
|
+
//# debugId=2EFAF3B7FC2E44DC64756E2164756E21
|