dsh-coding 0.0.0-stage → 0.1.1-rc1
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 +91 -2
- package/cordis.patch.yml +233 -0
- package/docs/DETAIL.md +183 -0
- package/docs/DEVELOPMENT.md +189 -0
- package/icon.svg +6 -0
- package/lib/apply-patch.js +268 -0
- package/lib/client/capsule.js +120 -0
- package/lib/client/card.js +220 -0
- package/lib/client/command-row.js +76 -0
- package/lib/client/config-page.js +392 -0
- package/lib/client/definition.js +164 -0
- package/lib/client/index.js +129 -0
- package/lib/client/locales.js +156 -0
- package/lib/client/mode-picker.js +77 -0
- package/lib/client/styles.js +283 -0
- package/lib/client.js +1691 -0
- package/lib/coding-projection.js +349 -0
- package/lib/config.js +204 -0
- package/lib/contract.js +124 -0
- package/lib/editor.js +23 -0
- package/lib/failures.js +142 -0
- package/lib/handoff.js +312 -0
- package/lib/index.js +115 -0
- package/lib/language.js +136 -0
- package/lib/messages.js +43 -0
- package/lib/models.js +154 -0
- package/lib/patch.js +235 -0
- package/lib/preset.js +1488 -0
- package/lib/reasoning-levels.js +28 -0
- package/lib/reasoning-projection.js +178 -0
- package/lib/reasoning.js +585 -0
- package/lib/stages.js +306 -0
- package/lib/state.js +550 -0
- package/lib/system-language.js +56 -0
- package/lib/types/apply-patch.d.ts +13 -0
- package/lib/types/client/capsule.d.ts +9 -0
- package/lib/types/client/card.d.ts +72 -0
- package/lib/types/client/command-row.d.ts +42 -0
- package/lib/types/client/config-page.d.ts +136 -0
- package/lib/types/client/definition.d.ts +51 -0
- package/lib/types/client/index.d.ts +10 -0
- package/lib/types/client/locales.d.ts +18 -0
- package/lib/types/client/mode-picker.d.ts +25 -0
- package/lib/types/client/styles.d.ts +28 -0
- package/lib/types/coding-projection.d.ts +116 -0
- package/lib/types/config.d.ts +193 -0
- package/lib/types/contract.d.ts +33 -0
- package/lib/types/editor.d.ts +9 -0
- package/lib/types/failures.d.ts +62 -0
- package/lib/types/handoff.d.ts +112 -0
- package/lib/types/index.d.ts +144 -0
- package/lib/types/language.d.ts +56 -0
- package/lib/types/messages.d.ts +27 -0
- package/lib/types/models.d.ts +82 -0
- package/lib/types/patch.d.ts +37 -0
- package/lib/types/preset.d.ts +22 -0
- package/lib/types/reasoning-levels.d.ts +20 -0
- package/lib/types/reasoning-projection.d.ts +64 -0
- package/lib/types/reasoning.d.ts +141 -0
- package/lib/types/stages.d.ts +164 -0
- package/lib/types/state.d.ts +261 -0
- package/lib/types/system-language.d.ts +10 -0
- package/lib/types/verification-tool.d.ts +32 -0
- package/lib/types/verification.d.ts +77 -0
- package/lib/types/verifier.d.ts +9 -0
- package/lib/types/volatile.d.ts +17 -0
- package/lib/verification-tool.js +176 -0
- package/lib/verification.js +337 -0
- package/lib/verifier.js +25 -0
- package/lib/volatile.js +20 -0
- package/locale/en.json +7 -0
- package/locale/zh.json +7 -0
- package/package.json +129 -3
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { CODING_PROJECTION_KEY, type CodingStageView, type CodingVerificationView } from '../coding-projection.js';
|
|
2
|
+
import { REASONING_PROJECTION_KEY, type ReasoningProjectionState } from '../reasoning-projection.js';
|
|
3
|
+
import { type ReasoningLevel } from '../reasoning-levels.js';
|
|
4
|
+
import { type CodingMode, type CodingStage } from '../stages.js';
|
|
5
|
+
import type { CodingKey } from './locales.js';
|
|
6
|
+
/** Props the turn-tail slot hands this card. */
|
|
7
|
+
export interface CodingCardProps {
|
|
8
|
+
/** Host-computed projection value for this session. */
|
|
9
|
+
readonly useProjection: (key: typeof CODING_PROJECTION_KEY | typeof REASONING_PROJECTION_KEY) => unknown;
|
|
10
|
+
/** Owner props: `TurnLocation` (`{ kind, turn }`) or a plain number. */
|
|
11
|
+
readonly turn?: unknown;
|
|
12
|
+
/** Injected by this plugin's registration: run one `/coding …` line. */
|
|
13
|
+
readonly execute?: (line: string) => unknown;
|
|
14
|
+
/** Injected by this plugin's registration: the configured reasoning policy. */
|
|
15
|
+
readonly settings?: () => unknown;
|
|
16
|
+
readonly t: (key: CodingKey) => string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The state one card renders: the live projection for the newest closed Turn,
|
|
20
|
+
* or the frozen snapshot that Turn ran under. Pure, so the split between a
|
|
21
|
+
* control card and a history card is testable without React.
|
|
22
|
+
* @param view - current projection value.
|
|
23
|
+
* @param turn - Turn the card belongs to, when the owner declares one.
|
|
24
|
+
* @returns the values rendered, plus whether this card may switch the mode.
|
|
25
|
+
*/
|
|
26
|
+
export declare function cardState(view: CodingStageView, turn: number | undefined): {
|
|
27
|
+
live: boolean;
|
|
28
|
+
mode: CodingMode;
|
|
29
|
+
stage: CodingStage;
|
|
30
|
+
verification: CodingVerificationView | null;
|
|
31
|
+
allowed: readonly CodingStage[];
|
|
32
|
+
planItems: number;
|
|
33
|
+
openPlanItems: number;
|
|
34
|
+
edits: number;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* The command line one mode switch sends back through the Host. A card sits at
|
|
38
|
+
* a closed turn's tail, and switching mode is a control action, not a prompt:
|
|
39
|
+
* the silent `set` verb applies the mode and tool table without starting a
|
|
40
|
+
* Turn, so the model never answers a button press. Typed `/coding <mode>` keeps
|
|
41
|
+
* its "switch and open a turn" meaning.
|
|
42
|
+
*/
|
|
43
|
+
export declare function commandFor(mode: CodingMode): string;
|
|
44
|
+
/** Verification text for one card. */
|
|
45
|
+
/**
|
|
46
|
+
* The card's verification cell: status only, never the command. The command
|
|
47
|
+
* still rides the capsule tooltip and the `run_verification` result, where a
|
|
48
|
+
* reader can act on it; the 12px card row stays scannable.
|
|
49
|
+
* @param verification - recorded outcome, or null before the first run.
|
|
50
|
+
* @param t - locale lookup.
|
|
51
|
+
* @returns the label and the color class that carries its meaning.
|
|
52
|
+
*/
|
|
53
|
+
export declare function verificationText(verification: CodingVerificationView | null, t: (key: CodingKey) => string): {
|
|
54
|
+
text: string;
|
|
55
|
+
className: string;
|
|
56
|
+
};
|
|
57
|
+
/** One card's reasoning cell, derived from the durable projection. */
|
|
58
|
+
export interface ReasoningDisplay {
|
|
59
|
+
readonly level: ReasoningLevel | null;
|
|
60
|
+
readonly source: 'settings' | 'override' | 'pick' | 'auto' | 'pending';
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The reasoning row one card renders. A closed turn keeps the state frozen at
|
|
64
|
+
* its own `turn/end`, so history cards never borrow a later turn's level; an
|
|
65
|
+
* unknown history turn stays pending instead of copying the live state.
|
|
66
|
+
* @param state - durable reasoning projection, when the Host serves it.
|
|
67
|
+
* @param turn - Turn the card belongs to.
|
|
68
|
+
* @param settings - configured policy: `auto`, or a pinned level.
|
|
69
|
+
*/
|
|
70
|
+
export declare function reasoningDisplay(state: ReasoningProjectionState | undefined, turn: number | undefined, settings: unknown): ReasoningDisplay;
|
|
71
|
+
/** The per-turn Coding control card. */
|
|
72
|
+
export declare const CodingTurnCard: import("react").NamedExoticComponent<CodingCardProps>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** The `CommandNode` fields this row reads (owner props pass the whole node). */
|
|
2
|
+
export interface CodingCommandNode {
|
|
3
|
+
readonly name?: string | null;
|
|
4
|
+
readonly args?: string | null;
|
|
5
|
+
readonly outcome?: {
|
|
6
|
+
readonly kind: string;
|
|
7
|
+
readonly text?: string;
|
|
8
|
+
} | null;
|
|
9
|
+
}
|
|
10
|
+
/** What one command receipt renders. */
|
|
11
|
+
export interface CodingCommandRowView {
|
|
12
|
+
/** Whether this command leaves no trace in the transcript at all. */
|
|
13
|
+
readonly hidden: boolean;
|
|
14
|
+
/** The command line as the user typed it. */
|
|
15
|
+
readonly line: string;
|
|
16
|
+
/** The receipt text, or null when there is nothing to say. */
|
|
17
|
+
readonly text: string | null;
|
|
18
|
+
/** Whether the receipt is an error. */
|
|
19
|
+
readonly failed: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Decide what one command receipt renders. Pure, so the hiding rule — the whole
|
|
23
|
+
* point of this module — is testable without a renderer.
|
|
24
|
+
* @param node - the `CommandNode` the Chat owner passes down.
|
|
25
|
+
* @returns the visible/absent split for this receipt.
|
|
26
|
+
*/
|
|
27
|
+
export declare function commandRowOf(node: CodingCommandNode): CodingCommandRowView;
|
|
28
|
+
/**
|
|
29
|
+
* Whether a commands Remote result is a command-level failure.
|
|
30
|
+
*
|
|
31
|
+
* Two shapes mean failure: the Remote itself failed (`{ ok: false }`), or the
|
|
32
|
+
* Remote succeeded while the command handler rejected the line
|
|
33
|
+
* (`{ ok: true, value: { result: { kind: 'error' } } }`). Only the first used to
|
|
34
|
+
* be checked, so a rejected switch looked like a success.
|
|
35
|
+
* @param result - whatever `remote.commands.execute()` returned.
|
|
36
|
+
* @returns true when the command did not apply.
|
|
37
|
+
*/
|
|
38
|
+
export declare function commandRejected(result: unknown): boolean;
|
|
39
|
+
/** One `/coding` command receipt, or nothing for a mode switch. */
|
|
40
|
+
export declare const CodingCommandRow: import("react").NamedExoticComponent<{
|
|
41
|
+
readonly node: CodingCommandNode;
|
|
42
|
+
}>;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { CodingKey } from './locales.js';
|
|
3
|
+
/** Settings namespace key: the bundle row id. */
|
|
4
|
+
export declare const SETTINGS_NAMESPACE = "dsh-coding";
|
|
5
|
+
/** Modes this page offers, matching the Host's `defaultMode` enum. */
|
|
6
|
+
export declare const MODES: readonly ["auto", "consult", "review", "codex"];
|
|
7
|
+
/** Languages this package ships. */
|
|
8
|
+
export declare const LANGUAGES: readonly ["auto", "zh", "en"];
|
|
9
|
+
/** Reasoning policies this page offers, matching the Host's `reasoning` enum. */
|
|
10
|
+
export declare const REASONING_MODES: readonly ["auto", "low", "high", "max"];
|
|
11
|
+
/**
|
|
12
|
+
* Accepted values and the revision-fenced write queue the Host owns for one
|
|
13
|
+
* plugin entry. Stated structurally so this package does not depend on the
|
|
14
|
+
* settings client package at build time; the Host instance provides exactly
|
|
15
|
+
* this face.
|
|
16
|
+
*/
|
|
17
|
+
export interface CodingConfigFormSnapshot {
|
|
18
|
+
/** `loading` until the first Host section, `unavailable` when not served. */
|
|
19
|
+
readonly status: 'loading' | 'ready' | 'unavailable';
|
|
20
|
+
readonly value: Record<string, unknown> | undefined;
|
|
21
|
+
readonly revision: number | undefined;
|
|
22
|
+
readonly writable: boolean;
|
|
23
|
+
}
|
|
24
|
+
/** One field write, addressed inside the namespace section. */
|
|
25
|
+
export interface CodingConfigOp {
|
|
26
|
+
readonly op: 'set' | 'unset';
|
|
27
|
+
readonly path: string[];
|
|
28
|
+
readonly value?: unknown;
|
|
29
|
+
}
|
|
30
|
+
/** The form face this page consumes. */
|
|
31
|
+
export interface CodingConfigForm {
|
|
32
|
+
getSnapshot(): CodingConfigFormSnapshot;
|
|
33
|
+
subscribe(listener: () => void): () => void;
|
|
34
|
+
mutate(ops: readonly CodingConfigOp[], expectedRevision?: number): Promise<boolean>;
|
|
35
|
+
}
|
|
36
|
+
/** Props the bundle page registration supplies. */
|
|
37
|
+
export interface CodingConfigPageProps {
|
|
38
|
+
/** `summary` renders the one-liner the plugin manager shows first. */
|
|
39
|
+
readonly view: 'summary' | 'page';
|
|
40
|
+
/** Host-owned form for this bundle entry. */
|
|
41
|
+
readonly form: CodingConfigForm;
|
|
42
|
+
/** Host LLM Remote the model selects read their catalog from. */
|
|
43
|
+
readonly remote?: ModelCatalogRemote;
|
|
44
|
+
readonly t: (key: CodingKey) => string;
|
|
45
|
+
}
|
|
46
|
+
/** Read one string field from a settings value. */
|
|
47
|
+
export declare function fieldOf(value: Record<string, unknown> | undefined, key: string, fallback?: string): string;
|
|
48
|
+
/** One editable draft, kept as strings so a half-typed route is not rejected. */
|
|
49
|
+
export interface Draft {
|
|
50
|
+
readonly defaultMode: string;
|
|
51
|
+
readonly implementWorkerModel: string;
|
|
52
|
+
readonly plannerWorkerModel: string;
|
|
53
|
+
readonly verifyWorkerModel: string;
|
|
54
|
+
readonly language: string;
|
|
55
|
+
readonly reasoning: string;
|
|
56
|
+
}
|
|
57
|
+
/** The defaults the page restores, matching `cordis.patch.yml`. */
|
|
58
|
+
export declare const DEFAULT_DRAFT: Draft;
|
|
59
|
+
/** One selectable `provider/model` route from the configured model catalog. */
|
|
60
|
+
export interface ModelOption {
|
|
61
|
+
readonly value: string;
|
|
62
|
+
readonly provider: string;
|
|
63
|
+
readonly model: string;
|
|
64
|
+
readonly label: string;
|
|
65
|
+
/** The stored route is no longer advertised; shown but not selectable. */
|
|
66
|
+
readonly missing?: boolean;
|
|
67
|
+
}
|
|
68
|
+
/** The result envelope every Host Remote method returns. */
|
|
69
|
+
export interface RemoteResultLike<T> {
|
|
70
|
+
readonly ok: boolean;
|
|
71
|
+
readonly value?: T;
|
|
72
|
+
readonly error?: {
|
|
73
|
+
readonly message?: string;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The slice of `ctx.remote.llm` this page reads. Model discovery is three
|
|
78
|
+
* calls: the registered providers, which of them the settings service can
|
|
79
|
+
* describe, and the models each one advertises for its settings namespace.
|
|
80
|
+
*/
|
|
81
|
+
export interface ModelCatalogRemote {
|
|
82
|
+
listProviders?(): Promise<RemoteResultLike<readonly {
|
|
83
|
+
id: string;
|
|
84
|
+
name?: string;
|
|
85
|
+
}[]>>;
|
|
86
|
+
listConfigurableProviders?(): Promise<RemoteResultLike<readonly {
|
|
87
|
+
provider: string;
|
|
88
|
+
displayName?: string;
|
|
89
|
+
settingsNs: string;
|
|
90
|
+
}[]>>;
|
|
91
|
+
discoverModels?(settingsNs: string, request: {
|
|
92
|
+
provider?: string;
|
|
93
|
+
}): Promise<RemoteResultLike<readonly {
|
|
94
|
+
id: string;
|
|
95
|
+
name?: string;
|
|
96
|
+
}[]>>;
|
|
97
|
+
}
|
|
98
|
+
/** Draft built from the accepted Host value. */
|
|
99
|
+
export declare function draftOf(value: Record<string, unknown> | undefined): Draft;
|
|
100
|
+
/** Whether every worker route names a `provider/model` pair. */
|
|
101
|
+
export declare function draftIsValid(draft: Draft): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Load every `provider/model` the Host has configured.
|
|
104
|
+
*
|
|
105
|
+
* The catalog is the union of the providers the registry knows and the ones
|
|
106
|
+
* the settings service can describe, each asked for its own models. A provider
|
|
107
|
+
* that fails discovery keeps its error and falls back to its built-in models
|
|
108
|
+
* when it has them, so one broken provider never hides the rest; only an empty
|
|
109
|
+
* catalog is an error.
|
|
110
|
+
* @param remote - the Host LLM Remote, absent on an older Host.
|
|
111
|
+
* @returns the sorted options, one per advertised model.
|
|
112
|
+
*/
|
|
113
|
+
export declare function loadModelOptions(remote: ModelCatalogRemote | undefined): Promise<ModelOption[]>;
|
|
114
|
+
/**
|
|
115
|
+
* Add the stored routes the catalog no longer advertises, marked `missing`, so
|
|
116
|
+
* a select can still show what the settings hold instead of silently dropping it.
|
|
117
|
+
* @param options - the loaded catalog.
|
|
118
|
+
* @param current - the routes the draft currently holds.
|
|
119
|
+
* @returns the options plus one entry per unknown stored route.
|
|
120
|
+
*/
|
|
121
|
+
export declare function mergeCurrentModels(options: readonly ModelOption[], current: readonly string[]): ModelOption[];
|
|
122
|
+
/** Whether every worker route is non-empty and present in the catalog. */
|
|
123
|
+
export declare function draftModelsValid(draft: Draft, options: readonly ModelOption[]): boolean;
|
|
124
|
+
/**
|
|
125
|
+
* The namespace mutation one save submits, revision fence owned by the caller.
|
|
126
|
+
* A field the served schema does not advertise is left out: an older Host
|
|
127
|
+
* would reject the whole mutation for an unknown property.
|
|
128
|
+
* That guard also covers `reasoning`: a Host that does not declare it gets no
|
|
129
|
+
* reasoning op, so the mutation is never rejected as a whole.
|
|
130
|
+
* @param draft - edited values.
|
|
131
|
+
* @param served - the accepted Host value the form was built from.
|
|
132
|
+
* @returns the ordered operations.
|
|
133
|
+
*/
|
|
134
|
+
export declare function buildConfigOps(draft: Draft, served?: Record<string, unknown>): CodingConfigOp[];
|
|
135
|
+
/** The bundle configuration page. */
|
|
136
|
+
export declare function CodingConfigPage(props: CodingConfigPageProps): ReactElement;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Conversation projection of the Coding runtime.
|
|
3
|
+
*
|
|
4
|
+
* Durable data source: the Session events this plugin's own tools already
|
|
5
|
+
* produce. `tool/call` starts a per-turn capsule; `tool/result` carries a
|
|
6
|
+
* **whole-value checkpoint** in its durable `meta`, so a history page that
|
|
7
|
+
* begins after the call still renders the complete stage and verification
|
|
8
|
+
* state. `turn/end` closes the turn's capsule and carries the previous turn's
|
|
9
|
+
* checkpoint forward through the strictly-backward Context reader.
|
|
10
|
+
*
|
|
11
|
+
* Every match reports `role: 'start'` on purpose. The Assembler adopts the
|
|
12
|
+
* earliest loaded start as the Context start and folds later matches through
|
|
13
|
+
* `update()`, so a window that starts mid-run initializes from the newest
|
|
14
|
+
* checkpoint instead of retaining a pending Context with no State.
|
|
15
|
+
*
|
|
16
|
+
* @module dsh-coding/client/definition
|
|
17
|
+
*/
|
|
18
|
+
import type { ConversationNodeDefinition } from '@deepseek-ai/dsh-client-ui-conversation/client';
|
|
19
|
+
import { type CodingCheckpoint, type CodingMode, type CodingStage } from '../stages.js';
|
|
20
|
+
/** Definition kind; also the renderer key in `conversation.chat.node`. */
|
|
21
|
+
export declare const CAPSULE_KIND = "coding-stage";
|
|
22
|
+
/** Chat target this Definition publishes to. */
|
|
23
|
+
export declare const CAPSULE_TARGET = "chat";
|
|
24
|
+
/** Business value of one turn's capsule. */
|
|
25
|
+
export interface CapsuleData {
|
|
26
|
+
/** Stable coding-run identity, when a checkpoint has been seen. */
|
|
27
|
+
readonly runId: string;
|
|
28
|
+
readonly turn: number;
|
|
29
|
+
readonly mode: CodingMode;
|
|
30
|
+
readonly stage: CodingStage;
|
|
31
|
+
/** Complete state from the newest `tool/result` checkpoint in this Context. */
|
|
32
|
+
readonly checkpoint?: CodingCheckpoint;
|
|
33
|
+
/** Newest checkpoint from an earlier turn, used while this turn is still running. */
|
|
34
|
+
readonly inherited?: CodingCheckpoint;
|
|
35
|
+
/** A Coding tool is running and its result has not arrived yet. */
|
|
36
|
+
readonly pending?: {
|
|
37
|
+
readonly tool: string;
|
|
38
|
+
readonly requested?: string;
|
|
39
|
+
readonly at: number;
|
|
40
|
+
};
|
|
41
|
+
/** No checkpoint exists in the loaded window yet: the stage is inherited or unknown. */
|
|
42
|
+
readonly partial: boolean;
|
|
43
|
+
}
|
|
44
|
+
declare module '@deepseek-ai/dsh-client-ui-chat/client' {
|
|
45
|
+
interface ChatNodeDataMap {
|
|
46
|
+
/** Read-only Coding stage capsule, one per Turn. */
|
|
47
|
+
'coding-stage': CapsuleData;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/** The Coding capsule Definition. */
|
|
51
|
+
export declare const capsuleDefinition: ConversationNodeDefinition<CapsuleData>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Context as ClientContext } from '@deepseek-ai/cordis';
|
|
2
|
+
/** Locale namespace owned by this plugin. */
|
|
3
|
+
export declare const NS = "dsh-coding";
|
|
4
|
+
/** Client services this half needs before it can register anything. */
|
|
5
|
+
export declare const inject: string[];
|
|
6
|
+
/**
|
|
7
|
+
* Register the card, the first-message pickers, the capsule, and the configuration page.
|
|
8
|
+
* @param ctx - client root context.
|
|
9
|
+
*/
|
|
10
|
+
export declare function apply(ctx: ClientContext): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copy of the Coding surface, registered as the `dsh-coding` Client locale
|
|
3
|
+
* namespace, so visible UI text never hard-codes a language.
|
|
4
|
+
*
|
|
5
|
+
* @module dsh-coding/client/locales
|
|
6
|
+
*/
|
|
7
|
+
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
8
|
+
interface LocaleNamespaceMap {
|
|
9
|
+
/** Coding stage capsule, per-turn control card, and configuration page copy. */
|
|
10
|
+
'dsh-coding': CodingKey;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/** Every dictionary key this client half uses. */
|
|
14
|
+
export type CodingKey = 'aria' | 'hint.mode' | 'picker.label' | 'picker.aria' | 'mode.consult' | 'mode.review' | 'mode.auto' | 'mode.codex' | 'stage.requirements' | 'stage.plan' | 'stage.implement' | 'stage.verify' | 'stage.deliver' | 'verification.none' | 'verification.passed' | 'verification.failed' | 'plan.none' | 'plan.progress' | 'worker.running' | 'worker.completed' | 'worker.failed' | 'pending' | 'refused' | 'files' | 'card.mode' | 'card.stage' | 'card.verify' | 'card.stageHint' | 'card.switchFailed' | 'card.stale' | 'card.reasoning' | 'reasoning.pending' | 'reasoning.sourceAuto' | 'reasoning.sourceOverride' | 'reasoning.sourcePick' | 'reasoning.sourceSettings' | 'config.title' | 'config.hint' | 'config.mode' | 'config.modeHint' | 'config.implementModel' | 'config.implementModelHint' | 'config.plannerModel' | 'config.plannerModelHint' | 'config.verifyModel' | 'config.verifyModelHint' | 'config.language' | 'config.languageHint' | 'config.languageAuto' | 'config.reasoning' | 'config.reasoningHint' | 'config.reasoningAuto' | 'config.verification' | 'config.verificationHint' | 'config.commands' | 'config.commandsHint' | 'config.save' | 'config.saving' | 'config.saved' | 'config.saveFailed' | 'config.invalidRoute' | 'config.readOnly' | 'config.loading' | 'config.unavailable' | 'config.reset' | 'config.presetWarning' | 'config.modelWarning' | 'config.modelsLoading' | 'config.modelsUnavailable' | 'config.modelsRetry' | 'config.modelPlaceholder' | 'config.modelMissing';
|
|
15
|
+
/** English copy. */
|
|
16
|
+
export declare const en: Record<CodingKey, string>;
|
|
17
|
+
/** Chinese copy. */
|
|
18
|
+
export declare const zh: Record<CodingKey, string>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CODING_PROJECTION_KEY, type CodingStageView } from '../coding-projection.js';
|
|
2
|
+
import type { CodingMode } from '../stages.js';
|
|
3
|
+
import type { CodingKey } from './locales.js';
|
|
4
|
+
/** Props the hero-options slot hands this picker. */
|
|
5
|
+
export interface CodingModePickerProps {
|
|
6
|
+
/** Host-computed projection value for this session. */
|
|
7
|
+
readonly useProjection: (key: typeof CODING_PROJECTION_KEY) => unknown;
|
|
8
|
+
/** Injected by this plugin's registration: run one `/coding …` line. */
|
|
9
|
+
readonly execute?: (line: string) => unknown;
|
|
10
|
+
readonly t: (key: CodingKey) => string;
|
|
11
|
+
}
|
|
12
|
+
/** The command line one pre-Turn choice sends; `set` never starts a Turn. */
|
|
13
|
+
export declare function pickerCommandFor(mode: CodingMode): string;
|
|
14
|
+
/**
|
|
15
|
+
* The state the picker renders. Pure, so the visible/absent split is testable
|
|
16
|
+
* without a renderer.
|
|
17
|
+
* @param view - current projection value, if the session has one.
|
|
18
|
+
* @returns the selected mode and the offered modes, or null outside a Coding session.
|
|
19
|
+
*/
|
|
20
|
+
export declare function pickerState(view: CodingStageView | undefined): {
|
|
21
|
+
readonly mode: CodingMode;
|
|
22
|
+
readonly modes: readonly CodingMode[];
|
|
23
|
+
} | null;
|
|
24
|
+
/** The first-message mode picker rendered in the blank-session hero. */
|
|
25
|
+
export declare const CodingModePicker: import("react").NamedExoticComponent<CodingModePickerProps>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The bundle's one stylesheet.
|
|
3
|
+
*
|
|
4
|
+
* Every rule is copied from a DSH component recipe or uses only DSH theme
|
|
5
|
+
* tokens, so the card, the capsule, and the configuration page sit in the
|
|
6
|
+
* conversation with the product's own typography, sizes, and colors:
|
|
7
|
+
*
|
|
8
|
+
* - card chrome: `PlanPreview.module.css` `.card` (bordered `card-fill` surface,
|
|
9
|
+
* `--dsw-radius-lg`, `font: inherit`),
|
|
10
|
+
* - buttons: `PlanPreview.module.css` `.cardOpen` (28px high, 12px/18px,
|
|
11
|
+
* `--dsw-radius-sm`, floating fill) plus the pressed/focus states DSH uses,
|
|
12
|
+
* - text: 12px/18px labels exactly like the shipped status rows,
|
|
13
|
+
* - inputs: `PluginManagerPage.module.css` `.installField input` (40px,
|
|
14
|
+
* `--dsw-radius-md`, `--dsw-alias-border-l4`),
|
|
15
|
+
* - colors: only `--dsw-alias-*` / `--dsw-radius-*` / `--dsw-focus-ring-*`.
|
|
16
|
+
*
|
|
17
|
+
* The module is browser-only and idempotent: one `<style data-plugin-css>`
|
|
18
|
+
* tagged for HMR bookkeeping, replaced if a previous generation left it.
|
|
19
|
+
*
|
|
20
|
+
* @module dsh-coding/client/styles
|
|
21
|
+
*/
|
|
22
|
+
/** Marker the client module system uses to inventory this plugin's styles. */
|
|
23
|
+
export declare const STYLE_ID = "dsh-coding/ui.css";
|
|
24
|
+
/**
|
|
25
|
+
* Install the bundle stylesheet once per client generation.
|
|
26
|
+
* @returns disposer removing the style tag this call created.
|
|
27
|
+
*/
|
|
28
|
+
export declare function installStyles(): () => void;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { type CodingCheckpoint, type CodingMode, type CodingStage } from './stages.js';
|
|
2
|
+
/** Projection key shared by the Host fold and every client reader. */
|
|
3
|
+
export declare const CODING_PROJECTION_KEY: "dshCodingStage";
|
|
4
|
+
/** Preset id this bundle declares in `cordis.patch.yml`. */
|
|
5
|
+
export declare const CODING_PRESET_ID = "dsh-coding";
|
|
6
|
+
/** Verification evidence reduced to what the card shows. */
|
|
7
|
+
export interface CodingVerificationView {
|
|
8
|
+
readonly passed: boolean;
|
|
9
|
+
readonly kind: string;
|
|
10
|
+
readonly scope: string;
|
|
11
|
+
readonly command: string;
|
|
12
|
+
readonly failedTests: readonly string[];
|
|
13
|
+
readonly ranAt: number;
|
|
14
|
+
}
|
|
15
|
+
/** One closed turn, frozen so a later switch never rewrites history. */
|
|
16
|
+
export interface CodingTurnView {
|
|
17
|
+
readonly turn: number;
|
|
18
|
+
readonly mode: CodingMode;
|
|
19
|
+
readonly stage: CodingStage;
|
|
20
|
+
readonly verification: CodingVerificationView | null;
|
|
21
|
+
/** Frozen plan progress at this turn's end. */
|
|
22
|
+
readonly planItems: number;
|
|
23
|
+
readonly openPlanItems: number;
|
|
24
|
+
/** Frozen session edit total at this turn's end. */
|
|
25
|
+
readonly edits: number;
|
|
26
|
+
}
|
|
27
|
+
/** One durable task-list entry, as `todo_write` recorded it. */
|
|
28
|
+
export interface CodingPlanItemView {
|
|
29
|
+
readonly content: string;
|
|
30
|
+
readonly status: 'pending' | 'in_progress' | 'completed';
|
|
31
|
+
}
|
|
32
|
+
/** The whole projection value: one session's current Coding state. */
|
|
33
|
+
export interface CodingStageView {
|
|
34
|
+
/** True only for a user-facing session running the `dsh-coding` preset. */
|
|
35
|
+
readonly active: boolean;
|
|
36
|
+
readonly mode: CodingMode;
|
|
37
|
+
readonly stage: CodingStage;
|
|
38
|
+
/** Stages this mode opens, in forward order. */
|
|
39
|
+
readonly allowedStages: readonly CodingStage[];
|
|
40
|
+
readonly planItems: number;
|
|
41
|
+
readonly openPlanItems: number;
|
|
42
|
+
readonly edits: number;
|
|
43
|
+
readonly verification: CodingVerificationView | null;
|
|
44
|
+
/** Newest whole-value checkpoint in the log, or null before the first Coding tool result. */
|
|
45
|
+
readonly checkpoint: CodingCheckpoint | null;
|
|
46
|
+
/** Latest durable task list; restored with the checkpoint on a resume. */
|
|
47
|
+
readonly plan: readonly CodingPlanItemView[];
|
|
48
|
+
/** A Coding verb is running and its result has not arrived yet. */
|
|
49
|
+
readonly pending: {
|
|
50
|
+
readonly tool: string;
|
|
51
|
+
readonly requested: string | null;
|
|
52
|
+
/** Provider call id, so another tool's result cannot clear this label. */
|
|
53
|
+
readonly callId: string | null;
|
|
54
|
+
} | null;
|
|
55
|
+
/** Newest closed turn; only that turn's card is a control. */
|
|
56
|
+
readonly latest: number;
|
|
57
|
+
readonly turns: readonly CodingTurnView[];
|
|
58
|
+
readonly updatedAt: number;
|
|
59
|
+
}
|
|
60
|
+
declare module '@deepseek-ai/dsh-session-projection/types' {
|
|
61
|
+
interface SessionProjectionMap {
|
|
62
|
+
/** Coding stage, mode, plan, and verification of one session. */
|
|
63
|
+
dshCodingStage: SessionProjectionSummaryExcluded<CodingStageView>;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/** The slice of a Session header this fold needs. */
|
|
67
|
+
interface HeaderLike {
|
|
68
|
+
readonly agentPreset?: unknown;
|
|
69
|
+
readonly delegationDepth?: unknown;
|
|
70
|
+
}
|
|
71
|
+
/** The slice of a Session event this fold needs. */
|
|
72
|
+
interface EventLike {
|
|
73
|
+
readonly type?: unknown;
|
|
74
|
+
readonly time?: unknown;
|
|
75
|
+
readonly data?: any;
|
|
76
|
+
}
|
|
77
|
+
/** Whether a session header names this bundle's user-facing preset. */
|
|
78
|
+
export declare function isCodingSession(header: HeaderLike | undefined): boolean;
|
|
79
|
+
/** Projection value before any event is folded. */
|
|
80
|
+
export declare function initialView(defaultMode: CodingMode): CodingStageView;
|
|
81
|
+
/**
|
|
82
|
+
* Fold one committed Session event into the projection.
|
|
83
|
+
* @param state - value covering every earlier event.
|
|
84
|
+
* @param event - next committed event.
|
|
85
|
+
* @param defaultMode - configured mode, used when a session switches preset mid-flight.
|
|
86
|
+
* @returns the next value; the same reference when the event is unrelated.
|
|
87
|
+
*/
|
|
88
|
+
export declare function applyEvent(state: CodingStageView, event: EventLike, defaultMode: CodingMode): CodingStageView;
|
|
89
|
+
/** Validate one persisted or wire value as {@link CodingStageView}. */
|
|
90
|
+
export declare function parseView(value: unknown): CodingStageView;
|
|
91
|
+
/** The tiny validator face the projection registry uses (`parse` only). */
|
|
92
|
+
interface ParseFace<T> {
|
|
93
|
+
parse(value: unknown): T;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Build the registrable projection definition.
|
|
97
|
+
*
|
|
98
|
+
* `defaultMode` is read lazily: the projection is folded during Session opens
|
|
99
|
+
* that can happen long after mount, and a page edit must apply to the next one.
|
|
100
|
+
*
|
|
101
|
+
* @param defaultMode - configured initial mode for a Coding session.
|
|
102
|
+
* @returns definition object accepted by `ctx.sessionProjections.register`.
|
|
103
|
+
*/
|
|
104
|
+
export declare function codingProjection(defaultMode: () => CodingMode): {
|
|
105
|
+
key: typeof CODING_PROJECTION_KEY;
|
|
106
|
+
stateVersion: number;
|
|
107
|
+
stateSchema: ParseFace<CodingStageView>;
|
|
108
|
+
init: (header: HeaderLike | undefined) => CodingStageView;
|
|
109
|
+
apply: (state: CodingStageView, event: EventLike) => CodingStageView;
|
|
110
|
+
wire: {
|
|
111
|
+
viewSchema: ParseFace<CodingStageView>;
|
|
112
|
+
view: (state: CodingStageView) => CodingStageView;
|
|
113
|
+
summary: boolean;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
export {};
|