Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
/**
* Routes history rendering through SummarizedConversationHistory (which can
* compact when the budget is exceeded). Independent from cache breakpoints
* — Anthropic Messages API endpoints suppress cache breakpoints but still
* need summarization for long conversations.
*/
readonly
?
:
boolean
;
/**
* Emits prompt-tsx <cacheBreakpoint> markers in the rendered prompt.
*/
readonly
?
:
boolean
;
/**
* Codesearch mode, aka agentic Ask mode
*/
readonly
?
:
boolean
;
/**
* All resolved customizations from the prompt registry.
*/
readonly
?
:
AgentPromptCustomizations
;
/**
* Prefer Simple mode for summarization, typically for the budget-exceeded recovery path.
* An explicit summarization mode configuration can still force Full mode.
*/
readonly
?
:
boolean
;
}
/** Proportion of the prompt token budget any singular textual tool result is allowed to use. */
const
MAX_TOOL_RESPONSE_PCT
=
0.5
;
/**
* The agent mode prompt, rendered on each request
*/
export
class
AgentPrompt
extends
PromptElement<AgentPromptProps>
{
constructor
(
:
AgentPromptProps
,
IConfigurationService
private
readonly
:
IConfigurationService
,
IInstantiationService
private
readonly
:
IInstantiationService
,
IExperimentationService
private
readonly
:
IExperimentationService
,
IPromptVariablesService
private
readonly
:
IPromptVariablesService
,
IPromptEndpoint
private
readonly
:
IPromptEndpoint
,
)
{
super
(
)
;
}
async
render
(
:
void
,
:
PromptSizing
)
{
const
=
this
.
props
.
customizations
;
if
(
!
)
{
throw
new
Error
(
'AgentPrompt requires customizations to be provided. Use PromptRegistry.resolveAllCustomizations() to resolve them.'
)
;
}
const
=
await
this
.
getSystemPrompt
(
)
;
const
CopilotIdentityRules
=
.
CopilotIdentityRulesClass
;
const
SafetyRules
=
.
SafetyRulesClass
;
const
=
this
.
configurationService
.
getConfig
(
ConfigKey
.
Advanced
.
OmitBaseAgentInstructions
)
;
const
=
!
!
this
.
props
.
promptContext
.
tools
?.
?.
find
(
=>
.
name
===
ToolName
.
Memory
)
;
const
=
<>
<SystemMessage>
You are an expert AI programming assistant, working with a user in the VS Code editor.
<br/>
<CopilotIdentityRules/>
<SafetyRules/>
</SystemMessage>
{
}
{
&&
<SystemMessage>
<MemoryInstructionsPrompt/>
</SystemMessage>
}
</>
;
const
=
this
.
props
.
promptContext
.
request
?.
===
'autopilot'
;
const
=
this
.
props
.
promptContext
.
request
?.
&&
!
this
.
props
.
promptContext
.
request
.
subAgentInvocationId
;
const
=
this
.
props
.
promptContext
.
request
?.
;
const
=
?
sessionResourceToId
(
)
:
undefined
;
const
=
extractDebugTargetSessionIds
(
[
...
this
.
props
.
promptContext
.
chatVariables
]
.
map
(
=>
.
reference
)
)
;
const
=
this
.
promptVariablesService
.
buildTemplateVariablesContext
(
,
)
;
const
=
this
.
getOrFreezeCustomizationsIndex
(
)
;
const
=
<>
{
!
&&
}
{
await
this
.
getAgentCustomInstructions
(
?.
)
}
{
&&
<SystemMessagepriority={80}>
When you have fully completed the task, call the task_complete tool to signal that you are done.
<br/>
IMPORTANT: Before calling task_complete, you MUST provide a brief text summary of what was accomplished in your message. The task is not complete until both the summary and the task_complete call are present.
</SystemMessage>
}
{
&&
<SystemMessagepriority={80}>
Voice Mode is active, and you are GitHub Copilot speaking directly to the user. Keep the final response concise and easy to understand aloud. Do not expose internal reasoning.
<br/>
You MUST call the report_voice_progress tool in the same response as your first real work tool calls, using investigating before reading or searching. Call it again at later meaningful stage changes, not for every operation, and in parallel with actual work when possible. Use planning when deciding the approach, editing while making changes, validating while running tests, builds, lint, or checks, and recovering after a concrete failure or change of approach.
<br/>
Each summary must be a concise factual update in plain speech, at most 240 characters, with no markdown, paths, commands, identifiers, secrets, reasoning, or raw source and tool output. Do not repeat the acknowledgement or final response. Questions, confirmations, questionnaires, and the final response use their existing structured flows instead.
<CustomInstructionslanguageId={undefined}chatVariables={this.props.promptContext.chatVariables}customizationsIndexOverride={frozenCustomizationsIndex?.value}customizationsIndexToolReferencesOverride={frozenCustomizationsIndex?.toolReferences}includeSystemMessageConflictWarning={!putCustomInstructionsInSystemMessage}customIntroduction={putCustomInstructionsInSystemMessage ?'':undefined}// If in system message, skip the "follow these user-provided coding instructions" intro/>
)
;
if
(
this
.
props
.
promptContext
.
modeInstructions
)
{
const
{
,
,
}
=
this
.
props
.
promptContext
.
modeInstructions
;
const
=
&&
.
length
>
0
?
await
this
.
promptVariablesService
.
resolveToolReferencesInPrompt
(
,
)
:
;
.
push
(
<Tagname='modeInstructions'>
You are currently running in "{name}" mode. Below are your instructions for this mode, they must take precedence over any instructions above.
<br/>
<br/>
{
}
</Tag>
)
;
}
return
?
<SystemMessage>
{
}
</SystemMessage>
:
<UserMessage>
{
}
</UserMessage>
;
}
/**
* Snapshot the customizations-index variable on the first turn of the
* conversation and reuse it for every subsequent turn. Stops per-turn
* churn in the bundled `<instructions>`/`<skills>`/`<agents>` text (e.g.
* the active mode swapping which subagent entry is listed in `<agents>`)
* from invalidating the system prompt cache.
*
* Returns:
* - `frozen`: the value (and matching tool-reference offsets) to substitute
* in the system prompt. Always present once a variable is available.
* - `drift`: the live current-turn value (and offsets) when it differs from
* `frozen`. Rendered in the latest user message so the model sees the
* up-to-date listing without busting the system prompt cache. Only
* surfaced when the variable was present this turn; an absent variable
* (e.g. on a request path without `instructionContext` such as terminal
* steering, or when collection ran but produced no listings) leaves the
* frozen system-prompt listing standing rather than emitting an empty
* update that would falsely signal removal.
*
* Returns `undefined` overall if no override should apply (no first turn
* available, or no snapshot yet and the variable is absent on this turn).
*/
private
getOrFreezeCustomizationsIndex
(
)
:
{
:
{
:
string
;
:
readonly
ChatLanguageModelToolReference
[
]
|
undefined
}
;
?
:
{
:
string
;
:
readonly
ChatLanguageModelToolReference
[
]
|
undefined
}
;
}
|
undefined
{
const
=
this
.
props
.
promptContext
.
conversation
?.
.
at
(
0
)
;
if
(
!
)
{
return
undefined
;
}
const
=
this
.
props
.
promptContext
.
chatVariables
.
find
(
=>
isCustomizationsIndex
(
.
reference
)
)
;
const
=
&&
typeof
.
value
===
'string'
?
.
value
:
undefined
;
const
=
?.
.
toolReferences
;
const
=
this
.
instantiationService
.
invokeFunction
(
)
;
const
=
.
getMetadata
(
CustomizationsIndexMetadata
)
;
if
(
&&
.
cacheKey
===
)
{
const
=
{
:
.
value
,
:
.
toolReferences
}
;
// Only surface drift when the variable was present this turn AND
// differs from the snapshot. An absent variable can mean either
// TODO:@bhavyau find a better way to extract session resource
const
=
(
this
.
props
.
promptContext
.
tools
?.
as
any
)
?.
as
string
|
undefined
;
const
=
(
this
.
props
.
promptContext
.
tools
?.
as
any
)
?.
as
URI
|
undefined
;
const
=
this
.
instantiationService
.
createInstance
(
WorkingDirectory
,
)
;
const
=
await
renderPromptElement
(
this
.
instantiationService
,
,
GlobalAgentContext
,
{
:
this
.
props
.
enableCacheBreakpoints
,
:
this
.
props
.
promptContext
.
tools
?.
,
,
,
}
,
undefined
,
undefined
)
;
const
=
.
messages
.
at
(
0
)
?.
;
if
(
)
{
?.
setMetadata
(
new
GlobalContextMessageMetadata
(
,
this
.
instantiationService
.
invokeFunction
(
)
)
)
;
return
;
}
}
}
interface
GlobalAgentContextProps
extends
BasePromptElementProps
{
readonly
?
:
boolean
;
readonly
?
:
readonly
LanguageModelToolInformation
[
]
;
readonly
?
:
boolean
;
readonly
?
:
string
;
readonly
:
WorkingDirectory
;
}
/**
* The "global agent context" is a static prompt at the start of a conversation containing user environment info, initial workspace structure, anything else that is a useful beginning
* hint for the agent but is not updated during the conversation.
*/
/** Tag name used to wrap the user query (e.g., 'userRequest' or 'user_query') */
readonly
?
:
string
;
/** Custom reminder instructions component class */
readonly
ReminderInstructionsClass
?
:
ReminderInstructionsConstructor
;
/** Custom tool references hint component class */
readonly
ToolReferencesHintClass
?
:
ToolReferencesHintConstructor
;
}
export
interface
AgentUserMessageProps
extends
BasePromptElementProps
,
AgentUserMessageCustomizations
{
readonly
?
:
Turn
;
readonly
?
:
boolean
;
readonly
:
string
;
readonly
:
IChatEndpoint
;
readonly
:
readonly
InternalToolReference
[
]
;
readonly
?
:
readonly
LanguageModelToolInformation
[
]
;
readonly
:
ChatVariablesCollection
;
readonly
?
:
boolean
;
readonly
?
:
readonly
ChatRequestEditedFileEvent
[
]
;
readonly
?
:
string
;
readonly
?
:
string
;
/** When true, indicates this is a stop hook continuation where the stop hook query is rendered as a separate message. */
readonly
?
:
boolean
;
/** Additional context provided by SubagentStart hooks. */
readonly
?
:
string
;
/** When true, this request was system-initiated (e.g. terminal completion notification) and should skip context/wrapping. */
readonly
?
:
boolean
;
/**
* Live customizations-index text rendered into the latest user message
* when it has drifted from the frozen snapshot in the system prompt.
* Lets the model see mid-conversation updates (new skill, mode swap, etc.)
* without invalidating the system prompt cache.
*
* Rendered inside this message's `<Tag name='context'>` (rather than as a
* sibling `UserMessage`) so it becomes part of the captured
* `RenderedUserMessageMetadata`. Emitting it as a separate UserMessage
* would cause `result.messages.at(-1)` in `agentIntent.runOne` to point
* at the drift block instead of the user query — the metadata would then
* store just the drift block and historical replays on later turns would
* lose the actual user query, busting cross-turn cache continuity.
*
* Only set when the current value differs from the snapshot captured on
* the first turn.
*/
readonly
?
:
{
:
string
;
:
readonly
ChatLanguageModelToolReference
[
]
|
undefined
}
;
}
export
function
getUserMessagePropsFromTurn
(
:
Turn
,
:
IChatEndpoint
,
?
:
AgentUserMessageCustomizations
)
:
AgentUserMessageProps
{
return
{
:
true
,
:
.
request
.
message
,
,
,
:
.
toolReferences
,
:
.
promptVariables
??
new
ChatVariablesCollection
(
)
,
:
.
editedFileEvents
,
:
false
,
// Should only be added to the current turn - some user messages may get them in Agent post-processing
...
,
}
;
}
export
function
getUserMessagePropsFromAgentProps
(
:
AgentPromptProps
,
?
:
AgentUserMessageCustomizations
)
:
AgentUserMessageProps
{
return
{
:
.
promptContext
.
query
,
// Will pull frozenContent off the Turn if available
:
.
promptContext
.
conversation
?.
getLatestTurn
(
)
,
:
.
endpoint
,
:
.
promptContext
.
tools
?.
??
[
]
,
:
.
promptContext
.
tools
?.
,
:
.
promptContext
.
chatVariables
,
:
.
enableCacheBreakpoints
,
:
.
promptContext
.
editedFileEvents
,
:
.
promptContext
.
hasStopHookQuery
,
:
.
promptContext
.
additionalHookContext
,
:
.
promptContext
.
request
?.
,
// TODO:@roblourens
:
(
.
promptContext
.
tools
?.
as
any
)
?.
,
:
(
.
promptContext
.
tools
?.
as
any
)
?.
,
...
,
}
;
}
/**
* Is sent with each user message. Includes the user message and also any ambient context that we want to update with each request.
* Uses frozen content if available, for prompt caching and to avoid being updated by any agent action below this point in the conversation.
*/
// Only include current date when not running simulations, since if we generate cache entries with the current date, the cache will be invalidated every day
return
(
!
this
.
envService
.
isSimulation
(
)
&&
<>
The current date is
{
}
.
</>
)
;
}
}
interface
AdditionalHookContextPromptProps
extends
BasePromptElementProps
{
readonly
:
string
;
}
/**
* Renders additional context provided by hooks.
*/
class
AdditionalHookContextPrompt
extends
PromptElement<AdditionalHookContextPromptProps>
{
async
render
(
:
void
,
:
PromptSizing
)
{
return
<>
Additional instructions from hooks:
{
this
.
props
.
context
}
</>
;
}
}
interface
CustomizationsIndexUpdateProps
extends
BasePromptElementProps
{
readonly
:
{
:
string
;
:
readonly
ChatLanguageModelToolReference
[
]
|
undefined
}
;
}
/**
* Surfaces drift between the frozen customizations-index snapshot (in the
* system prompt) and the current turn's listing. Rendered inside
* `AgentUserMessage`'s `<Tag name='context'>` alongside `EditedFileEvents`,
* `TerminalStatePromptElement`, etc., so it becomes part of the same
* `UserMessage` and is captured into `RenderedUserMessageMetadata` together
* with the user query. Replays verbatim on subsequent turns as the
* historical user message, preserving cross-turn cache continuity. Emitting
* it as a sibling `UserMessage` would make `result.messages.at(-1)` point at
* the drift block in `agentIntent.runOne`, so the metadata would store just
* the drift block and historical replays on later turns would lose the
* actual user query.
*
* Used only when the live index differs from the snapshot captured on the
* first turn.
*/
class
CustomizationsIndexUpdate
extends
PromptElement<CustomizationsIndexUpdateProps>
{
constructor
(
:
CustomizationsIndexUpdateProps
,
IPromptVariablesService
private
readonly
:
IPromptVariablesService
,
)
{
super
(
)
;
}
async
render
(
)
{
let
=
this
.
props
.
update
.
value
;
const
=
this
.
props
.
update
.
toolReferences
;
if
(
?.
)
{
=
await
this
.
promptVariablesService
.
resolveToolReferencesInPrompt
(
,
)
;
}
return
<Tagname='customizationsUpdate'>
The available instructions, skills, and agents have changed since this conversation started. The listings below supersede the ones in the system prompt.
<br/>
{
}
</Tag>
;
}
}
interface
SkillAdherenceReminderProps
extends
BasePromptElementProps
{
readonly
:
ChatVariablesCollection
;
}
/**
* Skill adherence reminder that prompts the model to read SKILL.md files when skills are available
* in the instruction index.
* Shown whenever the instruction index variable contains at least one skill or skill folder entry.
*/
class
SkillAdherenceReminder
extends
PromptElement<SkillAdherenceReminderProps>
{
constructor
(
:
SkillAdherenceReminderProps
,
ICustomInstructionsService
private
readonly
:
ICustomInstructionsService
,
IConfigurationService
private
readonly
:
IConfigurationService
,
IExperimentationService
private
readonly
:
IExperimentationService
,
)
{
super
(
)
;
}
async
render
(
)
{
// Check if any skills are available from the instruction index
const
=
this
.
props
.
chatVariables
.
find
(
=>
isCustomizationsIndex
(
.
reference
)
)
;
if
(
!
||
!
isString
(
.
value
)
)
{
return
undefined
;
}
const
=
this
.
customInstructionsService
.
parseInstructionIndexFile
(
.
value
)
;
if
(
.
skills
.
size
===
0
)
{
return
undefined
;
}
const
=
this
.
configurationService
.
getExperimentBasedConfig
(
ConfigKey
.
Advanced
.
SkillToolEnabled
,
this
.
experimentationService
)
;
if
(
)
{
return
<Tagname='additional_skills_reminder'>
Always check if any skills apply to the user's request. If so, use the
{
ToolName
.
Skill
}
tool to invoke the skill by name. Multiple skill files may be needed for a single request. These files contain best practices built from testing that are needed for high-quality outputs.
<br/>
</Tag>
;
}
return
<Tagname='additional_skills_reminder'>
Always check if any skills apply to the user's request. If so, use the
{
ToolName
.
ReadFile
}
tool to read the corresponding SKILL.md files. Multiple skill files may be needed for a single request. These files contain best practices built from testing that are needed for high-quality outputs.
<br/>
</Tag>
;
}
}
interface
CurrentEditorContextProps
extends
BasePromptElementProps
{
readonly
:
IChatEndpoint
;
}
/**
* Include the user's open editor and cursor position, but not content. This is independent of the "implicit context" attachment.
*/
class
CurrentEditorContext
extends
PromptElement<CurrentEditorContextProps>
{
constructor
(
:
CurrentEditorContextProps
,
ITabsAndEditorsService
private
readonly
:
ITabsAndEditorsService
,
IPromptPathRepresentationService
private
readonly
:
IPromptPathRepresentationService
,
IConfigurationService
private
readonly
:
IConfigurationService
,
IAlternativeNotebookContentService
private
readonly
:
IAlternativeNotebookContentService
,
)
{
super
(
)
;
}
async
render
(
:
void
,
:
PromptSizing
)
{
if
(
!
this
.
configurationService
.
getConfig
(
ConfigKey
.
CurrentEditorAgentContext
)
)
{
return
;
}
let
:
PromptElement
|
undefined
;
const
=
this
.
tabsAndEditorsService
.
activeTextEditor
;
if
(
)
{
=
this
.
renderActiveTextEditor
(
)
;
}
const
=
this
.
tabsAndEditorsService
.
activeNotebookEditor
;
if
(
)
{
=
this
.
renderActiveNotebookEditor
(
)
;
}
if
(
!
)
{
return
;
}
return
<Tagname='editorContext'>
{
}
</Tag>
;
}
private
renderActiveTextEditor
(
:
TextEditor
)
{
// Should this include column numbers too? This confused gpt-4.1 and it read the wrong line numbers, need to find the right format.
const
=
.
selection
;
// Found that selection is not always defined, so check for it.
const
=
(
&&
!
.
isEmpty
)
?
<>
The current selection is from line
{
.
start
.
line
+
1
}
to line
{
.
end
.
line
+
1
}
.
</>
:
undefined
;
return
<>
The user's current file is
{
this
.
promptPathRepresentationService
.
getFilePath
(
.
document
.
uri
)
}
.
{
}
</>
;
}
private
renderActiveNotebookEditor
(
:
NotebookEditor
)
{
const
=
this
.
alternativeNotebookContent
.
create
(
this
.
alternativeNotebookContent
.
getFormat
(
this
.
props
.
endpoint
)
)
.
getAlternativeDocument
(
.
notebook
)
;
let
=
''
;
// Found that selection is not always defined, so check for it.
if
(
.
selection
&&
!
.
selection
.
isEmpty
&&
.
notebook
.
cellCount
>
0
)
{
// Compute a list of all cells that fall in the range of selection.start and selection.end
const
{
,
}
=
.
selection
;
const
=
[
]
;
for
(
let
=
;
<
;
++
)
{
const
=
.
notebook
.
cellAt
(
)
;
if
(
)
{
.
push
(
)
;
}
}
const
=
[
0
]
;
const
=
[
.
length
-
1
]
;
const
=
.
document
.
lineAt
(
.
document
.
lineCount
-
1
)
;
const
=
.
fromCellPosition
(
,
new
Position
(
0
,
0
)
)
;
const
=
.
fromCellPosition
(
,
new
Position
(
.
document
.
lineCount
-
1
,
.
text
.
length
)
)
;
const
=
new
Range
(
,
)
;
=
?
` The current selection is from line ${selection.start.line +1} to line ${selection.end.line +1}.`
:
''
;
}
return
<>
The user's current notebook is
{
this
.
promptPathRepresentationService
.
getFilePath
(
.
notebook
.
uri
)
}
.
{
}
</>
;
}
}
interface
WorkspaceFoldersHintProps
extends
BasePromptElementProps
{
readonly
:
WorkingDirectory
;
}
class
WorkspaceFoldersHint
extends
PromptElement<WorkspaceFoldersHintProps>
{
constructor
(
:
WorkspaceFoldersHintProps
,
IPromptPathRepresentationService
private
readonly
:
IPromptPathRepresentationService
,
)
{
super
(
)
;
}
async
render
(
:
void
,
:
PromptSizing
)
{
const
=
this
.
props
.
workingDir
.
getFolders
(
)
;
if
(
.
length
>
0
)
{
return
(
<>
I am working in a workspace with the following folders: