Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
/**
* Regression test from a real scenario:
*
* User typed `class Fibonacci {\n\t` character by character. Two NES requests
* were made at different points during typing:
*
* - Request #6 (early): doc ended with `class `, model predicted `class FibonacciCalculator {`
* - Request #18 (later): doc ended with `class Fibonacci `, model predicted `class Fibonacci {`
*
* When `lookupNextEdit` runs, it should find and rebase the compatible cached edit
* from request #18 (whose prediction matches the user's typing).
*/
describe
(
'NextEditCache rebase — Fibonacci scenario'
,
(
)
=>
{
let
:
;
let
:
;
let
:
;
let
:
;
let
:
;
let
:
;
// Common prefix of all document states — everything before the class declaration
const
=
'import * as vscode from \'vscode\';\n'
+
'import { ASTNodeWithOffset } from \'./nodeTypes\';\n'
+
'import { NodeTypesIndex } from \'./nodeTypesIndex\';\n'
+
'import { Result } from \'./util/common/result\';\n'
+
'import { LRUCache } from \'./util/vs/base/common/map\';\n'
+
'\n'
+
'export class NodeTypesDefinitionProvider implements vscode.DefinitionProvider {\n'
// Model also has a 2nd edit: insert at 1961 → class body
// User then typed "{\n\t" → userEditSince: [1944,1960) → "class Fibonacci {\n\t"
//
// The user's typing is a superset of the model's first edit (model: "{", user: "{\n\t"),
// so rebase should succeed and the 2nd edit (class body) should be offered.
const
=
.
setKthNextEdit
(
,
new
StringText
(
)
,
new
OffsetRange
(
,
)
,
// editWindow
new
StringReplacement
(
new
OffsetRange
(
,
)
,
'class Fibonacci {'
)
,
0
,
[
new
StringReplacement
(
new
OffsetRange
(
,
)
,
'class Fibonacci {'
)
,
new
StringReplacement
(
.
emptyAt
(
+
'class Fibonacci {'
.
)
,
'\n\tprivate memo: Map<number, number>;\n\n\tconstructor() {\n\t\tthis.memo = new Map();\n\t}\n\n\tcalc(n: number): number {\n\t\tif (n <= 1) {\n\t\t\treturn n;\n\t\t}\n\t\tif (this.memo.has(n)) {\n\t\t\treturn this.memo.get(n)!;\n\t\t}\n\t\tconst result = this.calc(n - 1) + this.calc(n - 2);\n\t\tthis.memo.set(n, result);\n\t\treturn result;\n\t}\n}'
)
,
]
,
.
single
(
new
StringReplacement
(
new
OffsetRange
(
,
)
,
'class Fibonacci {\n\t'
)
)
,
makeSource
(
)
,
{
:
false
,
:
,
:
}
,
)
;
assert
(
!==
undefined
,
'setKthNextEdit should return the cached edit'
)
;
assert
(
.
!==
undefined
,
'userEditSince should be set'
)
;
.
=
true
;
const
=
.
tryRebaseCacheEntry
(
,
new
StringText
(
)
,
[
new
OffsetRange
(
,
)
]
,
)
;
assert
(
.
!==
undefined
,
'should rebase successfully'
)
;
assert
(
.
.
!==
undefined
,
'should have a rebased edit for the class body'
)
;
.
strictEqual
(
.
.
,
,
'should preserve model attribution on the rebased edit'
)
;
const
=
.
.
;
assert
(
,
'should reference the stable cache entry'
)
;
.
strictEqual
(
,
)
;
.
strictEqual
(
.
,
true
,
'should preserve inline-rendered state on the stable cache entry'
)
;
}
)
;
}
)
;
describe
(
'NextEditCache ghost-text presentation state'
,
(
)
=>
{
const
=
new
StringText
(
'const value = 1;\n'
)
;
const
=
.
create
(
URI
.
file
(
'/test/cache-presentation-state.ts'
)
.
toString
(
)
)
;
function
makeSource
(
)
:
{
const
=
new
InlineEditRequestLogContext
(
'test'
,
0
,
undefined
)
;
return
new
NextEditFetchRequest
(
generateUuid
(
)
,
,
undefined
,
false
)
;
}
it
(
'does not carry inline-rendered state to a replacement cache entry'
,
(
)
=>
{
const
=
new
MutableObservableWorkspace
(
)
;
.
addDocument
(
{
:
,
:
.
}
)
;
const
=
new
NextEditCache
(
,
new
LogServiceImpl
(
[
]
)
,
new
DefaultsOnlyConfigurationService
(
)
,
new
NullExperimentationService
(
)
)
;
const
=
.
setKthNextEdit
(
,
,
undefined
,
.
insert
(
.
.
,
'first'
)
,
0
,
undefined
,
undefined
,
makeSource
(
)
,
{
:
false
,
:
}
,
)
;
assert
(
)
;
.
=
true
;
const
=
.
setKthNextEdit
(
,
,
undefined
,
.
insert
(
.
.
,
'replacement'
)
,
0
,
undefined
,
undefined
,
makeSource
(
)
,
{
:
false
,
:
}
,
)
;
const
=
.
lookupNextEdit
(
,
,
[
.
emptyAt
(
.
.
)
]
)
;
.
deepStrictEqual
(
{
:
===
,
:
?.
?.
,
:
?.
,
}
,
{
:
true
,
:
'replacement'
,
:
undefined
,
}
)
;
}
)
;
}
)
;
/**
* Regression test from a real scenario (NES cached suggestion not shown):
*
* The user is inside `function familyJohn() {` on an empty body line. NES cached a
* suggestion that predicts the indented `return [` on that line (`"" -> " return ["`).
* The user then presses Tab to indent the line, inserting a tab character.
*
* Strict rebase matches indentation literally, so the tab-vs-spaces mismatch makes
* the whole suggestion drop (`rebaseFailed`) and nothing is shown. When the
* `reanchorContentOnIndentationMismatch` setting is enabled, the model's still-valid
* content is re-anchored as a clean pure insertion of `return [` at the cursor,
* respecting the tab the user typed. When disabled, the suggestion is dropped.
*/
describe
(
'NextEditCache rebase — indented insertion over mismatched user indentation'
,
(
)
=>
{
let
:
;
let
:
;
let
:
;
let
:
;
let
:
;
let
:
;
// cache-time doc: empty body line inside the function
const
=
'function familyJohn() {\n\n}\n'
;
const
=
'function familyJohn() {\n'
.
;
// start of the empty body line
// current doc: the user pressed Tab (a tab character) on the (empty) body line
const
=
'function familyJohn() {\n\t\n}\n'
;
const
=
+
'\t'
.
;
// caret sits after the typed tab
function
makeSource
(
)
:
{
const
=
new
InlineEditRequestLogContext
(
'test'
,
0
,
undefined
)
;
return
new
NextEditFetchRequest
(
generateUuid
(
)
,
,
undefined
,
false
)
;
}
/** Cache the model's indented prediction, then rebase it over the user's typed tab. */
function
cacheAndRebase
(
)
{
// Model predicts the indented `return [` on the empty body line.
const
=
new
StringReplacement
(
.
emptyAt
(
)
,
' return ['
)
;
// The user pressed Tab on that same (empty) line, inserting a tab character.
const
=
.
single
(
new
StringReplacement
(
.
emptyAt
(
)
,
'\t'
)
)
;
const
=
.
setKthNextEdit
(
,
new
StringText
(
)
,
undefined
,
// editWindow
,
0
,
[
]
,
,
makeSource
(
)
,
{
:
false
,
:
,
:
}
,
)
;
assert
(
!==
undefined
,
'setKthNextEdit should return the cached edit'
)
;
assert
(
.
!==
undefined
,
'userEditSince should be set'
)
;
return
.
tryRebaseCacheEntry
(
,
new
StringText
(
)
,
[
.
emptyAt
(
)
]
,
)
;
}
beforeEach
(
async
(
)
=>
{
=
new
InMemoryConfigurationService
(
new
DefaultsOnlyConfigurationService
(
)
)
;
await
.
setConfig
(
.
.
,
true
)
;
await
.
setConfig
(
.
.
,
true
)
;
=
new
MutableObservableWorkspace
(
)
;
=
new
LogServiceImpl
(
[
]
)
;
=
new
NullExperimentationService
(
)
;
=
.
create
(
URI
.
file
(
'/test/example.ts'
)
.
toString
(
)
)
;
.
addDocument
(
{
:
,
:
}
)
;
=
new
NextEditCache
(
,
,
,
)
;
}
)
;
it
(
'serves a clean at-cursor insertion (no leading whitespace) after the user tabs'
,
(
)
=>
{
const
=
cacheAndRebase
(
)
;
assert
(
.
!==
undefined
,
'should serve a (re-anchored) edit instead of dropping it'
)
;
assert
(
.
.
!==
undefined
,
'should have a rebased edit'
)
;
// The tab the user typed must not be part of the edit: a pure insertion at the cursor.