Configuration Reference
Kode's configuration falls into two piles: kbengine.* settings (VS Code settings.json) and the server-side XML configuration (kbengine_defaults.xml, the component kbengine.xml). Settings are introduced by feature area (diagnostics, hover, CodeLens and inlay, jumps, paths, config view, server and logs, remote debugging, Python, generators, telnet, HTTP, hot reload, database) — one small table per area with type, default value, and purpose, followed by that area's impact of changes and common misconfigurations; for how the server configuration layers and merges, and where the telnet port/password come from, read "The Three Layers of Server Configuration" first.
Setting default values are all taken from this extension's package.json contributions, and engine-side values from kbengine_defaults.xml; entries found in neither place are marked 「来源未考」 (source unverified).
The Three Layers of Server Configuration
The engine loads server configuration by this rule: read the engine defaults first, then the component config, same keys overriding. Kode's telnet probing and the "final config" view both take values by this rule.
| Layer | File | How it is located |
|---|---|---|
| 1 Engine defaults | kbe/res/server/kbengine_defaults.xml | Derived upward from kbengine.binPath (which points at kbe/bin/server) |
| 2 Component override | kbengine.xml | The kbengine.xml under kbengine.assetsRoot and its res/server/kbengine.xml take priority; when unset or missed, the discovered assets root (batch 128) participates; finally the workspace root is probed along conventional paths: kbengine.xml → res/server/kbengine.xml → assets/res/server/kbengine.xml, taking the first that exists |
| 3 Final effective | (composed, never on disk) | Layer 1 loads first, layer 2 overrides by same key |
The locating setting in the table, kbengine.assetsRoot, is a directory that supports VS Code variables (the retired binary-path override behaves the same — see the removal note below): values go through variable expansion first (${workspaceFolder}/${env:NAME} and friends), and relative paths join against the workspace root. A value that expands to an empty string counts as unset and falls through to auto-discovery as usual.
Override rules:
- Same-named key present on both sides: the component config's value wins;
- Only in defaults: the default is kept;
- Only in the component config: added;
- Container sections present on both sides: recurse down, sub-keys aligned by name;
- Repeated-name lists (e.g. multiple addresses under
<addresses>): the component config replaces the whole list, never interleaved with the default one.
Before/after comparison:
| Key | Engine default | Component kbengine.xml | Final effective |
|---|---|---|---|
baseapp/telnet_service/port | 40000 | 41000 | 41000 (overridden) |
baseapp/telnet_service/password | pwd123456 | (not written) | pwd123456 (only in defaults, kept) |
baseapp/archivePeriod | 300 | 600 | 600 (overridden) |
baseapp/externalAddress | (not written) | 10.0.0.9 | 10.0.0.9 (added) |
Viewing the Final Config
Three entries, same content — the read-only virtual document kbengine-final.xml, never written to disk:
- The 「最终配置」 (final config) node in the sidebar KBEngine → Config view; click to open;
- Command palette
Show Final Server Config(kbengine.config.showFinal); - Auto-opens in the background when the extension activates and defaults can be located (setting
kbengine.showFinalConfigOnOpen, default off; silently skipped when defaults are not found).
The document's header comment notes the source paths of defaults and component config. Saving, adding, or deleting defaults or the component kbengine.xml triggers recomposition (kbengine.autoRefreshFinalConfig, default on). Hover a field to see what it does.
How the telnet Port/Password Are Read
telnet has no parameter set of its own — it is the three layers above plus one explicit-settings layer, taking the first non-empty value in order:
| Parameter | Order of resolution |
|---|---|
| Port | Setting kbengine.telnet.port (>0) → the component kbengine.xml <telnet_service>'s port → that component's port in engine defaults |
| Password | Setting kbengine.telnet.password → the component section's password → engine defaults' password → empty (no auto login) |
| Host | Setting kbengine.telnet.host; left empty uses 127.0.0.1 |
Two boundaries:
- When the component
kbengine.xmlhas no<telnet_service>section and the settings give no port → no probing; the telnet panel, status lights, and the standalone tree view all stay hidden. The engine defaults do contain a<telnet_service>section, but defaults only supply value fallbacks and never turn telnet "on" by themselves; - When the component section exists but writes no port → probe per component against the engine's default component port table: loginapp 31000 / dbmgr 32000 / interfaces 33000 / logger 34000 / baseapp 40000 / cellapp 50000 / bots 51000; components whose port is written in defaults follow defaults.
.kbengine/debug.json is unrelated to this chain — it serves only the debugging flow (see the "Debug Configuration File" section).
Overview of kbengine.* Settings (by Feature Area)
The 170 settings are grouped by feature — one small table per area (Setting/Type/Default/Purpose), immediately followed by that area's impact of changes and common misconfigurations; no more one 76-row table. To find a setting, locate the feature area first, then the row within it.
Every key's tip in the VS Code settings UI is authored as markdownDescription — one sentence of purpose, a 「默认值」 (default value) section, and a deep link into this guide. The settings UI renders markdownDescription only (markdown inside a bare description never renders). tests/configMarkdownDescription.test.ts locks package.json against this page: every key must carry markdownDescription with a default section, every enum must document every option, and every guide-link anchor must exist as a heading on this page.
Diagnostics
| Setting | Type | Default | Purpose |
|---|---|---|---|
kbengine.enableDiagnostics | boolean | true | Master switch for .def diagnostics (since batch 147 it also gates the duplicate entity registration check in entities.xml) |
kbengine.enableStructureDiagnostics | boolean | true | Switch for structural validation (duplicate properties/methods, child-tag position, missing fields, duplicated field definitions) |
kbengine.receiverNoneDiagnostics | boolean | true | Python-side diagnostics: self.client/self.cell/self.base member use without a null guard (positive if, early exit, alias; hasattr does not establish a non-None value) is flagged as a Warning with the engine source cited; also flags .def section mismatches (calling a method via a receiver whose section does not declare it) |
kbengine.configContractDiagnostics | boolean | true | Workspace config-layer contract check (read-only, workspace-scoped): empty/missing debug.components in .kbengine/debug.json, known components' telnet port missing or off the engine default, a commented-out telnet section, unparsable JSON; python.analysis.extraPaths entries with ../.., a nonexistent target, or absolute python.analysis.extraPaths entries (kbengine.configContract.extraPathsAbsolute); .gitignore missing .kbengine/; CLAUDE.md/README-declared telnet password/port conflicting with actual debug.json values. Each finding is a Warning with bilingual fix hints; scanned on activation, on open/save of the contract files, and on watcher changes. Only runs in workspaces that have a .kbengine/ managed dir (zero noise elsewhere) |
kbengine.configValueDiagnostics | boolean | true | Config value validation on kbengine.xml — only dimensions backed by source/schema evidence: type mismatch (engine-read-site / comment type-annotation evidence) is an Error (the engine parses the key at startup), a value outside a documented enum block is a Warning (the engine masks/ignores undocumented values), and keys absent from kbengine_defaults.xml are Information (the config layer only reads known keys; custom-only keys are tolerated — safe if your own tooling consumes them). Range/required faces have no machine-readable evidence source and are honestly not implemented (zero findings, no fabricated bounds) |
kbengine.attributeNoneDiagnostics | boolean | true | Python-side diagnostics: user-managed properties (not .def-declared) self.<attr> whose converged type includes None and is not narrowed at the use site are flagged as a Warning for a member access/call without a null check (flow-sensitive: __init__ assignment convergence, is None/is not None guards and early exits all participate in narrowing) |
kbengine.propertyDirectionDiagnostics | boolean | true | Python-side diagnostics: def property access direction violations — self.<prop> / self.<role>.<prop> where the access position (process scope for a plain access, the receiver role for a qualified one) falls outside the property's Flag domains is flagged as a Warning; when the file's process scope cannot be determined (outside `scripts/base |
kbengine.readOnlyWriteDiagnostics | boolean | true | Python-side diagnostics: an entity script writing an engine read-only builtin property (self.id/self.isDestroyed/self.className and per-face read-only items) via plain/augmented/annotated assignment or del is flagged as a Warning (engine GET-only — the write is rejected at runtime); writable properties (self.position, self.shouldAutoBackup, …) and same-named fields of non-entity scripts are never flagged |
kbengine.startupScriptDiagnostics | boolean | true | Startup-script diagnostics: on server-process launch lines (machine/logger/dbmgr/baseappmgr/cellappmgr/baseapp/cellapp/loginapp/bots) inside .sh/.bat startup scripts — an unknown --xxx (misspelling), a non-numeric --cid/--gus value, or a referenced $KBE_RES_PATH/$KBE_BIN_PATH/$KBE_ROOT that is never assigned in-file and never sourced — is flagged as a Warning. Non-launch lines (echo/pkill/comment, and the separate kbcmd/guiconsole tools with their own param surfaces) are never inspected, so --help and friends are not misreported |
kbengine.spaceNavDiagnostics | boolean | true | Space/navigation semantic diagnostics: setSpaceData/delSpaceData using the reserved key _mapping, calling navigate/navigatePathPoints with no canNavigate anywhere in the file, and addSpaceGeometryMapping params dictionary string-layer keys — reported as a Warning (default: enabled) |
kbengine.rpcArgCountDiagnostics | boolean | true | RPC argument-count diagnostics: a self.base/cell/client.<method>(...) call site whose top-level argument count definitely mismatches the .def method's <Arg> count as declared in the section the call routes to is flagged as a kbengine.rpcArgCount Warning (default: enabled); star-args, dynamic receivers, declaration-not-ready, out-of-section declarations and unclosed parentheses stay unknown and are never reported; inlay hints do not substitute for the diagnostic |
kbengine.rpcArgTypeDiagnostics | boolean | true | RPC argument serialization-type diagnostics: when a self.base/cell/client.<method>(...) call-site argument is a statically determinable literal and definitely cannot serialize as the declared <Arg> builtin type family of the routed section, a kbengine.rpcArgType Warning is reported with the engine's pack behavior cited per family (the integer family packs 0 on a failed conversion, FLOAT/DOUBLE/STRING/UNICODE leave the argument out of the stream so the remote side reads misaligned bytes, BLOB accepts only bytes, VECTOR reads components through the sequence protocol; default: enabled); non-literal forms, types.xml aliases/ARRAY/FIXED_DICT, pickle families and ENTITYCALL never claim, list/tuple arguments to VECTOR stay unknown, and count mismatches stay with the rpcArgCount diagnostic |
kbengine.roleMisuseDiagnostics | boolean | true | Role-misuse diagnostics: an entity script's self.<builtin property> that is registered on other role faces (baseapp/cellapp/client) but not on the current face is flagged as a kbengine.roleMisuse Warning citing the registering face's engine source (default: enabled); unknown roles and plain Python classes are never guessed; the property table is the same source as the builtin-property hover metadata |
kbengine.entityScriptBaseClassDiagnostics | boolean | true | Entity-script base-class diagnostics: an entity module file ({EntityName}.py) must expose a class named after the module (class-name consistency hard gate, engine GetAttrString), and the entity class must derive from one of the component roster (base-class legitimacy hard gate, engine isSubClass; cellapp=Entity/EntityComponent, baseapp=Entity/Proxy/EntityComponent). Only provable forms are reported — the class-name gate lets the module namespace bind the name through any of a defined class / module-level instance assignment / import (GetAttrString finds it), and the base-class gate only reports "no direct base class + non-empty roster"; the client roster is unproven and face ambiguity is never guessed (default: enabled) |
kbengine.proxySessionSemanticsDiagnostics | boolean | true | Proxy session-semantics diagnostics (baseapp entity scripts only): an onLogOnAttempt returning LOG_ON_WAIT_FOR_DESTROY — the current engine does not implement a queued-login flow for this value (baseapp.cpp:4020-4021 shares the default branch, effectively a rejection; only LOG_ON_ACCEPT/LOG_ON_REJECT are stable) — and a giveClientTo(self) (the target is the caller itself, a giveClientTo pre-check violation that raises onGiveClientToFailure) are flagged as kbengine.proxySessionSemantics Warnings; only the baseapp face is handled; unproven faces and non-baseapp scripts are never guessed (default: enabled) |
kbengine.postDestroyDiagnostics | boolean | true | Post-destroy access diagnostics: within one function, a self.<member> access (excluding id/isDestroyed/className/destroy) that a determinable same-block self.destroy() precedes, with no same-level early exit in between, is flagged as a kbengine.postDestroy Warning (default: enabled); conditional destroys, cross-block/cross-callback flows, exceptions and def-declared destroy (dynamic dispatch) are never guessed |
kbengine.cellDataWriteDiagnostics | boolean | true | cellData known-field write diagnostics: a literal assignment to a known self.cellData["<key>"] field is validated against the declared engine scalar structure and range (datatypes.cpp registry) and flagged as a kbengine.cellDataWriteType Warning citing the declaration source (default: enabled); unknown keys, non-scalar types (PYTHON family, ARRAY, FIXED_DICT, custom aliases), non-literal or cross-line right-hand sides, bool-into-int and int-into-FLOAT are never flagged; alias receivers are validated by the nearest-assignment rule and skipped after rebinding |
kbengine.spaceDataProtectedKeyDiagnostics | boolean | true | Space-data protected-key diagnostics: setSpaceData / delSpaceData with the key _mapping — rejected by the engine case-insensitively (kbe_stricmp, spacememory.cpp protection contract) with AssertionError "key{_mapping} is protected!" — are flagged as a kbengine.spaceDataProtectedKey Error anchored on the key literal (default: enabled); getSpaceData("_mapping") is exempt (_mapping is the space geometry mapping the engine itself writes/reads, spacememory.cpp:543-554); protection is orthogonal to spaceID resolvability, so dynamic-space writes are still flagged; non-literal keys are not judged |
kbengine.cellDataWrongKeyDiagnostics | boolean | true | cellData wrong-key hints: a bare subscript read that provably misses, in a document with no untracked key-addition surface (dynamic key write / update / setdefault), is flagged as a kbengine.cellDataWrongKey Warning with the closest declared key and its declaration source; an open world or a .get() access only gets a low-confidence hint (a .get() never raises KeyError); declared and builtin keys, write points (writing is what introduces the key) and provable-present keys are never flagged; ties or distances past the bound yield no candidate |
kbengine.cellDataCallbackDiagnostics | boolean | true | cellData callback-entry access diagnostics: onGetCell is the only provable window — the engine destroys the cellData attribute before invoking the script callback (baseapp/entity.cpp:1024, callback from :1030), so reading self.cellData before an in-method store raises AttributeError and is flagged as a kbengine.cellDataLifecycle Warning; a plain store rebuilds the attribute and later reads stay silent, del self.cellData re-arms reporting, subscript/.get/iteration/alias forms all count as reads; base-role entity scripts only, all other callbacks (onLoseCell/onRestore/…) are never analyzed (default: enabled) |
kbengine.fixedDictMutationDiagnostics | boolean | true | FIXED_DICT sub-key assignment diagnostics (KBE-PY-015): assigning a sub-key of a FIXED_DICT property (self.<prop>.<key> / self.<prop>['<key>'], augmented forms included) does not trigger the property sync event — flagged as kbengine.fixedDictNestedMutation Warning with a whole-reassign quick fix ({**old, key: rhs}); whole-property assignments and non-FIXED_DICT properties are never flagged |
kbengine.fixedDictConstructDiagnostics | boolean | true | FIXED_DICT construction-site diagnostics: a whole dict literal assigned to a FIXED_DICT-typed target (self.<prop> = {…} / self.<prop>["<key>"]… = {…}) is validated against the types.xml declared field set — missing fields, unknown keys and field-value structure mismatches are flagged as a kbengine.fixedDictConstruct Warning citing the declaration source (default: enabled); plain dicts (bare-name targets, unresolvable or non-FIXED_DICT property types, augmented assignment, comparison/call right-hand sides) are never constrained; {**spread} or dynamic keys open the key universe (missing fields stay unreported, unknown literal keys still report); scalar ranges stay with the range lane and nested dict literals are not descended |
kbengine.scalarAssignDiagnostics | boolean | true | def-property scalar assignment diagnostics: a whole-line literal assigned to a target resolving to an engine scalar (self.<prop> = … root face including alias chains drilled through types.xml aliasType, self.<prop>["<key>"]… = … FD-field face via the STRUCT-02 key chain, self.<prop>[<int>] = … array-element face) is judged for structure and range against the same CELL-08 datatypes.cpp registry — structure mismatch (string/bytes/vector/None) and integer out-of-range (negative into unsigned, over the bandwidth bound, BigInt-exact) are flagged as a kbengine.scalarAssign Warning citing the declaration source (Avatar.def:5 / types.xml:30 form; default: enabled); the engine scalar name is resolved at the registry level, never from Python type names; bool counts as int; dict literals stay with the construction face; name/call right-hand sides, unresolvable targets, FD containers, array FD elements and mixed chains (array element then key) are never flagged |
kbengine.destroyedEntityReferenceDiagnostics | boolean | true | Destroyed-entity reference diagnostics (KBE-PY-016): storing self into a module-level list/dict/set is flagged as kbengine.destroyedEntityReference Warning — the reference outlives the entity and triggers the engine's garbages leak warning after 3600 s; drop it in onDestroy. Local containers, non-self arguments and read operations are never flagged |
kbengine.entityReferenceCacheDiagnostics | boolean | true | Entity reference caching diagnostics (KBE-PY-031): a statically provable entity object stored in a class attribute, module-level container or engine-timer closure is flagged as kbengine.entityReferenceCache Warning — the C++ object cannot be released after destroy and garbages warns only after 3600 s; the quick fix stores entity.id (downstream reads must be updated manually). Only seeded hook parameters, KBEngine.entities queries and assignment chains are analyzed — self.addTimer (safe per KB-001), createEntity*, .id reads, bare names and dynamic calls are never reported |
kbengine.typeImpact.enabled | boolean | true | Type impact preview (IDX-REL-001): kbengine.showTypeImpact lists, for a types.xml/alias.xml custom type entry (typically a FIXED_DICT whose field changed), every .def property whose type chain reaches it — direct references, ARRAY element types, alias chains — plus the .py access points of those properties via the entity mapping index. The def-edge index updates per file with content identity, so editing one types.xml never reparses def files |
kbengine.fieldChannels.enabled | boolean | true | Serialization round-trip index (IDX-REL-003): kbengine.showFieldChannels lists, for a field or def property, the concrete encode/decode points of the three serialization channels — wire encode (engine addToStreamEx, or the getDictFromObj return key positions when a user impl exists), wire decode (engine createFromStreamEx, or the createObjFromDict input-read positions), DB persistence (persistent properties go into the entity-table blob in stream order; non-persistent properties honestly report "not persisted"). Serializer shapes cache per Python file with content identity, so renaming a field in types.xml never reparses Python; the old spelling is listed under stale impl anchors |
kbengine.timerCleanupDiagnostics | boolean | true | Timer cleanup hint (KBE-PY-017): self.delTimer(...) statements inside onDestroy are flagged as kbengine.timerCleanupOnDestroy Information — destroy() already cancels all entity timers (scriptTimers_.cancelAll()), so destroy-time cancellation is redundant; stale ids silently return -1 |
kbengine.diagnostics.checkUnknownTypes | boolean | true | Check unknown type names |
kbengine.diagnostics.checkUnknownFlags | boolean | true | Check unknown Flags values |
kbengine.diagnostics.checkUnknownDetailLevels | boolean | true | Check illegal DetailLevel values |
kbengine.diagnostics.checkDuplicateDefinitions | boolean | true | Check duplicate property/method names |
kbengine.diagnostics.checkMissingPropertyFields | boolean | true | Check properties missing Type/Flags or duplicated fields |
kbengine.diagnostics.checkDefMethodMissingInPython | boolean | true | def↔Python method consistency (forward): a method declared in an entity .def (Base/Cell/Client methods) with no implementation in the same-named Python entity class is flagged as a Warning on the def method line, with the target Python file and class in the related info (default: enabled) |
kbengine.diagnostics.checkPythonMethodNotInDef | boolean | false | def↔Python method consistency (reverse, heuristic): a Python entity-class method with no def declaration is flagged — engine hooks and __dunder__ are skipped (default: disabled; enable only when you want the stricter direction) |
kbengine.diagnostics.checkProcessTopology | boolean | true | Process-topology definition-mismatch warnings: validates the process_topology.xml manifest (workspace root, optional) against entity defs — method sections (Base/Cell) or persistent properties whose topology role is missing, duplicate process names/ports, duplicate singleton roles, unknown roles/dependencies, and hosts ownership conflicts are all flagged as precisely-located Warnings (default: enabled; silent, zero findings, when no manifest is present) |
| Setting | What turning it off does | Common misconfiguration |
|---|---|---|
enableDiagnostics | Type, Flags, and structural problems in .def, plus duplicate entities.xml registrations, are no longer flagged | Forgetting to reopen the file and assuming the code has no errors |
enableStructureDiagnostics | Duplicate properties/methods, misplaced child tags, missing Type/Flags, and duplicated field definitions all go unreported | Confusing this with the item above: this one covers structure only; a misspelled type name belongs to checkUnknownTypes |
receiverNoneDiagnostics | Unguarded self.cell/self.base/self.client uses and .def section mismatches in Python scripts are no longer flagged | The receiver is None whenever the peer side is gone (player offline, lost cell); disabling only silences the warning, it does not make the call safe |
configContractDiagnostics | Config-layer contract violations (empty debug.components, off-default telnet ports, ../.. extraPaths, missing .kbengine/ ignore entry, doc-vs-config password/port conflicts) are no longer flagged | These are the exact failure shapes seen on a real intranet dev machine (Start Debugging with no targets, telnet auth failing per a stale doc, a plaintext-password debug.json committed by git add -A); disabling only silences the warnings |
propertyDirectionDiagnostics | Direction-violating def property accesses in Python scripts are no longer flagged | A base-side access to a cell-domain property is a real engine-side failure (the property does not exist in that domain); disabling only silences the warning |
startupScriptDiagnostics | Startup-script diagnostics (unknown --param, non-numeric --cid/--gus, unreferenced $KBE_RES_PATH/$KBE_BIN_PATH/$KBE_ROOT) are no longer flagged | Disabling silences the warning but does not fix the script; a process that never assigns $KBE_RES_PATH still cannot find its resources |
diagnostics.checkUnknownTypes | Misspelled type names no longer reported | Custom types must be locatable to avoid false positives: check entity_defs/types.xml, scripts/entity_defs/types.xml, assets/scripts/entity_defs/types.xml first, then user_type/<Type>.py, scripts/user_type/<Type>.py, assets/scripts/user_type/<Type>.py |
diagnostics.checkUnknownFlags | Misspelled Flags no longer reported | — |
diagnostics.checkUnknownDetailLevels | Illegal DetailLevel values no longer reported | — |
diagnostics.checkDuplicateDefinitions | Real duplicates go unreported | Projects with too many hints may turn this off, at the cost of missing real duplicates |
diagnostics.checkMissingPropertyFields | Properties missing Type/Flags go unreported | — |
diagnostics.checkDefMethodMissingInPython | def methods missing a Python implementation are no longer flagged | The one-click generate-impl CodeAction stays available from the def side; only the diagnostic is muted |
diagnostics.checkPythonMethodNotInDef | Python methods with no def declaration are no longer flagged | — |
Diagnostics trigger only when a .def file is opened or edited; kbengine.receiverNoneDiagnostics additionally triggers on Python entity scripts opened or edited. After kbengine.* configuration changes, already-open documents are rescanned.
Hover
| Setting | Type | Default | Purpose |
|---|---|---|---|
kbengine.hover.showTagDocs | boolean | true | Hover docs for tags like <Type>, <Flags>, <Properties> (the most frequent; turn this one off first if hints feel too many) |
kbengine.hover.showValueDocs | boolean | true | Hover docs for values like UINT32, BASE_AND_CLIENT, FAR |
kbengine.hover.showSymbolDocs | boolean | true | Hovering a custom property/method name shows the current definition's Type, Flags, Arg context |
kbengine.hover.returnTypeInference | boolean | true | Infer local variable types from Python return annotations on hover; disabling it stops annotation index builds initiated by hover |
kbengine.hover.typeStorage | boolean | true | Storage hover (landed table/column/type and shape) for types.xml custom types, in .def/types.xml |
kbengine.hover.implementedBy | boolean | true | Backlink when hovering a Python-side symbol referenced by a types.xml implementedBy |
kbengine.hover.entityRegistration | boolean | true | Registration info (Utype/list position) when hovering an entities.xml entity name |
kbengine.hover.defChain | boolean | true | Merged def chain when hovering Parent/Interfaces declaration elements |
kbengine.hover.eventStats | boolean | true | Registration/emit stats when hovering an event name in Python |
kbengine.hover.createNamespaceTimeline | boolean | true | createNamespace timeline on Python __init__ declarations: def property defaults, params per-key handling, then __init__, with engine source citations (CREATE-06) |
kbengine.hover.apiDocs | boolean | true | KBEngine Python API docs on hover (KBEngine.<api> access, lifecycle callback def lines, builtin-property supplement) |
kbengine.hover.behaviorNotes | boolean | true | Append the entity behavior-notes section on hover (property/callback behavior hints from the knowledge-page extraction library) |
kbengine.hover.serverConfig | boolean | true | Value and docs when hovering a kbengine.xml server config field (turns off the batch-112 hover face entirely) |
kbengine.hover.language | string | auto | Hover text language (IDE-I18N-002): auto detection — Chinese when the VS Code UI language/system locale is Chinese or the timezone is UTC+8, English otherwise; explicit en/zh-cn also accepted. The server-config hover face is wired; other hover faces follow gradually |
kbengine.hover.startupScript | boolean | true | Docs when hovering (and completion when typing -- or KBE_) a KBEngine startup parameter in .sh/.bat startup scripts — CLI params --cid/--gus/--hide/--KBE_ROOT/--KBE_RES_PATH/--KBE_BIN_PATH and env vars KBE_ROOT/KBE_RES_PATH/KBE_BIN_PATH/KBE_TIMING_METHOD/KBE_COMPONENTID/KBE_BOOTIDX_GLOBAL/KBE_BOOTIDX_GROUP/UID/UUID (bilingual, with the engine source line cited); off disables both the hover and the completion faces |
kbengine.hover.asyncBudgetMs | number | 2500 | Total budget (ms) for the hover def-method / receiver-call / builtin-property async chains; past the budget the layer is cut short and a timeout line is logged to LogHub (filter [kode-hover][timeout]) instead of spinning forever; <= 0 disables the gate (legacy unbounded wait) |
With the first three off, .def hover keeps only syntax highlighting. Since batch 154 (2026-10-20) the other six faces each get an independent per-feature switch — no master switch cutting everything off at once; mute only the noisy face and the rest carry on.
Server Config Completion
| Setting | Type | Default | Purpose |
|---|---|---|---|
kbengine.configCompletion.enabled | boolean | true | Key and enum-value completion in server config XML (kbengine.xml / kbengine_defaults.xml / messages_fixed*.xml): key suggestions are limited to exactly one more segment under the cursor's parent path (from the engine defaults snapshot field identities, KSEM-CFG-03); value suggestions come only from certain evidence — comment enum blocks suggest value-by-value with meanings, a Type: Boolean annotation suggests true/false, every other type stays empty (no default echo, no guessing) |
CodeLens and inlay hints
| Setting | Type | Default | Purpose |
|---|---|---|---|
kbengine.codeLens.rpc | boolean | true | RPC markers above def-declared method lines in Python implementation scripts (batch 126) |
kbengine.codeLens.eventCallbacks | boolean | true | Event callback markers — the event name on callback def lines and the listener count on emitEvent (since batch 154, split out of the RPC lens chain into its own registration) |
kbengine.codeLens.property | boolean | true | Property markers at self.<property> access sites in Python scripts (batch 135) |
kbengine.codeLens.propertyInitOrder | boolean | true | 属性先于 __init__ 装载 · 来自 <实体>.def marker on entity-class __init__ declarations (IDE-PROP-001; the engine loads Entity.def properties before __init__ runs, so scripts need no same-name assignment; click jumps to the def) |
kbengine.codeLens.typesXml | boolean | true | Storage lens chain on types.xml declaration lines (batch 134) |
kbengine.codeLens.engineSpi | boolean | true | Engine-SPI lens on module-level entry-script functions invoked by the engine via getEntryScript() (KODE-CFG-012 36-method table, title shows the trigger timing; component role derived from config, ordinary functions and out-of-table names get no lens) |
kbengine.codeLens.fileModifiedTime | boolean | retired 2026-11-25 | Retired: the standalone file-modified-time CodeLens was merged into the hot-reload state lens (the mtime segment now trails the state dot on line one); the key no longer appears in settings (a stale workspace value is silently ignored) |
kbengine.codeLens.mroChain | boolean | true | Mixin MRO execution-order lens on Python method def lines: 链 N: A → B → C lists every class defining the method along the enclosing class / composition-root MRO — exactly the order for cls in type(self).__mro__ dispatch and super() relay execute at runtime (C3 is fully determined by base declaration order; shown only with ≥2 definers, a lone definer has no ordering; click opens a position-numbered picker over all chain sites, multi-root views included) |
kbengine.inlayHints.typeData | boolean | true | Inline hint at self.<property> access sites in Python showing the final resolved type annotation (types.xml aliases resolve down to the underlying builtin, e.g. SERVER_ID → int; PYTHON/unknown → Any renders nothing), and the declared parameter types (: type, type-only) after each argument of self.base/cell/client RPC call sites (declared args only, section-gated); array <of> element types inline after for item in self.<property>: iteration targets and x = self.<property>[i] subscript-assignment locals (same resolution chain) — same resolution index as property F12 (batch 154; resolve-to-final 2026-10-29; element types 2026-11-04) |
kbengine.inlayHints.defParams | boolean | true | Inline hint at entity script section definition sites (ClientMethods/BaseMethods/CellMethods): each un-annotated def parameter gets the .def-declared <Arg> type after its name (: type), and a declared <ReturnType> renders -> type after the closing paren; multi-line defs are skipped (same rule as call-site inlays) |
kbengine.inlayHints.defProps | boolean | true | Read-only view of the entity's .def root-level properties rendered inline after a whole-line comment anchor # kode:props-from-def in an entity script (name + resolved type per property; segment hover shows the .def declaration source). Pure rendering — no code is written, the .def stays the single source of truth |
kbengine.semanticTokens.enabled | boolean | false | Python structural-symbol semantic tokens: class/function/method/parameter names plus decorators (macro), with declaration/async modifiers; same decision core as the Rust parity golden (RUST-144). Off by default — Python semantic highlighting is usually provided by Pylance; opt in until the conflict matrix (RUST-148) is settled. Disabled emits zero tokens |
kbengine.inlayHints.propertyShadow | boolean | true | Faint inline hints, never a squiggle: copied property x: <type> · cell after self.y = self.cellData["x"] assignment lines and bare out-of-domain reads; the def face x: <type> · cell after self.cellData["key"] accesses (raw domain union plus a not in cellData suffix when the domain set has no cell part — the full union stays in the tooltip); hints that resolve to a def declaration carry it as the navigation target (Ctrl+click, same as the non-copy hints); dual-gated by kbengine.propertyDirectionDiagnostics |
kbengine.domainMarkers.enabled | boolean | false | Editor decorations for resolved KBEngine symbols (underline family, zero colors, tooltip carries the domain identity and its source) layered alongside Pylance's semantic highlighting — a decoration layer, not the semantic-token namespace, so the RUST-148 default-off decision stays untouched. Four pilot faces: ① a self.<DEF property> access that hits a def property (same resolution index as F12, inheritance chain decided index-side); ② self.base/cell/client.<RPC> that hits a def method (section-gated, same-name methods across Base/Cell/Client disambiguated by the receiver section); ③ method declarations inside the entity script tree whose name hits the 36-entry engine lifecycle-hook table; ④ data-dictionary keys with a definite identity (a globalData/baseAppData/cellAppData key signature with real write sites in the index). Unresolved / index-not-ready (first scan) / unknown receiver all emit zero decorations — never guessed. Off by default (KODE-SYN-005 pilot) |
The four CodeLens switches take effect on change, no window reload needed; inlay hints have no change event, so turning one off takes effect on the next render.
Jumps and Navigation
| Setting | Type | Default | Purpose |
|---|---|---|---|
kbengine.jumpLog | boolean | false | Jump decision-path logging (Output panel KBEngine Navigation, filter [kode-jump]; zero overhead when off) |
kbengine.annotationLog | boolean | false | Annotation-source logging: hover answers record which source (document bucket / disk snapshot) they used into the KBEngine Annotations output channel; zero overhead when off |
kbengine.index.syntaxGate | boolean | true | Python index input syntax gate (INDEX-DISCIPLINE-001): before a saved reindex (save + external write, coalesced) the file passes a single-pass bracket/quote/indent precheck (no subprocess); a file saved mid-edit with broken syntax stays out of the index and the last healthy symbols are kept (diagnostics still report the error, navigation keeps working); off restores indexing broken files as-is |
kbengine.index.scanExcludeGlobs | string[] | [] | User exclusion globs for business indexing (ENGINE-LIB-SCAN-005): each glob is compiled with minimatch (dot on) and matched against the normalized absolute path; matching files/directories are pruned from every business scan surface (discovery chain .def, event index, Python class index). A bare directory name (kbe) is interpreted as the double-star form matching any prefix and suffix; invalid patterns are skipped without breaking the scan. The engine repo subtree is excluded automatically by engine-tree markers (see "How to Watch Index Progress" above) — this key is an additional escape hatch |
kbengine.python.enableMroJump | boolean | true | Switch for Python jump layer 2 (cross-file C3-MRO + composition roots resolving mixin/base-class methods); when off, layer 2 records a skip and no full-repo scan runs — jumps fall back to layer 1 (the .def derived index) and layer 3 (current-file class scopes) |
kbengine.python.enableDataDictIndex | boolean | true | Switch for the KBEngine.globalData/baseAppData/cellAppData cross-process data-dict key index; write sites [K]=RHS and read sites [K]/.get(K) link by key signature for Shift+F12 references and F12 jumps (read site jumps to the write site); a write-site RHS value type is inferred (only when known) and shown at same-key read sites as an inlay : <type> and in hover, so a {"gold": 1} write yields Dict[str, int] at get("cfg") readers; off skips the index and references/jumps fall back to the regular chain |
kbengine.python.enableSpaceDataIndex | boolean | true | Switch for the engine KBEngine.setSpaceData / getSpaceData / delSpaceData (cellapp-registered, per-space storage) space-data read/write index; calls whose spaceID is an int literal or module-level int constant binding and whose key is a string literal join a (spaceID, key)-exact family for key-position completion, Shift+F12 references and F12 jumps (read/delete site jumps to the write site, set site jumps to the first different-kind site); dynamic spaceIDs (unresolvable) never join a family — a dynamic space is not merged into one definite object; off skips the index and completion/references/jumps fall back to the regular chain |
kbengine.python.callChainHints | boolean | true | Python entity-method call-chain lenses and the Show Call Chain command; off removes the lens entry and suppresses preview generation |
kbengine.python.callChainView | string | graph | Initial Show Call Chain panel view: graph (mermaid rendered from the bundled npm package, offline-capable) or text (text chain fallback); the in-panel tab choice persists to workspace state and takes precedence over this setting; graph render failures fall back to text automatically with a header notice |
kbengine.python.apiMetadata | boolean | true | Engine-aware KBEngine API metadata (version, source commit/description and original declaration locations); missing source identity shows unknown instead of invented values |
kbengine.python.enableMroJump changes take effect immediately (no window reload); when off, layer 2 only records a skip in the jump trace and no full-repo .py scan runs, and .py changes stop being fed to the index. Method use sites prefer the Python implementation, with .def method declarations staged as fallback targets; .def navigation is kept at property accesses and method declarations. The index distinguishes modules from base/cell same-named classes and uses unsaved editor content. For the per-layer trace and troubleshooting, see the [kode-jump] decision-path section of the Logging guide. Engine source settings feed kbengine.python.apiMetadata; metadata is derived at activation, not by hard-coding a machine path.
Index discipline
kbengine.index.syntaxGate and the INDEX-DISCIPLINE-001 input rules: reindexing only happens for landed-on-disk states — saves (onDidSave) and external writes (watcher) are coalesced into one reindex per file per 300 ms window (a file still being edited is deferred to the next window, bounded at 5 s; among files flushed together the most recently touched one is reindexed last), and plain edits never reindex by themselves — they only register the document so queries can see unsaved buffers through on-demand version-keyed parsing. Before the reindex the file passes the kbengine.index.syntaxGate precheck: a file saved mid-edit with broken syntax (unbalanced brackets, unterminated strings, broken indentation) stays out of the index, the previous healthy symbols are kept so navigation keeps working, and diagnostics still report the syntax error normally; saving the repaired file restores full indexing automatically. The status-bar tooltip shows the live discipline counters (pending coalesce count and gate-skip count).
Paths and Workspace Discovery
| Setting | Type | Default | Purpose |
|---|---|---|---|
kbengine.configData | object | enabled: true, 3 default config-dir globs, *Config/*Data patterns, reload*/hotUpdate* exemptions, empty mutationExclude | Config data protection: accidental-write diagnostics (kbengine.configDataMutation) on config bindings plus direct-read schema hover; see Config Data Protection below |
kbengine.configData.schemas | object | {} (no declarations) | Declarative types for config.getXXX() / config[key] config-manager objects: manager object expression → table-key set; the generated stub reads this declaration instead of inference; see Config Data Protection below |
kbengine.assetsRoot | string | "" | Assets root (containing res/, scripts/ below); empty = auto-discover. The Python/def index scans only {assetsRoot}/scripts — see the assetsRoot details below |
kbengine.managedDir | string | ".kbengine" | Managed directory name (where generated/derived artifacts land, relative to the workspace root); illegal path characters fall back to .kbengine |
kbengine.engineRoot | string | "" | KBEngine engine install root (the kbe tree itself: parent of res/ bin/ src/ tools/, same semantics as the engine's KBE_ROOT; identity by structure anchor <root>/res/server/kbengine_defaults.xml, never by directory name). Used for engine-tree identification, the engine version marker, engine-tree exclusion from workspace scans, and SDK stubs. An explicit value is honored only after the anchor check passes (a misconfigured whole-tree exclusion is exactly what the check prevents); empty = the auto-fill/probe chain (unique structural hit under the current dir or its parent, ambiguous stays unset) — see the engine-root details below |
kbengine.gitHistory.enabled | boolean | true | File Git history feature gate (IDE-GIT-001): on = the 「查看文件历史 / 查看选中范围历史」 entries appear (explorer/editor context menus + command palette) and Git is queried only when the user opens one (never at activation/file-open/cursor/selection, no prefetch, no polling); off = entries hidden and direct command invocations run nothing Git |
The remaining path settings are "optional overrides": a configured value is honored as-is, an unconfigured one goes through the discovery chain — see "Auto-Discovery of Path Settings" below. Four more settings were removed the same day (2026-11-23, read paths kept as hidden overrides so existing settings.json values keep working): kbengine.binPath (the engine pins the binary layout — start_server.sh hardcodes kbe/bin/server; the extension derives it from the engine root and auto-discovery), kbengine.engineVersion (auto-detected from the version marker and preset by the project wizard; an explicit value still gates), kbengine.loggerPort (the engine logger allocates its log-listener port at startup — no engine-side default exists), and kbengine.console.discoveryHost (localhost-only by design; a hidden value remains the cross-machine escape hatch). kbengine.entityDefsPath / kbengine.entitiesXmlPath were removed (2026-11-23): the engine pins both layouts (entitydef.cpp:159/176-181 resolves entities.xml, entity_defs/ and types.xml strictly under {assets}/scripts), so fixed directories no longer get their own settings — both are computed from kbengine.assetsRoot.
Engine-root default search (2026-11-23): the auto-fill/probe chain (kbengine.engineRoot, profile engineRoot) looks in exactly two places — a kbe engine tree under the current directory, or one under its parent; a miss keeps the root honestly empty and the engine-missing prompt asks you to configure kbengine.engineRoot (no deeper upward walk, no sibling-directory name guessing). Per-key details:
Fixed def-side layouts (no settings; computed from kbengine.assetsRoot)
- Entity definitions directory:
{assetsRoot}/scripts/entity_defs;entities.xml:{assetsRoot}/scripts/entities.xml;types.xml:{assetsRoot}/scripts/entity_defs/types.xml(2026-11-23: formerkbengine.entityDefsPath/kbengine.entitiesXmlPathsettings removed — the engine only ever loads these fixed locations, so per-directory settings had no engine-supported meaning) - Used by: the entity explorer list,
entities.xmlnavigation, generator.defoutput, dependency graph reads and entity registration - When
kbengine.assetsRootis unset, the assets root falls back to the workspace root (the demo layout); the convention candidates and deep-scan fallback remain as the in-extension resolution aid, and the discovery report still flags a missing layout with remediation pointing atkbengine.assetsRoot - Misconfiguration: a wrong
kbengine.assetsRootleaves the entity explorer empty
kbengine.assetsRoot
- Type: string; default
""(empty = auto-discover). Renamed fromkbengine.configPathin batch 131 (2026-10-15): aligning with engine-domain terminology (the engine assets tree is literally called assets, and the convention scan is*_assets, see../../../assets/res/server/at kbemain.h:133-137); the old default${workspaceFolder}/serverwas dropped at the same time — that default disguised "unconfigured" as "explicitly configured", and only the empty string lets the code's "unset → auto-discover" path take real effect - This is the assets root (the engine assets tree root, e.g.
flyff_assets), effective in three places:- The working directory (cwd) of component processes — the engine resolves asset-relative paths against it;
- The project-side entry of the process env
KBE_RES_PATH: full orderKBE_ROOT/kbe/res, the assets root,assetsRoot/res,assetsRoot/scripts; - The preferred location of the component
kbengine.xml:assetsRoot/kbengine.xml.
- Since batch 128, auto-discovery: when the original value fails the engine-loading probe (no
res/server/kbengine.xmlbelow it), fall back through convention chain → remembered multi-candidate choice → unique deep-scan hit; the discovered root likewise feeds telnet probing and the final config view's componentkbengine.xml. Since batch 129 the convention chain includes first-level*_assetsworkspace directories (likeflyff_assets) — the directory name is only admission; a hit is still accepted by probe - The probe validates only the user copy
kbengine.xmland does not requirekbengine_defaults.xmlto be present: the engine loads the two configs each in its own tree (kbemain.h:71-74 loads defaults first, then the user copy overrides; the engine comments at kbemain.h:133-137 exemplify defaults in the engine res tree and the user copy in the assets tree), and the assets root's anchor is exactly the user copy — the engine'sgetPyUserResPath()also locates the assets tree viamatchRes("server/kbengine.xml"). The extension follows the same rule: defaults are derived from binPath/the engine source root (deriveEngineDefaultsXmlPath), the user copy is found from the assets root — the two trees are independent - Before starting, it validates: empty string when both discovery and explicit config fail, a nonexistent directory, or a path that is not a directory all error and abort the start; directory present but probe file missing → a
[WARN]is left in the output channel without blocking (batch 127) - Index scan root (2026-11-23 user directive): the Python/def index scans only
{assetsRoot}/scripts— the scripts source is the narrowest useful scope, and the rest of the assets tree (res/,entity_defs/, …) is not useful for class/entity indexing. When{assetsRoot}/scriptsdoes not exist, the index scan-root list is empty (nothing is scanned) — there is no fallback to the assets root itself or the workspace top level, which used to drag engine repos, dependency trees and build output into the index (the 2398-file full-disk scan). Callers surface the empty root as a configuration problem rather than silently scanning everything. A configured-but-invalid assets root (explicit value that resolves to nothing) is likewise an empty scan root — the explicit configuration is an intent, not a guess, so the workspace is not scanned in its place. A workspace without an assets root contributes a scan root only when its folder has ascriptssubdirectory (the engine-fixed default location; the narrowed root is thatscripts), and folders without one contribute nothing. When the scan root sits outside the workspace (an assets root in another directory), the workspace is not scanned at all: the workspace-wide glob only runs when there is no scan root, and the external root is walked on its own; the narrowed glob results pass the same exclusion filter, so narrowing saves IO without widening the match set. The engine-res tree ({KBE_ROOT}/kbe/res/) is never indexed: it holds only engine defaults (kbengine_defaults.xml, error/message/email defaults — noentities.xml, noentity_defs/), and the engine resolves entity definitions exclusively from{assets}/scripts(resmgr.cppgetPyUserScriptsPath();entitydef.cpp:159/176-181), so the extension excludes engine subtrees from scans outright - Scan narrowing covers every KBEngine face (2026-11-23): config-data diagnostics, ruff file collection, and event-API F12 candidate enumeration all reuse the same scan roots — narrowed to
scriptswhen KBEngine scan roots exist, keeping their previous workspace-wide behavior only in workspaces with no KBEngine roots (generic Python projects). The def-md5 face already enumerated through the scan roots. The warm-up gate probe (which decides whether the status-bar warm-up progress starts) also treats the presence of external scan roots as a KBEngine signal, so external-assets workspaces now get the warm-up progress instead of a permanently closed gate. The warm-up pipeline gained apython class indexstage: the full-scanN/Mdetail mirrors into the status-bar message the same way the discovery and event-index stages do. 2026-11-24 closure: the anchor-root-first + narrowed/bare-glob assembly of the three faces is unified into one shared discovery entry in the scan-root module, sharing the index face's gate — under misconfiguration (an explicit assets root that resolves to nothing, or assets present withscriptsmissing) all three faces now produce zero files instead of each falling back to a workspace-wide bare glob that dragstools/and dependency trees in to mask the configuration error - Misconfiguration: pointing at the repo root instead of the assets directory → the probe fails and auto-discovery takes over; when discovery also fails, the engine cannot find scripts under
res/scriptssubdirectories and components will not start; when the componentkbengine.xmlcannot be located, telnet and the final config fall back to pure defaults
Final Config View
| Setting | Type | Default | Purpose |
|---|---|---|---|
kbengine.showFinalConfigOnOpen | boolean | false | When the extension activates and defaults can be located, auto-open the final config in the background (not stealing focus); on location failure it silently skips without an error popup. When off, it can still be opened manually via the command or the sidebar Config view's 「最终配置」 node |
kbengine.finalConfigView | string enum | gui | Which face the final config opens in: gui = the config merge visualization panel (default), text = the read-only composed kbengine-final.xml virtual document. Applies to kbengine.config.showFinal, the sidebar Config view's 「最终配置」 node and the activation auto-open; kbengine.config.showFinalText always opens the text face, and the panel toolbar's Text view button always opens the GUI's text counterpart |
kbengine.autoRefreshFinalConfig | boolean | true | After defaults or the component kbengine.xml is saved, added, or deleted, recompose the open composed document automatically. When off, reopen the document or rerun the command |
kbengine.finalConfigComments | boolean | true | In the synthesized final-config view, put a sourced purpose comment inside every configuration element and order elements by the functional sub-category of their section (custom keys with no known meaning fall into the "Custom (unrecognized)" sub-category). Comments are evidenced from the engine defaults/source and follow the VS Code display language; when off, the original order and no comments are shown |
Folder Colors
| Setting | Type | Default | Purpose |
|---|---|---|---|
kbengine.folderColors.enabled | boolean | true | Master switch for workspace folder coloring (FOLDER-COLOR-001). Requires BOTH this switch and a KBEngine theme family workbench.colorTheme — with any other theme the feature is completely silent, as if not installed; switching themes takes effect live. Honest boundary: VS Code has no API to tint native Explorer folder backgrounds — only file badges (single-letter badge + theme color) and Kode's own tree views are decorated, folder background colors are never promised |
kbengine.folderColors.rules | array | see below | Coloring rule table (glob + semantic + per-rule toggle). Array order is the hit priority: first match wins, so reordering overrides; malformed entries (empty glob / unknown semantic) are filtered out. glob supports ** across segments, * within a segment, ? single char, {a,b} alternatives; the {assetsRoot} placeholder expands at resolve time to the active profile's assets root (absolute). Unset = the six built-in rules below; an explicit [] = zero rules, zero decorations. Faces: assets A orange · venv V muted gray · docs D blue · configs C purple · logs L red · process colors under scripts/ (baseapp blue B / cellapp green C / client yellow U / bots purple T, same role-directory judgment chain as the process breadcrumbs) |
Built-in default rules (in order): {assetsRoot}/** → assets, **/{venv,.venv}/** → venv, **/docs/** → docs, **/configs/** → configs, **/logs/** → logs, **/scripts/** → process. A docs/ directory at any depth matches by default — narrow or reorder via a custom rules array if that is too broad.
While the gate is on, the KBEngine Explorer entity tree's four groups (Types/Entities/Interfaces/Components) also switch to colored SVG icons (resources/icons/folder-colors/); when the gate is off (or the theme is not a KBEngine theme) they fall back to the default theme icons. See also the UI areas page's Folder Colors section.
Server and Logs
| Setting | Type | Default | Purpose |
|---|---|---|---|
kbengine.autoStart | string[] | ["machine","logger","dbmgr"] | Components brought up by a start without arguments. Legal values come from the component registry (src/serverManager.ts) — each documented in the setting's markdownEnumDescriptions: machine, logger, interfaces, dbmgr, baseappmgr, cellappmgr, loginapp, baseapp, cellapp, bots. The list is filtered in declared component order and started through the dependency-readiness graph — if machine fails or never becomes ready, dependents downstream are not started |
kbengine.logAutoConnect | boolean | true | Try connecting to the logger once on activation; failure is silent and goes through reconnection |
kbengine.webviewConsoleLogs | boolean | true | Collect the log panel page's console output and uncaught exceptions into the same log stream |
kbengine.webviewLocale | "auto" | "zh" | "en" | "auto" | Webview panel display language; auto follows the VS Code display language (zh-cn/zh-tw → Chinese, otherwise English); zh/en force-override. Panel copy only — editor diagnostics and hovers are unaffected |
kbengine.maxLogEntries | number | 10000 | Log WebView cache cap (entries). Oldest entries are dropped first and the buffer resets on window reload. Lower it to save memory on heavy log volume; raise it to keep longer history |
Console Line (Live Log Tail and Component Status Panel)
The guiconsole protocol line (machined UDP discovery + direct TCP to each component): the log tail registers Logger::registerLogWatcher (702) on the discovered logger and renders the 65501 push stream into the "KBEngine Console 日志" Output channel; the status panel reads the machine discovery broadcast (the same Args25 that carries pid/cpu/mem/usedmem/state). Both faces share one discovery hub — there is no second polling chain.
| Setting | Type | Default | Purpose |
|---|---|---|---|
kbengine.consoleLogTail.enabled | boolean | true | Master switch for the live log tail (702 → 65501 long-lived push stream). Missing config counts as ON; only an explicit false turns it off (same convention as hot-reload gates). A status-bar item shows connecting/connected/backoff state; disconnects reconnect with exponential backoff (1s doubling, 30s cap). Workspace-trust gate (RUST-422): the tail's long-lived connection reaches the logger through machined discovery whose broadcast target defaults to 127.0.0.1, so in an untrusted workspace the tail does not connect (status item stays hidden); trusting the workspace resumes the connection on the next discovery round. Fire-time read, same semantics as the telnet trust gate |
kbengine.consoleLogTail.components | string[] | [] | Component filter for the tail: keep only lines whose component type name (engine COMPONENT_NAME: cellapp, baseapp, logger, …) is in the array; empty = no filter. Changing the array takes effect on the next tail reconnect (toggle off/on) |
kbengine.componentStatusPanel.refreshSeconds | number | 5 | Discovery poll interval (seconds) for the shared hub — feeds both the panel rows and the tail's logger address |
kbengine.componentStatusPanel.cpuThresholdPercent | number | 90 | A component whose broadcast cpu exceeds this percent is marked red in the panel; a vanished process and a non-running state (shutting-down values 2/3/4) are red too (0=INIT/1=RUN are normal — live engines report INIT for machine/bots) |
kbengine.componentStatusPanel.memThresholdMb | number | 1024 | Memory threshold in MB over which a component is marked red; the wire usedmem field is bytes and is converted (live-machine measured) |
Remote Debugging
Python 3.7.3 compatibility: pin engine
debugpy==1.7.0and VS Codems-python.debugpy@2024.0.0; the project reproduction baseline forms-python.pythonis2024.0.1. The existing automatic installer/synchronizer still assumes newer Python and must not be used for this target. Follow the version-pinned installation guide.
| Setting | Type | Default | Purpose |
|---|---|---|---|
kbengine.debug.remoteTargets | array | [] | Remote debug target list — the target source for Attach to Remote Component; Update launch.json appends them into launch.json as debugpy connect entries |
kbengine.jsoncAssociation | boolean | true | Auto-write the debug.json glob key as jsonc into the workspace .vscode/settings.json files.associations (WorkspaceFolder level) — debug.json is JSONC (comments), stock json mode draws red squiggles on them. Own key only: an existing value (user-entered json/json5/anything) is never overwritten; when off, activation explains without writing. The kbengine.jsoncAssociation.off command flips the switch to false and reclaims only the key kode wrote (a key whose value you later changed is left as is) |
kbengine.debug.autoDebugpy | boolean | false | After a component starts successfully, kode injects debugpy.listen through that component's telnet :python layer (own short-lived client; per-component ports baseapp 5678 / cellapp 5679 / loginapp 5680 / dbmgr 5681 / logger 5682, bound to 127.0.0.1 only, outside the 31000-51000 telnet range). Named instances (same component started several times) each draw an exclusive port from that component's 8-slot window (baseapp 5700 / cellapp 5708 / loginapp 5716 / dbmgr 5724 / logger 5732, first-free; beyond 8 named instances of one component the extra ones are skipped with a warning). Single-component failures are logged only and never block startup. Before injecting, the selected interpreter (the kbengine.python.interpreterPath → workspace venv → PATH chain) is preflight-checked for debugpy: a missing interpreter/package or an outdated version surfaces an actionable status up front (interpreter path + install command) instead of a Traceback at injection time; when the assets tree already carries the synced package, injection proceeds as usual. Requires telnet enabled per component; components outside the port table (machine/interfaces/bots) are skipped. When on, Update launch.json also emits one debugpy connect attach config per component (localRoot = the workspace root) plus one component#instance entry per running named instance pointing at its own port. First use: run kbengine.python.debugpySync to copy the system debugpy into <assets>/scripts/common/debugpy (the first entry of the engine's module search path, python_app.cpp:167). Limitation, stated honestly: injection goes through telnet, so the entitydef loading and early config phases have already run — early breakpoints are covered by the separate wait-at-startup mode below. Workspace-trust gate (RUST-422): the injection target is that component's telnet endpoint declared in workspace configuration, so in an untrusted workspace the injection is skipped (no probe packet, no debugpy.listen command; the debug status board honestly shows the component as not injected); trusting the workspace and restarting the component resumes injection |
kbengine.debug.pythonTarget | string | "" | Explicit engine target Python three-part version (e.g. 3.7.3) — the single basis for debugpy install/sync/preflight compatibility policy (3.7 strictly pins 1.7.0 since debugpy 1.8.0+ requires Python ≥3.8; 3.8 → 1.8.1 line; 3.9 → 1.8.13 line; 3.10+ floor 1.8.0; versions with no verified support line are never blind-installed). Empty = inferred from the active project's engine binaries (version-string cross-binary vote under kbe/bin/server); still unresolved = honest unknown: auto install/sync refuses to act, preflight only reports whether the package is installed |
kbengine.debug.debugpyInject | boolean | true | Master gate of the one-shot command kbengine.debug.debugpyInject (KODE-DBG-001): pick a running component, send debugpy.listen through its telnet :python layer (per-component port table, otherwise 5678, 127.0.0.1 only), then attach in port mode once the listener is up (probe → connect; a listener that never comes up reports honestly instead of force-attaching). Reuses the assets-tree debugpy sync and the short-lived telnet client — no second injection path. When off, the command only says so and does nothing. Earliest-startup breakpoints are not covered here — use kbengine.debug.waitAtStartup |
kbengine.debug.waitAtStartup | boolean | false | Opt-in wait-for-debugger mode (on/off commands insert/remove a marked bootstrap in the entry script scripts/kbengine.py, byte-exact on removal). The bootstrap reads KODE_DEBUGPY_WAIT_PORT — set by the launcher for default instances of table components to the per-component table port — and runs debugpy.listen + wait_for_client() at the earliest Python, pausing the component before early breakpoints until VS Code attaches the matching debugpy attach config. Without the env var, without the debugpy package, or on any error it stays silent and never blocks startup. Boundary: named instances keep the telnet-injection path (per-instance ports come from the start-linkage window; wait mode does not cover them yet); while on, the telnet injection for default instances is skipped with a log line |
kbengine.debug.sessionEndBehavior | string | "detach" | What happens to the target process when a debug session ends. detach (default): the debugger detaches and the process keeps running — other instances and unlinked processes are never touched. stop-process: only the exact target that session was attached to is stopped (located by component + instance, so other instances of the same component stay untouched); applies only to kode-generated attach configs (their entry names carry the target identity), user-created debug sessions are unaffected |
kbengine.debug.attachTimeoutMs | number | 15000 | Deadline in ms for attach commands (Attach to Component / Attach to Remote Component). While attaching, a cancellable progress notification shows: a port nobody listens on is stopped at the deadline with an honest warning — the entry never waits forever and never retries in that run; cancelling the notification takes the same stop path. 0 or negative disables the deadline (wait indefinitely, manual cancel still works) |
Fields per entry:
| Field | Type | Required | Notes |
|---|---|---|---|
name | string | Yes | Target display name (the identifier in the picker) |
host | string | Yes | Remote IP or hostname |
port | number | No | debugpy listen port, default 5678 |
localRoot | string | No | Local source root for pathMappings; must be paired with remoteRoot — a partial pair is not collected |
remoteRoot | string | No | Remote source root for pathMappings; must be paired with localRoot — a partial pair is not collected |
- Prerequisite: the remote component must first have been sent the enable-debugging command over telnet and have a debugpy listener up; the extension attaches with
connect: {host, port}. An entry carrying bothlocalRoot/remoteRootgets thosepathMappingsin the attach config and its launch.json entry; otherwisepathMappingsstays omitted - Misconfiguration: a wrong
host→ attach fails through the error channel; a wrongport→ debugpy unreachable; entries with emptyname/hostare not collected
Python Integration
Interpreter resolution chain (PY-ENV) — the profile interpreter resolves as: the kbengine.python.interpreterPath setting (adopted only when the file exists, ${workspaceFolder} supported) → a workspace scan for virtual environments → python3/python on PATH → an explicit missing state (never a fabricated path). The workspace scan (PY-ENV phase 2) walks the workspace root to a bounded depth (3), skipping node_modules/target/.git and other dependency/build directories, and accepts an environment only with real evidence — pyvenv.cfg for venv or conda-meta/ for conda, plus a verified interpreter binary (bin/python, Scripts/python.exe on Windows); broken directories are never claimed. The kbengine.python.venvDirectories name list acts as a same-depth priority hint, not a gate.
Interpreter status bar and one-shot venv creation — a status bar item shows the current interpreter with its source badge (auto discovery / configured setting / PATH), clicking it (kbengine.python.selectInterpreter) opens a QuickPick whose selection writes kbengine.python.interpreterPath at workspace level and takes effect immediately; the trailing 「创建新 venv…」 entry (kbengine.python.createVenv) runs python -m venv in a progress notification (base interpreter from the PATH chain only — missing base refuses honestly before any spawn) and auto-selects the verified new environment. See the command sections of kbengine.python.selectInterpreter / kbengine.python.createVenv in the commands guide.
| Setting | Type | Default | Purpose |
|---|---|---|---|
kbengine.python.interpreterPath | string | empty | Python interpreter path recorded per project profile together with its source: this setting is adopted only when the file exists (supports ${workspaceFolder}); otherwise the workspace is scanned for verified environments (pyvenv.cfg/conda-meta evidence + interpreter binary, depth-bounded, dependency/build directories pruned); otherwise python3/python is located on PATH; if none is found the profile records an explicit missing state and never fabricates a path |
kbengine.python.venvDirectories | string[] | [".venv", "venv", ".kbenv"] | Virtual-env directory names (single path segment, no separators): when a quick action enables venv without venv.path, each name is probed beside the action directory and under the config root (action directory first); the interpreter chain treats the list as a same-depth priority hint for the workspace environment scan when interpreterPath is empty. Non-array or all-invalid values fall back to the default |
kbengine.python.extraPathsSync | boolean | true | Auto-write the workspace-discovered KBEngine scripts root into python.analysis.extraPaths (WorkspaceFolder level). python.analysis.extraPaths entries are always written as ${workspaceFolder}/... variable paths, and legacy absolute entries whose prefix is the workspace root migrate automatically on the next sync; absolute entries that cannot be migrated are flagged by kbengine.configContract.extraPathsAbsolute. Manages only the segment this extension wrote (user-entered paths are kept as-is apart from that workspace-prefix migration; no write when unchanged). When off, the kbengine.python.syncExtraPaths command only explains without writing |
kbengine.ruff.ensureConfig | boolean | true | On the first ruff lint/format run (or generator multi-lining), check the workspace root for a ruff config ([tool.ruff] in pyproject.toml, or ruff.toml): when missing, ask once and on consent create the minimal [tool.ruff] section (line-length = 88, common-value comments included); an existing [tool.ruff] is never touched, and an append that cannot be proven TOML-safe is skipped honestly. Declining silences the prompt for the session |
kbengine.python.stubCopy | boolean | true | Automatically copies missing built-in KBEngine stubs for detected KBEngine projects. Set to false to disable automatic copy. Manual export and reset remain available. |
kbengine.python.stubExport | boolean | true | Copy the built-in KBEngine stub package (repo-top-level typings/ template, derived from the cuihairu/kbengine fork typings; copy-if-absent, project copies are never overwritten) into the stub directory so Pylance can resolve import KBEngine, and export the types.xml custom types into a kbe_types.py type stub module (FIXED_DICT → TypedDict, aliases → type names). Silent auto-copy once on activation; kbengine.python.exportStubs / kbengine.python.exportTypeStubs are the manual entries, kbengine.python.resetStubs is the only overwrite channel Turning the switch off stops exports and wiring: the next sync (silent activation chain or the manual command) drops the stub directory from the managed python.analysis.extraPaths segment and stops writing python.analysis.stubPath / the reportMissingModuleSource suppression; files already on disk are kept (this gates export, not deletion), and previously written values stay because no managed memory can distinguish them from user-set values (see docs/review/2026-11-17-rust-168-typings-toggle-audit.md) |
kbengine.python.stubDir | string | empty | The .pyi stub directory, resolved in three tiers: setting > env var KBENGINE_STUB_DIR > default convention .kbengine/stubs. VS Code variables like ${workspaceFolder}/${env:NAME} are supported; relative paths join against the workspace root, absolute paths are used as-is |
kbengine.python.entityStubMethods | boolean | true | Include the def method surface (Base/Cell/ClientMethods) in entity_types.pyi stubs (default: enabled); when off, keep the properties-only stub surface |
Un-annotated Function Stub Inference (2026-11-03, pyrefly)
| Setting | Type | Default | Purpose |
|---|---|---|---|
kbengine.infer.enabled | boolean | true | Enabled for detected KBEngine projects when local Pyrefly is available. Project .pyi files are written under .kbengine/stubs/generated/. Kode reads them by source path for hover and inlay hints. |
kbengine.infer.pyreflyPath | string | empty | Absolute path to the pyrefly executable (empty = discover on PATH, then the ~/.local/bin pipx default location; if not found, kbengine.infer.run says so honestly and the feature degrades without throwing) |
kbengine.infer.pythonVersion | string | 3.7 | Target for pyrefly stubgen --python-version (the KBEngine embedded-interpreter version; official minimum is 3.5) |
kbengine.infer.sourceWrite | string | managed | Legacy compatibility setting. Pyrefly reads source and writes only .pyi under the managed directory. |
kbengine.infer.exclusionsSync | boolean | true | Automatically exclude .kbengine from search.exclude / files.watcherExclude, and suggest appending to the git repo-root .gitignore when the file already exists: the entry is only written after the user accepts the confirmation prompt (never edited silently, never created; SVN / no-VCS workspaces get no git-specific write). Write-once memory: accepting or declining is remembered once per repo root × managed dir — once settled, a later missing entry is treated as deliberate (e.g. committing .kbengine) and never re-asked; the kbengine.managedDir.syncExclusions command is the explicit bypass and the KBE-CFG-004 diagnostic keeps warning about the un-ignored debug.json password risk |
The pyrefly binary itself requires python >= 3.8 (requires-python >= 3.8 in its PyPI metadata). A pyrefly.exe inside a Python37\Scripts (or older) directory was not installed by that interpreter's pip — it was copied or force-installed there, and such a binary can answer --version and exit 0 from every batch while generating no stubs. Install pyrefly with a python >= 3.8 interpreter; kbengine.infer.run prints a channel warning whenever the discovered binary sits under an older install directory. --python-version 3.7 stays valid as a stub target: pyrefly 1.4.0 accepts it and emits real 3.7-form stubs (verified on a real corpus — counts identical to the default target, a handful of files adapt syntax/quality, none regress to empty). To check output yourself: PowerShell (Get-ChildItem .kbengine\stubs\generated -Recurse -Filter *.pyi | Measure-Object).Count — zero after a "successful" run means the binary, not the pipeline, is at fault.
Entity Script Enhancements (2026-10-21)
| Setting | Type | Default | Purpose |
|---|---|---|---|
kbengine.entity.builtinProperties | boolean | true | Hover annotations and self. completion for built-in entity properties (per base/cell/client face; default: enabled), plus def-declared property type / array element type hover (TYP-ARRAY); when off, falls back to the plain symbol chain |
kbengine.entity.receiverSections | boolean | true | Filter def candidates by receiver section on self.cell./self.base./self.client. calls — hover, F12, RPC lens (default: enabled); when off, falls back to section-unaware resolution while the def signature (arg/type) gate stays on |
kbengine.entity.methodStubBody | string | pass | Body of the one-click implementation skeleton generated on the def side (pass empty body, or raise → raise NotImplementedError); parameters map from the def <Arg> types — builtins emit annotations (int/float/str/bool/bytes), others stay bare parameter names |
kbengine.python.builtinTypeInlayHints | boolean | true | Inline : <type> hints after self.<builtin property> accesses in entity scripts (same hit basis as hover; default: enabled); double-gated by kbengine.entity.builtinProperties (master switch) and this key — either off renders no builtin-property inlay hints |
kbengine.python.proxyInternalAttrHints | boolean | true | Faint internal attribute · Proxy hints after self.__ACCOUNT_NAME__ / self.__ACCOUNT_PASSWORD__ accesses in entity scripts (names from entitydef/common.h:142-143, injected by baseapp at baseapp.cpp:4241-4246); with the project stub-copy KBEngine/Proxy.pyi on disk the hint carries navigation to the declaration row (Ctrl+click); declaration rows are scanned from the project copy at render time (the copy is user-editable, pinned numbers would drift) |
kbengine.types.aliasDiscovery | boolean | true | Discover custom types from scripts/entity_defs/alias.xml into the type list (default: enabled); when off, falls back to types.xml only |
kbengine.types.inlineFixedDict | boolean | true | Inline FIXED_DICT declarations on .def properties (<Type>FIXED_DICT<Properties> written directly in the def) register as synthetic types in the unified registry (flattened name <Entity>_<Property>): hover/inlay annotations for self.<property>, member drill, dict-key diagnostics and the kbe_types.pyi/kbe_runtime.py emission all light up; off falls back to the old behavior (annotations honestly land on Any, no synthetic stub classes) |
With kbengine.python.stubDir left empty (the default), the directory is kode-managed .kbengine/stubs: zero write when content matches disk, stale content (after an index update) is automatically rewritten, manual edits are not kept — ignoring it in .gitignore is recommended. With a directory configured, the directory is user-owned: kode only scans, never overwrites — any .pyi already in the directory is treated as a user asset and left untouched; one is generated only when no .pyi exists; an unreadable directory (missing/no permission) is reported honestly, never blindly written.
Boundary: the extraPaths managed segment recognizes only the default convention directory .kbengine/stubs (joined when export is on and KBEngine.pyi or kbe_types.py is on disk; both generated artifacts share the one directory); a user-configured kbengine.python.stubDir directory does not join the managed segment — add it to python.analysis.extraPaths yourself if needed.
kode exports separate packages to .kbengine/stubs/base, cell, bots, client, dbmgr, interfaces, logger, and loginapp. The script directories scripts/base and scripts/cell map to engine components baseapp and cellapp; they select the base and cell stub directories. pyrightconfig.json executionEnvironments put only the matching process package first in each directory's extraPaths. Each process also has a separate generated entity_types.pyi, filtered by property Flags and method section, with distinct remote handles. No sidecar .pyi shadows your entity implementation.
Resolution order is measured on real servers (RUST-170, Pylance 2026.4.1 / Pyright 1.1.414): stubPath → extraPaths → importer-directory .pyi — the importing file's own directory is not a search root for absolute imports, so a same-directory .pyi only resolves when nothing else provides the module (see docs/review/2026-11-17-rust-170-stub-priority-realenv.md). To keep an old combined KBEngine package from masking those environments, the managed python.analysis.stubPath is ${workspaceFolder}/.kbengine/stubs/_shared, and the project config uses the equivalent relative path. Both follow kbengine.managedDir and a custom kbengine.python.stubDir or KBENGINE_STUB_DIR. User-set paths and JSONC comments are preserved. Existing TOML Pyright settings, inherited configs, conflicting user execution environments, or a user-owned global stubPath require explicit integration; kode preserves them and reports the conflict. The sync merges reportMissingModuleSource: none into python.analysis.diagnosticSeverityOverrides for the C++ embedded module. Export and synchronization switches still control this lane. The lane runs once at activation and chains after every stub export / reset / type-stub export command; changing kbengine.managedDir or kbengine.python.stubDir re-exports the stubs and silently re-syncs the whole wiring (settings keys and pyrightconfig.json) against the new location.
Existing stub files remain copy-if-absent. New process directories are added alongside older copies, so old root packages no longer override process analysis. To replace an edited process template, run the explicit reset command and review its confirmation. Shared scripts without a process assignment receive common vector/container types, not a union of server and bots APIs. See the process typing design.
Code Generators
| Setting | Type | Default | Purpose |
|---|---|---|---|
kbengine.generator.defOutputPath | string | scripts/entity_defs | Where generated .def files go; the default value is itself the discovered def root, config serves only as override |
kbengine.generator.pythonOutputPath | string | scripts | Where generated Python goes; with the default value it is derived from the discovered def root's parent (e.g. assets/scripts), config serves only as override |
kbengine.generator.generatePython | boolean | true | Whether wizard/template entity creation also generates the Python file |
kbengine.generator.registerInEntitiesXml | boolean | true | Auto-write into entities.xml after generation (the fixed {assetsRoot}/scripts/entities.xml) |
kbengine.clientSdk.outputDir
| Setting | Type | Default | Purpose |
|---|---|---|---|
kbengine.clientSdk.outputDir | string | scripts/client_entities | Output directory of the client entity SDK generator (kbengine.clientSdk.generate) — TypeScript / C# / Python skeletons and companion files all land here; relative to the workspace root |
The language list and overwrite policy are chosen in the command's quick pick; existing files are not overwritten by default — see Client Entity SDK Generation.
telnet Probing
telnet's presentation surface (standalone tree view, status lights, panel) appears only when the configuration explicitly enables telnet; the resolution chain is in "How the telnet Port/Password Are Read".
| Setting | Type | Default | Purpose |
|---|---|---|---|
kbengine.telnet.host | string | 127.0.0.1 | Probe target host. For a remote machine, enter its IP |
kbengine.telnet.port | number | 0 | Explicit port. >0 locks a single target (no more per-component probing); 0 = not explicitly set, falling back to the component kbengine.xml section and defaults |
kbengine.telnet.password | string | empty | Used by the automatic handshake login; written to the socket only, never to logs. Empty = no auto login; the status light stays at 「端口开·未配密码」 (port open, no password set) |
kbengine.telnet.enableCommands | string[] | [] | The command whitelist the telnet panel may send (exact match, or "command + space + arguments" prefix match). Built-in read-only shortcut commands (entity count/entity list/global data keys/:help) are allowed by default; :quit shuts the server process down and is always refused even if whitelisted |
kbengine.telnet.configXmlPath | string | empty | Explicitly specifies the component kbengine.xml (${workspaceFolder} supported), taking priority over auto-probing; when the setting gives an explicit port >0, the port follows the setting |
kbengine.telnet.probeIntervalSeconds | number | 5 | Probe polling interval (seconds); values below 1 run at 1 second |
Workspace-trust gate (RUST-422): the target host comes from workspace configuration, so in an untrusted workspace the telnet probe does not connect to any config-declared host and no persistent session is opened (status lights stay off; trusting the workspace resumes probing on the next round). The gate is fire-time read and mirrors the HTTP quick-request trust gate.
Memory Monitor
The memory monitor panel (kbengine.memoryMonitor.show, right-column webview) rides the same shared data face as Server Monitoring (MEMMON-002): the machine UDP broadcast already samples each component (CPU / RSS via usedmem / entity count via extradata) and watcher TCP queries supplement per-component detail — there is no telnet session, no password/port setup, and no hand-rolled sampler. The panel shows number cards (current RSS / window peak / entities / sample rate, each with a period-over-period delta), a 60-second canvas line chart (cyan RSS line + purple dashed entity line on a right axis + gray dashed window-peak line), and object-pool counter chips from the cellapp watcher (objectPools/Witness + objectPools/EntityRef; chips hide honestly when the watcher gives no response — nothing is invented). Top-bar buttons switch the drawn instance, one per configured component type expanded into discovered instances (green dot = sample present and watcher responded, yellow = machine-only, red = absent from the scan); all configured instances accumulate in parallel so switching never clears curves; pause stops scanning and keeps the curves, clear drops the selected curve. When machine discovery finds no components the panel says so explicitly (machine :20086 unreachable).
| Setting | Type | Default | Purpose |
|---|---|---|---|
kbengine.memoryMonitor.sampleHz | number | 1 | Sampling frequency (Hz); 0.5 = one sample every 2 seconds, 2 = two per second. Changes take effect from the next sample period |
kbengine.memoryMonitor.defaultTargets | string[] | ["baseapp", "cellapp"] | Component types the panel shows buttons for, expanded into the instances machine discovery finds |
kbengine.memoryMonitor.autoStart | string | "off" | Start memory monitoring automatically once the Telnet probe first reports a live engine component: off (manual only), panel (auto-open once — closing it suppresses re-opens this session), background (silent sampling; a later manual panel open shows the accumulated history, no window pops) |
HTTP Quick Requests
| Setting | Type | Default | Purpose |
|---|---|---|---|
kbengine.httpRequests | array | see below | HTTP quick request list (one disabled example by default) |
kbengine.http.allowNonLoopback | boolean | false | Whether HTTP quick requests and the hot-reload deployment channel may target non-loopback endpoints. Off by default: only confirmed loopback targets are allowed (the local engine: localhost / *.localhost / 127.0.0.0/8 / [::1], host-literal classification, no DNS); every non-loopback target (intranet or public hosts, cloud metadata addresses such as 169.254.169.254) is blocked before the request is sent, with a reviewable ⛔ block line and an error popup (SSRF / data-exfiltration guard). When enabled, non-loopback requests pass but each run logs a ⚠ security warning first — use only with hosts you trust |
Type: array; the default contains one disabled example (a hot-reload example, enabled: false), shaped after the default hot-reload endpoint (POST http://127.0.0.1:8090/hotfix?module_name=<module>, body module_name=<module>) — module_name is deliberately carried in both the query string and the body, so a server that reads either one gets it; the duplicated identical value is harmless — equivalent to:
curl -X POST 'http://127.0.0.1:8090/hotfix?module_name=entities.fight.FightAI' -d 'module_name=entities.fight.FightAI'Add/remove/edit via the settings UI's list editor; enable/disable = the entry's enabled switch. Fields per entry:
| Field | Type | Notes |
|---|---|---|
name | string | Request name (identifier in the quick pick and logs), required |
url | string | URL template, may contain template variables, required |
method | string | HTTP method, default GET |
headers | object | Request headers (values also go through template substitution) |
body | string | Request body (sent only when non-empty, also through template substitution) |
enabled | boolean | Enable switch, default enabled |
keybinding | string | Keybinding display string (shown in the quick pick's detail column) |
Template variables (shared by URL/body/header values, literal substitution, no URL encoding):
| Variable | Meaning |
|---|---|
${module} | Module path scanned along __init__.py package boundaries: when entities/ and fight/ each contain __init__.py, entities/fight/FightAI.py → entities.fight.FightAI; KBEngine scripts live under base//cell/ role directories which have no __init__.py, so those do not count as module segments — the module name is then just the file name without .py (the "no module, use the file name" form) |
${moduleBasename} | Last segment of the module path: entities.fight.FightAI → FightAI; in the no-package form it matches ${module} |
${filename} | File name (FightAI.py) |
${line} | Cursor line (1-based) |
${sel} | Selected text |
The official VS Code variable family is also supported (${file}=absolute path, ${workspaceFolder}, ${workspaceFolderBasename}, ${fileBasename}, ${fileBasenameNoExtension}, ${fileDirname}, ${fileExtname}, ${relativeFile}, ${relativeFileDirname}, ${env:NAME}, ${cwd}, ${userHome}, ${pathSeparator}; in multi-root workspaces ${workspaceFolder:Name} picks a folder by name). Placeholders unknown to both tables are kept as-is (not wiped to an empty string).
History: before batch 152 the file-name placeholder was named
${file}; since the official variable family landed,${file}follows the official absolute-path semantics — use${filename}for the file name.
With no active editor, each variable substitutes to the empty string.
Keybinding: VS Code has no API to register keybindings at runtime; bind a key to kbengine.httpRequest.run in "Keyboard Shortcuts" and carry the request name in args:
{
"key": "ctrl+alt+h",
"command": "kbengine.httpRequest.run",
"args": { "name": "热更新(示例)" }
}The run log goes to the OUTPUT channel 「KBEngine HTTP 快捷请求」 (KBEngine HTTP quick requests): ▶ request line → ✓ status code · duration → response body (truncated past 4000 characters, full length noted); failures render as a ✗ mark + an error popup.
Endpoint policy (RUST-420, complementary to the workspace-trust gate): after template variables are substituted, the real URL must point at a confirmed loopback endpoint on this machine before it is sent. A non-loopback host is blocked (no request leaves the machine; a ⛔ block line plus an error popup names the host and the kbengine.http.allowNonLoopback setting) unless that setting is explicitly enabled, in which case each run logs a ⚠ security warning first. Untrusted workspaces are blocked earlier by the trust gate regardless. Classification is by host literal — a public domain that happens to resolve to loopback is treated as non-loopback (opt-in to allow it), and file:// / other non-HTTP URLs pass this gate and are rejected by the transport instead. The same endpoint policy also gates the profile-based hot-reload deployment channel (HttpReloadTransport): both its send and its probe pass this policy before any request leaves — a non-loopback target without opt-in is blocked (per-file failed receipts carrying the block reason, no request sent), and with opt-in each ⚠ security warning is attached to the receipt (visible per delivery in the ledger). The channel's default template endpoint is 127.0.0.1:8090, always loopback and allowed.
Auto Hot Reload
File save/watch → trigger the quickActions action by name. On by default (user order 2026-11-06): a fresh workspace with no configuration still creates a watcher — the scope is derived from kbengine.assetsRoot as <assetsRoot>/**/*.py when globs is unset (one explicit globs pattern per watcher when it is set, and if no valid assetsRoot resolves the status bar reports ready-with-error with the fix instead of silently watching the whole workspace) — and with no actionName set a save sends the default hot-reload request POST http://127.0.0.1:8090/hotfix?module_name=<module> with body module_name=<module> (both carry it, for server implementations that read either) — the engine being down is reported as failed honestly, never as success. One-key off: click the 「热更」 status bar item or run kbengine.hotReload.toggle (writes this setting back); the first activation shows one non-modal notice that can be dismissed for good. Switching enabled to false tears the watchers down immediately — config changes take effect without a window restart. Structural .def changes are still intercepted (restart required), never sent as an ordinary reload.
Quick-enable keybinding (on by default): ctrl+alt+r (macOS cmd+alt+r) is bound to kbengine.hotReload.configureChannel out of the box with no when narrowing — it works in any editor/workspace context the moment the extension is installed. Pressing it opens the three-preset quick-enable screen (in-house receiver [recommended] / KBEngine official / unset, plus an "advanced" entry): a single profile goes straight to the preset list, multiple profiles pick one first — ≤2 steps total; a preset auto-fills the local port/path defaults, probes, and enables only on a passing probe; with zero configuration it reports honestly instead of doing nothing. Preset defaults are http://127.0.0.1:8000/reload + POST + body {"files":${files}} (JSON object body, which is what carries targetId/sender_digests so the receiver can answer applied); start the receiver with node scripts/hot-reload-receiver/referenceReceiver.mjs --port 8000 --root <staging root> --mode apply (the script defaults to --port 0, a random port, otherwise the port-8000 probe honestly reports unreachable).
To change it: edit it in Keyboard Shortcuts, or in keybindings.json remove the default binding first, then bind the new key (a new entry for the same command alone does not drop the default):
[
{ "key": "ctrl+alt+r", "command": "-kbengine.hotReload.configureChannel" },
{ "key": "ctrl+shift+r", "command": "kbengine.hotReload.configureChannel" }
]On macOS do the same with a key field in the user rule (keybindings.json does not take mac):
[
{ "key": "cmd+alt+r", "command": "-kbengine.hotReload.configureChannel" },
{ "key": "cmd+shift+r", "command": "kbengine.hotReload.configureChannel" }
]Conflict rule: when another command shares the key, Keyboard Shortcuts lists both and marks the conflict; keybindings resolve bottom-up, first rule whose when matches wins — user rules sit after default rules, so a user binding (or the removal line above) takes precedence, with ties within one layer decided by actual order and context. The default key deliberately avoids keys already taken in this repo: ctrl+alt+h is this guide's HTTP quick-request example key, and ctrl+] / ctrl+d belong to the telnet panel, so the hot-reload quick enable uses ctrl+alt+r (test-locked: any collision goes red).
| Setting | Type | Default | Purpose |
|---|---|---|---|
kbengine.hotReload.enabled | boolean | true | Master switch, on by default; when on, one file watcher per globs pattern (unset globs derive the scope from assetsRoot, see below); off = watchers torn down |
kbengine.hotReload.actionName | string | empty | The action name to trigger; must exist in the quickActions array. Empty (the default) = send the default hot-reload request POST http://127.0.0.1:8090/hotfix?module_name=<module> (body module_name=<module>, both carry it) |
kbengine.hotReload.globs | string[] | unset → derived from kbengine.assetsRoot | Watch patterns (VS Code globs); one file watcher per pattern. Unset derives <assetsRoot>/**/*.py (.py only, never a workspace-wide scan); an explicit empty array watches nothing |
kbengine.hotReload.denylist | string[] | empty | Path denylist (RUST-337): a path prefix matching a file's canonical path excludes it from hot reload (strict prefix + whole-segment boundary, same canonicalization as script roots; deny wins over allow — a file inside a permitted root that also matches a deny entry is denied). Unset = empty (behavior identical to before) |
kbengine.hotReload.pathAllowlist | string[] | empty | Path allowlist (RUST-337): when non-empty, only files under a listed path prefix are hot-reloaded (strict prefix + whole-segment boundary, same canonicalization as script roots; deny wins over allow — a file matching both a deny and an allow entry is denied). Unset = empty (no restriction, behavior identical to before) |
kbengine.hotReload.debounceMs | number | 500 | Debounce milliseconds before triggering; 0 = no debounce |
kbengine.hotReload.triggerMode | string enum | onSave | Trigger source (HR-WATCH-001): onSave = watcher write events drive the reload (editor save / autosave post immediately; unsaved buffer edits never enter the chain) — default; onDiskChange = additionally build a root-scoped native file watcher so external changes / generated files / git checkout also reload (deduped with save events in the same pipeline, never double-sent) |
kbengine.hotReload.notify | string enum | errors | Notification mode (HR-UI-013): silent = no toasts at all for success/failure/summary (the fact still lands in audit/status/history); errors = failures toast, successes silent (default, existing behavior); summary = one batch-result toast per completed batch (successes too, with failure detail). Storm guard = one toast per batch, never one per file |
kbengine.hotReload.stabilityWindowMs | number | 0 | Write-stability window (HR-WATCH-007): after an event, two snapshots must match before the write counts as stable and the file is sent; probes past the cap send the last snapshot flagged unstable honestly. 0 = no stability wait (default timing unchanged); e.g. 200 enables it (ms) |
kbengine.hotReload.syntaxGate | boolean | false | Syntax gate (HR-WATCH-012): settled content passes a full Python syntax check via the interpreter's compile() (compile only, never executes) before sending; content with syntax errors is blocked and consumes no revision. Checker infrastructure failure (missing interpreter / timeout) always passes and logs once — the gate never blocks hot reload because it is broken |
kbengine.hotReload.batchFlushMs | number | 0 | Wave flush window (HR-WATCH-013): files settling in the same window coalesce into one batch at the wave tail (latency adds at most this window after settle). 0 = settle joins the merge pool immediately (default timing); e.g. 300 batches same-window files (prerequisite for the preview threshold, which counts per batch) |
kbengine.hotReload.batchPreviewThreshold | number | 50 | Batch preview threshold (HR-WATCH-016): a wave batch larger than this is held preview-only — nothing sends until 「KBEngine: Release Hot Reload Preview Batch」 (kbengine.hotReload.releasePreview) releases it; batches arriving while held merge into the same hold. 0 = hold every batch |
kbengine.hotReload.sendViaProviders | boolean | false | Send-provider slot (HR-PR-08): when enabled, action-less auto hot reload consults the send-provider registry first (fork-specific implementations answer first, by injection order; duplicate id / apiVersion mismatch registrations are rejected honestly, never silently replaced) and falls back to the default HTTP hotfix face only when nobody answers. Disabled (default) = the face stays out of the chain, send behavior unchanged |
kbengine.hotReload.allowRootLevelStem | boolean | false | Root-level single-file fallback (HR-MOD-008): when the script resource root directly contains Foo.py, the dual-name resolver rejects it by default (reason root-level, book §19.1) and the default hotfix falls back to package-boundary scanning; enabled = explicit fallback to the bare short name (Foo), matching how a file at an engine process root resolves in sys.modules; off (default) keeps zero-config behavior unchanged |
kbengine.hotReload.tempEdit.enabled | boolean | false | Master switch for the temp-edit hot reload command (default off; independent of hotReload.enabled, which is on by default) |
kbengine.hotReload.tempEdit.actionName | string | empty | Quick action fired for the reload step (HTTP or terminal); empty aborts with a config error |
kbengine.hotReload.tempEdit.autoRestore | boolean | true | Restore the original content before sending the reload request; a failed restore aborts the request |
kbengine.hotReload.tempEdit.scriptRoot | string | empty | Script resource root for dual-name resolution (fullModule / requestModule); empty echoes the module name as unresolved, no guessing |
kbengine.hotReload.tempEdit.scriptRoots | string[] | empty | Ordered multi-root priority list for dual-name resolution (lower index wins; a file hitting several roots selects the unique lowest-index root, never guesses; roots absent from the list are never promoted); unset keeps single-root behavior |
Status-bar version numbers (HOT-VER): the status bar stacks a per-file version number on the five watch states — one number (热更: 就绪 v3) = on-disk content matches the verified baseline (synced), a pair (热更: … v2→v3) = baseline → current on-disk version (pending). The version ledger lives inside the hot-reload ledger and is independent of the enabled switch: with watching off, the manual paths (kbengine.hotReload.showFileState, kbengine.hotReload.retryFailed, running a hot-reload action by hand) still show numbers, byte-identical to the watched path for the same file — globs alone decides whether a file is in scope, and the watcher is only the ledger's default event source. Files outside globs show no version number; running kbengine.hotReload.showLog (the 「打开日志」 button in the toggle notice) appends the version ledger (current file, baseline version, disk version, every version jump with time / attempt / digest prefix / accepted-applied-failed outcome) to the 「KBEngine 热更新」 OUTPUT channel. Versions only count disk changes and mark where the baseline is — they never claim a reload took effect.
Behavior rules:
- All three channels trigger: a file's change, creation, and deletion all count as save events; any of them enters debounce.
- Debounce merges: bursts of events between one trigger and the next merge into one execution; turning the switch off during debounce cancels the pending timer.
- Unattended: the trigger path skips the execution confirmation box (even if the action's
confirmistrue); the action's own failures still pop up their errors as usual — that is an execution result, not an interaction confirmation. Executions are still written into the "last run" memory, so the Explorer's top-bar ▶ also points at the most recently triggered action. - No disturbance on missing names: when
actionNameis empty or matches no action, the event still fires but only drops one log line into the OUTPUT channel 「KBEngine 快速执行动作」 (KBEngine quick actions) — no popup, no execution. - Scope defaults to
assetsRoot: withglobsunset the watcher is derived as<assetsRoot>/**/*.py, so only the asset tree is watched. If no validkbengine.assetsRootresolves, the extension reports the problem on the status bar (ready-with-error) with the fix — setkbengine.assetsRoot, or open the workspace as the parent of the asset root — instead of silently watching the whole workspace. - Non-
.pychanges take a side channel: files underassetsRootthat are not.pyare captured but not hot-reloaded (no delivery, no status change); they are logged as unrouted unless a consumer is registered for their extension/path prefix, which can forward them to a Rust parser over the existing LSP$/kode/fileChangednotification. - Config tolerance: wrong types (
enablednot a boolean,globsnot an array,debounceMsnegative or non-numeric) all fall back to defaults, erroring nothing and interrupting nothing; empty strings and non-string items inglobsare pruned. A pruned-to-empty list counts as an explicitly empty one (watch off), while an unset or mistypedglobsderives<assetsRoot>/**/*.py— never a bare workspace-wide pattern.
Runtime Queries
The Runtime Queries panel (kbengine.runtimeQuery.show) queries a running KBEngine over the engine's console protocol: component discovery, a single watcher path query rendered as a table, and space snapshots. Its operation surface — the watcher watch-list (add/remove) and the result subscription stream — is gated off by default against accidental polling against a live server.
| Setting | Type | Default | Purpose |
|---|---|---|---|
kbengine.runtimeQuery.enabled | boolean | false | Master switch for the operation surface (watch-list add/remove and the result stream); off keeps the panel to single manual queries |
kbengine.metrics.fileReadDetail | boolean | false | Record file-read audit detail (path + bytes into a 256-entry ring, viewable via kbengine.metrics.showSummary); off keeps only cumulative read/byte counters (bounded overhead) |
kbengine.metrics.detailed | boolean | false | Per-sample language-service metric recording (one sample per operation, viewable via kbengine.metrics.showSummary); off keeps only cumulative counters (bounded overhead) |
kbengine.runtimeQuery.pollIntervalMs | number | 2000 | Result stream interval in milliseconds; applies only when kbengine.runtimeQuery.enabled is on |
Behavior rules:
- Default off is enforced at the boundary: with
kbengine.runtimeQuery.enabledunset or false, starting the stream reportswatchList: Result stream is off by default; enable kbengine.runtimeQuery.enabled.and issues no query at all — the panel stays on single manual queries. - Watch-list entries are query targets, not engine watchers:
KBEngine.addWatcher/delWatcherare in-process script APIs (kbe/src/lib/pyscript/pywatcher.cpp), not console-protocol messages, so the panel cannot add or remove watchers inside the engine. Adding a path only registers it for the panel's own queries. - Interval floor: values below
500are clamped to500at run time (the schema also declaresminimum: 500), so a mis-typed50polls at 500 ms, not 50 ms. - Empty list is a no-op round: with no watch-list entries a stream round issues no request and does not clear the existing table rows.
- The stream stops with the panel: closing the webview tears the interval down; rounds that resolve after the panel closed are dropped instead of posted back.
Boundary: these are engine runtime console-observation protocol messages, only reachable against a running KBEngine server. End-to-end assertions cannot run in-repo or in CI — see docs/design/space-viewer-watcher.md §8 for the conditions under which a real end-to-end run would be worth reopening.
Dual-Track Backend Gate (kode2 Rust Core)
| Setting | Type | Default | Purpose |
|---|---|---|---|
kbengine.core.backend | string | "rust" | Dual-track backend switch (kill-switch, governing the interactive serving lane): rust = serving track (default since the 2026-11-08 "switch now" directive) — the interactive faces (definition/hover/completion/references/document & workspace symbols/rename/code actions/signature help) serve from kode-server Rust-first with TS fallback on empty/failure; ts = single-track kill-switch fallback — switching back to ts stops the Rust process immediately for a user-invisible rollback of the interactive faces; shadow = shadow comparison — TS keeps serving while textDocument/definition and textDocument/diagnostic requests are mirrored to kode-server and only diff-logged. Any invalid value falls back to ts. Command-level analysis faces (def formatting, def MD5, client SDK generation, trap lint, config derive/resolve, …) are binary-gated, not mode-gated: they use kode-server whenever the binary resolves, in every mode. Under rust the TS-side python index full scan no longer self-starts on activation (first TS-face query lazily triggers it — RUST-TRACK-FREEZE-007), the corpus mirror yields to interaction every 8 files, and mirror generations are single-flight (a restart cuts in-flight runs first; late stale corpus never lands in a new process — KODE-RESP-006). The Core health status-bar light writes this setting too (click the light → switch tracks), and the existing configuration-change chain rebuilds the lane immediately, no window reload. Full per-face matrix: TS or Rust: choosing the backend |
kbengine.core.serverPath | string | empty | kode-server binary path; used by the rust serving track and the shadow comparison. When empty, the extension auto-probes target/{debug,release}/kode-server under the extension root; if discovery fails too, backend=rust falls back to ts (no process spawned) |
kbengine.core.shadow.timeoutMs | number | 2000 | Mirror-request timeout (ms) for shadow comparison; timeouts only log rust-timeout and never affect the TS serving path |
Iron rule: the switch governs the interactive serving lane and is a live kill-switch. With the default rust, the interactive faces (definition/hover/completion/references/document & workspace symbols/rename/code actions/signature help) serve from kode-server Rust-first — TS fallback on empty/failure/2 s interactive budget; diagnostics keep the TS base face and merge Rust supplement diagnostics asynchronously on top (the Python create-params face is Rust-only). With ts, the serving lane exits and the Rust process stops immediately — the interactive behavior rolls back to the pure-TS implementation invisibly (the command-level tool lane keeps consulting the binary whenever it resolves). In shadow mode TS keeps serving while textDocument/definition and textDocument/diagnostic are mirrored for comparison; outcomes go only into the diff log of the 「KBEngine Core Shadow」 output channel (inspect via kbengine.core.showShadowDiffLog) and never affect any user-visible result.
Built-in Kode MCP
| Setting | Type | Default | Purpose |
|---|---|---|---|
kbengine.mcp.enabled | boolean | true | Built-in Kode MCP server definition (VS Code native MCP API, VS Code ≥ 1.101): with the kode-mcp binary present the extension registers one stdio server per workspace folder (command = binary path, args = [assets root]); servers appear in the native MCP servers view by default and the status bar $(plug) Kode MCP item toggles this. Binary missing → no registration (nothing fabricated); older hosts fall back to status-bar-only probing. Enablement details: Kode MCP guide |
kbengine.mcp.transport | string | "stdio" | Kode MCP transport: stdio = one kode-mcp server per workspace folder (default); http = one converged streamable HTTP endpoint per window (127.0.0.1:<httpPort>/mcp, Bearer token). See Kode MCP enablement. |
kbengine.mcp.httpPort | number | 9361 | Fixed loopback port for the HTTP transport; a taken port refuses to start (no drift). 0 = OS-assigned (VS Code-internal only; external agent configs need a stable port). |
kbengine.mcp.httpToken | string | "" | Bearer token for the HTTP transport. When empty the extension generates a 32-byte hex token once and persists it in workspace storage; external agent configs embed it verbatim. |
Protocol Tooling Detection (PA-007)
| Setting | Type | Default | Purpose |
|---|---|---|---|
kbengine.protocol.tsharkPath | string | "tshark" | tshark executable for protocol tooling detection, resolved from PATH; command kbengine.protocol.showStatus renders the status report |
kbengine.protocol.wiresharkPath | string | "wireshark" | Wireshark GUI executable; an absent GUI is reported honestly and analysis still works via tshark/CLI |
kbengine.protocol.cliPath | string | empty | kode-kbengine CLI path override; empty walks the extension-root target/{debug,release} discovery (same shape as kode-server), version via the --version one-line contract |
kbengine.protocol.schemaAutoBuild | boolean | true | auto-rebuild the protocol schema on protocol definition file changes (.def / types.xml / entities.xml / alias.xml inside the resolved asset root); Python files are never watched — command kbengine.protocol.buildSchema builds manually |
Database
| Setting | Type | Default | Purpose |
|---|---|---|---|
kbengine.db.tablePrefix | string | "" (empty = engine default tbl_) | Database table name prefix; replaced in the schema view and SQL templates from the same source |
kbengine.databaseQueryTimeoutMs | number | 10000 | Per-connect/per-query timeout in ms for the read-only database commands (drift check / table preview). A cancellable progress notification shows while running: timeout or cancel returns with that reason and releases the connection (a hung one is force-destroyed); cancelling the notification takes the same return path. 0 or negative disables the deadline (wait indefinitely, manual cancel still works) |
With a custom value (e.g. kb_), table names in the schema view and the three SQL template lines are replaced from the same source:
| Template | Purpose |
|---|---|
SQL: SELECT * FROM ... | All columns (engine structural columns + property columns) |
SQL(属性列): SELECT ... | Lists only the columns landed from def properties, dropping id / sm_autoLoad / parentID / the six position-orientation columns |
SQL(子表 JOIN): ... | ARRAY / component child tables only: joins the parent by parentID; LEFT JOIN keeps property rows of empty elements |
The child-table JOIN also appears in the hover line of ARRAY / component properties. Projects not changing the engine default prefix can leave it empty — behavior is unchanged.
Connection Info of the Database Drift Check
kbengine.database.checkDrift's connection info all comes from the engine config, with no new settings: the composed <dbmgr><databaseInterfaces><default> (engine kbengine_defaults.xml + component kbengine.xml same-key override); port 0 lands on the MySQL default 3306.
The credentials must be stored in plaintext (<encrypt>false</encrypt>). The engine default encrypt=true is RSA ciphertext, which kode does not decrypt; the command then honestly reports 「未校验」 (not verified) — it never asks you to change the engine config or type a password just to run one check. The verification rules and the read-only red line: see Database Drift Check.
Player Data Clone
| Setting | Type | Default | Purpose |
|---|---|---|---|
kbengine.clone.archiveEncryption | "encrypted" | "plain" | "encrypted" | Player-clone archive encryption default. encrypted (default) = exports write chacha20poly1305-encrypted archives, the key stored in this machine's globalStorage clone-keys/ (0600) — move the archive to another machine and you must fetch the key from the original one; plain = exports write plaintext archives (sensitive columns still masked), for archives that must cross machines. This is only the default: the export confirm step can toggle it per run. Per-option trade-offs live in the setting's markdownEnumDescriptions; ops and key handling: see Player Data Clone Ops & Security |
kbengine.clone.probeTimeoutMs | number | 5000 | Independent short deadline in ms for the player-clone export source-connection probe (the "is it reachable right now" check). The probe answers within this budget and fails straight into the existing retry/configure dialog instead of waiting on the export-side long deadline (120s default) — this is the biggest felt hang when the source is unreachable. Export execution (table reads / archive write) keeps its own timeout and is not affected by this setting |
kbengine.clone.defaultEntity | string | "" | Default entity for the Player Clone export (kbengine.clone.export): the entity picker offers a From config: <entity> item up front showing the configured value (one Enter accepts it). Empty (default) = no config item, the picker behaves as before; a configured name that is not in the workspace entity list also yields no config item (kode does not guess entity names). This is only a convenience default: every export can still re-pick |
kbengine.clone.defaultDbId | string | "" | Default root-table DBID for the Player Clone export: the DBID input prompt shows config default: <value> and prefills it (last successful export wins over the config value, matching the entity-memory policy); Enter accepts the config value. Empty (default) = prompt and prefill behave as before. Digits only: the export chain validates the DBID as a positive integer |
AI (opt-in base, AI-001)
| Setting | Type | Default | Purpose |
|---|---|---|---|
kbengine.ai.baseUrl | string | "" | OpenAI-compatible endpoint host (the part before /v1, e.g. https://api.example.com); requests go to {baseUrl}/v1/chat/completions through the extension's own fetch (no new dependencies). Leaving it empty — when the host also has no language model — keeps every AI command unregistered: the feature is fully off with zero activation cost |
kbengine.ai.model | string | "" | Model id to request (e.g. gpt-4o-mini or a local model name); empty = let the server pick its default |
kbengine.ai.temperature | number | 0.2 | Sampling temperature (0–2); OpenAI-compatible route only |
kbengine.ai.maxTokens | number | 1024 | Max tokens per reply; OpenAI-compatible route only |
kbengine.ai.requestTimeoutMs | number | 30000 | Per-request timeout in ms; timed-out requests abort with an error instead of hanging |
kbengine.ai.maxRetries | number | 1 | Retry cap for retryable failures only (HTTP 429/5xx and network errors; 0 disables retry); other 4xx statuses fail immediately |
How the AI face works:
- Opt-in, fully off by default. No AI command exists until
kbengine.ai.baseUrlis configured or the host VS Code exposes a language model (e.g. a Copilot BYOK provider); with both absent, activation registers nothing. - Fallback chain. With
baseUrlset, requests go to the OpenAI-compatible endpoint; without it, the host'svscode.lmLanguage Model API is used (feature-detected at runtime — the extension's engine range predates that API, so it is never hard-required). - API keys never touch settings.json. There is deliberately no key field above: run
kbengine.ai.setApiKey(password input) to store the key in VS Code SecretStorage andkbengine.ai.clearApiKeyto remove it; key-less local endpoints (Ollama/LM Studio style) work without a key. - Timeout, cancellation and retry caps on every request; cancellation propagates from the invoking UI token.
- Zero telemetry, minimal payloads. Nothing is sent anywhere except when you explicitly invoke an AI command, and only that command's needed snippet is included. Chat UI, quick fixes and stub/architecture helpers arrive in later AI batches; none of them exist yet.
Debug Configuration File (.kbengine/debug.json)
This file serves only the debugging flow and quick actions. telnet probing, the telnet panel, status lights, and the telnet tree view never read it.
The file is JSONC, not JSON5: comments are legal (the parser strips them with stripJsonComments), but single quotes, unquoted keys, and trailing commas are not — writing them leaves the entry silently treated as a bad config, same as before. So that comments do not draw red squiggles in stock json mode, kode wires the file into files.associations as jsonc on activation (kbengine.jsoncAssociation, default on, WorkspaceFolder-level .vscode/settings.json): only its own glob key is written, an existing value is never overwritten, and the kbengine.jsoncAssociation.off command reclaims exactly the key kode wrote.
Quick Actions (the quickActions key)
Actions are the top-level quickActions array (not inside the debug section: actions are not debug config); they travel with the KBEngine project, with no new kbengine.* settings.
Editor-side validation: kode ships a JSON Schema for this file with the package (matching .kbengine/debug.json at any subfolder depth); VS Code's JSON extension flags errors while editing — a wrong backend type, telnetPort written as a string, a pathMappings entry missing localRoot/remoteRoot, a method outside the whitelist — all surface before saving instead of at run time. The schema is generated from the parser's own definitions (backend and method enums take the constants of quickActionConfig.ts), byte-identical with the inline object in package.json and locked by tests against drift. Validation is a hint, not a gate: the parser still prunes bad entries one by one, and per-field type fallback rules are unchanged.
| Field | Applicable types | Notes |
|---|---|---|
name | all | Display name, required |
type | all | command / script / http; anything outside the whitelist is pruned whole |
command | command | VS Code command id, required |
args | command | Argument array; string items go through variable substitution, default [] |
script | script | Script path, required, variables supported |
cwd | script | Working directory, variables supported, default the workspace root |
venv | script | Optional { "enabled": true, "path": "${workspaceFolder}/.venv" }; prepends bin (Scripts on Windows) to the child PATH and sets VIRTUAL_ENV; without path, searches each name from kbengine.python.venvDirectories (default .venv / venv / .kbenv) beside the script and under the config root |
background | script | true means server-start types don't wait for the exit code, default false |
url | http | URL, required, variables supported; only the address hard-coded in the config is requested — no runtime concatenation |
method | http | GET / POST / PUT / PATCH / HEAD / OPTIONS, default POST |
body | http | Request body (sent only when non-empty), variables supported |
confirm | all | Modal confirmation before execution, default true |
source | all | manual / scan; entries generated by the first-install scan are automatically recorded scan |
category | all | server / export, written only for scan-generated entries that hit the word list (omitted for word-list outsiders) |
Variables (substituted at run time, applied to config literal strings only):
| Variable | Meaning |
|---|---|
${workspaceFolder} | The effective quick-action config root (normally the first workspace root) |
${workspaceFolder:Name} | The workspace root by view name (multi-root projects) |
${env:VAR_NAME} | A process environment variable |
An unknown variable errors out immediately, naming the variable — a silent empty-string substitution would run the script into a fake success with an "empty path", worse than an error.
Example:
{
"version": "1.0.0",
"quickActions": [
{ "name": "重启 BaseApp", "type": "command",
"command": "kbengine.server.restart", "args": ["baseapp"] },
{ "name": "启动全部组件", "type": "script",
"script": "${workspaceFolder}/start_server.bat", "background": true },
{ "name": "导配置表", "type": "script",
"script": "${workspaceFolder}/export_tables.bat" },
{ "name": "本地热更", "type": "http",
"url": "http://127.0.0.1:9000/reload", "method": "POST", "confirm": false }
]
}The first-install scan checks the effective config root and the top level of assetsRoot for .bat / .ps1, listing all of them for confirmation (the start/stop (start / stop / restart / boot / server) and table-export (export / convert / 导表) vocabulary only assigns a category — hits get server / export, non-hits omit it); after checking, they are written in the ${workspaceFolder}/<filename> variable form (those starting with start / boot automatically get background: true), preserving existing version / debug sections. Use Rescan Scripts for Quick Actions to scan again at any time. Generated script paths and cwd both point to the script's directory; venv is off by default for scanned actions — opt in with "venv": { "enabled": true } or specify a path. A rescan replaces only source: "scan" actions and preserves manual actions and debug settings.
Debug Fields (the debug section)
| Field | Purpose |
|---|---|
debug.defaultTelnetHost / defaultTelnetPort | The telnet address in Start Debugging's instructions (hint only, not part of actual probing) |
debug.components.<Component>.telnetHost / telnetPort | Same as above, overridden per component |
debug.components.<Component>.telnetEnableCommands | The "enable-debugging commands" listed in the instructions, reminding you to first send the project's actual command over telnet |
debug.components.<Component>.debugpyHost / debugpyPort | IDE-PDBG-001: debugpyPort > 0 makes the component attach in port mode — connect straight to debugpyHost:debugpyPort (host defaults to 127.0.0.1), with Start Debugging skipping the telnet briefing. Without it, the mode chosen once applies; in port mode with no explicit port the per-component table (baseapp 5678 / cellapp 5679 / loginapp 5680 / dbmgr 5681 / logger 5682, otherwise 5678) is used. The engine never starts a listener by itself — the embedded Python must reach a debugpy.listen(port) first (kbengine.debug.autoDebugpy injection, kbengine.debug.waitAtStartup bootstrap, or your own code). Every port-mode attach also idempotently writes that component's host:port connect entry into .vscode/launch.json (same name and shape as what Update launch.json generates, user entries preserved), and a port that is still closed offers the three next-step controls 起监听并附加 / 重试附加 / 起监听指引 |
debug.components.<Component>.pathMappings | The path mappings written when Update launch.json generates the attach configuration |
debug.defaultSshHost | IDE-PDBG-004: global connection declaration — which ssh host debug and py-spy dispatch through when a component declares nothing itself ('local' / omitted = local direct execution). Per-component sshHost overrides it |
debug.components.<Component>.sshHost | IDE-PDBG-004: per-component connection declaration — an ssh alias (resolved against ~/.ssh/config for HostName/User/Port/ProxyJump; an alias absent from the config connects by its bare name) routes this component's debug attach through an ssh -N -L tunnel and its py-spy dump over ssh <host> -- …; 'local' / omitted = follow debug.defaultSshHost, the Remote Servers view selection, then local |
Local attach does not take the process id from here: without a configured debugpyPort, Attach to Component lists local processes (matches of the component name pinned with ✓) and assembles the configuration from the selected PID (the mode is asked once and remembered; kbengine.debug.resetAttachMode clears it). Remote attach targets come from the setting kbengine.debug.remoteTargets and never read this file either.
Recommended structure:
{
"version": "1.0.0",
"debug": {
"defaultTelnetHost": "127.0.0.1",
"defaultTelnetPort": 0,
"components": {
"baseapp": {
"telnetHost": "127.0.0.1",
"telnetPort": 0,
"telnetEnableCommands": [
"# 先连接 telnet",
"# 再输入项目实际使用的开启调试命令"
],
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "${workspaceFolder}"
}
]
}
}
}
}Generated When Missing (batch 143)
When .kbengine/debug.json is absent from the workspace, the extension writes an annotated skeleton at activation — you no longer have to create the file first and guess what each field means:
- The skeleton is written as JSONC, so
//and block comments are allowed (same convention astsconfig.json); every field carries a one-line explanation. Kode strips comments before parsing, so comments you write yourself never make the file unreadable. - Path examples always use the
${workspaceFolder}/...form — open and edit. - Scripts found by the existing scan rule (one level of
.bat/.ps1under the working directory; the word list only assigns a category) are written intoquickActions; when nothing matches, the array stays empty. - An existing file is never overwritten: repeated activations and your edits are preserved as-is. If the directory is not writable, the extension says so in the
KBEngine 配置output channel and nothing else is affected.
Working Directory and the Environment Variable
The scaffold location and the .pyi stub directory share one effective working directory, resolved highest priority first:
| Tier | Source | Notes |
|---|---|---|
| 1 | KBENGINE_WORKSPACE environment variable | Supports official VS Code variable substitution, e.g. ${workspaceFolder}/server; the name follows this repo's existing KBENGINE_* style |
| 2 | Top-level workspaceRoot in the config file | Shipped commented out in the skeleton — uncomment to take over |
| 3 | Default | The first workspace folder |
Values go through variable substitution first; a value that expands to an empty string counts as unset and falls through to the next tier. The effective value, its source, and every overridden alternative are written into the skeleton comments and the KBEngine 配置 output channel — no tier is picked silently.
Protocol Tooling Detection (PA-007)
kbengine.protocol.showStatus(命令面板「显示协议工具链状态」)探测本机协议工具链并在「KBEngine Protocol Tooling」输出通道给一份如实状态报告:tshark 版本、Wireshark GUI 版本(未装如实标未检出)、个人/全局插件目录、KBEngine Wireshark 插件(PA-006 交付面)与其落盘版本线和宿主版本线的核对结果(匹配 / 不匹配(宿主不会加载)/ 未知三态),以及 kode-kbengine CLI 的路径与版本。任何一步探测失败都收敛为「未检出」,不报错、不猜测;报告始终提示零 ABI 兜底(未装插件时 kode-kbengine capture analyze 可直接分析 pcap)。
kbengine.protocol.tsharkPath(默认tshark):tshark 可执行名或路径,按 PATH 解析;kbengine.protocol.wiresharkPath(默认wireshark):Wireshark GUI 可执行名或路径;kbengine.protocol.cliPath(默认空):kode-kbengine CLI 覆盖路径;留空走扩展根target/{debug,release}自动发现(与 kode-server 同款,发现落空报告如实标未发现);kbengine.protocol.schemaAutoBuild(默认true):协议定义文件变更时自动重建协议 Schema(kbengine.protocol.buildSchema命令可手动触发同一建图)。资产根解析复用kbengine.assetsRoot配置与既有发现链;输出落扩展 globalStorage 的kbengine-schema.json(CLIschema inspect/diff的输入)。诚实边界:激活不主动起子进程——首次生成发生在首个协议文件事件或手动命令;自动面失败只落输出通道不刷通知;项目根外的协议文件事件不触发(防仓库内 fixture 误触发);CLI 未检出/资产根未检出时如实不建。
Auto-Discovery of Path Settings (batch 125)
Design constraint: minimize settings; whatever can be auto-discovered, auto-discover. The core features (open a .def → entity explorer/dependency graph/property panel/database schema/hover storage info) work in a clean workspace with zero configuration — all five path settings below degrade to "optional override": configured values are honored; unconfigured ones go through the discovery chain.
Discovery chain (first hit wins, in order):
- Explicit config: the setting value of
kbengine.assetsRoot(${workspaceFolder}supported; the retiredkbengine.binPathis still honored as a hidden override); the def-side layouts are no longer settings (computed fromkbengine.assetsRoot, see above); - Conventional paths: fixed engine/official-asset layouts, e.g.
entity_defs,scripts/entity_defs,assets/scripts/entity_defs,server_assets/scripts/entity_defs; - Bounded deep scan: when conventions all miss, scan the workspace for anchors (directory name
entity_defs, file namesentities.xml/types.xml/messages_fixed.xml/messages_fixed_defaults.xml(batch 129 dual names), engine source anchorsentitydef.cpp/entity_table_mysql.cpp), bounded to depth 7 and 20k entries, pruningnode_modules/.git/out/dist/dot-directories; results cached per workspace; - Unique hit wins; multiple candidates never guessed: synchronous read paths accept only a unique hit — with multiple candidates, nothing beats a guess (a guess would rewrite the whole set of interfaces/components/user_type root directories); instead, a quick pick pops once during activation for you to choose, the choice is remembered per workspace (
workspaceState), and you are never asked again.
Sub-paths inferable from existing files never become settings: the def root derives interfaces/, components/, user_type/ subdirectories; types.xml is preferred under the def root; entities.xml is preferred at the def root's parent; messages_fixed(_defaults).xml since batch 129 has four priority levels aligned with the engine loading order (kbemain.h:71-74, defaults load first as the base, the user copy loads after and overrides): workspace user copy messages_fixed.xml → engine source-root user copy → workspace messages_fixed_defaults.xml → engine source-root default; the user copy and the default each live in their own tree (engine comments kbemain.h:133-137: defaults in the engine res tree, the user copy in the assets tree), the four levels are taken independently with no same-directory requirement; an assets-only workspace having both or neither is normal, and having neither is marked informational in the discovery report, not a problem.
Three kinds of purely discovered resources with no settings at all (since batch 125): types.xml, messages_fixed(_defaults).xml, and the engine kbengine_defaults.xml (when binPath cannot derive it, fall back via the engine source-root anchor, then derive).
Full Setting Comparison Table (batch-125 inventory of 32 items; additions and removals since, 173 declared settings as of 2026-11-23 — the new ones are in the feature-area groups of "Overview of kbengine.* Settings (by Feature Area)" above)
How it resolves now = how the value is actually taken today; Auto-discoverable = whether the value can be derived from the workspace/environment; Disposition = this round's conclusion and reasoning.
| Setting | How it resolves now | Auto-discoverable | Disposition |
|---|---|---|---|
kbengine.entityDefsPath | Removed (2026-11-23): computed as {assetsRoot}/scripts/entity_defs | Yes (derivable from assetsRoot) | Removed; fixed engine layout needs no per-directory setting |
kbengine.entitiesXmlPath | Removed (2026-11-23): computed as {assetsRoot}/scripts/entities.xml | Yes | Removed; same reasoning |
kbengine.binPath | Explicit config (authoritative; nonexistent explicit values kept for the launch check chain to report) → default ${workspaceFolder}/kbe/bin/server when it exists on disk (CFG-01) → engine source-root anchor derives kbe/bin/server → sibling-directory/environment-variable guessing; a full miss returns empty and the launch check chain warns | Yes (source-root anchors entitydef.cpp/entity_table_mysql.cpp) | Auto-discover; config serves only as override (2026-11-23: removed from declared settings — kept as a hidden override, behavior unchanged) |
kbengine.generator.defOutputPath | The default value itself uses the discovered def root (resolveDefOutputPath) | Yes (reuses def-root discovery) | Auto-discover; config serves only as override |
kbengine.generator.pythonOutputPath | When the default scripts applies, derived from the discovered def root's parent; derived outside the workspace or empty segments keep the default | Yes (def root's parent) | Auto-discover; config serves only as override |
kbengine.assetsRoot | Explicit config (default empty = auto-discover); since batch 128, when the original value fails the res/server/kbengine.xml probe it auto-discovers: convention chain (workspace root, assets/, server_assets/, and since batch 129 first-level *_assets directories like flyff_assets) → remembered choice → unique deep-scan hit; multi-candidate asks during activation | Yes (validated by the engine-loading probe, done in batch 128) | Auto-discover; config serves only as override; the probe's criterion = the engine's real loading location, eliminating the risk of a wrong guess failing to start |
kbengine.telnet.port | Explicit >0 locks it; 0 = per the component section → engine defaults chain (batch 112) | Yes (config chain, done in batch 112) | Auto-resolve; config serves only as override |
kbengine.telnet.password | Settings → component section → defaults → empty (batch 112) | Yes (same as above) | Auto-resolve; config serves only as override |
kbengine.telnet.configXmlPath | Empty = auto-find kbengine.xml at 3 conventional locations | Yes (already override-style) | Auto-discover; config serves only as override |
kbengine.enableDiagnostics | Switch, default on | No (user preference, not a discoverable fact) | Keep; default-on means zero-config usability |
kbengine.enableStructureDiagnostics | Same as above | No | Keep, same reasoning |
kbengine.diagnostics.checkUnknownTypes | Switch, default on | No | Keep (preference switch; the 5 fine-grained diagnostics likewise) |
kbengine.diagnostics.checkUnknownFlags | Same as above | No | Keep |
kbengine.diagnostics.checkUnknownDetailLevels | Same as above | No | Keep |
kbengine.diagnostics.checkDuplicateDefinitions | Same as above | No | Keep |
kbengine.diagnostics.checkMissingPropertyFields | Same as above | No | Keep |
kbengine.hover.showTagDocs | Switch, default on | No | Keep (preference switch; the 3 fine-grained hovers likewise) |
kbengine.hover.showValueDocs | Same as above | No | Keep |
kbengine.hover.showSymbolDocs | Same as above | No | Keep |
kbengine.showFinalConfigOnOpen | Switch, default off; silently skipped when defaults cannot be located | No | Keep; off by default |
kbengine.autoRefreshFinalConfig | Switch, default on | No | Keep |
kbengine.autoStart | Component name list, default ["machine","logger","dbmgr"] | No (start strategy is a decision, not a fact) | Keep; the default is the official minimal runnable set |
kbengine.loggerPort | Fixed 20022 default; a hidden override still applies (the engine logger allocates its log-listener port at startup — no engine-side 20022) | No (a runtime network port leaves no workspace trace) | Removed (2026-11-23); hidden override kept |
kbengine.logAutoConnect | Switch, default on | No | Keep |
kbengine.webviewConsoleLogs | Switch, default on | No | Keep (page diagnostics should arrive without an extra step) |
kbengine.maxLogEntries | Value 10000 | No | Keep (a memory/history trade-off preference) |
kbengine.debug.remoteTargets | Empty list; remote machine + port | No (remote infrastructure does not exist in the workspace) | Keep; default empty = don't configure if unused |
kbengine.generator.generatePython | Switch, default on | No | Keep |
kbengine.generator.registerInEntitiesXml | Switch, default on | No | Keep |
kbengine.telnet.host | Default 127.0.0.1 | No (entering a remote IP is user knowledge) | Keep; local default works out of the box |
kbengine.telnet.enableCommands | Empty whitelist = only built-in read-only shortcuts are allowed | No (a security policy; the allowance scope is a decision) | Keep; deny-by-default is the security baseline and must not be guessed on the user's behalf |
kbengine.telnet.probeIntervalSeconds | Value 5 | No | Keep (frequency preference) |
kbengine.httpRequests | Default: one disabled example (enabled: false) | No (the user's business endpoints) | Keep; the example is disabled by default and has no side effects |
Counted at the batch-125 inventory: all 32 kept, 0 deleted (deleting entries would break existing user settings — not done). 2026-11-23 update: 6 entries have since been removed — kbengine.entityDefsPath/kbengine.entitiesXmlPath (fixed engine layouts, computed from kbengine.assetsRoot) and kbengine.binPath/kbengine.engineVersion/kbengine.loggerPort/kbengine.console.discoveryHost (engine-derived or localhost-by-design values); each keeps its read as a hidden override, so existing settings.json values keep working; of them, 5 path settings were downgraded from "must configure" to "optional override", 3 telnet/value settings were already override-style, and 21 are preference/security/business switches (whose defaults carry zero-config semantics). Additionally, 3 kinds of purely discovered resources with no settings were added (types.xml, messages_fixed(_defaults).xml, and the engine defaults' source-root fallback). Since batch 126, 12 more settings were added beyond this table (kbengine.db.tablePrefix, 4 × kbengine.hotReload.*, kbengine.clientSdk.outputDir, kbengine.python.extraPathsSync/stubExport/stubDir/stubSourceMode, kbengine.python.enableMroJump, and kbengine.engineVersion), all registered in the grouped overview tables above. Since the 2026-11-11 static-template stub lane, kbengine.python.stubSourceMode and kbengine.python.stubEngineTypings are retired and kbengine.python.proxyInternalAttrHints is added (all three reconciled in the grouped overview tables). Since 2026-11-16, kbengine.python.stubCopy is added as the narrow copy gate for the built-in stub package (see the current default in the grouped overview tables above).
Config Data Protection
Excel-generated config tables/classes (dict bindings and *Config/*Data classes) hold data that only hot-reload entry points are allowed to change. Kode guards them with two faces driven by one whole-workspace scan:
- Accidental-write diagnostics (
kbengine.configDataMutation): every write to a config binding — attribute (x.f = v), subscript (x[k] = v),del, augmented assignment (x += v), and mutator methods (append/pop/update/clear/sort/…) — is flagged unless it sits inside a hot-reload entry function (reload*/hotUpdate*) or amutationExcludewhitelist path. Config-directory files themselves are never flagged. - Schema hover: hovering a config binding or class name shows the literal type text read straight from its definition (schema direct-read, not inference). Member access resolves through the same schema: hovering
hpinConfig.MOBILES[0].hp(module-rooted chain), a dict key insideTABLE["warrior"]["hp"], or a module-level alias (TBL = MOBILES, thenTBL[0].hp) shows the member's direct-read type plus the source binding location. Container method names (.getand friends) never match.
Recognition is settings-driven, not heuristic: config directories (configDirGlobs, default scripts/config/**, scripts/data/config/**, scripts/data/**), config class names (configClassPatterns, default *Config/*Data), hot-reload entries (reloadFunctionPatterns, default reload*/hotUpdate*), and intentional-write exemptions (mutationExclude, default empty). The feature activates only in KBEngine workspaces (entity .def root discovered) and rescans on activation, on Python file open/save (800 ms debounce), and on settings changes. Set kbengine.configData.enabled to false to turn both faces off.
Pointing kode at your own layout: when your tables live outside the default directories or your classes are not named *Config/*Data, extend the settings instead of renaming code:
{
"kbengine.configData": {
"configDirGlobs": ["assets/config_data/**", "scripts/config/**"],
"configClassPatterns": ["*Config", "*Data", "TABLE_*", "Cfg*"]
}
}When the feature is on but the schema comes back empty, hovering a config-class-shaped name shows a notice listing the current configDirGlobs/configClassPatterns, so a directory or pattern miss is visible instead of silent.
Honest boundaries: the scan is line-level (a write statement split across lines is not recognized); consumption sites are matched by binding name without module-path resolution; a module-level rebinding of the same name in the consuming file shadows the config binding from that point on.
Declarative Types for config.getXXX() Managers
A project that reads config through a manager object (config.getXXX(), config[key]) has nothing for static inference to hold on to: the manager looks like a dict, so no member type can be inferred and no completion can be offered. Declare the key set instead of inferring it — kbengine.configData.schemas maps a manager object expression to its table keys, and the declaration becomes the single source of the stub's key set and type text:
{
"kbengine.configData.schemas": {
"config": {
"keys": { "hp": "int", "name": "str", "skills": "list[str]" },
"source": "configs/skills.xlsx"
}
}
}Every key must be a Python identifier and every value a plain annotation text (int, str, list[str], …) — no quotes, newlines or backslashes. source is optional provenance metadata (an Excel table path or a config class name) and is never parsed as a declaration. Malformed entries are skipped one by one, never fatal: one bad declaration cannot blank the whole stub.
Generated stub shape: each declared manager becomes a table class with one @overload per key on get/__getitem__ (key literal + declared type), an object fallback overload, direct attribute annotations and a @dataclass-style class, plus a module-level binding for the manager name — so config.get("hp"), config["hp"] and config.hp all carry the declared type under Pylance/pyright.
Shipment boundary: the setting collects declarations and the stub generator is contract-tested; what is gated is the write face — landing the generated stub into the Pylance stub path happens only after the Pylance crash triage (PYLANCE-CRASH-001) clears the suspicion that kode writes trigger it. Declarations written now are already valid input for that face.
FAQ
Why didn't my settings change take effect immediately?
The extension watches kbengine.* configuration changes and normally applies them instantly. If not refreshed: confirm you changed the current workspace's or the user settings; confirm the currently open file is a .def; in extreme cases close and reopen the file.
Which settings are most worth tuning first?
If hints feel too many, turn these four off first:
{
"kbengine.hover.showTagDocs": false,
"kbengine.diagnostics.checkDuplicateDefinitions": false,
"kbengine.diagnostics.checkUnknownDetailLevels": false,
"kbengine.diagnostics.checkMissingPropertyFields": false
}Debugging Model Notes
KBEngine components are C++ processes with an embedded Python runtime — not something the extension launches as a Python script. Debugging is fixed at two steps:
- First send the project's actual enable-debugging command to the component over telnet (telnet address/port/password confirmed along the three-layer chain in "How the telnet Port/Password Are Read")
- Then attach to the process: local components via
Attach to Component(process list, matches of the component name pinned with ✓); remote components viaAttach to Remote Component(targets fromkbengine.debug.remoteTargets, debugpyconnectmode)
Attach Error Troubleshooting
Check in this order:
- Whether the target component has really enabled debugging over telnet (telnet parameters confirmed along the three-layer chain, unrelated to
.kbengine/debug.json) - Whether the process picked in the list is the target component itself, not a machine/logger helper process
- Whether
telnetEnableCommandsin.kbengine/debug.jsonmatches the project's real command (affects the instructions only) - Whether
pathMappingsin.kbengine/debug.jsonmaps to the current source directory (the remote connect mode writespathMappingsonly when the target entry carries bothlocalRoot/remoteRoot) - Whether
ms-python.debugpyis installed on this machine and VS Code can attach through it normally
The old kbengine.pythonPath, kbengine.debugPort, kbengine.autoAttachDebug have been removed; kbengine.pythonDefsPath, kbengine.enablePythonNavigation have also been removed (navigation goes through the .def definition system — see the entity explorer).
How to Watch Index Progress (WARM-VISIBILITY-004)
The extension indexes entity definitions, Python classes and event calls in the background after activation. Two surfaces show what the indexer is doing:
- Status bar progress — while the warmup pipeline runs you see
KBEngine 后台索引预热in the status bar. Hovering it shows the current stage, and long stages now report intra-stage counters (实体发现链 def 23/87,事件/方法索引 145/612 文件) throttled to at most one update per 500 ms / 10 files, so a minute-long first scan is visibly alive instead of stuck. - Output panel →
KBEngine Index— a unified, always-on log channel for indexer key events: scan start/completion for the discovery chain, the event index and the Python class index, per-chunk Python index progress, disk cache hits/restore, slow-file notices and scan-failure retries. Every line carries a relative timestamp ([+12.3s]) and a source tag (discovery/event-index/python-index/cache/server). Theservertag covers the Rust kode-server helper process itself:spawned/ready/exitlines and restart-loop forensics (crash → auto-restart generations). These lines only appear when the helper process is actually running.
Notes:
- The
KBEngine Indexchannel has no on/off switch: it only carries key facts (a handful of lines per scan), never per-decision debug traffic. Thekbengine.jumpLogsetting still controls the verboseKBEngine Navigationchannel only. - If the status bar never advances and
KBEngine Indexshows no scan-start line, the workspace was likely not detected as a KBEngine project (check the scan-root settings referenced above). - If the workspace contains the KBEngine engine repository itself (for example a parent folder holding the engine repo next to your assets), the engine subtree is excluded from business indexing automatically — detected through the engine tree markers (
kbe/src/lib/common/version.h/kbeversion.h) or thekbengine.engineRootsetting, and reported in the scan-start line (已剔引擎仓子树 N 处). Engine-side corpus flows through its own dedicated channel, so opening the engine repo alone yields an empty business index by design. - Background full scans parse in 4-file chunks and check the interactive cooldown window before each chunk (a fresh user interaction postpones the next chunk by up to 50 ms), so a large first scan stays responsive instead of freezing the UI.