The rebase resolution annotated both hoisted descriptors and the local in resolveKimiHooksTomlDir as ConfigHomeDescriptor. #2755 used DotHomeDescriptor there deliberately: the union permits xdg / dot-home-nested / generic-agents-root shapes, so the broader annotation drops the compile-time guarantee that this resolver selects a dot-home descriptor and nothing else. Runtime behaviour was already correct — all eleven paths resolve identically — so this restores a type-level property, not a behavioural one. Both exported constants are now pinned to DotHomeDescriptor as well, which is stricter than the ConfigHomeDescriptor they carried since round 3; the interface stays unexported and NON_REGISTRY_CONFIG_HOME_DESCRIPTORS keeps its ConfigHomeDescriptor[] type, which the narrower constants satisfy as subtypes. Found by the pre-push adversarial review of this round, which is the one claim of six it refuted.
This commit is contained in:
@@ -491,7 +491,7 @@ export function resolveKimiGlobalDir(opts: ResolveKimiOpts = {}): string {
|
|||||||
* homes: KIMI_CONFIG_DIR (registry-visible, already covered) and KIMI_SHARE_DIR
|
* homes: KIMI_CONFIG_DIR (registry-visible, already covered) and KIMI_SHARE_DIR
|
||||||
* (this one), so a derivation keyed only on the registry looks complete and is not.
|
* (this one), so a derivation keyed only on the registry looks complete and is not.
|
||||||
*/
|
*/
|
||||||
export const KIMI_HOOKS_TOML_DESCRIPTOR: ConfigHomeDescriptor = {
|
export const KIMI_HOOKS_TOML_DESCRIPTOR: DotHomeDescriptor = {
|
||||||
kind: 'dot-home',
|
kind: 'dot-home',
|
||||||
name: '.kimi',
|
name: '.kimi',
|
||||||
env: ['KIMI_SHARE_DIR'],
|
env: ['KIMI_SHARE_DIR'],
|
||||||
@@ -509,7 +509,7 @@ export const KIMI_HOOKS_TOML_DESCRIPTOR: ConfigHomeDescriptor = {
|
|||||||
* commit, which is the property NON_REGISTRY_CONFIG_HOME_DESCRIPTORS exists to
|
* commit, which is the property NON_REGISTRY_CONFIG_HOME_DESCRIPTORS exists to
|
||||||
* guarantee. Each product's env var stays scoped to that product (#2755).
|
* guarantee. Each product's env var stays scoped to that product (#2755).
|
||||||
*/
|
*/
|
||||||
export const KIMI_CODE_HOOKS_TOML_DESCRIPTOR: ConfigHomeDescriptor = {
|
export const KIMI_CODE_HOOKS_TOML_DESCRIPTOR: DotHomeDescriptor = {
|
||||||
kind: 'dot-home',
|
kind: 'dot-home',
|
||||||
name: '.kimi-code',
|
name: '.kimi-code',
|
||||||
env: ['KIMI_CODE_HOME'],
|
env: ['KIMI_CODE_HOME'],
|
||||||
@@ -586,7 +586,7 @@ export function resolveKimiHooksTomlDir(opts: ResolveKimiHooksTomlOpts = {}): st
|
|||||||
// Explicit comparison rather than an object lookup keyed on `runtime`: the
|
// Explicit comparison rather than an object lookup keyed on `runtime`: the
|
||||||
// value originates from argv, and an index would resolve inherited keys
|
// value originates from argv, and an index would resolve inherited keys
|
||||||
// (`constructor`, `__proto__`) to something that is not a descriptor.
|
// (`constructor`, `__proto__`) to something that is not a descriptor.
|
||||||
const descriptor: ConfigHomeDescriptor = opts.runtime === 'kimi-code'
|
const descriptor: DotHomeDescriptor = opts.runtime === 'kimi-code'
|
||||||
? KIMI_CODE_HOOKS_TOML_DESCRIPTOR
|
? KIMI_CODE_HOOKS_TOML_DESCRIPTOR
|
||||||
: KIMI_HOOKS_TOML_DESCRIPTOR;
|
: KIMI_HOOKS_TOML_DESCRIPTOR;
|
||||||
return resolveConfigHomeFromDescriptor(descriptor, { env, home });
|
return resolveConfigHomeFromDescriptor(descriptor, { env, home });
|
||||||
|
|||||||
Reference in New Issue
Block a user