@gyoungwe/research-suite 0.1.3 → 0.1.6
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/build-manifest.json +2 -2
- package/node_modules/@gyoungwe/pi-core/README.md +5 -3
- package/node_modules/@gyoungwe/pi-core/build-manifest.json +2 -2
- package/node_modules/@gyoungwe/pi-core/dist/index.mjs +435 -151
- package/node_modules/@gyoungwe/pi-core/package.json +1 -1
- package/node_modules/@gyoungwe/pi-knowledge/build-manifest.json +68 -3
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/capability-discovery.d.ts +7 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/capability-discovery.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/claim-conflicts.d.ts +30 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/claim-conflicts.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/config.d.ts +55 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/config.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/daily-discovery-prompt.d.ts +11 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/daily-discovery-prompt.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/daily-discovery.d.ts +26 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/daily-discovery.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/deliverable-review.d.ts +127 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/deliverable-review.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/evolution.d.ts +39 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/evolution.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/experience-store.d.ts +290 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/experience-store.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/extension-helpers.d.ts +38 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/extension-helpers.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/files.d.ts +39 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/files.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/flow-cards.d.ts +77 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/flow-cards.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/graph-cache.d.ts +14 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/graph-cache.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/graph-retrieval.d.ts +44 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/graph-retrieval.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/host.d.ts +9 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/host.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/index.d.ts +46 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/index.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/ingest-frontmatter.d.ts +125 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/ingest-frontmatter.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/ingest-identity.d.ts +93 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/ingest-identity.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/ingest-policy.d.ts +63 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/ingest-policy.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/layout.d.ts +47 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/layout.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/maintenance.d.ts +16 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/maintenance.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/memory-note.d.ts +14 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/memory-note.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/metacognitive-policy.d.ts +116 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/metacognitive-policy.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/note-title.d.ts +8 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/note-title.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/orchestration-policy.d.ts +84 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/orchestration-policy.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/project-identity.d.ts +70 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/project-identity.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/publication-policy.d.ts +39 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/publication-policy.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/publication.d.ts +24 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/publication.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/recent-by-category.d.ts +15 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/recent-by-category.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/related-notes.d.ts +4 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/related-notes.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/reuse.d.ts +124 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/reuse.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/review-policy.d.ts +12 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/review-policy.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/runtime-host.d.ts +98 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/runtime-host.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/search-policy.d.ts +14 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/search-policy.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/semantic-model.d.ts +85 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/semantic-model.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/semantic-provider.d.ts +41 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/semantic-provider.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/semantic-settings.d.ts +30 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/semantic-settings.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/service.d.ts +171 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/service.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/source-links.d.ts +13 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/source-links.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/specialist-delivery.d.ts +8 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/specialist-delivery.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/specialist-host.d.ts +61 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/specialist-host.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/specialists.d.ts +55 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/specialists.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/task-feedback.d.ts +57 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/task-feedback.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/tool-budget.d.ts +24 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/tool-budget.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/topic-candidate.d.ts +22 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/topic-candidate.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/topic-memory.d.ts +79 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/topic-memory.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/topic-probe.d.ts +2 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/topic-probe.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/ui-service.d.ts +360 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/ui-service.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/ui-state.d.ts +28 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/ui-state.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/wiki-model-review.d.ts +167 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/wiki-model-review.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/wiki-policy.d.ts +34 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/wiki-policy.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/wiki-review.d.ts +74 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/wiki-review.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/worker.d.ts +2 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/core/worker.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/extension/internal-knowledge-extension.d.ts +42 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/extension/internal-knowledge-extension.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/extension/knowledge-extension.d.ts +5 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/extension/knowledge-extension.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/extension/knowledge-worker.d.ts +6 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/extension/knowledge-worker.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/host.d.ts +7 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/host.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/host.mjs +11638 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/index.d.ts +6 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/index.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/index.mjs +4728 -10301
- package/node_modules/@gyoungwe/pi-knowledge/dist/maintenance/plan.d.ts +41 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/maintenance/plan.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/maintenance/prompts.d.ts +10 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/maintenance/prompts.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/maintenance/run.d.ts +31 -0
- package/node_modules/@gyoungwe/pi-knowledge/dist/maintenance/run.d.ts.map +1 -0
- package/node_modules/@gyoungwe/pi-knowledge/lib/knowledge/runtime/.knowledge-worker-manifest.json +9 -0
- package/node_modules/@gyoungwe/pi-knowledge/lib/knowledge/runtime/worker.mjs +142 -12
- package/node_modules/@gyoungwe/pi-knowledge/package.json +21 -3
- package/node_modules/@gyoungwe/pi-knowledge/plugin.manifest.json +23 -1
- package/node_modules/@gyoungwe/pi-research/build-manifest.json +2 -2
- package/node_modules/@gyoungwe/pi-research/dist/index.mjs +3141 -613
- package/node_modules/@gyoungwe/pi-research/package.json +1 -1
- package/node_modules/@gyoungwe/plugin-api/dist/index.d.ts +101 -0
- package/node_modules/@gyoungwe/plugin-api/dist/index.d.ts.map +1 -1
- package/node_modules/@gyoungwe/plugin-api/dist/index.js +124 -0
- package/node_modules/@gyoungwe/plugin-api/dist/index.js.map +1 -1
- package/node_modules/@gyoungwe/plugin-api/dist/knowledge.d.ts +486 -0
- package/node_modules/@gyoungwe/plugin-api/dist/knowledge.d.ts.map +1 -0
- package/node_modules/@gyoungwe/plugin-api/dist/knowledge.js +251 -0
- package/node_modules/@gyoungwe/plugin-api/dist/knowledge.js.map +1 -0
- package/node_modules/@gyoungwe/plugin-api/package.json +6 -1
- package/package.json +58 -44
- package/plugin.manifest.json +39 -3
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/** 会话条目类型:日常空间按会话选择的项目(`pi.appendEntry(SESSION_PROJECT_ENTRY, { project })`)。 */
|
|
2
|
+
export declare const SESSION_PROJECT_ENTRY = "drone-session-project-v1";
|
|
3
|
+
/** 旧版本在未指定项目时使用的缺省项目;只用于迁移判断,不再作为回落值。 */
|
|
4
|
+
export declare const LEGACY_DEFAULT_PROJECT = "research-workbench";
|
|
5
|
+
export type ProjectSource = "session" | "workspace-config" | "workspace";
|
|
6
|
+
export interface ProjectResolution {
|
|
7
|
+
/** 解析出的规范项目 slug。 */
|
|
8
|
+
project: string;
|
|
9
|
+
source: ProjectSource;
|
|
10
|
+
/** cwd 是否为日常空间。 */
|
|
11
|
+
daily: boolean;
|
|
12
|
+
/** 调用方(通常是模型的工具参数)请求的项目;未请求时为 null。 */
|
|
13
|
+
requested: string | null;
|
|
14
|
+
/** 请求的项目与解析结果不同,已被忽略。 */
|
|
15
|
+
ignoredRequest: boolean;
|
|
16
|
+
}
|
|
17
|
+
/** 是否为合法的项目 slug(小写 kebab-case,≤ 96 字符,不是保留名或 `shared`)。 */
|
|
18
|
+
export declare function isProjectSlug(value: unknown): value is string;
|
|
19
|
+
/** 把用户输入整理成项目 slug(NFKC、小写、非字母数字变 `-`);无法得到合法 slug 时返回 null。 */
|
|
20
|
+
export declare function normalizeProjectSlug(input: unknown): string | null;
|
|
21
|
+
/** 由工作区目录派生的项目 ID;`configured` 为合法 slug 时直接使用。算法与既有 `projectIdentity` 一致。 */
|
|
22
|
+
export declare function workspaceProjectId(cwd: string, configured?: unknown): string;
|
|
23
|
+
/** 日常空间目录 `~/.drone/daily`(与 desktop `getDailyDir()` 一致)。 */
|
|
24
|
+
export declare function dailyWorkspaceDir(home?: string): string;
|
|
25
|
+
/** cwd 是否为日常空间。 */
|
|
26
|
+
export declare function isDailyWorkspace(cwd: string, home?: string): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* 从会话条目中读出最近一次 `/project` 选择。`{ project: null }` 表示清除选择。
|
|
29
|
+
* 只接受合法 slug;条目不合法时忽略。
|
|
30
|
+
*/
|
|
31
|
+
export declare function sessionProjectFromEntries(entries: unknown): string | null;
|
|
32
|
+
export interface SessionContextLike {
|
|
33
|
+
sessionManager?: {
|
|
34
|
+
getBranch?: () => unknown;
|
|
35
|
+
getEntries?: () => unknown;
|
|
36
|
+
} | null;
|
|
37
|
+
}
|
|
38
|
+
/** 安全读取当前会话分支上的条目(没有会话管理器时返回空数组)。 */
|
|
39
|
+
export declare function sessionEntriesOf(ctx: SessionContextLike | null | undefined): unknown[];
|
|
40
|
+
export interface ResolveProjectInput {
|
|
41
|
+
cwd: string;
|
|
42
|
+
/** `.pi/research-workspace.json` 的 `knowledgeProjectId`(未读取时为 undefined)。 */
|
|
43
|
+
configured?: unknown;
|
|
44
|
+
/** 当前会话分支的条目;只在日常空间生效。 */
|
|
45
|
+
sessionEntries?: unknown;
|
|
46
|
+
/** 调用方请求的项目(如工具参数)。 */
|
|
47
|
+
requested?: unknown;
|
|
48
|
+
/** 测试用:替代 `os.homedir()`。 */
|
|
49
|
+
home?: string;
|
|
50
|
+
}
|
|
51
|
+
/** 同步解析(调用方已读取工作区配置)。 */
|
|
52
|
+
export declare function resolveProjectIdentity(input: ResolveProjectInput): ProjectResolution;
|
|
53
|
+
/** 读取 `.pi/research-workspace.json` 的 `knowledgeProjectId`;文件缺失或损坏时返回 undefined。 */
|
|
54
|
+
export declare function readConfiguredProject(cwd: string): Promise<unknown>;
|
|
55
|
+
/** 读取工作区配置后解析项目身份。工具层传入 `sessionEntries: sessionEntriesOf(ctx)`。 */
|
|
56
|
+
export declare function resolveWorkspaceProject(input: Omit<ResolveProjectInput, "configured">): Promise<ProjectResolution>;
|
|
57
|
+
/**
|
|
58
|
+
* 运行级操作(总结、来源归档)使用的项目:运行开始时记录在 `metadata.project` 中的项目优先;
|
|
59
|
+
* 旧版本缺省写入的 `research-workbench`(以及缺失 / 非法值)视为"未指定",改用当前解析结果。
|
|
60
|
+
*/
|
|
61
|
+
export declare function runProject(metadataProject: unknown, resolution: ProjectResolution): string;
|
|
62
|
+
/** 请求的项目被忽略时给模型 / 用户的一句说明;否则返回 null。 */
|
|
63
|
+
export declare function projectNotice(resolution: ProjectResolution): string | null;
|
|
64
|
+
/** 便于结果展示的紧凑描述。 */
|
|
65
|
+
export declare function describeProject(resolution: ProjectResolution): {
|
|
66
|
+
project: string;
|
|
67
|
+
source: ProjectSource;
|
|
68
|
+
notice?: string;
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=project-identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-identity.d.ts","sourceRoot":"","sources":["../../src/core/project-identity.ts"],"names":[],"mappings":"AAiBA,iFAAiF;AACjF,eAAO,MAAM,qBAAqB,6BAA6B,CAAC;AAChE,yCAAyC;AACzC,eAAO,MAAM,sBAAsB,uBAAuB,CAAC;AAK3D,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,kBAAkB,GAAG,WAAW,CAAC;AAEzE,MAAM,WAAW,iBAAiB;IACjC,qBAAqB;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,aAAa,CAAC;IACtB,mBAAmB;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,uCAAuC;IACv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,sBAAsB,CAAC,KAAK,EAAE,mBAAmB,GAAG,iBAAiB,CAmBpF;AAED,oFAAoF;AACpF,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CASzE;AAED,oEAAoE;AACpE,wBAAsB,uBAAuB,CAAC,KAAK,EAAE,IAAI,CAAC,mBAAmB,EAAE,YAAY,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAExH;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,eAAe,EAAE,OAAO,EAAE,UAAU,EAAE,iBAAiB,GAAG,MAAM,CAG1F;AAED,wCAAwC;AACxC,wBAAgB,aAAa,CAAC,UAAU,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAM1E;AAED,mBAAmB;AACnB,wBAAgB,eAAe,CAAC,UAAU,EAAE,iBAAiB,GAAG;IAC/D,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB,CAGA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure publication policy shared by the knowledge runtime and backend fallback.
|
|
3
|
+
*
|
|
4
|
+
* The extension keeps the session-specific sealing state and validation orchestration;
|
|
5
|
+
* this module owns only deterministic notices, failure classification and advisory copy.
|
|
6
|
+
* The dependency-free packaged adapter is built from this package entrypoint.
|
|
7
|
+
*/
|
|
8
|
+
export type PublicationFailureCode = "paper-citation-required" | "search-required" | "coverage-incomplete" | "citation-required" | "citation-invalid" | "citation-budget" | "source-unread" | "delivery-changed" | "source-changed" | "wiki-changed" | "search-stale" | "binding-changed" | "navigation-changed" | "not-prepared" | "interrupted" | "model-error" | "check-timeout" | "check-failed" | "empty-answer" | "answer-too-large" | "protocol-budget" | "tool-loop-stopped" | "metacognitive-inconsistency" | "artifact-pending-review";
|
|
9
|
+
export interface PublicationVerification {
|
|
10
|
+
sources?: unknown;
|
|
11
|
+
deliveries?: unknown;
|
|
12
|
+
unverifiedCitationCount?: unknown;
|
|
13
|
+
unverifiedCitations?: unknown;
|
|
14
|
+
citationCount?: unknown;
|
|
15
|
+
citationLimit?: unknown;
|
|
16
|
+
[key: string]: unknown;
|
|
17
|
+
}
|
|
18
|
+
export interface PublicationFailure {
|
|
19
|
+
code: PublicationFailureCode;
|
|
20
|
+
message: string;
|
|
21
|
+
paths: string[];
|
|
22
|
+
}
|
|
23
|
+
/** Message used by the backend when the runtime extension is unavailable. */
|
|
24
|
+
export declare const publicationFallbackNotice = "\u56DE\u7B54\u68C0\u67E5\u672A\u5B8C\u6210\uFF0C\u56DE\u7B54\u6682\u672A\u5C55\u793A\u3002";
|
|
25
|
+
export declare const publicationNotices: Readonly<Record<PublicationFailureCode, string>>;
|
|
26
|
+
/** Return reader-facing copy for a publication failure or nonblocking advisory. */
|
|
27
|
+
export declare function publicationNotice(code: string | null | undefined): string;
|
|
28
|
+
/** Return reader-facing copy for a nonblocking advisory. */
|
|
29
|
+
export declare function advisoryNotice(code: string | null | undefined): string;
|
|
30
|
+
/**
|
|
31
|
+
* One reader-facing advisory line: what happened, then what was actually verified.
|
|
32
|
+
* Counts come from the check itself, so the sentence cannot overstate verification.
|
|
33
|
+
*/
|
|
34
|
+
export declare function advisoryLine(code: string, error?: {
|
|
35
|
+
verified?: PublicationVerification;
|
|
36
|
+
}): string;
|
|
37
|
+
/** Convert arbitrary validation failures into the bounded public failure contract. */
|
|
38
|
+
export declare function knowledgeFailure(error: unknown): PublicationFailure;
|
|
39
|
+
//# sourceMappingURL=publication-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publication-policy.d.ts","sourceRoot":"","sources":["../../src/core/publication-policy.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,sBAAsB,GAC/B,yBAAyB,GACzB,iBAAiB,GACjB,qBAAqB,GACrB,mBAAmB,GACnB,kBAAkB,GAClB,iBAAi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,EAAE,OAAO,GAAG,kBAAkB,CAUnE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { advisoryLine, advisoryNotice, knowledgeFailure } from "./publication-policy.js";
|
|
2
|
+
export { advisoryLine, advisoryNotice, knowledgeFailure };
|
|
3
|
+
export declare function projectKnowledgeEvent(event: any): any;
|
|
4
|
+
export declare function projectKnowledgeSnapshot(messages: any, persisted?: never[]): any;
|
|
5
|
+
export declare function registerAnswerPublication(pi: any, { runtime, getCurrent, evidenceOnly, getDeliveryFooter, getTaskFeedback, getTaskRuntime, getMetacognition, maxToolRounds, }: {
|
|
6
|
+
runtime?: null | undefined;
|
|
7
|
+
getCurrent: any;
|
|
8
|
+
evidenceOnly?: boolean | undefined;
|
|
9
|
+
getDeliveryFooter?: null | undefined;
|
|
10
|
+
getTaskFeedback?: null | undefined;
|
|
11
|
+
getTaskRuntime?: null | undefined;
|
|
12
|
+
getMetacognition?: null | undefined;
|
|
13
|
+
maxToolRounds?: number | undefined;
|
|
14
|
+
}): {
|
|
15
|
+
attachRuntime: (next: any) => boolean;
|
|
16
|
+
attachReviewer: (next: any) => boolean;
|
|
17
|
+
recordDelivery(ctx: any, path: any): Promise<void>;
|
|
18
|
+
preflight(ctx: any, text: any): Promise<any>;
|
|
19
|
+
recordSetup(result: any, checkCurrent: any): void;
|
|
20
|
+
begin(isRequired?: boolean, newTurn?: boolean): void;
|
|
21
|
+
invalidate(): void;
|
|
22
|
+
readonly guidance: "Answer the user's question directly. For a planning request, first provide a concise provisional framework with explicit assumptions, then deepen only the evidence needed. Cite scientific claims inline using exact [[path]] citations from research_read_knowledge results read this turn; a saved report link is a deliverable, not an evidence citation. Reuse successful read receipts instead of reading the same source through both generic read and research_read_knowledge. Do not invent citations or cite a source merely to clear a warning. Label suggested sample sizes as design heuristics, not universal statistical thresholds. Acknowledge uncertainty and save useful knowledge. Evidence quality reminders are nonblocking: do not run repeated read/search/check just to clear them. Never claim scientific verification. Host permission, binding, abort and spending limits still apply; human Wiki edits require confirmation." | "For execution progress in ANY task (analysis, code, environment, experiments, writing), use task_status; its host-generated report needs no research citations. Never add irrelevant sources to an operational report. Scientific host-checked answers need a current-turn search, reads of cited [[path]] sources, then research_check_answer. Public text must answer the user's question; do not lecture about Vault policy or evidence-gate stages. Use short set_status about the task, not product design. Show Me/run links are deliverables, not evidence.";
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=publication.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publication.d.ts","sourceRoot":"","sources":["../../src/core/publication.ts"],"names":[],"mappings":"AAIA,OAAO,EACN,YAAY,EACZ,cAAc,EACd,gBAAgB,EAEhB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,CAAC;AAyH1D,wBAAgB,qBAAqB,CAAC,KAAK,KAAA,OAiB1C;AACD,wBAAgB,wBAAwB,CAAC,QAAQ,KAAA,EAAE,SAAS,UAAK,OAWhE;AACD,wBAAgB,yBAAyB,CACxC,EAAE,KAAA,EACF,EACC,OAAc,EACd,UAAU,EACV,YAAoB,EACpB,iBAAwB,EACxB,eAAsB,EACtB,cAAqB,EACrB,gBAAuB,EACvB,aAAkB,GAClB;;;;;;;;;CAAA;;;;;;;;;EAgfD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type KnowledgeCategory = "paper" | "software" | "method" | "idea";
|
|
2
|
+
export interface RecentCategoryRow {
|
|
3
|
+
path: string;
|
|
4
|
+
title: string;
|
|
5
|
+
kind: string;
|
|
6
|
+
signature: string;
|
|
7
|
+
body: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function recentByCategory(rows: readonly RecentCategoryRow[], limit?: number): Record<KnowledgeCategory, Array<{
|
|
10
|
+
path: string;
|
|
11
|
+
title: string;
|
|
12
|
+
kind: string;
|
|
13
|
+
updatedAt: number;
|
|
14
|
+
}>>;
|
|
15
|
+
//# sourceMappingURL=recent-by-category.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recent-by-category.d.ts","sourceRoot":"","sources":["../../src/core/recent-by-category.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEzE,MAAM,WAAW,iBAAiB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACb;AAYD,wBAAgB,gBAAgB,CAC/B,IAAI,EAAE,SAAS,iBAAiB,EAAE,EAClC,KAAK,SAAK,GACR,MAAM,CAAC,iBAAiB,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAuBpG"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function findRelatedNotes(title: string, limit?: number): Promise<string[]>;
|
|
2
|
+
/** 在正文末尾追加「相关笔记」双链区;已在正文里链接过的不再重复 */
|
|
3
|
+
export declare function appendRelatedLinks(markdown: string, paths: readonly string[]): string;
|
|
4
|
+
//# sourceMappingURL=related-notes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"related-notes.d.ts","sourceRoot":"","sources":["../../src/core/related-notes.ts"],"names":[],"mappings":"AAOA,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,SAAI,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAuBlF;AAED,qCAAqC;AACrC,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAKrF"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { type ContractParentRef, type KnowledgeEvidenceGrade, type KnowledgeFreshness, type KnowledgeReuseLevel, type KnowledgeSnapshot, type KnowledgeSourceReceipt } from "@gyoungwe/plugin-api/knowledge";
|
|
2
|
+
/**
|
|
3
|
+
* The context carried by a knowledge snapshot. A project id alone is not
|
|
4
|
+
* enough to reuse a source: the same project name may exist in two workspaces.
|
|
5
|
+
*/
|
|
6
|
+
export interface KnowledgeContext {
|
|
7
|
+
readonly projectId: string;
|
|
8
|
+
readonly workspaceId: string;
|
|
9
|
+
readonly workspaceRoot?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface KnowledgeContextInput {
|
|
12
|
+
readonly projectId?: string;
|
|
13
|
+
readonly workspaceId?: string;
|
|
14
|
+
readonly workspaceRoot: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function resolveKnowledgeContext(input: KnowledgeContextInput): KnowledgeContext;
|
|
17
|
+
export type KnowledgeFreshnessStatus = "fresh" | "stale" | "unknown" | "invalid";
|
|
18
|
+
export interface KnowledgeSourceState {
|
|
19
|
+
readonly contentHash: string;
|
|
20
|
+
readonly version?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface KnowledgeFreshnessCheck {
|
|
23
|
+
readonly status: KnowledgeFreshnessStatus;
|
|
24
|
+
readonly checkedAt: string;
|
|
25
|
+
readonly reason?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface KnowledgeFreshnessOptions {
|
|
28
|
+
readonly now?: string;
|
|
29
|
+
/** Maximum age of a read receipt. Omit to use an explicit expiry only. */
|
|
30
|
+
readonly maxAgeMs?: number;
|
|
31
|
+
/** Require a host-observed source version/hash when reusing a receipt. */
|
|
32
|
+
readonly requireCurrent?: boolean;
|
|
33
|
+
readonly current?: KnowledgeSourceState;
|
|
34
|
+
}
|
|
35
|
+
/** Validate one host read receipt without reading the source again. */
|
|
36
|
+
export declare function validateKnowledgeSourceReceipt(receipt: KnowledgeSourceReceipt): KnowledgeSourceReceipt;
|
|
37
|
+
/**
|
|
38
|
+
* Check both the age and the host-observed identity of a receipt. A missing
|
|
39
|
+
* current state is explicitly reported as unknown when the caller requests a
|
|
40
|
+
* fail-closed check; this avoids silently treating a title or stale index hit
|
|
41
|
+
* as current evidence.
|
|
42
|
+
*/
|
|
43
|
+
export declare function checkKnowledgeReceiptFreshness(receipt: KnowledgeSourceReceipt, options?: KnowledgeFreshnessOptions): KnowledgeFreshnessCheck;
|
|
44
|
+
export interface KnowledgeReceiptInput extends Omit<KnowledgeSourceReceipt, "freshness"> {
|
|
45
|
+
readonly freshness?: KnowledgeFreshness;
|
|
46
|
+
}
|
|
47
|
+
export interface KnowledgeSnapshotInput {
|
|
48
|
+
readonly id?: string;
|
|
49
|
+
readonly context: KnowledgeContext;
|
|
50
|
+
readonly caseRef?: ContractParentRef;
|
|
51
|
+
readonly sources: readonly KnowledgeReceiptInput[];
|
|
52
|
+
readonly reuseLevel?: KnowledgeReuseLevel;
|
|
53
|
+
readonly evidenceGrade?: KnowledgeEvidenceGrade;
|
|
54
|
+
readonly evidenceLevel?: KnowledgeEvidenceGrade;
|
|
55
|
+
readonly assay?: string;
|
|
56
|
+
readonly analysisRefs?: readonly ContractParentRef[];
|
|
57
|
+
readonly evidenceCheckpointRefs?: readonly ContractParentRef[];
|
|
58
|
+
readonly environmentFingerprint?: string;
|
|
59
|
+
readonly methodVersion?: string;
|
|
60
|
+
readonly referenceVersion?: string;
|
|
61
|
+
readonly inputManifestHash?: string;
|
|
62
|
+
readonly createdAt?: string;
|
|
63
|
+
readonly ingestedAt?: string;
|
|
64
|
+
readonly parentRefs?: readonly ContractParentRef[];
|
|
65
|
+
readonly revision?: number;
|
|
66
|
+
readonly approval?: "pending" | "approved" | "rejected" | "revoked";
|
|
67
|
+
}
|
|
68
|
+
export declare function knowledgeEvidenceGradeRank(grade: KnowledgeEvidenceGrade): number;
|
|
69
|
+
export declare function knowledgeReuseLevelRank(level: KnowledgeReuseLevel): number;
|
|
70
|
+
/** Build a versioned, immutable snapshot from actual source read receipts. */
|
|
71
|
+
export declare function ingestKnowledgeSnapshot(input: KnowledgeSnapshotInput): KnowledgeSnapshot;
|
|
72
|
+
export interface KnowledgeReuseRequest {
|
|
73
|
+
readonly context: KnowledgeContext;
|
|
74
|
+
readonly requiredLevel?: KnowledgeReuseLevel;
|
|
75
|
+
readonly assay?: string;
|
|
76
|
+
readonly methodVersion?: string;
|
|
77
|
+
readonly referenceVersion?: string;
|
|
78
|
+
readonly inputManifestHash?: string;
|
|
79
|
+
readonly maxAgeMs?: number;
|
|
80
|
+
readonly now?: string;
|
|
81
|
+
readonly sourceStates?: Readonly<Record<string, KnowledgeSourceState>>;
|
|
82
|
+
readonly requireCurrent?: boolean;
|
|
83
|
+
readonly analysisRef?: ContractParentRef;
|
|
84
|
+
readonly evidenceCheckpointRef?: ContractParentRef;
|
|
85
|
+
}
|
|
86
|
+
export type KnowledgeReuseStatus = "reusable" | "pending-approval" | "revoked" | "stale" | "context-mismatch" | "insufficient-evidence" | "method-mismatch" | "reference-mismatch" | "input-mismatch" | "unlinked";
|
|
87
|
+
export interface KnowledgeReuseDecision {
|
|
88
|
+
readonly snapshotId: string;
|
|
89
|
+
readonly reusable: boolean;
|
|
90
|
+
readonly status: KnowledgeReuseStatus;
|
|
91
|
+
readonly reasons: readonly string[];
|
|
92
|
+
readonly freshness: readonly KnowledgeFreshnessCheck[];
|
|
93
|
+
readonly reusedAt?: string;
|
|
94
|
+
}
|
|
95
|
+
/** Fail-closed checks used before a new analysis consumes a snapshot. */
|
|
96
|
+
export declare function checkKnowledgeSnapshotReuse(snapshot: KnowledgeSnapshot, request: KnowledgeReuseRequest): KnowledgeReuseDecision;
|
|
97
|
+
export interface KnowledgeReuseIndexEntry {
|
|
98
|
+
readonly snapshot: KnowledgeSnapshot;
|
|
99
|
+
readonly reuseCount: number;
|
|
100
|
+
readonly lastReusedAt?: string;
|
|
101
|
+
}
|
|
102
|
+
export interface KnowledgeReuseIndexStore {
|
|
103
|
+
read(): Promise<readonly KnowledgeSnapshot[]>;
|
|
104
|
+
write(snapshots: readonly KnowledgeSnapshot[]): Promise<void>;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* A small reusable index. Persistence is supplied by the host through the
|
|
108
|
+
* optional store, so the knowledge package remains independent of JsonStore,
|
|
109
|
+
* Electron and backend implementations.
|
|
110
|
+
*/
|
|
111
|
+
export declare class KnowledgeReuseIndex {
|
|
112
|
+
private readonly store?;
|
|
113
|
+
private readonly entries;
|
|
114
|
+
private writeQueue;
|
|
115
|
+
constructor(store?: KnowledgeReuseIndexStore | undefined, snapshots?: readonly KnowledgeSnapshot[]);
|
|
116
|
+
load(): Promise<void>;
|
|
117
|
+
ingest(snapshot: KnowledgeSnapshot): Promise<KnowledgeSnapshot>;
|
|
118
|
+
get(id: string): KnowledgeReuseIndexEntry | undefined;
|
|
119
|
+
list(): readonly KnowledgeReuseIndexEntry[];
|
|
120
|
+
find(request: KnowledgeReuseRequest): readonly KnowledgeReuseDecision[];
|
|
121
|
+
reuse(id: string, request: KnowledgeReuseRequest): Promise<KnowledgeReuseDecision>;
|
|
122
|
+
private persist;
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=reuse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reuse.d.ts","sourceRoot":"","sources":["../../src/core/reuse.ts"],"names":[],"mappings":"AACA,OAAO,EAGN,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,MAAM,gCAAgC,CAAC;AAGxC;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,qBAAqB;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Environment policy is intentionally higher precedence than persisted state.
|
|
5
|
+
*/
|
|
6
|
+
export declare function readReviewMode(): ReviewMode;
|
|
7
|
+
/** Persist a review mode atomically with restrictive file permissions. */
|
|
8
|
+
export declare function saveReviewMode(mode: string): Promise<{
|
|
9
|
+
mode: ReviewMode;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const advisoryCodes: Set<string>;
|
|
12
|
+
//# sourceMappingURL=review-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review-policy.d.ts","sourceRoot":"","sources":["../../src/core/review-policy.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,QAAQ,CAAC;AAMhD;;;GAGG;AACH,wBAAgB,cAAc,IAAI,UAAU,CAY3C;AAED,0EAA0E;AAC1E,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,CAShF;AAED,eAAO,MAAM,aAAa,aAcxB,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/** Host seams used by knowledge runtime modules.
|
|
2
|
+
*
|
|
3
|
+
* The domain package owns the stateful implementation; desktop/CLI hosts inject
|
|
4
|
+
* process event and runtime scheduling adapters at composition time. Defaults
|
|
5
|
+
* are deterministic and safe for read-only package use and tests.
|
|
6
|
+
*/
|
|
7
|
+
export type RuntimeExclusive = <T>(namespace: string, key: string, work: () => Promise<T>) => Promise<T>;
|
|
8
|
+
export type ProcessEventEmitter = (event: string, payload?: unknown) => void;
|
|
9
|
+
export type RuntimeSlotProvider = <T extends object>(domain: string, slot: string, create: () => T) => T;
|
|
10
|
+
export type ToolMetadataLookup = (toolName: string) => unknown;
|
|
11
|
+
export type FlowCardBuilder = (toolName: string) => unknown;
|
|
12
|
+
export type DeliveryContract = (prompt: string, options?: Record<string, unknown>) => unknown;
|
|
13
|
+
export declare function configureKnowledgeRuntime(host?: {
|
|
14
|
+
runRuntimeExclusive?: RuntimeExclusive;
|
|
15
|
+
emitProcessEvent?: ProcessEventEmitter;
|
|
16
|
+
toolMeta?: ToolMetadataLookup;
|
|
17
|
+
flowCardBuilder?: FlowCardBuilder;
|
|
18
|
+
deliveryContract?: DeliveryContract;
|
|
19
|
+
runtimeSlot?: RuntimeSlotProvider;
|
|
20
|
+
}): void;
|
|
21
|
+
export declare const runRuntimeExclusive: RuntimeExclusive;
|
|
22
|
+
export declare const emitProcessEvent: ProcessEventEmitter;
|
|
23
|
+
/** Resolve each operation through the host's current async runtime, including
|
|
24
|
+
* modules loaded before the host installs its adapter. */
|
|
25
|
+
export declare function runtimeSlot<T extends object>(domain: string, key: string, factory: () => T): T;
|
|
26
|
+
export declare function diagnosticText(value: unknown, limit?: number): string;
|
|
27
|
+
export declare function toolMeta(_toolName: string): unknown;
|
|
28
|
+
export declare function flowCardBuilder(_toolName: string): unknown;
|
|
29
|
+
export type KnowledgeWorkerFactory = (url: URL, options: Record<string, unknown>) => unknown;
|
|
30
|
+
export interface KnowledgeWorkerMetadata {
|
|
31
|
+
/** Human-readable worker artifact version (usually a build manifest hash). */
|
|
32
|
+
readonly version: string;
|
|
33
|
+
/** Absolute or package-relative resource path, when the host can disclose it. */
|
|
34
|
+
readonly source?: string;
|
|
35
|
+
/** SHA-256 of the exact worker bytes, when available. */
|
|
36
|
+
readonly integrity?: string;
|
|
37
|
+
}
|
|
38
|
+
export type KnowledgeWorkerMetadataProvider = () => KnowledgeWorkerMetadata;
|
|
39
|
+
/**
|
|
40
|
+
* Install the worker factory used by the domain service. Hosts may also
|
|
41
|
+
* provide a lazy metadata reader: packaged hosts select their resource root
|
|
42
|
+
* after this module is imported, so resolving the manifest eagerly would
|
|
43
|
+
* accidentally pin the development path.
|
|
44
|
+
*/
|
|
45
|
+
export declare function configureKnowledgeWorker(factory: KnowledgeWorkerFactory, metadata?: KnowledgeWorkerMetadataProvider): void;
|
|
46
|
+
export declare function createKnowledgeWorker(url: URL, options: Record<string, unknown>): unknown;
|
|
47
|
+
export declare function knowledgeWorkerMetadata(): KnowledgeWorkerMetadata;
|
|
48
|
+
export declare const KNOWLEDGE_WORKER_LIFECYCLE_EVENT = "drone:knowledge-worker-lifecycle/v1";
|
|
49
|
+
export type KnowledgeWorkerLifecycleStage = "staged" | "verified" | "enabled" | "disabled" | "drained" | "reloaded" | "rolled_back";
|
|
50
|
+
export interface KnowledgeWorkerLifecycleEvent {
|
|
51
|
+
readonly stage: KnowledgeWorkerLifecycleStage;
|
|
52
|
+
readonly version: string;
|
|
53
|
+
readonly previousVersion?: string;
|
|
54
|
+
readonly source?: string;
|
|
55
|
+
readonly integrity?: string;
|
|
56
|
+
readonly reason?: string;
|
|
57
|
+
readonly pendingRequests?: number;
|
|
58
|
+
readonly at: string;
|
|
59
|
+
}
|
|
60
|
+
/** Emit bounded, metadata-only lifecycle evidence through the host seam. */
|
|
61
|
+
export declare function emitKnowledgeWorkerLifecycle(stage: KnowledgeWorkerLifecycleStage, partial: Omit<KnowledgeWorkerLifecycleEvent, "stage" | "at">): void;
|
|
62
|
+
export declare function configureKnowledgeEvidence(host: {
|
|
63
|
+
requiresPaperEvidence?: (query: string) => boolean;
|
|
64
|
+
hasPaperCitation?: (sources: unknown[]) => boolean;
|
|
65
|
+
}): void;
|
|
66
|
+
declare let requiresPaperEvidence: (query: string) => boolean;
|
|
67
|
+
declare let hasPaperCitation: (sources: unknown[]) => boolean;
|
|
68
|
+
export { requiresPaperEvidence, hasPaperCitation };
|
|
69
|
+
export declare const deliveryContract: DeliveryContract;
|
|
70
|
+
export type WorkspaceConfigLoader = (cwd: string) => Promise<Record<string, unknown>>;
|
|
71
|
+
export type ExplainerPublisher = (input: Record<string, unknown>) => Promise<unknown>;
|
|
72
|
+
export declare function configureKnowledgeHost(host?: {
|
|
73
|
+
loadWorkspaceConfig?: WorkspaceConfigLoader;
|
|
74
|
+
publishExplainer?: ExplainerPublisher;
|
|
75
|
+
consumeKnowledgeReviewPreview?: (cwd: string, token: string) => unknown;
|
|
76
|
+
specialistSettings?: () => Promise<Record<string, unknown>>;
|
|
77
|
+
}): void;
|
|
78
|
+
export declare const loadWorkspaceConfig: WorkspaceConfigLoader;
|
|
79
|
+
export declare const publishExplainer: ExplainerPublisher;
|
|
80
|
+
export declare const consumeKnowledgeReviewPreview: (cwd: string, token: string) => unknown;
|
|
81
|
+
export declare const specialistSettings: () => Promise<Record<string, unknown>>;
|
|
82
|
+
export type LayoutDefinition = {
|
|
83
|
+
templates: Record<string, string>;
|
|
84
|
+
noteTemplate: string;
|
|
85
|
+
};
|
|
86
|
+
export declare function configureKnowledgeSetup(host?: {
|
|
87
|
+
layout?: LayoutDefinition;
|
|
88
|
+
inspectObsidianSetup?: (input: Record<string, unknown>) => Promise<unknown>;
|
|
89
|
+
inspectSetupDirectory?: (vault: string) => Promise<unknown>;
|
|
90
|
+
resolveSetupVault?: (supplied: string, workspace: string) => string;
|
|
91
|
+
researchSetupOptions?: () => unknown;
|
|
92
|
+
}): void;
|
|
93
|
+
export declare const LAYOUT: LayoutDefinition;
|
|
94
|
+
export declare const inspectObsidianSetup: (input: Record<string, unknown>) => Promise<unknown>;
|
|
95
|
+
export declare const inspectSetupDirectory: (vault: string) => Promise<unknown>;
|
|
96
|
+
export declare const resolveSetupVault: (supplied: string, workspace: string) => string;
|
|
97
|
+
export declare const researchSetupOptions: () => unknown;
|
|
98
|
+
//# sourceMappingURL=runtime-host.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-host.d.ts","sourceRoot":"","sources":["../../src/core/runtime-host.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;AACzG,MAAM,MAAM,mBAAmB,GAAG,CA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avaScript adapter for packaged
|
|
5
|
+
* CLI/electron builds, while this module is the typed source of truth for
|
|
6
|
+
* tests and backend callers.
|
|
7
|
+
*/
|
|
8
|
+
/** Tokenize English/Unicode text for the SQLite FTS index. */
|
|
9
|
+
export declare function tokenizeKnowledgeText(text: string): string[];
|
|
10
|
+
/** Build a bounded, quoted FTS5 expression from an end-user query. */
|
|
11
|
+
export declare function buildKnowledgeSearchExpression(query: string): string;
|
|
12
|
+
/** Split note text into bounded chunks for optional semantic indexing. */
|
|
13
|
+
export declare function splitKnowledgeChunks(text: string, maxChars?: number): string[];
|
|
14
|
+
//# sourceMappingURL=search-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-policy.d.ts","sourceRoot":"","sources":["../../src/core/search-policy.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,8DAA8D;AAC9D,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAsB5D;AAED,sEAAsE;AACtE,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMpE;AAED,0EAA0E;AAC1E,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,SAAO,GAAG,MAAM,EAAE,CAO5E"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/** Pure semantic projection for the knowledge network.
|
|
2
|
+
*
|
|
3
|
+
* The input deliberately accepts the old graph shape. All fields added by
|
|
4
|
+
* this module are optional at the transport boundary, so an older worker can
|
|
5
|
+
* still be rendered by a newer desktop.
|
|
6
|
+
*/
|
|
7
|
+
export type SemanticView = "semantic" | "all";
|
|
8
|
+
export type RelationType = "link" | "directory" | "duplicate";
|
|
9
|
+
export interface SemanticNodeInput {
|
|
10
|
+
path: string;
|
|
11
|
+
title: string;
|
|
12
|
+
kind: string;
|
|
13
|
+
degree?: number;
|
|
14
|
+
scope?: string;
|
|
15
|
+
/** Stable bibliographic identity (DOI, PMID, arXiv, or a producer key). */
|
|
16
|
+
identity?: string | null;
|
|
17
|
+
/** Frontmatter type used to build the fixed research-sector layout. */
|
|
18
|
+
contentType?: string | null;
|
|
19
|
+
}
|
|
20
|
+
export interface SemanticEdgeInput {
|
|
21
|
+
source: string;
|
|
22
|
+
target: string;
|
|
23
|
+
type?: RelationType;
|
|
24
|
+
}
|
|
25
|
+
export interface SemanticNode {
|
|
26
|
+
path: string;
|
|
27
|
+
title: string;
|
|
28
|
+
kind: string;
|
|
29
|
+
degree: number;
|
|
30
|
+
nodeType: "note" | "wiki" | "navigation" | "mirror" | "infrastructure" | "memory";
|
|
31
|
+
isInfrastructure: boolean;
|
|
32
|
+
community: number;
|
|
33
|
+
x: number;
|
|
34
|
+
y: number;
|
|
35
|
+
mirrors?: string[];
|
|
36
|
+
warnings?: string[];
|
|
37
|
+
/** Normalized content category (paper, method, software, …). */
|
|
38
|
+
contentType?: string;
|
|
39
|
+
/** Research question/topic nodes anchor the surrounding category sectors. */
|
|
40
|
+
isMain?: boolean;
|
|
41
|
+
/** Main nodes this item bridges; shared items are placed between their anchors. */
|
|
42
|
+
sharedWith?: string[];
|
|
43
|
+
}
|
|
44
|
+
export interface SemanticRelation {
|
|
45
|
+
source: string;
|
|
46
|
+
target: string;
|
|
47
|
+
type: RelationType;
|
|
48
|
+
}
|
|
49
|
+
export interface SemanticGraph {
|
|
50
|
+
nodes: SemanticNode[];
|
|
51
|
+
edges: {
|
|
52
|
+
source: string;
|
|
53
|
+
target: string;
|
|
54
|
+
}[];
|
|
55
|
+
relations: SemanticRelation[];
|
|
56
|
+
duplicates: {
|
|
57
|
+
canonical: string;
|
|
58
|
+
duplicate: string;
|
|
59
|
+
}[];
|
|
60
|
+
communities: Record<string, number>;
|
|
61
|
+
layout: Record<string, {
|
|
62
|
+
x: number;
|
|
63
|
+
y: number;
|
|
64
|
+
}>;
|
|
65
|
+
}
|
|
66
|
+
/** Keep category colors and sectors stable even for older notes without typed frontmatter. */
|
|
67
|
+
export declare function contentCategory(node: Pick<SemanticNodeInput, "path" | "kind" | "contentType">): string;
|
|
68
|
+
export declare function isInfrastructureNode(node: Pick<SemanticNodeInput, "path" | "kind">): boolean;
|
|
69
|
+
export declare function nodeType(node: Pick<SemanticNodeInput, "path" | "kind"> & {
|
|
70
|
+
contentType?: string | null;
|
|
71
|
+
}): SemanticNode["nodeType"];
|
|
72
|
+
/** Classify an edge without changing the meaning of legacy `edges`. */
|
|
73
|
+
export declare function classifyRelation(source: Pick<SemanticNodeInput, "path">, target: Pick<SemanticNodeInput, "path">, type?: RelationType): RelationType;
|
|
74
|
+
/** A deterministic local-moving modularity pass. It is intentionally small,
|
|
75
|
+
* dependency-free, and uses sorted keys for stable results across input order. */
|
|
76
|
+
export declare function assignCommunities(paths: string[], edges: SemanticRelation[], seed?: number): Record<string, number>;
|
|
77
|
+
export declare function createSemanticModel(input: {
|
|
78
|
+
nodes: SemanticNodeInput[];
|
|
79
|
+
edges?: SemanticEdgeInput[];
|
|
80
|
+
}, options?: {
|
|
81
|
+
view?: SemanticView;
|
|
82
|
+
mergeMirrors?: boolean;
|
|
83
|
+
seed?: number;
|
|
84
|
+
}): SemanticGraph;
|
|
85
|
+
//# sourceMappingURL=semantic-model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semantic-model.d.ts","sourceRoot":"","sources":["../../src/core/semantic-model.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,KAAK,CAAC;AAC9C,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,WAAW,GAAG,WAAW,CAAC;AAE9D,MAAM,WAAW,iBAAiB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,QAAQ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AC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,GAC1E,aAAa,CA0Gf"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {Record<string, any>} [input]
|
|
3
|
+
*/
|
|
4
|
+
export declare function validateSemanticConfig(input?: {}): {
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
provider: string;
|
|
7
|
+
baseUrl: string;
|
|
8
|
+
model: string;
|
|
9
|
+
credentialEnv: string;
|
|
10
|
+
remoteConsent: boolean;
|
|
11
|
+
timeoutMs?: undefined;
|
|
12
|
+
chunkChars?: undefined;
|
|
13
|
+
minSimilarity?: undefined;
|
|
14
|
+
} | {
|
|
15
|
+
enabled: any;
|
|
16
|
+
provider: any;
|
|
17
|
+
baseUrl: string;
|
|
18
|
+
model: string;
|
|
19
|
+
credentialEnv: string;
|
|
20
|
+
remoteConsent: boolean;
|
|
21
|
+
timeoutMs: any;
|
|
22
|
+
chunkChars: any;
|
|
23
|
+
minSimilarity: any;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* @param {Record<string, any>} rawConfig
|
|
27
|
+
* @param {string[]} texts
|
|
28
|
+
* @param {{ signal?: AbortSignal }} [options]
|
|
29
|
+
*/
|
|
30
|
+
export declare function embedTexts(rawConfig: any, texts: any, { signal }?: {}): Promise<{
|
|
31
|
+
provider: any;
|
|
32
|
+
model: string;
|
|
33
|
+
vectors: any[][];
|
|
34
|
+
dimension: number;
|
|
35
|
+
}>;
|
|
36
|
+
export declare const semanticLimits: Readonly<{
|
|
37
|
+
MAX_BATCH: 32;
|
|
38
|
+
MAX_CHARS: 120000;
|
|
39
|
+
MAX_RESPONSE: number;
|
|
40
|
+
}>;
|
|
41
|
+
//# sourceMappingURL=semantic-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semantic-provider.d.ts","sourceRoot":"","sources":["../../src/core/semantic-provider.ts"],"names":[],"mappings":"AA6BA;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,KAAK;;;;;;;;;;;;;;;;;;;;EA+FhD;AA8DD;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,SAAS,KAAA,EAAE,KAAK,KAAA,EAAE,EAAE,MAAM,EAAE,KAAK;;;;;GA2EjE;AAED,eAAO,MAAM,cAAc;;;;EAAwD,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type SemanticProvider = "none" | "ollama" | "openai-compatible";
|
|
2
|
+
export interface SemanticConfig {
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
provider: SemanticProvider;
|
|
5
|
+
baseUrl: string;
|
|
6
|
+
model: string;
|
|
7
|
+
credentialEnv: string;
|
|
8
|
+
remoteConsent: boolean;
|
|
9
|
+
timeoutMs?: number;
|
|
10
|
+
chunkChars?: number;
|
|
11
|
+
minSimilarity?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface SemanticSettings extends SemanticConfig {
|
|
14
|
+
version: 1;
|
|
15
|
+
revision: number;
|
|
16
|
+
updatedAt: string;
|
|
17
|
+
}
|
|
18
|
+
export interface SemanticSettingsState {
|
|
19
|
+
defaultUpdatedAt: Map<string, string>;
|
|
20
|
+
}
|
|
21
|
+
export interface SemanticSettingsApi {
|
|
22
|
+
readSemanticSettings(vaultId: string): Promise<SemanticSettings>;
|
|
23
|
+
saveSemanticSettings(vaultId: string, input: Partial<SemanticConfig>, expectedRevision: number): Promise<SemanticSettings>;
|
|
24
|
+
}
|
|
25
|
+
export declare function validateSemanticConfig(input?: Partial<SemanticConfig>): SemanticConfig;
|
|
26
|
+
export declare function createSemanticSettingsState(): SemanticSettingsState;
|
|
27
|
+
export declare function createSemanticSettingsApi(state?: SemanticSettingsState): SemanticSettingsApi;
|
|
28
|
+
export declare const readSemanticSettings: (vaultId: string) => Promise<SemanticSettings>;
|
|
29
|
+
export declare const saveSemanticSettings: (vaultId: string, input: Partial<SemanticConfig>, expectedRevision: number) => Promise<SemanticSettings>;
|
|
30
|
+
//# sourceMappingURL=semantic-settings.d.ts.map
|