@feltdb/core 0.13.0 → 0.15.0

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 (92) hide show
  1. package/dist/agent-runtime.d.ts +64 -2
  2. package/dist/agent-runtime.d.ts.map +1 -1
  3. package/dist/agent-runtime.js +121 -11
  4. package/dist/agent-state.d.ts +48 -0
  5. package/dist/agent-state.d.ts.map +1 -1
  6. package/dist/agent-state.js +174 -12
  7. package/dist/agent.d.ts +10 -1
  8. package/dist/agent.d.ts.map +1 -1
  9. package/dist/agent.js +10 -1
  10. package/dist/build-identity.json +4 -4
  11. package/dist/cli/commands.js +27 -6
  12. package/dist/collection.d.ts +3 -1
  13. package/dist/collection.d.ts.map +1 -1
  14. package/dist/collection.js +30 -8
  15. package/dist/create/build-identity.json +4 -4
  16. package/dist/create/cli.js +1 -1
  17. package/dist/create/create.js +4 -6
  18. package/dist/create/package-versions.js +1 -1
  19. package/dist/create/server-source/Cargo.lock +6 -6
  20. package/dist/create/server-source/Cargo.toml +1 -1
  21. package/dist/create/server-source/crates/feltdb/src/lib.rs +126 -35
  22. package/dist/create/server-source/crates/feltdb/src/state_contract.rs +162 -53
  23. package/dist/create/server-source/crates/feltdb/src/worker_mesh.rs +137 -1
  24. package/dist/create/server-source/crates/feltdb/src/workload.rs +1427 -91
  25. package/dist/create/server-source/crates/feltdb-client/Cargo.toml +1 -1
  26. package/dist/create/server-source/crates/feltdb-server/Cargo.toml +1 -1
  27. package/dist/create/server-source/crates/feltdb-server/README.md +6 -1
  28. package/dist/create/server-source/crates/feltdb-server/src/app_state.rs +9 -1
  29. package/dist/create/server-source/crates/feltdb-server/src/auth.rs +85 -25
  30. package/dist/create/server-source/crates/feltdb-server/src/backup.rs +4 -0
  31. package/dist/create/server-source/crates/feltdb-server/src/console_accounts.rs +1009 -0
  32. package/dist/create/server-source/crates/feltdb-server/src/control_authorization.rs +441 -0
  33. package/dist/create/server-source/crates/feltdb-server/src/identity.rs +68 -6
  34. package/dist/create/server-source/crates/feltdb-server/src/key_management.rs +355 -23
  35. package/dist/create/server-source/crates/feltdb-server/src/lib.rs +3 -0
  36. package/dist/create/server-source/crates/feltdb-server/src/main.rs +879 -84
  37. package/dist/create/server-source/crates/feltdb-server/src/redaction.rs +208 -0
  38. package/dist/create/server-source/crates/feltdb-server/src/tenancy.rs +198 -19
  39. package/dist/create/server-source/crates/feltdb-server/tests/transaction_precondition_contract.rs +403 -0
  40. package/dist/db.d.ts +64 -9
  41. package/dist/db.d.ts.map +1 -1
  42. package/dist/db.js +153 -27
  43. package/dist/deployment.d.ts +19 -0
  44. package/dist/deployment.d.ts.map +1 -1
  45. package/dist/deployment.js +38 -2
  46. package/dist/embedded-query.d.ts.map +1 -1
  47. package/dist/embedded-query.js +5 -4
  48. package/dist/embedded-transaction.d.ts +8 -4
  49. package/dist/embedded-transaction.d.ts.map +1 -1
  50. package/dist/embedded-transaction.js +55 -19
  51. package/dist/error-codes.d.ts +31 -2
  52. package/dist/error-codes.d.ts.map +1 -1
  53. package/dist/error-codes.js +41 -2
  54. package/dist/feltdb.d.ts +7 -0
  55. package/dist/feltdb.d.ts.map +1 -1
  56. package/dist/file-db.d.ts +27 -0
  57. package/dist/file-db.d.ts.map +1 -1
  58. package/dist/file-db.js +145 -7
  59. package/dist/http-client.d.ts +11 -3
  60. package/dist/http-client.d.ts.map +1 -1
  61. package/dist/http-client.js +27 -14
  62. package/dist/http-db.d.ts +27 -1
  63. package/dist/http-db.d.ts.map +1 -1
  64. package/dist/http-db.js +252 -54
  65. package/dist/index.js +1 -1
  66. package/dist/local-state-lock.d.ts +34 -0
  67. package/dist/local-state-lock.d.ts.map +1 -0
  68. package/dist/local-state-lock.js +225 -0
  69. package/dist/reactive-graph.d.ts +0 -3
  70. package/dist/reactive-graph.d.ts.map +1 -1
  71. package/dist/reactive-graph.js +11 -1
  72. package/dist/runtime-registry.d.ts +7 -2
  73. package/dist/runtime-registry.d.ts.map +1 -1
  74. package/dist/runtime-registry.js +2 -2
  75. package/dist/studio/components/index.js +1 -1
  76. package/dist/studio/{components-BSGmHfif.js → components-CJmzntBi.js} +2 -1
  77. package/dist/studio/index.js +1 -1
  78. package/dist/studio-app/assets/{feltdb_wasm-3hDngl1h.js → feltdb_wasm-BjM1ylL3.js} +1 -1
  79. package/dist/studio-app/assets/feltdb_wasm_bg-TseJn2Ax.wasm +0 -0
  80. package/dist/studio-app/assets/index-1wd0uKua.js +30 -0
  81. package/dist/studio-app/index.html +1 -1
  82. package/dist/transaction.d.ts +27 -11
  83. package/dist/transaction.d.ts.map +1 -1
  84. package/dist/transaction.js +20 -14
  85. package/dist/wasm/feltdb_wasm_bg.wasm +0 -0
  86. package/dist/wasm/package.json +1 -1
  87. package/dist/workload.d.ts +31 -3
  88. package/dist/workload.d.ts.map +1 -1
  89. package/dist/workload.js +28 -3
  90. package/package.json +1 -1
  91. package/dist/studio-app/assets/feltdb_wasm_bg-CFQT4gCy.wasm +0 -0
  92. package/dist/studio-app/assets/index-Dql1hS5m.js +0 -30
