@feltdb/core 0.7.3 → 0.8.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 (147) hide show
  1. package/README.md +25 -0
  2. package/dist/application-development.d.ts +78 -0
  3. package/dist/application-development.d.ts.map +1 -0
  4. package/dist/application-development.js +153 -0
  5. package/dist/application-manifest.d.ts +6 -1
  6. package/dist/application-manifest.d.ts.map +1 -1
  7. package/dist/application-manifest.js +10 -3
  8. package/dist/canonical-application.d.ts +27 -0
  9. package/dist/canonical-application.d.ts.map +1 -0
  10. package/dist/canonical-application.js +46 -0
  11. package/dist/cli/ai-model-config.js +97 -0
  12. package/dist/cli/cli.js +1 -1
  13. package/dist/cli/commands.js +664 -120
  14. package/dist/cli/index.js +1 -1
  15. package/dist/cli/managed-environment.js +6 -0
  16. package/dist/cli/managed-project.js +6 -0
  17. package/dist/cli/proposal-client.js +63 -0
  18. package/dist/cli/publish-engine.js +165 -0
  19. package/dist/cli/source-sync.js +183 -0
  20. package/dist/create/cli.js +11 -2
  21. package/dist/create/create.js +38 -16
  22. package/dist/create/managed-account.js +82 -11
  23. package/dist/create/package-versions.js +1 -1
  24. package/dist/create/server-source/crates/feltdb/src/application.rs +41 -1
  25. package/dist/create/server-source/crates/feltdb/src/authority_failover.rs +84 -6
  26. package/dist/create/server-source/crates/feltdb/src/bin/feltdb_node.rs +126 -38
  27. package/dist/create/server-source/crates/feltdb/src/distributed_transactions.rs +72 -34
  28. package/dist/create/server-source/crates/feltdb/src/lib.rs +20 -2
  29. package/dist/create/server-source/crates/feltdb-server/src/app_state.rs +12 -24
  30. package/dist/create/server-source/crates/feltdb-server/src/application_contract.rs +11 -3
  31. package/dist/create/server-source/crates/feltdb-server/src/authenticated_principal.rs +0 -1
  32. package/dist/create/server-source/crates/feltdb-server/src/certification_harness.rs +23 -22
  33. package/dist/create/server-source/crates/feltdb-server/src/delegation_token.rs +5 -15
  34. package/dist/create/server-source/crates/feltdb-server/src/durable_operations.rs +13 -28
  35. package/dist/create/server-source/crates/feltdb-server/src/identity.rs +111 -3
  36. package/dist/create/server-source/crates/feltdb-server/src/key_management.rs +28 -7
  37. package/dist/create/server-source/crates/feltdb-server/src/lib.rs +5 -5
  38. package/dist/create/server-source/crates/feltdb-server/src/main.rs +1960 -143
  39. package/dist/create/server-source/crates/feltdb-server/src/managed_diagnostics.rs +10 -30
  40. package/dist/create/server-source/crates/feltdb-server/src/membership_policy.rs +12 -4
  41. package/dist/create/server-source/crates/feltdb-server/src/request_telemetry.rs +8 -6
  42. package/dist/create/server-source/crates/feltdb-server/src/snapshot_cursor.rs +10 -14
  43. package/dist/create/server-source/crates/feltdb-server/src/tenancy.rs +195 -13
  44. package/dist/create/server-source/crates/feltdb-server/src/tenant_policies.rs +9 -21
  45. package/dist/create/server-source/crates/feltdb-server/src/transaction_idempotency.rs +5 -3
  46. package/dist/create/server-source/crates/feltdb-server/src/transaction_recovery.rs +9 -8
  47. package/dist/create/server-source/crates/feltdb-server/tests/revision_recovery_integration_test.rs +1 -4
  48. package/dist/create/template/default-project/README.md +57 -0
  49. package/dist/create/template/default-project/agents/activity-assistant.ts +18 -0
  50. package/dist/create/template/default-project/agents/project-assistant.ts +19 -0
  51. package/dist/create/template/default-project/capabilities/activity-summary.ts +14 -0
  52. package/dist/create/template/default-project/capabilities/project-search.ts +16 -0
  53. package/dist/create/template/default-project/capabilities/project-summary.ts +15 -0
  54. package/dist/create/template/default-project/feltdb.flow +174 -0
  55. package/dist/create/template/default-project/src/App.tsx +20 -0
  56. package/dist/create/template/default-project/src/context/AuthContext.tsx +27 -0
  57. package/dist/create/template/default-project/src/feltdb.ts +87 -0
  58. package/dist/create/template/default-project/src/index.tsx +14 -0
  59. package/dist/create/template/default-project/src/pages/Activity.tsx +7 -0
  60. package/dist/create/template/default-project/src/pages/Agents.tsx +15 -0
  61. package/dist/create/template/default-project/src/pages/Dashboard.tsx +17 -0
  62. package/dist/create/template/default-project/src/pages/Invitations.tsx +11 -0
  63. package/dist/create/template/default-project/src/pages/Projects.tsx +11 -0
  64. package/dist/create/template/default-project/src/pages/SignIn.tsx +8 -0
  65. package/dist/create/template/default-project/src/pages/SignUp.tsx +8 -0
  66. package/dist/create/template/default-project/src/styles-application.css +21 -0
  67. package/dist/create/template/default-project/src/styles.css +1 -0
  68. package/dist/create/template/default-project/workflows/agent-assisted-summary.ts +1 -0
  69. package/dist/create/template/default-project/workflows/invitation.ts +30 -0
  70. package/dist/create/template/default-project/workflows/project-created.ts +2 -0
  71. package/dist/db.d.ts +49 -1
  72. package/dist/db.d.ts.map +1 -1
  73. package/dist/db.js +77 -0
  74. package/dist/error-codes.d.ts +20 -1
  75. package/dist/error-codes.d.ts.map +1 -1
  76. package/dist/error-codes.js +25 -0
  77. package/dist/flowspec.d.ts +1 -0
  78. package/dist/flowspec.d.ts.map +1 -1
  79. package/dist/flowspec.js +66 -11
  80. package/dist/http-client.d.ts +135 -14
  81. package/dist/http-client.d.ts.map +1 -1
  82. package/dist/http-client.js +79 -31
  83. package/dist/http-db.d.ts +15 -2
  84. package/dist/http-db.d.ts.map +1 -1
  85. package/dist/http-db.js +113 -5
  86. package/dist/index-core.d.ts +5 -0
  87. package/dist/index-core.d.ts.map +1 -1
  88. package/dist/index-core.js +5 -0
  89. package/dist/module-intent.d.ts +37 -0
  90. package/dist/module-intent.d.ts.map +1 -0
  91. package/dist/module-intent.js +81 -0
  92. package/dist/module.d.ts +76 -0
  93. package/dist/module.d.ts.map +1 -0
  94. package/dist/module.js +61 -0
  95. package/dist/proposal.d.ts +161 -0
  96. package/dist/proposal.d.ts.map +1 -0
  97. package/dist/proposal.js +232 -0
  98. package/dist/studio/app.d.ts +5 -1
  99. package/dist/studio/app.d.ts.map +1 -1
  100. package/dist/studio/components/ApplicationDesigner.d.ts +2 -1
  101. package/dist/studio/components/ApplicationDesigner.d.ts.map +1 -1
  102. package/dist/studio/components/AskFeltDB.d.ts +21 -0
  103. package/dist/studio/components/AskFeltDB.d.ts.map +1 -0
  104. package/dist/studio/components/ContractInspector.d.ts +7 -0
  105. package/dist/studio/components/ContractInspector.d.ts.map +1 -0
  106. package/dist/studio/components/ManagedInstancePanel.d.ts.map +1 -1
  107. package/dist/studio/components/ManagedInstancePanel.js +1 -5
  108. package/dist/studio/components/ModuleExplorer.d.ts +6 -0
  109. package/dist/studio/components/ModuleExplorer.d.ts.map +1 -0
  110. package/dist/studio/components/ProposalBrowser.d.ts +12 -0
  111. package/dist/studio/components/ProposalBrowser.d.ts.map +1 -0
  112. package/dist/studio/components/StateExplorer.d.ts +6 -7
  113. package/dist/studio/components/StateExplorer.d.ts.map +1 -1
  114. package/dist/studio/components/index.d.ts +4 -0
  115. package/dist/studio/components/index.d.ts.map +1 -1
  116. package/dist/studio/components/index.js +4 -4
  117. package/dist/studio/components-CNSNrmA9.js +2787 -0
  118. package/dist/studio/index.js +214 -157
  119. package/dist/studio/studio.css +1 -1
  120. package/dist/studio/utils/index.d.ts +2 -0
  121. package/dist/studio/utils/index.d.ts.map +1 -1
  122. package/dist/studio/utils/index.js +14 -12
  123. package/dist/studio/utils/managed-instance.d.ts +0 -4
  124. package/dist/studio/utils/managed-instance.d.ts.map +1 -1
  125. package/dist/studio/utils/managed-instance.js +0 -4
  126. package/dist/studio/utils/proposal-api.d.ts +53 -0
  127. package/dist/studio/utils/proposal-api.d.ts.map +1 -0
  128. package/dist/studio/utils/proposal-api.js +91 -0
  129. package/dist/studio/utils/service-api.d.ts +81 -0
  130. package/dist/studio/utils/service-api.d.ts.map +1 -0
  131. package/dist/studio/utils/service-api.js +51 -0
  132. package/dist/studio-app/assets/dist-CCOk39Uc.js +1 -0
  133. package/dist/studio-app/assets/{feltdb_wasm-DVKsw75S.js → feltdb_wasm-CSB6KVgw.js} +1 -1
  134. package/dist/studio-app/assets/feltdb_wasm_bg-Dd1fnO9U.wasm +0 -0
  135. package/dist/studio-app/assets/index-Bncji3aN.js +43 -0
  136. package/dist/studio-app/assets/{index-C1GWyazR.css → index-yazaWMUN.css} +1 -1
  137. package/dist/studio-app/assets/lib-B2_7fcn7.js +69 -0
  138. package/dist/studio-app/assets/worker-CARZ5g7K.js +69 -0
  139. package/dist/studio-app/index.html +2 -2
  140. package/dist/wasm/feltdb_wasm_bg.wasm +0 -0
  141. package/dist/workspace/local-development-authority.d.ts +3 -0
  142. package/dist/workspace/local-development-authority.d.ts.map +1 -1
  143. package/dist/workspace/local-development-authority.js +124 -2
  144. package/package.json +1 -1
  145. package/dist/studio/components-Dxuhrv8_.js +0 -1832
  146. package/dist/studio-app/assets/feltdb_wasm_bg-DNyNf0yy.wasm +0 -0
  147. package/dist/studio-app/assets/index-B5tnmvSD.js +0 -28
