@anweat/dsh-browser 0.1.17 → 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.
Files changed (169) hide show
  1. package/README.md +266 -88
  2. package/assets/skills/dsh-browser/SKILL.md +120 -0
  3. package/assets/skills/dsh-browser/references/develop.md +48 -0
  4. package/assets/skills/dsh-browser/references/observe.md +91 -0
  5. package/assets/skills/dsh-browser/references/opencli.md +25 -0
  6. package/assets/skills/dsh-browser/references/recipes.md +149 -0
  7. package/assets/skills/dsh-browser/references/userscripts.md +44 -0
  8. package/cordis.patch.yml +11 -3
  9. package/lib/actions/act.d.ts +3 -0
  10. package/lib/actions/act.js +147 -0
  11. package/lib/actions/act.js.map +1 -0
  12. package/lib/actions/automation.d.ts +3 -0
  13. package/lib/actions/automation.js +356 -0
  14. package/lib/actions/automation.js.map +1 -0
  15. package/lib/actions/crawl.d.ts +3 -0
  16. package/lib/actions/crawl.js +28 -0
  17. package/lib/actions/crawl.js.map +1 -0
  18. package/lib/actions/errors.d.ts +53 -0
  19. package/lib/actions/errors.js +178 -0
  20. package/lib/actions/errors.js.map +1 -0
  21. package/lib/actions/index-view.d.ts +42 -0
  22. package/lib/actions/index-view.js +268 -0
  23. package/lib/actions/index-view.js.map +1 -0
  24. package/lib/actions/inspect.d.ts +3 -0
  25. package/lib/actions/inspect.js +35 -0
  26. package/lib/actions/inspect.js.map +1 -0
  27. package/lib/actions/observe.d.ts +3 -0
  28. package/lib/actions/observe.js +121 -0
  29. package/lib/actions/observe.js.map +1 -0
  30. package/lib/actions/opencli.d.ts +3 -0
  31. package/lib/actions/opencli.js +51 -0
  32. package/lib/actions/opencli.js.map +1 -0
  33. package/lib/actions/registry.d.ts +35 -0
  34. package/lib/actions/registry.js +89 -0
  35. package/lib/actions/registry.js.map +1 -0
  36. package/lib/actions/run.d.ts +34 -0
  37. package/lib/actions/run.js +226 -0
  38. package/lib/actions/run.js.map +1 -0
  39. package/lib/actions/runtime.d.ts +3 -0
  40. package/lib/actions/runtime.js +33 -0
  41. package/lib/actions/runtime.js.map +1 -0
  42. package/lib/actions/schema.d.ts +31 -0
  43. package/lib/actions/schema.js +309 -0
  44. package/lib/actions/schema.js.map +1 -0
  45. package/lib/actions/script.d.ts +3 -0
  46. package/lib/actions/script.js +97 -0
  47. package/lib/actions/script.js.map +1 -0
  48. package/lib/actions/shared.d.ts +31 -0
  49. package/lib/actions/shared.js +45 -0
  50. package/lib/actions/shared.js.map +1 -0
  51. package/lib/actions/surface.d.ts +22 -0
  52. package/lib/actions/surface.js +18 -0
  53. package/lib/actions/surface.js.map +1 -0
  54. package/lib/actions/target.d.ts +3 -0
  55. package/lib/actions/target.js +66 -0
  56. package/lib/actions/target.js.map +1 -0
  57. package/lib/actions/types.d.ts +181 -0
  58. package/lib/actions/types.js +48 -0
  59. package/lib/actions/types.js.map +1 -0
  60. package/lib/activation-rules.d.ts +29 -0
  61. package/lib/activation-rules.js +33 -0
  62. package/lib/activation-rules.js.map +1 -0
  63. package/lib/approval-policy.d.ts +40 -2
  64. package/lib/approval-policy.js +184 -97
  65. package/lib/approval-policy.js.map +1 -1
  66. package/lib/automation-assets-rpc.d.ts +8 -2
  67. package/lib/automation-assets-rpc.js +68 -10
  68. package/lib/automation-assets-rpc.js.map +1 -1
  69. package/lib/automation-assets.d.ts +152 -4
  70. package/lib/automation-assets.js +255 -15
  71. package/lib/automation-assets.js.map +1 -1
  72. package/lib/automation-convert.d.ts +23 -0
  73. package/lib/automation-convert.js +110 -0
  74. package/lib/automation-convert.js.map +1 -0
  75. package/lib/automation-development.d.ts +26 -0
  76. package/lib/automation-development.js +47 -0
  77. package/lib/automation-development.js.map +1 -1
  78. package/lib/automation-execution.d.ts +57 -1
  79. package/lib/automation-execution.js +167 -11
  80. package/lib/automation-execution.js.map +1 -1
  81. package/lib/automation-journal.d.ts +92 -0
  82. package/lib/automation-journal.js +449 -0
  83. package/lib/automation-journal.js.map +1 -0
  84. package/lib/automation-v2.d.ts +138 -0
  85. package/lib/automation-v2.js +631 -0
  86. package/lib/automation-v2.js.map +1 -0
  87. package/lib/automation.d.ts +82 -5
  88. package/lib/automation.js +239 -82
  89. package/lib/automation.js.map +1 -1
  90. package/lib/browser-service.d.ts +309 -32
  91. package/lib/browser-service.js +636 -182
  92. package/lib/browser-service.js.map +1 -1
  93. package/lib/client/SettingsCard.js +95 -57
  94. package/lib/client/SettingsCard.js.map +1 -1
  95. package/lib/client/asset-editor.d.ts +55 -0
  96. package/lib/client/asset-editor.js +101 -0
  97. package/lib/client/asset-editor.js.map +1 -0
  98. package/lib/client/automation-assets-client.d.ts +99 -2
  99. package/lib/client/automation-assets-client.js +243 -10
  100. package/lib/client/automation-assets-client.js.map +1 -1
  101. package/lib/client/form.d.ts +48 -4
  102. package/lib/client/form.js +142 -29
  103. package/lib/client/form.js.map +1 -1
  104. package/lib/client/index.d.ts +25 -2
  105. package/lib/client/index.js +5 -1
  106. package/lib/client/index.js.map +1 -1
  107. package/lib/client/locales.d.ts +85 -6
  108. package/lib/client/locales.js +64 -12
  109. package/lib/client/locales.js.map +1 -1
  110. package/lib/client/prompts-form.d.ts +67 -0
  111. package/lib/client/prompts-form.js +140 -0
  112. package/lib/client/prompts-form.js.map +1 -0
  113. package/lib/client/prompts-status-client.d.ts +34 -0
  114. package/lib/client/prompts-status-client.js +53 -0
  115. package/lib/client/prompts-status-client.js.map +1 -0
  116. package/lib/client/settings-namespace.d.ts +1 -1
  117. package/lib/client/settings-namespace.js +1 -1
  118. package/lib/client/settings-namespace.js.map +1 -1
  119. package/lib/client.js +1915 -330
  120. package/lib/client.js.map +1 -1
  121. package/lib/config.d.ts +50 -1
  122. package/lib/config.js +31 -1
  123. package/lib/config.js.map +1 -1
  124. package/lib/dialogs.d.ts +37 -0
  125. package/lib/dialogs.js +73 -0
  126. package/lib/dialogs.js.map +1 -0
  127. package/lib/freedom.d.ts +23 -7
  128. package/lib/freedom.js +48 -59
  129. package/lib/freedom.js.map +1 -1
  130. package/lib/index.d.ts +5 -13
  131. package/lib/index.js +51 -30
  132. package/lib/index.js.map +1 -1
  133. package/lib/journal.d.ts +109 -0
  134. package/lib/journal.js +238 -0
  135. package/lib/journal.js.map +1 -0
  136. package/lib/locator.d.ts +82 -0
  137. package/lib/locator.js +190 -0
  138. package/lib/locator.js.map +1 -0
  139. package/lib/observe-script.d.ts +27 -0
  140. package/lib/observe-script.js +565 -0
  141. package/lib/observe-script.js.map +1 -0
  142. package/lib/observe.d.ts +179 -0
  143. package/lib/observe.js +368 -0
  144. package/lib/observe.js.map +1 -0
  145. package/lib/policy-keys.d.ts +30 -0
  146. package/lib/policy-keys.js +34 -0
  147. package/lib/policy-keys.js.map +1 -0
  148. package/lib/prompt-limits.d.ts +30 -0
  149. package/lib/prompt-limits.js +31 -0
  150. package/lib/prompt-limits.js.map +1 -0
  151. package/lib/prompts.d.ts +131 -0
  152. package/lib/prompts.js +295 -0
  153. package/lib/prompts.js.map +1 -0
  154. package/lib/skill.d.ts +100 -0
  155. package/lib/skill.js +181 -0
  156. package/lib/skill.js.map +1 -0
  157. package/lib/tool-defs.d.ts +72 -0
  158. package/lib/tool-defs.js +67 -0
  159. package/lib/tool-defs.js.map +1 -0
  160. package/lib/tools.d.ts +19 -4
  161. package/lib/tools.js +124 -922
  162. package/lib/tools.js.map +1 -1
  163. package/package.json +15 -11
  164. package/scripts/check-host-rpc.mjs +11 -4
  165. package/scripts/dump-prompts.mjs +29 -0
  166. package/scripts/measure-tool-surface.mjs +190 -0
  167. package/lib/settings-scope.d.ts +0 -56
  168. package/lib/settings-scope.js +0 -51
  169. package/lib/settings-scope.js.map +0 -1
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Length caps of the `prompts` overrides. A module of its own (no imports) so the settings panel, which is built
3
+ * for the browser, can validate against the same numbers the plugin enforces.
4
+ * @module dsh-browser/prompt-limits
5
+ */
6
+ /** A `prompts.skill.bodyFile` larger than this many characters is not used. */
7
+ export declare const SKILL_BODY_FILE_LIMIT = 20000;
8
+ /** Length caps (in characters) of each kind of override. A longer value is ignored, not truncated. */
9
+ export declare const PROMPT_LIMITS: {
10
+ /** A group or action summary: one line of the catalog. */
11
+ readonly summary: 300;
12
+ /** The extra guidance of an action or sub-action. */
13
+ readonly notes: 1000;
14
+ /** The text of a detail topic (`observe.read.controls`), which is a page of its own. */
15
+ readonly topicText: 3500;
16
+ /** A tool description (`prompts.tools.<tool>.description`). */
17
+ readonly description: 1500;
18
+ /** The compact guide that replaces the skill pointer at the root. */
19
+ readonly rootGuide: 1500;
20
+ /** The deployer's note at the end of the root. */
21
+ readonly rootNote: 800;
22
+ /** The hint of one error code. */
23
+ readonly errorHint: 600;
24
+ /** The skill's description in the skill list. */
25
+ readonly skillDescription: 1000;
26
+ /** Text appended to the skill body. */
27
+ readonly skillAppend: 4000;
28
+ /** A `skill.bodyFile` larger than this falls back to the packaged body. */
29
+ readonly skillBodyFile: 20000;
30
+ };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Length caps of the `prompts` overrides. A module of its own (no imports) so the settings panel, which is built
3
+ * for the browser, can validate against the same numbers the plugin enforces.
4
+ * @module dsh-browser/prompt-limits
5
+ */
6
+ /** A `prompts.skill.bodyFile` larger than this many characters is not used. */
7
+ export const SKILL_BODY_FILE_LIMIT = 20_000;
8
+ /** Length caps (in characters) of each kind of override. A longer value is ignored, not truncated. */
9
+ export const PROMPT_LIMITS = {
10
+ /** A group or action summary: one line of the catalog. */
11
+ summary: 300,
12
+ /** The extra guidance of an action or sub-action. */
13
+ notes: 1000,
14
+ /** The text of a detail topic (`observe.read.controls`), which is a page of its own. */
15
+ topicText: 3500,
16
+ /** A tool description (`prompts.tools.<tool>.description`). */
17
+ description: 1500,
18
+ /** The compact guide that replaces the skill pointer at the root. */
19
+ rootGuide: 1500,
20
+ /** The deployer's note at the end of the root. */
21
+ rootNote: 800,
22
+ /** The hint of one error code. */
23
+ errorHint: 600,
24
+ /** The skill's description in the skill list. */
25
+ skillDescription: 1000,
26
+ /** Text appended to the skill body. */
27
+ skillAppend: 4000,
28
+ /** A `skill.bodyFile` larger than this falls back to the packaged body. */
29
+ skillBodyFile: SKILL_BODY_FILE_LIMIT,
30
+ };
31
+ //# sourceMappingURL=prompt-limits.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt-limits.js","sourceRoot":"","sources":["../src/prompt-limits.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,+EAA+E;AAC/E,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAA;AAE3C,sGAAsG;AACtG,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,0DAA0D;IAC1D,OAAO,EAAE,GAAG;IACZ,qDAAqD;IACrD,KAAK,EAAE,IAAI;IACX,wFAAwF;IACxF,SAAS,EAAE,IAAI;IACf,+DAA+D;IAC/D,WAAW,EAAE,IAAI;IACjB,qEAAqE;IACrE,SAAS,EAAE,IAAI;IACf,kDAAkD;IAClD,QAAQ,EAAE,GAAG;IACb,kCAAkC;IAClC,SAAS,EAAE,GAAG;IACd,iDAAiD;IACjD,gBAAgB,EAAE,IAAI;IACtB,uCAAuC;IACvC,WAAW,EAAE,IAAI;IACjB,2EAA2E;IAC3E,aAAa,EAAE,qBAAqB;CAC5B,CAAA"}
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Deployment overrides of the model-facing text (`prompts` configuration).
3
+ *
4
+ * Every sentence the model reads that is guidance rather than contract can be replaced by the
5
+ * deployer: the two L0 tool descriptions, the root guide, group and action summaries and notes,
6
+ * error hints, and the `dsh-browser` skill. Names, parameter schemas, error codes, approval
7
+ * wording and the compliance notice are NOT configurable.
8
+ *
9
+ * This module is the one place that knows the shape: it validates a raw `prompts` value into
10
+ * {@link ResolvedPrompts} (never throwing: bad entries are dropped and reported as diagnostics),
11
+ * lists the built-in defaults in the same shape ({@link defaultPrompts}, behind `prompts:dump`),
12
+ * and measures what an override does to the context budget.
13
+ * @module dsh-browser/prompts
14
+ */
15
+ import { type ActionGroup } from './actions/types.ts';
16
+ import { CHARS_PER_TOKEN } from './tool-defs.ts';
17
+ import { PROMPT_LIMITS } from './prompt-limits.ts';
18
+ import type { AutomationMode, ExposureOptions } from './freedom.ts';
19
+ export { PROMPT_LIMITS };
20
+ /** Context budgets from the tool-system design (estimated tokens = characters / 3.5, as `measure:tools` counts). */
21
+ export { CHARS_PER_TOKEN };
22
+ export declare const L0_BUDGET_TOKENS = 1500;
23
+ export declare const LAYER_BUDGET_TOKENS = 1000;
24
+ export type PromptDiagnosticCode = 'invalid-type' | 'too-long' | 'unknown-key' | 'unknown-group' | 'unknown-action' | 'unknown-error-code' | 'not-overridable' | 'relative-body-file' | 'body-file' | 'budget-l0' | 'budget-layer';
25
+ export interface PromptDiagnostic {
26
+ level: 'warn' | 'info';
27
+ code: PromptDiagnosticCode;
28
+ /** The configuration key the entry is about, e.g. `actions.act.click.summary`. */
29
+ key: string;
30
+ message: string;
31
+ }
32
+ /** One accepted override, by key and length only (the text itself is never echoed back). */
33
+ export interface AppliedPrompt {
34
+ key: string;
35
+ length?: number;
36
+ }
37
+ /** The validated, effective overrides. Absent members mean "use the built-in text". */
38
+ export interface ResolvedPrompts {
39
+ tools: {
40
+ browser_index?: string;
41
+ browser_call?: string;
42
+ };
43
+ rootGuide?: string;
44
+ rootNote?: string;
45
+ groups: Partial<Record<ActionGroup, string>>;
46
+ /** Keyed by `group.action`, `group.action.sub` or `group.action.topic`; a topic's `notes` is its detail text. */
47
+ actions: Record<string, {
48
+ summary?: string;
49
+ notes?: string;
50
+ }>;
51
+ errorHints: Partial<Record<string, string>>;
52
+ skill: {
53
+ enabled: boolean;
54
+ description?: string;
55
+ bodyFile?: string;
56
+ append?: string;
57
+ };
58
+ applied: AppliedPrompt[];
59
+ diagnostics: PromptDiagnostic[];
60
+ }
61
+ /** The overrides of nothing: what the plugin uses when `prompts` is not configured. */
62
+ export declare const NO_PROMPTS: ResolvedPrompts;
63
+ /** The error codes whose hint has one fixed text, and so can be replaced. */
64
+ export declare const OVERRIDABLE_ERROR_CODES: readonly string[];
65
+ /**
66
+ * Validate a raw `prompts` value. Never throws: a malformed or unknown entry is left out and described in
67
+ * `diagnostics`; everything else still applies.
68
+ */
69
+ export declare function resolvePrompts(raw: unknown): ResolvedPrompts;
70
+ /** A live view of the configured overrides. `current()` re-reads the config each time, so a change applies to the next call. */
71
+ export interface PromptsSource {
72
+ current(): ResolvedPrompts;
73
+ }
74
+ /**
75
+ * Wrap a reader of the raw `prompts` value. The result is cached by the identity of what the reader returns, so
76
+ * an unchanged config costs nothing per call while a changed one (a volatile reference holds a new snapshot after
77
+ * every write) is validated again.
78
+ */
79
+ export declare function promptsSource(read: () => unknown): PromptsSource;
80
+ /** A source that never overrides anything. */
81
+ export declare const NO_PROMPTS_SOURCE: PromptsSource;
82
+ /**
83
+ * Every overridable text with its built-in value, in the exact structure of the `prompts` configuration. Pasted back
84
+ * as the configuration it changes nothing (a blank `notes`, `rootNote` or `append` means "none"), which makes it the
85
+ * starting point for editing: delete what stays default, reword the rest.
86
+ */
87
+ export declare function defaultPrompts(): Record<string, unknown>;
88
+ /**
89
+ * The text `prompts:dump` prints and the settings card's "Export default text" shows: {@link defaultPrompts} as JSON,
90
+ * two-space indented unless `compact`. One function, so the script and the card cannot drift apart.
91
+ */
92
+ export declare function promptsDumpText(compact?: boolean): string;
93
+ export interface PromptBudget {
94
+ /** Estimated tokens of the two L0 tools (name + description + parameters, as the host sends them). */
95
+ l0Tokens: number;
96
+ l0Budget: number;
97
+ layerBudget: number;
98
+ /** The largest browser_index layer (root, a group, an action, a sub-action or a topic). */
99
+ largestLayer: {
100
+ name: string;
101
+ tokens: number;
102
+ };
103
+ /** Every layer over the per-layer budget. */
104
+ overBudget: {
105
+ name: string;
106
+ tokens: number;
107
+ }[];
108
+ }
109
+ export interface BudgetEnvironment {
110
+ mode: AutomationMode;
111
+ options: ExposureOptions;
112
+ enabled: boolean;
113
+ }
114
+ /** Measure the L0 tools and every browser_index layer under these overrides. */
115
+ export declare function measurePromptBudget(prompts: ResolvedPrompts, environment: BudgetEnvironment): PromptBudget;
116
+ export interface PromptsStatus {
117
+ /** The overrides in force, by key and length. */
118
+ overrides: AppliedPrompt[];
119
+ /** Everything ignored or worth a warning, including budget overruns. */
120
+ diagnostics: PromptDiagnostic[];
121
+ budget: PromptBudget;
122
+ skill: {
123
+ enabled: boolean;
124
+ body: 'packaged' | 'file';
125
+ bodyFile?: string;
126
+ };
127
+ }
128
+ /** What `runtime.status` reports under `prompts`, and the settings panel shows. Reads the live configuration. */
129
+ export declare function describePrompts(config: {
130
+ prompts?: PromptsSource;
131
+ } & BudgetEnvironment): PromptsStatus;
package/lib/prompts.js ADDED
@@ -0,0 +1,295 @@
1
+ /**
2
+ * Deployment overrides of the model-facing text (`prompts` configuration).
3
+ *
4
+ * Every sentence the model reads that is guidance rather than contract can be replaced by the
5
+ * deployer: the two L0 tool descriptions, the root guide, group and action summaries and notes,
6
+ * error hints, and the `dsh-browser` skill. Names, parameter schemas, error codes, approval
7
+ * wording and the compliance notice are NOT configurable.
8
+ *
9
+ * This module is the one place that knows the shape: it validates a raw `prompts` value into
10
+ * {@link ResolvedPrompts} (never throwing: bad entries are dropped and reported as diagnostics),
11
+ * lists the built-in defaults in the same shape ({@link defaultPrompts}, behind `prompts:dump`),
12
+ * and measures what an override does to the context budget.
13
+ * @module dsh-browser/prompts
14
+ */
15
+ import path from 'node:path';
16
+ import { ACTIONS, GROUP_SUMMARIES, findAction, findSubAction, findTopic } from "./actions/registry.js";
17
+ import { ACTION_GROUPS, ERROR_CODES } from "./actions/types.js";
18
+ import { DEFAULT_ERROR_HINTS } from "./actions/errors.js";
19
+ import { COMPACT_GUIDE, renderIndex } from "./actions/index-view.js";
20
+ import { CHARS_PER_TOKEN, DEFAULT_CALL_DESCRIPTION, DEFAULT_INDEX_DESCRIPTION, PROMPT_TOOL_NAMES, estimateTokens, indexedToolDefinitions, modelFacingChars } from "./tool-defs.js";
21
+ import { readSkill, loadSkillBodyFile } from "./skill.js";
22
+ import { PROMPT_LIMITS } from "./prompt-limits.js";
23
+ export { PROMPT_LIMITS };
24
+ /** Context budgets from the tool-system design (estimated tokens = characters / 3.5, as `measure:tools` counts). */
25
+ export { CHARS_PER_TOKEN };
26
+ export const L0_BUDGET_TOKENS = 1500;
27
+ export const LAYER_BUDGET_TOKENS = 1000;
28
+ /** The overrides of nothing: what the plugin uses when `prompts` is not configured. */
29
+ export const NO_PROMPTS = Object.freeze({
30
+ tools: Object.freeze({}), groups: Object.freeze({}), actions: Object.freeze({}), errorHints: Object.freeze({}),
31
+ skill: Object.freeze({ enabled: true }), applied: Object.freeze([]), diagnostics: Object.freeze([]),
32
+ });
33
+ /** The error codes whose hint has one fixed text, and so can be replaced. */
34
+ export const OVERRIDABLE_ERROR_CODES = Object.keys(DEFAULT_ERROR_HINTS);
35
+ function isRecord(value) {
36
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
37
+ }
38
+ /**
39
+ * Validate a raw `prompts` value. Never throws: a malformed or unknown entry is left out and described in
40
+ * `diagnostics`; everything else still applies.
41
+ */
42
+ export function resolvePrompts(raw) {
43
+ if (raw === undefined || raw === null)
44
+ return NO_PROMPTS;
45
+ const diagnostics = [];
46
+ const applied = [];
47
+ const warn = (code, key, message) => { diagnostics.push({ level: 'warn', code, key, message }); };
48
+ if (!isRecord(raw)) {
49
+ warn('invalid-type', 'prompts', 'prompts must be an object; ignored');
50
+ return { ...NO_PROMPTS, diagnostics };
51
+ }
52
+ /** A text override: blank means "use the default"; a wrong type or an over-long value is ignored. */
53
+ const text = (value, key, limit) => {
54
+ if (value === undefined || value === null)
55
+ return undefined;
56
+ if (typeof value !== 'string') {
57
+ warn('invalid-type', key, `${key} must be a string; ignored`);
58
+ return undefined;
59
+ }
60
+ if (value.trim() === '')
61
+ return undefined;
62
+ if (value.length > limit) {
63
+ warn('too-long', key, `${key} is ${value.length} characters, over the limit of ${limit}; ignored`);
64
+ return undefined;
65
+ }
66
+ applied.push({ key, length: value.length });
67
+ return value;
68
+ };
69
+ const unknownKeys = (value, allowed, prefix) => {
70
+ for (const name of Object.keys(value))
71
+ if (!allowed.includes(name))
72
+ warn('unknown-key', prefix ? `${prefix}.${name}` : name, `${prefix ? `${prefix}.${name}` : name} is not a prompts key; ignored`);
73
+ };
74
+ const section = (value, key) => {
75
+ if (value === undefined || value === null)
76
+ return undefined;
77
+ if (!isRecord(value)) {
78
+ warn('invalid-type', key, `${key} must be an object; ignored`);
79
+ return undefined;
80
+ }
81
+ return value;
82
+ };
83
+ unknownKeys(raw, ['tools', 'rootGuide', 'rootNote', 'groups', 'actions', 'errorHints', 'skill'], '');
84
+ const tools = {};
85
+ const toolsRaw = section(raw.tools, 'tools');
86
+ if (toolsRaw) {
87
+ unknownKeys(toolsRaw, PROMPT_TOOL_NAMES, 'tools');
88
+ for (const name of PROMPT_TOOL_NAMES) {
89
+ const entry = section(toolsRaw[name], `tools.${name}`);
90
+ if (!entry)
91
+ continue;
92
+ unknownKeys(entry, ['description'], `tools.${name}`);
93
+ const description = text(entry.description, `tools.${name}.description`, PROMPT_LIMITS.description);
94
+ if (description !== undefined)
95
+ tools[name] = description;
96
+ }
97
+ }
98
+ const rootGuide = text(raw.rootGuide, 'rootGuide', PROMPT_LIMITS.rootGuide);
99
+ const rootNote = text(raw.rootNote, 'rootNote', PROMPT_LIMITS.rootNote);
100
+ const groups = {};
101
+ const groupsRaw = section(raw.groups, 'groups');
102
+ if (groupsRaw) {
103
+ for (const [name, value] of Object.entries(groupsRaw)) {
104
+ if (!ACTION_GROUPS.includes(name)) {
105
+ warn('unknown-group', `groups.${name}`, `groups.${name}: no such group (groups: ${ACTION_GROUPS.join(', ')}); ignored`);
106
+ continue;
107
+ }
108
+ const entry = section(value, `groups.${name}`);
109
+ if (!entry)
110
+ continue;
111
+ unknownKeys(entry, ['summary'], `groups.${name}`);
112
+ const summary = text(entry.summary, `groups.${name}.summary`, PROMPT_LIMITS.summary);
113
+ if (summary !== undefined)
114
+ groups[name] = summary;
115
+ }
116
+ }
117
+ const actions = {};
118
+ const actionsRaw = section(raw.actions, 'actions');
119
+ if (actionsRaw) {
120
+ for (const [name, value] of Object.entries(actionsRaw)) {
121
+ if (!findAction(name) && !findSubAction(name) && !findTopic(name)) {
122
+ warn('unknown-action', `actions.${name}`, `actions.${name}: no such action, sub-action or detail topic; ignored`);
123
+ continue;
124
+ }
125
+ const entry = section(value, `actions.${name}`);
126
+ if (!entry)
127
+ continue;
128
+ unknownKeys(entry, ['summary', 'notes'], `actions.${name}`);
129
+ const summary = text(entry.summary, `actions.${name}.summary`, PROMPT_LIMITS.summary);
130
+ const topicOnly = !findAction(name) && !findSubAction(name);
131
+ const notes = text(entry.notes, `actions.${name}.notes`, topicOnly ? PROMPT_LIMITS.topicText : PROMPT_LIMITS.notes);
132
+ if (summary !== undefined || notes !== undefined)
133
+ actions[name] = { ...summary !== undefined ? { summary } : {}, ...notes !== undefined ? { notes } : {} };
134
+ }
135
+ }
136
+ const errorHints = {};
137
+ const hintsRaw = section(raw.errorHints, 'errorHints');
138
+ if (hintsRaw) {
139
+ for (const [code, value] of Object.entries(hintsRaw)) {
140
+ if (!ERROR_CODES.includes(code)) {
141
+ warn('unknown-error-code', `errorHints.${code}`, `errorHints.${code}: not an error code; ignored`);
142
+ continue;
143
+ }
144
+ if (!OVERRIDABLE_ERROR_CODES.includes(code)) {
145
+ warn('not-overridable', `errorHints.${code}`, `errorHints.${code}: this code has no fixed hint to replace (overridable: ${OVERRIDABLE_ERROR_CODES.join(', ')}); ignored`);
146
+ continue;
147
+ }
148
+ const hint = text(value, `errorHints.${code}`, PROMPT_LIMITS.errorHint);
149
+ if (hint !== undefined)
150
+ errorHints[code] = hint;
151
+ }
152
+ }
153
+ const skill = { enabled: true };
154
+ const skillRaw = section(raw.skill, 'skill');
155
+ if (skillRaw) {
156
+ unknownKeys(skillRaw, ['enabled', 'description', 'bodyFile', 'append'], 'skill');
157
+ if (skillRaw.enabled !== undefined && skillRaw.enabled !== null) {
158
+ if (typeof skillRaw.enabled !== 'boolean')
159
+ warn('invalid-type', 'skill.enabled', 'skill.enabled must be true or false; ignored');
160
+ else {
161
+ skill.enabled = skillRaw.enabled;
162
+ if (!skill.enabled)
163
+ applied.push({ key: 'skill.enabled' });
164
+ }
165
+ }
166
+ const description = text(skillRaw.description, 'skill.description', PROMPT_LIMITS.skillDescription);
167
+ if (description !== undefined)
168
+ skill.description = description;
169
+ const append = text(skillRaw.append, 'skill.append', PROMPT_LIMITS.skillAppend);
170
+ if (append !== undefined)
171
+ skill.append = append;
172
+ if (skillRaw.bodyFile !== undefined && skillRaw.bodyFile !== null) {
173
+ if (typeof skillRaw.bodyFile !== 'string')
174
+ warn('invalid-type', 'skill.bodyFile', 'skill.bodyFile must be a string; ignored');
175
+ else if (skillRaw.bodyFile.trim() !== '') {
176
+ if (!path.isAbsolute(skillRaw.bodyFile))
177
+ warn('relative-body-file', 'skill.bodyFile', 'skill.bodyFile must be an absolute path; the packaged body is used');
178
+ else {
179
+ skill.bodyFile = skillRaw.bodyFile;
180
+ applied.push({ key: 'skill.bodyFile', length: skillRaw.bodyFile.length });
181
+ }
182
+ }
183
+ }
184
+ }
185
+ const empty = !Object.keys(tools).length && rootGuide === undefined && rootNote === undefined && !Object.keys(groups).length
186
+ && !Object.keys(actions).length && !Object.keys(errorHints).length && applied.length === 0;
187
+ if (empty && diagnostics.length === 0)
188
+ return NO_PROMPTS;
189
+ return {
190
+ tools, ...rootGuide !== undefined ? { rootGuide } : {}, ...rootNote !== undefined ? { rootNote } : {},
191
+ groups, actions, errorHints, skill, applied, diagnostics,
192
+ };
193
+ }
194
+ /**
195
+ * Wrap a reader of the raw `prompts` value. The result is cached by the identity of what the reader returns, so
196
+ * an unchanged config costs nothing per call while a changed one (a volatile reference holds a new snapshot after
197
+ * every write) is validated again.
198
+ */
199
+ export function promptsSource(read) {
200
+ let last;
201
+ let resolved;
202
+ return {
203
+ current() {
204
+ const raw = read();
205
+ if (resolved === undefined || raw !== last) {
206
+ last = raw;
207
+ resolved = resolvePrompts(raw);
208
+ }
209
+ return resolved;
210
+ },
211
+ };
212
+ }
213
+ /** A source that never overrides anything. */
214
+ export const NO_PROMPTS_SOURCE = { current: () => NO_PROMPTS };
215
+ // --- defaults, in the shape of the configuration ---------------------------------------------------------------
216
+ /** The sub-actions and detail topics of an action, as the keys `prompts.actions` addresses them by. */
217
+ function* promptTargets() {
218
+ for (const action of ACTIONS) {
219
+ yield { key: action.name, summary: action.summary, notes: action.notes ?? '' };
220
+ for (const [sub, def] of Object.entries(action.subActions?.items ?? {}))
221
+ yield { key: `${action.name}.${sub}`, summary: def.summary, notes: def.notes ?? '' };
222
+ for (const [topic, def] of Object.entries(action.topics ?? {}))
223
+ yield { key: `${action.name}.${topic}`, summary: def.summary, notes: def.text };
224
+ }
225
+ }
226
+ /**
227
+ * Every overridable text with its built-in value, in the exact structure of the `prompts` configuration. Pasted back
228
+ * as the configuration it changes nothing (a blank `notes`, `rootNote` or `append` means "none"), which makes it the
229
+ * starting point for editing: delete what stays default, reword the rest.
230
+ */
231
+ export function defaultPrompts() {
232
+ const skill = readSkill();
233
+ return {
234
+ tools: {
235
+ browser_index: { description: DEFAULT_INDEX_DESCRIPTION },
236
+ browser_call: { description: DEFAULT_CALL_DESCRIPTION },
237
+ },
238
+ rootGuide: COMPACT_GUIDE,
239
+ rootNote: '',
240
+ groups: Object.fromEntries(ACTION_GROUPS.map(group => [group, { summary: GROUP_SUMMARIES[group] }])),
241
+ actions: Object.fromEntries([...promptTargets()].map(target => [target.key, { summary: target.summary, notes: target.notes }])),
242
+ errorHints: { ...DEFAULT_ERROR_HINTS },
243
+ skill: { enabled: true, description: skill.description, bodyFile: '', append: '' },
244
+ };
245
+ }
246
+ /**
247
+ * The text `prompts:dump` prints and the settings card's "Export default text" shows: {@link defaultPrompts} as JSON,
248
+ * two-space indented unless `compact`. One function, so the script and the card cannot drift apart.
249
+ */
250
+ export function promptsDumpText(compact = false) {
251
+ return JSON.stringify(defaultPrompts(), null, compact ? 0 : 2);
252
+ }
253
+ // --- budget and status -----------------------------------------------------------------------------------------
254
+ const tokensOf = estimateTokens;
255
+ /** Measure the L0 tools and every browser_index layer under these overrides. */
256
+ export function measurePromptBudget(prompts, environment) {
257
+ const l0Chars = modelFacingChars(indexedToolDefinitions(prompts.tools));
258
+ const env = (skillAvailable) => ({ mode: environment.mode, options: environment.options, enabled: environment.enabled, skillAvailable, prompts });
259
+ const layers = [
260
+ { name: 'root', tokens: tokensOf(renderIndex({}, env(false)).text.length) },
261
+ { name: 'root (skill present)', tokens: tokensOf(renderIndex({}, env(true)).text.length) },
262
+ ];
263
+ for (const group of ACTION_GROUPS)
264
+ layers.push({ name: group, tokens: tokensOf(renderIndex({ group }, env(true)).text.length) });
265
+ for (const target of promptTargets())
266
+ layers.push({ name: target.key, tokens: tokensOf(renderIndex({ action: target.key }, env(true)).text.length) });
267
+ const largest = layers.reduce((best, layer) => layer.tokens > best.tokens ? layer : best);
268
+ return {
269
+ l0Tokens: tokensOf(l0Chars), l0Budget: L0_BUDGET_TOKENS, layerBudget: LAYER_BUDGET_TOKENS,
270
+ largestLayer: largest, overBudget: layers.filter(layer => layer.tokens > LAYER_BUDGET_TOKENS),
271
+ };
272
+ }
273
+ /** What `runtime.status` reports under `prompts`, and the settings panel shows. Reads the live configuration. */
274
+ export function describePrompts(config) {
275
+ const prompts = config.prompts?.current() ?? NO_PROMPTS;
276
+ const diagnostics = [...prompts.diagnostics];
277
+ const budget = measurePromptBudget(prompts, config);
278
+ if (budget.l0Tokens > L0_BUDGET_TOKENS)
279
+ diagnostics.push({ level: 'warn', code: 'budget-l0', key: 'tools', message: `the always-on L0 tools are ~${budget.l0Tokens} tokens, over the ${L0_BUDGET_TOKENS} budget` });
280
+ for (const layer of budget.overBudget)
281
+ diagnostics.push({ level: 'warn', code: 'budget-layer', key: layer.name, message: `browser_index layer "${layer.name}" is ~${layer.tokens} tokens, over the ${LAYER_BUDGET_TOKENS} per-layer budget` });
282
+ let body = 'packaged';
283
+ if (prompts.skill.bodyFile) {
284
+ const loaded = loadSkillBodyFile(prompts.skill.bodyFile);
285
+ if (loaded.ok)
286
+ body = 'file';
287
+ else
288
+ diagnostics.push({ level: 'warn', code: 'body-file', key: 'skill.bodyFile', message: `${loaded.reason}; the packaged skill body is used` });
289
+ }
290
+ return {
291
+ overrides: [...prompts.applied], diagnostics, budget,
292
+ skill: { enabled: prompts.skill.enabled, body, ...prompts.skill.bodyFile ? { bodyFile: prompts.skill.bodyFile } : {} },
293
+ };
294
+ }
295
+ //# sourceMappingURL=prompts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACtG,OAAO,EAAE,aAAa,EAAE,WAAW,EAAoB,MAAM,oBAAoB,CAAA;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAyB,MAAM,yBAAyB,CAAA;AAC3F,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,cAAc,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAClL,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAGlD,OAAO,EAAE,aAAa,EAAE,CAAA;AAExB,oHAAoH;AACpH,OAAO,EAAE,eAAe,EAAE,CAAA;AAC1B,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAA;AACpC,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAA;AAkCvC,uFAAuF;AACvF,MAAM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EAAE,GAAG,EAAE,gBAAgB,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,MAAM,mCAAmC,EAAE,CAAC,CAAA;IAClJ,CAAC;IACD,OAAO;QACL,SAAS,EAAE,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,MAAM;QACpD,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;KACvH,CAAA;AACH,CAAC"}
package/lib/skill.d.ts ADDED
@@ -0,0 +1,100 @@
1
+ /**
2
+ * The bundled `dsh-browser` skill: usage guidance for the browser tools.
3
+ *
4
+ * The skill is registered with the Host's skill registry when that service
5
+ * exists. It must never be a hard dependency of the plugin: Cordis 4.0.4 treats
6
+ * every declared `inject` as required, so a missing `skills` service would hang
7
+ * the whole plugin. The plugin therefore asks for it through a scoped
8
+ * `ctx.inject(['skills'], …)` and works the same without it.
9
+ * @module dsh-browser/skill
10
+ */
11
+ import type { Context } from '@deepseek-ai/cordis';
12
+ import type { PromptsSource } from './prompts.ts';
13
+ import { SKILL_BODY_FILE_LIMIT } from './prompt-limits.ts';
14
+ export declare const SKILL_NAME = "dsh-browser";
15
+ /** `assets/skills/dsh-browser/`, resolved next to `src/` or the built `lib/`. */
16
+ export declare const SKILL_DIR: string;
17
+ /** Parse `name` and `description` out of a SKILL.md and return the body without the front matter. */
18
+ export declare function parseSkillFile(raw: string): {
19
+ name: string;
20
+ description: string;
21
+ body: string;
22
+ };
23
+ export declare function readSkill(dir?: string): {
24
+ name: string;
25
+ description: string;
26
+ body: string;
27
+ };
28
+ export { SKILL_BODY_FILE_LIMIT };
29
+ /**
30
+ * Read a replacement skill body. A leading front matter block is dropped (the name and description come from the
31
+ * packaged file or `prompts.skill.description`). Never throws: a missing, unreadable, empty or oversized file is
32
+ * reported as a reason, and the caller falls back to the packaged body.
33
+ */
34
+ export declare function loadSkillBodyFile(file: string): {
35
+ ok: true;
36
+ body: string;
37
+ } | {
38
+ ok: false;
39
+ reason: string;
40
+ };
41
+ /** What the skill says right now: the packaged file with the `prompts.skill` overrides applied. */
42
+ export declare function currentSkill(dir?: string, prompts?: PromptsSource): {
43
+ name: string;
44
+ description: string;
45
+ body: string;
46
+ };
47
+ /**
48
+ * A provider object shaped like the Host's `SkillProvider` (declared locally to avoid a build-time dependency).
49
+ * It reads the packaged file and the `prompts.skill` overrides on every call, so it is never stale.
50
+ */
51
+ export declare function createSkillProvider(dir?: string, prompts?: PromptsSource): {
52
+ name: string;
53
+ list: () => Promise<{
54
+ name: string;
55
+ description: string;
56
+ invocation: {
57
+ modelInvocable: boolean;
58
+ userInvocable: boolean;
59
+ };
60
+ provider: string;
61
+ source: string;
62
+ resourceBase: {
63
+ kind: "directory";
64
+ path: string;
65
+ };
66
+ rank: number;
67
+ locator: string;
68
+ }[]>;
69
+ get: () => Promise<{
70
+ name: string;
71
+ description: string;
72
+ invocation: {
73
+ modelInvocable: boolean;
74
+ userInvocable: boolean;
75
+ };
76
+ provider: string;
77
+ source: string;
78
+ resourceBase: {
79
+ kind: "directory";
80
+ path: string;
81
+ };
82
+ content: string;
83
+ }>;
84
+ };
85
+ export interface SkillRegistration {
86
+ /** Whether the skill is registered with the Host right now (false without a skill service, or when disabled). */
87
+ isAvailable: () => boolean;
88
+ /**
89
+ * Bring the registration in line with the current `prompts.skill`: register or withdraw the provider when `enabled`
90
+ * changed, and tell the Host (`invalidate()`) when the description, body file or appended text changed. Cheap; the
91
+ * tools call it on every use, which is how a config edit reaches the skill without a restart.
92
+ */
93
+ refresh: () => void;
94
+ }
95
+ /**
96
+ * Register the skill when the Host provides a skill registry, and track whether
97
+ * it is registered so the index can fall back to its compact guide otherwise.
98
+ * With `prompts.skill.enabled=false` nothing is registered.
99
+ */
100
+ export declare function registerSkillWhenAvailable(ctx: Context, dir?: string, prompts?: PromptsSource): SkillRegistration;