@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.
Files changed (146) hide show
  1. package/build-manifest.json +2 -2
  2. package/node_modules/@gyoungwe/pi-core/README.md +5 -3
  3. package/node_modules/@gyoungwe/pi-core/build-manifest.json +2 -2
  4. package/node_modules/@gyoungwe/pi-core/dist/index.mjs +435 -151
  5. package/node_modules/@gyoungwe/pi-core/package.json +1 -1
  6. package/node_modules/@gyoungwe/pi-knowledge/build-manifest.json +68 -3
  7. package/node_modules/@gyoungwe/pi-knowledge/dist/core/capability-discovery.d.ts +7 -0
  8. package/node_modules/@gyoungwe/pi-knowledge/dist/core/capability-discovery.d.ts.map +1 -0
  9. package/node_modules/@gyoungwe/pi-knowledge/dist/core/claim-conflicts.d.ts +30 -0
  10. package/node_modules/@gyoungwe/pi-knowledge/dist/core/claim-conflicts.d.ts.map +1 -0
  11. package/node_modules/@gyoungwe/pi-knowledge/dist/core/config.d.ts +55 -0
  12. package/node_modules/@gyoungwe/pi-knowledge/dist/core/config.d.ts.map +1 -0
  13. package/node_modules/@gyoungwe/pi-knowledge/dist/core/daily-discovery-prompt.d.ts +11 -0
  14. package/node_modules/@gyoungwe/pi-knowledge/dist/core/daily-discovery-prompt.d.ts.map +1 -0
  15. package/node_modules/@gyoungwe/pi-knowledge/dist/core/daily-discovery.d.ts +26 -0
  16. package/node_modules/@gyoungwe/pi-knowledge/dist/core/daily-discovery.d.ts.map +1 -0
  17. package/node_modules/@gyoungwe/pi-knowledge/dist/core/deliverable-review.d.ts +127 -0
  18. package/node_modules/@gyoungwe/pi-knowledge/dist/core/deliverable-review.d.ts.map +1 -0
  19. package/node_modules/@gyoungwe/pi-knowledge/dist/core/evolution.d.ts +39 -0
  20. package/node_modules/@gyoungwe/pi-knowledge/dist/core/evolution.d.ts.map +1 -0
  21. package/node_modules/@gyoungwe/pi-knowledge/dist/core/experience-store.d.ts +290 -0
  22. package/node_modules/@gyoungwe/pi-knowledge/dist/core/experience-store.d.ts.map +1 -0
  23. package/node_modules/@gyoungwe/pi-knowledge/dist/core/extension-helpers.d.ts +38 -0
  24. package/node_modules/@gyoungwe/pi-knowledge/dist/core/extension-helpers.d.ts.map +1 -0
  25. package/node_modules/@gyoungwe/pi-knowledge/dist/core/files.d.ts +39 -0
  26. package/node_modules/@gyoungwe/pi-knowledge/dist/core/files.d.ts.map +1 -0
  27. package/node_modules/@gyoungwe/pi-knowledge/dist/core/flow-cards.d.ts +77 -0
  28. package/node_modules/@gyoungwe/pi-knowledge/dist/core/flow-cards.d.ts.map +1 -0
  29. package/node_modules/@gyoungwe/pi-knowledge/dist/core/graph-cache.d.ts +14 -0
  30. package/node_modules/@gyoungwe/pi-knowledge/dist/core/graph-cache.d.ts.map +1 -0
  31. package/node_modules/@gyoungwe/pi-knowledge/dist/core/graph-retrieval.d.ts +44 -0
  32. package/node_modules/@gyoungwe/pi-knowledge/dist/core/graph-retrieval.d.ts.map +1 -0
  33. package/node_modules/@gyoungwe/pi-knowledge/dist/core/host.d.ts +9 -0
  34. package/node_modules/@gyoungwe/pi-knowledge/dist/core/host.d.ts.map +1 -0
  35. package/node_modules/@gyoungwe/pi-knowledge/dist/core/index.d.ts +46 -0
  36. package/node_modules/@gyoungwe/pi-knowledge/dist/core/index.d.ts.map +1 -0
  37. package/node_modules/@gyoungwe/pi-knowledge/dist/core/ingest-frontmatter.d.ts +125 -0
  38. package/node_modules/@gyoungwe/pi-knowledge/dist/core/ingest-frontmatter.d.ts.map +1 -0
  39. package/node_modules/@gyoungwe/pi-knowledge/dist/core/ingest-identity.d.ts +93 -0
  40. package/node_modules/@gyoungwe/pi-knowledge/dist/core/ingest-identity.d.ts.map +1 -0
  41. package/node_modules/@gyoungwe/pi-knowledge/dist/core/ingest-policy.d.ts +63 -0
  42. package/node_modules/@gyoungwe/pi-knowledge/dist/core/ingest-policy.d.ts.map +1 -0
  43. package/node_modules/@gyoungwe/pi-knowledge/dist/core/layout.d.ts +47 -0
  44. package/node_modules/@gyoungwe/pi-knowledge/dist/core/layout.d.ts.map +1 -0
  45. package/node_modules/@gyoungwe/pi-knowledge/dist/core/maintenance.d.ts +16 -0
  46. package/node_modules/@gyoungwe/pi-knowledge/dist/core/maintenance.d.ts.map +1 -0
  47. package/node_modules/@gyoungwe/pi-knowledge/dist/core/memory-note.d.ts +14 -0
  48. package/node_modules/@gyoungwe/pi-knowledge/dist/core/memory-note.d.ts.map +1 -0
  49. package/node_modules/@gyoungwe/pi-knowledge/dist/core/metacognitive-policy.d.ts +116 -0
  50. package/node_modules/@gyoungwe/pi-knowledge/dist/core/metacognitive-policy.d.ts.map +1 -0
  51. package/node_modules/@gyoungwe/pi-knowledge/dist/core/note-title.d.ts +8 -0
  52. package/node_modules/@gyoungwe/pi-knowledge/dist/core/note-title.d.ts.map +1 -0
  53. package/node_modules/@gyoungwe/pi-knowledge/dist/core/orchestration-policy.d.ts +84 -0
  54. package/node_modules/@gyoungwe/pi-knowledge/dist/core/orchestration-policy.d.ts.map +1 -0
  55. package/node_modules/@gyoungwe/pi-knowledge/dist/core/project-identity.d.ts +70 -0
  56. package/node_modules/@gyoungwe/pi-knowledge/dist/core/project-identity.d.ts.map +1 -0
  57. package/node_modules/@gyoungwe/pi-knowledge/dist/core/publication-policy.d.ts +39 -0
  58. package/node_modules/@gyoungwe/pi-knowledge/dist/core/publication-policy.d.ts.map +1 -0
  59. package/node_modules/@gyoungwe/pi-knowledge/dist/core/publication.d.ts +24 -0
  60. package/node_modules/@gyoungwe/pi-knowledge/dist/core/publication.d.ts.map +1 -0
  61. package/node_modules/@gyoungwe/pi-knowledge/dist/core/recent-by-category.d.ts +15 -0
  62. package/node_modules/@gyoungwe/pi-knowledge/dist/core/recent-by-category.d.ts.map +1 -0
  63. package/node_modules/@gyoungwe/pi-knowledge/dist/core/related-notes.d.ts +4 -0
  64. package/node_modules/@gyoungwe/pi-knowledge/dist/core/related-notes.d.ts.map +1 -0
  65. package/node_modules/@gyoungwe/pi-knowledge/dist/core/reuse.d.ts +124 -0
  66. package/node_modules/@gyoungwe/pi-knowledge/dist/core/reuse.d.ts.map +1 -0
  67. package/node_modules/@gyoungwe/pi-knowledge/dist/core/review-policy.d.ts +12 -0
  68. package/node_modules/@gyoungwe/pi-knowledge/dist/core/review-policy.d.ts.map +1 -0
  69. package/node_modules/@gyoungwe/pi-knowledge/dist/core/runtime-host.d.ts +98 -0
  70. package/node_modules/@gyoungwe/pi-knowledge/dist/core/runtime-host.d.ts.map +1 -0
  71. package/node_modules/@gyoungwe/pi-knowledge/dist/core/search-policy.d.ts +14 -0
  72. package/node_modules/@gyoungwe/pi-knowledge/dist/core/search-policy.d.ts.map +1 -0
  73. package/node_modules/@gyoungwe/pi-knowledge/dist/core/semantic-model.d.ts +85 -0
  74. package/node_modules/@gyoungwe/pi-knowledge/dist/core/semantic-model.d.ts.map +1 -0
  75. package/node_modules/@gyoungwe/pi-knowledge/dist/core/semantic-provider.d.ts +41 -0
  76. package/node_modules/@gyoungwe/pi-knowledge/dist/core/semantic-provider.d.ts.map +1 -0
  77. package/node_modules/@gyoungwe/pi-knowledge/dist/core/semantic-settings.d.ts +30 -0
  78. package/node_modules/@gyoungwe/pi-knowledge/dist/core/semantic-settings.d.ts.map +1 -0
  79. package/node_modules/@gyoungwe/pi-knowledge/dist/core/service.d.ts +171 -0
  80. package/node_modules/@gyoungwe/pi-knowledge/dist/core/service.d.ts.map +1 -0
  81. package/node_modules/@gyoungwe/pi-knowledge/dist/core/source-links.d.ts +13 -0
  82. package/node_modules/@gyoungwe/pi-knowledge/dist/core/source-links.d.ts.map +1 -0
  83. package/node_modules/@gyoungwe/pi-knowledge/dist/core/specialist-delivery.d.ts +8 -0
  84. package/node_modules/@gyoungwe/pi-knowledge/dist/core/specialist-delivery.d.ts.map +1 -0
  85. package/node_modules/@gyoungwe/pi-knowledge/dist/core/specialist-host.d.ts +61 -0
  86. package/node_modules/@gyoungwe/pi-knowledge/dist/core/specialist-host.d.ts.map +1 -0
  87. package/node_modules/@gyoungwe/pi-knowledge/dist/core/specialists.d.ts +55 -0
  88. package/node_modules/@gyoungwe/pi-knowledge/dist/core/specialists.d.ts.map +1 -0
  89. package/node_modules/@gyoungwe/pi-knowledge/dist/core/task-feedback.d.ts +57 -0
  90. package/node_modules/@gyoungwe/pi-knowledge/dist/core/task-feedback.d.ts.map +1 -0
  91. package/node_modules/@gyoungwe/pi-knowledge/dist/core/tool-budget.d.ts +24 -0
  92. package/node_modules/@gyoungwe/pi-knowledge/dist/core/tool-budget.d.ts.map +1 -0
  93. package/node_modules/@gyoungwe/pi-knowledge/dist/core/topic-candidate.d.ts +22 -0
  94. package/node_modules/@gyoungwe/pi-knowledge/dist/core/topic-candidate.d.ts.map +1 -0
  95. package/node_modules/@gyoungwe/pi-knowledge/dist/core/topic-memory.d.ts +79 -0
  96. package/node_modules/@gyoungwe/pi-knowledge/dist/core/topic-memory.d.ts.map +1 -0
  97. package/node_modules/@gyoungwe/pi-knowledge/dist/core/topic-probe.d.ts +2 -0
  98. package/node_modules/@gyoungwe/pi-knowledge/dist/core/topic-probe.d.ts.map +1 -0
  99. package/node_modules/@gyoungwe/pi-knowledge/dist/core/ui-service.d.ts +360 -0
  100. package/node_modules/@gyoungwe/pi-knowledge/dist/core/ui-service.d.ts.map +1 -0
  101. package/node_modules/@gyoungwe/pi-knowledge/dist/core/ui-state.d.ts +28 -0
  102. package/node_modules/@gyoungwe/pi-knowledge/dist/core/ui-state.d.ts.map +1 -0
  103. package/node_modules/@gyoungwe/pi-knowledge/dist/core/wiki-model-review.d.ts +167 -0
  104. package/node_modules/@gyoungwe/pi-knowledge/dist/core/wiki-model-review.d.ts.map +1 -0
  105. package/node_modules/@gyoungwe/pi-knowledge/dist/core/wiki-policy.d.ts +34 -0
  106. package/node_modules/@gyoungwe/pi-knowledge/dist/core/wiki-policy.d.ts.map +1 -0
  107. package/node_modules/@gyoungwe/pi-knowledge/dist/core/wiki-review.d.ts +74 -0
  108. package/node_modules/@gyoungwe/pi-knowledge/dist/core/wiki-review.d.ts.map +1 -0
  109. package/node_modules/@gyoungwe/pi-knowledge/dist/core/worker.d.ts +2 -0
  110. package/node_modules/@gyoungwe/pi-knowledge/dist/core/worker.d.ts.map +1 -0
  111. package/node_modules/@gyoungwe/pi-knowledge/dist/extension/internal-knowledge-extension.d.ts +42 -0
  112. package/node_modules/@gyoungwe/pi-knowledge/dist/extension/internal-knowledge-extension.d.ts.map +1 -0
  113. package/node_modules/@gyoungwe/pi-knowledge/dist/extension/knowledge-extension.d.ts +5 -0
  114. package/node_modules/@gyoungwe/pi-knowledge/dist/extension/knowledge-extension.d.ts.map +1 -0
  115. package/node_modules/@gyoungwe/pi-knowledge/dist/extension/knowledge-worker.d.ts +6 -0
  116. package/node_modules/@gyoungwe/pi-knowledge/dist/extension/knowledge-worker.d.ts.map +1 -0
  117. package/node_modules/@gyoungwe/pi-knowledge/dist/host.d.ts +7 -0
  118. package/node_modules/@gyoungwe/pi-knowledge/dist/host.d.ts.map +1 -0
  119. package/node_modules/@gyoungwe/pi-knowledge/dist/host.mjs +11638 -0
  120. package/node_modules/@gyoungwe/pi-knowledge/dist/index.d.ts +6 -0
  121. package/node_modules/@gyoungwe/pi-knowledge/dist/index.d.ts.map +1 -0
  122. package/node_modules/@gyoungwe/pi-knowledge/dist/index.mjs +4728 -10301
  123. package/node_modules/@gyoungwe/pi-knowledge/dist/maintenance/plan.d.ts +41 -0
  124. package/node_modules/@gyoungwe/pi-knowledge/dist/maintenance/plan.d.ts.map +1 -0
  125. package/node_modules/@gyoungwe/pi-knowledge/dist/maintenance/prompts.d.ts +10 -0
  126. package/node_modules/@gyoungwe/pi-knowledge/dist/maintenance/prompts.d.ts.map +1 -0
  127. package/node_modules/@gyoungwe/pi-knowledge/dist/maintenance/run.d.ts +31 -0
  128. package/node_modules/@gyoungwe/pi-knowledge/dist/maintenance/run.d.ts.map +1 -0
  129. package/node_modules/@gyoungwe/pi-knowledge/lib/knowledge/runtime/.knowledge-worker-manifest.json +9 -0
  130. package/node_modules/@gyoungwe/pi-knowledge/lib/knowledge/runtime/worker.mjs +142 -12
  131. package/node_modules/@gyoungwe/pi-knowledge/package.json +21 -3
  132. package/node_modules/@gyoungwe/pi-knowledge/plugin.manifest.json +23 -1
  133. package/node_modules/@gyoungwe/pi-research/build-manifest.json +2 -2
  134. package/node_modules/@gyoungwe/pi-research/dist/index.mjs +3141 -613
  135. package/node_modules/@gyoungwe/pi-research/package.json +1 -1
  136. package/node_modules/@gyoungwe/plugin-api/dist/index.d.ts +101 -0
  137. package/node_modules/@gyoungwe/plugin-api/dist/index.d.ts.map +1 -1
  138. package/node_modules/@gyoungwe/plugin-api/dist/index.js +124 -0
  139. package/node_modules/@gyoungwe/plugin-api/dist/index.js.map +1 -1
  140. package/node_modules/@gyoungwe/plugin-api/dist/knowledge.d.ts +486 -0
  141. package/node_modules/@gyoungwe/plugin-api/dist/knowledge.d.ts.map +1 -0
  142. package/node_modules/@gyoungwe/plugin-api/dist/knowledge.js +251 -0
  143. package/node_modules/@gyoungwe/plugin-api/dist/knowledge.js.map +1 -0
  144. package/node_modules/@gyoungwe/plugin-api/package.json +6 -1
  145. package/package.json +58 -44
  146. package/plugin.manifest.json +39 -3
