@deepseek-ai/cordis-plugin-loader 1.0.1-rc.1

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.
@@ -0,0 +1,68 @@
1
+ import { Context, Fiber, Inject } from '@deepseek-ai/cordis';
2
+ import { Loader } from '../index.ts';
3
+ import { EntryGroup } from './group.ts';
4
+ import { EntryTree } from './tree.ts';
5
+ /** Static plugin hook for resolving a container config while preserving nested entry configs. */
6
+ export declare const EntryConfigResolver: unique symbol;
7
+ /**
8
+ * Resolve a container's own config while preserving any nested entry configs.
9
+ * @param ctx - the container plugin context.
10
+ * @param config - the container's raw config.
11
+ * @returns the config to validate for this activation.
12
+ */
13
+ export type EntryConfigResolver = (ctx: Context, config: any) => any;
14
+ /** Serialized plugin entry options stored in loader config files. */
15
+ export interface EntryOptions {
16
+ /** Stable id inside the containing entry tree. */
17
+ id: string;
18
+ /** Module specifier imported by the entry tree. */
19
+ name: string;
20
+ /** Config passed to the plugin. */
21
+ config?: any;
22
+ /** Marks this entry as a nested group. */
23
+ group?: boolean | null;
24
+ /** Prevents this entry and descendants from running. */
25
+ disabled?: boolean | null;
26
+ /** Required services or service intercept config for this entry. */
27
+ inject?: Inject | null;
28
+ }
29
+ /** One configured plugin node inside an `EntryTree`. */
30
+ export declare class Entry {
31
+ loader: Loader;
32
+ static readonly key: unique symbol;
33
+ ctx: Context;
34
+ fiber?: Fiber;
35
+ parent: EntryGroup;
36
+ options: EntryOptions;
37
+ subgroup?: EntryGroup;
38
+ subtree?: EntryTree;
39
+ _initTask?: Promise<void>;
40
+ _disposing: number;
41
+ private runtimeEnabled;
42
+ private runtimeEnableTask?;
43
+ constructor(loader: Loader);
44
+ get context(): Context;
45
+ get id(): string;
46
+ /** True when this entry or any owning parent entry is disabled. */
47
+ get disabled(): boolean;
48
+ private _disabled;
49
+ /**
50
+ * Enable this in-memory entry without rewriting its configured `disabled`
51
+ * value; the override survives config reapplication for this entry object.
52
+ * @returns a promise settling after its initial activation attempt.
53
+ */
54
+ enableRuntime(): Promise<void>;
55
+ evaluate(expr: string): any;
56
+ private _patchContext;
57
+ refresh(): Promise<void>;
58
+ _dispose(fiber?: Fiber | undefined): Promise<void>;
59
+ /** Merge new options, restart as needed, and persist through the parent tree. */
60
+ update(options: Partial<EntryOptions>, create?: boolean, force?: boolean): Promise<void>;
61
+ getOuterStack: () => string[];
62
+ /** Import and start the configured plugin if it is not already running. */
63
+ init(): Promise<void>;
64
+ _await(): Promise<void>;
65
+ private _init;
66
+ private _start;
67
+ }
68
+ //# sourceMappingURL=entry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../../../src/config/entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAE5D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAGrC,iGAAiG;AACjG,eAAO,MAAM,mBAAmB,eAAoD,CAAA;AAEpF;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,KAAK,GAAG,CAAA;AAEpE,qEAAqE;AACrE,MAAM,WAAW,YAAY;IAC3B,kDAAkD;IAClD,EAAE,EAAE,MAAM,CAAA;IACV,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAA;IACZ,mCAAmC;IACnC,MAAM,CAAC,EAAE,GAAG,CAAA;IACZ,0CAA0C;IAC1C,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;IACtB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;IACzB,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACvB;AA6BD,wDAAwD;AACxD,qBAAa,KAAK;IAgBG,MAAM,EAAE,MAAM;IAfjC,MAAM,CAAC,QAAQ,CAAC,GAAG,gBAA6B;IAEzC,GAAG,EAAE,OAAO,CAAA;IACZ,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,MAAM,EAAG,UAAU,CAAA;IAEnB,OAAO,EAAS,YAAY,CAAA;IAC5B,QAAQ,CAAC,EAAE,UAAU,CAAA;IACrB,OAAO,CAAC,EAAE,SAAS,CAAA;IAE1B,SAAS,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;IACzB,UAAU,SAAI;IACd,OAAO,CAAC,cAAc,CAAQ;IAC9B,OAAO,CAAC,iBAAiB,CAAC,CAAe;gBAEtB,MAAM,EAAE,MAAM;IAKjC,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,IAAI,EAAE,WAML;IAED,mEAAmE;IACnE,IAAI,QAAQ,YAEX;IAED,OAAO,CAAC,SAAS;IAYjB;;;;OAIG;IACH,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAW9B,QAAQ,CAAC,IAAI,EAAE,MAAM;YAIP,aAAa;IAUrB,OAAO;IAMP,QAAQ,CAAC,KAAK,oBAAa;IAWjC,iFAAiF;IAC3E,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,EAAE,MAAM,UAAQ,EAAE,KAAK,UAAQ;IA0G1E,aAAa,iBAQZ;IAED,2EAA2E;IACrE,IAAI;IAUJ,MAAM;YAQE,KAAK;YAcL,MAAM;CAYrB"}
@@ -0,0 +1,27 @@
1
+ import { Context, Service } from '@deepseek-ai/cordis';
2
+ import { type EntryOptions } from './entry.ts';
3
+ import { EntryTree } from './tree.ts';
4
+ /** Runtime owner for a list of child loader entries. */
5
+ export declare class EntryGroup {
6
+ ctx: Context;
7
+ tree: EntryTree;
8
+ static readonly key: unique symbol;
9
+ data: EntryOptions[];
10
+ constructor(ctx: Context, tree: EntryTree);
11
+ get context(): Context;
12
+ create(options: Omit<EntryOptions, 'id'>): Promise<string>;
13
+ unlink(options: EntryOptions): void;
14
+ remove(id: string, isDispose?: boolean): Promise<void>;
15
+ update(config: EntryOptions[]): Promise<void>;
16
+ stop(): Promise<void>;
17
+ }
18
+ /** Plugin that mounts a nested loader entry group. */
19
+ export declare class Group extends EntryGroup {
20
+ ctx: Context;
21
+ config: EntryOptions[];
22
+ static initial: Omit<EntryOptions, 'id'>[];
23
+ static readonly [EntryGroup.key] = true;
24
+ constructor(ctx: Context, config: EntryOptions[]);
25
+ [Service.init](): AsyncGenerator<() => Promise<void>, void, unknown>;
26
+ }
27
+ //# sourceMappingURL=group.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../../../src/config/group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAS,KAAK,YAAY,EAAE,MAAM,YAAY,CAAA;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,wDAAwD;AACxD,qBAAa,UAAU;IAKF,GAAG,EAAE,OAAO;IAAS,IAAI,EAAE,SAAS;IAJvD,MAAM,CAAC,QAAQ,CAAC,GAAG,gBAA6B;IAEzC,IAAI,EAAE,YAAY,EAAE,CAAK;gBAEb,GAAG,EAAE,OAAO,EAAS,IAAI,EAAE,SAAS;IAKvD,IAAI,OAAO,IAAI,OAAO,CAErB;IAEK,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC;IAsB9C,MAAM,CAAC,OAAO,EAAE,YAAY;IAMtB,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,UAAQ;IAWpC,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE;IAiD7B,IAAI;CAKX;AAED,sDAAsD;AACtD,qBAAa,KAAM,SAAQ,UAAU;IAIhB,GAAG,EAAE,OAAO;IAAS,MAAM,EAAE,YAAY,EAAE;IAH9D,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,EAAE,CAAK;IAC/C,MAAM,CAAC,QAAQ,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,QAAO;gBAEpB,GAAG,EAAE,OAAO,EAAS,MAAM,EAAE,YAAY,EAAE;IAKvD,CAAC,OAAO,CAAC,IAAI,CAAC;CAItB"}
@@ -0,0 +1,35 @@
1
+ import { Context } from '@deepseek-ai/cordis';
2
+ import type { Dict } from '@deepseek-ai/cosmokit';
3
+ import { Entry } from './entry.ts';
4
+ declare module './entry.ts' {
5
+ interface EntryOptions {
6
+ intercept?: Dict | null;
7
+ isolate?: Dict<true | string> | null;
8
+ }
9
+ interface Entry {
10
+ realm: LocalRealm;
11
+ }
12
+ }
13
+ /** Symbol realm used to isolate service implementations by entry or label. */
14
+ export declare abstract class Realm {
15
+ protected store: Dict<symbol>;
16
+ abstract get suffix(): string;
17
+ access(key: string, create?: boolean): symbol;
18
+ delete(key: string): void;
19
+ get size(): number;
20
+ }
21
+ /** Entry-local isolation realm. */
22
+ export declare class LocalRealm extends Realm {
23
+ private entry;
24
+ constructor(entry: Entry);
25
+ get suffix(): string;
26
+ }
27
+ /** Named isolation realm shared by entries that use the same label. */
28
+ export declare class GlobalRealm extends Realm {
29
+ label: string;
30
+ constructor(label: string);
31
+ get suffix(): string;
32
+ }
33
+ /** Install loader hooks that apply `intercept` and `isolate` entry options. */
34
+ export default function isolate(ctx: Context): void;
35
+ //# sourceMappingURL=isolate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isolate.d.ts","sourceRoot":"","sources":["../../../src/config/isolate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAElC,OAAO,QAAQ,YAAY,CAAC;IAC1B,UAAU,YAAY;QACpB,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;QACvB,OAAO,CAAC,EAAE,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,GAAG,IAAI,CAAA;KACrC;IAED,UAAU,KAAK;QACb,KAAK,EAAE,UAAU,CAAA;KAClB;CACF;AAWD,8EAA8E;AAC9E,8BAAsB,KAAK;IACzB,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAsB;IAEnD,QAAQ,KAAK,MAAM,IAAI,MAAM,CAAA;IAE7B,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,UAAQ;IAQlC,MAAM,CAAC,GAAG,EAAE,MAAM;IAIlB,IAAI,IAAI,WAEP;CACF;AAED,mCAAmC;AACnC,qBAAa,UAAW,SAAQ,KAAK;IACvB,OAAO,CAAC,KAAK;gBAAL,KAAK,EAAE,KAAK;IAIhC,IAAI,MAAM,WAET;CACF;AAED,uEAAuE;AACvE,qBAAa,WAAY,SAAQ,KAAK;IACjB,KAAK,EAAE,MAAM;gBAAb,KAAK,EAAE,MAAM;IAIhC,IAAI,MAAM,WAET;CACF;AAED,+EAA+E;AAC/E,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,GAAG,EAAE,OAAO,QAsG3C"}
@@ -0,0 +1,38 @@
1
+ import { Context } from '@deepseek-ai/cordis';
2
+ import { type Dict } from '@deepseek-ai/cosmokit';
3
+ import { Entry, type EntryOptions } from './entry.ts';
4
+ import { EntryGroup } from './group.ts';
5
+ /** Mutable tree of loader entries. Persistence is supplied by subclasses. */
6
+ export declare abstract class EntryTree {
7
+ static readonly sep = ":";
8
+ ctx: Context;
9
+ enableLogs?: boolean;
10
+ root: EntryGroup;
11
+ store: Dict<Entry>;
12
+ constructor(ctx: Context);
13
+ get context(): Context;
14
+ /** Iterate entries in this tree and any nested subtrees. */
15
+ entries(): Generator<Entry, void, void>;
16
+ /** Return pending import and lifecycle tasks owned by this tree. */
17
+ getTasks(): Promise<void>[];
18
+ /**
19
+ * Wait until this tree has no active import or lifecycle tasks.
20
+ * @throws a settled fiber failure, or an aggregate when several fibers failed.
21
+ */
22
+ await(): Promise<void>;
23
+ ensureId(options: Partial<EntryOptions>): string;
24
+ /** Resolve an entry by id, including nested ids separated by `EntryTree.sep`. */
25
+ resolve(id: string): Entry;
26
+ resolveGroup(id: string | null): EntryGroup;
27
+ /** Create an entry in the root group or a nested group. */
28
+ create(options: Omit<EntryOptions, 'id'>, parent?: string | null, position?: number): Promise<string>;
29
+ /** Stop and remove an entry from its parent group. */
30
+ remove(id: string): Promise<void>;
31
+ /** Update an entry and optionally move it to another group. */
32
+ update(id: string, options: Omit<EntryOptions, 'id' | 'name'>, parent?: string | null, position?: number): Promise<void>;
33
+ /** Import a plugin module from a specifier or `cordis:` builtin. */
34
+ import(name: string, getOuterStack?: () => string[]): any;
35
+ /** Persist current tree state. In-memory trees may implement this as a no-op. */
36
+ abstract write(): void;
37
+ }
38
+ //# sourceMappingURL=tree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../../src/config/tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,EAAiB,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAChE,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEvC,6EAA6E;AAC7E,8BAAsB,SAAS;IAC7B,MAAM,CAAC,QAAQ,CAAC,GAAG,OAAM;IAElB,GAAG,EAAE,OAAO,CAAA;IACZ,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,IAAI,EAAE,UAAU,CAAA;IAChB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAsB;gBAEnC,GAAG,EAAE,OAAO;IAOxB,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,4DAA4D;IAC1D,OAAO,IAAI,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC;IAQzC,oEAAoE;IACpE,QAAQ;IAMR;;;OAGG;IACG,KAAK;IAoBX,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC;IASvC,iFAAiF;IACjF,OAAO,CAAC,EAAE,EAAE,MAAM;IAalB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAO9B,2DAA2D;IACrD,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,EAAE,MAAM,GAAE,MAAM,GAAG,IAAW,EAAE,QAAQ,SAAW;IASjG,sDAAsD;IAChD,MAAM,CAAC,EAAE,EAAE,MAAM;IAMvB,+DAA+D;IACzD,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,GAAG,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,CAAC,EAAE,MAAM;IA8B9G,oEAAoE;IACpE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,MAAM,EAAE;IAmBnD,iFAAiF;IACjF,QAAQ,CAAC,KAAK,IAAI,IAAI;CACvB"}
@@ -0,0 +1,11 @@
1
+ /** Evaluate a JavaScript expression against a loader context scope. */
2
+ export declare const evaluate: ((ctx: object, expr: string) => any);
3
+ /** Recursively replace YAML `!js` expression nodes with evaluated values. */
4
+ export declare function interpolate(ctx: object, value: any): any;
5
+ /** Return true when a value is a serialized loader JavaScript expression. */
6
+ export declare function isJsExpr(value: any): value is JsExpr;
7
+ /** Serialized JavaScript expression produced by the include YAML tag. */
8
+ export interface JsExpr {
9
+ __jsExpr: string;
10
+ }
11
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/config/utils.ts"],"names":[],"mappings":"AAGA,uEAAuE;AACvE,eAAO,MAAM,QAAQ,EAIf,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,GAAG,CAAC,CAAA;AAE1C,6EAA6E;AAC7E,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAUlD;AAED,6EAA6E;AAC7E,wBAAgB,QAAQ,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,MAAM,CAEpD;AAED,yEAAyE;AACzE,MAAM,WAAW,MAAM;IACrB,QAAQ,EAAE,MAAM,CAAA;CACjB"}
@@ -0,0 +1,73 @@
1
+ import { Context, Service, type Fiber } from '@deepseek-ai/cordis';
2
+ import { type Dict } from '@deepseek-ai/cosmokit';
3
+ import { ModuleLoader } from './internal.ts';
4
+ import { Entry, type EntryOptions } from './config/entry.ts';
5
+ import { EntryTree } from './config/tree.ts';
6
+ /** Re-export entry node APIs. */
7
+ export * from './config/entry.ts';
8
+ /** Re-export nested entry group APIs. */
9
+ export * from './config/group.ts';
10
+ /** Re-export service isolation helpers. */
11
+ export * from './config/isolate.ts';
12
+ /** Re-export entry tree persistence APIs. */
13
+ export * from './config/tree.ts';
14
+ /** Re-export loader config expression helpers. */
15
+ export * from './config/utils.ts';
16
+ /** Re-export Node internal module loader compatibility types. */
17
+ export * from './internal.ts';
18
+ declare module '@deepseek-ai/cordis' {
19
+ interface Events {
20
+ 'exit'(signal: NodeJS.Signals): Promise<void>;
21
+ 'loader/config-update'(): void;
22
+ 'loader/entry-init'(entry: Entry): void;
23
+ 'loader/partial-dispose'(entry: Entry, legacy: Partial<EntryOptions>, active: boolean): void;
24
+ 'loader/patch-context'(entry: Entry, next: () => void | Promise<void>): void | Promise<void>;
25
+ }
26
+ interface Context {
27
+ loader: Loader;
28
+ }
29
+ interface EnvData {
30
+ startTime?: number;
31
+ }
32
+ interface Fiber {
33
+ entry?: Entry;
34
+ }
35
+ }
36
+ /** Loader config and dependency intercept namespace. */
37
+ export declare namespace Loader {
38
+ /** Root loader configuration. */
39
+ interface Config {
40
+ /** Base URL used to resolve relative plugin specifiers and config paths. */
41
+ baseUrl?: string;
42
+ }
43
+ /** Intercept config used when other plugins depend on `loader`. */
44
+ interface Intercept {
45
+ /** Keep dependent plugins pending while loader entries are still loading. */
46
+ await?: boolean;
47
+ }
48
+ }
49
+ /**
50
+ * Service that owns a loader entry tree and imports configured plugins.
51
+ *
52
+ * Subclasses provide persistence by implementing `write()` on `EntryTree`.
53
+ */
54
+ export declare class Loader extends EntryTree {
55
+ config: Loader.Config;
56
+ [Service.config]: Loader.Intercept;
57
+ envData: any;
58
+ name: string;
59
+ internal: ModuleLoader | undefined;
60
+ builtins: Dict<any>;
61
+ constructor(ctx: Context, config?: Loader.Config);
62
+ write(): void;
63
+ [Service.check](): boolean;
64
+ showLog(entry: Entry, type: string): void;
65
+ /** Return the loader entry id that owns `fiber`, if any. */
66
+ locate(fiber?: Fiber): string | undefined;
67
+ /** Hook for hosts that can restart the process on full-reload requests. */
68
+ exit(): void;
69
+ /** Normalize ESM/CJS/default export shapes before applying a plugin. */
70
+ unwrapExports(exports: any): any;
71
+ }
72
+ export default Loader;
73
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAsB,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,qBAAqB,CAAA;AACtF,OAAO,EAA8B,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EACL,KAAK,EAGL,KAAK,YAAY,EAClB,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAG5C,iCAAiC;AACjC,cAAc,mBAAmB,CAAA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MAAM,CAAC,SAAS,CAAA;IAEnC,OAAO,MAEe;IAEtB,IAAI,SAAW;IACf,QAAQ,2BAA8B;IAEtC,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,CAAsB;gBAEpC,GAAG,EAAE,OAAO,EAAS,MAAM,GAAE,MAAM,CAAC,MAAW;IAmF3D,KAAK;IAIL,CAAC,OAAO,CAAC,KAAK,CAAC;IAMf,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM;IAKlC,4DAA4D;IAC5D,MAAM,CAAC,KAAK,QAAiB;IAS7B,2EAA2E;IAC3E,IAAI;IAGJ,wEAAwE;IACxE,aAAa,CAAC,OAAO,EAAE,GAAG;CAQ3B;AAED,eAAe,MAAM,CAAA"}
@@ -0,0 +1,97 @@
1
+ import { type LoadHookContext } from 'node:module';
2
+ import type { Dict } from '@deepseek-ai/cosmokit';
3
+ /** Node internal module format names handled by loader hooks. */
4
+ export type ModuleFormat = 'builtin' | 'commonjs' | 'json' | 'module' | 'wasm';
5
+ /** Source payload accepted by Node internal module load hooks. */
6
+ export type ModuleSource = string | ArrayBuffer;
7
+ /** Result returned by a Node internal resolve hook. */
8
+ export interface ResolveResult {
9
+ format: ModuleFormat;
10
+ url: string;
11
+ }
12
+ /** Result returned by a Node internal load hook. */
13
+ export interface LoadResult {
14
+ format: ModuleFormat;
15
+ source?: ModuleSource;
16
+ }
17
+ type LoadCacheData = ModuleJob;
18
+ /** @see https://github.com/nodejs/node/blob/main/lib/internal/modules/esm/module_map.js */
19
+ interface LoadCache extends Omit<Map<string, Dict<LoadCacheData>>, 'get' | 'set' | 'has'> {
20
+ get(url: string, type?: string): LoadCacheData | undefined;
21
+ set(url: string, type?: string, job?: LoadCacheData): this;
22
+ has(url: string, type?: string): boolean;
23
+ }
24
+ /** Minimal Node internal ModuleWrap surface used by HMR helpers. */
25
+ export interface ModuleWrap {
26
+ url: string;
27
+ getNamespace(): any;
28
+ }
29
+ /** @see https://github.com/nodejs/node/blob/main/lib/internal/modules/esm/module_job.js */
30
+ export interface ModuleJob {
31
+ url: string;
32
+ loader: ModuleLoader;
33
+ module?: ModuleWrap;
34
+ importAttributes: ImportAttributes;
35
+ linked: Promise<ModuleJob[]>;
36
+ instantiate(): Promise<void>;
37
+ run(): Promise<{
38
+ module: ModuleWrap;
39
+ }>;
40
+ }
41
+ /**
42
+ * Node 22/23 ModuleLoader interface.
43
+ *
44
+ * Key methods:
45
+ * - getModuleJobForImport(specifier, parentURL, importAttributes)
46
+ * - resolve(specifier, parentURL, importAttributes) → Promise<ResolveResult>
47
+ * - resolveSync(specifier, parentURL, importAttributes) → ResolveResult
48
+ */
49
+ export interface ModuleLoaderV1 {
50
+ version: 'v1';
51
+ loadCache: LoadCache;
52
+ import(specifier: string, parentURL: string, importAttributes: ImportAttributes): Promise<any>;
53
+ register(specifier: string | URL, parentURL?: string | URL, data?: any, transferList?: any[]): void;
54
+ getModuleJobForImport(specifier: string, parentURL: string, importAttributes: ImportAttributes): Promise<ModuleJob>;
55
+ resolve(specifier: string, parentURL: string, importAttributes: ImportAttributes): Promise<ResolveResult>;
56
+ resolveSync(specifier: string, parentURL: string, importAttributes: ImportAttributes): ResolveResult;
57
+ load(specifier: string, context: Pick<LoadHookContext, 'format' | 'importAttributes'>): Promise<LoadResult>;
58
+ }
59
+ /** Node 24+ module request object. */
60
+ export interface ModuleRequest {
61
+ specifier: string;
62
+ attributes?: ImportAttributes;
63
+ phase?: ModulePhase;
64
+ }
65
+ /** @see https://github.com/nodejs/node/blob/main/src/module_wrap.h */
66
+ export declare const enum ModulePhase {
67
+ Source = 1,
68
+ Evaluation = 2
69
+ }
70
+ /** Opaque Node internal module request type marker. */
71
+ export type ModuleRequestType = unknown;
72
+ /**
73
+ * Node 24+ ModuleLoader interface.
74
+ *
75
+ * Breaking changes from v1:
76
+ * - getModuleJobForImport removed → getOrCreateModuleJob(parentURL, request, requestType)
77
+ * - resolve removed (became private #resolve) → resolveSync(parentURL, request)
78
+ * - Parameter order reversed for resolveSync, request object { specifier, attributes }
79
+ * - LoadCache became typed Map<url, { [type]: ModuleJob }> with delete only setting undefined
80
+ */
81
+ export interface ModuleLoaderV2 {
82
+ version: 'v2';
83
+ loadCache: LoadCache;
84
+ import(specifier: string, parentURL: string, importAttributes: ImportAttributes, phase?: ModulePhase, isEntryPoint?: boolean): Promise<any>;
85
+ register(specifier: string | URL, parentURL?: string | URL, data?: any, transferList?: any[], isInternal?: boolean): void;
86
+ getOrCreateModuleJob(parentURL: string, request: ModuleRequest, requestType?: ModuleRequestType): Promise<ModuleJob>;
87
+ resolveSync(parentURL: string, request: ModuleRequest): ResolveResult;
88
+ load(url: string, context: Pick<LoadHookContext, 'format' | 'importAttributes'>): Promise<LoadResult>;
89
+ }
90
+ /** Supported Node internal ESM loader shapes. */
91
+ export type ModuleLoader = ModuleLoaderV1 | ModuleLoaderV2;
92
+ /** Helpers for locating the current Node internal module loader. */
93
+ export declare namespace ModuleLoader {
94
+ function fromInternal(): ModuleLoader | undefined;
95
+ }
96
+ export {};
97
+ //# sourceMappingURL=internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,eAAe,EAAE,MAAM,aAAa,CAAA;AACjE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAEjD,iEAAiE;AACjE,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAA;AAC9E,kEAAkE;AAClE,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,WAAW,CAAA;AAE/C,uDAAuD;AACvD,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,YAAY,CAAA;IACpB,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,oDAAoD;AACpD,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,YAAY,CAAA;IACpB,MAAM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IAC3I,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,GAAG,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,YAAY,CAAC,EAAE,GAAG,EAAE,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;IACzH,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,SAAS,CAAC,CAAA;IACpH,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,aAAa,CAAA;IACrE,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,QAAQ,GAAG,kBAAkB,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;CACtG;AAED,iDAAiD;AACjD,MAAM,MAAM,YAAY,GAAG,cAAc,GAAG,cAAc,CAAA;AAE1D,oEAAoE;AACpE,yBAAiB,YAAY,CAAC;IAe5B,SAAgB,YAAY,IAAI,YAAY,GAAG,SAAS,CAWvD;CACF"}
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@deepseek-ai/cordis-plugin-loader",
3
+ "description": "Plugin loader for cordis",
4
+ "version": "1.0.1-rc.1",
5
+ "publishConfig": {
6
+ "access": "restricted"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
11
+ "directory": "vendor/loader"
12
+ },
13
+ "type": "module",
14
+ "main": "lib/index.js",
15
+ "types": "lib/types/index.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./lib/types/index.d.ts",
19
+ "default": "./lib/index.js"
20
+ },
21
+ "./src/*": "./src/*",
22
+ "./package.json": "./package.json"
23
+ },
24
+ "files": [
25
+ "lib/index.js",
26
+ "lib/types/**/*.d.ts",
27
+ "lib/types/**/*.d.ts.map",
28
+ "src"
29
+ ],
30
+ "author": "Shigma <shigma10826@gmail.com>",
31
+ "license": "MIT",
32
+ "peerDependencies": {
33
+ "node-addon-require-builtin": "^0.1.4",
34
+ "@deepseek-ai/cordis": "^4.0.1-rc.1"
35
+ },
36
+ "peerDependenciesMeta": {
37
+ "node-addon-require-builtin": {
38
+ "optional": true
39
+ }
40
+ },
41
+ "dependencies": {
42
+ "@deepseek-ai/cosmokit": "^1.8.2-rc.1"
43
+ }
44
+ }