@deepseek-ai/cordis-plugin-include 1.0.10 → 1.0.11-alpha.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.
@@ -1,85 +1,80 @@
1
- import { EntryGroup, EntryTree, type EntryOptions } from '@deepseek-ai/cordis-plugin-loader';
1
+ import { type EntryChange, EntryTree, EntryGroup } from '@deepseek-ai/cordis-plugin-loader';
2
2
  import { Context, Service } from '@deepseek-ai/cordis';
3
3
  import * as yaml from 'js-yaml';
4
- /**
5
- * The entry-list YAML dialect: `!!js` scalars round-trip as expression nodes
6
- * the Loader evaluates at entry activation. Exported so config tooling
7
- * (`dsh --dump-config`) parses and prints exactly the dialect this include
8
- * mounts.
9
- */
4
+ import { type PatchOptions } from './patch.ts';
5
+ /** Shared patch semantics used by config dumps and mounting. */
6
+ export { applyPatches as applyEntryPatches } from './patch.ts';
7
+ /** Serialized entry patch options. */
8
+ export type { PatchOptions } from './patch.ts';
9
+ /** YAML dialect preserving child-owned JavaScript expression nodes. */
10
10
  export declare const entryListSchema: yaml.Schema;
11
- /**
12
- * Apply patch lists to an entry list — THE patch semantics of this include,
13
- * shared by mounting (`applyPatches`) and offline config tooling
14
- * (`dsh --dump-config`) so a dump can never drift from what boots. The input
15
- * is never mutated: patching shared entry objects would bake earlier patch
16
- * values into the cached parse, so repeated application (config hot-reloads)
17
- * could never revert a removed or changed patch. Inserted entries are indexed
18
- * as they are added, so a later patch in the same list can target a row an
19
- * earlier patch inserted. A patch that matches nothing warns and is skipped.
20
- * @param data - the parsed entry list (JSON-safe plain data).
21
- * @param patches - the patch list to apply, in order.
22
- * @param warn - sink for skipped-patch diagnostics (printf-style, `%C` = code).
23
- * @returns a detached entry list with every applicable patch applied.
24
- */
25
- export declare function applyEntryPatches(data: EntryOptions[], patches: PatchOptions[] | undefined, warn: (message: string, ...args: any[]) => void): EntryOptions[];
26
- /** Runtime patch applied to entries loaded from an included config file. */
27
- export interface PatchOptions {
28
- id?: string;
29
- insert?: EntryOptions[];
30
- name?: string;
31
- config?: any;
32
- group?: boolean | null;
33
- disabled?: boolean | null;
34
- inject?: any;
35
- intercept?: any;
36
- isolate?: any;
37
- [key: string]: any;
11
+ type ConfigStage = 'read' | 'parse' | 'validate';
12
+ export declare class ConfigFileError extends Error {
13
+ stage: ConfigStage;
14
+ name: string;
15
+ constructor(stage: ConfigStage, path: string, cause: unknown);
38
16
  }
39
- /** Config namespace for the file-backed include loader. */
40
17
  export declare namespace Include {
41
- /** Config for a file-backed loader subtree. */
42
18
  interface Config {
43
- /** YAML or JSON path resolved from `ctx.baseUrl`. */
44
19
  path: string;
45
- /** Entry list written when the file does not already exist. */
46
20
  initial?: any[];
47
- /** Runtime patches applied after reading the file. */
48
21
  patches?: PatchOptions[];
49
- /** Enables loader apply/reload/unload logs for this subtree. */
50
22
  enableLogs?: boolean;
51
23
  }
52
24
  }
53
- /** Loader entry tree backed by a YAML or JSON file. */
54
25
  export declare class Include extends EntryTree {
55
26
  config: Include.Config;
56
27
  static inject: string[];
57
28
  static readonly [EntryGroup.key] = true;
58
29
  filename: string;
59
- private type?;
60
- private readonly;
61
- private content?;
62
- private data?;
63
- private writeTask?;
64
- private pendingWrite?;
65
- private writeQueue;
30
+ private type;
31
+ /** The last file state we read or wrote. */
32
+ private cache?;
33
+ /** Tree-side changes that have not reached the file yet. */
34
+ private journal;
35
+ /** Ids we assigned to entries the file leaves anonymous. */
36
+ private anonymous;
37
+ private dirtyRead;
38
+ private dirtyWrite;
39
+ private _draining?;
40
+ /** Only the latest intended tree is ever applied; older ones are skipped. */
41
+ private _pendingTree?;
42
+ private _applyTask?;
43
+ private _disposed;
44
+ private _seq;
45
+ private persistenceError;
66
46
  constructor(ctx: Context, config: Include.Config);
67
- private checkAccess;
68
- private read;
69
- private applyPatches;
47
+ private warn;
70
48
  [Service.init](): AsyncGenerator<() => Promise<void>, void, unknown>;
71
49
  stop(): Promise<void>;
72
50
  /**
73
- * Re-read the file and refresh child entries when content changed. An
74
- * unreadable or unparsable file logs a warning and keeps the last good
75
- * tree: a hot-reload of a live app must never take the process down.
51
+ * Resolves once every pending read and write has been processed and the
52
+ * tree reflects the outcome. Retries pending writes and rejects while changes remain unsaved.
76
53
  */
54
+ flush(): Promise<void>;
55
+ /** Re-read the file and reconcile the tree with it. */
77
56
  refresh(): Promise<void>;
78
- private _writeFile;
79
- private writeFile;
80
- private flushWrite;
81
- /** Schedule a write of the current root entry data. */
82
- write(): void;
57
+ /** Called synchronously by the loader once a tree-side change is in place. */
58
+ commit(change: EntryChange): void;
59
+ private _drain;
60
+ private _loop;
61
+ private _read;
62
+ private _write;
63
+ /**
64
+ * Write through a temp file and a rename, so that no reader ever sees a
65
+ * truncated file. When `expected` is given, the rename (and every retry of
66
+ * it) only goes ahead while the file still holds that content.
67
+ */
68
+ private _writeText;
69
+ private dump;
70
+ /**
71
+ * Entries the file leaves anonymous get an id here, before the loader sees
72
+ * them. One that looks exactly like an entry we named on the previous read
73
+ * keeps that id, so editing a neighbor does not restart it; anything else
74
+ * gets a fresh id. Assigned ids stay in memory until the next write.
75
+ */
76
+ private _assignIds;
77
+ private _scheduleApply;
83
78
  }
84
79
  export default Include;
85
80
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAY,KAAK,YAAY,EAAE,MAAM,mCAAmC,CAAA;AACtG,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAKtD,OAAO,KAAK,IAAI,MAAM,SAAS,CAAA;AAU/B;;;;;GAKG;AACH,eAAO,MAAM,eAAe,aAAkC,CAAA;AAoB9D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,YAAY,EAAE,EACpB,OAAO,EAAE,YAAY,EAAE,GAAG,SAAS,EACnC,IAAI,EAAE,CAA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 +1,69 @@
1
+ import type { EntryChange, EntryOptions } from '@deepseek-ai/cordis-plugin-loader';
2
+ import { type Dict } from '@deepseek-ai/cosmokit';
3
+ /** One tree-side mutation that has not reached the file yet, keyed by entry id. */
4
+ export type JournalRecord = JournalRecord.Remove | JournalRecord.Upsert;
5
+ export declare namespace JournalRecord {
6
+ interface Remove {
7
+ kind: 'remove';
8
+ }
9
+ interface Upsert {
10
+ kind: 'upsert';
11
+ /** The entry did not exist when the tree first reported it. */
12
+ created: boolean;
13
+ /**
14
+ * The group the tree placed the entry in (`null` for the root), or
15
+ * `undefined` when the tree did not relocate it.
16
+ */
17
+ parent: string | null | undefined;
18
+ /** Index within `parent`; only meaningful alongside a `parent`. */
19
+ position: number;
20
+ /**
21
+ * Per-key delta relative to the options the entry had when the change
22
+ * was reported; `undefined` deletes a key. Collected at report time: the
23
+ * live tree is reconciled asynchronously and may lag behind the file.
24
+ */
25
+ changes: Dict;
26
+ }
27
+ }
28
+ export type Journal = Map<string, JournalRecord>;
29
+ export declare function diffOptions(legacy: EntryOptions, options: EntryOptions): Dict;
30
+ /** Fold a later record into an earlier one for the same entry. */
31
+ export declare function mergeRecords(older: JournalRecord | undefined, newer: JournalRecord): JournalRecord | undefined;
32
+ export declare function merge(journal: Journal, id: string, record: JournalRecord): void;
33
+ export declare function record(journal: Journal, change: EntryChange, parent: string | null): void;
34
+ export interface FlatEntry {
35
+ parent: string | null;
36
+ position: number;
37
+ options: EntryOptions;
38
+ list: EntryOptions[];
39
+ }
40
+ /** Index every entry (including nested group members) by id. */
41
+ export declare function flatten(data: EntryOptions[], parent?: string | null, result?: Map<string, FlatEntry>): Map<string, FlatEntry>;
42
+ export declare function applyChanges(options: EntryOptions, changes: Dict, filter?: (key: string) => boolean): void;
43
+ export declare function detach(data: EntryOptions[], id: string): EntryOptions | undefined;
44
+ /**
45
+ * Insert `options` under `parent` (a group id, or `null` for the root) at
46
+ * `position`, clamped to the group's length. Returns false when the parent
47
+ * group does not exist.
48
+ */
49
+ export declare function place(data: EntryOptions[], options: EntryOptions, parent: string | null, position: number): boolean;
50
+ /**
51
+ * Overlay a journal onto `data` in place. `filter(id, key)` restricts which
52
+ * changes apply; `key` is `null` when asking about the entry as a whole
53
+ * (creation, removal, relocation).
54
+ */
55
+ export declare function applyJournal(data: EntryOptions[], journal: Journal, filter?: (id: string, key: string | null) => boolean, warn?: (format: string, ...args: any[]) => void): EntryOptions[];
56
+ export interface Conflict {
57
+ id: string;
58
+ reason: string;
59
+ }
60
+ /**
61
+ * Three-way reconciliation of a journal against a new file state. The file
62
+ * wins every conflict: conflicting keys are dropped from the journal so that
63
+ * the tree follows the file, and each drop is reported.
64
+ *
65
+ * `fileOwned(id, key)` scopes the check to what the file can actually express
66
+ * (patch-owned keys and patch-inserted entries live elsewhere).
67
+ */
68
+ export declare function reconcile(journal: Journal, base: Map<string, FlatEntry>, theirs: Map<string, FlatEntry>, fileOwned: (id: string, key: string | null) => boolean): Conflict[];
69
+ //# sourceMappingURL=journal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"journal.d.ts","sourceRoot":"","sources":["../../src/journal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAClF,OAAO,EAAa,KAAK,IAAI,EAAQ,MAAM,uBAAuB,CAAA;AAElE,mFAAmF;AACnF,MAAM,MAAM,aAAa,GAAG,aAAa,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,CAAA;AAEvE,yBAAiB,aAAa,CAAC;IAC7B,UAAiB,MAAM;QACrB,IAAI,EAAE,QAAQ,CAAA;KACf;IAED,UAAiB,MAAM;QACrB,IAAI,EAAE,QAAQ,CAAA;QACd,+DAA+D;QAC/D,OAAO,EAAE,OAAO,CAAA;QAChB;;;WAGG;QACH,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;QACjC,mEAAmE;QACnE,QAAQ,EAAE,MAAM,CAAA;QAChB;;;;W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C1B,IAAI,EAAE,YAAY,EAAE,EACpB,OAAO,EAAE,OAAO,EAChB,MAAM,GAAE,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,KAAK,OAAoB,EAChE,IAAI,GAAE,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAe,kBA4B1D;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CACvB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,EAC5B,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,EAC9B,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,KAAK,OAAO,cA2CvD"}
@@ -0,0 +1,68 @@
1
+ import type { EntryOptions } from '@deepseek-ai/cordis-plugin-loader';
2
+ import { type Journal } from './journal.ts';
3
+ export interface PatchOptions {
4
+ id?: string;
5
+ insert?: EntryOptions[];
6
+ name?: string;
7
+ config?: any;
8
+ group?: boolean | null;
9
+ disabled?: boolean | null;
10
+ inject?: any;
11
+ intercept?: any;
12
+ isolate?: any;
13
+ [key: string]: any;
14
+ }
15
+ export type Warn = (format: string, ...args: any[]) => void;
16
+ /** Give every entry (nested groups included) an id, in place. */
17
+ export declare function ensureIds(entries: EntryOptions[], used: (id: string) => boolean): void;
18
+ /** Runtime changes are routed back to an inserted entry by its id, so every insert needs one. */
19
+ export declare function ensureInsertIds(patches: PatchOptions[] | undefined, used: (id: string) => boolean): void;
20
+ /**
21
+ * Overlay `patches` onto a fresh clone of `data`. Inserted entries are cloned
22
+ * too, so the tree owns every object it mounts.
23
+ */
24
+ export declare function applyPatches(data: EntryOptions[], patches: PatchOptions[] | undefined, warn: Warn): EntryOptions[];
25
+ /**
26
+ * Who owns an entry, or one key of it, in the patched tree: the file, a patch
27
+ * that overrides that key (the last one wins), or the patch that inserted the
28
+ * whole entry.
29
+ */
30
+ export type EntryOwner = EntryOwner.File | EntryOwner.Patch | EntryOwner.Insert;
31
+ export declare namespace EntryOwner {
32
+ interface File {
33
+ type: 'file';
34
+ }
35
+ interface Patch {
36
+ type: 'patch';
37
+ /** Index into the patch list. */
38
+ index: number;
39
+ }
40
+ interface Insert {
41
+ type: 'insert';
42
+ /** Index into the patch list. */
43
+ index: number;
44
+ /** The insert list (or nested group config) holding the entry. */
45
+ list: EntryOptions[];
46
+ options: EntryOptions;
47
+ /** The group the entry is inserted into (`null` for the root). */
48
+ parent: string | null;
49
+ }
50
+ }
51
+ export declare class PatchIndex {
52
+ patches: PatchOptions[];
53
+ private keys;
54
+ private inserts;
55
+ constructor(patches: PatchOptions[]);
56
+ /** Owner of the entry as a whole. */
57
+ entry(id: string | null): EntryOwner;
58
+ /** Owner of one key of an entry. */
59
+ key(id: string, key: string): EntryOwner;
60
+ fileOwned(id: string, key: string | null): boolean;
61
+ }
62
+ /**
63
+ * Route a journal to its owners: file-owned changes are applied to `data`,
64
+ * patch-owned ones to `patches`. Both are mutated in place, so pass clones.
65
+ * Returns whether any patch changed.
66
+ */
67
+ export declare function routeJournal(journal: Journal, data: EntryOptions[], patches: PatchOptions[], warn: Warn): boolean;
68
+ //# sourceMappingURL=patch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"patch.d.ts","sourceRoot":"","sources":["../../src/patch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAErE,OAAO,EAAiC,KAAK,OAAO,EAAS,MAAM,cAAc,CAAA;AAEjF,MAAM,WAAW,YAAY;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,YAAY,EAAE,CAAA;IACvB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb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E,YAAY,EAAE,CAAA;QACpB,OAAO,EAAE,YAAY,CAAA;QACrB,kEAAkE;QAClE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;KACtB;CACF;AAED,qBAAa,UAAU;IAIF,OAAO,EAAE,YAAY,EAAE;IAH1C,OAAO,CAAC,IAAI,CAAyC;IACrD,OAAO,CAAC,OAAO,CAAuC;gBAEnC,OAAO,EAAE,YAAY,EAAE;IAsB1C,qCAAqC;IACrC,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,UAAU;IAKpC,oCAAoC;IACpC,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,UAAU;IAOxC,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;CAGzC;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,IAAI,WAsEvG"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/cordis-plugin-include",
3
3
  "description": "Include files in cordis configurations",
4
- "version": "1.0.10",
4
+ "version": "1.0.11-alpha.2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -30,11 +30,11 @@
30
30
  "author": "Shigma <shigma10826@gmail.com>",
31
31
  "license": "MIT",
32
32
  "peerDependencies": {
33
- "@deepseek-ai/cordis-plugin-loader": "~1.0.6",
34
- "@deepseek-ai/cordis": "~4.0.5"
33
+ "@deepseek-ai/cordis-plugin-loader": "~1.0.7-alpha.2",
34
+ "@deepseek-ai/cordis": "~4.0.6-alpha.2"
35
35
  },
36
36
  "dependencies": {
37
- "@deepseek-ai/cosmokit": "~1.8.6",
37
+ "@deepseek-ai/cosmokit": "~1.8.7-alpha.2",
38
38
  "js-yaml": "^4.1.0"
39
39
  }
40
40
  }