@feltdb/core 0.6.13 → 0.6.14

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 (63) hide show
  1. package/dist/agent-registry.js +1 -3
  2. package/dist/agent-runtime.js +8 -7
  3. package/dist/analytics-backend.js +3 -1
  4. package/dist/application-contract.js +1 -0
  5. package/dist/application-manifest.js +1 -0
  6. package/dist/artifact.js +2 -0
  7. package/dist/authorization.js +2 -0
  8. package/dist/bundle.js +2 -0
  9. package/dist/capability.js +1 -3
  10. package/dist/cell.js +9 -4
  11. package/dist/cli/commands.js +26 -2
  12. package/dist/cli/index.js +1 -1
  13. package/dist/collection.js +39 -31
  14. package/dist/create/package-versions.js +1 -1
  15. package/dist/create/server-source/crates/feltdb/src/bin/feltdb_node.rs +497 -27
  16. package/dist/create/server-source/crates/feltdb/src/causal_backlog_bound.rs +452 -0
  17. package/dist/create/server-source/crates/feltdb/src/causal_dependency_barrier.rs +208 -0
  18. package/dist/create/server-source/crates/feltdb/src/convergence.rs +16 -0
  19. package/dist/create/server-source/crates/feltdb/src/dedup_bound_investigation.rs +402 -0
  20. package/dist/create/server-source/crates/feltdb/src/distributed_transactions.rs +765 -24
  21. package/dist/create/server-source/crates/feltdb/src/durable_operation_identity.rs +418 -0
  22. package/dist/create/server-source/crates/feltdb/src/lib.rs +4 -0
  23. package/dist/create/server-source/crates/feltdb/src/replica_membership.rs +661 -0
  24. package/dist/db.js +19 -13
  25. package/dist/development-runtime-bridge.js +1 -1
  26. package/dist/distributed-indexing.js +7 -5
  27. package/dist/file-db.js +8 -3
  28. package/dist/flowspec.js +2 -1
  29. package/dist/http-client.js +2 -0
  30. package/dist/http-db.js +16 -1
  31. package/dist/identity.js +1 -0
  32. package/dist/index-analytics.js +6 -7
  33. package/dist/index-backend.js +3 -3
  34. package/dist/index-dashboard.js +10 -13
  35. package/dist/index-manager.js +12 -11
  36. package/dist/index-monitoring.js +9 -4
  37. package/dist/index-store.js +2 -0
  38. package/dist/indexeddb-db.js +27 -23
  39. package/dist/memory-db.js +7 -4
  40. package/dist/observe.js +2 -0
  41. package/dist/provider.js +2 -0
  42. package/dist/query-planner.js +2 -4
  43. package/dist/reactive-graph.js +6 -8
  44. package/dist/release.js +2 -0
  45. package/dist/sharding.js +11 -6
  46. package/dist/state-contract.js +3 -3
  47. package/dist/studio-app/assets/{feltdb_wasm-CJv3wHzi.js → feltdb_wasm-C9xpYtna.js} +1 -1
  48. package/dist/studio-app/assets/feltdb_wasm_bg-BsXHw7eX.wasm +0 -0
  49. package/dist/studio-app/assets/{index-DospFFYE.js → index-D4RZ44qs.js} +4 -4
  50. package/dist/studio-app/index.html +1 -1
  51. package/dist/sync-contract.js +9 -2
  52. package/dist/telemetry.d.ts.map +1 -1
  53. package/dist/telemetry.js +32 -12
  54. package/dist/transaction.js +4 -2
  55. package/dist/wasm/feltdb_wasm_bg.wasm +0 -0
  56. package/dist/worker.js +2 -0
  57. package/dist/workload.js +2 -0
  58. package/dist/workspace/development-node.js +11 -10
  59. package/dist/workspace/investigation-lifecycle-manager.js +2 -0
  60. package/dist/workspace/investigation-supervisor.js +5 -3
  61. package/dist/workspace/workspace-connection.js +14 -5
  62. package/package.json +1 -1
  63. package/dist/studio-app/assets/feltdb_wasm_bg-C8TG8r2n.wasm +0 -0
@@ -8,9 +8,7 @@
8
8
  * Registry for agent definitions and discovery
