dsh-ptc-plus 0.2.3 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.en.md +171 -0
  2. package/README.md +94 -67
  3. package/assets/dsh-ptc-plus-banner-en.webp +0 -0
  4. package/assets/ptc-plus-repair-en.png +0 -0
  5. package/assets/ptc-plus-settings-en.png +0 -0
  6. package/assets/ptc-plus-settings-zh.png +0 -0
  7. package/client.js +1211 -128
  8. package/docs/adr/0019-plugin-settings-and-kill-switch.md +20 -4
  9. package/docs/adr/0020-optional-cordis-tools-in-ptc-mode.md +2 -2
  10. package/docs/adr/0022-stage-npm-releases-with-oidc.md +31 -0
  11. package/docs/architecture.md +10 -9
  12. package/docs/client-ui.md +30 -12
  13. package/docs/installation.md +13 -5
  14. package/docs/publishing.md +25 -1
  15. package/docs/runtime-reference.md +18 -12
  16. package/docs/value-wire.md +1 -1
  17. package/index.js +43 -12
  18. package/internal/cell-analysis.js +20 -3
  19. package/internal/cell-rewriter.js +36 -2
  20. package/internal/config-spec.js +192 -82
  21. package/internal/direct-surface-owner.js +77 -23
  22. package/internal/edit-transport-owner.js +10 -1
  23. package/internal/failure-reporting.js +15 -0
  24. package/internal/rejected-cell-editor.js +21 -12
  25. package/internal/repl-memory-projection.js +277 -0
  26. package/internal/run-code-description.js +34 -0
  27. package/internal/runtime-bridge-owner.js +63 -15
  28. package/internal/runtime-config.js +2 -0
  29. package/internal/session-cell-executor.js +14 -4
  30. package/internal/session-events.js +7 -0
  31. package/internal/session-journal.js +3 -2
  32. package/internal/session-log-view.js +2 -1
  33. package/internal/session-runtime.js +19 -2
  34. package/internal/session-state.js +83 -4
  35. package/internal/settings-compat.js +31 -0
  36. package/package.json +20 -13
  37. package/src/client-activity.js +472 -0
  38. package/src/client.js +536 -38
  39. package/README.zh.md +0 -144
  40. package/assets/ptc-plus-settings.png +0 -0
  41. /package/assets/{dsh-ptc-plus-banner.webp → dsh-ptc-plus-banner-zh.webp} +0 -0
  42. /package/assets/{ptc-plus-repair.png → ptc-plus-repair-zh.png} +0 -0
@@ -50,10 +50,12 @@ function addPatternBindings(pattern, names) {
50
50
  walkPattern(pattern, node => names.add(node.name))
51
51
  }
52
52
 
