@mengyuly/dsh-ponytail 0.1.5 → 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.
@@ -15,6 +15,19 @@
15
15
  import type { Context } from '@deepseek-ai/cordis';
16
16
  export declare const name = "ponytail";
17
17
  export declare const inject: string[];
18
+ /**
19
+ * Cordis profile-level configuration (set per profile via the bundle row's
20
+ * `config` in a profile patch). `defaultMode` sits between the environment
21
+ * variable and the user config file in the default-resolution chain.
22
+ *
23
+ * No `Config` schema is exported on purpose: cordis passes the raw config
24
+ * through unvalidated then, so an invalid `defaultMode` falls back with a
25
+ * one-time warning instead of failing the plugin mount.
26
+ */
27
+ export interface PonytailConfig {
28
+ /** Profile-scoped default intensity, e.g. `web → full`, `tui → lite`. */
29
+ defaultMode?: unknown;
30
+ }
18
31
  /** Extract the plain text of one user message (only its text blocks). */
19
32
  export declare function messageText(message: {
20
33
  content: readonly {
@@ -33,4 +46,4 @@ export declare function containsDeactivation(messages: readonly {
33
46
  * Register the always-on ruleset section, the runtime skills, the slash
34
47
  * commands, and the plain-text deactivation listener.
35
48
  */
36
- export declare function apply(ctx: Context): void;
49
+ export declare function apply(ctx: Context, config?: PonytailConfig): void;
@@ -1,23 +1,17 @@
1
1
  /**
2
- * Build the mode-filtered ponytail ruleset. Ported from the upstream
3
- * `hooks/ponytail-instructions.js`, so the injected text is byte-for-byte the
4
- * same ruleset every other host emits, filtered to the active intensity.
2
+ * Structured ponytail ruleset composition. Each intensity is built from
3
+ * explicit fragments — common rules, a never-cut safety boundary list, and
4
+ * the mode's own rules — instead of filtering one Markdown body with regexes.
5
+ * The three intensities therefore differ in their actual instructions, not
6
+ * just in a table row.
5
7
  *
6
8
  * @module @deepseek-ai/dsh-ponytail
7
9
  */
8
10
  import { type PonytailRuntimeMode } from './modes.ts';
9
11
  /**
10
- * Keep a line of the skill body only when it belongs to every mode or to the
11
- * active one. Both shape-sensitive spots (the intensity table rows and the
12
- * quoted worked examples) are keyed by a mode name; ordinary rules survive
13
- * verbatim, even ones whose prose starts with a mode-looking word.
14
- */
15
- export declare function filterSkillBodyForMode(body: string, mode: PonytailRuntimeMode | null | undefined): string;
16
- /** Minimal instruction set if the skill body can't be read (parity fallback). */
17
- export declare function fallbackInstructions(mode: PonytailRuntimeMode): string;
18
- /**
19
- * The full injected ruleset for one intensity: the "PONYTAIL MODE ACTIVE"
20
- * header plus the body filtered down to that mode's rows and examples.
21
- * Returns an empty string for `off` (ponytail contributes nothing).
12
+ * The injected ruleset for one intensity, composed from the structured
13
+ * fragments above. Returns an empty string for `off` (ponytail contributes
14
+ * nothing). Renders are pure per mode and cached so every turn's bytes stay
15
+ * identical.
22
16
  */
23
17
  export declare function getPonytailInstructions(mode: PonytailRuntimeMode | null | undefined): string;
@@ -47,17 +47,26 @@ export interface DefaultModeResolution {
47
47
  readonly issue?: DefaultModeIssue;
48
48
  }
49
49
  /**
50
- * Read the configured default with diagnostics: environment variable first,
51
- * then the config file, then `full`. A missing config file is normal and
52
- * yields no issue; a broken one yields the fallback mode plus one issue for
53
- * the caller to warn about once.
50
+ * Read the configured default with diagnostics. Priority:
51
+ * `PONYTAIL_DEFAULT_MODE` → Cordis profile `defaultMode` → user config file →
52
+ * `full`. A missing config file is normal and yields no issue; a broken one
53
+ * yields the fallback mode plus one issue for the caller to warn about once.
54
+ * @param env - the process environment to read.
55
+ * @param profileMode - the validated Cordis profile `defaultMode`, or `null`
56
+ * when the profile config is absent or invalid (invalid values are reported
57
+ * by the caller; this function only consumes valid ones).
54
58
  */
55
- export declare function readDefaultModeInfo(env?: NodeJS.ProcessEnv): DefaultModeResolution;
59
+ export declare function readDefaultModeInfo(env?: NodeJS.ProcessEnv, profileMode?: PonytailRuntimeMode | null): DefaultModeResolution;
56
60
  /**
57
61
  * Read the configured default for this host: environment variable first, then
58
- * the config file, then `full`.
62
+ * the Cordis profile `defaultMode`, then the user config file, then `full`.
59
63
  */
60
- export declare function readDefaultMode(env?: NodeJS.ProcessEnv): PonytailRuntimeMode;
64
+ export declare function readDefaultMode(env?: NodeJS.ProcessEnv, profileMode?: PonytailRuntimeMode | null): PonytailRuntimeMode;
65
+ /**
66
+ * Why a `saved` default is not the effective one — for the `/ponytail default`
67
+ * result message. `null` means the saved value is effective.
68
+ */
69
+ export declare function defaultOverrideReason(env: NodeJS.ProcessEnv, profileMode: PonytailRuntimeMode | null): 'PONYTAIL_DEFAULT_MODE' | 'profile configuration' | null;
61
70
  /**
62
71
  * Persist a new default level to the config file, preserving other fields.
63
72
  * Returns the normalized mode, or `null` when the value is not a runtime mode.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mengyuly/dsh-ponytail",
3
3
  "description": "Lazy senior dev mode for DeepSeek Harness: always-on minimal-code ruleset, intensity switching, and short review/audit/debt/gain/help skills",
4
- "version": "0.1.5",
4
+ "version": "0.2.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -44,7 +44,8 @@
44
44
  "@deepseek-ai/dsh-invariants": ">=0.0.1-rc <2",
45
45
  "@deepseek-ai/dsh-llm": ">=0.0.1-rc <2",
46
46
  "@deepseek-ai/dsh-skill": ">=0.0.1-rc <2",
47
- "@deepseek-ai/dsh-system-prompt": ">=0.0.1-rc <2"
47
+ "@deepseek-ai/dsh-system-prompt": ">=0.0.1-rc <2",
48
+ "@deepseek-ai/schemastery": "^3.18.0"
48
49
  },
49
50
  "scripts": {
50
51
  "sync:dist": "node scripts/sync-dist.mjs",