@dsh-enhanced/assistant-policy 0.1.65 → 0.1.67
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/README.md +78 -10
- package/bin/dsh-plugin-setup.js +7 -0
- package/lib/approval-reviewer.d.ts +2 -0
- package/lib/approval-reviewer.d.ts.map +1 -1
- package/lib/approval-reviewer.js +10 -13
- package/lib/approval-reviewer.js.map +1 -1
- package/lib/auto-review.d.ts.map +1 -1
- package/lib/auto-review.js +6 -2
- package/lib/auto-review.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/permission-setup.d.ts +1 -1
- package/lib/permission-setup.d.ts.map +1 -1
- package/lib/permission-setup.js +13 -6
- package/lib/permission-setup.js.map +1 -1
- package/lib/plugin-setup.d.ts +167 -0
- package/lib/plugin-setup.d.ts.map +1 -0
- package/lib/plugin-setup.js +975 -0
- package/lib/plugin-setup.js.map +1 -0
- package/lib/profile-setup.d.ts +5 -1
- package/lib/profile-setup.d.ts.map +1 -1
- package/lib/profile-setup.js +9 -6
- package/lib/profile-setup.js.map +1 -1
- package/lib/service.d.ts +19 -17
- package/lib/service.d.ts.map +1 -1
- package/lib/service.js +151 -58
- package/lib/service.js.map +1 -1
- package/lib/types.d.ts +6 -1
- package/lib/types.d.ts.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +13 -8
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { type EffectiveProfileDumpReader } from './profile-setup.js';
|
|
2
|
+
export interface PluginSetupTarget {
|
|
3
|
+
dshHome: string;
|
|
4
|
+
/** Omit to use `DSH_PROFILE` or the only profile under `$DSH_HOME/profiles`. */
|
|
5
|
+
profile?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface PluginSetupOptions {
|
|
8
|
+
/** Test seam; defaults to the approved Host `--dump-config`. */
|
|
9
|
+
readDump?: EffectiveProfileDumpReader;
|
|
10
|
+
/** Compute and report the change without writing. */
|
|
11
|
+
dryRun?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface ProfilePluginSummary {
|
|
14
|
+
id: string;
|
|
15
|
+
slug: string;
|
|
16
|
+
packageName: string;
|
|
17
|
+
/** Loader row gate (`disabled: true` means the plugin is not loaded). */
|
|
18
|
+
loaded: boolean;
|
|
19
|
+
/** Top-level `enabled` config gate when the plugin has one. */
|
|
20
|
+
enabled?: boolean;
|
|
21
|
+
/** Feature flags: top-level `*Enabled` booleans and one-level `<key>.enabled`. */
|
|
22
|
+
flags: Record<string, boolean>;
|
|
23
|
+
/** True when the profile patch already overrides this row. */
|
|
24
|
+
overridden: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface PluginChange {
|
|
27
|
+
id: string;
|
|
28
|
+
key: string;
|
|
29
|
+
from: unknown;
|
|
30
|
+
to: unknown;
|
|
31
|
+
}
|
|
32
|
+
export interface PluginSkip {
|
|
33
|
+
id: string;
|
|
34
|
+
reason: string;
|
|
35
|
+
}
|
|
36
|
+
export interface PluginWriteResult {
|
|
37
|
+
profile: string;
|
|
38
|
+
patchPath: string;
|
|
39
|
+
changed: boolean;
|
|
40
|
+
dryRun: boolean;
|
|
41
|
+
changes: PluginChange[];
|
|
42
|
+
skipped: PluginSkip[];
|
|
43
|
+
}
|
|
44
|
+
export declare function resolvePluginProfile(target: PluginSetupTarget): Promise<string>;
|
|
45
|
+
/** Secret-bearing key names; handles/env names/paths/ttls are not secrets. */
|
|
46
|
+
export declare function isSecretConfigKey(name: string): boolean;
|
|
47
|
+
/** Map `work-items`, `assistant-work-items`, `@dsh-enhanced/assistant-work-items` or the row id to an installed row id. */
|
|
48
|
+
export declare function resolvePluginId(name: string, installed: Iterable<string>): string | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Convert a CLI string to the type of the current effective value. Unknown keys
|
|
51
|
+
* need `force`; documented optional keys are typed from a small table.
|
|
52
|
+
*/
|
|
53
|
+
export declare function coerceConfigValue(id: string, key: string, raw: string, current: unknown, force?: boolean): unknown;
|
|
54
|
+
export declare function listProfilePlugins(target: PluginSetupTarget, options?: PluginSetupOptions): Promise<{
|
|
55
|
+
profile: string;
|
|
56
|
+
patchPath: string;
|
|
57
|
+
plugins: ProfilePluginSummary[];
|
|
58
|
+
}>;
|
|
59
|
+
/** Effective config of one plugin with secret-like values redacted. */
|
|
60
|
+
export declare function showProfilePlugin(target: PluginSetupTarget & {
|
|
61
|
+
plugin: string;
|
|
62
|
+
}, options?: PluginSetupOptions): Promise<{
|
|
63
|
+
profile: string;
|
|
64
|
+
summary: ProfilePluginSummary;
|
|
65
|
+
config: string;
|
|
66
|
+
}>;
|
|
67
|
+
/**
|
|
68
|
+
* Enable or disable one plugin: flips the loader row gate and, when the plugin
|
|
69
|
+
* has a top-level `enabled` config gate, that gate too.
|
|
70
|
+
*/
|
|
71
|
+
export declare function setPluginEnabled(target: PluginSetupTarget & {
|
|
72
|
+
plugin: string;
|
|
73
|
+
enabled: boolean;
|
|
74
|
+
}, options?: PluginSetupOptions): Promise<PluginWriteResult>;
|
|
75
|
+
/** Set one config key (dotted path) after validating it against the effective value type. */
|
|
76
|
+
export declare function setPluginConfigValue(target: PluginSetupTarget & {
|
|
77
|
+
plugin: string;
|
|
78
|
+
key: string;
|
|
79
|
+
value: string;
|
|
80
|
+
force?: boolean;
|
|
81
|
+
}, options?: PluginSetupOptions): Promise<PluginWriteResult>;
|
|
82
|
+
/** Remove one config key from the profile override so the plugin default applies. */
|
|
83
|
+
export declare function unsetPluginConfigValue(target: PluginSetupTarget & {
|
|
84
|
+
plugin: string;
|
|
85
|
+
key: string;
|
|
86
|
+
}, options?: PluginSetupOptions): Promise<PluginWriteResult>;
|
|
87
|
+
/**
|
|
88
|
+
* A setting that must already be configured by an owner-facing setup before this
|
|
89
|
+
* preset may turn on the feature that depends on it. The preset never invents
|
|
90
|
+
* model routes, evaluation rules, signed pins or signing keys.
|
|
91
|
+
*/
|
|
92
|
+
export interface PresetRequirement {
|
|
93
|
+
/** Installed plugin (row id, package name or short slug) that owns the setting. */
|
|
94
|
+
plugin: string;
|
|
95
|
+
/** Dotted config path that must already be present in the effective profile. */
|
|
96
|
+
key: string;
|
|
97
|
+
/** Exact value the existing setting must have. Absent means presence only. */
|
|
98
|
+
equals?: boolean | string;
|
|
99
|
+
/** The existing value must be a non-empty array. */
|
|
100
|
+
nonEmptyArray?: boolean;
|
|
101
|
+
/** Extra structural check on the existing value. */
|
|
102
|
+
validate?: (value: unknown) => boolean;
|
|
103
|
+
/** Shown as the skip reason when this requirement is not met. */
|
|
104
|
+
reason: string;
|
|
105
|
+
}
|
|
106
|
+
export interface PresetItem {
|
|
107
|
+
id: string;
|
|
108
|
+
purpose: string;
|
|
109
|
+
set: ReadonlyArray<readonly [key: string, value: boolean | string]>;
|
|
110
|
+
/** Only applied when every requirement is already configured; never generated here. */
|
|
111
|
+
requires?: readonly PresetRequirement[];
|
|
112
|
+
/** Reported as skipped with this reason instead of guessing an ambiguous value. */
|
|
113
|
+
manual?: string;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* The `recommended` preset deliberately turns on opt-in features that stay off
|
|
117
|
+
* by default. It edits only plugins that are installed and loaded, never loads
|
|
118
|
+
* a disabled plugin, never touches credentials, Policy, owner routes or sealed
|
|
119
|
+
* plugin state, and leaves the automations scheduler to the RSI/supervised setup.
|
|
120
|
+
*
|
|
121
|
+
* Settings whose authorization is owner-generated (model route and rules for the
|
|
122
|
+
* intake evaluator, signed background-engineering pins, revision adoption keys)
|
|
123
|
+
* are never guessed: an item either waits for the explicit configuration and is
|
|
124
|
+
* skipped with the concrete reason, or is permanently reported as manual.
|
|
125
|
+
*/
|
|
126
|
+
export declare const recommendedPluginPreset: readonly PresetItem[];
|
|
127
|
+
export declare const pluginPresets: ReadonlyMap<string, readonly PresetItem[]>;
|
|
128
|
+
/**
|
|
129
|
+
* Apply a named plugin preset (default `recommended`) to one profile in a
|
|
130
|
+
* single verified write. Intended for onboarding flows:
|
|
131
|
+
*
|
|
132
|
+
* ```ts
|
|
133
|
+
* import { applyRecommendedPluginPreset } from '@dsh-enhanced/assistant-policy/plugin-setup'
|
|
134
|
+
* const result = await applyRecommendedPluginPreset({ dshHome, profile: 'web' })
|
|
135
|
+
* ```
|
|
136
|
+
*
|
|
137
|
+
* Items whose prerequisites are missing are skipped with a concrete reason
|
|
138
|
+
* instead of being guessed; a manual item is reported as skipped on every run.
|
|
139
|
+
* Idempotent: re-running reports no changes.
|
|
140
|
+
*/
|
|
141
|
+
export declare function applyPluginPreset(target: PluginSetupTarget & {
|
|
142
|
+
preset?: string;
|
|
143
|
+
}, options?: PluginSetupOptions): Promise<PluginWriteResult>;
|
|
144
|
+
/** Onboarding entry point: apply the `recommended` plugin preset. */
|
|
145
|
+
export declare function applyRecommendedPluginPreset(target: PluginSetupTarget, options?: PluginSetupOptions): Promise<PluginWriteResult>;
|
|
146
|
+
export type PluginSetupCommand = 'list' | 'show' | 'enable' | 'disable' | 'set' | 'unset' | 'preset' | 'guided';
|
|
147
|
+
export interface PluginSetupArgs {
|
|
148
|
+
command: PluginSetupCommand;
|
|
149
|
+
positionals: string[];
|
|
150
|
+
dshHome: string;
|
|
151
|
+
profile?: string;
|
|
152
|
+
force: boolean;
|
|
153
|
+
dryRun: boolean;
|
|
154
|
+
yes: boolean;
|
|
155
|
+
json: boolean;
|
|
156
|
+
help: boolean;
|
|
157
|
+
}
|
|
158
|
+
export declare function parsePluginSetupArgs(argv: readonly string[]): PluginSetupArgs;
|
|
159
|
+
export declare function pluginSetupUsage(): string;
|
|
160
|
+
export interface PluginSetupIo {
|
|
161
|
+
write(text: string): void;
|
|
162
|
+
isTTY: boolean;
|
|
163
|
+
/** Ask one question; resolves to the trimmed answer. */
|
|
164
|
+
ask?(question: string): Promise<string>;
|
|
165
|
+
}
|
|
166
|
+
export declare function runPluginSetup(argv?: string[], io?: PluginSetupIo, options?: Omit<PluginSetupOptions, 'dryRun'>): Promise<void>;
|
|
167
|
+
//# sourceMappingURL=plugin-setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-setup.d.ts","sourceRoot":"","sources":["../src/plugin-setup.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,0BAA0B,EAAqC,MAAM,oBAAoB,CAAA;AAsEvG,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,gFAAgF;IAChF,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,gEAAgE;IAChE,QAAQ,CAAC,EAAE,0BAA0B,CAAA;IACrC,qDAAqD;IACrD,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,yEAAyE;IACzE,MAAM,EAAE,OAAO,CAAA;IACf,+DAA+D;IAC/D,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,kFAAkF;IAClF,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC9B,8DAA8D;IAC9D,UAAU,EAAE,OAAO,CAAA;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,OAAO,CAAA;IACb,EAAE,EAAE,OAAO,CAAA;CACZ;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,OAAO,CAAA;IACf,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB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