@avantf/dsh-mem 0.1.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.
- package/LICENSE +21 -0
- package/README.md +140 -0
- package/lib/client.js +5901 -0
- package/lib/client.js.map +1 -0
- package/lib/dsh-build.json +7 -0
- package/lib/index.js +14329 -0
- package/lib/types/client/domains.d.ts +52 -0
- package/lib/types/client/domains.d.ts.map +1 -0
- package/lib/types/client/domains.js +25 -0
- package/lib/types/client/domains.js.map +1 -0
- package/lib/types/client/index.d.ts +35 -0
- package/lib/types/client/index.d.ts.map +1 -0
- package/lib/types/client/index.js +1351 -0
- package/lib/types/client/index.js.map +1 -0
- package/lib/types/client/ingest.d.ts +24 -0
- package/lib/types/client/ingest.d.ts.map +1 -0
- package/lib/types/client/ingest.js +30 -0
- package/lib/types/client/ingest.js.map +1 -0
- package/lib/types/client/paging.d.ts +30 -0
- package/lib/types/client/paging.d.ts.map +1 -0
- package/lib/types/client/paging.js +36 -0
- package/lib/types/client/paging.js.map +1 -0
- package/lib/types/client/summarize.d.ts +11 -0
- package/lib/types/client/summarize.d.ts.map +1 -0
- package/lib/types/client/summarize.js +79 -0
- package/lib/types/client/summarize.js.map +1 -0
- package/lib/types/envinit-bootstrap.d.ts +43 -0
- package/lib/types/envinit-bootstrap.js +323 -0
- package/lib/types/envinit.d.ts +145 -0
- package/lib/types/envinit.d.ts.map +1 -0
- package/lib/types/envinit.js +495 -0
- package/lib/types/envinit.js.map +1 -0
- package/lib/types/hints.d.ts +42 -0
- package/lib/types/hints.d.ts.map +1 -0
- package/lib/types/hints.js +54 -0
- package/lib/types/hints.js.map +1 -0
- package/lib/types/index.d.ts +74 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +708 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/inject.d.ts +14 -0
- package/lib/types/inject.d.ts.map +1 -0
- package/lib/types/inject.js +14 -0
- package/lib/types/inject.js.map +1 -0
- package/lib/types/open.d.ts +27 -0
- package/lib/types/open.d.ts.map +1 -0
- package/lib/types/open.js +133 -0
- package/lib/types/open.js.map +1 -0
- package/lib/types/prompt.d.ts +49 -0
- package/lib/types/prompt.d.ts.map +1 -0
- package/lib/types/prompt.js +65 -0
- package/lib/types/prompt.js.map +1 -0
- package/lib/types/provision.d.ts +117 -0
- package/lib/types/provision.d.ts.map +1 -0
- package/lib/types/provision.js +233 -0
- package/lib/types/provision.js.map +1 -0
- package/lib/types/remote.d.ts +17 -0
- package/lib/types/remote.d.ts.map +1 -0
- package/lib/types/remote.js +233 -0
- package/lib/types/remote.js.map +1 -0
- package/lib/types/tool_schema.d.ts +40 -0
- package/lib/types/tool_schema.d.ts.map +1 -0
- package/lib/types/tool_schema.js +149 -0
- package/lib/types/tool_schema.js.map +1 -0
- package/package.json +109 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The 知识域 picker's option list.
|
|
3
|
+
*
|
|
4
|
+
* The host's `kbDomains` returns `knowledge.domains` (the configured allowlist) ∪ the domains the
|
|
5
|
+
* library already holds. The union is the point: a historical name that the allowlist would not
|
|
6
|
+
* accept as NEW must stay selectable, or the tab offers a value the store then refuses.
|
|
7
|
+
* `restricted` mirrors "the allowlist is non-empty" — then the control is a closed `<select>` and
|
|
8
|
+
* a new domain is a config change, not a second spelling of an existing one. An explicitly empty
|
|
9
|
+
* allowlist means no restriction, so the control stays a free input.
|
|
10
|
+
*/
|
|
11
|
+
export interface DomainCatalog {
|
|
12
|
+
domains: string[];
|
|
13
|
+
restricted: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** One `<option>`: `value` is what the form sends, `label` is what the user reads. */
|
|
16
|
+
export interface DomainOption {
|
|
17
|
+
value: string;
|
|
18
|
+
label: string;
|
|
19
|
+
}
|
|
20
|
+
/** The empty choice first, then every catalog domain in the host's order. */
|
|
21
|
+
export declare function domainOptions(catalog: DomainCatalog | null, emptyLabel: string): DomainOption[];
|
|
22
|
+
/**
|
|
23
|
+
* `'select'` when the allowlist is active (non-empty) — the control must not offer free input, or
|
|
24
|
+
* two spellings of one domain can still be created. `'input'` when it is empty (no restriction),
|
|
25
|
+
* and also while the catalog is not loaded yet: the form stays usable and the store is the final
|
|
26
|
+
* guard either way.
|
|
27
|
+
*/
|
|
28
|
+
export declare function domainPickerMode(catalog: DomainCatalog | null): 'select' | 'input';
|
|
29
|
+
/**
|
|
30
|
+
* What the 「+」 draft means, so the form and the store agree on the rules BEFORE a round-trip.
|
|
31
|
+
*
|
|
32
|
+
* `existing` is not an error: a name the picker already offers is a SELECTION (the user typed the
|
|
33
|
+
* option instead of choosing it), and writing it a second time would only produce a duplicate list
|
|
34
|
+
* entry. `invalid` is the case that must never reach the store: a `/` or `\` would become one level
|
|
35
|
+
* of the managed path (`docs/<domain>/<source>/<title>.md`), and `sanitizeSegment` rewrites it — so
|
|
36
|
+
* the picker would show a name that is not the directory name.
|
|
37
|
+
*/
|
|
38
|
+
export type NewDomainCheck = {
|
|
39
|
+
kind: 'empty';
|
|
40
|
+
} | {
|
|
41
|
+
kind: 'invalid';
|
|
42
|
+
reason: string;
|
|
43
|
+
} | {
|
|
44
|
+
kind: 'existing';
|
|
45
|
+
name: string;
|
|
46
|
+
} | {
|
|
47
|
+
kind: 'new';
|
|
48
|
+
name: string;
|
|
49
|
+
};
|
|
50
|
+
/** Classify one 「+」 draft against the domains the picker currently offers. */
|
|
51
|
+
export declare function checkNewDomain(raw: string, existing: readonly string[]): NewDomainCheck;
|
|
52
|
+
//# sourceMappingURL=domains.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domains.d.ts","sourceRoot":"","sources":["../../../src/client/domains.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,UAAU,EAAE,OAAO,CAAA;CACpB;AAED,sFAAsF;AACtF,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAED,6EAA6E;AAC7E,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,EAAE,UAAU,EAAE,MAAM,GAAG,YAAY,EAAE,CAG/F;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,GAAG,QAAQ,GAAG,OAAO,CAElF;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACnC;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAEjC,8EAA8E;AAC9E,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,cAAc,CAOvF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** The empty choice first, then every catalog domain in the host's order. */
|
|
2
|
+
export function domainOptions(catalog, emptyLabel) {
|
|
3
|
+
const domains = catalog === null ? [] : catalog.domains;
|
|
4
|
+
return [{ value: '', label: emptyLabel }, ...domains.map(domain => ({ value: domain, label: domain }))];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* `'select'` when the allowlist is active (non-empty) — the control must not offer free input, or
|
|
8
|
+
* two spellings of one domain can still be created. `'input'` when it is empty (no restriction),
|
|
9
|
+
* and also while the catalog is not loaded yet: the form stays usable and the store is the final
|
|
10
|
+
* guard either way.
|
|
11
|
+
*/
|
|
12
|
+
export function domainPickerMode(catalog) {
|
|
13
|
+
return catalog !== null && catalog.restricted ? 'select' : 'input';
|
|
14
|
+
}
|
|
15
|
+
/** Classify one 「+」 draft against the domains the picker currently offers. */
|
|
16
|
+
export function checkNewDomain(raw, existing) {
|
|
17
|
+
const name = raw.trim();
|
|
18
|
+
if (name === '')
|
|
19
|
+
return { kind: 'empty' };
|
|
20
|
+
if (name.includes('/') || name.includes('\\')) {
|
|
21
|
+
return { kind: 'invalid', reason: '知识域不能包含 “/” 或 “\\”' };
|
|
22
|
+
}
|
|
23
|
+
return existing.includes(name) ? { kind: 'existing', name } : { kind: 'new', name };
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=domains.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domains.js","sourceRoot":"","sources":["../../../src/client/domains.ts"],"names":[],"mappings":"AAqBA,6EAA6E;AAC7E,MAAM,UAAU,aAAa,CAAC,OAA6B,EAAE,UAAkB;IAC7E,MAAM,OAAO,GAAG,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAA;IACvD,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAA;AACzG,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAA6B;IAC5D,OAAO,OAAO,KAAK,IAAI,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAA;AACpE,CAAC;AAiBD,8EAA8E;AAC9E,MAAM,UAAU,cAAc,CAAC,GAAW,EAAE,QAA2B;IACrE,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,CAAA;IACvB,IAAI,IAAI,KAAK,EAAE;QAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAA;IACzC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9C,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,oBAAoB,EAAE,CAAA;IAC1D,CAAC;IACD,OAAO,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;AACrF,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** The slice of the client Context this plugin uses. */
|
|
2
|
+
interface ClientContext {
|
|
3
|
+
slots: {
|
|
4
|
+
inject(name: string, register: () => void): void;
|
|
5
|
+
register(options: {
|
|
6
|
+
name: string;
|
|
7
|
+
id: string;
|
|
8
|
+
order: number;
|
|
9
|
+
label: () => string;
|
|
10
|
+
}, component: () => unknown): void;
|
|
11
|
+
};
|
|
12
|
+
remote: {
|
|
13
|
+
/** Mount this package's own Remote contribution (see `./remote.ts`). */
|
|
14
|
+
$mount(contribution: unknown): Promise<() => Promise<void>>;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Cordis service lookup. Required here because `ctx.remote.avantfMem` is
|
|
18
|
+
* guarded: a dotted property read demands that exact key in the plugin's own
|
|
19
|
+
* `inject`, which would park this entry before it can mount the namespace.
|
|
20
|
+
* `get()` has no such requirement and returns the mounted service object.
|
|
21
|
+
*/
|
|
22
|
+
get(name: string): unknown;
|
|
23
|
+
}
|
|
24
|
+
/** Client cordis-plugin name shown in boot diagnostics. */
|
|
25
|
+
export declare const name = "avantf-mem-client";
|
|
26
|
+
/**
|
|
27
|
+
* Services required to render the two tabs. `remote` (not `remote.avantfMem`)
|
|
28
|
+
* on purpose: a missing namespace must not leave this entry pending, because
|
|
29
|
+
* the client boot rejects the whole tree when any entry is pending.
|
|
30
|
+
*/
|
|
31
|
+
export declare const inject: string[];
|
|
32
|
+
/** Contribute the two `conversation.view` tabs, mounting this package's Remote namespace first. */
|
|
33
|
+
export declare function apply(ctx: ClientContext): Promise<void>;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AA+FA,wDAAwD;AACxD,UAAU,aAAa;IACrB,KAAK,EAAE;QACL,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAA;QAChD,QAAQ,CACN,OAAO,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,MAAM,CAAA;SAAE,EACzE,SAAS,EAAE,MAAM,OAAO,GACvB,IAAI,CAAA;KACR,CAAA;IACD,MAAM,EAAE;QACN,wEAAwE;QACxE,MAAM,CAAC,YAAY,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;KAC5D,CAAA;IACD;;;;;OAKG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;CAC3B;AAm7CD,2DAA2D;AAC3D,eAAO,MAAM,IAAI,sBAAsB,CAAA;AAEvC;;;;GAIG;AACH,eAAO,MAAM,MAAM,UAAsB,CAAA;AAEzC,mGAAmG;AACnG,wBAAsB,KAAK,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAoC7D"}
|