package/dist/db.js CHANGED
@@ -8,10 +8,11 @@ import { describeFreshness, readRevision, } from './freshness.js';
8
8
  import { Collection, Relationship } from './collection.js';
9
9
  import { AtomicTransactionBuilder, AtomicTransactionError, ConditionalConflictError, TransactionIdConflictError, TransactionIdUnverifiableError, conditionalRefusal, normaliseReadSet, } from './transaction.js';
10
10
  import { CellImpl } from './cell.js';
11
- import { createAgentRef } from './agent.js';
11
+ import { createAgentRef, parseAgentRef } from './agent.js';
12
12
  import { AgentRegistry } from './agent-registry.js';
13
13
  import { AgentRuntime } from './agent-runtime.js';
14
14
  import { MemoryJsDb } from './memory-db.js';
15
+ import { getReactiveDependencyGraph } from './reactive-graph.js';
15
16
  import { HttpJsDb } from './http-db.js';
16
17
  import { IndexedDbJsDb } from './indexeddb-db.js';
17
18
  import { requireRuntime } from './runtime-registry.js';
@@ -62,6 +63,7 @@ function explicitDeployment(options) {
62
63
  applicationId: options.server.applicationId,
63
64
  environment: options.server.environment,
64
65
  requestTimeoutMs: options.server.requestTimeoutMs,
66
+ allowServiceKeyInBrowser: options.server.operatorConsole === true,
65
67
  };
66
68
  }
67
69
  if (options.browser)
@@ -85,11 +87,12 @@ export function createFeltDB(options = {}) {
85
87
  environment: deployment.environment,
86
88
  requestTimeoutMs: options.server?.requestTimeoutMs,
87
89
  authorityScope,
90
+ allowServiceKeyInBrowser: options.server?.operatorConsole === true,
88
91
  })
89
92
  : deployment.mode === 'browser' ? new IndexedDbJsDb(deployment.namespace)
90
93
  : deployment.mode === 'local' ? requireRuntime('file', deployment.path, 'createFeltDB() resolved to the local Node runtime, but the Node file runtime is not available here. '
91
94
  + 'In a browser use FELTDB_MODE=browser or createFeltDB({ browser: true }); in Node import "@feltdb/core" '
92
- + 'rather than a browser-conditioned build.')
95
+ + 'rather than a browser-conditioned build.', { access: options.access ?? 'exclusive' })
93
96
  : new MemoryJsDb(deployment.namespace);
94
97
  const runtimeName = deployment.mode === 'local' ? 'node' : deployment.mode;
