fuli-context 0.5.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 (206) hide show
  1. package/README.en.md +2 -333
  2. package/README.md +370 -202
  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 -5
  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 +51 -28
  59. package/src/cli/local-runtime-options.js +14 -8
  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 +1 -1
  92. package/src/local-runtime/lifecycle.js +26 -15
  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.js +36 -17
  100. package/src/setup/agent-installation-status.js +2 -1
  101. package/src/setup/agents.js +2 -1
  102. package/src/setup/claude-code-config.js +2 -1
  103. package/src/setup/codex-bootstrap.js +12 -7
  104. package/src/setup/container-runtime.js +25 -21
  105. package/src/setup/graph-runtime.js +148 -56
  106. package/src/setup/node-runtime.js +3 -3
  107. package/src/setup/options.js +2 -4
  108. package/src/setup/paths.js +18 -3
  109. package/src/setup/review-skill-adapters.js +49 -0
  110. package/src/setup/setup.js +26 -2
  111. package/src/setup/uninstall.js +4 -2
  112. package/src/system/resource-monitor.js +317 -0
  113. package/src/system/runtime-settings.js +131 -0
  114. package/src/system/system-service.js +119 -0
  115. package/dist/web/assets/ConnectionsPage-CCKWm-6p.js +0 -1
  116. package/dist/web/assets/KnowledgeInspector-BZkB2wJn.js +0 -1
  117. package/dist/web/assets/KnowledgeInspector-CrGYxEob.css +0 -1
  118. package/dist/web/assets/KnowledgeOrganizerPage-CZAF_OlN.css +0 -1
  119. package/dist/web/assets/KnowledgeOrganizerPage-DlvcLwlL.js +0 -1
  120. package/dist/web/assets/KnowledgePage-CNQXd15y.js +0 -1
  121. package/dist/web/assets/KnowledgeWorkspace-CXPE4GCD.js +0 -4
  122. package/dist/web/assets/OverviewPage-ul7g7HXh.js +0 -1
  123. package/dist/web/assets/PersonalProfilePage-CC40Pw2L.js +0 -1
  124. package/dist/web/assets/PersonalProjectsPage-CPIEcShD.js +0 -1
  125. package/dist/web/assets/PublicProjectsPage-C700sR7z.js +0 -1
  126. package/dist/web/assets/ReviewPage-7MDDUDgA.js +0 -1
  127. package/dist/web/assets/console-B_Ena2DS.js +0 -5
  128. package/dist/web/assets/fuli-logo-DGuyqchQ.png +0 -0
  129. package/dist/web/assets/identity-CjBwYSMX.js +0 -1
  130. package/dist/web/assets/index-CpLDx3of.css +0 -1
  131. package/dist/web/assets/index-DAzeFJSc.js +0 -2
  132. package/dist/web/assets/model-C-5RVIJ2.js +0 -1
  133. package/dist/web/assets/paths-BkULqmGI.js +0 -1
  134. package/dist/web/assets/vue-router-DnD3hUm7.js +0 -1
  135. package/src/agent/candidate-read-service.js +0 -53
  136. package/src/agent/context-pack-service.js +0 -83
  137. package/src/agent/public-read-policy.js +0 -39
  138. package/src/agent/public-read-service.js +0 -69
  139. package/src/agent/read-projection.js +0 -107
  140. package/src/agent/search-service.js +0 -61
  141. package/src/agent/space-boundary.js +0 -33
  142. package/src/app/bootstrap.js +0 -8
  143. package/src/app/create-application.js +0 -143
  144. package/src/app/state-service.js +0 -38
  145. package/src/candidates.js +0 -78
  146. package/src/classifier.js +0 -63
  147. package/src/cli/command-arguments.js +0 -14
  148. package/src/context-pack.js +0 -206
  149. package/src/extractor.js +0 -77
  150. package/src/fact-history.js +0 -39
  151. package/src/facts/fact-service.js +0 -89
  152. package/src/http/bounded-json-array.js +0 -19
  153. package/src/http/lens-route.js +0 -50
  154. package/src/ingestion.js +0 -161
  155. package/src/lens/lens-correction-service.js +0 -81
  156. package/src/lens/lens-fact-writer.js +0 -85
  157. package/src/lens/lens-input.js +0 -62
  158. package/src/lens/lens-query-projection.js +0 -87
  159. package/src/lens/lens-query-ranking.js +0 -62
  160. package/src/lens/lens-query.js +0 -143
  161. package/src/lens/lens-resource-projection.js +0 -93
  162. package/src/lens/lens-resource-selection.js +0 -45
  163. package/src/lens/lens-resource-service.js +0 -103
  164. package/src/lens/lens-search-query.js +0 -122
  165. package/src/lens/lens-service.js +0 -183
  166. package/src/models.js +0 -44
  167. package/src/observer.js +0 -83
  168. package/src/project-rules.js +0 -33
  169. package/src/publication/outbox-service.js +0 -46
  170. package/src/publication/publication-envelope-schema.js +0 -75
  171. package/src/publication/publication-envelope.js +0 -37
  172. package/src/publication/publication-policy.js +0 -82
  173. package/src/publication/publication-service.js +0 -48
  174. package/src/router.js +0 -58
  175. package/src/runtime-options.js +0 -138
  176. package/src/security/episode-visibility.js +0 -14
  177. package/src/security/fact-visibility.js +0 -15
  178. package/src/security/source-metadata-policy.js +0 -8
  179. package/src/storage/episode-evidence-preview.js +0 -100
  180. package/src/storage/fact-search-order.js +0 -18
  181. package/src/storage/file/episode-evidence.js +0 -37
  182. package/src/storage/file/episode-index.js +0 -59
  183. package/src/storage/file/fact-search.js +0 -60
  184. package/src/storage/file-store.js +0 -437
  185. package/src/storage/migrate.js +0 -128
  186. package/src/storage/migrations/001-initial.sql +0 -83
  187. package/src/storage/migrations/002-storage-integrity.sql +0 -113
  188. package/src/storage/record-validation.js +0 -46
  189. package/src/storage/snapshot-defaults.js +0 -54
  190. package/src/storage/sqlite/candidates-repository.js +0 -84
  191. package/src/storage/sqlite/episode-evidence-repository.js +0 -154
  192. package/src/storage/sqlite/episode-privacy-sql.js +0 -33
  193. package/src/storage/sqlite/episodes-repository.js +0 -52
  194. package/src/storage/sqlite/fact-search-repository.js +0 -162
  195. package/src/storage/sqlite/facts-repository.js +0 -146
  196. package/src/storage/sqlite/imports-repository.js +0 -39
  197. package/src/storage/sqlite/mapper.js +0 -84
  198. package/src/storage/sqlite/open-database.js +0 -15
  199. package/src/storage/sqlite/outbox-repository.js +0 -103
  200. package/src/storage/sqlite/snapshot-repository.js +0 -69
  201. package/src/storage/sqlite/spaces-repository.js +0 -52
  202. package/src/storage/sqlite/subscriptions-repository.js +0 -54
  203. package/src/storage/sqlite-store.js +0 -159
  204. package/src/storage/stable-json.js +0 -24
  205. package/src/storage/store-port.js +0 -20
  206. 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';