Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
/** Hardcoded extension→languageId fallback for common languages.
*
* The agents window does not load language services / built-in language
* extensions yet, so `ILanguageService.guessLanguageIdByFilepathOrFirstLine`
* returns `'unknown'` for everything except a small core set. Once the
* agents window starts loading language services this map becomes a
* pure fallback for the leftover `'unknown'` cases. The IDs match
* VS Code's built-in extension `package.json` contributions. */
const
EXTENSION_LANGUAGE_MAP
:
<
string
,
string
>
=
{
'.js'
:
'javascript'
,
'.mjs'
:
'javascript'
,
'.cjs'
:
'javascript'
,
'.jsx'
:
'javascriptreact'
,
'.ts'
:
'typescript'
,
'.mts'
:
'typescript'
,
'.cts'
:
'typescript'
,
'.tsx'
:
'typescriptreact'
,
'.py'
:
'python'
,
'.pyw'
:
'python'
,
'.java'
:
'java'
,
'.c'
:
'c'
,
'.h'
:
'c'
,
'.cpp'
:
'cpp'
,
'.cc'
:
'cpp'
,
'.cxx'
:
'cpp'
,
'.hpp'
:
'cpp'
,
'.cs'
:
'csharp'
,
'.go'
:
'go'
,
'.rs'
:
'rust'
,
'.rb'
:
'ruby'
,
'.php'
:
'php'
,
'.html'
:
'html'
,
'.htm'
:
'html'
,
'.css'
:
'css'
,
'.scss'
:
'scss'
,
'.less'
:
'less'
,
'.json'
:
'json'
,
'.jsonc'
:
'jsonc'
,
'.md'
:
'markdown'
,
'.sh'
:
'shellscript'
,
'.bash'
:
'shellscript'
,
'.zsh'
:
'shellscript'
,
'.yaml'
:
'yaml'
,
'.yml'
:
'yaml'
,
'.xml'
:
'xml'
,
'.sql'
:
'sql'
,
'.swift'
:
'swift'
,
'.kt'
:
'kotlin'
,
'.kts'
:
'kotlin'
,
'.r'
:
'r'
,
'.lua'
:
'lua'
,
'.dart'
:
'dart'
,
}
;
/**
* Command ID for opening the {@link MobileDiffView}.
*
* Accepts {@link IMobileDiffViewData} as the single argument. Phone-only.
*
* For backwards compatibility the command also accepts a bare
* {@link IFileDiffViewData} (without siblings) — in that case the view
* is rendered without prev/next navigation.
*/
export
const
MOBILE_OPEN_DIFF_VIEW_COMMAND_ID
=
'sessions.mobile.openDiffView'
;
/**
* Minimal subset of diff entry fields consumed by the mobile diff view.
* Defined locally to avoid importing from vs/workbench/contrib in vs/sessions/browser.
*/
export
interface
IFileDiffViewData
{
/**
* URI of the file before the change. `undefined` when the file is
* newly added by the agent and there is no prior content; the diff
* is rendered against an empty original (all lines as additions).
*/
readonly
:
URI
|
undefined
;
/**
* URI of the file after the change. `undefined` when the file was
* deleted by the agent — the diff is rendered as all-removed lines
* read from {@link originalURI}.
*/
readonly
:
URI
|
undefined
;
readonly
:
boolean
;
readonly
:
number
;
readonly
:
number
;
}
/**
* Data passed to {@link MobileDiffView} when opening a diff view.
*
* When {@link siblings} is provided and contains more than one entry,
* the header renders prev/next chevrons that navigate within the list.
*/
export
interface
IMobileDiffViewData
{
readonly
:
;
readonly
?
:
readonly
[
]
;
readonly
?
:
number
;
}
/**
* Full-screen overlay for viewing file changes produced by a coding agent
* session on phone viewports.
*
* Renders a unified diff with coloured +/- gutters, line numbers, and
* Monaco-quality syntax highlighting. Text is read from the file service
* via the modified/original URIs stored in {@link IFileDiffViewData}.
* This keeps the view lightweight — it avoids embedding a full Monaco
* diff editor while still giving users a readable, theme-aware view.
*
* Follows the account-sheet overlay pattern: appends to the workbench
* container, disposes on back-button tap.
*/
export
class
MobileDiffView
extends
Disposable
{
private
readonly
=
this
.
_register
(
new
Emitter<void>
(
)
)
;
/**
* Fires when this view has been disposed (either externally or
* because the user tapped Back). Used by the mobile overlay
* contribution to clear its `MutableDisposable<MobileDiffView>` slot.
*/
readonly
:
<
void
>
=
this
.
.
;
private
readonly
=
this
.
_register
(
new
DisposableStore
(
)
)
;
private
=
false
;
/** Bumped on every body render so late-arriving `textFileService.read`
* promises know to drop their results when the user navigated away. */
private
=
0
;
private
readonly
:
readonly
[
]
;
private
:
number
;
private
!
:
;
private
!
:
;
private
!
:
;
private
!
:
;
private
!
:
;
private
!
:
;
private
!
:
;
constructor
(
:
,
:
,
private
readonly
:
,
private
readonly
:
,
)
{
super
(
)
;
// Normalise siblings into a non-empty array so all subsequent code
// can index it directly. If the caller didn't pass siblings we
// treat the single diff as its own one-element list.
/**
* Tokenize a full text and return the per-line HTML (one entry per
* source line, in order). Uses `tokenizeToString` which awaits
* `TokenizationRegistry.getOrCreate(languageId)` — without that, sync
* tokenization returns null highlighting for any language whose
* textmate grammar hasn't been activated yet (common in agents
* workbench, where no editor has opened the file).
*
* Tokenization runs over the whole text so state (open string,
* template literal, block comment) propagates correctly across lines.
*/
async
function
tokenizeFileLines
(
:
,
:
string
,
:
string
)
:
Promise
<
string
[
]
>
{
if
(
!
)
{
return
[
''
]
;
}
const
=
await
tokenizeToString
(
,
,
)
;
const
=
stripTokenizedWrapper
(
)
;
// `_tokenizeToString` separates lines with `<br/>` (no closing tag,
// always lower-case in the upstream implementation). Splitting on
// the literal preserves the inner `<span class="mtkN">…</span>`
// markup that gives us the syntax-highlight colours.
return
.
split
(
'<br/>'
)
;
}
/**
* `tokenizeToString` returns HTML wrapped in
* `<div class="monaco-tokenized-source">…</div>`. We render per-line into
* an inline `<span>`, so we strip the wrapper and keep just the inner
* `<span class="mtkN">` token spans.
*/
function
stripTokenizedWrapper
(
:
string
)
:
string
{
const
=
'<div class="monaco-tokenized-source">'
;
const
=
'</div>'
;
if
(
.
startsWith
(
)
&&
.
endsWith
(
)
)
{
return
.
slice
(
.
,
.
-
.
)
;
}
return
;
}
/**
* Returns true when the Monaco tokenizer produced real syntax tokens,
* i.e. the HTML contains more than just `mtk1` class spans. When the
* TextMate grammar for the language isn't loaded (common on the agents
* workbench which doesn't load built-in language extensions), every
* token falls back to `mtk1` (default foreground).
*/
` so we get the same diff quality as
// the diff editor — no in-tree diff algorithm to maintain.
interface IDiffLine {
type: 'context' | 'added' | 'removed';
lineNum?: number;
text: string;
}
interface IDiffHunk {
header: string;
lines: IDiffLine[];
}
const CONTEXT_LINES = 3;
function computeUnifiedDiff(original: string, modified: string): IDiffHunk[] {
const origLines = original.split(/\r?\n/);
const modLines = modified.split(/\r?\n/);
const result = linesDiffComputers.getDefault().computeDiff(origLines, modLines, {
ignoreTrimWhitespace: false,
maxComputationTimeMs: 1000,
computeMoves: false,
});
if (result.changes.length === 0) {
return [];
}
// Merge changes that are within 2*CONTEXT_LINES of each other into a
// single hunk so consecutive edits aren't visually fragmented. Each
// group keeps the list of underlying changes so that unchanged lines
// between merged sub-changes can later be emitted as `
` rather
// than `
`/`
`.
type Sub = { origStart: number; origEnd: number; modStart: number; modEnd: number };
type Group = { subs: Sub[] };
const groups: Group[] = [];
for (const change of result.changes) {
const sub: Sub = {
origStart: change.original.startLineNumber,
origEnd: change.original.endLineNumberExclusive,
modStart: change.modified.startLineNumber,
modEnd: change.modified.endLineNumberExclusive,
};
const last = groups[groups.length - 1];
const lastSub = last?.subs[last.subs.length - 1];
if (lastSub && sub.origStart - lastSub.origEnd <= CONTEXT_LINES * 2) {
last!.subs.push(sub);
} else {
groups.push({ subs: [sub] });
}
}
const hunks: IDiffHunk[] = [];
for (const group of groups) {
const first = group.subs[0];
const last = group.subs[group.subs.length - 1];
const origLeading = Math.max(1, first.origStart - CONTEXT_LINES);
const modLeading = Math.max(1, first.modStart - CONTEXT_LINES);
const origTrailing = Math.min(origLines.length + 1, last.origEnd + CONTEXT_LINES);
const modTrailing = Math.min(modLines.length + 1, last.modEnd + CONTEXT_LINES);
const lines: IDiffLine[] = [];
// Leading context (from original — identical to modified in unchanged regions).
for (let i = origLeading; i < first.origStart; i++) {
lines.push({ type: 'context', lineNum: i, text: origLines[i - 1] ?? '' });
}
// Walk each sub-change in the group. Emit removed/added for the
// change itself, then context lines for the unchanged region
// between this sub and the next.
for (let s = 0; s < group.subs.length; s++) {
const sub = group.subs[s];
for (let i = sub.origStart; i < sub.origEnd; i++) {
lines.push({ type: 'removed', lineNum: i, text: origLines[i - 1] ?? '' });
}
for (let i = sub.modStart; i < sub.modEnd; i++) {
lines.push({ type: 'added', lineNum: i, text: modLines[i - 1] ?? '' });
}
const next = group.subs[s + 1];
if (next) {
// Unchanged region between two merged sub-changes — these
// must render as context. We display them with their
// original-side line numbers because the gutter mirrors
// the original side for context rows elsewhere in the file.
for (let i = sub.origEnd; i < next.origStart; i++) {
lines.push({ type: 'context', lineNum: i, text: origLines[i - 1] ?? '' });
}
}
}
// Trailing context.
for (let i = last.origEnd; i < origTrailing; i++) {
lines.push({ type: 'context', lineNum: i, text: origLines[i - 1] ?? '' });
}
const origCount = origTrailing - origLeading;
const modCount = modTrailing - modLeading;
hunks.push({
header: `
-
{
}
,
{
}
+
{
}
,
{
}
,
,
}
)
;
}
return
;
}
/**
* Opens a {@link MobileDiffView} for the given file diff.
* Returns the view instance; dispose it to close.
*/