95
98
  const bridge = attachDevelopmentRuntimeBridge({
@@ -134,6 +137,13 @@ function observeRuntime(runtime, observation) {
134
137
  * State-first database interface.
135
138
  * Applications use this to treat FeltDB collections as live application state.
136
139
  */
140
+ /** Where embedded agent executions are durable. */
141
+ const AGENT_EXECUTION_COLLECTION = '_flow_agent_executions';
142
+ /** Indexes `findAgentExecution` reads through: newest first per task and per agent. */
143
+ const AGENT_EXECUTION_INDEXES = [
144
+ { name: 'agent_executions_by_task_created', type: 'compound', fields: ['taskId', 'createdMs', 'id'], directions: ['asc', 'desc', 'asc'], persistent: true },
145
+ { name: 'agent_executions_by_agent_created', type: 'compound', fields: ['agentRef', 'createdMs', 'id'], directions: ['asc', 'desc', 'asc'], persistent: true },
146
+ ];
137
147
  export class StateFirstDB {
138
148
  jsDb;
139
149
  collections = new Map();
@@ -232,6 +242,15 @@ export class StateFirstDB {
232
242
  },
233
243
  };
234
244
  this.agentRuntime = new AgentRuntime(this.agentRegistry, agentConfig);
245
+ this.agentRuntime.bindStore({
246
+ create: execution => this.collection(AGENT_EXECUTION_COLLECTION)
247
+ .insert(this.agentExecutionRecord(execution), execution.executionId)
248
+ .then(() => undefined),
249
+ update: execution => this.collection(AGENT_EXECUTION_COLLECTION)
250
+ .update(execution.executionId, this.agentExecutionRecord(execution))
251
+ .then(() => undefined),
252
+ find: query => this.queryAgentExecution(query),
253
+ });
235
254
  // Emit initialization telemetry event
236
255
  // Non-blocking, fails silently if telemetry unavailable
237
256
  emitTelemetry('initialize');
@@ -344,6 +363,7 @@ export class StateFirstDB {
344
363
  replication: typeof this.jsDb.export_operations === 'function' || typeof this.jsDb.apply_remote_operations === 'function',
345
364
  remoteAuthority,
346
365
  offline: !remoteAuthority,
366
+ content: typeof this.jsDb.storeContent === 'function' && typeof this.jsDb.acquireContent === 'function',
347
367
  };
348
368
  }
349
369
  /**
@@ -506,6 +526,33 @@ export class StateFirstDB {
506
526
  * transactions. Runtimes that cannot refuse rather than silently degrading
507
527
  * the transaction into a sequence of independent writes.
508
528
  */
529
+ /**
530
+ * Tell this process's live collections that a transaction committed.
531
+ *
532
+ * Collection writes publish through the reactive dependency graph; a
533
+ * transaction bypasses the collection, so without this a subscriber on the
534
+ * local file or memory runtime never learns about it. The announcement is
535
+ * a notification only (subscribers re-read committed state), and it runs
536
+ * after the commit is durable: a failing subscriber cannot turn a committed
537
+ * transaction into a reported failure.
538
+ */
539
+ async announceCommittedTransaction(operations) {
540
+ const graph = getReactiveDependencyGraph();
541
+ const timestamp = Date.now();
542
+ for (const operation of operations) {
543
+ try {
544
+ await graph.emitChange(operation.collection, {
545
+ type: operation.value === undefined ? 'delete' : 'update',
546
+ key: `${operation.collection}:${operation.id}`,
547
+ value: operation.value ?? null,
548
+ timestamp,
549
+ });
550
+ }
551
+ catch {
552
+ // Notification is best-effort; the commit already happened.
553
+ }
554
+ }
555
+ }
509
556
  async transaction(build, options = {}) {
510
557
  // A transaction may be staged through a callback or described in full. The
511
558
  // second is not a second mechanism: it builds the same request, through the
@@ -534,7 +581,7 @@ export class StateFirstDB {
534
581
  if (!this.jsDb.commit_transaction) {
535
582
  const error = new AtomicTransactionError('This FeltDB runtime does not provide atomic transactions. '
536
583
  + 'Connect to a FeltDB authority (createFeltDB({ server: ... })) to use db.transaction(). '
537
- + 'FeltDB will not emulate a transaction with separate writes, because that would not be atomic.', builder.transactionId);
584
+ + 'FeltDB will not emulate a transaction with separate writes, because that would not be atomic.', builder.transactionId, FeltDBErrorCode.CONTRACT_UNSUPPORTED);
538
585
  observed?.fail(error);
539
586
  throw error;
540
587
  }
@@ -547,7 +594,7 @@ export class StateFirstDB {
547
594
  }
548
595
  const request = builder.seal();
549
596
  if (request.operations.length === 0) {
550
- const error = new AtomicTransactionError('a transaction requires at least one operation', request.transactionId);
597
+ const error = new AtomicTransactionError('a transaction requires at least one operation', request.transactionId, FeltDBErrorCode.INVALID_REQUEST);
551
598
  observed?.fail(error);
552
599
  throw error;
553
600
  }
@@ -584,6 +631,11 @@ export class StateFirstDB {
584
631
  duplicate: completed.duplicate,
585
632
  ...(completed.binding ? { binding: completed.binding } : {}),
586
633
  });
634
+ // A transaction commits the same durable state a collection write does,
635
+ // so it reaches the same live subscribers. A duplicate applied nothing
636
+ // and announces nothing.
637
+ if (!completed.duplicate)
638
+ await this.announceCommittedTransaction(request.operations);
587
639
  return completed;
588
640
  }
589
641
  catch (error) {
@@ -594,17 +646,23 @@ export class StateFirstDB {
594
646
  // conflict must be distinguishable from an infrastructure failure without
595
647
  // reading the message.
596
648
  const refusal = conditionalRefusal(error);
597
- const remoteCode = error?.code
598
- ?? error?.feltdbCode;
599
- const transactionError = error instanceof TransactionIdConflictError || error instanceof TransactionIdUnverifiableError
649
+ const cause = error;
650
+ const remoteCode = cause?.feltdbCode ?? cause?.code;
651
+ const message = error instanceof Error ? error.message : String(error);
652
+ // One typed shape for every runtime and transport: the stable code, the
653
+ // authority's status and request id when it answered, and for a lost
654
+ // race the structured failure. A transport that ended without an answer
655
+ // keeps its `COMMIT_OUTCOME_UNKNOWN`; it is never turned into a refusal.
656
+ const transactionError = error instanceof AtomicTransactionError
600
657
  ? error
601
658
  : remoteCode === 'IDEMPOTENCY_CONFLICT'
602
659
  // A managed authority's refusal is the same event as an embedded one.
603
- ? new TransactionIdConflictError(request.transactionId, error instanceof Error ? error.message : undefined)
604
- : refusal.conflict
605
- ? new ConditionalConflictError(error instanceof Error ? error.message : String(error), request.transactionId, refusal.failure)
606
- : new AtomicTransactionError(error instanceof Error ? error.message : String(error), request.transactionId, error?.code
607
- ?? error?.feltdbCode, error?.status, error);
660
+ ? new TransactionIdConflictError(request.transactionId, message, cause?.status, cause?.requestId)
661
+ : remoteCode === 'IDEMPOTENCY_UNVERIFIABLE'
662
+ ? new TransactionIdUnverifiableError(request.transactionId, message, cause?.status, cause?.requestId)
663
+ : refusal.conflict
664
+ ? new ConditionalConflictError(message, request.transactionId, refusal.failure, cause?.status, cause?.requestId)
665
+ : new AtomicTransactionError(message, request.transactionId, remoteCode ?? FeltDBErrorCode.INTERNAL_ERROR, cause?.status, error, cause?.requestId);
608
666
  observed?.fail(transactionError);
609
667
  throw transactionError;
610
668
  }
@@ -834,18 +892,35 @@ export class StateFirstDB {
834
892
  throw new Error('Causal provenance requires a server runtime');
835
893
  return this.jsDb.provenance(collection, id);
836
894
  }
837
- /** Persist immutable content by hash; repeated bytes deduplicate automatically. */
895
+ /**
896
+ * Persist immutable content by its SHA-256; repeated bytes deduplicate.
897
+ * Returns `{ hash, bytes, ref: 'sha256:<hash>' }`.
898
+ *
899
+ * A server runtime stores it in the server's content store; the local file
900
+ * runtime stores it under its state directory (`content/<hash>`), durably
901
+ * before this returns. Memory and browser runtimes refuse with
902
+ * `CONTRACT_UNSUPPORTED`.
903
+ */
838
904
  async storeContent(content) {
839
- if (!(this.jsDb instanceof HttpJsDb))
840
- throw new Error('Durable content storage requires a server runtime');
905
+ if (!this.jsDb.storeContent)
906
+ throw this.contentUnsupported('store');
841
907
  return this.jsDb.storeContent(content);
842
908
  }
843
- /** Resolve verified immutable content locally or from configured peers. */
909
+ /**
910
+ * Resolve content by hash: verified against its SHA-256 before it is
911
+ * returned (`CONTENT_INTEGRITY_FAILURE` otherwise), `null` when absent. A
912
+ * server also asks its configured peers; the local runtime reads its own
913
+ * directory only.
914
+ */
844
915
  async acquireContent(hash) {
845
- if (!(this.jsDb instanceof HttpJsDb))
846
- throw new Error('Network content acquisition requires a server runtime');
916
+ if (!this.jsDb.acquireContent)
917
+ throw this.contentUnsupported('read');
847
918
  return this.jsDb.acquireContent(hash);
848
919
  }
920
+ contentUnsupported(action) {
921
+ return new FeltDBServiceError(`CONTRACT_UNSUPPORTED: this ${this.runtimeInfo.storage} runtime has no durable content store, so it cannot ${action} `
922
+ + 'content. Use the local file runtime (createFeltDB({ path })) or a FeltDB server.', FeltDBErrorCode.CONTRACT_UNSUPPORTED);
923
+ }
849
924
  /** Define a durable workflow whose lifecycle is ordinary replicated state. */
850
925
  async defineWorkflow(name, steps) {
851
926
  if (!(this.jsDb instanceof HttpJsDb))
@@ -925,33 +1000,84 @@ export class StateFirstDB {
925
1000
  return this.agentRuntime;
926
1001
  }
927
1002
  /**
928
- * Create an agent execution
1003
+ * Create an agent execution. It is committed to `_flow_agent_executions`
1004
+ * before this returns; pass `taskId` to find it later with
1005
+ * `findAgentExecution({ taskId })`.
929
1006
  */
930
- async createAgentExecution(agentRef, goal, inputs) {
931
- const execution = await this.agentRuntime.createExecution(this, agentRef, goal, inputs);
932
- await this.collection('_flow_agent_executions').insert(this.agentExecutionRecord(execution), execution.executionId);
933
- return execution;
1007
+ async createAgentExecution(agentRef, goal, inputs, options = {}) {
1008
+ return this.agentRuntime.createExecution(this, agentRef, goal, inputs, options);
934
1009
  }
935
1010
  agentExecutionRecord(execution) {
936
1011
  return { ...execution, id: execution.executionId, agentRef: execution.agentRef.toString() };
937
1012
  }
1013
+ agentExecutionIndexesDeclared = false;
1014
+ /** Declare the lookup indexes once per handle, on an embedded runtime only. */
1015
+ async declareAgentExecutionIndexes() {
1016
+ if (this.agentExecutionIndexesDeclared)
1017
+ return;
1018
+ this.agentExecutionIndexesDeclared = true;
1019
+ if (this.capabilities().remoteAuthority)
1020
+ return;
1021
+ const executions = this.collection(AGENT_EXECUTION_COLLECTION);
1022
+ for (const index of AGENT_EXECUTION_INDEXES) {
1023
+ if (executions.listIndexes().some(existing => existing.name === index.name))
1024
+ continue;
1025
+ // A definition committed by an earlier process is already durable.
1026
+ const planned = await this.explain({
1027
+ collection: AGENT_EXECUTION_COLLECTION,
1028
+ where: [{ field: index.fields[0], eq: '' }],
1029
+ limit: 1,
1030
+ }).catch(() => undefined);
1031
+ if (planned?.index === index.name)
1032
+ continue;
1033
+ executions.createIndex(index);
1034
+ }
1035
+ }
1036
+ async queryAgentExecution(query) {
1037
+ await this.declareAgentExecutionIndexes();
1038
+ const field = 'taskId' in query && query.taskId !== undefined ? 'taskId' : 'agentRef';
1039
+ const value = field === 'taskId' ? query.taskId : String(query.agentRef);
1040
+ const page = await this.query({
1041
+ collection: AGENT_EXECUTION_COLLECTION,
1042
+ where: [{ field, eq: value }],
1043
+ orderBy: [{ field: 'createdMs', direction: 'desc' }],
1044
+ limit: 1,
1045
+ });
1046
+ const row = page.records[0];
1047
+ if (!row)
1048
+ return null;
1049
+ const { id: _id, __version: _version, ...execution } = row;
1050
+ return { ...execution, agentRef: parseAgentRef(String(row.agentRef)) };
1051
+ }
1052
+ /**
1053
+ * The most recently created execution for an agent-state task or an agent,
1054
+ * read from durable state through a declared index (one bounded query; it
1055
+ * never scans `_flow_agent_executions`). Null when there is none.
1056
+ */
1057
+ async findAgentExecution(query) {
1058
+ return this.agentRuntime.findExecution(query);
1059
+ }
938
1060
  /** Claim and durably materialize an embedded agent execution. */
939
1061
  async startAgentExecution(execution, peerId = this.instanceId()) {
940
1062
  await this.agentRuntime.start(execution, peerId);
941
- await this.collection('_flow_agent_executions').update(execution.executionId, this.agentExecutionRecord(execution));
942
1063
  }
943
1064
  /** Advance an agent lifecycle and expose the transition as ordinary state. */
944
1065
  async transitionAgentExecution(execution, status) {
945
1066
  await this.agentRuntime.transition(execution, status);
946
- await this.collection('_flow_agent_executions').update(execution.executionId, this.agentExecutionRecord(execution));
1067
+ }
1068
+ /** Resume an execution for `peerId` (status `Observing`), committed before this returns. */
1069
+ async resumeAgentExecution(execution, peerId = this.instanceId()) {
1070
+ await this.agentRuntime.resume(execution, peerId);
947
1071
  }
948
1072
  async completeAgentExecution(execution, resultRef) {
949
1073
  await this.agentRuntime.complete(execution, resultRef);
950
- await this.collection('_flow_agent_executions').update(execution.executionId, this.agentExecutionRecord(execution));
951
1074
  }
952
1075
  async failAgentExecution(execution, error) {
953
1076
  await this.agentRuntime.fail(execution, error);
954
- await this.collection('_flow_agent_executions').update(execution.executionId, this.agentExecutionRecord(execution));
1077
+ }
1078
+ /** Cancel a non-terminal execution (terminal status `Cancelled`), committed before this returns. */
1079
+ async cancelAgentExecution(execution, reason) {
1080
+ await this.agentRuntime.cancel(execution, reason);
955
1081
  }
956
1082
  /**
957
1083
  * Close the database and clean up resources.
@@ -1,4 +1,21 @@
1
+ import { FeltDBServiceError } from './error-codes.js';
1
2
  export type FeltDBDeploymentMode = 'browser' | 'local' | 'remote' | 'memory';
3
+ /** Prefix of every FeltDB service (API) key. */
4
+ export declare const FELTDB_SERVICE_KEY_PREFIX = "fdb_live_";
5
+ /**
6
+ * A FeltDB service key reached code running in a browser.
7
+ *
8
+ * Service keys (`fdb_live_…`) authorize everything their scopes name for every
9
+ * caller holding them, so a key in a browser bundle or page is a key published
10
+ * to every visitor. Keep service keys server-side (`FELTDB_TOKEN`, never a
11
+ * `VITE_`/`NEXT_PUBLIC_`/`PUBLIC_` variable) and give browsers an end-user
12
+ * session token from `/v1/auth/signin`, or call FeltDB through your server.
13
+ */
14
+ export declare class FeltDBBrowserCredentialError extends FeltDBServiceError {
15
+ constructor(source: string);
16
+ }
17
+ /** Throws {@link FeltDBBrowserCredentialError} when a service key reaches a browser runtime. */
18
+ export declare function assertBrowserSafeCredential(token: string | undefined, isBrowser: boolean, source?: string): void;
2
19
  export interface FeltDBDeploymentConfig {
3
20
  mode?: FeltDBDeploymentMode;
4
21
  namespace?: string;
@@ -8,6 +25,8 @@ export interface FeltDBDeploymentConfig {
8
25
  environment?: string;
9
26
  path?: string;
10
27
  requestTimeoutMs?: number;
28
+ /** Explicit configuration only; see `server.operatorConsole` on `createFeltDB`. */
29
+ allowServiceKeyInBrowser?: boolean;
11
30
  }
12
31
  export interface FeltDBDeploymentResolution {
13
32
  mode: FeltDBDeploymentMode;
@@ -1 +1 @@
1
- {"version":3,"file":"deployment.d.ts","sourceRoot":"","sources":["../src/deployment.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE7E,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,EAAE,oBAAoB,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,oBAAoB,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,UAAU,GAAG,aAAa,GAAG,aAAa,GAAG,MAAM,CAAC;CAC7D;AAED,MAAM,W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AE,MAAM,CAAC;IAC1B,mFAAmF;IACnF,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC;AAED,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,oBAAoB,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,UAAU,GAAG,aAAa,GAAG,aAAa,GAAG,MAAM,CAAC;CAC7D;AAED,MAAM,WAAW,iCAAiC;IAChD,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACzC,UAAU,CAAC,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAC3C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAMD,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,MAAM,sBAAsB,GAAG,SAAS,GAAG,IAAI,CAErG;AA+FD,wBAAgB,uBAAuB,CACrC,QAAQ,GAAE,sBAA2B,EACrC,OAAO,GAAE,iCAAsC,GAC9C,0BAA0B,CA6C5B"}
@@ -1,3 +1,29 @@
1
+ import { FeltDBServiceError } from './error-codes.js';
2
+ /** Prefix of every FeltDB service (API) key. */
3
+ export const FELTDB_SERVICE_KEY_PREFIX = 'fdb_live_';
4
+ /**
5
+ * A FeltDB service key reached code running in a browser.
6
+ *
7
+ * Service keys (`fdb_live_…`) authorize everything their scopes name for every
8
+ * caller holding them, so a key in a browser bundle or page is a key published
9
+ * to every visitor. Keep service keys server-side (`FELTDB_TOKEN`, never a
10
+ * `VITE_`/`NEXT_PUBLIC_`/`PUBLIC_` variable) and give browsers an end-user
11
+ * session token from `/v1/auth/signin`, or call FeltDB through your server.
12
+ */
13
+ export class FeltDBBrowserCredentialError extends FeltDBServiceError {
14
+ constructor(source) {
15
+ super(`A FeltDB service key (fdb_live_…) was supplied to a browser runtime via ${source}. Service keys must stay server-side: ` +
16
+ 'set FELTDB_TOKEN on your server (never a VITE_/NEXT_PUBLIC_/PUBLIC_ variable, which bundlers inline into client code), ' +
17
+ 'and give the browser an end-user session token from /v1/auth/signin or proxy requests through your server.', 'SERVICE_KEY_IN_BROWSER');
18
+ this.name = 'FeltDBBrowserCredentialError';
19
+ }
20
+ }
21
+ /** Throws {@link FeltDBBrowserCredentialError} when a service key reaches a browser runtime. */
22
+ export function assertBrowserSafeCredential(token, isBrowser, source = 'configuration') {
23
+ if (isBrowser && typeof token === 'string' && token.trim().startsWith(FELTDB_SERVICE_KEY_PREFIX)) {
24
+ throw new FeltDBBrowserCredentialError(source);
25
+ }
26
+ }
1
27
  let configFileLoader;
2
28
  export function registerDeploymentConfigLoader(loader) {
3
29
  configFileLoader = loader;
@@ -17,7 +43,10 @@ function envConfig(env) {
17
43
  mode: modeValue(env.FELTDB_MODE ?? env.VITE_FELTDB_MODE),
18
44
  namespace: env.FELTDB_NAMESPACE ?? env.VITE_FELTDB_NAMESPACE,
19
45
  url: env.FELTDB_URL ?? env.VITE_FELTDB_URL ?? env.FELTDB_API_URL,
20
- token: env.FELTDB_TOKEN ?? env.VITE_FELTDB_TOKEN ?? env.FELTDB_API_KEY ?? env.VITE_FELTDB_API_KEY,
46
+ // Credentials are read only from server-side names. A VITE_* (or
47
+ // NEXT_PUBLIC_*/PUBLIC_*) variable is inlined into browser bundles by the
48
+ // bundler, so a token there is published; it is never a credential source.
49
+ token: env.FELTDB_TOKEN ?? env.FELTDB_API_KEY,
21
50
  applicationId: env.FELTDB_APPLICATION_ID ?? env.VITE_FELTDB_APPLICATION_ID,
22
51
  environment: env.FELTDB_ENVIRONMENT ?? env.VITE_FELTDB_ENVIRONMENT,
23
52
  path: env.FELTDB_PATH ?? env.FELTDB_DATA_DIR,
@@ -111,11 +140,18 @@ export function resolveFeltDBDeployment(explicit = {}, context = {}) {
111
140
  const url = firstValue(sources, 'url');
112
141
  if (!url)
113
142
  throw new Error('FeltDB remote deployment requires FELTDB_URL or createFeltDB({ server: { url } }).');
143
+ const token = firstValue(sources, 'token');
144
+ const tokenSource = sources.find(candidate => typeof candidate.token === 'string' && candidate.token.trim())?.source;
145
+ // Only an explicit, in-code operator-console opt-in can allow it; an
146
+ // environment or config-file value never can.
147
+ const allowed = explicit.allowServiceKeyInBrowser === true && tokenSource === 'explicit';
148
+ if (!allowed)
149
+ assertBrowserSafeCredential(token, flags.isBrowser, tokenSource === 'explicit' ? 'createFeltDB({ server: { token } })' : `the ${tokenSource} configuration`);
114
150
  return {
115
151
  mode,
116
152
  namespace,
117
153
  url,
118
- token: firstValue(sources, 'token'),
154
+ token,
119
155
  applicationId: firstValue(sources, 'applicationId'),
120
156
  environment: firstValue(sources, 'environment'),
121
157
  source,
@@ -1 +1 @@
1
- {"version":3,"file":"embedded-query.d.ts","sourceRoot":"","sources":["../src/embedded-query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAG9E,KAAK,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAInC,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WA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AE,qBAAqB,GAAG,kBAAkB,CAAC,CAAC,CAAC,GAAG;QAAE,KAAK,EAAE,kBAAkB,CAAA;KAAE;IAyErG,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,kBAAkB;IAQ1B,OAAO,CAAC,UAAU;IA6BlB,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,QAAQ;CAkBjB"}
@@ -1,3 +1,4 @@
1
+ import { FeltDBErrorCode, FeltDBServiceError } from './error-codes.js';
1
2
  const now = () => typeof performance !== 'undefined' ? performance.now() : Date.now();
2
3
  function compareValue(left, right) {
3
4
  if (left === right)
@@ -78,7 +79,7 @@ function decode(cursor, expectedBinding) {
78
79
  return value;
79
80
  }
80
81
  catch {
81
- throw new Error('INVALID_CURSOR: cursor is malformed or does not match this query');
82
+ throw new FeltDBServiceError('INVALID_CURSOR: cursor is malformed or does not match this query', FeltDBErrorCode.INVALID_CURSOR);
82
83
  }
83
84
  }
84
85
  /** Small deterministic planner/executor owned by an embedded storage boundary. */
@@ -331,7 +332,7 @@ export class EmbeddedQueryEngine {
331
332
  }
332
333
  validate(query) {
333
334
  if (!query.collection?.trim() || !Number.isInteger(query.limit) || query.limit < 1 || query.limit > 1_000)
334
- throw new Error('INVALID_QUERY: collection and a limit between 1 and 1000 are required');
335
+ throw new FeltDBServiceError('INVALID_QUERY: collection and a limit between 1 and 1000 are required', 'INVALID_QUERY');
335
336
  for (const condition of query.where ?? []) {
336
337
  // Every key beside `field` must be exactly one known operator. A stray
337
338
  // key — a `semantic` clause misplaced into a condition, or anything
@@ -340,13 +341,13 @@ export class EmbeddedQueryEngine {
340
341
  const keys = Object.keys(condition).filter(key => key !== 'field');
341
342
  const operators = keys.filter(operator => ['eq', 'neq', 'lt', 'lte', 'gt', 'gte'].includes(operator));
342
343
  if (!condition.field || operators.length !== 1 || keys.length !== 1)
343
- throw new Error('INVALID_QUERY: each condition requires a field and exactly one operator');
344
+ throw new FeltDBServiceError('INVALID_QUERY: each condition requires a field and exactly one operator', 'INVALID_QUERY');
344
345
  }
345
346
  if (query.semantic !== undefined) {
346
347
  // Semantic composition runs where the Rust decision primitive runs. This
347
348
  // embedded engine has no runtime binding, so it refuses the clause
348
349
  // rather than answering the deterministic query in its place.
349
- throw new Error('SEMANTIC_UNSUPPORTED: this runtime has no semantic runtime binding; semantic query composition is available through the managed authority');
350
+ throw new FeltDBServiceError('SEMANTIC_UNSUPPORTED: this runtime has no semantic runtime binding; semantic query composition is available through the managed authority', 'SEMANTIC_UNSUPPORTED');
350
351
  }
351
352
  }
352
353
  }
@@ -126,7 +126,7 @@ export type EmbeddedPlan =
126
126
  kind: 'reject';
127
127
  reason: string;
128
128
  failure?: ConditionalConflictDetail;
129
- code?: 'INVALID_REQUEST';
129
+ code?: 'INVALID_REQUEST' | 'CONTRACT_UNSUPPORTED';
130
130
  } | {
131
131
  kind: 'apply';
132
132
  mutations: EmbeddedMutation[];
@@ -184,8 +184,12 @@ export declare function embeddedDuplicate(request: AtomicTransactionRequest, pla
184
184
  export declare class EmbeddedTransactionRejected extends Error {
185
185
  readonly feltdbCode?: 'PRECONDITION_FAILED';
186
186
  readonly feltdbConflict?: ConditionalConflictDetail;
187
- /** Set when the request itself was malformed, as opposed to refused by state. */
188
- readonly code?: 'INVALID_REQUEST';
189
- constructor(reason: string, failure?: ConditionalConflictDetail, code?: 'INVALID_REQUEST');
187
+ /**
188
+ * Set when the request itself was malformed (`INVALID_REQUEST`) or asks for
189
+ * something this runtime cannot evaluate (`CONTRACT_UNSUPPORTED`), as
190
+ * opposed to refused by state.
191
+ */
192
+ readonly code?: 'INVALID_REQUEST' | 'CONTRACT_UNSUPPORTED';
193
+ constructor(reason: string, failure?: ConditionalConflictDetail, code?: 'INVALID_REQUEST' | 'CONTRACT_UNSUPPORTED');
190
194
  }
191
195
  //# sourceMappingURL=embedded-transaction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"embedded-transaction.d.ts","sourceRoot":"","sources":["../src/embedded-transaction.ts"],"names":[],"mapp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