@feltdb/core 0.6.12 → 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 (69) 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/application.js +1 -1
  12. package/dist/cli/browser-opening.js +35 -0
  13. package/dist/cli/commands.js +50 -17
  14. package/dist/cli/index.js +1 -1
  15. package/dist/collection.js +39 -31
  16. package/dist/create/cli.js +7 -5
  17. package/dist/create/create.js +9 -7
  18. package/dist/create/development-handoff.js +4 -0
  19. package/dist/create/docker-compose-generator.js +4 -4
  20. package/dist/create/package-versions.js +1 -1
  21. package/dist/create/server-source/crates/feltdb/src/bin/feltdb_node.rs +497 -27
  22. package/dist/create/server-source/crates/feltdb/src/causal_backlog_bound.rs +452 -0
  23. package/dist/create/server-source/crates/feltdb/src/causal_dependency_barrier.rs +208 -0
  24. package/dist/create/server-source/crates/feltdb/src/convergence.rs +16 -0
  25. package/dist/create/server-source/crates/feltdb/src/dedup_bound_investigation.rs +402 -0
  26. package/dist/create/server-source/crates/feltdb/src/distributed_transactions.rs +765 -24
  27. package/dist/create/server-source/crates/feltdb/src/durable_operation_identity.rs +418 -0
  28. package/dist/create/server-source/crates/feltdb/src/lib.rs +4 -0
  29. package/dist/create/server-source/crates/feltdb/src/replica_membership.rs +661 -0
  30. package/dist/db.js +19 -13
  31. package/dist/development-runtime-bridge.js +1 -1
  32. package/dist/distributed-indexing.js +7 -5
  33. package/dist/file-db.js +8 -3
  34. package/dist/flowspec.js +2 -1
  35. package/dist/http-client.js +2 -0
  36. package/dist/http-db.js +16 -1
  37. package/dist/identity.js +1 -0
  38. package/dist/index-analytics.js +6 -7
  39. package/dist/index-backend.js +3 -3
  40. package/dist/index-dashboard.js +10 -13
  41. package/dist/index-manager.js +12 -11
  42. package/dist/index-monitoring.js +9 -4
  43. package/dist/index-store.js +2 -0
  44. package/dist/indexeddb-db.js +27 -23
  45. package/dist/memory-db.js +7 -4
  46. package/dist/observe.js +2 -0
  47. package/dist/provider.js +2 -0
  48. package/dist/query-planner.js +2 -4
  49. package/dist/reactive-graph.js +6 -8
  50. package/dist/release.js +2 -0
  51. package/dist/sharding.js +11 -6
  52. package/dist/state-contract.js +3 -3
  53. package/dist/studio-app/assets/{feltdb_wasm-CJv3wHzi.js → feltdb_wasm-C9xpYtna.js} +1 -1
  54. package/dist/studio-app/assets/feltdb_wasm_bg-BsXHw7eX.wasm +0 -0
  55. package/dist/studio-app/assets/{index-DospFFYE.js → index-D4RZ44qs.js} +4 -4
  56. package/dist/studio-app/index.html +1 -1
  57. package/dist/sync-contract.js +9 -2
  58. package/dist/telemetry.d.ts.map +1 -1
  59. package/dist/telemetry.js +32 -12
  60. package/dist/transaction.js +4 -2
  61. package/dist/wasm/feltdb_wasm_bg.wasm +0 -0
  62. package/dist/worker.js +2 -0
  63. package/dist/workload.js +2 -0
  64. package/dist/workspace/development-node.js +11 -10
  65. package/dist/workspace/investigation-lifecycle-manager.js +2 -0
  66. package/dist/workspace/investigation-supervisor.js +5 -3
  67. package/dist/workspace/workspace-connection.js +14 -5
  68. package/package.json +1 -1
  69. package/dist/studio-app/assets/feltdb_wasm_bg-C8TG8r2n.wasm +0 -0
