fuli-context 0.4.0 → 0.7.2

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 (207) hide show
  1. package/README.en.md +5 -0
  2. package/README.md +411 -173
  3. package/README.zh-CN.md +448 -0
  4. package/compose.graphiti.yml +6 -6
  5. package/dist/web/assets/AboutPage-DXh7Fwxt.css +1 -0
  6. package/dist/web/assets/AboutPage-DfnZo7Lo.js +1 -0
  7. package/dist/web/assets/ConnectionsPage-BloaSKmt.js +1 -0
  8. package/dist/web/assets/ConnectionsPage-CBHAdZXT.css +1 -0
  9. package/dist/web/assets/KnowledgeInspector-Bjhdu2mf.css +1 -0
  10. package/dist/web/assets/KnowledgeInspector-QvNpv0_k.js +1 -0
  11. package/dist/web/assets/KnowledgeOrganizerPage-Cx1w1jb2.css +1 -0
  12. package/dist/web/assets/KnowledgeOrganizerPage-DKq1jVD5.js +1 -0
  13. package/dist/web/assets/KnowledgePage-BWL0jT01.js +1 -0
  14. package/dist/web/assets/KnowledgeWorkspace-Czq6aZ7b.js +4 -0
  15. package/dist/web/assets/OverviewPage-5sJoO1Gh.js +1 -0
  16. package/dist/web/assets/{PersonalProfilePage-S8ZcG2LU.css → PersonalProfilePage-CdmEzyvZ.css} +1 -1
  17. package/dist/web/assets/PersonalProfilePage-tVChM9ik.js +1 -0
  18. package/dist/web/assets/PersonalProjectsPage-BPFrup4V.js +1 -0
  19. package/dist/web/assets/PublicProjectsPage-BPJSeREN.js +1 -0
  20. package/dist/web/assets/ReviewPage-B7EN817i.js +1 -0
  21. package/dist/web/assets/SearchableSelect-ClLN0rIb.js +1 -0
  22. package/dist/web/assets/SettingsPage-C6ouU0sR.css +1 -0
  23. package/dist/web/assets/SettingsPage-Chd_B3eH.js +1 -0
  24. package/dist/web/assets/_plugin-vue_export-helper-BDNMzG2s.js +1 -0
  25. package/dist/web/assets/console-CbDsKrsO.js +1 -0
  26. package/dist/web/assets/fuli-logo-Bu9WBuQe.js +1 -0
  27. package/dist/web/assets/fuli-logo-ER1wQ8Kk.png +0 -0
  28. package/dist/web/assets/i18n-BQcns1PH.js +5 -0
  29. package/dist/web/assets/identity-B8K4VYg6.js +1 -0
  30. package/dist/web/assets/index-CB8Xmsc2.js +2 -0
  31. package/dist/web/assets/index-CZeuPh-U.css +1 -0
  32. package/dist/web/assets/model-eF52GgPF.js +1 -0
  33. package/dist/web/assets/paths-hwz-Ac1g.js +1 -0
  34. package/dist/web/assets/useMinimumLoadingDisplay-BpCyBeko.css +1 -0
  35. package/dist/web/assets/useMinimumLoadingDisplay-wCgGDmHg.js +1 -0
  36. package/dist/web/assets/vue-router-BsEp_XwI.js +1 -0
  37. package/dist/web/index.html +9 -6
  38. package/docs/external-knowledge-architecture.md +279 -0
  39. package/examples/external-knowledge/markdown-folder.mjs +235 -0
  40. package/graph-provider/fuli_graph/app.py +57 -1
  41. package/graph-provider/fuli_graph/graph_models.py +3 -0
  42. package/graph-provider/fuli_graph/graph_query.py +62 -16
  43. package/graph-provider/fuli_graph/knowledge_review.py +612 -0
  44. package/graph-provider/fuli_graph/knowledge_review_models.py +127 -0
  45. package/graph-provider/fuli_graph/knowledge_search.py +51 -4
  46. package/graph-provider/fuli_graph/models.py +19 -0
  47. package/graph-provider/fuli_graph/runtime.py +15 -0
  48. package/graph-provider/fuli_graph/store_knowledge.py +2 -1
  49. package/graph-provider/pyproject.toml +1 -1
  50. package/npm-shrinkwrap.json +5 -407
  51. package/package.json +7 -4
  52. package/skills/capturing-session-knowledge/SKILL.md +24 -4
  53. package/skills/flreview/SKILL.md +73 -0
  54. package/skills/flreview/agents/openai.yaml +6 -0
  55. package/src/agent-tools/graph-definitions.js +79 -4
  56. package/src/agent-tools/graph-handlers.js +12 -0
  57. package/src/cli/command-registry.js +3 -3
  58. package/src/cli/local-runtime-command.js +60 -23
  59. package/src/cli/local-runtime-options.js +16 -6
  60. package/src/cli/setup-agent-selection.js +12 -12
  61. package/src/cli/setup-command.js +41 -18
  62. package/src/cli/shell-argument.js +10 -0
  63. package/src/cli/uninstall-command.js +17 -15
  64. package/src/cli/update-command.js +38 -30
  65. package/src/external-knowledge/catalog.js +61 -0
  66. package/src/external-knowledge/conflict-policy.js +58 -0
  67. package/src/external-knowledge/connected-search.js +166 -0
  68. package/src/external-knowledge/connectors/custom.js +133 -0
  69. package/src/external-knowledge/connectors/feishu.js +461 -0
  70. package/src/external-knowledge/connectors/mcp.js +438 -0
  71. package/src/external-knowledge/connectors/notion.js +307 -0
  72. package/src/external-knowledge/connectors/retrieval-api.js +222 -0
  73. package/src/external-knowledge/document-mapping.js +151 -0
  74. package/src/external-knowledge/graph-projection.js +17 -0
  75. package/src/external-knowledge/index.js +8 -0
  76. package/src/external-knowledge/registry.js +91 -0
  77. package/src/external-knowledge/runtime.js +68 -0
  78. package/src/external-knowledge/safe-diagnostic.js +14 -0
  79. package/src/external-knowledge/service.js +811 -0
  80. package/src/graphiti/agent-knowledge-workflows.js +7 -2
  81. package/src/graphiti/federated-application.js +66 -41
  82. package/src/graphiti/knowledge-item-role.js +21 -0
  83. package/src/graphiti/knowledge-review.js +43 -0
  84. package/src/graphiti/project-profile-mapping.js +32 -0
  85. package/src/graphiti/provider-client.js +22 -1
  86. package/src/graphiti/source-marker.js +54 -3
  87. package/src/graphiti/task-knowledge-recall.js +250 -0
  88. package/src/http/api-router.js +23 -108
  89. package/src/http/external-knowledge-api-router.js +104 -0
  90. package/src/http/graph-api-router.js +12 -1
  91. package/src/http/request-policy.js +38 -3
  92. package/src/local-runtime/lifecycle.js +37 -16
  93. package/src/mcp/create-mcp-server.js +1 -0
  94. package/src/mcp/instructions.js +7 -7
  95. package/src/mcp/tool-annotations.js +6 -0
  96. package/src/mcp/tool-result.js +1 -0
  97. package/src/server/application-lifecycle.js +2 -11
  98. package/src/server/blocked-ports.js +11 -0
  99. package/src/server/lan-access.js +52 -0
  100. package/src/server.js +103 -25
  101. package/src/setup/agent-installation-status.js +2 -1
  102. package/src/setup/agents.js +2 -1
  103. package/src/setup/claude-code-config.js +2 -1
  104. package/src/setup/codex-bootstrap.js +12 -7
  105. package/src/setup/container-runtime.js +25 -21
  106. package/src/setup/graph-runtime.js +219 -58
  107. package/src/setup/node-runtime.js +3 -3
  108. package/src/setup/options.js +2 -4
  109. package/src/setup/paths.js +18 -3
  110. package/src/setup/review-skill-adapters.js +49 -0
  111. package/src/setup/setup.js +26 -2
  112. package/src/setup/uninstall.js +4 -2
  113. package/src/system/resource-monitor.js +317 -0
  114. package/src/system/runtime-settings.js +131 -0
  115. package/src/system/system-service.js +119 -0
  116. package/dist/web/assets/ConnectionsPage-CCKWm-6p.js +0 -1
  117. package/dist/web/assets/KnowledgeInspector-BZkB2wJn.js +0 -1
  118. package/dist/web/assets/KnowledgeInspector-CrGYxEob.css +0 -1
  119. package/dist/web/assets/KnowledgeOrganizerPage-CJCNI2Wd.css +0 -1
  120. package/dist/web/assets/KnowledgeOrganizerPage-PXH-TlGt.js +0 -1
  121. package/dist/web/assets/KnowledgePage-CNQXd15y.js +0 -1
  122. package/dist/web/assets/KnowledgeWorkspace-CXPE4GCD.js +0 -4
  123. package/dist/web/assets/OverviewPage-ul7g7HXh.js +0 -1
  124. package/dist/web/assets/PersonalProfilePage-CC40Pw2L.js +0 -1
  125. package/dist/web/assets/PersonalProjectsPage-CPIEcShD.js +0 -1
  126. package/dist/web/assets/PublicProjectsPage-C700sR7z.js +0 -1
  127. package/dist/web/assets/ReviewPage-7MDDUDgA.js +0 -1
  128. package/dist/web/assets/console-B_Ena2DS.js +0 -5
  129. package/dist/web/assets/fuli-logo-DGuyqchQ.png +0 -0
  130. package/dist/web/assets/identity-CjBwYSMX.js +0 -1
  131. package/dist/web/assets/index-BQRkOwPx.js +0 -2
  132. package/dist/web/assets/index-CpLDx3of.css +0 -1
  133. package/dist/web/assets/model-C-5RVIJ2.js +0 -1
  134. package/dist/web/assets/paths-BkULqmGI.js +0 -1
  135. package/dist/web/assets/vue-router-DnD3hUm7.js +0 -1
  136. package/src/agent/candidate-read-service.js +0 -53
  137. package/src/agent/context-pack-service.js +0 -83
  138. package/src/agent/public-read-policy.js +0 -39
  139. package/src/agent/public-read-service.js +0 -69
  140. package/src/agent/read-projection.js +0 -107
  141. package/src/agent/search-service.js +0 -61
  142. package/src/agent/space-boundary.js +0 -33
  143. package/src/app/bootstrap.js +0 -8
  144. package/src/app/create-application.js +0 -143
  145. package/src/app/state-service.js +0 -38
  146. package/src/candidates.js +0 -78
  147. package/src/classifier.js +0 -63
  148. package/src/cli/command-arguments.js +0 -14
  149. package/src/context-pack.js +0 -206
  150. package/src/extractor.js +0 -77
  151. package/src/fact-history.js +0 -39
  152. package/src/facts/fact-service.js +0 -89
  153. package/src/http/bounded-json-array.js +0 -19
  154. package/src/http/lens-route.js +0 -50
  155. package/src/ingestion.js +0 -161
  156. package/src/lens/lens-correction-service.js +0 -81
  157. package/src/lens/lens-fact-writer.js +0 -85
  158. package/src/lens/lens-input.js +0 -62
  159. package/src/lens/lens-query-projection.js +0 -87
  160. package/src/lens/lens-query-ranking.js +0 -62
  161. package/src/lens/lens-query.js +0 -143
  162. package/src/lens/lens-resource-projection.js +0 -93
  163. package/src/lens/lens-resource-selection.js +0 -45
  164. package/src/lens/lens-resource-service.js +0 -103
  165. package/src/lens/lens-search-query.js +0 -122
  166. package/src/lens/lens-service.js +0 -183
  167. package/src/models.js +0 -44
  168. package/src/observer.js +0 -83
  169. package/src/project-rules.js +0 -33
  170. package/src/publication/outbox-service.js +0 -46
  171. package/src/publication/publication-envelope-schema.js +0 -75
  172. package/src/publication/publication-envelope.js +0 -37
  173. package/src/publication/publication-policy.js +0 -82
  174. package/src/publication/publication-service.js +0 -48
  175. package/src/router.js +0 -58
  176. package/src/runtime-options.js +0 -138
  177. package/src/security/episode-visibility.js +0 -14
  178. package/src/security/fact-visibility.js +0 -15
  179. package/src/security/source-metadata-policy.js +0 -8
  180. package/src/storage/episode-evidence-preview.js +0 -100
  181. package/src/storage/fact-search-order.js +0 -18
  182. package/src/storage/file/episode-evidence.js +0 -37
  183. package/src/storage/file/episode-index.js +0 -59
  184. package/src/storage/file/fact-search.js +0 -60
  185. package/src/storage/file-store.js +0 -437
  186. package/src/storage/migrate.js +0 -128
  187. package/src/storage/migrations/001-initial.sql +0 -83
  188. package/src/storage/migrations/002-storage-integrity.sql +0 -113
  189. package/src/storage/record-validation.js +0 -46
  190. package/src/storage/snapshot-defaults.js +0 -54
  191. package/src/storage/sqlite/candidates-repository.js +0 -84
  192. package/src/storage/sqlite/episode-evidence-repository.js +0 -154
  193. package/src/storage/sqlite/episode-privacy-sql.js +0 -33
  194. package/src/storage/sqlite/episodes-repository.js +0 -52
  195. package/src/storage/sqlite/fact-search-repository.js +0 -162
  196. package/src/storage/sqlite/facts-repository.js +0 -146
  197. package/src/storage/sqlite/imports-repository.js +0 -39
  198. package/src/storage/sqlite/mapper.js +0 -84
  199. package/src/storage/sqlite/open-database.js +0 -15
  200. package/src/storage/sqlite/outbox-repository.js +0 -103
  201. package/src/storage/sqlite/snapshot-repository.js +0 -69
  202. package/src/storage/sqlite/spaces-repository.js +0 -52
  203. package/src/storage/sqlite/subscriptions-repository.js +0 -54
  204. package/src/storage/sqlite-store.js +0 -159
  205. package/src/storage/stable-json.js +0 -24
  206. package/src/storage/store-port.js +0 -20
  207. package/src/store.js +0 -2
