Это 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{IEndpointProvider}from'../../../platform/endpoint/common/endpointProvider';import{IAlternativeNotebookContentService}from'../../../platform/notebook/common/alternativeContent';import{IPromptPathRepresentationService}from'../../../platform/prompts/common/promptPathRepresentationService';import{IWorkspaceService}from'../../../platform/workspace/common/workspaceService';
toolName
_promptContext
@ instantiationService
@ promptPathRepresentationService
@ workspaceService
@ alternativeNotebookContent
@ endpointProvider
@ telemetryService
@ notebookService
@ logger
options vscode token vscode
filePath cellId options
uri filePath
uri
options
notebook uri
notebook
uri notebook
uri
options
notebook notebook uri
ex
options
ex
cell notebookcellId
cell
options
outputs cell
toolCallResults
endpoint request request
i i outputs i
output outputsi
imageItem endpointsupportsVision outputitem item item
imageItem
toolCallResults
toolCallResultsimageItem imageItem
toolCallResults
toolCallResults output index i sizeLimitRatio options token
result toolCallResults
cellUri cell
result
options
result
ex
options
ex
options vscode vscodevscode
invocationMessage l10n
pastTenseMessage l10n
input promptContext
promptContext
input
filePath
cellId
telemetryService endpointProvider options vscode outcome
model options endpointProvider endpointProvideroptions
telemetryService
requestId options outcome model isNotebook
// Sometimes we get the notebook cell Uri in the resource.
// Resolve this to notebook.
let
=
findNotebook
(
,
this
.
workspaceService
.
notebookDocuments
)
;
if
(
)
{
=
.
uri
;
}
else
if
(
!
this
.
notebookService
.
hasSupportedNotebooks
(
)
)
{
sendOutcomeTelemetry
(
this
.
telemetryService
,
this
.
endpointProvider
,
,
'notNotebookUri'
)
;
throw
new
Error
(
`Use this tool only with Notebook files, the file ${uri.toString()} is not a notebook.`
)
;
}
try
{
=
||
await
this
.
workspaceService
.
openNotebookDocument
(
)
;
}
catch
(
)
{
sendOutcomeTelemetry
(
this
.
telemetryService
,
this
.
endpointProvider
,
,
'failedToOpenNotebook'
)
;
this
.
logger
.
error
(
`Failed to open notebook: ${uri.toString()}`
,
)
;
throw
new
Error
(
`Failed to open the notebook ${uri.toString()}, ${ex.message ||''}. Verify the file exists.`
)
;
}
const
=
getCellIdMap
(
)
.
get
(
)
;
if
(
!
)
{
sendOutcomeTelemetry
(
this
.
telemetryService
,
this
.
endpointProvider
,
,
'cellNotFound'
)
;
throw
new
Error
(
`Cell not found, use the ${ToolName.ReadFile} file tool to get the latest content of the notebook file.`
)
;
}
try
{
const
=
.
outputs
;
const
:
Array
<
LanguageModelPromptTsxPart
|
unknown
>
=
[
]
;
const
=
this
.
_promptContext
?.
?
await
this
.
endpointProvider
.
getChatEndpoint
(
this
.
_promptContext
?.
)
:
undefined
;
for
(
let
=
0
;
<
.
length
;
++
)
{
const
=
[
]
;
const
=
?.
?
.
items
.
find
(
(
)
=>
.
mime
===
'image/png'
||
.
mime
===
'image/jpeg'
)
:
undefined
;
if
(
)
{
.
push
(
new
LanguageModelTextPart
(
`<cell-output>\nOutput ${i}:\n`
)
)
;
.
push
(
LanguageModelDataPart
.
image
(
.
data
,
.
mime
===
'image/png'
?
ChatImageMimeType
.
PNG
:
ChatImageMimeType
.
JPEG
)
)
;
.
push
(
new
LanguageModelTextPart
(
`</cell-output>`
)
)
;
}
else
{
.
push
(
new
LanguageModelPromptTsxPart
(
await
renderPromptElementJSON
(
this
.
instantiationService
,
RunNotebookCellOutput
,
{
,
:
,
:
1.2
}
,
.
tokenizationOptions
,
)
)
)
;
}
}
const
=
new
ExtendedLanguageModelToolResult
(
as
any
)
;
const
=
?.
document
.
uri
;
.
toolResultMessage
=
new
MarkdownString
(
`Read output of [](${cellUri?.toString()})`
)
;
sendOutcomeTelemetry
(
this
.
telemetryService
,
this
.
endpointProvider
,
,
'success'
)
;
return
;
}
catch
(
)
{
sendOutcomeTelemetry
(
this
.
telemetryService
,
this
.
endpointProvider
,
,
'error'
)
;
throw
;
}
}
prepareInvocation
(
:
.
LanguageModelToolInvocationPrepareOptions
<
IGetNotebookCellOutputToolParams
>
)
:
.
ProviderResult
<
.
PreparedToolInvocation
>
{
return
{
:
.
t
`Reading cell output`
,
:
.
t
`Read cell output`
,
}
;
}
async
resolveInput
(
:
IGetNotebookCellOutputToolParams
,
:
IBuildPromptContext
)
:
Promise
<
IGetNotebookCellOutputToolParams
>
{
this
.
_promptContext
=
;
return
;
}
}
interface
IGetNotebookCellOutputToolParams
{
:
string
;
:
string
;
}
ToolRegistry
.
registerTool
(
GetNotebookCellOutputTool
)
;
async
function
sendOutcomeTelemetry
(
:
ITelemetryService
,
:
IEndpointProvider
|
undefined
,
:
.
LanguageModelToolInvocationOptions
<
IGetNotebookCellOutputToolParams
>
,
:
string
)
{
const
=
(
.
model
&&
&&
(
await
.
getChatEndpoint
(
.
model
)
)
.
model
)
;
/* __GDPR__
"getNotebookCellOutput.toolOutcome" : {
"owner": "donjayamanne",
"comment": "Tracks the tool used to get Notebook cell outputs",
"requestId": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "The id of the current request turn." },
"isNotebook": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "comment": "Whether the document is a notebook (this measure is used to identify notebook related telemetry)." },
"outcome": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Outcome of the edit operation" },
"model": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "The model used for the request." }
}
*/