Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/import*as l10nfrom'@vscode/l10n';importtype*as vscode from'vscode';import{ResourceMap,ResourceSet}from'../../../util/vs/base/common/map';import{ count }from'../../../util/vs/base/common/strings';import{URI}from'../../../util/vs/base/common/uri';import{MarkdownString}from'../../../vscodeTypes';import{
explanation
replacements
multiReplaceStringPrimaryDescription
toolName
nonDeferred
input
inputr
filePath r
oldString r
newString r
options vscode _token vscode vscode
partialInput options
invocationMessage
partialInput partialInput partialInput
validReplacements partialInput
r r r r
validReplacements
totalOldLines
totalNewLines
hasNewString
fileNames
r validReplacements
totalOldLines r
r
hasNewString
totalNewLines r
uri r r
uri
fileNamesuri
fileList fileNames fileNames n n
hasNewString fileList
invocationMessage l10n
hasNewString
invocationMessage l10n
fileList
invocationMessage l10n
invocationMessage l10n
invocationMessage l10n
invocationMessage l10n
invocationMessage
options vscode token vscode
options options
prepared options token
successes
failures
individualEdits
uniqueUris
edit prepared
uniqueUrisedit
edit
successes
individualEdits edit
failures
requestId requestId
model options
successes
failures
individualEdits
uniqueUris uniqueUris
i i prepared i
e1 preparedi
uniqueUrise1
e1
failures
successes
k i k prepared k
e2 preparedk
e2 e2 e1 e2 e1
preparedk
k
e2
e1 e1 e2
e1 e1e2
e1textEditSorter
options prepared token
override
a vscode b vscode
ba ba
left right
notebookEdits vscode
textEditsByUri
item vscode vscode
item
uri edits item
bucket textEditsByUriuri
bucket
bucket
textEditsByUriuri bucket
bucketedits
notebookEditsitem
leftadd
rightadd
mergedTextEditTuples vscode
uri edits textEditsByUri
editstextEditSorter
mergedTextEditTuplesuri edits
notebookEdits mergedTextEditTuples
'This is the primary tool for making multiple edits to one or more files. Use this instead of calling replace_string_in_file repeatedly. It takes an array of replacement operations and applies them sequentially. Each replacement operation has the same parameters as replace_string_in_file: filePath, oldString, newString, and explanation. This tool is ideal when you need to make multiple edits across different files or multiple edits in the same file. The tool will provide a summary of successful and failed operations.'
// Filter to valid replacements that have at least oldString
const
=
.
replacements
.
filter
(
=>
&&
typeof
===
'object'
&&
.
oldString
!==
undefined
)
;
if
(
.
length
>
0
)
{
let
=
0
;
let
=
0
;
let
=
false
;
const
=
new
ResourceSet
(
)
;
for
(
const
of
)
{
+=
count
(
.
oldString
,
'\n'
)
+
1
;
if
(
.
newString
!==
undefined
)
{
=
true
;
+=
count
(
.
newString
,
'\n'
)
+
1
;
}
const
=
.
filePath
&&
this
.
promptPathRepresentationService
.
resolveFilePath
(
.
filePath
)
;
if
(
)
{
.
add
(
)
;
}
}
const
=
.
size
>
0
?
Array
.
from
(
,
=>
formatUriForFileWidget
(
)
)
.
join
(
', '
)
:
undefined
;
if
(
&&
)
{
=
new
MarkdownString
(
.
t
`Replacing ${totalOldLines} lines with ${totalNewLines} lines in ${fileList}`
)
;
}
else
if
(
)
{
=
new
MarkdownString
(
.
t
`Replacing ${totalOldLines} lines with ${totalNewLines} lines`
)
;
}
else
if
(
)
{
=
new
MarkdownString
(
.
t
`Replacing ${totalOldLines} lines in ${fileList}`
)
;
}
else
{
=
new
MarkdownString
(
.
t
`Replacing ${totalOldLines} lines`
)
;
}
}
else
{
=
new
MarkdownString
(
.
t
`Editing files`
)
;
}
}
else
{
=
new
MarkdownString
(
.
t
`Editing files`
)
;
}
return
{
}
;
}
async
invoke
(
:
.
LanguageModelToolInvocationOptions
<
IMultiReplaceStringToolParams
>
,
:
.
CancellationToken
)
{
if
(
!
.
input
.
replacements
||
!
Array
.
isArray
(
.
input
.
replacements
)
)
{
throw
new
Error
(
'Invalid input, no replacements array'
)
;
}
const
=
await
this
.
prepareEdits
(
,
)
;
let
=
0
;
let
=
0
;
let
=
0
;
const
=
new
ResourceSet
(
)
;
for
(
const
of
)
{
.
add
(
.
uri
)
;
if
(
.
generatedEdit
.
success
)
{
++
;
+=
.
generatedEdit
.
textEdits
.
length
;
}
else
{
++
;
}
}
/* __GDPR__
"multiStringReplaceCall" : {
"owner": "connor4312",
"comment": "Tracks how much percent of the AI edits survived after 5 minutes of accepting",
"requestId": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "The id of the current request turn." },
"model": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "The model used for the request." },
"successes": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "The number of successful edits.", "isMeasurement": true },
"failures": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "The number of failed edits.", "isMeasurement": true },
"uniqueUris": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "The number of unique URIs edited.", "isMeasurement": true },
"individualEdits": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "The number of individual text edits made.", "isMeasurement": true }
}
*/
this
.
telemetryService
.
sendMSFTTelemetryEvent
(
'multiStringReplaceCall'
,
{
:
this
.
_promptContext
?.
,
:
await
this
.
modelForTelemetry
(
)
,
}
,
{
,
,
,
:
.
size
,
}
)
;
for
(
let
=
0
;
<
.
length
;
++
)
{
const
=
[
]
;
.
add
(
.
uri
)
;
if
(
!
.
generatedEdit
.
success
)
{
++
;
continue
;
}
++
;
for
(
let
=
+
1
;
<
.
length
;
++
)
{
const
=
[
]
;
// Merge successful edits of the same type and URI so that edits come in
// a single correct batch and positions aren't later clobbered.
if
(
!
.
generatedEdit
.
success
||
.
uri
.
toString
(
)
!==
.
uri
.
toString
(
)
||
(
!
!
.
generatedEdit
.
notebookEdits
!==
!
!
.
generatedEdit
.
notebookEdits
)
)
{
continue
;
}
.
splice
(
,
1
)
;
--
;
if
(
.
generatedEdit
.
notebookEdits
)
{
.
generatedEdit
.
notebookEdits
=
mergeNotebookAndTextEdits
(
.
generatedEdit
.
notebookEdits
!
,
.
generatedEdit
.
notebookEdits
)
;
}
else
{
.
generatedEdit
.
textEdits
=
.
generatedEdit
.
textEdits
.
concat
(
.
generatedEdit
.
textEdits
)
;
.
generatedEdit
.
textEdits
.
sort
(
)
;
}
}
}
return
this
.
applyAllEdits
(
,
,
)
;
}
protected
toolName
(
)
:
ToolName
{
return
MultiReplaceStringTool
.
toolName
;
}
}
ToolRegistry
.
registerTool
(
MultiReplaceStringTool
)
;
function
textEditSorter
(
:
.
TextEdit
,
:
.
TextEdit
)
{
return
.
range
.
end
.
compareTo
(
.
range
.
end
)
||
.
range
.
start
.
compareTo
(
.
range
.
start
)
;
}
/**
* Merge two arrays of notebook edits or text edits grouped by URI.
* Text edits for the same URI are concatenated and sorted in reverse file order (descending by start position).
*/