@kanadego/dsh-heartbeat 1.9.0 → 1.9.2
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 +58 -71
- package/assets/frontwin.ps1 +1 -0
- package/assets/idle.ps1 +1 -0
- package/assets/screenpulse.ps1 +4 -2
- package/config/profile-schema.json +306 -306
- package/cordis.patch.yml +18 -39
- package/dist/{bindings-XPPSKILN.js → bindings-225SI7KC.js} +3 -2
- package/dist/{chunk-63FUJLIF.js → chunk-3MDBU6WY.js} +17 -2
- package/dist/chunk-3MDBU6WY.js.map +1 -0
- package/dist/chunk-AJ5HLAL7.js +2477 -0
- package/dist/chunk-AJ5HLAL7.js.map +1 -0
- package/dist/{chunk-VIZNIQLK.js → chunk-CUOSICYJ.js} +82 -74
- package/dist/chunk-CUOSICYJ.js.map +1 -0
- package/dist/chunk-IG6YMUHW.js +569 -0
- package/dist/chunk-IG6YMUHW.js.map +1 -0
- package/dist/chunk-IV2ZWQA3.js +56 -0
- package/dist/chunk-IV2ZWQA3.js.map +1 -0
- package/dist/{chunk-PQTSXW4F.js → chunk-JDH2LDFS.js} +97 -71
- package/dist/chunk-JDH2LDFS.js.map +1 -0
- package/dist/chunk-K5Y6JP2B.js +399 -0
- package/dist/chunk-K5Y6JP2B.js.map +1 -0
- package/dist/{chunk-RB3NLLGF.js → chunk-KB5SMG3F.js} +3 -3
- package/dist/{chunk-J6ZTRFFW.js → chunk-TY6UP74X.js} +6 -2
- package/dist/chunk-TY6UP74X.js.map +1 -0
- package/dist/chunk-WRUTATW4.js +47 -0
- package/dist/chunk-WRUTATW4.js.map +1 -0
- package/dist/{chunk-IPOZFZPY.js → chunk-XFNCTOW7.js} +48 -10
- package/dist/chunk-XFNCTOW7.js.map +1 -0
- package/dist/chunk-ZLV4NMFX.js +333 -0
- package/dist/chunk-ZLV4NMFX.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.js +565 -497
- package/dist/cli/index.js.map +1 -1
- package/dist/{inbox-57NHQHY3.js → inbox-P26DDMWC.js} +5 -3
- package/dist/index.d.ts +550 -0
- package/dist/index.js +665 -2730
- package/dist/index.js.map +1 -1
- package/dist/{migrate-N6NXMZ3G.js → migrate-D4VKAKYT.js} +4 -3
- package/dist/orchestrator-EUTZ3KG6.js +62 -0
- package/dist/{pool-7I4VACG2.js → pool-UTXQJJ5C.js} +5 -3
- package/dist/{snapshot-ZBCSX67Y.js → snapshot-K5VHETTK.js} +5 -4
- package/dist/snapshot-K5VHETTK.js.map +1 -0
- package/package.json +83 -76
- package/config/watchlist.json +0 -9
- package/dist/chunk-2SYXKKZF.js +0 -837
- package/dist/chunk-2SYXKKZF.js.map +0 -1
- package/dist/chunk-63FUJLIF.js.map +0 -1
- package/dist/chunk-IFTFDHZX.js +0 -203
- package/dist/chunk-IFTFDHZX.js.map +0 -1
- package/dist/chunk-IPOZFZPY.js.map +0 -1
- package/dist/chunk-J6ZTRFFW.js.map +0 -1
- package/dist/chunk-PQTSXW4F.js.map +0 -1
- package/dist/chunk-VIZNIQLK.js.map +0 -1
- /package/dist/{bindings-XPPSKILN.js.map → bindings-225SI7KC.js.map} +0 -0
- /package/dist/{chunk-RB3NLLGF.js.map → chunk-KB5SMG3F.js.map} +0 -0
- /package/dist/{inbox-57NHQHY3.js.map → inbox-P26DDMWC.js.map} +0 -0
- /package/dist/{migrate-N6NXMZ3G.js.map → migrate-D4VKAKYT.js.map} +0 -0
- /package/dist/{pool-7I4VACG2.js.map → orchestrator-EUTZ3KG6.js.map} +0 -0
- /package/dist/{snapshot-ZBCSX67Y.js.map → pool-UTXQJJ5C.js.map} +0 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,550 @@
|
|
|
1
|
+
import { Volatile, Dict, Binary } from './array.ts';
|
|
2
|
+
|
|
3
|
+
/** The Standard Typed interface. This is a base type extended by other specs. */
|
|
4
|
+
interface StandardTypedV1<Input = unknown, Output = Input> {
|
|
5
|
+
/** The Standard properties. */
|
|
6
|
+
readonly "~standard": StandardTypedV1.Props<Input, Output>;
|
|
7
|
+
}
|
|
8
|
+
declare namespace StandardTypedV1 {
|
|
9
|
+
/** The Standard Typed properties interface. */
|
|
10
|
+
interface Props<Input = unknown, Output = Input> {
|
|
11
|
+
/** The version number of the standard. */
|
|
12
|
+
readonly version: 1;
|
|
13
|
+
/** The vendor name of the schema library. */
|
|
14
|
+
readonly vendor: string;
|
|
15
|
+
/** Inferred types associated with the schema. */
|
|
16
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
17
|
+
}
|
|
18
|
+
/** The Standard Typed types interface. */
|
|
19
|
+
interface Types<Input = unknown, Output = Input> {
|
|
20
|
+
/** The input type of the schema. */
|
|
21
|
+
readonly input: Input;
|
|
22
|
+
/** The output type of the schema. */
|
|
23
|
+
readonly output: Output;
|
|
24
|
+
}
|
|
25
|
+
/** Infers the input type of a Standard Typed. */
|
|
26
|
+
type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
27
|
+
/** Infers the output type of a Standard Typed. */
|
|
28
|
+
type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
29
|
+
}
|
|
30
|
+
/** The Standard Schema interface. */
|
|
31
|
+
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
32
|
+
/** The Standard Schema properties. */
|
|
33
|
+
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
34
|
+
}
|
|
35
|
+
declare namespace StandardSchemaV1 {
|
|
36
|
+
/** The Standard Schema properties interface. */
|
|
37
|
+
interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
|
|
38
|
+
/** Validates unknown input values. */
|
|
39
|
+
readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
|
|
40
|
+
}
|
|
41
|
+
/** The result interface of the validate function. */
|
|
42
|
+
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
43
|
+
/** The result interface if validation succeeds. */
|
|
44
|
+
interface SuccessResult<Output> {
|
|
45
|
+
/** The typed output value. */
|
|
46
|
+
readonly value: Output;
|
|
47
|
+
/** A falsy value for `issues` indicates success. */
|
|
48
|
+
readonly issues?: undefined;
|
|
49
|
+
}
|
|
50
|
+
interface Options {
|
|
51
|
+
/** Explicit support for additional vendor-specific parameters, if needed. */
|
|
52
|
+
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
53
|
+
}
|
|
54
|
+
/** The result interface if validation fails. */
|
|
55
|
+
interface FailureResult {
|
|
56
|
+
/** The issues of failed validation. */
|
|
57
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
58
|
+
}
|
|
59
|
+
/** The issue interface of the failure output. */
|
|
60
|
+
interface Issue {
|
|
61
|
+
/** The error message of the issue. */
|
|
62
|
+
readonly message: string;
|
|
63
|
+
/** The path of the issue, if any. */
|
|
64
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
65
|
+
}
|
|
66
|
+
/** The path segment interface of the issue. */
|
|
67
|
+
interface PathSegment {
|
|
68
|
+
/** The key representing a path segment. */
|
|
69
|
+
readonly key: PropertyKey;
|
|
70
|
+
}
|
|
71
|
+
/** The Standard types interface. */
|
|
72
|
+
interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {
|
|
73
|
+
}
|
|
74
|
+
/** Infers the input type of a Standard. */
|
|
75
|
+
type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
|
|
76
|
+
/** Infers the output type of a Standard. */
|
|
77
|
+
type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
declare const kSchema: unique symbol;
|
|
81
|
+
declare global {
|
|
82
|
+
namespace Schemastery {
|
|
83
|
+
/** Convert primitive constructors, constants, and existing schemas into a schema type. */
|
|
84
|
+
type From<X> = X extends string | number | boolean ? Schema<X> : X extends Schema<any, any, SchemaMode> ? X : X extends typeof String ? Schema<string> : X extends typeof Number ? Schema<number> : X extends typeof Boolean ? Schema<boolean> : X extends typeof Function ? Schema<Function, (...args: any[]) => any> : X extends Constructor<infer S> ? Schema<S> : never;
|
|
85
|
+
type TypeS1<X> = X extends Schema<infer S, infer _T, infer _M> ? S : never;
|
|
86
|
+
type Inverse<X> = X extends Schema<infer _S, infer T, infer M> ? (arg: SchemaOutput<T, M>) => void : never;
|
|
87
|
+
/** Input type accepted by a schema-like value. */
|
|
88
|
+
type TypeS<X> = TypeS1<From<X>>;
|
|
89
|
+
/** Output type returned by a schema-like value after validation. */
|
|
90
|
+
type TypeT<X> = ReturnType<From<X>>;
|
|
91
|
+
/** Resolver callback used by custom schema types registered with `Schema.extend()`. */
|
|
92
|
+
type Resolve = (data: any, schema: Schema, options: Options, strict?: boolean) => [any, any?];
|
|
93
|
+
/** Input type accepted by one schema in an intersection. */
|
|
94
|
+
type IntersectS<X> = From<X> extends Schema<infer S, infer _T, infer _M> ? S : never;
|
|
95
|
+
/** Output type returned by one schema in an intersection. */
|
|
96
|
+
type IntersectT<X> = Inverse<From<X>> extends ((arg: infer T) => void) ? T : never;
|
|
97
|
+
type TupleS<X extends readonly any[]> = X extends readonly [infer L, ...infer R] ? [TypeS<L>?, ...TupleS<R>] : any[];
|
|
98
|
+
type TupleT<X extends readonly any[]> = X extends readonly [infer L, ...infer R] ? [TypeT<L>?, ...TupleT<R>] : any[];
|
|
99
|
+
type ObjectS<X extends Dict> = {
|
|
100
|
+
[K in keyof X]?: TypeS<X[K]> | null;
|
|
101
|
+
} & Dict;
|
|
102
|
+
type ObjectT<X extends Dict> = {
|
|
103
|
+
[K in keyof X]: TypeT<X[K]>;
|
|
104
|
+
} & Dict;
|
|
105
|
+
type Constructor<T = any> = new (...args: any[]) => T;
|
|
106
|
+
/** Static constructor and factory methods exposed by the default `Schema` export. */
|
|
107
|
+
interface Static {
|
|
108
|
+
<T = any>(options: Partial<Schema<T>>): Schema<T>;
|
|
109
|
+
new <T = any>(options: Partial<Schema<T>>): Schema<T>;
|
|
110
|
+
prototype: Schema;
|
|
111
|
+
/** Validate a value against a schema node and return `[output, adaptedInput?]`. */
|
|
112
|
+
resolve: Resolve;
|
|
113
|
+
/** Infer a schema from a primitive value, constructor, or existing schema. */
|
|
114
|
+
from<X = any>(source?: X): From<X>;
|
|
115
|
+
/** Register a resolver for a custom schema `type`. */
|
|
116
|
+
extend(type: string, resolve: Resolve): void;
|
|
117
|
+
/** Accept any value without validation. */
|
|
118
|
+
any<T = any>(): Schema<T>;
|
|
119
|
+
/** Accept only nullable input. */
|
|
120
|
+
never(): Schema<never>;
|
|
121
|
+
/** Accept exactly one constant value. */
|
|
122
|
+
const<const T>(value: T): Schema<T>;
|
|
123
|
+
/** Accept strings, with optional metadata constraints added by instance methods. */
|
|
124
|
+
string(): Schema<string>;
|
|
125
|
+
/** Accept numbers, with optional range and step constraints. */
|
|
126
|
+
number(): Schema<number>;
|
|
127
|
+
/** Accept non-negative integer numbers. */
|
|
128
|
+
natural(): Schema<number>;
|
|
129
|
+
/** Accept a number between 0 and 1 and mark it as a slider. */
|
|
130
|
+
percent(): Schema<number>;
|
|
131
|
+
/** Accept booleans. */
|
|
132
|
+
boolean(): Schema<boolean>;
|
|
133
|
+
/** Accept `Date` instances or parse datetime strings into `Date` objects. */
|
|
134
|
+
date(): Schema<string | Date, Date>;
|
|
135
|
+
/** Accept `RegExp` instances or parse strings into regular expressions. */
|
|
136
|
+
regExp(flag?: string): Schema<string | RegExp, RegExp>;
|
|
137
|
+
/** Accept binary sources and normalize them to `ArrayBufferLike`. */
|
|
138
|
+
arrayBuffer(): Schema<Binary.Source, ArrayBufferLike>;
|
|
139
|
+
arrayBuffer(encoding: 'hex' | 'base64'): Schema<Binary.Source | string, ArrayBufferLike>;
|
|
140
|
+
/** Accept a numeric bitset or string keys and normalize to a number. */
|
|
141
|
+
bitset<K extends string>(bits: Partial<Record<K, number>>): Schema<number | readonly K[], number>;
|
|
142
|
+
/** Accept functions. */
|
|
143
|
+
function(): Schema<Function, (...args: any[]) => any>;
|
|
144
|
+
/** Accept instances of a constructor or objects whose constructor name matches. */
|
|
145
|
+
is(constructor: string): Schema;
|
|
146
|
+
is<T>(constructor: Constructor<T>): Schema<T>;
|
|
147
|
+
/** Accept arrays whose elements match `inner`. */
|
|
148
|
+
array<X>(inner: X): Schema<TypeS<X>[], TypeT<X>[]>;
|
|
149
|
+
/** Accept plain objects with values matching `inner` and optional key schema. */
|
|
150
|
+
dict<X, Y extends Schema<any, string> = Schema<string>>(inner: X, sKey?: Y): Schema<Dict<TypeS<X>, TypeS<Y>>, Dict<TypeT<X>, TypeT<Y>>>;
|
|
151
|
+
/** Accept tuple arrays where each index matches the corresponding schema. */
|
|
152
|
+
tuple<const X extends readonly any[]>(list: X): Schema<TupleS<X>, TupleT<X>>;
|
|
153
|
+
/** Accept plain objects; infer fields from the dictionary, not the enclosing schema's output type. */
|
|
154
|
+
object<X extends Dict>(dict: X): Schema<ObjectS<NoInfer<X>>, ObjectT<NoInfer<X>>>;
|
|
155
|
+
/** Accept values matching at least one schema in `list`. */
|
|
156
|
+
union<const X>(list: readonly X[]): Schema<TypeS<X>, TypeT<X>>;
|
|
157
|
+
/** Accept values matching every schema in `list`, merging object outputs. */
|
|
158
|
+
intersect<const X>(list: readonly X[]): Schema<IntersectS<X>, IntersectT<X>>;
|
|
159
|
+
/** Validate with `inner`, then convert the result with `callback`. */
|
|
160
|
+
transform<X, T>(inner: X, callback: (value: TypeS<X>, options: Schemastery.Options) => T, preserve?: boolean): Schema<TypeS<X>, T>;
|
|
161
|
+
/** Defer construction of a recursive schema until validation or serialization. */
|
|
162
|
+
lazy<X extends Schema<any, any, SchemaMode>>(callback: () => X): X;
|
|
163
|
+
ValidationError: typeof ValidationError;
|
|
164
|
+
}
|
|
165
|
+
/** Runtime validation options shared by all schema calls. */
|
|
166
|
+
interface Options {
|
|
167
|
+
/** Remove invalid object properties instead of throwing when possible. */
|
|
168
|
+
autofix?: boolean;
|
|
169
|
+
/** Skip validation for selected values and schema nodes. */
|
|
170
|
+
ignore?(data: any, schema: Schema): boolean;
|
|
171
|
+
/** Path used to format nested validation errors. */
|
|
172
|
+
path?: (keyof any)[];
|
|
173
|
+
}
|
|
174
|
+
/** UI and validation metadata attached by schema builder methods. */
|
|
175
|
+
interface Meta<T = any> {
|
|
176
|
+
default?: T extends {} ? Partial<T> : T;
|
|
177
|
+
required?: boolean;
|
|
178
|
+
/** Parse this node as a stable config reference; its type and UI metadata remain unchanged. */
|
|
179
|
+
volatile?: boolean;
|
|
180
|
+
disabled?: boolean;
|
|
181
|
+
collapse?: boolean;
|
|
182
|
+
badges?: {
|
|
183
|
+
text: string;
|
|
184
|
+
type: string;
|
|
185
|
+
}[];
|
|
186
|
+
hidden?: boolean;
|
|
187
|
+
loose?: boolean;
|
|
188
|
+
role?: string;
|
|
189
|
+
extra?: any;
|
|
190
|
+
link?: string;
|
|
191
|
+
description?: string | Dict<string>;
|
|
192
|
+
comment?: string;
|
|
193
|
+
pattern?: {
|
|
194
|
+
source: string;
|
|
195
|
+
flags?: string;
|
|
196
|
+
};
|
|
197
|
+
max?: number;
|
|
198
|
+
min?: number;
|
|
199
|
+
step?: number;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
/** Callable schema instance that validates input and returns normalized output. */
|
|
203
|
+
interface Schemastery<S = any, T = S, Mode extends SchemaMode = 'plain'> {
|
|
204
|
+
(data?: S | null, options?: Schemastery.Options): SchemaOutput<T, Mode>;
|
|
205
|
+
new (data?: S | null, options?: Schemastery.Options): SchemaOutput<T, Mode>;
|
|
206
|
+
[kSchema]: true;
|
|
207
|
+
uid: number;
|
|
208
|
+
meta: Schemastery.Meta<T>;
|
|
209
|
+
type: string;
|
|
210
|
+
sKey?: Schema;
|
|
211
|
+
inner?: Schema;
|
|
212
|
+
list?: Schema[];
|
|
213
|
+
dict?: Dict<Schema>;
|
|
214
|
+
bits?: Dict<number>;
|
|
215
|
+
callback?: Function;
|
|
216
|
+
constructor?: string | Function;
|
|
217
|
+
builder?: Function;
|
|
218
|
+
value?: T;
|
|
219
|
+
refs?: Dict<Schema>;
|
|
220
|
+
preserve?: boolean;
|
|
221
|
+
'~standard': StandardSchemaV1.Props;
|
|
222
|
+
/** Format this schema as a compact TypeScript-like type string. */
|
|
223
|
+
toString(inline?: boolean): string;
|
|
224
|
+
/** Serialize this schema, preserving shared and recursive references. */
|
|
225
|
+
toJSON(): Schema<S, T, Mode>;
|
|
226
|
+
/** Mark nullable input as invalid unless a default supplies a fallback. */
|
|
227
|
+
required<R extends boolean = true>(value?: R): Schema<S, T, SetRequired<Mode, R>>;
|
|
228
|
+
/**
|
|
229
|
+
* Parse this config field as a stable reference containing immutable data.
|
|
230
|
+
* @returns a schema whose output supports get(), including when the field is absent.
|
|
231
|
+
*/
|
|
232
|
+
volatile(): Schema<NoInfer<S>, NoInfer<T>, Mode extends 'defined' | 'volatile-defined' ? 'volatile-defined' : 'volatile'>;
|
|
233
|
+
/** Hide this schema node from UI renderers. */
|
|
234
|
+
hidden(value?: boolean): Schema<S, T, Mode>;
|
|
235
|
+
/** Return the default value instead of throwing when validation fails. */
|
|
236
|
+
loose(value?: boolean): Schema<S, T, Mode>;
|
|
237
|
+
/** Attach a renderer role and optional role-specific metadata. */
|
|
238
|
+
role(text: string, extra?: any): Schema<S, T, Mode>;
|
|
239
|
+
/** Attach an external documentation link. */
|
|
240
|
+
link(link: string): Schema<S, T, Mode>;
|
|
241
|
+
/** Set the fallback value used for nullable input. */
|
|
242
|
+
default(value: T | NoInfer<Partial<S>>): Schema<S, T, SetRequired<Mode, true>>;
|
|
243
|
+
/** Attach an auxiliary comment for documentation or form UIs. */
|
|
244
|
+
comment(text: string): Schema<S, T, Mode>;
|
|
245
|
+
/** Attach a localized or plain description for documentation or form UIs. */
|
|
246
|
+
description(text: string): Schema<S, T, Mode>;
|
|
247
|
+
/** Mark this schema node as disabled for form UIs. */
|
|
248
|
+
disabled(value?: boolean): Schema<S, T, Mode>;
|
|
249
|
+
/** Request collapsed rendering for nested form UIs. */
|
|
250
|
+
collapse(value?: boolean): Schema<S, T, Mode>;
|
|
251
|
+
/** Add a deprecated badge to this schema node. */
|
|
252
|
+
deprecated(): Schema<S, T, Mode>;
|
|
253
|
+
/** Add an experimental badge to this schema node. */
|
|
254
|
+
experimental(): Schema<S, T, Mode>;
|
|
255
|
+
/** Require strings to match a regular expression. */
|
|
256
|
+
pattern(regexp: RegExp): Schema<S, T, Mode>;
|
|
257
|
+
/** Set an inclusive maximum for numbers or collection lengths. */
|
|
258
|
+
max(value: number): Schema<S, T, Mode>;
|
|
259
|
+
/** Set an inclusive minimum for numbers or collection lengths. */
|
|
260
|
+
min(value: number): Schema<S, T, Mode>;
|
|
261
|
+
/** Set the numeric increment constraint. */
|
|
262
|
+
step(value: number): Schema<S, T, Mode>;
|
|
263
|
+
/** Add or replace an object property schema. */
|
|
264
|
+
set(key: string, value: Schema): Schema<S, T, Mode>;
|
|
265
|
+
/** Append a tuple, union, or intersection member schema. */
|
|
266
|
+
push(value: Schema): Schema<S, T, Mode>;
|
|
267
|
+
/** Remove values equal to schema defaults from normalized output. */
|
|
268
|
+
simplify(value?: any): any;
|
|
269
|
+
/** Return a schema clone with descriptions merged from locale messages. */
|
|
270
|
+
i18n(messages: Dict): Schema<S, T, Mode>;
|
|
271
|
+
/** Attach arbitrary metadata consumed by form renderers and downstream tools. */
|
|
272
|
+
extra<K extends keyof Schemastery.Meta>(key: K, value: Schemastery.Meta[K]): Schema<S, T, Mode>;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
declare class ValidationError extends TypeError {
|
|
276
|
+
options: Schemastery.Options;
|
|
277
|
+
name: string;
|
|
278
|
+
constructor(message: string, options: Schemastery.Options);
|
|
279
|
+
static is(error: any): error is ValidationError;
|
|
280
|
+
}
|
|
281
|
+
type SchemaMode = 'plain' | 'defined' | 'volatile' | 'volatile-defined';
|
|
282
|
+
type SchemaOutput<T, M extends SchemaMode> = M extends 'volatile' ? Volatile<T | undefined> : M extends 'volatile-defined' ? Volatile<T> : T;
|
|
283
|
+
type SetRequired<M extends SchemaMode, R extends boolean> = M extends 'volatile' | 'volatile-defined' ? R extends true ? 'volatile-defined' : 'volatile' : R extends true ? 'defined' : 'plain';
|
|
284
|
+
type Schema<S = any, T = S, Mode extends SchemaMode = 'plain'> = Schemastery<S, T, Mode>;
|
|
285
|
+
declare const Schema: Schemastery.Static;
|
|
286
|
+
//# sourceMappingURL=index.d.ts.map
|
|
287
|
+
|
|
288
|
+
interface QuietHours {
|
|
289
|
+
start: string;
|
|
290
|
+
end: string;
|
|
291
|
+
}
|
|
292
|
+
interface BrowseWindow {
|
|
293
|
+
start: string;
|
|
294
|
+
end: string;
|
|
295
|
+
}
|
|
296
|
+
interface Policy {
|
|
297
|
+
heartbeat: {
|
|
298
|
+
intervalMin: number;
|
|
299
|
+
idleMode: boolean;
|
|
300
|
+
archiveRotatedHome: boolean;
|
|
301
|
+
};
|
|
302
|
+
gate: {
|
|
303
|
+
maxDailySend: number;
|
|
304
|
+
cooldownMinutes: number;
|
|
305
|
+
quietHours: QuietHours;
|
|
306
|
+
};
|
|
307
|
+
browse: {
|
|
308
|
+
windows: BrowseWindow[];
|
|
309
|
+
minIntervalHours: number;
|
|
310
|
+
maxSeedsPerVisit: number;
|
|
311
|
+
};
|
|
312
|
+
seeds: {
|
|
313
|
+
maxActive: number;
|
|
314
|
+
ttlDays: {
|
|
315
|
+
news: number;
|
|
316
|
+
fandom: number;
|
|
317
|
+
scene: number;
|
|
318
|
+
promise: number;
|
|
319
|
+
};
|
|
320
|
+
coldBenchDays: number;
|
|
321
|
+
/** Archive-area cap (v1.9.0): gc trims archived seeds beyond this, oldest first. */
|
|
322
|
+
archiveCap: number;
|
|
323
|
+
retireAfterUsed: number;
|
|
324
|
+
scoreWeights: {
|
|
325
|
+
freshness: number;
|
|
326
|
+
unused: number;
|
|
327
|
+
confidence: number;
|
|
328
|
+
};
|
|
329
|
+
};
|
|
330
|
+
profile: {
|
|
331
|
+
consolidation: {
|
|
332
|
+
minIntervalHours: number;
|
|
333
|
+
inboxBacklog: number;
|
|
334
|
+
};
|
|
335
|
+
partitionCap: number;
|
|
336
|
+
maxOpsPerRun: number;
|
|
337
|
+
confidenceCap: {
|
|
338
|
+
chat: number;
|
|
339
|
+
screen: number;
|
|
340
|
+
browse: number;
|
|
341
|
+
};
|
|
342
|
+
volatileDays: number;
|
|
343
|
+
stableLowActivityDays: number;
|
|
344
|
+
psyEnabled: boolean;
|
|
345
|
+
};
|
|
346
|
+
/** Observation depth (v1.8.0): how much of each user message enters the inbox. */
|
|
347
|
+
observe: {
|
|
348
|
+
maxChars: number;
|
|
349
|
+
perBeat: number;
|
|
350
|
+
};
|
|
351
|
+
weekly: {
|
|
352
|
+
enabled: boolean;
|
|
353
|
+
};
|
|
354
|
+
retention: {
|
|
355
|
+
envPulseHours: number;
|
|
356
|
+
decisionLogDays: number;
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
/** Recursive merge: user values win; objects merge, arrays and scalars replace. */
|
|
360
|
+
declare function deepMerge<T>(base: T, override: unknown): T;
|
|
361
|
+
|
|
362
|
+
interface PathGuard {
|
|
363
|
+
/** Canonical workspace boundary. */
|
|
364
|
+
readonly workspace: string;
|
|
365
|
+
/** Canonicalize then validate; returns the canonical path or throws. */
|
|
366
|
+
assert(target: string): string;
|
|
367
|
+
/** Canonicalize then validate; returns null instead of throwing. */
|
|
368
|
+
check(target: string): string | null;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
type RelocateResult = {
|
|
372
|
+
action: 'relocated';
|
|
373
|
+
/** Package-local tree the data came from (now deleted). */
|
|
374
|
+
srcDir: string;
|
|
375
|
+
dstDir: string;
|
|
376
|
+
backupDir: string;
|
|
377
|
+
files: number;
|
|
378
|
+
bytes: number;
|
|
379
|
+
/** Plaintext JSON/JSONL that does not parse (verified byte-identical). */
|
|
380
|
+
warnings: string[];
|
|
381
|
+
/** Paths that could not be deleted after the move (cosmetic leftovers). */
|
|
382
|
+
leftovers: string[];
|
|
383
|
+
} | {
|
|
384
|
+
action: 'skipped';
|
|
385
|
+
reason: 'source-missing' | 'no-payload' | 'destination-exists';
|
|
386
|
+
} | {
|
|
387
|
+
action: 'failed';
|
|
388
|
+
stage: 'backup' | 'copy' | 'verify' | 'commit';
|
|
389
|
+
problems: string[];
|
|
390
|
+
/** Null when the backup itself could not be created. */
|
|
391
|
+
backupDir: string | null;
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
interface WorkspacePaths {
|
|
395
|
+
/** Guard boundary and the only writable tree at runtime. */
|
|
396
|
+
dataDir: string;
|
|
397
|
+
settingsDir: string;
|
|
398
|
+
logsDir: string;
|
|
399
|
+
tmpDir: string;
|
|
400
|
+
exportsDir: string;
|
|
401
|
+
/** Package root (where package.json lives). Read-only at runtime. */
|
|
402
|
+
packageRoot: string;
|
|
403
|
+
configDir: string;
|
|
404
|
+
assetsDir: string;
|
|
405
|
+
/**
|
|
406
|
+
* Set only when a legacy package-local data dir was found: the outcome of
|
|
407
|
+
* the one-time relocation. Absent for explicit dirs and fresh installs.
|
|
408
|
+
*/
|
|
409
|
+
relocation?: RelocateResult;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
interface OrchestratorDeps {
|
|
413
|
+
ctx: {
|
|
414
|
+
agents: {
|
|
415
|
+
create(options: unknown): Promise<unknown>;
|
|
416
|
+
resume(options: unknown): Promise<unknown>;
|
|
417
|
+
roots(): unknown[];
|
|
418
|
+
get(id: string): unknown;
|
|
419
|
+
};
|
|
420
|
+
logger: {
|
|
421
|
+
info(msg: string, ...a: unknown[]): void;
|
|
422
|
+
warn(msg: string, ...a: unknown[]): void;
|
|
423
|
+
error(msg: string, ...a: unknown[]): void;
|
|
424
|
+
};
|
|
425
|
+
effect(fn: () => unknown, label?: string): () => void;
|
|
426
|
+
/** Cordis service lookup (used for `agentDefaultModel`). */
|
|
427
|
+
get?(name: string): unknown;
|
|
428
|
+
};
|
|
429
|
+
paths: WorkspacePaths;
|
|
430
|
+
guard: PathGuard;
|
|
431
|
+
policy: Policy;
|
|
432
|
+
/** Agent preset the heartbeat agent joins (composition entry `agentPreset`). */
|
|
433
|
+
agentPreset?: string;
|
|
434
|
+
/** Awaited right before the preset mount: the plugin registers its preset at
|
|
435
|
+
* runtime (issue #2 — the composition must not name a host package), and the
|
|
436
|
+
* mount must not race that registration. Resolves at once when registration
|
|
437
|
+
* was skipped or the host has no registry API. */
|
|
438
|
+
presetRegistration?: () => Promise<void>;
|
|
439
|
+
/** Extra tool names the engine-room allow-list should include (config
|
|
440
|
+
* `extraTools`, comma-separated in the composition entry). Only names that
|
|
441
|
+
* actually exist in the global layer are applied. */
|
|
442
|
+
extraTools?: string[];
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
declare const name = "heartbeat";
|
|
446
|
+
/**
|
|
447
|
+
* Host services required by the orchestrator (verified present in
|
|
448
|
+
* DSH 0.1.1-rc.2 via hb-probe: agents service + agent/created + followup).
|
|
449
|
+
* `settings` = the host SettingsProvider service (0.1.5): the web card's
|
|
450
|
+
* rhythm edits live there. 0.1.5's strict resolution refuses undeclared
|
|
451
|
+
* service access, so the name must be declared here.
|
|
452
|
+
*/
|
|
453
|
+
declare const inject: string[];
|
|
454
|
+
declare const Config: Schema<Schemastery.ObjectS<NoInfer<{
|
|
455
|
+
/** Override the runtime data dir (workspace guard boundary). Empty = default (<packageRoot>/data). */
|
|
456
|
+
dataDir: Schema<string, string, "defined">;
|
|
457
|
+
/** UI-editable: heartbeat interval in minutes. 0 = use policy file / factory. */
|
|
458
|
+
intervalMin: Schema<number, number, "defined">;
|
|
459
|
+
/** UI-editable: daily expression cap. 0 = use policy file / factory. */
|
|
460
|
+
maxDailySend: Schema<number, number, "defined">;
|
|
461
|
+
/**
|
|
462
|
+
* Agent preset the heartbeat agent joins (`<dshHome>/.agent-presets/<id>/`).
|
|
463
|
+
* Without a preset the agent is a BARE agent: tools/prompt sections resolve
|
|
464
|
+
* against the empty global layer, so it cannot even see `web_search`.
|
|
465
|
+
*/
|
|
466
|
+
agentPreset: Schema<string, string, "defined">;
|
|
467
|
+
/**
|
|
468
|
+
* Install the bundled preset (see `agentPreset`) into the roster's user root
|
|
469
|
+
* on first run, so setup needs no manual file copy. An existing preset is
|
|
470
|
+
* never overwritten; set false to manage the preset entirely by hand.
|
|
471
|
+
*/
|
|
472
|
+
installPreset: Schema<boolean, boolean, "defined">;
|
|
473
|
+
/** Self-built time injection interval (D20, §17.6). 0 disables injection. */
|
|
474
|
+
timeInjectMin: Schema<number, number, "defined">;
|
|
475
|
+
/** IANA timezone for the injected clock; empty = process zone. */
|
|
476
|
+
timeZone: Schema<string, string, "defined">;
|
|
477
|
+
/** Statusbar master switch (D19). Off = no section/pre-step status; time injection unaffected. */
|
|
478
|
+
statusbar: Schema<boolean, boolean, "defined">;
|
|
479
|
+
/** v1.6.3 闲着模式:素材池为空时用画像话题兜底主动搭话(默认关)。 */
|
|
480
|
+
idleMode: Schema<boolean, boolean, "defined">;
|
|
481
|
+
/** v1.7.0 节省 token 模式:用户离开(闲置 ≥30 分钟)或锁屏时整跳暂停(默认关)。 */
|
|
482
|
+
tokenSaver: Schema<boolean, boolean, "defined">;
|
|
483
|
+
/** v1.8.0 账本工具:向所有日常会话 agent 注册共享账本工具(默认开)。 */
|
|
484
|
+
ledgerTool: Schema<boolean, boolean, "defined">;
|
|
485
|
+
/** v1.9.0 素材报账工具:投递后由陪伴 agent 主动报账(默认开)。 */
|
|
486
|
+
seedReportTool: Schema<boolean, boolean, "defined">;
|
|
487
|
+
/** v1.8.0 引擎室追加工具:逗号分隔的全局工具名,存在才加入白名单(bili 压缩工具自动探测,无需手填)。 */
|
|
488
|
+
extraTools: Schema<string, string, "defined">;
|
|
489
|
+
}>>, Schemastery.ObjectT<NoInfer<{
|
|
490
|
+
/** Override the runtime data dir (workspace guard boundary). Empty = default (<packageRoot>/data). */
|
|
491
|
+
dataDir: Schema<string, string, "defined">;
|
|
492
|
+
/** UI-editable: heartbeat interval in minutes. 0 = use policy file / factory. */
|
|
493
|
+
intervalMin: Schema<number, number, "defined">;
|
|
494
|
+
/** UI-editable: daily expression cap. 0 = use policy file / factory. */
|
|
495
|
+
maxDailySend: Schema<number, number, "defined">;
|
|
496
|
+
/**
|
|
497
|
+
* Agent preset the heartbeat agent joins (`<dshHome>/.agent-presets/<id>/`).
|
|
498
|
+
* Without a preset the agent is a BARE agent: tools/prompt sections resolve
|
|
499
|
+
* against the empty global layer, so it cannot even see `web_search`.
|
|
500
|
+
*/
|
|
501
|
+
agentPreset: Schema<string, string, "defined">;
|
|
502
|
+
/**
|
|
503
|
+
* Install the bundled preset (see `agentPreset`) into the roster's user root
|
|
504
|
+
* on first run, so setup needs no manual file copy. An existing preset is
|
|
505
|
+
* never overwritten; set false to manage the preset entirely by hand.
|
|
506
|
+
*/
|
|
507
|
+
installPreset: Schema<boolean, boolean, "defined">;
|
|
508
|
+
/** Self-built time injection interval (D20, §17.6). 0 disables injection. */
|
|
509
|
+
timeInjectMin: Schema<number, number, "defined">;
|
|
510
|
+
/** IANA timezone for the injected clock; empty = process zone. */
|
|
511
|
+
timeZone: Schema<string, string, "defined">;
|
|
512
|
+
/** Statusbar master switch (D19). Off = no section/pre-step status; time injection unaffected. */
|
|
513
|
+
statusbar: Schema<boolean, boolean, "defined">;
|
|
514
|
+
/** v1.6.3 闲着模式:素材池为空时用画像话题兜底主动搭话(默认关)。 */
|
|
515
|
+
idleMode: Schema<boolean, boolean, "defined">;
|
|
516
|
+
/** v1.7.0 节省 token 模式:用户离开(闲置 ≥30 分钟)或锁屏时整跳暂停(默认关)。 */
|
|
517
|
+
tokenSaver: Schema<boolean, boolean, "defined">;
|
|
518
|
+
/** v1.8.0 账本工具:向所有日常会话 agent 注册共享账本工具(默认开)。 */
|
|
519
|
+
ledgerTool: Schema<boolean, boolean, "defined">;
|
|
520
|
+
/** v1.9.0 素材报账工具:投递后由陪伴 agent 主动报账(默认开)。 */
|
|
521
|
+
seedReportTool: Schema<boolean, boolean, "defined">;
|
|
522
|
+
/** v1.8.0 引擎室追加工具:逗号分隔的全局工具名,存在才加入白名单(bili 压缩工具自动探测,无需手填)。 */
|
|
523
|
+
extraTools: Schema<string, string, "defined">;
|
|
524
|
+
}>>, "plain">;
|
|
525
|
+
interface HeartbeatConfig {
|
|
526
|
+
dataDir?: string | null;
|
|
527
|
+
intervalMin?: number;
|
|
528
|
+
maxDailySend?: number;
|
|
529
|
+
agentPreset?: string;
|
|
530
|
+
installPreset?: boolean;
|
|
531
|
+
timeInjectMin?: number;
|
|
532
|
+
timeZone?: string;
|
|
533
|
+
statusbar?: boolean;
|
|
534
|
+
idleMode?: boolean;
|
|
535
|
+
tokenSaver?: boolean;
|
|
536
|
+
ledgerTool?: boolean;
|
|
537
|
+
seedReportTool?: boolean;
|
|
538
|
+
extraTools?: string;
|
|
539
|
+
}
|
|
540
|
+
declare function apply(ctx: OrchestratorDeps['ctx'] & {
|
|
541
|
+
get(name: string): unknown;
|
|
542
|
+
/** Cordis lazy service declaration: callback runs once the named services mount. */
|
|
543
|
+
inject(services: string[], callback: (scoped: unknown) => void): void;
|
|
544
|
+
/** Cordis event subscription (pre-step waterfall etc.); returns a disposer. */
|
|
545
|
+
on(event: string, listener: (payload: never, next: () => Promise<unknown>) => Promise<unknown>, opts?: {
|
|
546
|
+
prepend?: boolean;
|
|
547
|
+
}): unknown;
|
|
548
|
+
}, config?: HeartbeatConfig): void;
|
|
549
|
+
|
|
550
|
+
export { Config, type HeartbeatConfig, apply, deepMerge, inject, name };
|