@@ -0,0 +1,41 @@
1
+ export type MaintenanceItemKind = "missing-topic" | "source-changed" | "orphan" | "unlinked";
2
+ export interface MaintenanceItem {
3
+ readonly id: string;
4
+ readonly kind: MaintenanceItemKind;
5
+ readonly path: string;
6
+ readonly title?: string;
7
+ readonly detail?: string;
8
+ }
9
+ export interface MaintenanceGraphNode {
10
+ readonly path: string;
11
+ readonly title?: string;
12
+ readonly kind?: string;
13
+ readonly degree?: number;
14
+ readonly warnings?: readonly string[];
15
+ readonly isInfrastructure?: boolean;
16
+ readonly nodeType?: string;
17
+ }
18
+ export interface MaintenanceGraph {
19
+ readonly nodes?: readonly MaintenanceGraphNode[];
20
+ readonly edges?: readonly {
21
+ source: string;
22
+ target: string;
23
+ type?: string;
24
+ }[];
25
+ readonly semantic?: {
26
+ nodes?: readonly MaintenanceGraphNode[];
27
+ edges?: readonly {
28
+ source: string;
29
+ target: string;
30
+ type?: string;
31
+ }[];
32
+ };
33
+ }
34
+ export interface MaintenanceSettings {
35
+ readonly enabled: boolean;
36
+ readonly maxItems: number;
37
+ readonly dailyLimit: number;
38
+ readonly model?: string | null;
39
+ }
40
+ export declare function planMaintenance(_status: unknown, graph: MaintenanceGraph | null, settings: MaintenanceSettings): MaintenanceItem[];
41
+ //# sourceMappingURL=plan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/maintenance/plan.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,mBAAmB,GAAG,eAAe,GAAG,gBAAgB,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE7F,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,oBAAoB;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IACpC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACjD,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC9E,QAAQ,CAAC,QAAQ,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,SAAS,oBAAoB,EAAE,CAAC;QAAC,KAAK,CAAC,EAAE,SAAS;YAAE,MAAM,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;KAAE,CAAC;CACtI;AAED,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AASD,wBAAgB,eAAe,CAC9B,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,gBAAgB,GAAG,IAAI,EAC9B,QAAQ,EAAE,mBAAmB,GAC3B,eAAe,EAAE,CAwCnB"}
@@ -0,0 +1,10 @@
1
+ export type MaintenancePromptKind = "missing-topic" | "source-changed" | "orphan" | "unlinked";
2
+ export declare function maintenancePrompt(kind: MaintenancePromptKind, item: {
3
+ path: string;
4
+ title?: string;
5
+ detail?: string;
6
+ markdown?: string;
7
+ sourceMarkdown?: string;
8
+ }): string;
9
+ export declare function parseMaintenanceJson(text: string): Record<string, unknown>;
10
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/maintenance/prompts.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,qBAAqB,GAAG,eAAe,GAAG,gBAAgB,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE/F,wBAAgB,iBAAiB,CAChC,IAAI,EAAE,qBAAqB,EAC3B,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,GACjG,MAAM,CAaR;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAK1E"}
@@ -0,0 +1,31 @@
1
+ import type { MaintenanceItem } from "./plan.js";
2
+ export interface MaintenanceRunResult {
3
+ readonly startedAt: string;
4
+ readonly processed: number;
5
+ readonly modelCalls: number;
6
+ readonly items: readonly {
7
+ id: string;
8
+ kind: string;
9
+ status: string;
10
+ reason?: string;
11
+ }[];
12
+ }
13
+ export interface MaintenancePorts {
14
+ readonly readNote: (path: string) => Promise<{
15
+ title?: string;
16
+ markdown: string;
17
+ sourceMarkdown?: string;
18
+ exists?: boolean;
19
+ }>;
20
+ readonly complete: (prompt: string, model?: string | null) => Promise<string>;
21
+ readonly model?: string | null;
22
+ readonly setTopic: (path: string, topic: string) => Promise<void>;
23
+ readonly proposeWiki: (item: MaintenanceItem, proposal: Record<string, unknown>) => Promise<void>;
24
+ readonly validateWikiLinks?: (proposal: Record<string, unknown>) => Promise<void>;
25
+ readonly budget?: {
26
+ readonly modelCalls: number;
27
+ };
28
+ readonly signal?: AbortSignal;
29
+ }
30
+ export declare function runMaintenance(items: readonly MaintenanceItem[], ports: MaintenancePorts): Promise<MaintenanceRunResult>;
31
+ //# sourceMappingURL=run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/maintenance/run.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,MAAM,WAAW,oBAAoB;IACpC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,SAAS;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACzF;AAED,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;QAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,MAAM,CAAC,EAAE,OAAO,CAAC;KACjB,CAAC,CAAC;IACH,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9E,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClE,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClG,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClF,QAAQ,CAAC,MAAM,CAAC,EAAE;QAAE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IAClD,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC9B;AAED,wBAAsB,cAAc,CAAC,KAAK,EAAE,SAAS,eAAe,EAAE,EAAE,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAyD9H"}
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": 1,
3
+ "generator": "packages/pi-knowledge/scripts/build.mjs",
4
+ "output": "worker.mjs",
5
+ "source": "src/extension/knowledge-worker.ts",
6
+ "inputsSha256": "d6825afa4c77c708ddac99ccad22cca8479db2784f3617fd91ecc92dc8ea5b2a",
7
+ "knowledgeSourceSha256": "d6825afa4c77c708ddac99ccad22cca8479db2784f3617fd91ecc92dc8ea5b2a",
8
+ "outputSha256": "0ba2740573429c6de789f495f2cddf06cc3801dfb7ffeca70ac0aeb512c461d0"
9
+ }
@@ -1,5 +1,6 @@
1
1
  // @ts-nocheck