@@ -1,159 +0,0 @@
1
- import { configureDatabase, runMigrations } from './migrate.js';
2
- import { CandidatesRepository } from './sqlite/candidates-repository.js';
3
- import { EpisodeEvidenceRepository } from './sqlite/episode-evidence-repository.js';
4
- import { registerEpisodePrivacyFunction } from './sqlite/episode-privacy-sql.js';
5
- import { EpisodesRepository } from './sqlite/episodes-repository.js';
6
- import { FactsRepository } from './sqlite/facts-repository.js';
7
- import { ImportsRepository } from './sqlite/imports-repository.js';
8
- import { OutboxRepository } from './sqlite/outbox-repository.js';
9
- import { openDatabase } from './sqlite/open-database.js';
10
- import { SnapshotRepository } from './sqlite/snapshot-repository.js';
11
- import { SpacesRepository } from './sqlite/spaces-repository.js';
12
- import { SubscriptionsRepository } from './sqlite/subscriptions-repository.js';
13
-
14
- export class SqliteStore {
15
- #db;
16
- #repositories;
17
- #schemaVersionsStatement;
18
- #transactionActive = false;
19
-
20
- constructor(filePath = '.fuli/context.db') {
21
- this.#db = openDatabase(filePath);
22
- try {
23
- configureDatabase(this.#db, filePath);
24
- runMigrations(this.#db);
25
- this.#repositories = createRepositories(this.#db);
26
- this.#schemaVersionsStatement = this.#db.prepare(`
27
- SELECT version FROM schema_migrations ORDER BY version
28
- `);
29
- } catch (error) {
30
- this.#db.close();
31
- throw error;
32
- }
33
- }
34
-
35
- transaction(fn, { mode = 'default' } = {}) {
36
- if (this.#transactionActive) {
37
- throw new TypeError('Nested SqliteStore transactions are not supported');
38
- }
39
- if (fn.constructor?.name === 'AsyncFunction') {
40
- throw new TypeError('Transaction callback must be synchronous');
41
- }
42
-
43
- this.#transactionActive = true;
44
- try {
45
- const transaction = this.#db.transaction(() => {
46
- const result = fn(this);
47
- if (isThenable(result)) {
48
- if (typeof result.catch === 'function') result.catch(() => {});
49
- throw new TypeError('Transaction callback must be synchronous');
50
- }
51
- return result;
52
- });
53
- const run = mode === 'immediate' ? transaction.immediate : transaction;
54
- if (typeof run !== 'function') throw new TypeError(`Unsupported transaction mode: ${mode}`);
55
- return run();
56
- } finally {
57
- this.#transactionActive = false;
58
- }
59
- }
60
-
61
- createSpace(name, kind, description = null) {
62
- return this.#repositories.spaces.create(name, kind, description);
63
- }
64
-
65
- listSpaces() { return this.#repositories.spaces.list(); }
66
- findSpaceByName(name) { return this.#repositories.spaces.findByName(name); }
67
- getSpace(id) { return this.#repositories.spaces.get(id); }
68
-
69
- subscribe(personalSpaceId, spaceId, mode = 'latest') {
70
- return this.#repositories.subscriptions.subscribe(personalSpaceId, spaceId, mode);
71
- }
72
-
73
- listSubscriptions() { return this.#repositories.subscriptions.list(); }
74
- subscriptionsFor(personalSpaceId) {
75
- return this.#repositories.subscriptions.forPersonalSpace(personalSpaceId);
76
- }
77
-
78
- addEpisode(spaceId, sourceKind, body, sourceUri = null, metadata = {}) {
79
- return this.#repositories.episodes.add(spaceId, sourceKind, body, sourceUri, metadata);
80
- }
81
-
82
- getEpisode(id) { return this.#repositories.episodes.get(id); }
83
- listEpisodes() { return this.#repositories.episodes.list(); }
84
- episodeEvidencePreview(spaceId, episodeId, options = {}) {
85
- return this.#repositories.episodeEvidence.source(spaceId, episodeId, options);
86
- }
87
- correctionEpisodeEvidencePreviews(spaceId, factIds, options = {}) {
88
- return this.#repositories.episodeEvidence.corrections(spaceId, factIds, options);
89
- }
90
- addFact(fact) { return this.#repositories.facts.add(fact); }
91
- getFact(id) { return this.#repositories.facts.get(id); }
92
- updateFact(id, updates) { return this.#repositories.facts.update(id, updates); }
93
- invalidateFact(id, replacedByFactId = null) {
94
- return this.#repositories.facts.invalidate(id, replacedByFactId);
95
- }
96
-
97
- currentFacts(spaceId) { return this.#repositories.facts.current(spaceId); }
98
- listFacts(options = {}) { return this.#repositories.facts.list(options); }
99
- timeline(spaceId, subject) { return this.#repositories.facts.timeline(spaceId, subject); }
100
- searchFacts(spaceIds, query, options = {}) {
101
- return this.#repositories.facts.search(spaceIds, query, options);
102
- }
103
- searchFactsPage(spaceIds, query, options = {}) {
104
- return this.#repositories.facts.searchPage(spaceIds, query, options);
105
- }
106
-
107
- addCandidate(candidate) { return this.#repositories.candidates.add(candidate); }
108
- getCandidate(id) { return this.#repositories.candidates.get(id); }
109
- listCandidates() { return this.#repositories.candidates.list(); }
110
- pendingCandidates(personalSpaceId) {
111
- return this.#repositories.candidates.pending(personalSpaceId);
112
- }
113
-
114
- updateCandidateStatus(id, status) {
115
- return this.#repositories.candidates.updateStatus(id, status);
116
- }
117
-
118
- enqueueOutbox(entry) { return this.#repositories.outbox.enqueue(entry); }
119
- listPendingOutbox(at) { return this.#repositories.outbox.listPending(at); }
120
- markOutboxSent(id, sentAt) { return this.#repositories.outbox.markSent(id, sentAt); }
121
- markOutboxFailed(id, error, nextAttemptAt = null) {
122
- return this.#repositories.outbox.markFailed(id, error, nextAttemptAt);
123
- }
124
-
125
- hasImport(contentHash) { return this.#repositories.imports.has(contentHash); }
126
- recordImport(record) { return this.#repositories.imports.record(record); }
127
- exportSnapshot() { return this.#repositories.snapshot.export(); }
128
- importSnapshot(snapshot) { return this.#repositories.snapshot.import(snapshot); }
129
-
130
- schemaVersions() {
131
- return this.#schemaVersionsStatement.pluck().all();
132
- }
133
-
134
- close() {
135
- if (this.#db.open) this.#db.close();
136
- }
137
- }
138
-
139
- function createRepositories(db) {
140
- registerEpisodePrivacyFunction(db);
141
- const repositories = {
142
- spaces: new SpacesRepository(db),
143
- subscriptions: new SubscriptionsRepository(db),
144
- episodes: new EpisodesRepository(db),
145
- episodeEvidence: new EpisodeEvidenceRepository(db),
146
- facts: new FactsRepository(db),
147
- candidates: new CandidatesRepository(db),
148
- outbox: new OutboxRepository(db),
149
- imports: new ImportsRepository(db)
150
- };
151
- repositories.snapshot = new SnapshotRepository(db, repositories);
152
- return repositories;
153
- }
154
-
155
- function isThenable(value) {
156
- return value !== null &&
157
- (typeof value === 'object' || typeof value === 'function') &&
158
- typeof value.then === 'function';
159
- }
@@ -1,24 +0,0 @@
1
- export function stableJson(value) {
2
- return JSON.stringify(sortJsonValue(value));
3
- }
4
-
5
- function sortJsonValue(value) {
6
- if (value === null || typeof value === 'string' || typeof value === 'boolean') return value;
7
- if (typeof value === 'number') {
8
- if (Number.isFinite(value)) return value;
9
- throw new TypeError('Snapshot must contain only finite JSON numbers');
10
- }
11
- if (Array.isArray(value)) return value.map(sortJsonValue);
12
- if (isPlainObject(value)) {
13
- return Object.fromEntries(
14
- Object.keys(value).sort().map((key) => [key, sortJsonValue(value[key])])
15
- );
16
- }
17
- throw new TypeError('Snapshot must contain only JSON values');
18
- }
19
-
20
- function isPlainObject(value) {
21
- if (!value || typeof value !== 'object') return false;
22
- const prototype = Object.getPrototypeOf(value);
23
- return prototype === Object.prototype || prototype === null;
24
- }
@@ -1,20 +0,0 @@
1
- export const STORE_METHODS = Object.freeze([
2
- 'transaction',
3
- 'createSpace', 'listSpaces', 'findSpaceByName', 'getSpace',
4
- 'subscribe', 'listSubscriptions', 'subscriptionsFor',
5
- 'addEpisode', 'getEpisode', 'listEpisodes',
6
- 'episodeEvidencePreview', 'correctionEpisodeEvidencePreviews',
7
- 'addFact', 'getFact', 'updateFact', 'invalidateFact',
8
- 'currentFacts', 'listFacts', 'timeline', 'searchFacts', 'searchFactsPage',
9
- 'addCandidate', 'getCandidate', 'listCandidates',
10
- 'pendingCandidates', 'updateCandidateStatus',
11
- 'enqueueOutbox', 'listPendingOutbox', 'markOutboxSent', 'markOutboxFailed',
12
- 'hasImport', 'recordImport',
13
- 'exportSnapshot', 'importSnapshot', 'close'
14
- ]);
15
-
16
- export function assertStorePort(store) {
17
- const missing = STORE_METHODS.filter((name) => typeof store?.[name] !== 'function');
18
- if (missing.length) throw new TypeError(`Store Port missing: ${missing.join(', ')}`);
19
- return store;
20
- }
package/src/store.js DELETED
@@ -1,2 +0,0 @@
1
- export { FileStore } from './storage/file-store.js';
2
- export { SqliteStore } from './storage/sqlite-store.js';