dsh-cwtools 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +104 -2
- package/cordis.patch.yml +4 -0
- package/icon.svg +7 -0
- package/lib/client.js +1305 -0
- package/lib/index.js +592 -0
- package/lib/types/client/CwtoolsSection.d.ts +10 -0
- package/lib/types/client/CwtoolsSectionIcon.d.ts +8 -0
- package/lib/types/client/cwtools-controller.d.ts +84 -0
- package/lib/types/client/index.d.ts +27 -0
- package/lib/types/client/locales.d.ts +25 -0
- package/lib/types/config.d.ts +31 -0
- package/lib/types/contract/configTypes.d.ts +50 -0
- package/lib/types/contract/toolCatalog.d.ts +19 -0
- package/lib/types/host/activeBackend.d.ts +8 -0
- package/lib/types/host/contracts.d.ts +22 -0
- package/lib/types/host/errors.d.ts +9 -0
- package/lib/types/host/nativeTools.d.ts +4 -0
- package/lib/types/host/prompt.d.ts +1 -0
- package/lib/types/host/results.d.ts +7 -0
- package/lib/types/host/runtime.d.ts +22 -0
- package/lib/types/index.d.ts +12 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +118 -3
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client';
|
|
2
|
+
import type { SnapshotStore } from '@deepseek-ai/dsh-client-store';
|
|
3
|
+
import { type SettingsFieldState, type SettingsFormActions, type SettingsFormShell } from '@deepseek-ai/dsh-client-ui-primitives';
|
|
4
|
+
import type { CwtoolsConfig } from '../contract/configTypes.ts';
|
|
5
|
+
import { type CwtoolsReadGroup, type CwtoolsReadToolName } from '../contract/toolCatalog.ts';
|
|
6
|
+
/** Settings namespace of the Host entry this section edits. */
|
|
7
|
+
export declare const CWTOOLS_SETTINGS_NAMESPACE = "cwtools";
|
|
8
|
+
/** Configuration block a leaf belongs to. */
|
|
9
|
+
type CwtoolsBlock = 'enabled' | 'backend' | 'diagnostics' | 'readGroups' | 'readTools' | 'writeTools' | 'output';
|
|
10
|
+
/** One leaf field of the section, addressed inside the Host document. */
|
|
11
|
+
export interface CwtoolsFieldRef {
|
|
12
|
+
/** Dotted path inside the namespace section. */
|
|
13
|
+
field: string;
|
|
14
|
+
/** Configuration block the leaf belongs to. */
|
|
15
|
+
block: CwtoolsBlock;
|
|
16
|
+
}
|
|
17
|
+
/** A value the Host holds for one field after a save it did not accept. */
|
|
18
|
+
export interface CwtoolsAcceptedValue {
|
|
19
|
+
/** Dotted path of the field. */
|
|
20
|
+
field: string;
|
|
21
|
+
/** The value the Host kept, rendered as that field's draft text. */
|
|
22
|
+
text: string;
|
|
23
|
+
}
|
|
24
|
+
/** What the section renders: shared form state plus this entry's fields. */
|
|
25
|
+
export interface CwtoolsSectionState extends SettingsFormShell {
|
|
26
|
+
/** Every control's draft text and validity, keyed by dotted path. */
|
|
27
|
+
fields: Record<string, SettingsFieldState>;
|
|
28
|
+
/** Effective on-state of each read group. */
|
|
29
|
+
groups: Record<CwtoolsReadGroup, boolean>;
|
|
30
|
+
/** Effective on-state of each tool: its own grant AND its group's. */
|
|
31
|
+
tools: Record<CwtoolsReadToolName, boolean>;
|
|
32
|
+
/** Whether the refused save lost a revision race with an edit made elsewhere. */
|
|
33
|
+
conflict: boolean;
|
|
34
|
+
/** Values the Host still holds after a refused save; empty otherwise. */
|
|
35
|
+
accepted: readonly CwtoolsAcceptedValue[];
|
|
36
|
+
}
|
|
37
|
+
/** Actions and observable state the slot renderer binds. */
|
|
38
|
+
export interface CwtoolsSectionFace extends SettingsFormActions {
|
|
39
|
+
hooks: {
|
|
40
|
+
cwtoolsSection: SnapshotStore<CwtoolsSectionState>;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Stage one switch.
|
|
44
|
+
* @param field - dotted path of the switch.
|
|
45
|
+
* @param next - the value the user asked for.
|
|
46
|
+
*/
|
|
47
|
+
toggle: (field: string, next: boolean) => void;
|
|
48
|
+
}
|
|
49
|
+
/** The three values the Host accepts for the localisation diagnostic filter. */
|
|
50
|
+
export declare const CWTOOLS_LOCALISATION_FILTERS: readonly ["off", "problems", "all"];
|
|
51
|
+
/** Every control on the page, in rendering order. */
|
|
52
|
+
export declare const CWTOOLS_FIELDS: readonly CwtoolsFieldRef[];
|
|
53
|
+
/**
|
|
54
|
+
* Bind the whole CWTools section to one staged form.
|
|
55
|
+
*
|
|
56
|
+
* Every control is staged; a save writes the staged edits together; leaving the
|
|
57
|
+
* page drops them. A refused save keeps its drafts, reports the values the Host
|
|
58
|
+
* still holds, and says whether the document moved underneath.
|
|
59
|
+
*/
|
|
60
|
+
export declare class CwtoolsSettingsController {
|
|
61
|
+
private readonly scope;
|
|
62
|
+
private readonly form;
|
|
63
|
+
private readonly store;
|
|
64
|
+
/** @param form - the shared configuration form of the `cwtools` entry. */
|
|
65
|
+
constructor(form: ConfigForm<CwtoolsConfig>);
|
|
66
|
+
/**
|
|
67
|
+
* Bind the section to the slot renderer.
|
|
68
|
+
* @returns the section snapshot and its staged actions.
|
|
69
|
+
*/
|
|
70
|
+
inject(): CwtoolsSectionFace;
|
|
71
|
+
/** Release the accepted-value subscription and the flattened view. */
|
|
72
|
+
dispose(): void;
|
|
73
|
+
/** Rebuild everything the component renders from the current reads and drafts. */
|
|
74
|
+
private project;
|
|
75
|
+
/** Whether the refused write lost a revision race rather than failing validation. */
|
|
76
|
+
private conflict;
|
|
77
|
+
/**
|
|
78
|
+
* The values the Host still holds for the fields the refused save tried to
|
|
79
|
+
* write. Read from the accepted section, never from the draft, so the notice
|
|
80
|
+
* shows what a reload would restore.
|
|
81
|
+
*/
|
|
82
|
+
private acceptedValues;
|
|
83
|
+
}
|
|
84
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CWTools settings partition, browser half.
|
|
3
|
+
*
|
|
4
|
+
* The section edits the `cwtools` Host entry through the shared `configForms`
|
|
5
|
+
* service. It owns no permission state of its own: the read groups, the tool
|
|
6
|
+
* grants, the single write this release ships, and every backend bound are the
|
|
7
|
+
* same document the Host validates and the same values the tool surfaces read.
|
|
8
|
+
* The page therefore appears only while the Host actually serves that entry.
|
|
9
|
+
*/
|
|
10
|
+
import type { Context as ClientContext } from '@deepseek-ai/cordis';
|
|
11
|
+
import { type CwtoolsLocaleKey } from './locales.ts';
|
|
12
|
+
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
13
|
+
interface LocaleNamespaceMap {
|
|
14
|
+
/** CWTools settings section copy. */
|
|
15
|
+
'settings.cwtools': CwtoolsLocaleKey;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export type { CwtoolsLocaleKey } from './locales.ts';
|
|
19
|
+
export type { CwtoolsSectionProps } from './CwtoolsSection.tsx';
|
|
20
|
+
export type { CwtoolsAcceptedValue, CwtoolsFieldRef, CwtoolsSectionFace, CwtoolsSectionState, } from './cwtools-controller.ts';
|
|
21
|
+
/** Required services (cordis fiber inject). */
|
|
22
|
+
export declare const inject: string[];
|
|
23
|
+
/**
|
|
24
|
+
* Mount the settings section while the Host serves the `cwtools` entry.
|
|
25
|
+
* @param ctx - the browser plugin context.
|
|
26
|
+
*/
|
|
27
|
+
export declare function apply(ctx: ClientContext): void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copy for the CWTools settings section.
|
|
3
|
+
*
|
|
4
|
+
* Section, group, field, and form-frame text lives here. Tool names, field
|
|
5
|
+
* paths, and configuration keys stay verbatim from the frozen contract and are
|
|
6
|
+
* never translated.
|
|
7
|
+
*/
|
|
8
|
+
/** Every key this section renders. */
|
|
9
|
+
export type CwtoolsLocaleKey = 'nav' | 'title' | 'intro' | 'sectionProject' | 'sectionBackend' | 'sectionReadAccess' | 'sectionDiagnostics' | 'sectionWriteAccess' | 'sectionOutput' | 'tabProject' | 'tabBackend' | 'tabRead' | 'tabOutput' | 'enabled' | 'enabledHint' | 'serverPath' | 'serverPathHint' | 'gamePath' | 'gamePathHint' | 'rulesPath' | 'rulesPathHint' | 'cachePath' | 'cachePathHint' | 'activeManifestPath' | 'activeManifestPathHint' | 'preferActiveBackend' | 'preferActiveBackendHint' | 'game' | 'gameHint' | 'forceStart' | 'forceStartHint' | 'debug' | 'debugHint' | 'startupTimeoutMs' | 'startupTimeoutMsHint' | 'requestTimeoutMs' | 'requestTimeoutMsHint' | 'idleShutdownMs' | 'idleShutdownMsHint' | 'maxWorkspaceRuntimes' | 'maxWorkspaceRuntimesHint' | 'maxResultChars' | 'maxResultCharsHint' | 'writeLocalisation' | 'writeLocalisationHint' | 'writePolicyNote' | 'groupProject' | 'groupLocalisation' | 'groupSemantic' | 'groupNavigation' | 'groupDiagnostics' | 'groupShader' | 'groupDisabledNote' | 'readAccessIntro' | 'ignoreCodes' | 'ignoreCodesHint' | 'ignoreFiles' | 'ignoreFilesHint' | 'localisationFilter' | 'localisationFilterHint' | 'localisationFilterOff' | 'localisationFilterProblems' | 'localisationFilterAll' | 'overridden' | 'reset' | 'invalidNumber' | 'readOnly' | 'unavailable' | 'save' | 'saving' | 'saveFailed' | 'failedTitle' | 'acceptedValue' | 'retryHint' | 'conflictNotice' | 'emptyValue' | 'on' | 'off';
|
|
10
|
+
/** English copy. */
|
|
11
|
+
export declare const en: Record<CwtoolsLocaleKey, string>;
|
|
12
|
+
/** Simplified Chinese copy, checked against the English keys. */
|
|
13
|
+
export declare const zh: Record<CwtoolsLocaleKey, string>;
|
|
14
|
+
/**
|
|
15
|
+
* The shared settings frame's copy, read from this section's dictionary.
|
|
16
|
+
* @param t - the section's locale reader.
|
|
17
|
+
* @returns the labels the shared form frame renders.
|
|
18
|
+
*/
|
|
19
|
+
export declare function formLabels(t: (key: CwtoolsLocaleKey) => string): {
|
|
20
|
+
unavailable: string;
|
|
21
|
+
readOnly: string;
|
|
22
|
+
saveFailed: string;
|
|
23
|
+
save: string;
|
|
24
|
+
saving: string;
|
|
25
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Volatile } from '@deepseek-ai/cordis';
|
|
2
|
+
import z from '@deepseek-ai/schemastery';
|
|
3
|
+
import type { CwtoolsBackendConfig, CwtoolsConfig, CwtoolsConfigInput, CwtoolsDiagnosticsConfig } from './contract/configTypes.ts';
|
|
4
|
+
import { type CwtoolsReadGroup, type CwtoolsReadToolName, type CwtoolsWriteToolName } from './contract/toolCatalog.ts';
|
|
5
|
+
/** Plain, unwrapped values the runtime consumes. */
|
|
6
|
+
export type Config = CwtoolsConfig;
|
|
7
|
+
/**
|
|
8
|
+
* Host-provided live surface: the Host passes every editable section as a
|
|
9
|
+
* volatile reference, so a saved settings change reaches the running instance
|
|
10
|
+
* without remounting it. Sections without a volatile reference never appear in
|
|
11
|
+
* the Host settings page at all.
|
|
12
|
+
*/
|
|
13
|
+
export interface CwtoolsLiveConfig {
|
|
14
|
+
enabled: Volatile<boolean>;
|
|
15
|
+
readGroups: Volatile<Record<CwtoolsReadGroup, boolean>>;
|
|
16
|
+
readTools: Volatile<Partial<Record<CwtoolsReadToolName, boolean>>>;
|
|
17
|
+
writeTools: Volatile<Partial<Record<CwtoolsWriteToolName, boolean>>>;
|
|
18
|
+
backend: Volatile<CwtoolsBackendConfig>;
|
|
19
|
+
diagnostics: Volatile<CwtoolsDiagnosticsConfig>;
|
|
20
|
+
output: Volatile<{
|
|
21
|
+
maxResultChars: number;
|
|
22
|
+
}>;
|
|
23
|
+
}
|
|
24
|
+
export declare const Config: z<CwtoolsConfigInput, CwtoolsLiveConfig>;
|
|
25
|
+
/** Read every live section once so one operation sees one consistent configuration.
|
|
26
|
+
* @param config - the Host-provided live configuration.
|
|
27
|
+
* @returns plain values for the runtime, tools and their snapshots.
|
|
28
|
+
*/
|
|
29
|
+
export declare function snapshotConfig(config: CwtoolsLiveConfig): Config;
|
|
30
|
+
export declare function isReadToolEnabled(config: Config, name: CwtoolsReadToolName): boolean;
|
|
31
|
+
export declare function isWriteLocalisationEnabled(config: Config): boolean;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { CwtoolsReadGroup, CwtoolsReadToolName, CwtoolsWriteToolName } from './toolCatalog.ts';
|
|
2
|
+
export interface CwtoolsBackendConfig {
|
|
3
|
+
serverPath: string;
|
|
4
|
+
gamePath: string;
|
|
5
|
+
rulesPath: string;
|
|
6
|
+
cachePath: string;
|
|
7
|
+
game: string;
|
|
8
|
+
forceStart: boolean;
|
|
9
|
+
startupTimeoutMs: number;
|
|
10
|
+
requestTimeoutMs: number;
|
|
11
|
+
idleShutdownMs: number;
|
|
12
|
+
maxWorkspaceRuntimes: number;
|
|
13
|
+
preferActiveBackend: boolean;
|
|
14
|
+
activeManifestPath: string;
|
|
15
|
+
debug: boolean;
|
|
16
|
+
}
|
|
17
|
+
/** How localisation diagnostics are filtered, mirroring the server's `errors.localisationFilter`. */
|
|
18
|
+
export type CwtoolsLocalisationFilter = 'off' | 'problems' | 'all';
|
|
19
|
+
/** Diagnostic noise controls forwarded to the backend. */
|
|
20
|
+
export interface CwtoolsDiagnosticsConfig {
|
|
21
|
+
/** Error codes (or message fragments) the backend never reports. */
|
|
22
|
+
ignoreCodes: string[];
|
|
23
|
+
/** File names whose diagnostics are dropped. */
|
|
24
|
+
ignoreFiles: string[];
|
|
25
|
+
/** Localisation diagnostic filter mode. */
|
|
26
|
+
localisationFilter: CwtoolsLocalisationFilter;
|
|
27
|
+
}
|
|
28
|
+
export interface CwtoolsConfig {
|
|
29
|
+
enabled: boolean;
|
|
30
|
+
readGroups: Record<CwtoolsReadGroup, boolean>;
|
|
31
|
+
readTools: Partial<Record<CwtoolsReadToolName, boolean>>;
|
|
32
|
+
writeTools: Partial<Record<CwtoolsWriteToolName, boolean>>;
|
|
33
|
+
backend: CwtoolsBackendConfig;
|
|
34
|
+
diagnostics: CwtoolsDiagnosticsConfig;
|
|
35
|
+
output: {
|
|
36
|
+
maxResultChars: number;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/** User/config-layer input before Schemastery fills defaults. */
|
|
40
|
+
export interface CwtoolsConfigInput {
|
|
41
|
+
enabled?: boolean;
|
|
42
|
+
readGroups?: Partial<Record<CwtoolsReadGroup, boolean>>;
|
|
43
|
+
readTools?: Partial<Record<CwtoolsReadToolName, boolean>>;
|
|
44
|
+
writeTools?: Partial<Record<CwtoolsWriteToolName, boolean>>;
|
|
45
|
+
backend?: Partial<CwtoolsBackendConfig>;
|
|
46
|
+
diagnostics?: Partial<CwtoolsDiagnosticsConfig>;
|
|
47
|
+
output?: {
|
|
48
|
+
maxResultChars?: number;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const CWTOOLS_READ_TOOL_GROUPS: {
|
|
2
|
+
readonly project: readonly ["query_project_profile", "query_project_knowledge", "query_workspace_index", "explore_pdx_project", "analyze_pdx_flow", "query_inline_instantiation", "compare_definition_with_vanilla"];
|
|
3
|
+
readonly localisation: readonly ["query_localisation_index"];
|
|
4
|
+
readonly semantic: readonly ["query_types", "query_rules", "query_cwt_schema", "search_rule_capabilities", "explain_scope", "parse_pdx_fragment", "query_scope", "query_scripted_effects", "query_scripted_triggers", "query_enums", "query_static_modifiers", "query_variables", "get_entity_info", "get_pdx_block", "query_targeting_weight"];
|
|
5
|
+
readonly navigation: readonly ["get_completion_at", "document_symbols", "workspace_symbols", "go_to_definition", "find_references"];
|
|
6
|
+
readonly diagnostics: readonly ["get_diagnostics", "analyze_diagnostic_error"];
|
|
7
|
+
readonly shader: readonly ["query_shader_symbol", "query_shader_compile_unit", "query_shader_platform_variants", "query_shader_callers", "explain_shader_reachability", "validate_shader", "compare_shader_with_vanilla"];
|
|
8
|
+
};
|
|
9
|
+
export type CwtoolsReadGroup = keyof typeof CWTOOLS_READ_TOOL_GROUPS;
|
|
10
|
+
export type CwtoolsReadToolName = typeof CWTOOLS_READ_TOOL_GROUPS[CwtoolsReadGroup][number];
|
|
11
|
+
export declare const CWTOOLS_READ_GROUP_ORDER: readonly CwtoolsReadGroup[];
|
|
12
|
+
export declare const CWTOOLS_READ_TOOL_NAMES: readonly CwtoolsReadToolName[];
|
|
13
|
+
export declare const CWTOOLS_WRITE_TOOL_NAMES: readonly ["write_localisation"];
|
|
14
|
+
export type CwtoolsWriteToolName = typeof CWTOOLS_WRITE_TOOL_NAMES[number];
|
|
15
|
+
export declare const CWTOOLS_FIRST_RELEASE_TOOL_NAMES: readonly string[];
|
|
16
|
+
export declare const CWTOOLS_STELLARIS_ONLY_TOOLS: ReadonlySet<string>;
|
|
17
|
+
export declare function isCwtoolsReadToolName(name: string): name is CwtoolsReadToolName;
|
|
18
|
+
export declare function isCwtoolsWriteToolName(name: string): name is CwtoolsWriteToolName;
|
|
19
|
+
export declare function cwtoolsReadGroupFor(name: CwtoolsReadToolName): CwtoolsReadGroup;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type LspHost } from 'cwtools-node';
|
|
2
|
+
import type { Config } from '../config.ts';
|
|
3
|
+
export interface ActiveBackend {
|
|
4
|
+
lspHost: LspHost;
|
|
5
|
+
readyAtMs?: number;
|
|
6
|
+
}
|
|
7
|
+
/** Resolve a healthy active host only for the exact current mod root. */
|
|
8
|
+
export declare function resolveActiveBackend(config: Config, workspaceRoot: string, signal: AbortSignal): Promise<ActiveBackend | undefined>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { HostServices, SharedToolResult } from 'cwtools-shared';
|
|
2
|
+
export interface CwtoolsExecutionContext {
|
|
3
|
+
signal?: AbortSignal;
|
|
4
|
+
}
|
|
5
|
+
export type CwtoolsToolCallHandler = (name: string, args?: Record<string, unknown>, context?: CwtoolsExecutionContext) => Promise<SharedToolResult>;
|
|
6
|
+
export interface CwtoolsNodeHostOptions {
|
|
7
|
+
workspaceRoot: string;
|
|
8
|
+
game?: string;
|
|
9
|
+
serverPath?: string;
|
|
10
|
+
gamePath?: string;
|
|
11
|
+
cachePath?: string;
|
|
12
|
+
rulesPath?: string;
|
|
13
|
+
enableWrites: boolean;
|
|
14
|
+
allowedTools: string[];
|
|
15
|
+
forceStart: boolean;
|
|
16
|
+
startupTimeoutMs?: number;
|
|
17
|
+
requestTimeoutMs?: number;
|
|
18
|
+
lspHost?: HostServices['lsp'];
|
|
19
|
+
readyAtMs?: number;
|
|
20
|
+
debug?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export type CwtoolsNodeHostFactory = (options: CwtoolsNodeHostOptions) => HostServices;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare class CwtoolsToolError extends Error {
|
|
2
|
+
readonly code: string;
|
|
3
|
+
readonly nextSteps: readonly string[];
|
|
4
|
+
readonly name = "CwtoolsToolError";
|
|
5
|
+
constructor(code: string, message: string, nextSteps?: readonly string[]);
|
|
6
|
+
}
|
|
7
|
+
export declare function abortError(reason?: unknown): Error;
|
|
8
|
+
export declare function throwIfAborted(signal: AbortSignal | undefined): void;
|
|
9
|
+
export declare function awaitWithAbort<T>(promise: Promise<T>, signal: AbortSignal | undefined): Promise<T>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { Config } from '../config.ts';
|
|
3
|
+
import type { CwtoolsRuntimePool } from './runtime.ts';
|
|
4
|
+
export declare function registerNativeCwtoolsTools(ctx: Context, config: Config, runtime: CwtoolsRuntimePool): () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CWTOOLS_SYSTEM_PROMPT = "CWTools provides native semantic and explicitly allowed domain-write tools for Paradox mods. Ground claims about the mod in these tools rather than memory: PDX identifiers and syntax are easy to hallucinate.\n\nWhen working in a Paradox mod:\n- Start structural and dependency questions with explore_pdx_project.\n- Verify game IDs with query_types and the appropriate scripted effect/trigger, enum, modifier, or variable query before using them.\n- Check trigger/effect/scope/modifier syntax with query_rules and query_scope; check block and entity schemas with query_cwt_schema before writing.\n- Navigate with go_to_definition/find_references/document_symbols/workspace_symbols and use get_pdx_block for structured blocks.\n- Respect readiness and freshness. A loading result or an empty result while readiness.ready is false is not authoritative; retry after loading.\n- Respect vanillaCache provenance. When vanilla is unavailable, results are mod-only and vanilla references may produce incomplete answers or false errors.\n- Review get_diagnostics before declaring code correct. After an allowed write, re-check fresh diagnostics.\n- Only whitelisted domain writes may be used, and only when enabled by the user. Never treat a denied write as completed.";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ToolDefinition } from '@deepseek-ai/dsh-tools';
|
|
2
|
+
import type { SharedToolResult } from 'cwtools-shared';
|
|
3
|
+
import { CwtoolsToolError } from './errors.ts';
|
|
4
|
+
export declare function normalizeSuccessfulResult(result: SharedToolResult): SharedToolResult;
|
|
5
|
+
export declare function errorFromSharedResult(result: SharedToolResult): CwtoolsToolError;
|
|
6
|
+
export declare function renderCwtoolsResult(value: unknown, maxResultChars: number): string;
|
|
7
|
+
export declare const SUCCESS_OUTPUT_SCHEMA: ToolDefinition['output']['schema'];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type SharedToolResult } from 'cwtools-shared';
|
|
2
|
+
import type { Config } from '../config.ts';
|
|
3
|
+
export declare class CwtoolsRuntimePool {
|
|
4
|
+
private readonly config;
|
|
5
|
+
private readonly entries;
|
|
6
|
+
private readonly pendingEntries;
|
|
7
|
+
private disposed;
|
|
8
|
+
constructor(config: Config);
|
|
9
|
+
get workspaceCount(): number;
|
|
10
|
+
canExpose(name: string, workspaceRoot: string): boolean;
|
|
11
|
+
exposureReason(name: string, workspaceRoot: string): string | undefined;
|
|
12
|
+
execute(name: string, args: Record<string, unknown>, workspaceRoot: string, signal: AbortSignal): Promise<SharedToolResult>;
|
|
13
|
+
dispose(): void;
|
|
14
|
+
private resolveProject;
|
|
15
|
+
private entryFor;
|
|
16
|
+
private createEntry;
|
|
17
|
+
private enforceCapacity;
|
|
18
|
+
private serial;
|
|
19
|
+
private clearIdle;
|
|
20
|
+
private scheduleIdle;
|
|
21
|
+
private disposeEntry;
|
|
22
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import { type CwtoolsLiveConfig } from './config.ts';
|
|
3
|
+
export { Config } from './config.ts';
|
|
4
|
+
export declare const name = "cwtools";
|
|
5
|
+
export declare const inject: string[];
|
|
6
|
+
/** Register native CWTools tools and own every runtime resource in one effect.
|
|
7
|
+
* A settings save commits volatile values into this running instance, so the
|
|
8
|
+
* resources that capture them are rebuilt instead of waiting for a restart.
|
|
9
|
+
* @param ctx - the Host plugin context.
|
|
10
|
+
* @param config - the live configuration sections this entry owns.
|
|
11
|
+
*/
|
|
12
|
+
export declare function apply(ctx: Context, config: CwtoolsLiveConfig): void;
|
package/locale/en.json
ADDED
package/locale/zh.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,121 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-cwtools",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Native DeepSeek Harness tools and settings for CWTools Paradox modding",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "lib/index.js",
|
|
8
|
+
"types": "lib/types/index.d.ts",
|
|
9
|
+
"packageManager": "pnpm@11.24.0",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./lib/types/index.d.ts",
|
|
13
|
+
"default": "./lib/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./client": {
|
|
16
|
+
"types": "./lib/types/client/index.d.ts",
|
|
17
|
+
"default": "./lib/client.js"
|
|
18
|
+
},
|
|
19
|
+
"./locale/*.json": "./locale/*.json",
|
|
20
|
+
"./icon": "./icon.svg",
|
|
21
|
+
"./package.json": "./package.json"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"lib/index.js",
|
|
25
|
+
"lib/client.js",
|
|
26
|
+
"lib/types/**/*.d.ts",
|
|
27
|
+
"cordis.patch.yml",
|
|
28
|
+
"locale/*.json",
|
|
29
|
+
"icon.svg",
|
|
30
|
+
"README.md",
|
|
31
|
+
"LICENSE"
|
|
32
|
+
],
|
|
33
|
+
"dsh": {
|
|
34
|
+
"bundle": { "patch": "./cordis.patch.yml" },
|
|
35
|
+
"client": {
|
|
36
|
+
"platform": "web",
|
|
37
|
+
"inject": [
|
|
38
|
+
"@deepseek-ai/dsh-client-locale",
|
|
39
|
+
"@deepseek-ai/dsh-client-ui-settings",
|
|
40
|
+
"@deepseek-ai/dsh-client-ui-settings-general"
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "pnpm run typecheck && pnpm run build:types && tsdown",
|
|
46
|
+
"build:types": "tsc -p tsconfig.build.json",
|
|
47
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
48
|
+
"test": "vitest run",
|
|
49
|
+
"test:host": "vitest run tests/host",
|
|
50
|
+
"test:client": "vitest run tests/client",
|
|
51
|
+
"prepack": "pnpm run build",
|
|
52
|
+
"prepare": "tsdown"
|
|
53
|
+
},
|
|
54
|
+
"engines": {
|
|
55
|
+
"node": ">=24.9.0",
|
|
56
|
+
"dsh": ">=0.2.2-rc.1 <0.3.0"
|
|
57
|
+
},
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"@deepseek-ai/schemastery": "^3.19.0",
|
|
60
|
+
"cwtools-node": "0.2.0",
|
|
61
|
+
"cwtools-shared": "0.3.0"
|
|
62
|
+
},
|
|
63
|
+
"peerDependencies": {
|
|
64
|
+
"@deepseek-ai/cordis": "^4.1.0",
|
|
65
|
+
"@deepseek-ai/dsh-system-prompt": ">=0.2.2-rc.1 <0.3.0",
|
|
66
|
+
"@deepseek-ai/dsh-tools": ">=0.2.2-rc.1 <0.3.0",
|
|
67
|
+
"@deepseek-ai/dsh-working-directory": ">=0.2.2-rc.1 <0.3.0"
|
|
68
|
+
},
|
|
69
|
+
"devDependencies": {
|
|
70
|
+
"@deepseek-ai/cordis": "^4.1.0",
|
|
71
|
+
"@deepseek-ai/cordis-plugin-loader": "^1.1.0",
|
|
72
|
+
"@deepseek-ai/dsh-api-remotes": ">=0.2.2-rc.1 <0.3.0",
|
|
73
|
+
"@deepseek-ai/dsh-client-locale": ">=0.2.2-rc.1 <0.3.0",
|
|
74
|
+
"@deepseek-ai/dsh-client-store": ">=0.2.2-rc.1 <0.3.0",
|
|
75
|
+
"@deepseek-ai/dsh-client-ui-primitives": ">=0.2.2-rc.1 <0.3.0",
|
|
76
|
+
"@deepseek-ai/dsh-client-ui-renderer": ">=0.2.2-rc.1 <0.3.0",
|
|
77
|
+
"@deepseek-ai/dsh-client-ui-settings": ">=0.2.2-rc.1 <0.3.0",
|
|
78
|
+
"@deepseek-ai/dsh-client-ui-settings-general": ">=0.2.2-rc.1 <0.3.0",
|
|
79
|
+
"@deepseek-ai/dsh-client-ui-slots": ">=0.2.2-rc.1 <0.3.0",
|
|
80
|
+
"@deepseek-ai/dsh-system-prompt": ">=0.2.2-rc.1 <0.3.0",
|
|
81
|
+
"@deepseek-ai/dsh-tools": ">=0.2.2-rc.1 <0.3.0",
|
|
82
|
+
"@deepseek-ai/dsh-util-code-language": "0.1.7-rc.2",
|
|
83
|
+
"@deepseek-ai/dsh-util-workspace-path": "0.1.2-alpha.2",
|
|
84
|
+
"@deepseek-ai/dsh-working-directory": ">=0.2.2-rc.1 <0.3.0",
|
|
85
|
+
"@shikijs/langs": "^4.6.0",
|
|
86
|
+
"@testing-library/react": "^16.3.0",
|
|
87
|
+
"@types/mdast": "^4.0.4",
|
|
88
|
+
"@types/node": "^24.0.0",
|
|
89
|
+
"@types/react": "^18.3.0",
|
|
90
|
+
"@types/react-dom": "^18.3.0",
|
|
91
|
+
"anser": "^2.3.5",
|
|
92
|
+
"clsx": "^2.1.1",
|
|
93
|
+
"diff": "^9.0.0",
|
|
94
|
+
"immer": "^10.2.0",
|
|
95
|
+
"jsdom": "^26.1.0",
|
|
96
|
+
"katex": "^0.19.1",
|
|
97
|
+
"lightningcss": "^1.30.0",
|
|
98
|
+
"mdast-util-from-markdown": "^2.1.0",
|
|
99
|
+
"mdast-util-gfm": "^3.1.0",
|
|
100
|
+
"mdast-util-math": "^3.0.0",
|
|
101
|
+
"micromark-core-commonmark": "^2.0.4",
|
|
102
|
+
"micromark-extension-gfm": "^3.0.0",
|
|
103
|
+
"micromark-extension-math": "^3.1.0",
|
|
104
|
+
"micromark-factory-space": "^2.1.0",
|
|
105
|
+
"micromark-util-character": "^2.1.1",
|
|
106
|
+
"micromark-util-classify-character": "^2.0.1",
|
|
107
|
+
"micromark-util-decode-string": "^2.0.1",
|
|
108
|
+
"micromark-util-sanitize-uri": "^2.0.1",
|
|
109
|
+
"micromark-util-symbol": "^2.0.1",
|
|
110
|
+
"micromark-util-types": "^2.0.3",
|
|
111
|
+
"playwright-core": "^1.56.0",
|
|
112
|
+
"react": "^18.2.0",
|
|
113
|
+
"react-dom": "^18.2.0",
|
|
114
|
+
"shiki": "^4.6.0",
|
|
115
|
+
"simple-icons": "^16.37.0",
|
|
116
|
+
"tsdown": "^0.22.2",
|
|
117
|
+
"typescript": "^5.8.3",
|
|
118
|
+
"vitest": "^4.0.0",
|
|
119
|
+
"zustand": "~4.5.7"
|
|
120
|
+
}
|
|
6
121
|
}
|