53
- function addPatternDeclarations(pattern, declarations) {
53
+ function addPatternDeclarations(pattern, declarations, kind = 'variable', definitionSpan = undefined) {
54
54
  bindingNodes(pattern).forEach(node => declarations.push({
55
55
  name: node.name,
56
+ kind,
56
57
  span: declarationSpan(node),
58
+ definitionSpan,
57
59
  }))
58
60
  }
59
61
 
@@ -65,12 +67,17 @@ function topLevelDeclarations(body) {
65
67
  const declarations = []
66
68
  for (const statement of body) {
67
69
  if (statement.type === 'VariableDeclaration') {
68
- for (const declaration of statement.declarations) addPatternDeclarations(declaration.id, declarations)
70
+ const definitionSpan = declarationSpan(statement)
71
+ for (const declaration of statement.declarations) {
72
+ addPatternDeclarations(declaration.id, declarations, 'variable', definitionSpan)
73
+ }
69
74
  } else if ((statement.type === 'FunctionDeclaration' || statement.type === 'ClassDeclaration')
70
75
  && statement.id !== null) {
71
76
  declarations.push({
72
77
  name: statement.id.name,
78
+ kind: statement.type === 'ClassDeclaration' ? 'class' : 'function',
73
79
  span: declarationSpan(statement.id),
80
+ definitionSpan: declarationSpan(statement),
74
81
  })
75
82
  }
76
83
  }
@@ -395,9 +402,19 @@ export function prepareProgram(program, knownBindings, looseTopLevelRedeclaratio
395
402
  }
396
403
  }
397
404
  const importedNames = new Set(moduleRewrite.imports.keys())
405
+ const originalDeclarationNames = new Set(moduleRewrite.exportDeclarations.map(declaration => declaration.name))
398
406
  const declarations = [
399
407
  ...moduleRewrite.importDeclarations,
400
- ...generatedDeclarations.filter(declaration => !moduleRewrite.generatedNamespaces.has(declaration.name)),
408
+ ...moduleRewrite.exportDeclarations,
409
+ ...generatedDeclarations
410
+ .filter(declaration => !moduleRewrite.generatedNamespaces.has(declaration.name)
411
+ && !originalDeclarationNames.has(declaration.name))
412
+ .map(declaration => ({
413
+ ...declaration,
414
+ ...(declaration.definitionSpan === undefined ? {} : {
415
+ definitionSpan: mapSourceSpan(declaration.definitionSpan, code, program, sourceMap),
416
+ }),
417
+ })),
401
418
  ]
402
419
  const normalizeClassification = classification => {
403
420
  const imports = new Map(moduleRewrite.imports)
@@ -183,6 +183,7 @@ function importEdits(
183
183
  if (imported !== undefined && !requiredExports.includes(imported)) requiredExports.push(imported)
184
184
  importDeclarations.push({
185
185
  name: localName(specifier),
186
+ kind: 'import',
186
187
  span: {
187
188
  line: specifier.local.loc.start.line,
188
189
  column: specifier.local.loc.start.column + 1,
@@ -191,6 +192,14 @@ function importEdits(
191
192
  column: specifier.local.loc.end.column + 1,
192
193
  },
193
194
  },
195
+ definitionSpan: {
196
+ line: node.loc.start.line,
197
+ column: node.loc.start.column + 1,
198
+ end: {
199
+ line: node.loc.end.line,
200
+ column: node.loc.end.column + 1,
201
+ },
202
+ },
194
203
  original: true,
195
204
  })
196
205
  }
@@ -420,7 +429,7 @@ function exportAllEdits(node, code, edits, rewrites, moduleLoads) {
420
429
  rewrites.push(record('export', `converted the re-export of ${JSON.stringify(source)} into a side-effect import`, node, source))
421
430
  }
422
431
 
423
- function exportDefaultEdits(node, code, edits, rewrites, defaultNameAvailable) {
432
+ function exportDefaultEdits(node, code, edits, rewrites, defaultNameAvailable, exportDeclarations) {
424
433
  const declaration = node.declaration
425
434
  if (declaration.type === 'TSInterfaceDeclaration') {
426
435
  editNode(edits, node, code)
@@ -438,6 +447,29 @@ function exportDefaultEdits(node, code, edits, rewrites, defaultNameAvailable) {
438
447
  { line: node.loc.start.line, column: node.loc.start.column + 1 },
439
448
  )
440
449
  }
450
+ exportDeclarations.push({
451
+ name: '__default',
452
+ kind: declaration.type === 'FunctionDeclaration'
453
+ ? 'function'
454
+ : declaration.type === 'ClassDeclaration' ? 'class' : 'variable',
455
+ span: {
456
+ line: node.loc.start.line,
457
+ column: node.loc.start.column + 1,
458
+ end: {
459
+ line: node.loc.end.line,
460
+ column: node.loc.end.column + 1,
461
+ },
462
+ },
463
+ definitionSpan: {
464
+ line: node.loc.start.line,
465
+ column: node.loc.start.column + 1,
466
+ end: {
467
+ line: node.loc.end.line,
468
+ column: node.loc.end.column + 1,
469
+ },
470
+ },
471
+ original: true,
472
+ })
441
473
  const rewrite = record('export', 'converted the default export into a local __default binding', node)
442
474
  if (declaration.type === 'FunctionDeclaration' && declaration.id !== null) {
443
475
  const prefix = code.slice(node.start, declaration.start)
@@ -464,6 +496,7 @@ export function rewriteModuleImportsExports(program, enabled, existingImports =
464
496
  const rewrites = []
465
497
  const imports = new Map(existingImports)
466
498
  const importDeclarations = []
499
+ const exportDeclarations = []
467
500
  const moduleLoads = []
468
501
  const importNamespaces = new Set(existingNamespaces)
469
502
  const allocateName = createGeneratedNameAllocator(tree, [...unavailableNames, ...importNamespaces])
@@ -499,7 +532,7 @@ export function rewriteModuleImportsExports(program, enabled, existingImports =
499
532
  exportAllEdits(node, program, edits, rewrites, moduleLoads)
500
533
  }
501
534
  else if (node.type === 'ExportDefaultDeclaration' && enabled.autoStripExports) {
502
- exportDefaultEdits(node, program, edits, rewrites, defaultNameAvailable)
535
+ exportDefaultEdits(node, program, edits, rewrites, defaultNameAvailable, exportDeclarations)
503
536
  }
504
537
  }
505
538
  assertNoDynamicImportResolution(tree, imports)
@@ -514,6 +547,7 @@ export function rewriteModuleImportsExports(program, enabled, existingImports =
514
547
  importNamespaces,
515
548
  generatedNamespaces,
516
549
  importDeclarations,
550
+ exportDeclarations,
517
551
  moduleLoads,
518
552
  rewrites: rewrites.map(({ at: _at, ...rest }) => rest),
519
553
  }
@@ -4,21 +4,111 @@ export const MAX_TIMER_DELAY_MS = 2_147_483_647
4
4
  /** Stable settings namespace used by both Host and browser halves. */
5
5
  export const SETTINGS_NAMESPACE = 'ptc-plus'
6
6
 
7
- /** Ordered field definitions for the plugin configuration card. */
7
+ /**
8
+ * Ordered field definitions for the plugin configuration card. `label` and
9
+ * `description` are the canonical Host schema copy; `labelEn` and
10
+ * `descriptionEn` carry the English settings-card copy. A field's description
11
+ * exists in both locales or in neither.
12
+ */
8
13
  export const CONFIG_FIELDS = Object.freeze([
9
14
  {
10
15
  key: 'enabled',
11
16
  type: 'boolean',
12
17
  default: true,
13
18
  label: '启用 PTC Plus',
19
+ labelEn: 'Enable PTC Plus',
14
20
  description: '',
21
+ descriptionEn: '',
22
+ },
23
+ {
24
+ key: 'enhancedToolView',
25
+ type: 'boolean',
26
+ default: true,
27
+ label: '使用 PTC Plus 增强工具卡片',
28
+ labelEn: 'Use enhanced PTC Plus tool cards',
29
+ description: '开启时使用增强工具卡片;关闭后使用 DSH 原生工具卡片。',
30
+ descriptionEn: 'Uses enhanced tool cards when enabled and DSH native tool cards when disabled.',
31
+ },
32
+ {
33
+ key: 'autoDescribeRunCode',
34
+ type: 'boolean',
35
+ default: true,
36
+ label: '允许执行缺少摘要的 run_code',
37
+ labelEn: 'Allow run_code execution without a summary',
38
+ description: '允许 run_code 缺少外层 description;关闭后恢复 DSH 校验。模型请求和原始调用参数保持不变。',
39
+ descriptionEn: 'Allows run_code to omit its outer description; disabling restores DSH validation. Model requests and original call arguments remain unchanged.',
40
+ },
41
+ {
42
+ key: 'canonicalizeToolCalls',
43
+ type: 'boolean',
44
+ default: true,
45
+ label: '修复可识别的顶层 native 工具误调用',
46
+ labelEn: 'Repair recognizable top-level native tool mis-calls',
47
+ description: '仅当当前 schema 能唯一确认目标工具且参数有效时,才把顶层 native 工具误调用修复为对应的 run_code 调用。',
48
+ descriptionEn: 'Repairs a top-level native tool mis-call as the corresponding run_code call only when the current schema uniquely identifies the tool and validates its arguments.',
15
49
  },
16
50
  {
17
51
  key: 'cordisToolsEnabled',
18
52
  type: 'boolean',
19
53
  default: false,
20
- label: '在 PTC 模式中启用 Cordis 工具',
21
- description: '即时为 PTC agent 加入或移除官方 Cordis 工具。',
54
+ label: '在 PTC 模式中启用官方 Cordis 工具',
55
+ labelEn: 'Enable official Cordis tools in PTC mode',
56
+ description: '开启后,PTC agent 可使用官方 Cordis 工具、配套指引和开发 Skill;关闭后移除这些能力。Cordis 工具以 DSH 进程权限运行。',
57
+ descriptionEn: 'When enabled, PTC agents can use the official Cordis tools, guidance, and development Skill; disabling removes them. Cordis tools run with the DSH process permissions.',
58
+ },
59
+ {
60
+ key: 'looseTopLevelRedeclarations',
61
+ type: 'boolean',
62
+ default: true,
63
+ label: '允许顶层变量重声明',
64
+ labelEn: 'Allow top-level variable redeclarations',
65
+ description: '允许顶层 const 或 let 声明替换已有变量;关闭后,重声明会在执行前被拒绝。',
66
+ descriptionEn: 'Allows top-level const or let declarations to replace existing variables; disabling rejects redeclarations before execution.',
67
+ },
68
+ {
69
+ key: 'autoRewriteImports',
70
+ type: 'boolean',
71
+ default: true,
72
+ label: '支持静态 import 声明',
73
+ labelEn: 'Support static import declarations',
74
+ description: '允许在 run_code 中使用静态 import,并保留模块解析和只读 binding 语义。',
75
+ descriptionEn: 'Allows static import declarations in run_code while preserving module resolution and read-only binding semantics.',
76
+ },
77
+ {
78
+ key: 'autoStripExports',
79
+ type: 'boolean',
80
+ default: true,
81
+ label: '支持顶层 export 修饰符',
82
+ labelEn: 'Support top-level export modifiers',
83
+ description: '允许在 run_code 中使用顶层 export,并保留对应的本地声明或模块副作用。',
84
+ descriptionEn: 'Allows top-level export syntax in run_code while preserving the corresponding local declaration or module side effect.',
85
+ },
86
+ {
87
+ key: 'autoSplitRedeclarations',
88
+ type: 'boolean',
89
+ default: true,
90
+ label: '支持混合解构重声明',
91
+ labelEn: 'Support mixed destructuring redeclarations',
92
+ description: '允许顶层解构声明同时包含新变量和已有变量。',
93
+ descriptionEn: 'Allows top-level destructuring declarations to contain both new and existing variables.',
94
+ },
95
+ {
96
+ key: 'durableReplay',
97
+ type: 'boolean',
98
+ default: true,
99
+ label: '启用持久 REPL 恢复',
100
+ labelEn: 'Enable durable REPL recovery',
101
+ description: 'worker 重启后从 session journal 重建可恢复的 REPL 状态。',
102
+ descriptionEn: 'Rebuilds recoverable REPL state from the session journal after a worker restart.',
103
+ },
104
+ {
105
+ key: 'tipsEnabled',
106
+ type: 'boolean',
107
+ default: true,
108
+ label: '启用失败恢复提示',
109
+ labelEn: 'Enable failure recovery tips',
110
+ description: '在符合条件的失败后显示有冷却间隔的恢复提示。',
111
+ descriptionEn: 'Shows recovery tips with a cooldown after qualifying failures.',
22
112
  },
23
113
  {
24
114
  key: 'computeMs',
@@ -26,8 +116,10 @@ export const CONFIG_FIELDS = Object.freeze([
26
116
  default: 60_000,
27
117
  min: 1,
28
118
  max: Number.MAX_SAFE_INTEGER,
29
- label: '单 cell 最大 CPU 时间 (ms)',
30
- description: '同步计算超过该预算的 cell 会被中断。',
119
+ label: '单 cell CPU 时间上限 (ms)',
120
+ labelEn: 'CPU time limit per cell (ms)',
121
+ description: '同步计算超过该上限时中断当前 cell。',
122
+ descriptionEn: 'Interrupts the current cell when synchronous computation exceeds this limit.',
31
123
  },
32
124
  {
33
125
  key: 'maxWallMs',
@@ -35,26 +127,43 @@ export const CONFIG_FIELDS = Object.freeze([
35
127
  default: 600_000,
36
128
  min: 1,
37
129
  max: MAX_TIMER_DELAY_MS,
38
- label: '单 cell 最大墙钟时间 (ms)',
39
- description: '完整 cell 执行(含异步等待)的最长耗时。',
130
+ label: '单 cell 总耗时上限 (ms)',
131
+ labelEn: 'Elapsed time limit per cell (ms)',
132
+ description: '限制完整 cell 执行的耗时,包括异步等待。',
133
+ descriptionEn: 'Limits the complete cell execution time, including asynchronous waits.',
40
134
  },
41
135
  {
42
- key: 'maxOutputBytes',
136
+ key: 'maxOldGenerationSizeMb',
43
137
  type: 'integer',
44
- default: 64 * 1024 * 1024,
138
+ default: 512,
45
139
  min: 1,
46
140
  max: Number.MAX_SAFE_INTEGER,
47
- label: '最大输出字节',
48
- description: '限制单个 cell 的输出和结果数据总大小。',
141
+ label: '每个 worker 旧生代内存上限 (MiB)',
142
+ labelEn: 'Old-generation memory limit per worker (MiB)',
143
+ description: '限制每个 worker 的 V8 旧生代;活动 worker 存在时不能修改。',
144
+ descriptionEn: 'Limits the V8 old generation for each worker; this setting cannot change while a worker is active.',
49
145
  },
50
146
  {
51
- key: 'maxOldGenerationSizeMb',
147
+ key: 'maxNestedRunCodeDepth',
52
148
  type: 'integer',
53
- default: 512,
149
+ default: 8,
150
+ min: 1,
151
+ max: Number.MAX_SAFE_INTEGER,
152
+ label: 'code.run 嵌套层数上限',
153
+ labelEn: 'code.run nesting depth limit',
154
+ description: '限制单个顶层 cell 中 code.run 的最大嵌套层数。',
155
+ descriptionEn: 'Limits the maximum code.run nesting depth within one top-level cell.',
156
+ },
157
+ {
158
+ key: 'maxOutputBytes',
159
+ type: 'integer',
160
+ default: 64 * 1024 * 1024,
54
161
  min: 1,
55
162
  max: Number.MAX_SAFE_INTEGER,
56
- label: 'worker 旧生代内存上限 (MiB)',
57
- description: '每个 worker 的 V8 旧生代上限;活动 worker 存在时修改会被拒绝。',
163
+ label: '单 cell 输出上限 (bytes)',
164
+ labelEn: 'Output limit per cell (bytes)',
165
+ description: '限制单个 cell 的日志和返回结果的合计大小。',
166
+ descriptionEn: 'Limits the combined size of one cell\'s logs and returned result.',
58
167
  },
59
168
  {
60
169
  key: 'maxValueNodes',
@@ -62,8 +171,10 @@ export const CONFIG_FIELDS = Object.freeze([
62
171
  default: 100_000,
63
172
  min: 1,
64
173
  max: Number.MAX_SAFE_INTEGER,
65
- label: 'Value Graph 最大节点数',
66
- description: '限制单次返回值的节点数。',
174
+ label: '返回值节点数上限',
175
+ labelEn: 'Returned-value node limit',
176
+ description: '限制单次返回值的 Value Graph 节点数。',
177
+ descriptionEn: 'Limits the Value Graph node count for one returned value.',
67
178
  },
68
179
  {
69
180
  key: 'maxValueEdges',
@@ -71,8 +182,10 @@ export const CONFIG_FIELDS = Object.freeze([
71
182
  default: 1_000_000,
72
183
  min: 1,
73
184
  max: Number.MAX_SAFE_INTEGER,
74
- label: 'Value Graph 最大边数',
75
- description: '限制单次返回值的引用关系数。',
185
+ label: '返回值引用边数上限',
186
+ labelEn: 'Returned-value reference-edge limit',
187
+ description: '限制单次返回值的 Value Graph 引用边数。',
188
+ descriptionEn: 'Limits the Value Graph reference-edge count for one returned value.',
76
189
  },
77
190
  {
78
191
  key: 'maxValueArrayLength',
@@ -80,8 +193,10 @@ export const CONFIG_FIELDS = Object.freeze([
80
193
  default: 1_000_000,
81
194
  min: 1,
82
195
  max: Number.MAX_SAFE_INTEGER,
83
- label: '数组最大声明长度',
84
- description: '限制返回数组的最大长度。',
196
+ label: '返回数组长度上限',
197
+ labelEn: 'Returned-array length limit',
198
+ description: '限制返回数组的最大声明长度。',
199
+ descriptionEn: 'Limits the maximum declared length of a returned array.',
85
200
  },
86
201
  {
87
202
  key: 'maxValueBigIntDigits',
@@ -89,66 +204,10 @@ export const CONFIG_FIELDS = Object.freeze([
89
204
  default: 100_000,
90
205
  min: 1,
91
206
  max: Number.MAX_SAFE_INTEGER,
92
- label: 'BigInt 最大十进制位数',
207
+ label: '返回值 BigInt 十进制位数上限',
208
+ labelEn: 'Returned-value BigInt decimal-digit limit',
93
209
  description: '限制返回值中 BigInt 的十进制位数。',
94
- },
95
- {
96
- key: 'maxNestedRunCodeDepth',
97
- type: 'integer',
98
- default: 8,
99
- min: 1,
100
- max: Number.MAX_SAFE_INTEGER,
101
- label: 'code.run 最大递归深度',
102
- description: '限制 code.run 的嵌套层数。',
103
- },
104
- {
105
- key: 'canonicalizeToolCalls',
106
- type: 'boolean',
107
- default: true,
108
- label: '规范顶层 native 误调',
109
- description: '修正可以明确识别的顶层 native 误调。',
110
- },
111
- {
112
- key: 'looseTopLevelRedeclarations',
113
- type: 'boolean',
114
- default: true,
115
- label: '宽松顶层重声明',
116
- description: '允许顶层 const/let 重声明已有变量。',
117
- },
118
- {
119
- key: 'durableReplay',
120
- type: 'boolean',
121
- default: true,
122
- label: '持久重放',
123
- description: 'worker 重启后恢复可以重建的 REPL 状态。',
124
- },
125
- {
126
- key: 'autoRewriteImports',
127
- type: 'boolean',
128
- default: true,
129
- label: '自动改写 import',
130
- description: '允许在 run_code 中使用静态 import。',
131
- },
132
- {
133
- key: 'autoStripExports',
134
- type: 'boolean',
135
- default: true,
136
- label: '自动剥离 export',
137
- description: '允许在 run_code 中使用顶层 export。',
138
- },
139
- {
140
- key: 'autoSplitRedeclarations',
141
- type: 'boolean',
142
- default: true,
143
- label: '自动拆分混合重声明',
144
- description: '允许顶层解构声明同时包含新旧变量。',
145
- },
146
- {
147
- key: 'tipsEnabled',
148
- type: 'boolean',
149
- default: true,
150
- label: '启用恢复提示',
151
- description: '在符合条件的失败后显示恢复提示。',
210
+ descriptionEn: 'Limits the decimal-digit count of BigInt values in one returned value.',
152
211
  },
153
212
  {
154
213
  key: 'tipCooldownMessages',
@@ -156,8 +215,10 @@ export const CONFIG_FIELDS = Object.freeze([
156
215
  default: 3,
157
216
  min: 1,
158
217
  max: Number.MAX_SAFE_INTEGER,
159
- label: '恢复提示冷却步数',
218
+ label: '同类恢复提示间隔 (messages)',
219
+ labelEn: 'Same-kind recovery tip interval (messages)',
160
220
  description: '同类恢复提示之间的最小间隔。',
221
+ descriptionEn: 'The minimum gap between recovery tips of the same kind.',
161
222
  },
162
223
  {
163
224
  key: 'tipEscalationFailures',
@@ -165,8 +226,57 @@ export const CONFIG_FIELDS = Object.freeze([
165
226
  default: 2,
166
227
  min: 1,
167
228
  max: Number.MAX_SAFE_INTEGER,
168
- label: '恢复提示升级失败次数',
229
+ label: '详细恢复提示阈值 (failures)',
230
+ labelEn: 'Detailed recovery tip threshold (failures)',
169
231
  description: '连续失败达到此次数后显示更详细的恢复提示。',
232
+ descriptionEn: 'After this many consecutive failures, a more detailed recovery tip is shown.',
233
+ },
234
+ ])
235
+
236
+ /** Presentation groups keep high-attention decisions separate from advanced policy and limits. */
237
+ export const CONFIG_GROUPS = Object.freeze([
238
+ {
239
+ key: 'core',
240
+ label: '常用与兼容性',
241
+ labelEn: 'Common and compatibility',
242
+ fields: Object.freeze(['enabled', 'enhancedToolView', 'autoDescribeRunCode', 'canonicalizeToolCalls']),
243
+ },
244
+ {
245
+ key: 'optional',
246
+ label: '可选能力',
247
+ labelEn: 'Optional capabilities',
248
+ fields: Object.freeze(['cordisToolsEnabled']),
249
+ },
250
+ {
251
+ key: 'advanced',
252
+ label: '高级行为',
253
+ labelEn: 'Advanced behavior',
254
+ fields: Object.freeze([
255
+ 'looseTopLevelRedeclarations',
256
+ 'autoRewriteImports',
257
+ 'autoStripExports',
258
+ 'autoSplitRedeclarations',
259
+ 'durableReplay',
260
+ 'tipsEnabled',
261
+ ]),
262
+ },
263
+ {
264
+ key: 'limits',
265
+ label: '资源限制',
266
+ labelEn: 'Resource limits',
267
+ fields: Object.freeze([
268
+ 'computeMs',
269
+ 'maxWallMs',
270
+ 'maxOldGenerationSizeMb',
271
+ 'maxNestedRunCodeDepth',
272
+ 'maxOutputBytes',
273
+ 'maxValueNodes',
274
+ 'maxValueEdges',
275
+ 'maxValueArrayLength',
276
+ 'maxValueBigIntDigits',
277
+ 'tipCooldownMessages',
278
+ 'tipEscalationFailures',
279
+ ]),
170
280
  },
171
281
  ])
172
282