9
9
  */
10
10
  export class AgentRegistry {
11
- constructor() {
12
- this.agents = new Map();
13
- }
11
+ agents = new Map();
14
12
  /**
15
13
  * Register an agent definition
16
14
  */
@@ -9,10 +9,8 @@ import { AgentExecutionStatus, generateExecutionId } from './agent.js';
9
9
  * Agent ownership manager for distributed execution
10
10
  */
11
11
  export class AgentOwnershipManager {
12
- constructor() {
13
- this.ownership = new Map(); // executionId -> peerId
14
- this.locks = new Map();
15
- }
12
+ ownership = new Map(); // executionId -> peerId
13
+ locks = new Map();
16
14
  /**
17
15
  * Claim ownership of an execution
18
16
  */
@@ -86,10 +84,13 @@ export class AgentOwnershipManager {
86
84
  * Manages agent lifecycle and execution across the distributed fabric.
87
85
  */
88
86
  export class AgentRuntime {
87
+ config;
88
+ registry;
89
+ handlers = new Map();
90
+ executions = new Map();
91
+ ownership;
92
+ triggers = new Map();
89
93
  constructor(registry, config) {
90
- this.handlers = new Map();
91
- this.executions = new Map();
92
- this.triggers = new Map();
93
94
  this.registry = registry;
94
95
  this.config = config;
95
96
  this.ownership = new AgentOwnershipManager();
@@ -10,8 +10,9 @@ import { IndexAnalytics as TypeScriptIndexAnalytics } from './index-analytics.js
10
10
  * Analytics backend selector with dynamic WASM loading
11
11
  */
12
12
  export class AnalyticsBackend {
13
+ backend;
14
+ wasmLoaded = false;
13
15
  constructor() {
14
- this.wasmLoaded = false;
15
16
  // Start with TypeScript backend, attempt WASM load async
16
17
  // Create a wrapper that implements the interface
17
18
  const tsBackend = new TypeScriptIndexAnalytics();
@@ -76,6 +77,7 @@ export class AnalyticsBackend {
76
77
  * Adapter to bridge WASM analytics to TypeScript interface
77
78
  */
78
79
  class WasmAnalyticsAdapter {
80
+ wasm;
79
81
  constructor(wasm) {
80
82
  this.wasm = wasm;
81
83
  }
@@ -1,4 +1,5 @@
1
1
  export class ApplicationContractClient {
2
+ request;
2
3
  constructor(request) {
3
4
  this.request = request;
4
5
  }
@@ -1,4 +1,5 @@
1
1
  export class ApplicationManifestClient {
2
+ baseUrl;
2
3
  constructor(baseUrl = '') {
3
4
  this.baseUrl = baseUrl;
4
5
  }
package/dist/artifact.js CHANGED
@@ -1,4 +1,6 @@
1
1
  export class ArtifactClient {
2
+ baseUrl;
3
+ fetcher;
2
4
  constructor(baseUrl = '', fetcher = fetch) {
3
5
  this.baseUrl = baseUrl;
4
6
  this.fetcher = fetcher;
@@ -1,4 +1,6 @@
1
1
  export class AuthorizationClient {
2
+ baseUrl;
3
+ fetcher;
2
4
  constructor(baseUrl = '', fetcher = fetch) {
3
5
  this.baseUrl = baseUrl;
4
6
  this.fetcher = fetcher;
package/dist/bundle.js CHANGED
@@ -1,4 +1,6 @@
1
1
  export class BundleClient {
2
+ baseUrl;
3
+ fetcher;
2
4
  constructor(baseUrl = '', fetcher = fetch) {
3
5
  this.baseUrl = baseUrl;
4
6
  this.fetcher = fetcher;
@@ -4,9 +4,7 @@
4
4
  * Capabilities are distributed, pluggable features like search, vector embeddings, etc.
5
5
  */
6
6
  export class CapabilityRegistry {
7
- constructor() {
8
- this.capabilities = new Map();
9
- }
7
+ capabilities = new Map();
10
8
  register(capability) {
11
9
  this.capabilities.set(capability.id, capability);
12
10
  }
package/dist/cell.js CHANGED
@@ -16,11 +16,16 @@ export const AUTHORITY_CONFLICT = Symbol('FELTDB_AUTHORITY_CONFLICT');
16
16
  * A replica is read-only: replication transfers knowledge, not authority.
17
17
  */
18
18
  export class CellImpl {
19
+ id;
20
+ jsDb;
21
+ cellCollection;
22
+ replicaCollection;
23
+ failureObservationCollection;
24
+ mutationQueue = [];
25
+ isLocked = false;
26
+ changeHandlers = [];
27
+ isReplica = false;
19
28
  constructor(jsDb, cellId) {
20
- this.mutationQueue = [];
21
- this.isLocked = false;
22
- this.changeHandlers = [];
23
- this.isReplica = false;
24
29
  this.id = cellId;
25
30
  this.jsDb = jsDb;
26
31
  this.cellCollection = new Collection(jsDb, '_cells', undefined, undefined, false);
@@ -719,7 +719,14 @@ async function handleDev(args) {
719
719
  throw error;
720
720
  }
721
721
  let stopping = null;
722
+ // The development session runs until something stops it — a signal, a managed
723
+ // application exiting, or a failure. Its lifetime belongs to this command, so
724
+ // it is represented explicitly rather than borrowed from whichever service
725
+ // happens to be long-running.
726
+ let releaseSession = () => { };
727
+ const sessionStopped = new Promise(resolve => { releaseSession = resolve; });
722
728
  const stopAll = () => stopping ?? (stopping = (async () => {
729
+ releaseSession();
723
730
  if (developmentSession && developmentSession.state !== 'STOPPING' && developmentSession.state !== 'STOPPED') {
724
731
  transitionDevelopmentSession(developmentSession, 'STOPPING');
725
732
  }
@@ -830,13 +837,30 @@ async function handleDev(args) {
830
837
  }
831
838
  transitionDevelopmentSession(developmentSession, 'RUNNING');
832
839
  });
840
+ // Studio is one service in the session, not the session itself.
841
+ // `handleStudio` returns immediately when Studio's static assets are absent,
842
+ // and awaiting it as the session's lifetime meant a missing optional
843
+ // artifact tore down the authority, the pairing discovery server, and the
844
+ // workspace transport: the process printed "workspace is ready" and then
845
+ // exited, so anything reaching for the discovery endpoint afterwards got a
846
+ // connection failure. The session now outlives Studio either way.
847
+ void studio.then(() => {
848
+ if (!developmentSession || developmentSession.state === 'RUNNING')
849
+ return;
850
+ console.log('\u26a0\ufe0f Studio is unavailable for this session. The authority, pairing discovery, and workspace transport are unaffected.');
851
+ transitionDevelopmentSession(developmentSession, 'READY');
852
+ console.log(`\n${developmentSessionSummary(developmentSession)}\n`);
853
+ transitionDevelopmentSession(developmentSession, 'RUNNING');
854
+ }).catch(error => {
855
+ console.error(`Studio failed: ${error instanceof Error ? error.message : String(error)}`);
856
+ });
833
857
  if (managedApplication) {
834
- await Promise.race([studio, managedApplication.exited.then(exit => {
858
+ await Promise.race([sessionStopped, managedApplication.exited.then(exit => {
835
859
  throw new Error(`Managed application stopped during the development session (command: ${managedApplication.command}; exit: ${exit.code ?? exit.signal})`);
836
860
  })]);
837
861
  }
838
862
  else
839
- await studio;
863
+ await sessionStopped;
840
864
  }
841
865
  finally {
842
866
  await stopAll();
package/dist/cli/index.js CHANGED
@@ -23,7 +23,7 @@ import * as path from 'path';
23
23
  import * as readline from 'readline';
24
24
  import { getClient } from './api-client.js';
25
25
  import { loadFeltDBConfig, createDefaultConfig, validateModel, } from './config.js';
26
- const VERSION = '0.6.13';
26
+ const VERSION = '0.6.14';
27
27
  function prompt(question) {
28
28
  const rl = readline.createInterface({
29
29
  input: process.stdin,
@@ -18,38 +18,42 @@ import { IndexStore } from './index-store.js';
18
18
  * Uses reactive dependency graph instead of polling for efficient updates.
19
19
  */
20
20
  export class Collection {
21
+ db;
22
+ name;
23
+ collectionId; // Unique ID for this collection instance
24
+ predicate = null;
25
+ cache = [];
26
+ subscribers = new Set();
27
+ parent = null;
28
+ parentId = null;
29
+ isInitialized = false;
30
+ unsubscribeFunctions = new Set();
31
+ graphUnsubscribe = null;
32
+ runtimeUnsubscribe = null;
33
+ indexBackend = new IndexBackend();
34
+ indexStore;
35
+ indexesLoaded = false;
36
+ /** Incremented whenever `cache` is replaced, so the index can tell it is stale. */
37
+ cacheGeneration = 0;
38
+ /** The cache generation the index entries currently reflect, or -1 for none. */
39
+ indexedGeneration = -1;
40
+ lastPlan = null;
41
+ /** Cache records addressed by id, valid for `indexedGeneration`. */
42
+ recordsById = null;
43
+ /** Raw payload the cache was parsed from, used to detect that nothing changed. */
44
+ lastRawSnapshot = null;
45
+ /**
46
+ * The runtime revision the cache was built from, when the runtime offers one.
47
+ *
48
+ * Captured *before* the query that produced the cache, never after. A write
49
+ * landing between the two then makes this older than the data it labels,
50
+ * which costs one unnecessary refresh. Capturing it after would make it
51
+ * newer than the data, and the cache would look current forever.
52
+ */
53
+ cachedRevision = null;
54
+ /** How the last refresh decided the cache was usable. Reporting only. */
55
+ lastFreshness = null;
21
56
  constructor(db, name, predicate, parent, loadIndexes = true) {
22
- this.predicate = null;
23
- this.cache = [];
24
- this.subscribers = new Set();
25
- this.parent = null;
26
- this.parentId = null;
27
- this.isInitialized = false;
28
- this.unsubscribeFunctions = new Set();
29
- this.graphUnsubscribe = null;
30
- this.runtimeUnsubscribe = null;
31
- this.indexBackend = new IndexBackend();
32
- this.indexesLoaded = false;
33
- /** Incremented whenever `cache` is replaced, so the index can tell it is stale. */
34
- this.cacheGeneration = 0;
35
- /** The cache generation the index entries currently reflect, or -1 for none. */
36
- this.indexedGeneration = -1;
37
- this.lastPlan = null;
38
- /** Cache records addressed by id, valid for `indexedGeneration`. */
39
- this.recordsById = null;
40
- /** Raw payload the cache was parsed from, used to detect that nothing changed. */
41
- this.lastRawSnapshot = null;
42
- /**
43
- * The runtime revision the cache was built from, when the runtime offers one.
44
- *
45
- * Captured *before* the query that produced the cache, never after. A write
46
- * landing between the two then makes this older than the data it labels,
47
- * which costs one unnecessary refresh. Capturing it after would make it
48
- * newer than the data, and the cache would look current forever.
49
- */
50
- this.cachedRevision = null;
51
- /** How the last refresh decided the cache was usable. Reporting only. */
52
- this.lastFreshness = null;
53
57
  this.db = db;
54
58
  this.name = name;
55
59
  this.collectionId = `${name}-${Math.random().toString(36).substr(2, 9)}`;
@@ -690,6 +694,10 @@ export class Collection {
690
694
  * Relationship helper for loading related data.
691
695
  */
692
696
  export class Relationship {
697
+ parentDb;
698
+ childDb;
699
+ childCollection;
700
+ foreignKey;
693
701
  constructor(parentDb, childDb, childCollection, foreignKey) {
694
702
  this.parentDb = parentDb;
695
703
  this.childDb = childDb;
@@ -1,4 +1,4 @@
1
1
  // One release train keeps generated applications installable. The repository
2
2
  // validation script checks these values against every workspace manifest.
3
- export const FELTDB_PACKAGE_VERSION = '0.6.13';
3
+ export const FELTDB_PACKAGE_VERSION = '0.6.14';
4
4
  export const feltdbPackageRange = `^${FELTDB_PACKAGE_VERSION}`;