@feltdb/core 0.5.7 → 0.6.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.
- package/dist/cli/commands.js +68 -1
- package/dist/cli/workspace-integration.js +96 -0
- package/dist/create/cli.js +1 -1
- package/dist/create/create.js +21 -0
- package/dist/create/package-versions.js +1 -1
- package/dist/create/server-source/Cargo.lock +10 -0
- package/dist/create/server-source/crates/feltdb-server/Cargo.toml +1 -0
- package/dist/create/server-source/crates/feltdb-server/src/app_state.rs +5 -1
- package/dist/create/server-source/crates/feltdb-server/src/authenticated_principal.rs +273 -0
- package/dist/create/server-source/crates/feltdb-server/src/certification_harness.rs +528 -0
- package/dist/create/server-source/crates/feltdb-server/src/delegation_token.rs +472 -0
- package/dist/create/server-source/crates/feltdb-server/src/durable_operations.rs +992 -0
- package/dist/create/server-source/crates/feltdb-server/src/lib.rs +9 -0
- package/dist/create/server-source/crates/feltdb-server/src/main.rs +157 -9
- package/dist/create/server-source/crates/feltdb-server/src/managed_diagnostics.rs +413 -0
- package/dist/create/server-source/crates/feltdb-server/src/membership_policy.rs +488 -0
- package/dist/create/server-source/crates/feltdb-server/src/snapshot_cursor.rs +378 -0
- package/dist/create/server-source/crates/feltdb-server/src/tenancy.rs +49 -0
- package/dist/create/server-source/crates/feltdb-server/src/tenant_policies.rs +525 -0
- package/dist/create/server-source/crates/feltdb-server/src/transaction_recovery.rs +461 -0
- package/dist/create/template/dot-feltdb-README.md +58 -0
- package/dist/create/workspace-initialization.js +77 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/studio-app/assets/{feltdb_wasm-h9mxesnH.js → feltdb_wasm-B4wq4mqp.js} +1 -1
- package/dist/studio-app/assets/feltdb_wasm_bg-Ceyi7l21.wasm +0 -0
- package/dist/studio-app/assets/{index-B_EMnTaE.js → index-LQmvJSq6.js} +2 -2
- package/dist/studio-app/index.html +1 -1
- package/dist/telemetry.js +1 -1
- package/dist/wasm/feltdb_wasm_bg.wasm +0 -0
- package/dist/workspace/development-node.d.ts +42 -0
- package/dist/workspace/development-node.d.ts.map +1 -0
- package/dist/workspace/development-node.js +208 -0
- package/dist/workspace/index.d.ts +20 -0
- package/dist/workspace/index.d.ts.map +1 -0
- package/dist/workspace/index.js +16 -0
- package/dist/workspace/workspace-connection.d.ts +174 -0
- package/dist/workspace/workspace-connection.d.ts.map +1 -0
- package/dist/workspace/workspace-connection.js +290 -0
- package/dist/workspace/workspace-identity.d.ts +13 -0
- package/dist/workspace/workspace-identity.d.ts.map +1 -0
- package/dist/workspace/workspace-identity.js +70 -0
- package/dist/workspace/workspace-types.d.ts +82 -0
- package/dist/workspace/workspace-types.d.ts.map +1 -0
- package/dist/workspace/workspace-types.js +7 -0
- package/package.json +5 -1
- package/dist/studio-app/assets/feltdb_wasm_bg-B8U4A1n1.wasm +0 -0
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Development Workspace Connection
|
|
3
|
+
*
|
|
4
|
+
* Public API for clients (browser, IDE, agent) to discover and connect
|
|
5
|
+
* to a FeltDB Development Workspace.
|
|
6
|
+
*/
|
|
7
|
+
import fs from 'fs';
|
|
8
|
+
import path from 'path';
|
|
9
|
+
/**
|
|
10
|
+
* Discover workspace from .feltdb/workspace.json
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
* ```
|
|
14
|
+
* const workspace = await discoverDevelopmentWorkspace({
|
|
15
|
+
* projectDir: process.cwd()
|
|
16
|
+
* })
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export async function discoverDevelopmentWorkspace(options) {
|
|
20
|
+
const workspacePath = path.join(options.projectDir, '.feltdb', 'workspace.json');
|
|
21
|
+
if (!fs.existsSync(workspacePath)) {
|
|
22
|
+
throw new Error(`Development Workspace not found at ${workspacePath}. Run "feltdb dev" or create-feltdb to initialize.`);
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
const content = fs.readFileSync(workspacePath, 'utf-8');
|
|
26
|
+
const workspace = JSON.parse(content);
|
|
27
|
+
return workspace;
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
throw new Error(`Failed to read workspace metadata: ${error instanceof Error ? error.message : String(error)}`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Resolve pairing code to workspace ID
|
|
35
|
+
*
|
|
36
|
+
* Pairing codes are short-lived tokens (FELT-XXXX) that resolve to
|
|
37
|
+
* workspace IDs. They expire after 15 minutes.
|
|
38
|
+
*
|
|
39
|
+
* Used by clients to auto-discover workspace without manual entry.
|
|
40
|
+
*/
|
|
41
|
+
export async function resolvePairingCode(pairingCode, projectDir) {
|
|
42
|
+
if (!pairingCode.startsWith('FELT-')) {
|
|
43
|
+
throw new Error('Invalid pairing code format');
|
|
44
|
+
}
|
|
45
|
+
// When projectDir is provided, try local resolution first
|
|
46
|
+
if (projectDir) {
|
|
47
|
+
const pairingPath = path.join(projectDir, '.feltdb', 'pairing.json');
|
|
48
|
+
if (fs.existsSync(pairingPath)) {
|
|
49
|
+
try {
|
|
50
|
+
const content = fs.readFileSync(pairingPath, 'utf-8');
|
|
51
|
+
const pairing = JSON.parse(content);
|
|
52
|
+
if (pairing.token === pairingCode && Date.now() < pairing.expiresAt) {
|
|
53
|
+
return pairing.workspaceId;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
// Fall through to error
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
throw new Error(`Pairing code ${pairingCode} not found or expired. Ensure "feltdb dev" is running and the code is correct.`);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Connect to a Development Workspace
|
|
65
|
+
*
|
|
66
|
+
* Canonical API for clients to establish connection to shared workspace.
|
|
67
|
+
*
|
|
68
|
+
* Usage via pairing code (browser/IDE discovery):
|
|
69
|
+
* ```
|
|
70
|
+
* const workspace = await connectDevelopmentWorkspace({
|
|
71
|
+
* pairingCode: "FELT-7K3P",
|
|
72
|
+
* clientId: "vscode-randy",
|
|
73
|
+
* clientType: "ide"
|
|
74
|
+
* })
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* Usage via workspace ID (agent/CLI):
|
|
78
|
+
* ```
|
|
79
|
+
* const workspace = await connectDevelopmentWorkspace({
|
|
80
|
+
* workspaceId: "ws_myapp_1234567890_abc123",
|
|
81
|
+
* projectDir: process.cwd(),
|
|
82
|
+
* clientId: "claude-code",
|
|
83
|
+
* clientType: "agent"
|
|
84
|
+
* })
|
|
85
|
+
* ```
|
|
86
|
+
*
|
|
87
|
+
* Usage via endpoint (remote connection):
|
|
88
|
+
* ```
|
|
89
|
+
* const workspace = await connectDevelopmentWorkspace({
|
|
90
|
+
* workspaceId: "ws_...",
|
|
91
|
+
* endpoint: "http://localhost:7700",
|
|
92
|
+
* auth: { token: "..." }
|
|
93
|
+
* })
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
export async function connectDevelopmentWorkspace(options) {
|
|
97
|
+
let workspaceId = options.workspaceId;
|
|
98
|
+
// Resolve pairing code to workspace ID if provided
|
|
99
|
+
if (options.pairingCode && !workspaceId) {
|
|
100
|
+
workspaceId = await resolvePairingCode(options.pairingCode, options.projectDir);
|
|
101
|
+
}
|
|
102
|
+
// Discover workspace if no ID provided
|
|
103
|
+
if (!workspaceId && options.projectDir) {
|
|
104
|
+
const metadata = await discoverDevelopmentWorkspace({ projectDir: options.projectDir });
|
|
105
|
+
workspaceId = metadata.workspaceId;
|
|
106
|
+
}
|
|
107
|
+
if (!workspaceId) {
|
|
108
|
+
throw new Error('Cannot connect: provide pairingCode, workspaceId, or projectDir');
|
|
109
|
+
}
|
|
110
|
+
const clientId = options.clientId || generateClientId(options.clientType);
|
|
111
|
+
const clientType = options.clientType || 'other';
|
|
112
|
+
return new DevelopmentWorkspaceConnection(workspaceId, clientId, clientType, options);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Generate a unique client ID based on type
|
|
116
|
+
*/
|
|
117
|
+
function generateClientId(clientType) {
|
|
118
|
+
const timestamp = Date.now();
|
|
119
|
+
const random = Math.random().toString(36).substring(2, 5);
|
|
120
|
+
const prefix = clientType || 'client';
|
|
121
|
+
return `${prefix}-${timestamp}-${random}`;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Development Workspace Connection
|
|
125
|
+
*
|
|
126
|
+
* Represents an active connection to a shared development workspace.
|
|
127
|
+
* Provides methods to publish, subscribe, and query shared state.
|
|
128
|
+
*/
|
|
129
|
+
export class DevelopmentWorkspaceConnection {
|
|
130
|
+
constructor(workspaceId, clientId, clientType, options) {
|
|
131
|
+
this.subscriptions = new Map();
|
|
132
|
+
this.connectedAt = 0;
|
|
133
|
+
this.connectedClients = new Map();
|
|
134
|
+
this.workspaceId = workspaceId;
|
|
135
|
+
this.clientId = clientId;
|
|
136
|
+
this.clientType = clientType;
|
|
137
|
+
this.options = options;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Establish connection to workspace
|
|
141
|
+
*/
|
|
142
|
+
async connect() {
|
|
143
|
+
this.connectedAt = Date.now();
|
|
144
|
+
this.registerClient();
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Close connection to workspace
|
|
148
|
+
*/
|
|
149
|
+
async disconnect() {
|
|
150
|
+
this.subscriptions.clear();
|
|
151
|
+
this.connectedClients.delete(this.clientId);
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Register this client as connected
|
|
155
|
+
*/
|
|
156
|
+
registerClient() {
|
|
157
|
+
this.connectedClients.set(this.clientId, {
|
|
158
|
+
clientId: this.clientId,
|
|
159
|
+
clientType: this.clientType,
|
|
160
|
+
connectedAt: this.connectedAt,
|
|
161
|
+
capabilities: this.getCapabilities(),
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Get capabilities for this client type
|
|
166
|
+
*/
|
|
167
|
+
getCapabilities() {
|
|
168
|
+
switch (this.clientType) {
|
|
169
|
+
case 'browser':
|
|
170
|
+
return ['visual_selection', 'run_inspection', 'replay'];
|
|
171
|
+
case 'ide':
|
|
172
|
+
return ['code_edit', 'file_navigation', 'symbol_lookup'];
|
|
173
|
+
case 'agent':
|
|
174
|
+
return ['code_analysis', 'code_generation', 'verification'];
|
|
175
|
+
case 'cli':
|
|
176
|
+
return ['workspace_status', 'configuration'];
|
|
177
|
+
default:
|
|
178
|
+
return [];
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* List connected clients in workspace
|
|
183
|
+
*/
|
|
184
|
+
clients() {
|
|
185
|
+
return Array.from(this.connectedClients.values());
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Subscribe to workspace entity changes
|
|
189
|
+
*
|
|
190
|
+
* Usage:
|
|
191
|
+
* ```
|
|
192
|
+
* workspace.subscribe("development_task", (event) => {
|
|
193
|
+
* console.log(`Task ${event.entityId}: ${event.type}`)
|
|
194
|
+
* })
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
subscribe(collection, handler) {
|
|
198
|
+
if (!this.subscriptions.has(collection)) {
|
|
199
|
+
this.subscriptions.set(collection, new Set());
|
|
200
|
+
}
|
|
201
|
+
const handlers = this.subscriptions.get(collection);
|
|
202
|
+
handlers.add(handler);
|
|
203
|
+
return () => {
|
|
204
|
+
handlers.delete(handler);
|
|
205
|
+
if (handlers.size === 0) {
|
|
206
|
+
this.subscriptions.delete(collection);
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Publish entity to workspace
|
|
212
|
+
*
|
|
213
|
+
* Creates new entity in workspace collection.
|
|
214
|
+
*/
|
|
215
|
+
async publish(collection, entity) {
|
|
216
|
+
const id = generateEntityId();
|
|
217
|
+
const event = {
|
|
218
|
+
id: generateEventId(),
|
|
219
|
+
workspaceId: this.workspaceId,
|
|
220
|
+
collection,
|
|
221
|
+
entityId: id,
|
|
222
|
+
type: 'created',
|
|
223
|
+
value: entity,
|
|
224
|
+
timestamp: Date.now(),
|
|
225
|
+
originClientId: this.clientId,
|
|
226
|
+
};
|
|
227
|
+
this.notifySubscribers(collection, event);
|
|
228
|
+
return id;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Get entity from workspace
|
|
232
|
+
*/
|
|
233
|
+
async get(collection, entityId) {
|
|
234
|
+
// In full implementation, would query FeltDB backend
|
|
235
|
+
// For now, returns null (placeholder)
|
|
236
|
+
return null;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Query entities in workspace collection
|
|
240
|
+
*/
|
|
241
|
+
async query(collection) {
|
|
242
|
+
// In full implementation, would query FeltDB backend
|
|
243
|
+
// For now, returns empty array (placeholder)
|
|
244
|
+
return [];
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Update entity in workspace
|
|
248
|
+
*/
|
|
249
|
+
async update(collection, entityId, updates) {
|
|
250
|
+
const event = {
|
|
251
|
+
id: generateEventId(),
|
|
252
|
+
workspaceId: this.workspaceId,
|
|
253
|
+
collection,
|
|
254
|
+
entityId,
|
|
255
|
+
type: 'updated',
|
|
256
|
+
value: updates,
|
|
257
|
+
timestamp: Date.now(),
|
|
258
|
+
originClientId: this.clientId,
|
|
259
|
+
};
|
|
260
|
+
this.notifySubscribers(collection, event);
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Notify subscribers of entity changes
|
|
264
|
+
*/
|
|
265
|
+
notifySubscribers(collection, event) {
|
|
266
|
+
const handlers = this.subscriptions.get(collection);
|
|
267
|
+
if (handlers) {
|
|
268
|
+
for (const handler of handlers) {
|
|
269
|
+
try {
|
|
270
|
+
handler(event);
|
|
271
|
+
}
|
|
272
|
+
catch (error) {
|
|
273
|
+
console.error(`Error in subscription handler: ${error}`);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Generate unique entity ID
|
|
281
|
+
*/
|
|
282
|
+
function generateEntityId() {
|
|
283
|
+
return `entity_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Generate unique event ID
|
|
287
|
+
*/
|
|
288
|
+
function generateEventId() {
|
|
289
|
+
return `event_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
|
|
290
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace Identity Management
|
|
3
|
+
*
|
|
4
|
+
* Manages durable workspace identities and discovery.
|
|
5
|
+
*/
|
|
6
|
+
import type { DevelopmentWorkspace, WorkspaceDiscovery } from './workspace-types.js';
|
|
7
|
+
export declare function createWorkspaceId(projectId: string): string;
|
|
8
|
+
export declare function isValidWorkspaceId(id: string): boolean;
|
|
9
|
+
export declare function createDevelopmentWorkspace(projectId: string, name: string): DevelopmentWorkspace;
|
|
10
|
+
export declare function updateWorkspaceTimestamp(workspace: DevelopmentWorkspace): DevelopmentWorkspace;
|
|
11
|
+
export declare function discoverWorkspace(projectDir: string): Promise<WorkspaceDiscovery | null>;
|
|
12
|
+
export declare function persistWorkspaceDiscovery(projectDir: string, discovery: WorkspaceDiscovery): Promise<void>;
|
|
13
|
+
//# sourceMappingURL=workspace-identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-identity.d.ts","sourceRoot":"","sources":["../../src/workspace/workspace-identity.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAIrF,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAI3D;AAED,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,GACX,oBAAoB,CAStB;AAED,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,oBAAoB,GAC9B,oBAAoB,CAKtB;AAED,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CA0BpC;AAED,wBAAsB,yBAAyB,CAC7C,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,kBAAkB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAiBf"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace Identity Management
|
|
3
|
+
*
|
|
4
|
+
* Manages durable workspace identities and discovery.
|
|
5
|
+
*/
|
|
6
|
+
const WORKSPACE_ID_PREFIX = 'ws_';
|
|
7
|
+
export function createWorkspaceId(projectId) {
|
|
8
|
+
const timestamp = Date.now();
|
|
9
|
+
const random = Math.random().toString(36).substring(2, 8);
|
|
10
|
+
return `${WORKSPACE_ID_PREFIX}${projectId}_${timestamp}_${random}`;
|
|
11
|
+
}
|
|
12
|
+
export function isValidWorkspaceId(id) {
|
|
13
|
+
return id.startsWith(WORKSPACE_ID_PREFIX);
|
|
14
|
+
}
|
|
15
|
+
export function createDevelopmentWorkspace(projectId, name) {
|
|
16
|
+
const now = Date.now();
|
|
17
|
+
return {
|
|
18
|
+
id: createWorkspaceId(projectId),
|
|
19
|
+
name,
|
|
20
|
+
projectId,
|
|
21
|
+
createdAt: now,
|
|
22
|
+
updatedAt: now,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export function updateWorkspaceTimestamp(workspace) {
|
|
26
|
+
return {
|
|
27
|
+
...workspace,
|
|
28
|
+
updatedAt: Date.now(),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export async function discoverWorkspace(projectDir) {
|
|
32
|
+
try {
|
|
33
|
+
if (typeof window !== 'undefined') {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
const fs = await import('fs').then((m) => m.promises);
|
|
37
|
+
const path = await import('path');
|
|
38
|
+
const configPath = path.join(projectDir, '.feltdb', 'workspace.json');
|
|
39
|
+
try {
|
|
40
|
+
const content = await fs.readFile(configPath, 'utf-8');
|
|
41
|
+
const data = JSON.parse(content);
|
|
42
|
+
if (isValidWorkspaceId(data.workspaceId) && data.projectId) {
|
|
43
|
+
return data;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
export async function persistWorkspaceDiscovery(projectDir, discovery) {
|
|
56
|
+
try {
|
|
57
|
+
if (typeof window !== 'undefined') {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const fs = await import('fs').then((m) => m.promises);
|
|
61
|
+
const path = await import('path');
|
|
62
|
+
const configDir = path.join(projectDir, '.feltdb');
|
|
63
|
+
const configPath = path.join(configDir, 'workspace.json');
|
|
64
|
+
await fs.mkdir(configDir, { recursive: true });
|
|
65
|
+
await fs.writeFile(configPath, JSON.stringify(discovery, null, 2));
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
console.error('Failed to persist workspace discovery:', error);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Development Workspace Types
|
|
3
|
+
*
|
|
4
|
+
* Core contracts for durable development state shared across
|
|
5
|
+
* Browser, IDE, and Agent clients.
|
|
6
|
+
*/
|
|
7
|
+
export interface DevelopmentWorkspace {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
projectId: string;
|
|
11
|
+
createdAt: number;
|
|
12
|
+
updatedAt: number;
|
|
13
|
+
}
|
|
14
|
+
export type ClientType = "browser" | "ide" | "agent" | "cli" | "application" | "other";
|
|
15
|
+
export interface WorkspaceEventPayload<T = unknown> {
|
|
16
|
+
id: string;
|
|
17
|
+
workspaceId: string;
|
|
18
|
+
collection: string;
|
|
19
|
+
entityId: string;
|
|
20
|
+
type: "created" | "updated" | "deleted";
|
|
21
|
+
value?: T;
|
|
22
|
+
timestamp: number;
|
|
23
|
+
originClientId: string;
|
|
24
|
+
}
|
|
25
|
+
export interface DevelopmentTask {
|
|
26
|
+
id: string;
|
|
27
|
+
workspaceId: string;
|
|
28
|
+
investigationId?: string;
|
|
29
|
+
title: string;
|
|
30
|
+
description: string;
|
|
31
|
+
sourceLocations?: SourceLocation[];
|
|
32
|
+
status: "open" | "in_progress" | "ready_for_verification" | "verified" | "failed" | "cancelled";
|
|
33
|
+
createdAt: number;
|
|
34
|
+
updatedAt: number;
|
|
35
|
+
}
|
|
36
|
+
export interface CodeChange {
|
|
37
|
+
id: string;
|
|
38
|
+
workspaceId: string;
|
|
39
|
+
taskId: string;
|
|
40
|
+
description: string;
|
|
41
|
+
sourceLocations: SourceLocation[];
|
|
42
|
+
changeRef?: string;
|
|
43
|
+
status: "published" | "ready_for_verification" | "verifying" | "verified" | "failed";
|
|
44
|
+
createdAt: number;
|
|
45
|
+
updatedAt: number;
|
|
46
|
+
}
|
|
47
|
+
export interface VerificationResult {
|
|
48
|
+
id: string;
|
|
49
|
+
workspaceId: string;
|
|
50
|
+
taskId: string;
|
|
51
|
+
codeChangeId: string;
|
|
52
|
+
status: "fixed" | "regressed" | "unchanged" | "inconclusive";
|
|
53
|
+
summary: string;
|
|
54
|
+
originalOutcome?: unknown;
|
|
55
|
+
newOutcome?: unknown;
|
|
56
|
+
newErrors: number;
|
|
57
|
+
createdAt: number;
|
|
58
|
+
}
|
|
59
|
+
export interface SourceLocation {
|
|
60
|
+
file: string;
|
|
61
|
+
line?: number;
|
|
62
|
+
column?: number;
|
|
63
|
+
endLine?: number;
|
|
64
|
+
endColumn?: number;
|
|
65
|
+
}
|
|
66
|
+
export interface WorkspaceClient {
|
|
67
|
+
workspaceId: string;
|
|
68
|
+
clientId: string;
|
|
69
|
+
clientType: ClientType;
|
|
70
|
+
connect(): Promise<void>;
|
|
71
|
+
disconnect(): Promise<void>;
|
|
72
|
+
get<T>(collection: string, id: string): Promise<T | null>;
|
|
73
|
+
query<T>(collection: string, query?: unknown): Promise<T[]>;
|
|
74
|
+
publish<T>(collection: string, value: T): Promise<string>;
|
|
75
|
+
update<T>(collection: string, id: string, value: Partial<T>): Promise<void>;
|
|
76
|
+
subscribe<T>(collection: string, callback: (event: WorkspaceEventPayload<T>) => void): () => void;
|
|
77
|
+
}
|
|
78
|
+
export interface WorkspaceDiscovery {
|
|
79
|
+
workspaceId: string;
|
|
80
|
+
projectId: string;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=workspace-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-types.d.ts","sourceRoot":"","sources":["../../src/workspace/workspace-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,KAAK,GAAG,aAAa,GAAG,OAAO,CAAC;AAEvF,MAAM,WAAW,qBAAqB,CAAC,CAAC,GAAG,OAAO;IAChD,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;IACxC,KAAK,CAAC,EAAE,CAA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
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "FeltDB Core - Application-facing database with Browser, Local, and Server runtimes. Durable state, reactive APIs.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -42,6 +42,10 @@
|
|
|
42
42
|
"import": "./dist/wasm/feltdb_wasm.js",
|
|
43
43
|
"types": "./dist/wasm/feltdb_wasm.d.ts"
|
|
44
44
|
},
|
|
45
|
+
"./workspace": {
|
|
46
|
+
"import": "./dist/workspace/index.js",
|
|
47
|
+
"types": "./dist/workspace/index.d.ts"
|
|
48
|
+
},
|
|
45
49
|
"./package.json": "./package.json"
|
|
46
50
|
},
|
|
47
51
|
"files": [
|
|
Binary file
|