@gyoungwe/research-suite 0.1.5 → 0.1.7
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/build-manifest.json +2 -2
- package/node_modules/@gyoungwe/pi-core/dist/index.mjs +391 -10
- 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 +6 -6
- package/plugin.manifest.json +39 -3
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
type ContainedFile = (root: string, path: string) => Promise<string>;
|
|
2
|
+
type CreateOnly = (path: string, content: string) => Promise<boolean>;
|
|
3
|
+
type UpdateNavigation = (root: string, path: string, heading: string, body: string) => Promise<NavigationUpdateResult>;
|
|
4
|
+
export interface NavigationUpdateResult {
|
|
5
|
+
path: string;
|
|
6
|
+
changed: boolean;
|
|
7
|
+
}
|
|
8
|
+
/** Raised when a conditional Vault write observes a newer local version. */
|
|
9
|
+
export declare class VaultFileConflictError extends Error {
|
|
10
|
+
readonly code: "conflict";
|
|
11
|
+
constructor(path: string);
|
|
12
|
+
}
|
|
13
|
+
export interface ReplaceVaultFileOptions {
|
|
14
|
+
/** SHA-256 of the version the caller showed to the user. */
|
|
15
|
+
expectedHash?: string;
|
|
16
|
+
/** Test seam used to deterministically model an editor write before commit. */
|
|
17
|
+
beforeCommit?: () => void | Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Filesystem seams for embedding layout initialization in a host runtime.
|
|
21
|
+
* The defaults enforce Vault containment and create-only semantics. Hosts can
|
|
22
|
+
* inject the same contracts when they already own a filesystem abstraction.
|
|
23
|
+
*/
|
|
24
|
+
export interface KnowledgeLayoutDependencies {
|
|
25
|
+
containedFile?: ContainedFile;
|
|
26
|
+
createOnly?: CreateOnly;
|
|
27
|
+
updateNavigation?: UpdateNavigation;
|
|
28
|
+
}
|
|
29
|
+
/** Resolve a Vault-relative destination without following it outside Vault. */
|
|
30
|
+
export declare function containedVaultFile(root: string, path: string): Promise<string>;
|
|
31
|
+
/** Atomically create a regular file, preserving an existing human-edited file. */
|
|
32
|
+
export declare function createVaultFileOnly(path: string, content: string): Promise<boolean>;
|
|
33
|
+
/**
|
|
34
|
+
* Atomically replace an existing regular Vault file with an optional content CAS.
|
|
35
|
+
*
|
|
36
|
+
* The second hash check runs immediately before rename. It closes the stale-preview
|
|
37
|
+
* window for callers that show a version before asking for confirmation; if another
|
|
38
|
+
* writer changes the file during that window, the write is rejected and the caller
|
|
39
|
+
* can report a conflict without replacing the newer edit.
|
|
40
|
+
*/
|
|
41
|
+
export declare function replaceVaultFile(path: string, content: string, options?: ReplaceVaultFileOptions): Promise<void>;
|
|
42
|
+
/** Update only the managed navigation block, preserving human-authored text. */
|
|
43
|
+
export declare function updateVaultNavigation(vault: string, path: string, heading: string, body: string, containedFile?: ContainedFile): Promise<NavigationUpdateResult>;
|
|
44
|
+
export declare function initializeSharedNavigation(vault: string, dependencies?: KnowledgeLayoutDependencies): Promise<void>;
|
|
45
|
+
export declare function initializeProjectContext(vault: string, project: string, dependencies?: KnowledgeLayoutDependencies): Promise<void>;
|
|
46
|
+
export {};
|
|
47
|
+
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/core/layout.ts"],"names":[],"mappings":"AAqBA,KAAK,aAAa,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AACrE,KAAK,UAAU,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AACtE,KAAK,gBAAgB,GAAG,CACvB,IAAI,EAAE,MAAM,EACZ,IAAI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AAC,CA0CjC;AAeD,wBAAsB,0BAA0B,CAC/C,KAAK,EAAE,MAAM,EACb,YAAY,GAAE,2BAAgC,GAC5C,OAAO,CAAC,IAAI,CAAC,CAkBf;AAED,wBAAsB,wBAAwB,CAC7C,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,YAAY,GAAE,2BAAgC,GAC5C,OAAO,CAAC,IAAI,CAAC,CAOf"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare function updateNavigation(vault: any, path: any, heading: any, body: any): Promise<{
|
|
2
|
+
path: any;
|
|
3
|
+
changed: boolean;
|
|
4
|
+
}>;
|
|
5
|
+
export declare function runNavigationMaintenance(service: any, project: any, limit?: number): Promise<{
|
|
6
|
+
navigation: ({
|
|
7
|
+
path: any;
|
|
8
|
+
changed: boolean;
|
|
9
|
+
} | {
|
|
10
|
+
path: any;
|
|
11
|
+
error: any;
|
|
12
|
+
})[];
|
|
13
|
+
semanticWikiRewritten: boolean;
|
|
14
|
+
remaining: any;
|
|
15
|
+
}>;
|
|
16
|
+
//# sourceMappingURL=maintenance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maintenance.d.ts","sourceRoot":"","sources":["../../src/core/maintenance.ts"],"names":[],"mappings":"AAUA,wBAAsB,gBAAgB,CAAC,KAAK,KAAA,EAAE,IAAI,KAAA,EAAE,OAAO,KAAA,EAAE,IAAI,KAAA;;;GAwChE;AACD,wBAAsB,wBAAwB,CAAC,OAAO,KAAA,EAAE,OAAO,KAAA,EAAE,KAAK,SAAI;;;;;;;;;;GAkCzE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** 观察记忆 → 知识库笔记(单向沉淀)。纯函数,便于测试。 */
|
|
2
|
+
export interface MemoryNoteInput {
|
|
3
|
+
id: number;
|
|
4
|
+
kind: string;
|
|
5
|
+
title: string;
|
|
6
|
+
body: string;
|
|
7
|
+
sessionId?: string;
|
|
8
|
+
createdAt: number;
|
|
9
|
+
files?: string[];
|
|
10
|
+
}
|
|
11
|
+
export declare function memoryNoteSlug(memory: Pick<MemoryNoteInput, "id" | "title">): string;
|
|
12
|
+
/** 笔记正文:frontmatter(type: memory + 来源)、摘要、涉及文件、相关笔记的 [[链接]](知识网络据此连边)。 */
|
|
13
|
+
export declare function memoryNoteMarkdown(memory: MemoryNoteInput, related?: string[]): string;
|
|
14
|
+
//# sourceMappingURL=memory-note.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-note.d.ts","sourceRoot":"","sources":["../../src/core/memory-note.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,MAAM,WAAW,eAAe;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAID,wBAAgB,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,IAAI,GAAG,OAAO,CAAC,GAAG,MAAM,CAQpF;AAED,0EAA0E;AAC1E,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,GAAE,MAAM,EAAO,GAAG,MAAM,CA6B1F"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deterministic publication checks for host-observed research claims.
|
|
3
|
+
*
|
|
4
|
+
* The host supplies this snapshot; the policy never executes a workflow or
|
|
5
|
+
* infers scientific truth. It only compares the final draft with bounded,
|
|
6
|
+
* current receipts and returns actionable, redacted diffs. A finding that
|
|
7
|
+
* passes these structural checks is citable evidence of what was observed,
|
|
8
|
+
* never a claim that the underlying science is true.
|
|
9
|
+
*/
|
|
10
|
+
export type MetacognitiveLabel = "exploratory" | "validation" | "validated" | "overturned" | "unstable";
|
|
11
|
+
export type MetacognitiveUseRole = "evidence" | "exploratory" | "validation" | "conclusion";
|
|
12
|
+
export interface MetacognitiveArtifactNumber {
|
|
13
|
+
value: number | string;
|
|
14
|
+
tolerance?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface MetacognitiveArtifact {
|
|
17
|
+
path: string;
|
|
18
|
+
/** Inquiry lineage status; pending review is never publishable. */
|
|
19
|
+
status?: "valid" | "superseded" | "cleanup-candidate" | "archived" | "pending-review";
|
|
20
|
+
/** Hash recorded when the artifact was cited. */
|
|
21
|
+
sha256?: string;
|
|
22
|
+
/** Hash observed immediately before publication. */
|
|
23
|
+
currentSha256?: string;
|
|
24
|
+
/** Human confirmation metadata retained with a previously revoked artifact. */
|
|
25
|
+
reviews?: readonly {
|
|
26
|
+
decisionId: string;
|
|
27
|
+
confirmedBy: "user";
|
|
28
|
+
confirmedAt: string;
|
|
29
|
+
}[];
|
|
30
|
+
/** Reproducibility is advisory; a missing receipt never bypasses fail-closed checks. */
|
|
31
|
+
reproducibility?: "reproducible" | "partial" | "not-reproducible";
|
|
32
|
+
/** Optional bounded text/number index supplied by the host. */
|
|
33
|
+
text?: string;
|
|
34
|
+
numbers?: readonly MetacognitiveArtifactNumber[];
|
|
35
|
+
/** Optional current-turn read receipt reference for source citations. */
|
|
36
|
+
receiptId?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface MetacognitiveNumberClaim {
|
|
39
|
+
id?: string;
|
|
40
|
+
value: number | string;
|
|
41
|
+
/** Exact representation expected in the final answer (supports rounding). */
|
|
42
|
+
rendered?: string;
|
|
43
|
+
artifactPath: string;
|
|
44
|
+
rounding?: {
|
|
45
|
+
digits?: number;
|
|
46
|
+
tolerance?: number;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export interface MetacognitiveExecutedWorkflow {
|
|
50
|
+
workflows?: readonly string[];
|
|
51
|
+
modules?: readonly string[];
|
|
52
|
+
params?: Readonly<Record<string, unknown>>;
|
|
53
|
+
}
|
|
54
|
+
export interface MetacognitiveMethodClaim {
|
|
55
|
+
id?: string;
|
|
56
|
+
/** A bounded method sentence from the final answer. */
|
|
57
|
+
description: string;
|
|
58
|
+
workflow?: string;
|
|
59
|
+
modules?: readonly string[];
|
|
60
|
+
params?: Readonly<Record<string, unknown>>;
|
|
61
|
+
}
|
|
62
|
+
export interface MetacognitiveFinding {
|
|
63
|
+
id: string;
|
|
64
|
+
text: string;
|
|
65
|
+
label: MetacognitiveLabel;
|
|
66
|
+
citationPaths?: readonly string[];
|
|
67
|
+
}
|
|
68
|
+
export interface MetacognitiveFindingUse {
|
|
69
|
+
findingId: string;
|
|
70
|
+
role: MetacognitiveUseRole;
|
|
71
|
+
}
|
|
72
|
+
export interface MetacognitiveDiagnostic {
|
|
73
|
+
id: string;
|
|
74
|
+
reported: unknown;
|
|
75
|
+
observed: unknown;
|
|
76
|
+
}
|
|
77
|
+
export interface MetacognitiveSnapshot {
|
|
78
|
+
/** A host may turn this off for operational/setup turns. */
|
|
79
|
+
enabled?: boolean;
|
|
80
|
+
artifacts?: readonly MetacognitiveArtifact[];
|
|
81
|
+
numbers?: readonly MetacognitiveNumberClaim[];
|
|
82
|
+
executed?: MetacognitiveExecutedWorkflow;
|
|
83
|
+
methods?: readonly MetacognitiveMethodClaim[];
|
|
84
|
+
findings?: readonly MetacognitiveFinding[];
|
|
85
|
+
uses?: readonly MetacognitiveFindingUse[];
|
|
86
|
+
diagnostics?: readonly MetacognitiveDiagnostic[];
|
|
87
|
+
}
|
|
88
|
+
export type MetacognitiveFailureCode = "report-number-unbound" | "artifact-checksum-stale" | "method-mismatch" | "finding-label-conflict" | "diagnostic-drift" | "artifact-pending-review" | "metacognition-invalid";
|
|
89
|
+
export interface MetacognitiveFailure {
|
|
90
|
+
code: MetacognitiveFailureCode;
|
|
91
|
+
subject: string;
|
|
92
|
+
detail: string;
|
|
93
|
+
path?: string;
|
|
94
|
+
}
|
|
95
|
+
export interface MetacognitiveEvidenceFinding {
|
|
96
|
+
id: string;
|
|
97
|
+
text: string;
|
|
98
|
+
label: MetacognitiveLabel;
|
|
99
|
+
citationPaths: string[];
|
|
100
|
+
}
|
|
101
|
+
export interface MetacognitiveEvaluation {
|
|
102
|
+
ok: boolean;
|
|
103
|
+
failures: MetacognitiveFailure[];
|
|
104
|
+
warnings: MetacognitiveWarning[];
|
|
105
|
+
/** Finding records are copied into the publication proof for citation. */
|
|
106
|
+
findings: MetacognitiveEvidenceFinding[];
|
|
107
|
+
}
|
|
108
|
+
export interface MetacognitiveWarning {
|
|
109
|
+
code: "artifact-not-reproducible";
|
|
110
|
+
subject: string;
|
|
111
|
+
detail: string;
|
|
112
|
+
path?: string;
|
|
113
|
+
}
|
|
114
|
+
/** Compare a final answer with host-observed reports, workflows and findings. */
|
|
115
|
+
export declare function evaluateMetacognitivePublication(answer: string, snapshot: unknown): MetacognitiveEvaluation;
|
|
116
|
+
//# sourceMappingURL=metacognitive-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metacognitive-policy.d.ts","sourceRoot":"","sources":["../../src/core/metacognitive-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG,YAAY,GAAG,WAAW,GAAG,YAAY,GAAG,UAAU,CAAC;AACxG,MAAM,MAAM,oBAAoB,GAAG,UAAU,GAAG,aAAa,GAAG,YAAY,GAAG,YAAY,CAAC;AAE5F,MAAM,WAAW,2BAA2B;IAC3C,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,MAAM,CAAC,EAAE,OAAO,GAAG,YAAY,GAAG,mBAAmB,GAAG,UAAU,GAAG,gBAAgB,CAAC;IACtF,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oDAAoD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AC1B,aAAa,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,uBAAuB;IACvC,EAAE,EAAE,OAAO,CAAC;IACZ,QAAQ,EAAE,oBAAoB,EAAE,CAAC;IACjC,QAAQ,EAAE,oBAAoB,EAAE,CAAC;IACjC,0EAA0E;IAC1E,QAAQ,EAAE,4BAA4B,EAAE,CAAC;CACzC;AAED,MAAM,WAAW,oBAAoB;IACpC,IAAI,EAAE,2BAA2B,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAyED,iFAAiF;AACjF,wBAAgB,gCAAgC,CAC/C,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,OAAO,GACf,uBAAuB,CA2MzB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** A title that is really a file name ("PMC7022188.1.pdf", "lora-2106-09685") says nothing about the content. */
|
|
2
|
+
export declare function looksLikeFileName(title: string): boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Node/display title for a Vault note: an explicit `topic` written at ingestion wins,
|
|
5
|
+
* then frontmatter `title`, then the first H1, then the file name.
|
|
6
|
+
*/
|
|
7
|
+
export declare function noteDisplayTitle(text: string, path: string): string;
|
|
8
|
+
//# sourceMappingURL=note-title.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"note-title.d.ts","sourceRoot":"","sources":["../../src/core/note-title.ts"],"names":[],"mappings":"AAKA,iHAAiH;AACjH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAMxD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAanE"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/** Deterministic, auditable scheduling decisions for knowledge specialists. */
|
|
2
|
+
export declare const SPECIALIST_DECISIONS: readonly ["run", "skip", "wait", "ask-user"];
|
|
3
|
+
export type SpecialistDecision = (typeof SPECIALIST_DECISIONS)[number];
|
|
4
|
+
export interface SpecialistRequestSignatureOptions {
|
|
5
|
+
role?: string;
|
|
6
|
+
task?: string;
|
|
7
|
+
sourcePaths?: unknown[];
|
|
8
|
+
sourceHashes?: unknown[];
|
|
9
|
+
summary?: string;
|
|
10
|
+
targetPath?: string | null;
|
|
11
|
+
}
|
|
12
|
+
export declare function specialistRequestSignature({ role, task, sourcePaths, sourceHashes, summary, targetPath, }?: SpecialistRequestSignatureOptions): string;
|
|
13
|
+
export interface SpecialistRunOptions extends SpecialistRequestSignatureOptions {
|
|
14
|
+
automatic?: boolean;
|
|
15
|
+
mode?: string;
|
|
16
|
+
trusted?: boolean;
|
|
17
|
+
policy?: string;
|
|
18
|
+
hasEvidence?: boolean;
|
|
19
|
+
taskNeedsSpecialist?: boolean;
|
|
20
|
+
observedNeed?: boolean;
|
|
21
|
+
duplicate?: boolean;
|
|
22
|
+
turnRuns?: number;
|
|
23
|
+
maxRunsPerTurn?: number;
|
|
24
|
+
sessionRuns?: number;
|
|
25
|
+
maxRunsPerSession?: number;
|
|
26
|
+
active?: number;
|
|
27
|
+
concurrency?: number;
|
|
28
|
+
queueLength?: number;
|
|
29
|
+
queueLimit?: number;
|
|
30
|
+
}
|
|
31
|
+
export interface SpecialistRunDecision {
|
|
32
|
+
role?: string;
|
|
33
|
+
signature: string;
|
|
34
|
+
decision: SpecialistDecision;
|
|
35
|
+
reasonCode: string;
|
|
36
|
+
}
|
|
37
|
+
export declare function decideSpecialistRun({ role, task, sourcePaths, targetPath, sourceHashes, summary, automatic, mode, trusted, policy, hasEvidence, taskNeedsSpecialist, observedNeed, duplicate, turnRuns, maxRunsPerTurn, sessionRuns, maxRunsPerSession, active, concurrency, queueLength, queueLimit, }?: SpecialistRunOptions): SpecialistRunDecision;
|
|
38
|
+
export interface SpecialistBudgetOptions {
|
|
39
|
+
maxRunsPerTurn?: number;
|
|
40
|
+
maxRunsPerSession?: number;
|
|
41
|
+
maxToolOperations?: number;
|
|
42
|
+
maxTokensPerTurn?: number;
|
|
43
|
+
maxTokensPerSession?: number;
|
|
44
|
+
maxCostPerTurn?: number;
|
|
45
|
+
maxCostPerSession?: number;
|
|
46
|
+
}
|
|
47
|
+
export interface SpecialistUsage {
|
|
48
|
+
totalTokens?: number;
|
|
49
|
+
cost?: number;
|
|
50
|
+
}
|
|
51
|
+
export interface SpecialistBudgetSnapshot {
|
|
52
|
+
turn: number;
|
|
53
|
+
turnRuns: number;
|
|
54
|
+
sessionRuns: number;
|
|
55
|
+
toolOperations: number;
|
|
56
|
+
reservations: number;
|
|
57
|
+
maxRunsPerTurn: number;
|
|
58
|
+
maxRunsPerSession: number;
|
|
59
|
+
maxToolOperations: number;
|
|
60
|
+
turnTokens: number;
|
|
61
|
+
sessionTokens: number;
|
|
62
|
+
turnCost: number;
|
|
63
|
+
sessionCost: number;
|
|
64
|
+
maxTokensPerTurn: number;
|
|
65
|
+
maxTokensPerSession: number;
|
|
66
|
+
maxCostPerTurn: number;
|
|
67
|
+
maxCostPerSession: number;
|
|
68
|
+
}
|
|
69
|
+
export interface SpecialistBudget {
|
|
70
|
+
begin(): void;
|
|
71
|
+
reserve(signature: string, reservationTurn?: number, options?: {
|
|
72
|
+
dedupe?: boolean;
|
|
73
|
+
}): boolean;
|
|
74
|
+
commit(signature: string, reservationTurn?: number): boolean;
|
|
75
|
+
release(signature: string, reservationTurn?: number): boolean;
|
|
76
|
+
addToolOperation(): boolean;
|
|
77
|
+
configure(next?: SpecialistBudgetOptions): void;
|
|
78
|
+
updateUsage(usage?: SpecialistUsage, usageTurn?: number): boolean;
|
|
79
|
+
recordUsage(usage?: SpecialistUsage, usageTurn?: number): boolean;
|
|
80
|
+
checkUsage(): true;
|
|
81
|
+
readonly snapshot: SpecialistBudgetSnapshot;
|
|
82
|
+
}
|
|
83
|
+
export declare function createSpecialistBudget({ maxRunsPerTurn, maxRunsPerSession, maxToolOperations, maxTokensPerTurn, maxTokensPerSession, maxCostPerTurn, maxCostPerSession, }?: SpecialistBudgetOptions): SpecialistBudget;
|
|
84
|
+
//# sourceMappingURL=orchestration-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestration-policy.d.ts","sourceRoot":"","sources":["../../src/core/orchestration-policy.ts"],"names":[],"mappings":"AAEA,+EAA+E;AAC/E,eAAO,MAAM,oBAAoB,8CAA+C,CAAC;AACjF,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAevE,MAAM,WAAW,iCAAiC;IACjD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,EAAE,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,wBAAgB,0BAA0B,CAAC,EAC1C,IAAI,EACJ,IAAS,EACT,WAAgB,EAChB,YAAiB,EACjB,OAAY,EACZ,UAAiB,GACjB,GAAE,iCAAsC,GAAG,MAAM,CAWjD;AAED,MAAM,WAAW,oBAAqB,SAAQ,iCAAiC;IAC9E,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE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ACxB,mBAA4B,EAC5B,cAAkB,EAClB,iBAAqB,GACrB,GAAE,uBAA4B,GAAG,gBAAgB,CAgIjD"}
|
|
@@ -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;IACvC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,yBAAyB;IACzB,cAAc,EAAE,OAAO,CAAC;CACxB;AAED,4DAA4D;AAC5D,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE7D;AAED,gEAAgE;AAChE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAUlE;AAED,6EAA6E;AAC7E,wBAAgB,kBAAkB,CAAC,GAAG,EAA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,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,iBAAiB,GACjB,eAAe,GACf,kBAAkB,GAClB,gBAAgB,GAChB,cAAc,GACd,cAAc,GACd,iBAAiB,GACjB,oBAAoB,GACpB,cAAc,GACd,aAAa,GACb,aAAa,GACb,eAAe,GACf,cAAc,GACd,cAAc,GACd,kBAAkB,GAClB,iBAAiB,GACjB,mBAAmB,GACnB,6BAA6B,GAC7B,yBAAyB,CAAC;AAE7B,MAAM,WAAW,uBAAuB;IACvC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,kBAAkB;IAClC,IAAI,EAAE,sBAAsB,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,6EAA6E;AAC7E,eAAO,MAAM,yBAAyB,+FAAoB,CAAC;AAE3D,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,sBAAsB,EAAE,MAAM,CAAC,CA6B/E,CAAC;AAmBF,mFAAmF;AACnF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAEzE;AAED,4DAA4D;AAC5D,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAGtE;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,uBAAuB,CAAA;CAAE,GAAG,MAAM,CAsBjG;AAkBD,sFAAsF;AACtF,wBAAgB,gBAAgB,CAAC,KAAK,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
|