@feltdb/core 0.9.1 → 0.10.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 (99) hide show
  1. package/dist/cli/commands.js +19 -21
  2. package/dist/cli/development-session.js +16 -0
  3. package/dist/cli/studio-artifact.js +33 -0
  4. package/dist/create/package-versions.js +1 -1
  5. package/dist/create/server-source/crates/feltdb/src/acceptance_tests.rs +8 -1
  6. package/dist/create/server-source/crates/feltdb/src/application.rs +16 -0
  7. package/dist/create/server-source/crates/feltdb/src/bin/feltdb_node.rs +21 -22
  8. package/dist/create/server-source/crates/feltdb/src/lib.rs +451 -33
  9. package/dist/create/server-source/crates/feltdb/src/state_contract.rs +48 -3
  10. package/dist/create/server-source/crates/feltdb/src/state_model.rs +569 -4
  11. package/dist/create/server-source/crates/feltdb/src/state_trigger.rs +1 -0
  12. package/dist/create/server-source/crates/feltdb/src/versioned_object_substrate.rs +708 -0
  13. package/dist/create/server-source/crates/feltdb/src/worker_mesh.rs +1 -0
  14. package/dist/create/server-source/crates/feltdb/src/workload.rs +480 -44
  15. package/dist/create/server-source/crates/feltdb/tests/generalized_version_control_evidence.rs +123 -0
  16. package/dist/create/server-source/crates/feltdb/tests/generalized_version_control_substrate_completion.rs +281 -0
  17. package/dist/create/server-source/crates/feltdb/tests/production_readiness_contract.rs +15 -3
  18. package/dist/create/server-source/crates/feltdb/tests/revision_retention_boundary_evidence.rs +28 -18
  19. package/dist/create/server-source/crates/feltdb/tests/storage_independent_versioned_object_substrate.rs +328 -0
  20. package/dist/create/server-source/crates/feltdb/tests/workload_envelope_contract.rs +20 -3
  21. package/dist/create/server-source/crates/feltdb-server/src/app_state.rs +14 -4
  22. package/dist/create/server-source/crates/feltdb-server/src/backup.rs +0 -4
  23. package/dist/create/server-source/crates/feltdb-server/src/canonical_principals.rs +1093 -0
  24. package/dist/create/server-source/crates/feltdb-server/src/causal.rs +905 -144
  25. package/dist/create/server-source/crates/feltdb-server/src/connections.rs +9 -6
  26. package/dist/create/server-source/crates/feltdb-server/src/control_plane.rs +90 -0
  27. package/dist/create/server-source/crates/feltdb-server/src/lib.rs +1 -0
  28. package/dist/create/server-source/crates/feltdb-server/src/main.rs +408 -74
  29. package/dist/create/server-source/crates/feltdb-server/src/principals.rs +9 -501
  30. package/dist/create/server-source/crates/feltdb-server/src/tenancy.rs +22 -0
  31. package/dist/create/server-source/crates/feltdb-server/tests/principal_tenant_migration.rs +247 -0
  32. package/dist/db.d.ts +6 -5
  33. package/dist/db.d.ts.map +1 -1
  34. package/dist/db.js +18 -24
  35. package/dist/deployment.d.ts.map +1 -1
  36. package/dist/deployment.js +4 -2
  37. package/dist/embedded-transaction.d.ts.map +1 -1
  38. package/dist/embedded-transaction.js +4 -0
  39. package/dist/error-codes.d.ts +12 -0
  40. package/dist/error-codes.d.ts.map +1 -1
  41. package/dist/error-codes.js +20 -2
  42. package/dist/feltdb.d.ts +4 -0
  43. package/dist/feltdb.d.ts.map +1 -1
  44. package/dist/file-db.d.ts +10 -0
  45. package/dist/file-db.d.ts.map +1 -1
  46. package/dist/file-db.js +18 -0
  47. package/dist/http-db.d.ts +4 -0
  48. package/dist/http-db.d.ts.map +1 -1
  49. package/dist/http-db.js +73 -12
  50. package/dist/index-core.d.ts +1 -0
  51. package/dist/index-core.d.ts.map +1 -1
  52. package/dist/index-core.js +1 -0
  53. package/dist/public-contract.d.ts +112 -0
  54. package/dist/public-contract.d.ts.map +1 -0
  55. package/dist/public-contract.js +125 -0
  56. package/dist/studio/app.d.ts +23 -0
  57. package/dist/studio/app.d.ts.map +1 -1
  58. package/dist/studio/components/ContractInspector.d.ts +5 -0
  59. package/dist/studio/components/ContractInspector.d.ts.map +1 -1
  60. package/dist/studio/components/SettingsPanel.d.ts +4 -1
  61. package/dist/studio/components/SettingsPanel.d.ts.map +1 -1
  62. package/dist/studio/components/index.js +4 -4
  63. package/dist/studio/{components-CehkcX_k.js → components-CJFgdKG6.js} +322 -303
  64. package/dist/studio/control-plane/Data.d.ts.map +1 -1
  65. package/dist/studio/control-plane/Instance.d.ts +10 -0
  66. package/dist/studio/control-plane/Instance.d.ts.map +1 -1
  67. package/dist/studio/control-plane/Operations.d.ts +3 -0
  68. package/dist/studio/control-plane/Operations.d.ts.map +1 -1
  69. package/dist/studio/control-plane/State.d.ts.map +1 -1
  70. package/dist/studio/control-plane/index.d.ts +4 -2
  71. package/dist/studio/control-plane/index.d.ts.map +1 -1
  72. package/dist/studio/control-plane/index.js +2 -2
  73. package/dist/studio/control-plane-DP8ljTDO.js +3207 -0
  74. package/dist/studio/index.js +96 -75
  75. package/dist/studio/utils/api.d.ts +1 -1
  76. package/dist/studio/utils/api.d.ts.map +1 -1
  77. package/dist/studio/utils/control-plane-api.d.ts +12 -1
  78. package/dist/studio/utils/control-plane-api.d.ts.map +1 -1
  79. package/dist/studio/utils/control-plane-api.js +1 -1
  80. package/dist/studio/utils/index.js +16 -16
  81. package/dist/studio/utils/service-api.d.ts +8 -0
  82. package/dist/studio/utils/service-api.d.ts.map +1 -1
  83. package/dist/studio/utils/service-api.js +15 -12
  84. package/dist/studio-app/assets/{feltdb_wasm-DksXDnLa.js → feltdb_wasm-CfNb3IoF.js} +1 -1
  85. package/dist/studio-app/assets/feltdb_wasm_bg-D9d3gY-E.wasm +0 -0
  86. package/dist/studio-app/assets/index-SDXdROi1.js +30 -0
  87. package/dist/studio-app/feltdb-studio.json +6 -0
  88. package/dist/studio-app/index.html +1 -1
  89. package/dist/transaction.d.ts +9 -1
  90. package/dist/transaction.d.ts.map +1 -1
  91. package/dist/transaction.js +6 -2
  92. package/dist/wasm/feltdb_wasm_bg.wasm +0 -0
  93. package/dist/workspace/local-development-authority.d.ts +8 -0
  94. package/dist/workspace/local-development-authority.d.ts.map +1 -1
  95. package/dist/workspace/local-development-authority.js +136 -1
  96. package/package.json +2 -2
  97. package/dist/studio/control-plane-D6TT2fCQ.js +0 -3064
  98. package/dist/studio-app/assets/feltdb_wasm_bg-Yy4QRHJT.wasm +0 -0
  99. package/dist/studio-app/assets/index-CZ55nLgp.js +0 -30
