deepseek-coordination 0.1.9 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +351 -1083
- package/README.zh-CN.md +351 -697
- package/cordis.patch.yml +5 -74
- package/lib/client.js +33772 -0
- package/lib/index.d.mts +252 -0
- package/lib/index.mjs +27378 -0
- package/package.json +98 -114
- package/client.js +0 -338
- package/src/host/bin/dsh-os.bat +0 -19
- package/src/host/bin/dsh-os.ps1 +0 -5039
- package/src/host/bin/dsh-os.sh +0 -3385
- package/src/host/bin/dsh-os7.ps1 +0 -5518
- package/src/host/command.txt +0 -136
- package/src/host/docs/command-original.txt +0 -26
- package/src/host/docs/os-spec.md +0 -528
- package/src/host/docs/permission-model.md +0 -206
- package/src/host/spec/charsets.tsv +0 -28
- package/src/host/spec/verbs.tsv +0 -120
- package/src/permission/index.js +0 -546
- package/src/plugin/index.js +0 -226
- package/src/plugin/invoke.js +0 -306
- package/src/plugin/settings.js +0 -349
- package/src/plugin/takeover.js +0 -436
- package/src/plugin/workflow.js +0 -1494
- package/tools/measure-cache.mjs +0 -223
package/lib/index.d.mts
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { Schema } from "@deepseek-ai/schemastery";
|
|
2
|
+
import { Context } from "@deepseek-ai/cordis";
|
|
3
|
+
//#region src/shared/enum.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Enumerations shared by the Host and Client halves.
|
|
6
|
+
*
|
|
7
|
+
* Every union is a closed domain. The Chinese labels and tooltips live next to
|
|
8
|
+
* the English identifiers so the composer controls and the settings page never
|
|
9
|
+
* duplicate copy that the model-facing service also needs.
|
|
10
|
+
*/
|
|
11
|
+
/** A task's single accountable duty. Locked for the duration of one task. */
|
|
12
|
+
type Profession = 'decision' | 'outcome' | 'resource' | 'personnel' | 'qualification' | 'execution';
|
|
13
|
+
/** How the agent organises its response. */
|
|
14
|
+
type Interaction = 'emotion' | 'think' | 'heuristic' | 'converge' | 'orchestrate';
|
|
15
|
+
/** The working scenario (v24: writing sits between dialogue and office). */
|
|
16
|
+
type Scene = 'dialogue' | 'writing' | 'office' | 'research' | 'engineering' | 'iterate';
|
|
17
|
+
/** Evidence and inference depth. */
|
|
18
|
+
type Validation = 'low' | 'medium' | 'high';
|
|
19
|
+
/** The input command face; `none` runs the complete coordination pipeline. */
|
|
20
|
+
type CommandType = 'none' | 'goal' | 'plan' | 'feedback' | 'compact' | 'permission';
|
|
21
|
+
/**
|
|
22
|
+
* Per-scene execution policy (v24 §19). One table shared by the config
|
|
23
|
+
* defaults, the plan pipeline, and the UI copy, so a scene is never described
|
|
24
|
+
* in one place and enforced in another.
|
|
25
|
+
*/
|
|
26
|
+
interface SceneProfile {
|
|
27
|
+
thinking: 'enabled' | 'disabled';
|
|
28
|
+
reasoningEffort: string;
|
|
29
|
+
requirePlan: boolean;
|
|
30
|
+
requireScore: boolean;
|
|
31
|
+
requireOutline: boolean;
|
|
32
|
+
requireRevision: boolean;
|
|
33
|
+
requirePredict: boolean;
|
|
34
|
+
requireCitation: boolean;
|
|
35
|
+
allowBash: boolean;
|
|
36
|
+
allowWeb: boolean;
|
|
37
|
+
sandboxOnly: boolean;
|
|
38
|
+
maxIteration: number;
|
|
39
|
+
scoreThreshold: number;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/host/config.d.ts
|
|
43
|
+
interface ProfessionConfig {
|
|
44
|
+
/** Forced true by the resolver; kept for schema compatibility. */
|
|
45
|
+
enabled: boolean;
|
|
46
|
+
/** Forced true by the resolver: the lock is a core safety constraint. */
|
|
47
|
+
lock: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Documented alias of `defaults.profession`. `resolveConfig()` mirrors the
|
|
50
|
+
* effective default here so neither key is dead; new deployments should set
|
|
51
|
+
* `defaults.profession`.
|
|
52
|
+
*/
|
|
53
|
+
default: Profession;
|
|
54
|
+
/** Forced true by the resolver: a rebuild always creates a new task. */
|
|
55
|
+
rebuildCanReselect: boolean;
|
|
56
|
+
/** Forced true by the resolver: the next task may choose a new profession. */
|
|
57
|
+
abandonCanReselect: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Reserved: the profession module always appends its lock/rebuild/abandon
|
|
60
|
+
* events to `orchestration_trace`, so this flag does not gate anything yet.
|
|
61
|
+
* Kept for schema compatibility until a trace-audit policy actually exists.
|
|
62
|
+
*/
|
|
63
|
+
audit: boolean;
|
|
64
|
+
/** Whether lock rejections carry the rebuild/abandon escape hatch. */
|
|
65
|
+
errorHint: boolean;
|
|
66
|
+
}
|
|
67
|
+
interface PlanWeights {
|
|
68
|
+
feasibility: number;
|
|
69
|
+
coverage: number;
|
|
70
|
+
clarity: number;
|
|
71
|
+
specificity: number;
|
|
72
|
+
alignment: number;
|
|
73
|
+
risk: number;
|
|
74
|
+
cost: number;
|
|
75
|
+
efficiency: number;
|
|
76
|
+
}
|
|
77
|
+
interface PlanDimensionThreshold {
|
|
78
|
+
feasibility: number;
|
|
79
|
+
coverage: number;
|
|
80
|
+
clarity: number;
|
|
81
|
+
specificity: number;
|
|
82
|
+
alignment: number;
|
|
83
|
+
risk: number;
|
|
84
|
+
cost: number;
|
|
85
|
+
efficiency: number;
|
|
86
|
+
}
|
|
87
|
+
interface PlanConfig {
|
|
88
|
+
threshold: number;
|
|
89
|
+
maxRebuild: number;
|
|
90
|
+
weights: PlanWeights;
|
|
91
|
+
dimensions: PlanDimensionThreshold;
|
|
92
|
+
}
|
|
93
|
+
interface OrchestrationConfig {
|
|
94
|
+
maxReject: number;
|
|
95
|
+
maxSubTask: number;
|
|
96
|
+
groundTruth: boolean;
|
|
97
|
+
groundTruthTimeout: number;
|
|
98
|
+
allowShellGroundTruth: boolean;
|
|
99
|
+
modelRouting: boolean;
|
|
100
|
+
}
|
|
101
|
+
interface CacheConfig {
|
|
102
|
+
enabled: boolean;
|
|
103
|
+
ttl: number;
|
|
104
|
+
fingerprintWindow: number;
|
|
105
|
+
effortWarning: boolean;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Automatic token-governor policy (v24 §5/§9.3, `src/host/token.ts`).
|
|
109
|
+
*
|
|
110
|
+
* This group is deliberately distinct from the `compact` table and the
|
|
111
|
+
* `compact` command: those record an explicit, user-requested compaction,
|
|
112
|
+
* while these thresholds tune when the governor *proposes* one. `auto: false`
|
|
113
|
+
* disables only the automatic proposal; an explicit compact command still
|
|
114
|
+
* runs. `soft`/`hard` are utilisation ratios against the effective window
|
|
115
|
+
* (`contextWindow - reserve`), `cooldown` and `maxPerSession` bound how often
|
|
116
|
+
* the host adapter may act on a proposal.
|
|
117
|
+
*/
|
|
118
|
+
interface CompactionPolicyConfig {
|
|
119
|
+
auto: boolean;
|
|
120
|
+
soft: number;
|
|
121
|
+
hard: number;
|
|
122
|
+
reserve: number;
|
|
123
|
+
recentTurns: number;
|
|
124
|
+
cooldown: number;
|
|
125
|
+
maxPerSession: number;
|
|
126
|
+
}
|
|
127
|
+
interface BayesianConfig {
|
|
128
|
+
prior: number;
|
|
129
|
+
stopEntropy: number;
|
|
130
|
+
infoGain: number;
|
|
131
|
+
maxRoutes: number;
|
|
132
|
+
calibrationFloor: number;
|
|
133
|
+
}
|
|
134
|
+
interface ComprehensionConfig {
|
|
135
|
+
stageTimeout: number;
|
|
136
|
+
searchEnabled: boolean;
|
|
137
|
+
maxEvidence: number;
|
|
138
|
+
highHistoryWindow: number;
|
|
139
|
+
}
|
|
140
|
+
interface UiConfig {
|
|
141
|
+
/**
|
|
142
|
+
* @deprecated Legacy alias of the composer workflow flag. It is projected as
|
|
143
|
+
* `SelectionStateConfig.workflow` and kept so the schema stays compatible;
|
|
144
|
+
* new deployments should not build a setting around it.
|
|
145
|
+
*/
|
|
146
|
+
toolbar: boolean;
|
|
147
|
+
showTooltip: boolean;
|
|
148
|
+
takeover: boolean;
|
|
149
|
+
refreshInterval: number;
|
|
150
|
+
compact: boolean;
|
|
151
|
+
/** 'auto' follows the DSH locale; zh-CN/en-US force the host-side copy. */
|
|
152
|
+
locale: string;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* File-processing policy (v24 `docs/file-processing-v24.md` §4, domain model §7).
|
|
156
|
+
*
|
|
157
|
+
* The values are the documented hard caps: 1 MiB of source text, 200 000
|
|
158
|
+
* tokens, AST depth 256, a 2 s parse budget, a 256-entry parse cache and the
|
|
159
|
+
* 20 000 / 100 000 dependency-graph bounds. They live in the schema so a
|
|
160
|
+
* deployment can tighten them in one place.
|
|
161
|
+
*
|
|
162
|
+
* Consumers and timing (`src/host/tools.ts`): `enabled` gates the four file
|
|
163
|
+
* tools at registration time and is re-checked live (a disabled parser makes the
|
|
164
|
+
* registered tools fail closed); every limit is re-applied to the lazy
|
|
165
|
+
* `ToolRuntime` when the config signature changes, so a `/config` patch reaches
|
|
166
|
+
* the next tool call instead of waiting for a restart. `maxAstDepth` is threaded
|
|
167
|
+
* into the parser's `maxDepth` and the two dependency-graph caps bound
|
|
168
|
+
* `ParseService.dependencyGraph`; all three are clamped to the parser-layer hard
|
|
169
|
+
* caps. The settings catalog still marks those three keys `planned`; that is a
|
|
170
|
+
* catalog flag, not a missing consumer.
|
|
171
|
+
*/
|
|
172
|
+
interface ParserConfig {
|
|
173
|
+
/** Master switch for the file tools; read at registration and on every call. */
|
|
174
|
+
enabled: boolean;
|
|
175
|
+
/** Maximum source text in bytes; the parser truncates and marks `truncated`. */
|
|
176
|
+
maxFileBytes: number;
|
|
177
|
+
/** Maximum tokens emitted by one parse. */
|
|
178
|
+
maxTokens: number;
|
|
179
|
+
/** AST depth handed to the parser (`maxDepth`), capped to `MAX_AST_DEPTH`. */
|
|
180
|
+
maxAstDepth: number;
|
|
181
|
+
/** Parse wall-clock budget in milliseconds. */
|
|
182
|
+
timeoutMs: number;
|
|
183
|
+
/** Parse-result cache capacity in files. */
|
|
184
|
+
cacheCapacity: number;
|
|
185
|
+
/** Dependency-graph vertex cap, capped to the parser layer's hard cap. */
|
|
186
|
+
dependencyGraphMaxVertices: number;
|
|
187
|
+
/** Dependency-graph edge cap, capped to the parser layer's hard cap. */
|
|
188
|
+
dependencyGraphMaxEdges: number;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Chain-projection budget (domain model §3, §7): depth ≤ 8, links ≤ 50,
|
|
192
|
+
* ~1 500 tokens.
|
|
193
|
+
*
|
|
194
|
+
* `src/host/tools.ts` re-applies all three to the lazy `ToolRuntime` whenever the
|
|
195
|
+
* file-layer config signature changes, so a live `/config` patch reaches the
|
|
196
|
+
* next query while indexed handles stay valid (`ChainEngine.retune`).
|
|
197
|
+
*/
|
|
198
|
+
interface ChainConfig {
|
|
199
|
+
depth: number;
|
|
200
|
+
links: number;
|
|
201
|
+
tokenBudget: number;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Model-facing tool output budget. `0` means "no byte cap" (the historical
|
|
205
|
+
* unbounded `renderJson`); a positive value makes `renderJson` emit a valid JSON
|
|
206
|
+
* truncation envelope with an explicit marker and byte counts. The value is read
|
|
207
|
+
* per render, not captured at registration, so a live `/config` change applies
|
|
208
|
+
* to the very next tool result.
|
|
209
|
+
*/
|
|
210
|
+
interface ToolConfig {
|
|
211
|
+
maxResultBytes: number;
|
|
212
|
+
}
|
|
213
|
+
interface CoordinationConfig {
|
|
214
|
+
database: string;
|
|
215
|
+
databasePath: string;
|
|
216
|
+
maxTurnPerSession: number;
|
|
217
|
+
defaultLease: number;
|
|
218
|
+
clarifyTimeout: number;
|
|
219
|
+
profession: ProfessionConfig;
|
|
220
|
+
plan: PlanConfig;
|
|
221
|
+
orchestration: OrchestrationConfig;
|
|
222
|
+
cache: CacheConfig;
|
|
223
|
+
/** Automatic token-governor thresholds; distinct from the `compact` tables. */
|
|
224
|
+
compaction: CompactionPolicyConfig;
|
|
225
|
+
bayesian: BayesianConfig;
|
|
226
|
+
comprehension: ComprehensionConfig;
|
|
227
|
+
ui: UiConfig;
|
|
228
|
+
/** v24 file-processing policy (`docs/file-processing-v24.md` §4). */
|
|
229
|
+
parser: ParserConfig;
|
|
230
|
+
/** Chain-projection budget (domain model §3); applied live by `ToolRuntime`. */
|
|
231
|
+
chain: ChainConfig;
|
|
232
|
+
/** Model-facing tool output budget; `0` keeps the unbounded render. */
|
|
233
|
+
tools: ToolConfig;
|
|
234
|
+
/** v24 §19: per-scene execution policy. */
|
|
235
|
+
scenes: Record<Scene, SceneProfile>;
|
|
236
|
+
/** Defaults used when the composer sends no explicit selection. */
|
|
237
|
+
defaults: {
|
|
238
|
+
profession: Profession;
|
|
239
|
+
interaction: Interaction;
|
|
240
|
+
scene: Scene;
|
|
241
|
+
validation: Validation;
|
|
242
|
+
command: CommandType;
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
declare const Config: Schema<CoordinationConfig>;
|
|
246
|
+
//#endregion
|
|
247
|
+
//#region src/index.d.ts
|
|
248
|
+
declare const name = "deepseek-coordination";
|
|
249
|
+
declare const inject: string[];
|
|
250
|
+
declare function apply(context: Context, configInput?: Partial<CoordinationConfig>): void;
|
|
251
|
+
//#endregion
|
|
252
|
+
export { Config, apply, inject, name };
|