fix(sdk): address remaining tooling review findings

This commit is contained in:
imccyu
2026-07-15 23:08:06 +08:00
parent d8f6251e3a
commit 394706fa3c
12 changed files with 236 additions and 52 deletions
@@ -55,7 +55,15 @@ export function createBuiltinRegistry(profile: ProjectProfile): FeatureRegistry
label: 'Sandboxed executor',
resources: [
{ kind: 'npm-cordis-config-entry', id: 'sandbox', package: '@deepseek-ai/dsh-sandbox-local' },
{ kind: 'npm-cordis-config-entry', id: 'bash', package: '@deepseek-ai/dsh-bash-sandbox' },
{
kind: 'npm-cordis-config-entry',
id: 'bash',
package: '@deepseek-ai/dsh-bash-sandbox',
commentedExample: `Uncomment to allow writes under the project workspace.
config:
mode: workspace-write
workspaceRoot: !!js process.cwd()`,
},
],
},
],
@@ -31,6 +31,7 @@ interface NpmCordisConfigEntrySpec {
package: string
config?: Readonly<Record<string, unknown>>
ownedConfigKeys?: readonly string[]
commentedExample?: string
}
/** Relative or absolute file Cordis config entry with no NPM dependency. */
@@ -40,6 +41,7 @@ interface FileCordisConfigEntrySpec {
path: string
config?: Readonly<Record<string, unknown>>
ownedConfigKeys?: readonly string[]
commentedExample?: string
}
/** Static complete file owned by one feature option. */
@@ -147,6 +149,7 @@ function resourcesFromSpec(spec: FeatureResourceSpec): ProjectResource[] {
...config ? { config } : {},
},
ownedConfigKeys: spec.ownedConfigKeys ?? Object.keys(config ?? {}),
...spec.commentedExample ? { commentedExample: spec.commentedExample } : {},
...validateConfig ? { validateConfig } : {},
},
]
@@ -31,6 +31,7 @@ export interface CordisConfigEntryResource {
key: ResourceKey
entry: CordisConfigEntry
ownedConfigKeys: readonly string[]
commentedExample?: string
validateConfig?: (config: Readonly<Record<string, unknown>>) => readonly string[]
}