package/dist/file-db.js CHANGED
@@ -502,6 +502,24 @@ export class FileJsDb {
502
502
  this.refresh();
503
503
  return [...this.state.events];
504
504
  }
505
+ /** Read-only projection of the materialized authority state. */
506
+ authorityStateSummary() {
507
+ this.refresh();
508
+ const cardinalities = new Map();
509
+ for (const key of Object.keys(this.state.rows)) {
510
+ const separator = key.indexOf(':');
511
+ const collection = separator === -1 ? key : key.slice(0, separator);
512
+ cardinalities.set(collection, (cardinalities.get(collection) ?? 0) + 1);
513
+ }
514
+ return {
515
+ current_sequence: this.state.sequence,
516
+ records: Object.keys(this.state.rows).length,
517
+ events: this.state.events.length,
518
+ collections: [...cardinalities]
519
+ .sort(([left], [right]) => left.localeCompare(right))
520
+ .map(([collection, records]) => ({ collection, records })),
521
+ };
522
+ }
505
523
  export_operations(sinceSequence) {
506
524
  this.refresh();
507
525
  return this.state.events.filter(event => event.sequence > sinceSequence);
package/dist/http-db.d.ts CHANGED
@@ -175,6 +175,8 @@ export declare class HttpJsDb implements JsDb {
175
175
  operations: number;
176
176
  stateBefore: number;
177
177
  stateAfter: number;
178
+ revisionId: string;
179
+ operationIds: string[];
178
180
  }>;
179
181
  /**
180
182
  * Atomically create a record only if the key is free.
@@ -244,6 +246,8 @@ export declare class HttpJsDb implements JsDb {
244
246
  acquireContent(hash: string): Promise<Uint8Array | null>;
245
247
  command(path: string, body: unknown): Promise<any>;
246
248
  application_request<T>(path: string, init?: RequestInit): Promise<T>;
249
+ /** Canonical HTTP adapter used by the typed public substrate contract. */
250
+ public_request<T>(path: string, init?: RequestInit): Promise<T>;
247
251
  /**
248
252
  * Subscribe to change notifications.
249
253
  *
@@ -1 +1 @@
1
- {"version":3,"file":"http-db.d.ts","sourceRoot":"","sources":["../src/http-db.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAE,mBAAmB,E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AA2B,IAAI,QAAQ;IACvC,WAAW,IAAI,MAAM;IAErB;;;;;;;;OAQG;IACH,YAAY,IAAI,MAAM;IAEtB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,eAAe,CAAC,CAAS;IAE3B,SAAS,IAAI,OAAO,CAAC,mBAAmB,CAAC;IA0BzC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC;YAKrB,IAAI;IAOlB,OAAO,CAAC,MAAM;CAIf"}
package/dist/http-db.js CHANGED
@@ -1,4 +1,4 @@
1
- import { FeltDBServiceError } from './error-codes.js';
1
+ import { FeltDBErrorCode, FeltDBServiceError } from './error-codes.js';
2
2
  import { conditionalRefusal } from './transaction.js';
3
3
  import { BoundedBackoff, SingleFlightValue, cancellableDelay, describeFailure, } from './managed-recovery.js';
4
4
  /**
@@ -15,6 +15,20 @@ function conditionalTransactionId(purpose) {
15
15
  : `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
16
16
  return `${purpose}-${unique}`;
17
17
  }
18
+ /**
19
+ * The canonical state API exposes storage projection metadata as `_id` and
20
+ * `_version`. The collection SDK has its own document contract (`id` and
21
+ * `__version`), so those projection-only fields must not leak into remote
22
+ * collection values or make managed results differ from embedded results.
23
+ */
24
+ function managedCollectionRecord(value) {
25
+ if (!value || typeof value !== 'object' || Array.isArray(value))
26
+ return value;
27
+ const record = { ...value };
28
+ delete record._id;
29
+ delete record._version;
30
+ return record;
31
+ }
18
32
  /** Network adapter implementing the same collection runtime contract as WASM. */
19
33
  export class HttpJsDb {
20
34
  url;
@@ -204,7 +218,7 @@ export class HttpJsDb {
204
218
  const [collection, id] = this.splitKey(key);
205
219
  if (this.applicationId) {
206
220
  const result = await this.canonical('/query', { query: { collection, filter: { operator: 'eq', field: 'id', value: id }, limit: 1 } });
207
- return { success: true, data: result.records.length ? JSON.stringify(result.records[0]) : undefined };
221
+ return { success: true, data: result.records.length ? JSON.stringify(managedCollectionRecord(result.records[0])) : undefined };
208
222
  }
209
223
  const response = await fetch(`${this.url}/collections/${encodeURIComponent(collection)}/${encodeURIComponent(id)}`, {
210
224
  headers: this.headers(),
@@ -229,7 +243,7 @@ export class HttpJsDb {
229
243
  const page = await this.canonical('/query', {
230
244
  query: { collection, limit: 100, ...(cursor ? { cursor } : {}) },
231
245
  });
232
- records.push(...page.records);
246
+ records.push(...page.records.map(managedCollectionRecord));
233
247
  cursor = page.next_cursor;
234
248
  } while (cursor);
235
249
  return { success: true, data: JSON.stringify(records) };
@@ -259,7 +273,7 @@ export class HttpJsDb {
259
273
  order_by: query.orderBy?.map(value => ({ field: value.field, direction: value.direction })),
260
274
  limit: query.limit, cursor: query.cursor,
261
275
  } });
262
- return { records: result.records, nextCursor: result.next_cursor, exhausted: !result.next_cursor, plan: result.plan };
276
+ return { records: result.records.map(managedCollectionRecord), nextCursor: result.next_cursor, exhausted: !result.next_cursor, plan: result.plan };
263
277
  }
264
278
  const response = await fetch(`${this.url}/query`, {
265
279
  method: 'POST', headers: this.headers(true), body: JSON.stringify(query),
@@ -324,7 +338,11 @@ export class HttpJsDb {
324
338
  if (this.applicationId) {
325
339
  const operations = request.operations.map(operation => ({
326
340
  kind: operation.value === undefined ? 'delete' : operation.requireAbsent ? 'insert' : 'update',
327
- collection: operation.collection, id: operation.id, value: operation.value,
341
+ collection: operation.collection,
342
+ id: operation.id,
343
+ value: operation.value && typeof operation.value === 'object' && !Array.isArray(operation.value)
344
+ ? { ...operation.value, id: operation.id }
345
+ : operation.value,
328
346
  }));
329
347
  // Every record-level guard travels as a `record` precondition, which the
330
348
  // authority evaluates inside the same lock as the writes and against the
@@ -348,13 +366,21 @@ export class HttpJsDb {
348
366
  expected_lease_id: guard.expectedLeaseId,
349
367
  }));
350
368
  const result = await this.canonicalTransaction(operations, request.transactionId, guards);
351
- return { transactionId: result.transaction_id, baseRevision: result.base_revision, commitRevision: result.commit_revision, status: result.status, duplicate: result.duplicate, operations: operations.length, stateBefore: result.state_before, stateAfter: result.state_after };
369
+ return { transactionId: result.transaction_id, baseRevision: result.base_revision, commitRevision: result.commit_revision, revisionId: result.revision_id, operationIds: result.operation_ids, status: result.status, duplicate: result.duplicate, operations: operations.length, stateBefore: result.state_before, stateAfter: result.state_after };
370
+ }
371
+ let response;
372
+ try {
373
+ response = await fetch(`${this.url}/transactions`, {
374
+ method: 'POST',
375
+ headers: this.headers(true),
376
+ body: JSON.stringify(request),
377
+ signal: AbortSignal.timeout(this.requestTimeoutMs),
378
+ });
379
+ }
380
+ catch (error) {
381
+ this.recordFailure(error);
382
+ throw new FeltDBServiceError(error instanceof Error ? error.message : String(error), FeltDBErrorCode.COMMIT_OUTCOME_UNKNOWN);
352
383
  }
353
- const response = await fetch(`${this.url}/transactions`, {
354
- method: 'POST',
355
- headers: this.headers(true),
356
- body: JSON.stringify(request),
357
- });
358
384
  if (!response.ok) {
359
385
  // The authority answers a refused transaction with a structured
360
386
  // document. Flattening it to a message here is what would force a
@@ -618,7 +644,8 @@ export class HttpJsDb {
618
644
  }
619
645
  catch (error) {
620
646
  this.recordFailure(error);
621
- throw error;
647
+ const mutating = !['GET', 'HEAD', 'OPTIONS'].includes((init.method ?? 'GET').toUpperCase());
648
+ throw new FeltDBServiceError(error instanceof Error ? error.message : String(error), mutating ? FeltDBErrorCode.COMMIT_OUTCOME_UNKNOWN : FeltDBErrorCode.SERVICE_UNAVAILABLE);
622
649
  }
623
650
  const text = await response.text();
624
651
  let body;
@@ -636,6 +663,40 @@ export class HttpJsDb {
636
663
  this.recordSuccess();
637
664
  return body;
638
665
  }
666
+ /** Canonical HTTP adapter used by the typed public substrate contract. */
667
+ async public_request(path, init = {}) {
668
+ let response;
669
+ try {
670
+ response = await fetch(`${this.url}${path}`, {
671
+ ...init,
672
+ signal: init.signal ?? AbortSignal.timeout(this.requestTimeoutMs),
673
+ headers: { ...this.headers(init.body !== undefined), ...(init.headers || {}) },
674
+ });
675
+ }
676
+ catch (error) {
677
+ this.recordFailure(error);
678
+ const mutating = !['GET', 'HEAD', 'OPTIONS'].includes((init.method ?? 'GET').toUpperCase());
679
+ throw new FeltDBServiceError(error instanceof Error ? error.message : String(error), mutating ? FeltDBErrorCode.COMMIT_OUTCOME_UNKNOWN : FeltDBErrorCode.SERVICE_UNAVAILABLE);
680
+ }
681
+ const text = await response.text();
682
+ let body;
683
+ try {
684
+ body = text ? JSON.parse(text) : undefined;
685
+ }
686
+ catch {
687
+ body = { message: text };
688
+ }
689
+ if (!response.ok) {
690
+ const error = new FeltDBServiceError(body?.message || body?.error || `FeltDB request failed: HTTP ${response.status}`, body?.code || (response.status === 401 ? FeltDBErrorCode.UNAUTHORIZED
691
+ : response.status === 403 ? FeltDBErrorCode.FORBIDDEN
692
+ : response.status === 404 ? FeltDBErrorCode.NOT_FOUND
693
+ : 'INVALID_REQUEST'), body?.request_id, response.status);
694
+ this.recordFailure(error);
695
+ throw error;
696
+ }
697
+ this.recordSuccess();
698
+ return body;
699
+ }
639
700
  /**
640
701
  * Subscribe to change notifications.
641
702
  *
@@ -43,6 +43,7 @@ export * from './operation-admission.js';
43
43
  export * from './error-codes.js';
44
44
  export * from './authority-scope.js';
45
45
  export * from './managed-recovery.js';
46
+ export * from './public-contract.js';
46
47
  export * from './authorization.js';
47
48
  export * from './sync-contract.js';
48
49
  export * from './workload.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index-core.d.ts","sourceRoot":"","sources":["../src/index-core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,YAAY,EAAE,kBAAkB,EAAE,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a,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACnE,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzE;;GAEG;AACH,YAAY,EACV,eAAe,EACf,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,SAAS,CAAC;AAEjB;;;;GAIG;AACH,cAAc,wBAAwB,CAAC;AACvC,cAAc,iCAAiC,CAAC"}
@@ -42,6 +42,7 @@ export * from './operation-admission.js';
42
42
  export * from './error-codes.js';
43
43
  export * from './authority-scope.js';
44
44
  export * from './managed-recovery.js';
45
+ export * from './public-contract.js';
45
46
  export * from './authorization.js';
46
47
  export * from './sync-contract.js';
47
48
  export * from './workload.js';
@@ -0,0 +1,112 @@
1
+ import type { AuthorityScope } from './authority-scope.js';
2
+ import type { Collection } from './collection.js';
3
+ import type { StateFirstDB } from './db.js';
4
+ import type { AtomicTransactionDocument, AtomicTransactionOptions, AtomicTransactionResult, AtomicTransactionScope } from './transaction.js';
5
+ import type { CreateWorkloadInput, Workload } from './workload.js';
6
+ import type { CausalEvent } from './observe.js';
7
+ export declare const FELTDB_PUBLIC_CONTRACT_VERSION: "1.0";
8
+ declare const cursorBrand: unique symbol;
9
+ /** Opaque resume token. No parsing, comparison, or arithmetic is public. */
10
+ export type FeltDBEventCursor = string & {
11
+ readonly [cursorBrand]: true;
12
+ };
13
+ export interface PublicTransactionResult extends AtomicTransactionResult {
14
+ baseRevision: number;
15
+ commitRevision: number;
16
+ revisionId: string;
17
+ operationIds: string[];
18
+ }
19
+ export interface PublicEvent extends CausalEvent {
20
+ revision_id: string;
21
+ operation_ids: string[];
22
+ metadata: CausalEvent['metadata'] & {
23
+ cursor: FeltDBEventCursor;
24
+ transaction_id: string;
25
+ revision_id: string;
26
+ };
27
+ }
28
+ export interface EventReplayPage {
29
+ contract_version: typeof FELTDB_PUBLIC_CONTRACT_VERSION;
30
+ cursor_format: 'fh1';
31
+ application_id: string;
32
+ environment: string;
33
+ events: PublicEvent[];
34
+ next_cursor: FeltDBEventCursor;
35
+ }
36
+ export interface PublicPrincipal {
37
+ id: string;
38
+ tenant_id: string;
39
+ application_id: string;
40
+ kind: string;
41
+ name: string;
42
+ status: string;
43
+ capabilities: string[];
44
+ [key: string]: unknown;
45
+ }
46
+ export interface PublicCapabilityDeclaration {
47
+ contract: 'feltdb.public.substrate';
48
+ contract_version: typeof FELTDB_PUBLIC_CONTRACT_VERSION;
49
+ cursor_format_version: 'fh1';
50
+ stored_state_schema_version: number;
51
+ migration_version: string;
52
+ capabilities: Array<{
53
+ capability: string;
54
+ contract_version: string;
55
+ support: 'supported' | 'unsupported' | 'conditionally_supported';
56
+ supported_transport: string[];
57
+ scope_requirements: string;
58
+ durability_semantics: string;
59
+ authority_owner: 'canonical_feltdb';
60
+ }>;
61
+ }
62
+ type PublicRequest = <T>(path: string, init?: RequestInit) => Promise<T>;
63
+ /**
64
+ * One typed public adapter over the canonical FeltDB authority.
65
+ *
66
+ * This class owns no records, versions, cursors, work, provenance, or retry
67
+ * log. Its fields are routing adapters; destroying this object loses no
68
+ * durable information.
69
+ */
70
+ export declare class FeltDBPublicContract {
71
+ private readonly db;
72
+ private readonly scope;
73
+ private readonly applicationId;
74
+ private readonly environment;
75
+ private readonly request?;
76
+ readonly version: "1.0";
77
+ constructor(db: StateFirstDB, scope: AuthorityScope | undefined, applicationId: string | undefined, environment: string, request?: PublicRequest | undefined);
78
+ private requireApplicationScope;
79
+ private authority;
80
+ readonly state: {
81
+ collection: <T>(name: string) => Collection<T>;
82
+ transaction: (build: ((transaction: AtomicTransactionScope) => void | Promise<void>) | AtomicTransactionDocument, options?: AtomicTransactionOptions) => Promise<PublicTransactionResult>;
83
+ };
84
+ readonly principals: {
85
+ list: () => Promise<PublicPrincipal[]>;
86
+ create: (input: {
87
+ kind: string;
88
+ name: string;
89
+ }) => Promise<PublicPrincipal>;
90
+ grant: (principalId: string, capability: string) => Promise<PublicPrincipal>;
91
+ };
92
+ readonly work: {
93
+ create: (input: CreateWorkloadInput) => Promise<Workload>;
94
+ inspect: (workId: string) => Promise<Workload>;
95
+ history: (workId: string) => Promise<unknown>;
96
+ };
97
+ readonly events: {
98
+ replay: (after?: FeltDBEventCursor, options?: {
99
+ limit?: number;
100
+ }) => Promise<EventReplayPage>;
101
+ subscribe: (after: FeltDBEventCursor | undefined, listener: (event: PublicEvent) => void | Promise<void>, options?: {
102
+ pollIntervalMs?: number;
103
+ signal?: AbortSignal;
104
+ }) => (() => void);
105
+ };
106
+ readonly provenance: {
107
+ record: (collection: string, id: string) => Promise<unknown>;
108
+ };
109
+ capabilities(): Promise<PublicCapabilityDeclaration>;
110
+ }
111
+ export {};
112
+ //# sourceMappingURL=public-contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-contract.d.ts","sourceRoot":"","sources":["../src/public-contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,KAAK,EACV,yBAAyB,EACzB,wBAAwB,EACxB,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,eAAO,MAAM,8BAA8B,EAAG,KAAc,CAAC;AAE7D,OAAO,CAAC,MAAM,WAAW,EAAE,OAAO,MAAM,CAAC;AACzC,4EAA4E;AAC5E,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,CAAC,WAAW,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC;AAE1E,MAAM,WAAW,uBAAwB,SAAQ,uBAAuB;IACtE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AG,OAAO,CAAC,eAAe,CAAC;MAKhF;IAEF,QAAQ,CAAC,IAAI;wBACW,mBAAmB,KAAG,OAAO,CAAC,QAAQ,CAAC;0BAa3C,MAAM,KAAG,OAAO,CAAC,QAAQ,CAAC;0BAE1B,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;MAE3C;IAEF,QAAQ,CAAC,MAAM;yBAEH,iBAAiB,YAChB;YAAE,KAAK,CAAC,EAAE,MAAM,CAAA;SAAE,KAC1B,OAAO,CAAC,eAAe,CAAC;2BAWlB,iBAAiB,GAAG,SAAS,YAC1B,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,YAC7C;YAAE,cAAc,CAAC,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,WAAW,CAAA;SAAE,KACzD,CAAC,MAAM,IAAI,CAAC;MAyBf;IAEF,QAAQ,CAAC,UAAU;6BACU,MAAM,MAAM,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;MAUhE;IAEI,YAAY,IAAI,OAAO,CAAC,2BAA2B,CAAC;CAM3D"}
@@ -0,0 +1,125 @@
1
+ import { FeltDBErrorCode, FeltDBServiceError } from './error-codes.js';
2
+ export const FELTDB_PUBLIC_CONTRACT_VERSION = '1.0';
3
+ /**
4
+ * One typed public adapter over the canonical FeltDB authority.
5
+ *
6
+ * This class owns no records, versions, cursors, work, provenance, or retry
7
+ * log. Its fields are routing adapters; destroying this object loses no
8
+ * durable information.
9
+ */
10
+ export class FeltDBPublicContract {
11
+ db;
12
+ scope;
13
+ applicationId;
14
+ environment;
15
+ request;
16
+ version = FELTDB_PUBLIC_CONTRACT_VERSION;
17
+ constructor(db, scope, applicationId, environment, request) {
18
+ this.db = db;
19
+ this.scope = scope;
20
+ this.applicationId = applicationId;
21
+ this.environment = environment;
22
+ this.request = request;
23
+ }
24
+ requireApplicationScope() {
25
+ if (this.scope?.kind !== 'tenant' || !this.applicationId) {
26
+ throw new FeltDBServiceError('The public durable contract requires explicit tenant and application scope', FeltDBErrorCode.AUTHORITY_SCOPE_REQUIRED);
27
+ }
28
+ return { tenantId: this.scope.tenantId, applicationId: this.applicationId };
29
+ }
30
+ authority() {
31
+ this.requireApplicationScope();
32
+ if (!this.request) {
33
+ throw new FeltDBServiceError('This capability requires a connected FeltDB authority', FeltDBErrorCode.CONTRACT_UNSUPPORTED);
34
+ }
35
+ return this.request;
36
+ }
37
+ state = {
38
+ collection: (name) => {
39
+ this.requireApplicationScope();
40
+ return this.db.collection(name);
41
+ },
42
+ transaction: (build, options = {}) => {
43
+ this.requireApplicationScope();
44
+ return this.db.transaction(build, options);
45
+ },
46
+ };
47
+ principals = {
48
+ list: async () => {
49
+ const { applicationId } = this.requireApplicationScope();
50
+ return this.authority()(`/api/applications/${encodeURIComponent(applicationId)}/principals`);
51
+ },
52
+ create: async (input) => {
53
+ const { applicationId } = this.requireApplicationScope();
54
+ return this.authority()(`/api/applications/${encodeURIComponent(applicationId)}/principals`, { method: 'POST', body: JSON.stringify(input) });
55
+ },
56
+ grant: async (principalId, capability) => this.authority()(`/api/principals/${encodeURIComponent(principalId)}/capabilities`, { method: 'POST', body: JSON.stringify({ capability }) }),
57
+ };
58
+ work = {
59
+ create: async (input) => {
60
+ const { tenantId, applicationId } = this.requireApplicationScope();
61
+ if (input.tenant_id !== tenantId || input.application_id !== applicationId) {
62
+ throw new FeltDBServiceError('Durable Work scope does not match the bound public contract', FeltDBErrorCode.SCOPE_VIOLATION);
63
+ }
64
+ return this.authority()('/v1/workloads', {
65
+ method: 'POST',
66
+ body: JSON.stringify({ ...input, created_at: input.created_at ?? Math.floor(Date.now() / 1000) }),
67
+ });
68
+ },
69
+ inspect: (workId) => this.authority()(`/v1/workloads/${encodeURIComponent(workId)}`),
70
+ history: (workId) => this.authority()(`/v1/workloads/${encodeURIComponent(workId)}/history`),
71
+ };
72
+ events = {
73
+ replay: async (after, options = {}) => {
74
+ const { applicationId } = this.requireApplicationScope();
75
+ const query = new URLSearchParams({
76
+ application_id: applicationId,
77
+ environment: this.environment,
78
+ limit: String(options.limit ?? 100),
79
+ });
80
+ if (after)
81
+ query.set('cursor', after);
82
+ return this.authority()(`/v1/public/events/replay?${query}`);
83
+ },
84
+ subscribe: (after, listener, options = {}) => {
85
+ const controller = new AbortController();
86
+ const cancel = () => controller.abort();
87
+ options.signal?.addEventListener('abort', cancel, { once: true });
88
+ void (async () => {
89
+ let cursor = after;
90
+ while (!controller.signal.aborted) {
91
+ const page = await this.events.replay(cursor);
92
+ for (const event of page.events)
93
+ await listener(event);
94
+ cursor = page.next_cursor;
95
+ await new Promise(resolve => {
96
+ const timer = setTimeout(resolve, options.pollIntervalMs ?? 250);
97
+ controller.signal.addEventListener('abort', () => {
98
+ clearTimeout(timer);
99
+ resolve();
100
+ }, { once: true });
101
+ });
102
+ }
103
+ })().catch(() => {
104
+ // Delivery failure ends this discardable subscriber. Replay remains
105
+ // available from the caller's last acknowledged opaque cursor.
106
+ controller.abort();
107
+ });
108
+ return cancel;
109
+ },
110
+ };
111
+ provenance = {
112
+ record: async (collection, id) => {
113
+ const { applicationId } = this.requireApplicationScope();
114
+ const query = new URLSearchParams({
115
+ application_id: applicationId,
116
+ environment: this.environment,
117
+ });
118
+ return this.authority()(`/v1/control-plane/provenance/${encodeURIComponent(collection)}/${encodeURIComponent(id)}?${query}`);
119
+ },
120
+ };
121
+ async capabilities() {
122
+ const declaration = await this.authority()('/v1/control-plane/capabilities');
123
+ return declaration.public_contract;
124
+ }
125
+ }
@@ -16,6 +16,29 @@ export interface StudioAppProps {
16
16
  sourceSync?: SourceSyncConfiguration;
17
17
  onConnect?: (url: string, token: string) => void;
18
18
  }
19
+ export interface ApplicationConnectionNoticeProps {
20
+ registration?: {
21
+ namespace?: string;
22
+ };
23
+ }
24
+ export type StudioConnectionResolution = {
25
+ source: 'explicit-authority' | 'configured-authority';
26
+ authorityUrl: string;
27
+ } | {
28
+ source: 'injected';
29
+ authorityUrl: '';
30
+ } | {
31
+ source: 'browser';
32
+ authorityUrl: '';
33
+ };
34
+ export declare function resolveStudioConnection(input: {
35
+ explicitAuthority?: string | null;
36
+ configuredAuthority?: string | null;
37
+ injected?: boolean;
38
+ }): StudioConnectionResolution;
39
+ /** A registration proves the application is connected; it does not identify
40
+ * the JavaScript environment in which the application itself executes. */
41
+ export declare function ApplicationConnectionNotice({ registration }: ApplicationConnectionNoticeProps): React.JSX.Element;
19
42
  export declare function StudioApp({ db, remoteUrl, token, namespace, deploymentRuntime, applicationUrl, applicationId, environment, developmentSession, managedPublish, sourceSync, onConnect }: StudioAppProps): React.JSX.Element;
20
43
  export default StudioApp;
21
44
  //# sourceMappingURL=app.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAA8B,MAAM,OAAO,CAAC;AAOnD,OAA4B,EAAE,KAAK,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AACzG,OAAO,EAAa,KAAK,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAqBjF,OAAO,EAAgC,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,WAAW,CAAC;AACnB,OAAO,mCAAmC,CAAC;AAE3C,MAAM,WAAW,cAAc;IAC7B,EAAE,CAAC,EAAE,YAAY,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5C,cAAc,CAAC,EAAE,2BAA2B,CAAC;IAC7C,UAAU,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AAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAClD;AAED,MAAM,WAAW,gCAAgC;IAC/C,YAAY,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACvC;AAED,MAAM,MAAM,0BAA0B,GAClC;IAAE,MAAM,EAAE,oBAAoB,GAAG,sBAAsB,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GAC/E;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,YAAY,EAAE,EAAE,CAAA;CAAE,GACxC;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,YAAY,EAAE,EAAE,CAAA;CAAE,CAAC;AAE5C,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAC7C,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,0BAA0B,CAU7B;AAED;0EAC0E;AAC1E,wBAAgB,2BAA2B,CAAC,EAAE,YAAY,EAAE,EAAE,gCAAgC,qBAM7F;AAiBD,wBAAgB,SAAS,CAAC,EAAE,EAAE,EAAE,SAAc,EAAE,KAAU,EAAE,SAAqB,EAAE,iBAA6B,EAAE,cAAmB,EAAE,aAAkB,EAAE,WAA0B,EAAE,kBAAkB,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,cAAc,qBAyJjQ;AAED,eAAe,SAAS,CAAC"}
@@ -1,5 +1,10 @@
1
1
  import { default as React } from 'react';
2
2
  import { FlowSpec } from '@feltdb/core';
3
+ /** Preserve Studio's connection scope while naming a canonical Data collection. */
4
+ export declare function dataCollectionLocation(search: string, collection: string): {
5
+ pathname: string;
6
+ search: string;
7
+ };
3
8
  export declare function ContractInspector({ model, section }: {
4
9
  model: FlowSpec | null;
5
10
  section: 'schema' | 'policies';
@@ -1 +1 @@
1
- {"version":3,"file":"ContractInspector.d.ts","sourceRoot":"","sources":["../../src/components/ContractInspector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,wBAAgB,iBAAiB,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;IAAE,KAAK,EAAE,QAAQ,GAAG,IAAI,CAAC;IAAC,OAAO,EAAE,QAAQ,GAAC,UAAU,CAAA;CAAE,qBAM7G"}
1
+ {"version":3,"file":"ContractInspector.d.ts","sourceRoot":"","sources":["../../src/components/ContractInspector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,mFAAmF;AACnF,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;;;EAIxE;AAED,wBAAgB,iBAAiB,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;IAAE,KAAK,EAAE,QAAQ,GAAG,IAAI,CAAC;IAAC,OAAO,EAAE,QAAQ,GAAC,UAAU,CAAA;CAAE,qBAM7G"}
@@ -4,8 +4,11 @@ export interface SettingsPanelProps {
4
4
  db?: StateFirstDB;
5
5
  remoteUrl?: string;
6
6
  token?: string;
7
+ applicationUrl?: string;
8
+ feltDBRuntime?: string;
9
+ authorityUrl?: string;
7
10
  onConnect?: (url: string, token: string) => void;
8
11
  }
9
- export declare function SettingsPanel({ db, remoteUrl, token, onConnect }: SettingsPanelProps): React.JSX.Element;
12
+ export declare function SettingsPanel({ db, remoteUrl, token, applicationUrl, feltDBRuntime, authorityUrl, onConnect }: SettingsPanelProps): React.JSX.Element;
10
13
  export default SettingsPanel;
11
14
  //# sourceMappingURL=SettingsPanel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SettingsPanel.d.ts","sourceRoot":"","sources":["../../src/components/SettingsPanel.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAA8B,MAAM,OAAO,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,WAAW,kBAAkB;IACjC,EAAE,CAAC,EAAE,YAAY,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAClD;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,EAAE,SAAc,EAAE,KAAU,EAAE,SAAS,EAAE,EAAE,kBAAkB,qBAmC9F;AAED,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"SettingsPanel.d.ts","sourceRoot":"","sources":["../../src/components/SettingsPanel.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAA8B,MAAM,OAAO,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,WAAW,kBAAkB;IACjC,EAAE,CAAC,EAAE,YAAY,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAClD;AAWD,wBAAgB,aAAa,CAAC,EAAE,EAAE,EAAE,SAAc,EAAE,KAAU,EAAE,cAAmB,EAAE,aAAa,EAAE,YAAiB,EAAE,SAAS,EAAE,EAAE,kBAAkB,qBA8CrJ;AAED,eAAe,aAAa,CAAC"}
@@ -1,4 +1,4 @@
1
- import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, p as f, r as p, s as m, t as h, u as g, v as _, y as v } from "../components-CehkcX_k.js";
2
- import { t as y } from "../KeyManagementPanel-DZuSeWBK.js";
3
- import { ManagedInstancePanel as b } from "./ManagedInstancePanel.js";
4
- export { e as AgentExplorer, l as ApplicationDesigner, f as AskFeltDB, c as CapabilityExplorer, p as ConflictExplorer, g as ContractInspector, v as ExecutionViewer, o as GlobalSearch, h as HealthCenter, y as KeyManagementPanel, b as ManagedInstancePanel, r as ModuleExplorer, t as OperationsExplorer, n as OverviewDashboard, s as PeerMap, i as ProposalBrowser, u as ProvenanceViewer, d as ReferenceExplorer, a as SettingsPanel, m as StateExplorer, _ as WorkflowVisualizer };
1
+ import { _ as e, a as t, b as n, c as r, d as i, f as a, g as o, h as s, i as c, l, m as u, n as d, o as f, p, r as m, s as h, t as g, u as _, v, y } from "../components-CJFgdKG6.js";
2
+ import { t as b } from "../KeyManagementPanel-DZuSeWBK.js";
3
+ import { ManagedInstancePanel as x } from "./ManagedInstancePanel.js";
4
+ export { v as AgentExplorer, s as ApplicationDesigner, u as AskFeltDB, l as CapabilityExplorer, m as ConflictExplorer, _ as ContractInspector, n as ExecutionViewer, o as GlobalSearch, g as HealthCenter, b as KeyManagementPanel, x as ManagedInstancePanel, a as ModuleExplorer, t as OperationsExplorer, r as OverviewDashboard, c as PeerMap, p as ProposalBrowser, d as ProvenanceViewer, f as ReferenceExplorer, e as SettingsPanel, h as StateExplorer, y as WorkflowVisualizer, i as dataCollectionLocation };