2
- // packages/knowledge/src/worker.ts
2
+
3
+ // src/core/worker.ts
3
4
  import { watch } from "node:fs";
4
5
  import { mkdir, readdir } from "node:fs/promises";
5
6
  import { dirname, join as join2 } from "node:path";
@@ -7,7 +8,7 @@ import { DatabaseSync } from "node:sqlite";
7
8
  import { setImmediate as yieldTurn } from "node:timers/promises";
8
9
  import { parentPort, workerData } from "node:worker_threads";
9
10
 
10
- // packages/knowledge/src/files.ts
11
+ // src/core/files.ts
11
12
  import { createHash } from "node:crypto";
12
13
  import { constants } from "node:fs";
13
14
  import { lstat, open, realpath } from "node:fs/promises";
@@ -130,7 +131,7 @@ function snippet(text, { startLine = 1, maxChars = 5e3 } = {}) {
130
131
  };
131
132
  }
132
133
 
133
- // packages/knowledge/src/graph-retrieval.ts
134
+ // src/core/graph-retrieval.ts
134
135
  function backlinkContext(body, target, max = 240) {
135
136
  const bare = target.split("/").at(-1)?.replace(/\.md$/, "") || target;
136
137
  const full = target.replace(/\.md$/, "");
@@ -146,12 +147,12 @@ function backlinkContext(body, target, max = 240) {
146
147
  return void 0;
147
148
  }
148
149
 
149
- // packages/knowledge/src/search-policy.ts
150
+ // src/core/search-policy.ts
150
151
  function tokenizeKnowledgeText(text) {
151
152
  const words = String(text).normalize("NFKC").toLowerCase().match(/[a-z0-9][a-z0-9._+-]*|[\p{Script=Han}]+/gu) || [];
152
153
  const output = [];
153
154
  for (const word of words) {
154
- if (/\p{Script=Han}/u.test(word)) {
155
+ if (new RegExp("\\p{Script=Han}", "u").test(word)) {
155
156
  const characters = [...word];
156
157
  for (let index = 0; index < characters.length; index++) {
157
158
  const character = characters[index];
@@ -180,7 +181,10 @@ function splitKnowledgeChunks(text, maxChars = 1200) {
180
181
  return chunks;
181
182
  }
182
183
 
183
- // packages/knowledge/src/ingest-frontmatter.ts
184
+ // src/core/ingest-identity.ts
185
+ import { createHash as createHash2 } from "node:crypto";
186
+
187
+ // src/core/ingest-frontmatter.ts
184
188
  var KNOWLEDGE_TYPES = [
185
189
  "paper",
186
190
  "method",
@@ -412,7 +416,31 @@ function parseFrontmatter(text) {
412
416
  }
413
417
  }
414
418
 
415
- // packages/knowledge/src/semantic-model.ts
419
+ // src/core/note-title.ts
420
+ var clean = (value) => typeof value === "string" ? value.replace(/\s+/g, " ").trim().slice(0, 200) : "";
421
+ function looksLikeFileName(title) {
422
+ const value = String(title || "").trim();
423
+ if (!value) return true;
424
+ if (/\.(?:pdf|html?|md|txt|docx?|xlsx?|csv|json|zip|tar|gz)$/i.test(value)) return true;
425
+ if (/^(?:PMC|PMID)?\d[\d.]*$/i.test(value)) return true;
426
+ return /^[a-z0-9]+(?:[-_][a-z0-9]+){2,}$/.test(value) && /\d{4,}|[a-f0-9]{12,}/.test(value);
427
+ }
428
+ function noteDisplayTitle(text, path) {
429
+ let data = null;
430
+ try {
431
+ data = parseFrontmatter(text).data;
432
+ } catch {
433
+ data = null;
434
+ }
435
+ const topic = clean(data?.topic);
436
+ if (topic) return topic;
437
+ const title = clean(data?.title);
438
+ const heading = clean(text.match(/^#\s+(.+)$/m)?.[1]);
439
+ if (title && (!heading || looksLikeFileName(heading))) return title;
440
+ return heading || title || path.split("/").at(-1)?.replace(/\.md$/i, "") || path;
441
+ }
442
+
443
+ // src/core/semantic-model.ts
416
444
  var WIDTH = 720;
417
445
  var HEIGHT = 440;
418
446
  var LAYOUT_MARGIN = 28;
@@ -726,7 +754,7 @@ function createSemanticModel(input, options = {}) {
726
754
  return { nodes, edges: linkRelations.map(({ source, target }) => ({ source, target })), relations, duplicates, communities, layout };
727
755
  }
728
756
 
729
- // packages/knowledge/src/graph-cache.ts
757
+ // src/core/graph-cache.ts
730
758
  function createRevisionCache() {
731
759
  let activeRevision = null;
732
760
  const values = /* @__PURE__ */ new Map();
@@ -751,7 +779,40 @@ function createRevisionCache() {
751
779
  };
752
780
  }
753
781
 
754
- // packages/knowledge/src/worker.ts
782
+ // src/core/recent-by-category.ts
783
+ function noteCategory(row) {
784
+ const type = String(parseFrontmatter(row.body).data?.type || "").toLowerCase();
785
+ const value = `${type}/${row.path.toLowerCase()}`;
786
+ if (/paper|literature|文献|论文/.test(value)) return "paper";
787
+ if (/software|tool|软件/.test(value)) return "software";
788
+ if (/method|protocol|方法/.test(value)) return "method";
789
+ if (/idea|hypothes|想法|假设/.test(value)) return "idea";
790
+ return "other";
791
+ }
792
+ function recentByCategory(rows, limit = 10) {
793
+ const groups = {
794
+ paper: [],
795
+ software: [],
796
+ method: [],
797
+ idea: []
798
+ };
799
+ for (const row of rows) {
800
+ const category = noteCategory(row);
801
+ if (category === "other") continue;
802
+ groups[category].push({
803
+ path: row.path,
804
+ title: row.title,
805
+ kind: row.kind,
806
+ updatedAt: Number.parseFloat(String(row.signature).split(":", 1)[0]) || 0
807
+ });
808
+ }
809
+ const max = Math.max(1, Math.min(24, Math.floor(limit || 10)));
810
+ for (const key of Object.keys(groups))
811
+ groups[key] = groups[key].sort((left, right) => right.updatedAt - left.updatedAt || left.path.localeCompare(right.path)).slice(0, max);
812
+ return groups;
813
+ }
814
+
815
+ // src/core/worker.ts
755
816
  await mkdir(dirname(workerData.database), { recursive: true, mode: 448 });
756
817
  var db = new DatabaseSync(workerData.database, { timeout: 1500 });
757
818
  var priorSchemaVersion = Number(db.prepare("PRAGMA user_version").get().user_version ?? 0);
@@ -782,6 +843,26 @@ CREATE INDEX IF NOT EXISTS semantic_chunks_lookup ON semantic_chunks(fingerprint
782
843
  CREATE TABLE IF NOT EXISTS semantic_meta(fingerprint TEXT PRIMARY KEY, dimension INTEGER NOT NULL);
783
844
  `);
784
845
  if (priorSchemaVersion < 1) db.exec("PRAGMA user_version=1;");
846
+ if (!db.prepare("SELECT value FROM meta WHERE key='titlePolicy'").get()) {
847
+ db.exec("BEGIN IMMEDIATE");
848
+ try {
849
+ const setTitle = db.prepare("UPDATE notes SET title=? WHERE id=?");
850
+ const setSearchTitle = db.prepare("UPDATE search SET title=? WHERE rowid=?");
851
+ let refreshed = 0;
852
+ for (const row of db.prepare("SELECT id,path,title,body FROM notes").all()) {
853
+ const title = noteDisplayTitle(row.body, row.path);
854
+ if (title === row.title) continue;
855
+ setTitle.run(title, row.id);
856
+ setSearchTitle.run(tokenizeKnowledgeText(title).join(" "), row.id);
857
+ refreshed++;
858
+ }
859
+ if (refreshed) db.prepare("UPDATE meta SET value=value+1 WHERE key='revision'").run();
860
+ db.prepare("INSERT OR REPLACE INTO meta VALUES('titlePolicy',1)").run();
861
+ db.exec("COMMIT");
862
+ } catch {
863
+ db.exec("ROLLBACK");
864
+ }
865
+ }
785
866
  var semanticColumns = db.prepare("PRAGMA table_info(semantic_chunks)").all().map((column) => column.name);
786
867
  if (!semanticColumns.includes("start_char"))
787
868
  db.exec("ALTER TABLE semantic_chunks ADD COLUMN start_char INTEGER");
@@ -899,7 +980,7 @@ async function updatePath(path, force = false) {
899
980
  statements.clearProblem.run(path);
900
981
  return statements.get.get(path);
901
982
  }
902
- const title = file.text.match(/^#\s+(.+)$/m)?.[1]?.trim() || path.split("/").at(-1).slice(0, -3);
983
+ const title = noteDisplayTitle(file.text, path);
903
984
  const kind = /(?:^|\/)(?:Index|Context|Home)\.md$/i.test(path) ? "navigation" : /(?:^|\/)Wiki\//.test(path) ? "wiki" : path.startsWith("Library/Explainers/") ? "explainer" : "note";
904
985
  db.exec("BEGIN IMMEDIATE");
905
986
  try {
@@ -1104,6 +1185,7 @@ function status() {
1104
1185
  pendingChanges: dirty.size,
1105
1186
  jobs: Number(db.prepare("SELECT count(*) count FROM jobs").get().count),
1106
1187
  problems: db.prepare("SELECT * FROM problems ORDER BY path LIMIT 20").all(),
1188
+ categoryCounts: categoryCounts(),
1107
1189
  stats: { ...stats },
1108
1190
  semantic: {
1109
1191
  vectors: Number(db.prepare("SELECT count(*) count FROM semantic_chunks").get().count),
@@ -1111,6 +1193,21 @@ function status() {
1111
1193
  }
1112
1194
  };
1113
1195
  }
1196
+ function noteCategory2(row) {
1197
+ const type = String(parseFrontmatter(row.body)?.data?.type || "").toLowerCase();
1198
+ const value = `${type}/${String(row.path).toLowerCase()}`;
1199
+ if (/paper|literature|文献|论文/.test(value)) return "paper";
1200
+ if (/software|tool|软件/.test(value)) return "software";
1201
+ if (/method|protocol|方法/.test(value)) return "method";
1202
+ if (/idea|hypothes|想法|假设/.test(value)) return "idea";
1203
+ return "other";
1204
+ }
1205
+ function categoryCounts() {
1206
+ const counts = { paper: 0, software: 0, method: 0, idea: 0, other: 0 };
1207
+ for (const row of db.prepare("SELECT path,body,kind FROM notes WHERE kind IN ('note','wiki')").all())
1208
+ counts[noteCategory2(row)]++;
1209
+ return counts;
1210
+ }
1114
1211
  function semanticStatus(fingerprint = null, project = null) {
1115
1212
  if (!fingerprint) return { vectors: 0, paths: 0, coverage: "unconfigured" };
1116
1213
  const scope = project || "";
@@ -1124,6 +1221,27 @@ function pending(project, limit = 20, kind = null) {
1124
1221
  "SELECT * FROM jobs WHERE (scope='shared' OR scope=?) AND (? IS NULL OR kind=?) ORDER BY updated DESC LIMIT ?"
1125
1222
  ).all(project || "", kind, kind, limit);
1126
1223
  }
1224
+ async function recentByCategory2(project, limit = 10) {
1225
+ await flushDirty();
1226
+ const scope = project || "";
1227
+ const rows = db.prepare(
1228
+ "SELECT path,title,kind,signature,body FROM notes WHERE (scope='shared' OR scope=?) AND kind IN ('note','wiki')"
1229
+ ).all(scope);
1230
+ return recentByCategory(rows, limit);
1231
+ }
1232
+ async function recentNotes(project, limit = 8) {
1233
+ await flushDirty();
1234
+ const scope = project || "";
1235
+ const rows = db.prepare(
1236
+ "SELECT path,title,kind,signature FROM notes WHERE (scope='shared' OR scope=?) AND kind IN ('note','wiki')"
1237
+ ).all(scope);
1238
+ return rows.map((row) => ({
1239
+ path: row.path,
1240
+ title: row.title,
1241
+ kind: row.kind,
1242
+ updatedAt: Number.parseFloat(String(row.signature).split(":", 1)[0]) || 0
1243
+ })).sort((left, right) => right.updatedAt - left.updatedAt || left.path.localeCompare(right.path)).slice(0, Math.max(1, Math.min(24, Math.floor(limit || 8))));
1244
+ }
1127
1245
  async function read(path, project, options = {}) {
1128
1246
  if (!canRead(validateNote(path), project)) throw new Error("Note is outside shared/current-project scope");
1129
1247
  const row = await updatePath(path);
@@ -1467,7 +1585,7 @@ function noteIdentity(body) {
1467
1585
  async function knowledgeGraph(args) {
1468
1586
  await flushDirty();
1469
1587
  revision = Number(db.prepare("SELECT value FROM meta WHERE key='revision'").get().value);
1470
- const limit = Math.max(10, Math.min(400, Math.floor(args.limit || 200)));
1588
+ const limit = Math.max(10, Math.min(5e3, Math.floor(args.limit || 200)));
1471
1589
  const view = args.view === "all" ? "all" : "semantic";
1472
1590
  const mergeMirrors = args.mergeMirrors !== false;
1473
1591
  const cacheKey = `${view}\0${limit}\0${mergeMirrors ? "merge" : "raw"}`;
@@ -1556,7 +1674,17 @@ async function knowledgeGraph(args) {
1556
1674
  const links = model.edges.filter(({ source, target }) => keep.has(source) && keep.has(target));
1557
1675
  const relations = (model.relations || []).filter(({ source, target }) => keep.has(source) && keep.has(target));
1558
1676
  const result = {
1559
- nodes: legacyChosen.map((path) => ({ path, title: notes.get(path).title, kind: notes.get(path).kind, degree: legacyDegree.get(path) || 0 })),
1677
+ nodes: legacyChosen.map((path) => {
1678
+ const row = notes.get(path);
1679
+ const warnings = parseFrontmatter(row.body).warnings || [];
1680
+ return {
1681
+ path,
1682
+ title: row.title,
1683
+ kind: row.kind,
1684
+ degree: legacyDegree.get(path) || 0,
1685
+ ...warnings.length ? { warnings } : {}
1686
+ };
1687
+ }),
1560
1688
  edges: [...legacyEdges.values()].filter(([source, target]) => legacyKeep.has(source) && legacyKeep.has(target)).map(([source, target]) => ({ source, target })),
1561
1689
  totalNotes: notes.size,
1562
1690
  revision,
@@ -1639,6 +1767,8 @@ async function dispatch(op, args) {
1639
1767
  const items = db.prepare(`SELECT * FROM jobs WHERE ${where} ORDER BY updated DESC,key LIMIT ? OFFSET ?`).all(scope, limit, offset);
1640
1768
  return { items, total, offset, nextOffset: offset + items.length < total ? offset + items.length : null };
1641
1769
  }
1770
+ if (op === "recentNotes") return { items: await recentNotes(args.project, args.limit), revision };
1771
+ if (op === "recentByCategory") return { groups: await recentByCategory2(args.project, args.limit), revision };
1642
1772
  if (op === "jobs") return { ...status(), items: pending(args.project, 100, args.kind || null) };
1643
1773
  if (op === "completeJob") {
1644
1774
  db.prepare("DELETE FROM jobs WHERE key=? AND revision=?").run(args.key, args.revision);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gyoungwe/pi-knowledge",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Knowledge and Vault tools for native Pi hosts",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,6 +16,18 @@
16
16
  "license": "MIT",
17
17
  "type": "module",
18
18
  "main": "./dist/index.mjs",
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/host.d.ts",
22
+ "import": "./dist/index.mjs",
23
+ "default": "./dist/index.mjs"
24
+ },
25
+ "./host": {
26
+ "types": "./dist/host.d.ts",
27
+ "import": "./dist/host.mjs",
28
+ "default": "./dist/host.mjs"
29
+ }
30
+ },
19
31
  "files": [
20
32
  "dist",
21
33
  "lib",
@@ -37,12 +49,18 @@
37
49
  "build": "node scripts/build.mjs",
38
50
  "build:check": "node scripts/build.mjs --check",
39
51
  "smoke": "node scripts/smoke.mjs",
40
- "typecheck": "tsc --noEmit"
52
+ "typecheck": "tsc -p tsconfig.json --noEmit",
53
+ "test": "vitest run"
54
+ },
55
+ "dependencies": {
56
+ "@gyoungwe/plugin-api": "^1.1.0"
41
57
  },
42
58
  "peerDependencies": {
43
59
  "@earendil-works/pi-coding-agent": ">=1.1.0 <2.0.0"
44
60
  },
45
61
  "devDependencies": {
46
- "typescript": "^5.9.0"
62
+ "esbuild": "0.25.12",
63
+ "typescript": "^5.9.0",
64
+ "vitest": "^3.2.0"
47
65
  }
48
66
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "id": "drone-pi-knowledge",
4
- "version": "0.1.1",
4
+ "version": "0.2.0",
5
5
  "pi": {
6
6
  "apiVersion": 1,
7
7
  "minHostVersion": "1.1.0",
@@ -14,9 +14,31 @@
14
14
  "entrypoints": {
15
15
  "extension": "./dist/index.mjs",
16
16
  "worker": "./lib/knowledge/runtime/worker.mjs",
17
+ "host": "./dist/host.mjs",
17
18
  "skills": "./skills"
18
19
  },
19
20
  "capabilities": ["knowledge", "search", "evidence-context"],
21
+ "tools": [
22
+ "knowledge_status",
23
+ "knowledge_search",
24
+ "research_prepare_knowledge",
25
+ "research_topics",
26
+ "research_resume_topic",
27
+ "research_read_knowledge",
28
+ "research_restore_evidence",
29
+ "research_search_knowledge",
30
+ "research_check_answer",
31
+ "research_task_status",
32
+ "research_search_explainers",
33
+ "research_knowledge_status",
34
+ "research_update_topic",
35
+ "research_archive_topic",
36
+ "research_maintain_knowledge",
37
+ "research_delegate_knowledge",
38
+ "research_archive_explainer",
39
+ "research_propose_wiki_update",
40
+ "research_wiki_review_status"
41
+ ],
20
42
  "hosts": ["native-pi", "drone-desktop"],
21
43
  "permissions": {
22
44
  "filesystem": ["workspace", "configured-vault"],
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "version": 1,
3
3
  "generator": "scripts/build-pi-research.mjs",
4
- "inputsSha256": "a1e5bc1dd88de128ebb5fb1349ecb901bed403cc6e4d0b39b1e107e770949fb1",
4
+ "inputsSha256": "10115caff8c1b9fde20ec9e1a01279da226cd0959bb74971275be666441a4059",
5
5
  "outputs": {
6
- "dist/index.mjs": "59c59e8767cfcfb4398f6b0b6d3d9fb4afc13b090708b21fc68752311a099ed3"
6
+ "dist/index.mjs": "c8e65a646f2fede4f3b5a43a215e5ccec87947a7e1b0a020d434a5e4d99d3eca"
7
7
  }
8
8
  }