Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
/** Continuous enhanced-telemetry slices with no request bookmark; a pivot is synthesized. */
=
'continuous'
,
/** A raw, stateful local workspaceRecording@1.0 JSONL timeline. */
=
'workspace-recording'
,
}
export
const
DEFAULT_WORKSPACE_RECORDING_SAMPLE_CAP
=
100
;
export
const
DEFAULT_NES_DATAGEN_ORACLE_EDIT_LIMIT
=
10
;
/**
* How to choose the pivot in a continuous recording (only meaningful when
* `--input-format=continuous`). The pivot splits the timeline into context and
* the oracle (next user edit).
*/
export
enum
{
/** Pick a single eligible pivot uniformly at random. */
=
'random'
,
}
export
type
NesDatagen
=
{
readonly
:
string
;
readonly
:
string
|
undefined
;
readonly
:
number
;
readonly
:
boolean
;
readonly
:
;
/** Shape of the input recordings. */
readonly
:
;
/** Pivot selection strategy for continuous recordings. Ignored for alternative-action input. */
readonly
:
;
/**
* Seed for the continuous pivot RNG. Resolved once (random when `--seed` is
* omitted) so it can be propagated to all parallel workers for reproducible
* output. Ignored for alternative-action input.
*/
readonly
:
number
;
/** Minimum same-file lines above the request cursor for a move to count as a jump. */
readonly
:
number
;
/** Minimum same-file lines below the request cursor for a move to count as a jump. */
readonly
:
number
;
/** Maximum number of samples selected from one raw workspace recording. */
readonly
?
:
number
;
/** Maximum number of composed, non-touching oracle edits in one sample. */
readonly
?
:
number
;
/** Whether to emit scoredEdits viewer files for generated samples. */
readonly
:
boolean
;
/** Internal worker-only directory for staging scoredEdits files. */
readonly
?
:
string
;
/** Internal worker-only subset of selected workspace-recording operation indices. */
readonly
?
:
readonly
number
[
]
;
}
;
export
class
SimulationOptions
{
public
static
fromProcessArgs
(
)
:
{
return
new
SimulationOptions
(
.
)
;
}
public
static
fromArray
(
:
readonly
string
[
]
)
:
{
return
new
SimulationOptions
(
)
;
}
private
readonly
:
.
;
public
readonly
:
boolean
;
public
readonly
:
boolean
;
public
readonly
:
boolean
;
public
readonly
:
boolean
;
public
readonly
:
boolean
;
public
readonly
:
number
;
public
readonly
:
string
|
undefined
;
public
readonly
:
string
|
undefined
;
public
readonly
:
string
|
undefined
;
public
readonly
:
string
|
undefined
;
public
readonly
:
boolean
;
public
readonly
:
boolean
;
public
readonly
:
|
undefined
;
public
readonly
:
boolean
;
public
readonly
:
number
;
public
readonly
:
;
public
readonly
:
;
public
readonly
:
;
public
readonly
:
string
|
undefined
;
public
readonly
:
string
|
undefined
;
public
readonly
:
string
|
undefined
;
public
readonly
:
string
|
undefined
;
public
readonly
:
boolean
;
public
readonly
:
boolean
;
public
readonly
:
boolean
;
public
readonly
:
boolean
;
public
readonly
:
boolean
;
public
readonly
:
boolean
;
public
readonly
:
string
|
undefined
;
public
readonly
:
number
|
boolean
|
undefined
;
public
readonly
:
string
[
]
|
string
|
undefined
;
public
readonly
:
string
|
undefined
;
public
readonly
:
boolean
|
string
|
undefined
;
/** --scenario-test, --scenarioTest Run tests from provided scenario test file name */
public
readonly
:
string
|
undefined
;
public
readonly
:
boolean
;
public
readonly
:
boolean
;
public
readonly
:
boolean
;
/**
* A label for the current simulation run, to be displayed in the UI for distinguishing between runs.
*/
public
readonly
:
string
;
public
readonly
:
boolean
;
public
readonly
:
'external'
|
'coffe'
|
undefined
;
public
readonly
:
string
|
undefined
;
public
readonly
:
string
|
undefined
;
public
readonly
:
|
undefined
;
public
readonly
:
'nes-datagen'
|
undefined
;
public
readonly
:
<
string
>
;
/** If true, all tests are run in the extension host */
public
readonly
:
boolean
;
/** Extensions to ensure are available in the extension host */
public
readonly
:
string
[
]
;
/** Whether to run headless (defaults to false) */
public
readonly
:
boolean
;
/** @internal Only run a single test number */
public
readonly
:
number
;
/** Explicit workspace URI to use for stest --in-extension-host */
public
readonly
:
boolean
;
/** If true, will try to use code search using our service. */
public
readonly
:
boolean
;
public
readonly
:
string
|
undefined
;
public
readonly
:
string
|
undefined
;
/**
* Path to a JSON file describing an adhoc chat request to send (used by the
* simulation workbench "Adhoc request sender" mode). The file contains
* `{ system: string; user: string; model: string }`.
*/
public
readonly
:
string
|
undefined
;
protected
constructor
(
:
readonly
string
[
]
)
{
const
=
minimist
(
.
slice
(
2
)
)
;
this
.
=
;
this
.
=
boolean
(
[
'help'
]
,
false
)
;
this
.
=
boolean
(
[
'list-models'
]
,
false
)
;
this
.
=
boolean
(
[
'list-tests'
]
,
false
)
;
this
.
=
boolean
(
[
'list-suites'
]
,
false
)
;
this
.
=
boolean
(
[
'json'
]
,
false
)
;
this
.
=
boolean
(
[
'update-baseline'
]
??
[
'u'
]
,
false
)
;
this
.
=
boolean
(
[
'boost'
]
,
false
)
;
const
=
boolean
(
[
'fetch'
]
,
true
)
;
this
.
=
!
;
// `--no-fetch` becomes argv[`fetch`] because of how minimist works
const
=
boolean
(
[
'cache-pointer'
]
,
true
)
;
this
.
=
!
;
// `--no-cache-pointer` becomes argv[`cache-pointer`] because of how minimist works
this
.
=
typeof
[
'n'
]
===
'number'
?
[
'n'
]
:
(
this
.
||
[
'ci'
]
?
BASELINE_RUN_COUNT
:
10
)
;
this
.
=
this
.
[
'model'
]
;
this
.
=
this
.
[
'smart-model'
]
;
this
.
=
this
.
[
'fast-model'
]
;
this
.
=
this
.
[
'fast-rewrite-model'
]
;
this
.
=
boolean
(
[
'summarize-history'
]
,
true
)
;
this
.
=
boolean
(
[
'swebench-prompt'
]
,
false
)
;
this
.
=
cliOptionsToWellKnownEmbeddingsType
(
this
.
[
'embedding-model'
]
)
;
this
.
=
this
.
[
'parallelism'
]
??
this
.
[
'p'
]
??
20
;
this
.
=
this
.
[
'skip-model-cache'
]
?
.
:
.
;
this
.
=
(
this
.
[
'skip-cache'
]
?
.
:
(
this
.
[
'require-cache'
]
?
.
:
.
)
)
;
this
.
=
(
this
.
[
'skip-resources-cache'
]
?
.
:
.
)
;
this
.
=
this
.
[
'external-scenarios'
]
;
this
.
=
this
.
[
'external-baseline'
]
;
// must be set after `externalScenarios`
this
.
validateExternalBaseline
(
)
;
this
.
=
this
.
[
'output'
]
;
this
.
=
this
.
[
'cache-location'
]
;
this
.
=
boolean
(
this
.
[
'inline'
]
,
false
)
;
this
.
=
boolean
(
this
.
[
'sidebar'
]
,
false
)
;
this
.
=
boolean
(
this
.
[
'apply-chat-code-blocks'
]
,
false
)
;
this
.
=
boolean
(
this
.
[
'stage-cache-entries'
]
,
false
)
;
this
.
=
boolean
(
this
.
[
'ci'
]
,
false
)
;
this
.
=
boolean
(
this
.
[
'gc'
]
,
false
)
;
this
.
=
[
'external-cache-layers-path'
]
;
this
.
=
this
.
[
'verbose'
]
;
this
.
=
[
'grep'
]
;
this
.
=
[
'omit-grep'
]
;
this
.
=
[
'heap-snapshots'
]
;
this
.
=
[
'scenarioTest'
]
??
[
'scenario-test'
]
;
this
.
=
[
'label'
]
??
''
;
this
.
=
boolean
(
[
'in-extension-host'
]
,
false
)
;
this
.
=
[
'install-extension'
]
?
[
'install-extension'
]
.
split
(
','
)
:
[
]
;
this
.
=
boolean
(
[
'headless'
]
,
true
)
;
this
.
=
Number
(
[
'run-number'
]
)
||
0
;
this
.
=
boolean
(
[
'runServerPoweredNesProvider'
]
,
false
)
;
this
.
=
.
validateNesArgument
(
[
'nes'
]
)
;
this
.
=
[
'nes-url'
]
;
// [SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="used for local simulation tests")]
this
.
=
[
'nes-api-key'
]
;
.
validateNesUrlOverride
(
this
.
,
this
.
)
;
this
.
=
[
'disable-tools'
]
?
new
Set
(
[
'disable-tools'
]
.
split
(
','
)
)
:
new
Set
(
)
;
this
.
=
boolean
(
[
'scenario-workspace-folder'
]
,
false
)
;
this
.
=
boolean
(
[
'use-experimental-code-search-service'
]
,
false
)
;
const
=
(
.
as
string
[
]
)
.
includes
(
'nes-datagen'
)
;
this
.
=
?
'nes-datagen'
:
undefined
;
this
.
=
&&
[
'input'
]
?
{
:
[
'input'
]
,
:
[
'out'
]
,
:
typeof
[
'row-offset'
]
===
'number'
?
[
'row-offset'
]
:
0
,
:
boolean
(
[
'worker'
]
,
false
)
,
:
.
validateSampleTask
(
[
'sample-task'
]
)
,
:
.
validateInputFormat
(
[
'input-format'
]
)
,
:
.
validatePivotStrategy
(
[
'pivot-strategy'
]
)
,
:
.
resolveSeed
(
[
'seed'
]
)
,
:
typeof
[
'same-file-jump-min-above'
]
===
'number'
?
[
'same-file-jump-min-above'
]
:
2
,
:
typeof
[
'same-file-jump-min-below'
]
===
'number'
?
[
'same-file-jump-min-below'
]
:
5
,
:
.
validatePositiveInteger
(
[
'max-samples-per-recording'
]
,
'--max-samples-per-recording'
,
DEFAULT_WORKSPACE_RECORDING_SAMPLE_CAP
,
)
,
:
.
validatePositiveInteger
(
[
'max-oracle-edits'
]
,
'--max-oracle-edits'
,
DEFAULT_NES_DATAGEN_ORACLE_EDIT_LIMIT
,
)
,
:
boolean
(
[
'generate-scored-edits'
]
,
false
)
,
:
[
'scored-edits-output-directory'
]
,
:
.
parseWorkspacePivotOperationIndices
(
[
'workspace-pivot-operation-indices'
]
)
,
}
:
undefined
;
this
.
=
[
'config-file'
]
;
this
.
=
[
'model-config-file'
]
;
this
.
=
[
'adhoc-request-file'
]
;
}
public
printHelp
(
)
:
void
{
console
.
log
(
[
`Example usages: `
,
` npm run simulate`
,
` npm run simulate -- --external-scenarios=<path> --inline --output=<path>`
,
` npm run simulate -- --external-scenarios=<path> --sidebar --output=<path>`
,
` npm run simulate -- --external-scenarios=<path> --nes --output=<path>`
,
` npm run simulate -- --update-baseline`
,
``
,
` -u, --update-baseline Updates scores in baseline.json if they change as a result of your changes to prompts sent to the model`
,
` --external-scenarios Path to a directory containing scenarios to run`
,
` --inline Run inline chat external scenarios`
,
` --sidebar Run sidebar chat external scenarios`
,
` --nes Run NES external scenarios`
,
` --output Path to a directory where to generate output`
,
` --n Run each scenario N times`
,
` --ci Equivalent to --n=${BASELINE_RUN_COUNT} but throws if the baseline is not up-to-date`
,
` --gc Used with --require-cache to compact cache layers into the baseline cache`
,
` --external-cache-layers-path Used to specify the path to the external cache layers`
,
` --grep Run a test which contains the passed-in string`
,
` --omit-grep Run a test which does not contain the passed-in string`
,
` --embedding-model Specify the model to use for the embedding endpoint (default: ada)`
,
` Values: ada, text3small, text3large`
,
` --list-models List available chat models`
,
` --model Specify the model to use for the chat endpoint (use --list-models to see valid options)`
,
` --smart-model Specify the model to use in place of the smarter slower model, i.e GPT 4o`
,
` --fast-model Specify the model to use in place of the faster / less smart model, i.e GPT 4o mini`
,
` --fast-rewrite-model [experimental] Specify the model to use for the fast rewrite endpoint`
,
` -p, --parallelism [experimental] Run tests in parallel (default: 1)`
,
` --skip-cache [experimental] Do not use the cache for language model requests`
,
` --require-cache [experimental] Require cache hits, fail on cache misses`
,
` --regenerate-cache [experimental] Fetch all responses and refresh the cache`
,
` --skip-resources-cache [experimental] Do not use the cache for computed resources`
,
` --skip-model-cache [experimental] Do not use the cache for model metadata`
,
` --stage-cache-entries [experimental] Stage cache files that were used in current simulation run`
,
` --list-tests List tests without running them`
,
` --json Print output in JSONL format`
,
` --verbose Print more information about test and assertion failures`
,
` --scenario-test Run tests from provided scenario test file name, e.g., 'docComment.stest' or 'docComment.stest.ts' (--scenarioTest is supported but will be deprecated in future)`
,
` --no-fetch Do not send requests to the model endpoint (uses cache but doesn't write to it) (useful to make sure prompts are unchanged by observing cache misses)`
,
` --no-cache-pointer [experimental] Do not write files to outcome/`
,
` --label A label for the current simulation run, to be displayed in the UI for distinguishing between runs`
,
` --nes-url To override endpoint URL for NES (must be used with --nes-api-key)`
,
` --nes-api-key API key for endpoint URL provided via NES (must be used with --nes-url)`
,
` --runServerPoweredNesProvider Run stests against the http server powered NES provider (server must be run at port 8001)`
,
` --disable-tools A comma-separated list of tools to disable`
,
` --swebench-prompt Use the headless swebench prompt for agent mode`
,
` --summarize-history Enable experimental conversation history summarization in agent mode`
,
` --scenario-workspace-folder If true, runs the stest inline in the scenario's workspace folder`
,
` --config-file Path to a JSON file containing configuration options`
,
` --model-config-file Path to a JSON file containing model configuration options`
,
``
,
`Subcommands:`
,
` nes-datagen Generate NES training data from recorded editing sessions`
,
` Run 'npm run simulate -- nes-datagen --help' for options`
` npm run simulate -- --config-file=config.json nes-datagen --input=current.workspaceRecording.jsonl --input-format=workspace-recording`
,
` npm run simulate -- --config-file=config.json nes-datagen --input=current.workspaceRecording.jsonl --input-format=workspace-recording --generate-scored-edits`
,
``
,
]
.
join
(
'\n'
)
)
;
}
private
validateExternalBaseline
(
)
{
if
(
this
.
&&
!
this
.
)
{
throw
new
Error
(
'External scenarios must be provided for external baseline to work.'
)
;
}
}
private
static
validateNesArgument
(
:
unknown
)
:
'external'
|
'coffe'
|
undefined
{
if
(
===
undefined
||
===
null
)
{
return
undefined
;
}
if
(
typeof
===
'boolean'
)
{
// this's for backward compat because previously it was possible to just pass `--nes` to run external stests against NES
return
'external'
;
}
if
(
typeof
!==
'string'
)
{
throw
new
Error
(
`--nes must be a string, but got: ${typeof nes}`
)
;
}
switch
(
)
{
case
'external'
:
case
'coffe'
:
return
;
default
:
throw
new
Error
(
`--nes can only be 'external' or 'coffe', but got: ${nes}`
)
;
}
}
private
static
validateNesUrlOverride
(
:
string
|
undefined
,
:
string
|
undefined
)
:
void
{
if
(
!==
undefined
&&
===
undefined
)
{
throw
new
Error
(
`--nesApiKey must be provided when --nesUrl is set`
)
;
}
if
(
===
undefined
&&
!==
undefined
)
{
throw
new
Error
(
`--nesUrl must be provided when --nesApiKey is set`
)
;
}
}
private
static
validateSampleTask
(
:
unknown
)
:
{
if
(
===
undefined
||
===
null
)
{
return
.
;
}
if
(
typeof
!==
'string'
)
{
throw
new
Error
(
`--sample-task must be a string, but got: ${typeof value}`
)
;
}
const
=
.
values
(
)
as
string
[
]
;
if
(
!
.
includes
(
)
)
{
throw
new
Error
(
`--sample-task must be one of [${allowed.join(', ')}], but got: ${value}`
)
;
}
return
as
;
}
private
static
validateInputFormat
(
:
unknown
)
:
{
if
(
===
undefined
||
===
null
)
{
return
.
;
}
if
(
typeof
!==
'string'
)
{
throw
new
Error
(
`--input-format must be a string, but got: ${typeof value}`
)
;
}
const
=
.
values
(
)
as
string
[
]
;
if
(
!
.
includes
(
)
)
{
throw
new
Error
(
`--input-format must be one of [${allowed.join(', ')}], but got: ${value}`
)
;
}
return
as
;
}
private
static
validatePivotStrategy
(
:
unknown
)
:
{
if
(
===
undefined
||
===
null
)
{
return
.
;
}
if
(
typeof
!==
'string'
)
{
throw
new
Error
(
`--pivot-strategy must be a string, but got: ${typeof value}`
)
;
}
const
=
.
values
(
)
as
string
[
]
;
if
(
!
.
includes
(
)
)
{
throw
new
Error
(
`--pivot-strategy must be one of [${allowed.join(', ')}], but got: ${value}`
)
;
}
return
as
;
}
private
static
validatePositiveInteger
(
:
unknown
,
:
string
,
:
number
)
:
number
{
if
(
===
undefined
||
===
null
)
{
return
;
}
if
(
typeof
!==
'number'
||
!
.
isInteger
(
)
||
<=
0
)
{
throw
new
Error
(
`${optionName} must be a positive integer, but got: ${value}`
)
;
}
return
;
}
private
static
parseWorkspacePivotOperationIndices
(
:
unknown
)
:
readonly
number
[
]
|
undefined
{
if
(
===
undefined
||
===
null
)
{
return
undefined
;
}
const
=
typeof
===
'number'
?
String
(
)
:
;
if
(
typeof
!==
'string'
||
.
===
0
)
{
throw
new
Error
(
`--workspace-pivot-operation-indices must be a comma-separated list of non-negative integers`
)
;
}
const
=
.
split
(
','
)
.
map
(
=>
Number
(
)
)
;
if
(
.
some
(
=>
!
.
isInteger
(
)
||
<
0
)
)
{
throw
new
Error
(
`--workspace-pivot-operation-indices must be a comma-separated list of non-negative integers`
)
;
}
if
(
new
Set
(
)
.
!==
.
)
{
throw
new
Error
(
`--workspace-pivot-operation-indices must not contain duplicates`
)
;
}
return
;
}
/**
* Resolve the continuous pivot seed. When `--seed` is omitted a random
* 32-bit seed is generated so that the parent can log it and propagate it to
* every worker, keeping output reproducible.
*/