@@ -4,31 +4,152 @@
4
4
  * Provides a simple interface for connecting to and querying remote FeltDB instances.
5
5
  * For applications that only need HTTP access without the full core framework.
6
6
  */
7
+ import type { FeltDBProposalEvent, FeltDBProposalPreviewArtifact, FeltDBProposalRecord, ProposalReadiness, ProposalStatus } from './proposal.js';
8
+ import type { CanonicalQuery, QueryResult, TransactionResult } from './state-contract.js';
7
9
  export interface ClientOptions {
8
10
  url: string;
9
11
  token: string;
12
+ applicationId?: string;
13
+ environment?: string;
14
+ revisionId?: string;
15
+ fetch?: typeof globalThis.fetch;
10
16
  }
11
- export interface RemoteRecord<T> {
12
- id: string;
13
- key: string;
14
- value: T;
15
- version_ms: number;
17
+ export interface ServiceApiErrorBody {
18
+ code?: string;
19
+ error?: string;
20
+ message?: string;
21
+ request_id?: string;
22
+ }
23
+ export declare class FeltDBServiceApiError extends Error {
24
+ readonly code: string;
25
+ readonly status: number;
26
+ readonly requestId?: string | undefined;
27
+ constructor(code: string, message: string, status: number, requestId?: string | undefined);
28
+ }
29
+ export interface ApplicationInspection {
30
+ application_id: string;
31
+ application_name?: string;
32
+ environment: string;
33
+ version: number;
34
+ revision_id: string;
35
+ contract_hash: string;
36
+ flow_hash?: string;
37
+ snapshot: Record<string, unknown>;
38
+ }
39
+ export interface ApplicationSchemaInspection {
40
+ application: {
41
+ application_id: string;
42
+ environment: string;
43
+ };
44
+ contract_version: number;
45
+ collections: Array<{
46
+ collection: string;
47
+ fields: Array<{
48
+ name: string;
49
+ type: string;
50
+ required?: boolean;
51
+ reference?: string;
52
+ }>;
53
+ relationships: unknown[];
54
+ }>;
55
+ }
56
+ export interface InspectionPage<T> {
57
+ collection: string;
58
+ records: T[];
59
+ pagination: {
60
+ limit: number;
61
+ nextCursor: string | null;
62
+ };
63
+ state_version: number;
64
+ }
65
+ export interface InspectionRecord<T> {
66
+ collection: string;
67
+ record: T;
68
+ relationships: unknown[];
16
69
  }
17
70
  export declare class FeltDBClient {
18
71
  private readonly url;
19
72
  private readonly token;
73
+ private readonly applicationId?;
74
+ private readonly environment;
75
+ private readonly fetcher;
76
+ private revisionId?;
20
77
  constructor(options: ClientOptions);
21
78
  private headers;
22
79
  private request;
23
- runtime(): Promise<Record<string, unknown>>;
24
- list<T>(collection: string): Promise<Array<RemoteRecord<T>>>;
25
- get<T>(collection: string, id: string | number): Promise<RemoteRecord<T>>;
26
- insert<T extends object>(collection: string, value: T, id?: string | number): Promise<RemoteRecord<T>>;
27
- update<T extends object>(collection: string, id: string | number, changes: Partial<T>): Promise<RemoteRecord<T>>;
28
- delete(collection: string, id: string | number): Promise<void>;
29
- getInfo(): {
30
- runtime: 'remote';
31
- url: string;
80
+ private scoped;
81
+ private scopeBody;
82
+ private activeRevision;
83
+ /** Canonical application Contract Snapshot and schema inspection. */
84
+ readonly application: {
85
+ get: () => Promise<ApplicationInspection>;
86
+ schema: () => Promise<ApplicationSchemaInspection>;
87
+ };
88
+ /** Bounded, authorized application-state inspection. Cursors remain opaque. */
89
+ readonly data: {
90
+ list: <T = Record<string, unknown>>(collection: string, options?: {
91
+ limit?: number;
92
+ cursor?: string;
93
+ filters?: Record<string, string>;
94
+ }) => Promise<InspectionPage<T>>;
95
+ get: <T = Record<string, unknown>>(collection: string, id: string) => Promise<InspectionRecord<T>>;
96
+ };
97
+ /** Canonical application queries and atomic transactions against the active revision. */
98
+ readonly state: {
99
+ query: <T = Record<string, unknown>>(query: CanonicalQuery) => Promise<QueryResult<T>>;
100
+ transaction: (transaction: Record<string, unknown>) => Promise<TransactionResult>;
101
+ version: () => Promise<{
102
+ state_version: number;
103
+ }>;
104
+ };
105
+ /** Public contract-declared application capability invocation. */
106
+ readonly capabilities: {
107
+ run: (name: string, input: unknown) => Promise<unknown>;
108
+ };
109
+ /** Canonical Proposal lifecycle. Repository application is intentionally absent. */
110
+ readonly proposals: {
111
+ create: (proposal: {
112
+ base_contract_hash: string;
113
+ base_flow_hash: string;
114
+ proposed_flow: string;
115
+ summary: string;
116
+ warnings?: string[];
117
+ metadata?: Record<string, string>;
118
+ parent_proposal_id?: string;
119
+ expires_at?: string | number;
120
+ }) => Promise<FeltDBProposalRecord>;
121
+ list: (options?: {
122
+ status?: ProposalStatus;
123
+ limit?: number;
124
+ cursor?: string;
125
+ }) => Promise<{
126
+ proposals: FeltDBProposalRecord[];
127
+ pagination: {
128
+ limit: number;
129
+ nextCursor: string | null;
130
+ };
131
+ }>;
132
+ get: (id: string) => Promise<FeltDBProposalRecord>;
133
+ history: (id: string) => Promise<{
134
+ events: FeltDBProposalEvent[];
135
+ }>;
136
+ status: (id: string) => Promise<ProposalReadiness>;
137
+ validate: (id: string, proposedManifest?: unknown) => Promise<FeltDBProposalRecord>;
138
+ createPreview: (id: string) => Promise<FeltDBProposalPreviewArtifact>;
139
+ preview: (previewId: string) => Promise<FeltDBProposalPreviewArtifact>;
140
+ previewData: <T = Record<string, unknown>>(previewId: string, collection: string, options?: {
141
+ limit?: number;
142
+ cursor?: string;
143
+ }) => Promise<InspectionPage<T>>;
144
+ simulatePreview: (previewId: string, event: string) => Promise<{
145
+ preview_id: string;
146
+ event: string;
147
+ status: "simulated";
148
+ external_side_effects: "none";
149
+ trace: string[];
150
+ }>;
151
+ approve: (id: string, approveAuthorization?: boolean) => Promise<FeltDBProposalRecord>;
152
+ reject: (id: string, reason?: string) => Promise<FeltDBProposalRecord>;
32
153
  };
33
154
  }
34
155
  export declare function createClient(options: ClientOptions): FeltDBClient;
@@ -1 +1 @@
1
- {"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../src/http-client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,CAAC,CAAC;IACT,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;gBAEnB,OAAO,EAAE,aAAa;IAMlC,OAAO,CAAC,OAAO;YAQD,OAAO;IAgBrB,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAI3C,IAAI,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;IAI5D,GAAG,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAIzE,MAAM,CAAC,CAAC,SAAS,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAOtG,MAAM,CAAC,CAAC,SAAS,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAA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E;yBACpN;YAAE,MAAM,CAAC,EAAE,cAAc,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE;uBAAoC,oBAAoB,EAAE;wBAAc;gBAAE,KAAK,EAAE,MAAM,CAAC;gBAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;aAAE;;kBACtL,MAAM;sBACF,MAAM;oBAA4B,mBAAmB,EAAE;;qBACxD,MAAM;uBACJ,MAAM,qBAAqB,OAAO;4BAC7B,MAAM;6BACL,MAAM;sBACb,CAAC,uCAAuC,MAAM,cAAc,MAAM,YAAW;YAAE,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE;qCACjG,MAAM,SAAS,MAAM;wBAAgC,MAAM;mBAAS,MAAM;oBAAU,WAAW;mCAAyB,MAAM;mBAAS,MAAM,EAAE;;sBAC9J,MAAM;qBACP,MAAM,WAAW,MAAM;MACpC;CAEH;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,aAAa,GAAG,YAAY,CAEjE"}
@@ -4,14 +4,33 @@
4
4
  * Provides a simple interface for connecting to and querying remote FeltDB instances.
5
5
  * For applications that only need HTTP access without the full core framework.
6
6
  */
7
+ export class FeltDBServiceApiError extends Error {
8
+ code;
9
+ status;
10
+ requestId;
11
+ constructor(code, message, status, requestId) {
12
+ super(message);
13
+ this.code = code;
14
+ this.status = status;
15
+ this.requestId = requestId;
16
+ }
17
+ }
7
18
  export class FeltDBClient {
8
19
  url;
9
20
  token;
21
+ applicationId;
22
+ environment;
23
+ fetcher;
24
+ revisionId;
10
25
  constructor(options) {
11
26
  if (!options.url || !options.token)
12
27
  throw new Error('FeltDBClient requires url and token');
13
28
  this.url = options.url.replace(/\/$/, '');
14
29
  this.token = options.token;
30
+ this.applicationId = options.applicationId;
31
+ this.environment = options.environment || 'production';
32
+ this.fetcher = options.fetch ?? globalThis.fetch.bind(globalThis);
33
+ this.revisionId = options.revisionId;
15
34
  }
16
35
  headers(json = false) {
17
36
  return {
@@ -21,51 +40,80 @@ export class FeltDBClient {
21
40
  };
22
41
  }
23
42
  async request(path, init = {}) {
24
- const response = await fetch(`${this.url}${path}`, {
43
+ const response = await this.fetcher(`${this.url}${path}`, {
25
44
  ...init,
26
45
  headers: { ...this.headers(init.body !== undefined), ...init.headers },
27
46
  });
28
47
  if (!response.ok) {
29
48
  let message = `FeltDB request failed: HTTP ${response.status}`;
49
+ let body = {};
30
50
  try {
31
- const body = await response.json();
32
- if (body.error)
33
- message = body.error;
51
+ body = await response.json();
34
52
  }
35
53
  catch { /* non-JSON error */ }
36
- throw new Error(message);
54
+ if (body.message || body.error)
55
+ message = body.message || body.error || message;
56
+ throw new FeltDBServiceApiError(body.code || body.error || 'REQUEST_FAILED', message, response.status, body.request_id);
37
57
  }
38
58
  return (response.status === 204 ? undefined : response.json());
39
59
  }
40
- runtime() {
41
- return this.request('/runtime');
42
- }
43
- list(collection) {
44
- return this.request(`/collections/${encodeURIComponent(collection)}`);
60
+ scoped(path, query = {}) {
61
+ if (!this.applicationId)
62
+ throw new Error('This Service API operation requires createClient({ applicationId })');
63
+ const separator = path.includes('?') ? '&' : '?';
64
+ const parameters = new URLSearchParams({ application_id: this.applicationId, environment: this.environment });
65
+ for (const [name, value] of Object.entries(query))
66
+ if (value !== undefined && value !== '')
67
+ parameters.set(name, String(value));
68
+ return `${path}${separator}${parameters}`;
45
69
  }
46
- get(collection, id) {
47
- return this.request(`/collections/${encodeURIComponent(collection)}/${encodeURIComponent(String(id))}`);
48
- }
49
- insert(collection, value, id) {
50
- return this.request(`/collections/${encodeURIComponent(collection)}`, {
51
- method: 'POST',
52
- body: JSON.stringify(id === undefined ? value : { ...value, id }),
53
- });
54
- }
55
- update(collection, id, changes) {
56
- return this.request(`/collections/${encodeURIComponent(collection)}/${encodeURIComponent(String(id))}`, {
57
- method: 'PATCH',
58
- body: JSON.stringify(changes),
59
- });
60
- }
61
- delete(collection, id) {
62
- return this.request(`/collections/${encodeURIComponent(collection)}/${encodeURIComponent(String(id))}`, {
63
- method: 'DELETE',
64
- });
70
+ scopeBody(value = {}) {
71
+ if (!this.applicationId)
72
+ throw new Error('This Service API operation requires createClient({ applicationId })');
73
+ return { application_id: this.applicationId, environment: this.environment, ...value };
65
74
  }
66
- getInfo() {
67
- return { runtime: 'remote', url: this.url };
75
+ async activeRevision() {
76
+ if (this.revisionId)
77
+ return this.revisionId;
78
+ const application = await this.application.get();
79
+ this.revisionId = application.revision_id;
80
+ return application.revision_id;
68
81
  }
82
+ /** Canonical application Contract Snapshot and schema inspection. */
83
+ application = {
84
+ get: () => this.request(this.scoped('/v1/application')),
85
+ schema: () => this.request(this.scoped('/v1/application/schema')),
86
+ };
87
+ /** Bounded, authorized application-state inspection. Cursors remain opaque. */
88
+ data = {
89
+ list: (collection, options = {}) => this.request(this.scoped(`/v1/data/${encodeURIComponent(collection)}`, { limit: options.limit, cursor: options.cursor, ...options.filters })),
90
+ get: (collection, id) => this.request(this.scoped(`/v1/data/${encodeURIComponent(collection)}/${encodeURIComponent(id)}`)),
91
+ };
92
+ /** Canonical application queries and atomic transactions against the active revision. */
93
+ state = {
94
+ query: async (query) => this.request('/v1/query', { method: 'POST', body: JSON.stringify({ ...this.scopeBody(), revision_id: await this.activeRevision(), query }) }),
95
+ transaction: async (transaction) => this.request('/v1/transactions', { method: 'POST', body: JSON.stringify({ ...this.scopeBody(), revision_id: await this.activeRevision(), transaction }) }),
96
+ version: async () => this.request(this.scoped('/v1/state/version', { revision_id: await this.activeRevision() })),
97
+ };
98
+ /** Public contract-declared application capability invocation. */
99
+ capabilities = {
100
+ run: (name, input) => this.request(this.scoped(`/v1/capabilities/${encodeURIComponent(name)}/run`), { method: 'POST', body: JSON.stringify(input) }),
101
+ };
102
+ /** Canonical Proposal lifecycle. Repository application is intentionally absent. */
103
+ proposals = {
104
+ create: (proposal) => this.request('/v1/proposals', { method: 'POST', body: JSON.stringify(this.scopeBody(proposal)) }),
105
+ list: (options = {}) => this.request(this.scoped('/v1/proposals', options)),
106
+ get: (id) => this.request(this.scoped(`/v1/proposals/${encodeURIComponent(id)}`)),
107
+ history: (id) => this.request(this.scoped(`/v1/proposals/${encodeURIComponent(id)}/history`)),
108
+ status: (id) => this.request(this.scoped(`/v1/proposals/${encodeURIComponent(id)}/status`)),
109
+ validate: (id, proposedManifest) => this.request(`/v1/proposals/${encodeURIComponent(id)}/validate`, { method: 'POST', body: JSON.stringify(this.scopeBody({ proposed_manifest: proposedManifest })) }),
110
+ createPreview: (id) => this.request(`/v1/proposals/${encodeURIComponent(id)}/preview`, { method: 'POST', body: JSON.stringify(this.scopeBody()) }),
111
+ preview: (previewId) => this.request(this.scoped(`/v1/previews/${encodeURIComponent(previewId)}`)),
112
+ previewData: (previewId, collection, options = {}) => this.request(this.scoped(`/v1/previews/${encodeURIComponent(previewId)}/data/${encodeURIComponent(collection)}`, options)),
113
+ simulatePreview: (previewId, event) => this.request(this.scoped(`/v1/previews/${encodeURIComponent(previewId)}/simulate`), { method: 'POST', body: JSON.stringify({ event }) }),
114
+ approve: (id, approveAuthorization = false) => this.request(`/v1/proposals/${encodeURIComponent(id)}/approve`, { method: 'POST', body: JSON.stringify(this.scopeBody({ approve_authorization: approveAuthorization })) }),
115
+ reject: (id, reason) => this.request(`/v1/proposals/${encodeURIComponent(id)}/reject`, { method: 'POST', body: JSON.stringify(this.scopeBody({ reason })) }),
116
+ };
69
117
  }
70
118
  export function createClient(options) {
71
119
  return new FeltDBClient(options);
package/dist/http-db.d.ts CHANGED
@@ -7,7 +7,9 @@ interface JsResult {
7
7
  }
8
8
  interface HttpRuntimeOptions {
9
9
  url: string;
10
- token: string;
10
+ token?: string;
11
+ applicationId?: string;
12
+ environment?: string;
11
13
  }
12
14
  export interface AuthorityQueryRequest {
13
15
  collection: string;
@@ -35,10 +37,20 @@ export interface AuthorityQueryPage<T = Record<string, unknown>> {
35
37
  /** Network adapter implementing the same collection runtime contract as WASM. */
36
38
  export declare class HttpJsDb implements JsDb {
37
39
  private readonly url;
38
- private readonly token;
40
+ private token;
41
+ private readonly applicationId?;
42
+ private readonly environment;
43
+ private activeRevision?;
39
44
  constructor(options: HttpRuntimeOptions);
40
45
  private headers;
46
+ auth_request<T extends {
47
+ access_token?: string;
48
+ }>(operation: 'signup' | 'signin' | 'signout' | 'session', body?: unknown): Promise<T>;
41
49
  private splitKey;
50
+ private revisionId;
51
+ private canonical;
52
+ private transactionDocument;
53
+ private canonicalTransaction;
42
54
  get(key: string): Promise<JsResult>;
43
55
  query(collection: string): Promise<JsResult>;
44
56
  authority_query<T = Record<string, unknown>>(query: AuthorityQueryRequest): Promise<AuthorityQueryPage<T>>;
@@ -102,6 +114,7 @@ export declare class HttpJsDb implements JsDb {
102
114
  }>;
103
115
  acquireContent(hash: string): Promise<Uint8Array | null>;
104
116
  command(path: string, body: unknown): Promise<any>;
117
+ application_request<T>(path: string, init?: RequestInit): Promise<T>;
105
118
  subscribe_changes(callback: (collection: string) => void): () => void;
106
119
  private consumeEvents;
107
120
  private failure;
@@ -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,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAEpE,UAAU,QAAQ;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,kBAAkB;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,EAAE,CAAC,EAAE,OA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ChC,2BAA2B,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,18 +1,39 @@
1
+ import { FeltDBServiceError } from './error-codes.js';
1
2
  /** Network adapter implementing the same collection runtime contract as WASM. */
2
3
  export class HttpJsDb {
3
4
  url;
4
5
  token;
6
+ applicationId;
7
+ environment;
8
+ activeRevision;
5
9
  constructor(options) {
6
10
  this.url = options.url.replace(/\/$/, '');
7
- this.token = options.token;
11
+ this.token = options.token || '';
12
+ this.applicationId = options.applicationId;
13
+ this.environment = options.environment || 'production';
8
14
  }
9
15
  headers(json = false) {
10
16
  return {
11
- Authorization: `Bearer ${this.token}`,
17
+ ...(this.token ? { Authorization: `Bearer ${this.token}` } : {}),
12
18
  'FeltDB-Protocol': '1',
13
19
  ...(json ? { 'Content-Type': 'application/json' } : {}),
14
20
  };
15
21
  }
22
+ async auth_request(operation, body) {
23
+ const response = await fetch(`${this.url}/v1/auth/${operation}`, {
24
+ method: operation === 'session' ? 'GET' : 'POST',
25
+ headers: this.headers(body !== undefined),
26
+ ...(body !== undefined ? { body: JSON.stringify(operation === 'signup' ? { application_id: this.applicationId, ...body } : body) } : {}),
27
+ });
28
+ const value = response.status === 204 ? {} : await response.json();
29
+ if (!response.ok)
30
+ throw new FeltDBServiceError(value.message || value.error || 'Authentication failed', value.code || value.error || 'AUTHENTICATION_FAILED', value.request_id, response.status);
31
+ if (value.access_token)
32
+ this.token = value.access_token;
33
+ if (operation === 'signout')
34
+ this.token = '';
35
+ return value;
36
+ }
16
37
  splitKey(key) {
17
38
  const separator = key.indexOf(':');
18
39
  if (separator < 1 || separator === key.length - 1) {
@@ -20,9 +41,33 @@ export class HttpJsDb {
20
41
  }
21
42
  return [key.slice(0, separator), key.slice(separator + 1)];
22
43
  }
44
+ async revisionId() {
45
+ if (!this.applicationId)
46
+ throw new Error('applicationId is required for the canonical application service');
47
+ this.activeRevision ??= this.application_request('/application').then(value => value.revision_id);
48
+ return this.activeRevision;
49
+ }
50
+ async canonical(path, payload) {
51
+ const revisionId = await this.revisionId();
52
+ return this.application_request(path, { method: 'POST', body: JSON.stringify({
53
+ application_id: this.applicationId, revision_id: revisionId, environment: this.environment, ...payload,
54
+ }) });
55
+ }
56
+ transactionDocument(revisionId, operations, transactionId = crypto.randomUUID()) {
57
+ return { transaction_id: transactionId, tenant_id: '', application_id: this.applicationId, revision_id: revisionId, schema_version: 0,
58
+ authorization: { subject: '', tenant_id: '', application_id: this.applicationId, revision_id: revisionId, capabilities: [] }, operations };
59
+ }
60
+ async canonicalTransaction(operations, transactionId) {
61
+ const revisionId = await this.revisionId();
62
+ return this.application_request('/transactions', { method: 'POST', body: JSON.stringify({ application_id: this.applicationId, revision_id: revisionId, environment: this.environment, transaction: this.transactionDocument(revisionId, operations, transactionId) }) });
63
+ }
23
64
  async get(key) {
24
65
  try {
25
66
  const [collection, id] = this.splitKey(key);
67
+ if (this.applicationId) {
68
+ const result = await this.canonical('/query', { query: { collection, filter: { operator: 'eq', field: 'id', value: id }, limit: 1 } });
69
+ return { success: true, data: result.records.length ? JSON.stringify(result.records[0]) : undefined };
70
+ }
26
71
  const response = await fetch(`${this.url}/collections/${encodeURIComponent(collection)}/${encodeURIComponent(id)}`, {
27
72
  headers: this.headers(),
28
73
  });
@@ -39,6 +84,10 @@ export class HttpJsDb {
39
84
  }
40
85
  async query(collection) {
41
86
  try {
87
+ if (this.applicationId) {
88
+ const result = await this.canonical('/query', { query: { collection, limit: 500 } });
89
+ return { success: true, data: JSON.stringify(result.records) };
90
+ }
42
91
  const response = await fetch(`${this.url}/collections/${encodeURIComponent(collection)}`, {
43
92
  headers: this.headers(),
44
93
  });
@@ -52,6 +101,20 @@ export class HttpJsDb {
52
101
  }
53
102
  }
54
103
  async authority_query(query) {
104
+ if (this.applicationId) {
105
+ const conditions = query.where || [];
106
+ const filters = conditions.map(condition => {
107
+ const operator = Object.keys(condition).find(key => key !== 'field') || 'eq';
108
+ return { operator, field: condition.field, value: condition[operator] };
109
+ });
110
+ const result = await this.canonical('/query', { query: {
111
+ collection: query.collection,
112
+ filter: filters.length === 1 ? filters[0] : filters.length ? { operator: 'and', filters } : undefined,
113
+ order_by: query.orderBy?.map(value => ({ field: value.field, direction: value.direction })),
114
+ limit: query.limit, cursor: query.cursor,
115
+ } });
116
+ return { records: result.records, nextCursor: result.next_cursor, exhausted: !result.next_cursor };
117
+ }
55
118
  const response = await fetch(`${this.url}/query`, {
56
119
  method: 'POST', headers: this.headers(true), body: JSON.stringify(query),
57
120
  });
@@ -68,6 +131,10 @@ export class HttpJsDb {
68
131
  try {
69
132
  const [collection, id] = this.splitKey(key);
70
133
  const record = JSON.parse(value);
134
+ if (this.applicationId) {
135
+ await this.canonicalTransaction([{ kind: 'insert', collection, id, value: record }]);
136
+ return { success: true, data: key };
137
+ }
71
138
  const response = await fetch(`${this.url}/collections/${encodeURIComponent(collection)}`, {
72
139
  method: 'POST',
73
140
  headers: this.headers(true),
@@ -84,6 +151,10 @@ export class HttpJsDb {
84
151
  async update(key, value) {
85
152
  try {
86
153
  const [collection, id] = this.splitKey(key);
154
+ if (this.applicationId) {
155
+ await this.canonicalTransaction([{ kind: 'update', collection, id, value: JSON.parse(value) }]);
156
+ return { success: true, data: key };
157
+ }
87
158
  const response = await fetch(`${this.url}/collections/${encodeURIComponent(collection)}/${encodeURIComponent(id)}`, {
88
159
  method: 'PATCH',
89
160
  headers: this.headers(true),
@@ -104,6 +175,16 @@ export class HttpJsDb {
104
175
  * durable record on the server. A refusal means nothing was applied.
105
176
  */
106
177
  async commit_transaction(request) {
178
+ if (this.applicationId) {
179
+ if (request.preconditions?.length)
180
+ throw new Error('record preconditions are not representable by the canonical transaction contract');
181
+ const operations = request.operations.map(operation => ({
182
+ kind: operation.value === undefined ? 'delete' : operation.requireAbsent ? 'insert' : 'update',
183
+ collection: operation.collection, id: operation.id, value: operation.value, if_version: operation.expectedVersion,
184
+ }));
185
+ const result = await this.canonicalTransaction(operations, request.transactionId);
186
+ return { transactionId: result.transaction_id, duplicate: result.duplicate, operations: operations.length, stateBefore: result.state_before, stateAfter: result.state_after };
187
+ }
107
188
  const response = await fetch(`${this.url}/transactions`, {
108
189
  method: 'POST',
109
190
  headers: this.headers(true),
@@ -174,6 +255,10 @@ export class HttpJsDb {
174
255
  async delete(key) {
175
256
  try {
176
257
  const [collection, id] = this.splitKey(key);
258
+ if (this.applicationId) {
259
+ await this.canonicalTransaction([{ kind: 'delete', collection, id }]);
260
+ return { success: true, data: key };
261
+ }
177
262
  const response = await fetch(`${this.url}/collections/${encodeURIComponent(collection)}/${encodeURIComponent(id)}`, {
178
263
  method: 'DELETE',
179
264
  headers: this.headers(),
@@ -230,6 +315,28 @@ export class HttpJsDb {
230
315
  throw new Error((await this.failure(response)).error);
231
316
  return response.status === 204 ? undefined : response.json();
232
317
  }
318
+ async application_request(path, init = {}) {
319
+ const separator = path.includes('?') ? '&' : '?';
320
+ const context = this.applicationId
321
+ ? `${separator}application_id=${encodeURIComponent(this.applicationId)}&environment=${encodeURIComponent(this.environment)}`
322
+ : '';
323
+ const response = await fetch(`${this.url}/v1${path}${context}`, {
324
+ ...init,
325
+ headers: { ...this.headers(init.body !== undefined), ...(init.headers || {}) },
326
+ });
327
+ const text = await response.text();
328
+ let body;
329
+ try {
330
+ body = text ? JSON.parse(text) : undefined;
331
+ }
332
+ catch {
333
+ body = { message: text };
334
+ }
335
+ if (!response.ok) {
336
+ throw new FeltDBServiceError(body?.message || body?.error || `FeltDB service request failed: HTTP ${response.status}`, body?.code || body?.error || 'REQUEST_FAILED', body?.request_id, response.status);
337
+ }
338
+ return body;
339
+ }
233
340
  subscribe_changes(callback) {
234
341
  const controller = new AbortController();
235
342
  void this.consumeEvents(controller, callback);
@@ -238,7 +345,8 @@ export class HttpJsDb {
238
345
  async consumeEvents(controller, callback) {
239
346
  while (!controller.signal.aborted) {
240
347
  try {
241
- const response = await fetch(`${this.url}/events`, {
348
+ const eventPath = this.applicationId ? `/v1/events?application_id=${encodeURIComponent(this.applicationId)}&environment=${encodeURIComponent(this.environment)}` : '/events';
349
+ const response = await fetch(`${this.url}${eventPath}`, {
242
350
  headers: this.headers(),
243
351
  signal: controller.signal,
244
352
  });
@@ -259,8 +367,8 @@ export class HttpJsDb {
259
367
  if (!data)
260
368
  continue;
261
369
  const event = JSON.parse(data);
262
- if (event.change?.capability)
263
- callback(event.change.capability);
370
+ if (event.resource)
371
+ callback(event.resource);
264
372
  }
265
373
  }
266
374
  }
@@ -52,6 +52,11 @@ export * from './provider.js';
52
52
  export * from './identity.js';
53
53
  export * from './development-runtime-bridge.js';
54
54
  export * from './application-contract.js';
55
+ export * from './canonical-application.js';
56
+ export * from './application-development.js';
57
+ export * from './proposal.js';
58
+ export * from './module.js';
59
+ export * from './module-intent.js';
55
60
  export { ProtocolHandler, type Message, type Operation as ProtocolOperation, type Response as ProtocolResponse, } from './protocol.js';
56
61
  /**
57
62
  * Agent Runtime APIs
@@ -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,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,EA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B,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,iCAAiC,CAAC;AAChD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,OAAO,EACL,eAAe,EACf,KAAK,OAAO,EACZ,KAAK,SAAS,IAAI,iBAAiB,EACnC,KAAK,QAAQ,IAAI,gBAAgB,GAClC,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AAEnC;;GAEG;AACH,OAAO,EAAE,aAAa,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"}
@@ -51,6 +51,11 @@ export * from './provider.js';
51
51
  export * from './identity.js';
52
52
  export * from './development-runtime-bridge.js';
53
53
  export * from './application-contract.js';
54
+ export * from './canonical-application.js';
55
+ export * from './application-development.js';
56
+ export * from './proposal.js';
57
+ export * from './module.js';
58
+ export * from './module-intent.js';
54
59
  export { ProtocolHandler, } from './protocol.js';
55
60
  /**
56
61
  * Agent Runtime APIs