@@ -1,3 +1,3 @@
1
- <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#17211b"/><title>FeltDB Studio</title> <script type="module" crossorigin src="/assets/index-DospFFYE.js"></script>
1
+ <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#17211b"/><title>FeltDB Studio</title> <script type="module" crossorigin src="/assets/index-D4RZ44qs.js"></script>
2
2
  <link rel="stylesheet" crossorigin href="/assets/index-C1GWyazR.css">
3
3
  </head><body><div id="root"></div></body></html>
@@ -1,7 +1,8 @@
1
1
  class StatusSignal {
2
+ value;
3
+ listeners = new Set();
2
4
  constructor(value = 'offline') {
3
5
  this.value = value;
4
- this.listeners = new Set();
5
6
  }
6
7
  subscribe(listener) { this.listeners.add(listener); listener(this.value); return () => this.listeners.delete(listener); }
7
8
  set(value) { this.value = value; for (const listener of this.listeners)
@@ -9,9 +10,15 @@ class StatusSignal {
9
10
  get() { return this.value; }
10
11
  }
11
12
  export class SyncController {
13
+ config;
14
+ status = new StatusSignal();
15
+ fetcher;
16
+ sessionId;
17
+ cursor;
18
+ error;
19
+ timer;
12
20
  constructor(config) {
13
21
  this.config = config;
14
- this.status = new StatusSignal();
15
22
  this.fetcher = config.fetcher || fetch;
16
23
  this.restore();
17
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../src/telemetry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAyBH;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,YAAY,GACZ,OAAO,GACP,OAAO,GACP,MAAM,GACN,iBAAiB,GACjB,qBAAqB,CAAC;AAE1B;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,kBAAkB,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;CACnB;AA8CD;;;GAGG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAM;IAChC,OAAO,CAAC,UAAU,CA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SAAS,CAAM;IAChC,OAAO,CAAC,UAAU,CAAwB;IAC1C,OAAO,CAAC,UAAU,CAA+B;IACjD,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,OAAO,CAA8B;gBAEjC,WAAW,GAAE,MAAgB;IAczC;;OAEG;IACH,IAAI,CAAC,SAAS,EAAE,kBAAkB,GAAG,IAAI;IA6BzC;;OAEG;YACW,KAAK;IAqBnB;;OAEG;IACH,OAAO,CAAC,aAAa;IAarB;;;OAGG;YACW,UAAU;IA6BxB;;OAEG;IACH,OAAO,CAAC,KAAK;IAkBb;;OAEG;IACH,MAAM,IAAI,IAAI;IAId;;OAEG;IACH,OAAO,IAAI,IAAI;IASf;;OAEG;IACH,SAAS,IAAI,OAAO;IAIpB;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAKlC;AAOD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,eAAe,CAKxE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,kBAAkB,GAAG,IAAI,CAEjE"}
package/dist/telemetry.js CHANGED
@@ -8,14 +8,33 @@
8
8
  const isBrowserRuntime = () => typeof window !== 'undefined' && typeof window.document !== 'undefined';
9
9
  const environmentValue = (name) => typeof process !== 'undefined' ? process.env?.[name] : undefined;
10
10
  const createUUID = () => {
11
- const browserCrypto = globalThis.crypto;
12
- if (typeof browserCrypto?.randomUUID === 'function')
13
- return browserCrypto.randomUUID();
11
+ // Try using the modern crypto.randomUUID() API first
12
+ try {
13
+ const browserCrypto = globalThis.crypto;
14
+ if (typeof browserCrypto?.randomUUID === 'function') {
15
+ return browserCrypto.randomUUID();
16
+ }
17
+ }
18
+ catch (e) {
19
+ // If randomUUID exists but throws (due to browser security restrictions or unimplemented feature),
20
+ // fall through to the fallback implementation
21
+ }
22
+ // Fallback implementation using getRandomValues or Math.random()
14
23
  const bytes = new Uint8Array(16);
24
+ const browserCrypto = globalThis.crypto;
15
25
  if (typeof browserCrypto?.getRandomValues === 'function') {
16
- browserCrypto.getRandomValues(bytes);
26
+ try {
27
+ browserCrypto.getRandomValues(bytes);
28
+ }
29
+ catch (e) {
30
+ // If getRandomValues fails, fall back to Math.random()
31
+ for (let index = 0; index < bytes.length; index += 1) {
32
+ bytes[index] = Math.floor(Math.random() * 256);
33
+ }
34
+ }
17
35
  }
18
36
  else {
37
+ // No crypto support at all - use Math.random()
19
38
  for (let index = 0; index < bytes.length; index += 1) {
20
39
  bytes[index] = Math.floor(Math.random() * 256);
21
40
  }
@@ -30,10 +49,8 @@ const createUUID = () => {
30
49
  * Generates and persists a unique, anonymous installation ID
31
50
  */
32
51
  class InstallationIdentity {
33
- constructor() {
34
- this.id = null;
35
- this.identityFile = null;
36
- }
52
+ id = null;
53
+ identityFile = null;
37
54
  /**
38
55
  * Get or create installation ID
39
56
  */
@@ -72,11 +89,14 @@ class InstallationIdentity {
72
89
  * Handles event collection and transport
73
90
  */
74
91
  export class TelemetryClient {
92
+ identity;
93
+ enabled;
94
+ batchSize = 10;
95
+ eventQueue = [];
96
+ flushTimer = null;
97
+ coreVersion;
98
+ runtime = 'node';
75
99
  constructor(coreVersion = '0.5.7') {
76
- this.batchSize = 10;
77
- this.eventQueue = [];
78
- this.flushTimer = null;
79
- this.runtime = 'node';
80
100
  this.coreVersion = coreVersion;
81
101
  this.identity = new InstallationIdentity();
82
102
  // Check if telemetry is disabled
@@ -24,6 +24,7 @@
24
24
  */
25
25
  /** Thrown when a transaction cannot be committed. Nothing was applied. */
26
26
  export class AtomicTransactionError extends Error {
27
+ transactionId;
27
28
  constructor(message, transactionId) {
28
29
  super(message);
29
30
  this.name = 'AtomicTransactionError';
@@ -36,9 +37,10 @@ function generateTransactionId() {
36
37
  }
37
38
  /** Collects operations without performing any I/O. */
38
39
  export class AtomicTransactionBuilder {
40
+ transactionId;
41
+ staged = [];
42
+ sealed = false;
39
43
  constructor(transactionId) {
40
- this.staged = [];
41
- this.sealed = false;
42
44
  this.transactionId = transactionId || generateTransactionId();
43
45
  }
44
46
  get operations() {
Binary file
package/dist/worker.js CHANGED
@@ -1,4 +1,6 @@
1
1
  class MeshTransport {
2
+ baseUrl;
3
+ fetcher;
2
4
  constructor(baseUrl = '', fetcher = fetch) {
3
5
  this.baseUrl = baseUrl;
4
6
  this.fetcher = fetcher;
package/dist/workload.js CHANGED
@@ -1,4 +1,6 @@
1
1
  export class WorkloadClient {
2
+ baseUrl;
3
+ fetcher;
2
4
  constructor(baseUrl = '', fetcher = fetch) {
3
5
  this.baseUrl = baseUrl;
4
6
  this.fetcher = fetcher;
@@ -7,17 +7,18 @@
7
7
  import { classifyWorkspaceActivity, evaluateVerification, transitionInvestigation, transitionRemediation, transitionVerification, } from './runtime-investigation.js';
8
8
  import { createDevelopmentWorkspace, isValidWorkspaceId, } from './workspace-identity.js';
9
9
  export class DevelopmentNode {
10
+ workspaces = new Map();
11
+ tasks = new Map();
12
+ codeChanges = new Map();
13
+ verificationResults = new Map();
14
+ runtimeObservations = new Map();
15
+ investigations = new Map();
16
+ remediationContracts = new Map();
17
+ workspaceActivities = new Map();
18
+ verificationAttempts = new Map();
19
+ isRunning = false;
20
+ dataDir;
10
21
  constructor(config = {}) {
11
- this.workspaces = new Map();
12
- this.tasks = new Map();
13
- this.codeChanges = new Map();
14
- this.verificationResults = new Map();
15
- this.runtimeObservations = new Map();
16
- this.investigations = new Map();
17
- this.remediationContracts = new Map();
18
- this.workspaceActivities = new Map();
19
- this.verificationAttempts = new Map();
20
- this.isRunning = false;
21
22
  this.dataDir = config.dataDir || '.feltdb';
22
23
  }
23
24
  async start() {
@@ -16,6 +16,8 @@ import path from 'node:path';
16
16
  import { createRemediationContract, evaluateVerification, transitionInvestigation, transitionRemediation, transitionVerification, } from './runtime-investigation.js';
17
17
  import { trackRemediation } from './git-identity.js';
18
18
  export class InvestigationLifecycleManager {
19
+ workspaceDir;
20
+ investigationsDir;
19
21
  constructor(workspaceDir) {
20
22
  this.workspaceDir = workspaceDir;
21
23
  this.investigationsDir = path.join(workspaceDir, '.feltdb', 'investigations');
@@ -21,9 +21,11 @@ import { captureRepositoryIdentity } from './git-identity.js';
21
21
  import { agentRemediationHandoff } from './runtime-investigation.js';
22
22
  import { connectDevelopmentWorkspace } from './workspace-connection.js';
23
23
  export class RuntimeInvestigationSupervisor {
24
+ investigations;
25
+ options;
26
+ connection = null;
27
+ seenObservations = new Set();
24
28
  constructor(options) {
25
- this.connection = null;
26
- this.seenObservations = new Set();
27
29
  this.options = options;
28
30
  this.investigations = new InvestigationLifecycleManager(options.projectDir);
29
31
  // Observations already turned into investigations must not re-open on a
@@ -64,7 +66,7 @@ export class RuntimeInvestigationSupervisor {
64
66
  * verification rather than a false VERIFIED.
65
67
  */
66
68
  async awaitObservation(criterion, options = { after: 0 }) {
67
- const deadline = Date.now() + (options.timeoutMs ?? 10000);
69
+ const deadline = Date.now() + (options.timeoutMs ?? 10_000);
68
70
  const interval = options.intervalMs ?? 100;
69
71
  while (Date.now() < deadline) {
70
72
  const match = (await this.observations()).find(observation => observation.timestamp > options.after
@@ -166,11 +166,19 @@ function generateClientId(clientType) {
166
166
  * Provides methods to publish, subscribe, and query shared state.
167
167
  */
168
168
  export class DevelopmentWorkspaceConnection {
169
+ workspaceId;
170
+ /** Canonical `feltdb dev` session identity, when supplied by pairing/session configuration. */
171
+ sessionId;
172
+ /** Canonical active runtime identity, when supplied by pairing/session configuration. */
173
+ runtimeInstanceId;
174
+ clientId;
175
+ clientType;
176
+ options;
177
+ subscriptions = new Map();
178
+ connectedAt = 0;
179
+ transport = null;
180
+ unsubscribeEvents = null;
169
181
  constructor(workspaceId, clientId, clientType, options) {
170
- this.subscriptions = new Map();
171
- this.connectedAt = 0;
172
- this.transport = null;
173
- this.unsubscribeEvents = null;
174
182
  this.workspaceId = workspaceId;
175
183
  this.sessionId = options.sessionId;
176
184
  this.runtimeInstanceId = options.runtimeInstanceId;
@@ -471,8 +479,9 @@ const ENTITY_COLLECTION = '_development_workspace_entities';
471
479
  const EVENT_COLLECTION = '_development_workspace_events';
472
480
  const CLIENT_COLLECTION = '_development_workspace_clients';
473
481
  class HttpWorkspaceTransport {
482
+ db;
483
+ seenEvents = new Set();
474
484
  constructor(endpoint, token) {
475
- this.seenEvents = new Set();
476
485
  this.db = new HttpJsDb({ url: endpoint, token });
477
486
  }
478
487
  async assertReachable() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feltdb/core",
3
- "version": "0.6.12",
3
+ "version": "0.6.14",
4
4
  "description": "FeltDB Core - Application-facing database with Browser, Local, and Server runtimes. Durable state, reactive APIs.",
5
5
  "license": "MIT",
6
6
  "type": "module",