@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.
Files changed (48) hide show
  1. package/dist/cli/commands.js +68 -1
  2. package/dist/cli/workspace-integration.js +96 -0
  3. package/dist/create/cli.js +1 -1
  4. package/dist/create/create.js +21 -0
  5. package/dist/create/package-versions.js +1 -1
  6. package/dist/create/server-source/Cargo.lock +10 -0
  7. package/dist/create/server-source/crates/feltdb-server/Cargo.toml +1 -0
  8. package/dist/create/server-source/crates/feltdb-server/src/app_state.rs +5 -1
  9. package/dist/create/server-source/crates/feltdb-server/src/authenticated_principal.rs +273 -0
  10. package/dist/create/server-source/crates/feltdb-server/src/certification_harness.rs +528 -0
  11. package/dist/create/server-source/crates/feltdb-server/src/delegation_token.rs +472 -0
  12. package/dist/create/server-source/crates/feltdb-server/src/durable_operations.rs +992 -0
  13. package/dist/create/server-source/crates/feltdb-server/src/lib.rs +9 -0
  14. package/dist/create/server-source/crates/feltdb-server/src/main.rs +157 -9
  15. package/dist/create/server-source/crates/feltdb-server/src/managed_diagnostics.rs +413 -0
  16. package/dist/create/server-source/crates/feltdb-server/src/membership_policy.rs +488 -0
  17. package/dist/create/server-source/crates/feltdb-server/src/snapshot_cursor.rs +378 -0
  18. package/dist/create/server-source/crates/feltdb-server/src/tenancy.rs +49 -0
  19. package/dist/create/server-source/crates/feltdb-server/src/tenant_policies.rs +525 -0
  20. package/dist/create/server-source/crates/feltdb-server/src/transaction_recovery.rs +461 -0
  21. package/dist/create/template/dot-feltdb-README.md +58 -0
  22. package/dist/create/workspace-initialization.js +77 -0
  23. package/dist/index.d.ts +6 -0
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +6 -0
  26. package/dist/studio-app/assets/{feltdb_wasm-h9mxesnH.js → feltdb_wasm-B4wq4mqp.js} +1 -1
  27. package/dist/studio-app/assets/feltdb_wasm_bg-Ceyi7l21.wasm +0 -0
  28. package/dist/studio-app/assets/{index-B_EMnTaE.js → index-LQmvJSq6.js} +2 -2
  29. package/dist/studio-app/index.html +1 -1
  30. package/dist/telemetry.js +1 -1
  31. package/dist/wasm/feltdb_wasm_bg.wasm +0 -0
  32. package/dist/workspace/development-node.d.ts +42 -0
  33. package/dist/workspace/development-node.d.ts.map +1 -0
  34. package/dist/workspace/development-node.js +208 -0
  35. package/dist/workspace/index.d.ts +20 -0
  36. package/dist/workspace/index.d.ts.map +1 -0
  37. package/dist/workspace/index.js +16 -0
  38. package/dist/workspace/workspace-connection.d.ts +174 -0
  39. package/dist/workspace/workspace-connection.d.ts.map +1 -0
  40. package/dist/workspace/workspace-connection.js +290 -0
  41. package/dist/workspace/workspace-identity.d.ts +13 -0
  42. package/dist/workspace/workspace-identity.d.ts.map +1 -0
  43. package/dist/workspace/workspace-identity.js +70 -0
  44. package/dist/workspace/workspace-types.d.ts +82 -0
  45. package/dist/workspace/workspace-types.d.ts.map +1 -0
  46. package/dist/workspace/workspace-types.js +7 -0
  47. package/package.json +5 -1
  48. package/dist/studio-app/assets/feltdb_wasm_bg-B8U4A1n1.wasm +0 -0
@@ -1,3 +1,3 @@
1
- <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#17211b"/><title>FeltDB Studio</title> <script type="module" crossorigin src="/assets/index-B_EMnTaE.js"></script>
1
+ <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#17211b"/><title>FeltDB Studio</title> <script type="module" crossorigin src="/assets/index-LQmvJSq6.js"></script>
2
2
  <link rel="stylesheet" crossorigin href="/assets/index-C1GWyazR.css">
3
3
  </head><body><div id="root"></div></body></html>
package/dist/telemetry.js CHANGED
@@ -72,7 +72,7 @@ class InstallationIdentity {
72
72
  * Handles event collection and transport
73
73
  */
74
74
  export class TelemetryClient {
75
- constructor(coreVersion = '0.5.6') {
75
+ constructor(coreVersion = '0.5.7') {
76
76
  this.batchSize = 10;
77
77
  this.eventQueue = [];
78
78
  this.flushTimer = null;
Binary file
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Development Node
3
+ *
4
+ * Local FeltDB authority for development workspaces.
5
+ * Handles workspace creation, persistence, and client coordination.
6
+ */
7
+ import type { DevelopmentWorkspace, DevelopmentTask, CodeChange, VerificationResult } from './workspace-types.js';
8
+ export interface DevelopmentNodeConfig {
9
+ dataDir?: string;
10
+ autoSave?: boolean;
11
+ }
12
+ export declare class DevelopmentNode {
13
+ private workspaces;
14
+ private tasks;
15
+ private codeChanges;
16
+ private verificationResults;
17
+ private isRunning;
18
+ private dataDir;
19
+ constructor(config?: DevelopmentNodeConfig);
20
+ start(): Promise<void>;
21
+ stop(): Promise<void>;
22
+ createWorkspace(projectId: string, name: string): Promise<DevelopmentWorkspace>;
23
+ getWorkspace(workspaceId: string): Promise<DevelopmentWorkspace | null>;
24
+ listWorkspaces(projectId?: string): Promise<DevelopmentWorkspace[]>;
25
+ publishTask(task: Omit<DevelopmentTask, 'id' | 'createdAt' | 'updatedAt'>): Promise<DevelopmentTask>;
26
+ getTask(taskId: string): Promise<DevelopmentTask | null>;
27
+ listTasks(workspaceId: string): Promise<DevelopmentTask[]>;
28
+ publishCodeChange(change: Omit<CodeChange, 'id' | 'createdAt' | 'updatedAt'>): Promise<CodeChange>;
29
+ getCodeChange(changeId: string): Promise<CodeChange | null>;
30
+ listCodeChanges(taskId: string): Promise<CodeChange[]>;
31
+ publishVerificationResult(result: Omit<VerificationResult, 'id' | 'createdAt'>): Promise<VerificationResult>;
32
+ getVerificationResult(resultId: string): Promise<VerificationResult | null>;
33
+ listVerificationResults(taskId: string): Promise<VerificationResult[]>;
34
+ private validateWorkspaceExists;
35
+ private ensureRunning;
36
+ private generateId;
37
+ private loadState;
38
+ private saveState;
39
+ }
40
+ export declare function getDevelopmentNode(config?: DevelopmentNodeConfig): Promise<DevelopmentNode>;
41
+ export declare function shutdownDevelopmentNode(): Promise<void>;
42
+ //# sourceMappingURL=development-node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"development-node.d.ts","sourceRoot":"","sources":["../../src/workspace/development-node.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,oBAAoB,EAEpB,eAAe,EACf,UAAU,EACV,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAO9B,MAAM,WAAW,qBAAqB;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,UAAU,CAAgD;IAClE,OAAO,CAAC,KAAK,CAA2C;IACxD,OAAO,CAAC,WAAW,CAAsC;IACzD,OAAO,CAAC,mBAAmB,CAA8C;IACzE,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,OAAO,CAAS;gBAEZ,MAAM,GAAE,qBAA0B;IAIxC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IActB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAcrB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAU/E,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAUvE,cAAc,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAYnE,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,eAAe,EAAE,IAAI,GAAG,WAAW,GAAG,WAAW,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC;IAmBpG,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IAKxD,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAO1D,iBAAiB,CACrB,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,GAAG,WAAW,GAAG,WAAW,CAAC,GACzD,OAAO,CAAC,UAAU,CAAC;IAmBhB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAK3D,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAMtD,yBAAyB,CAC7B,MAAM,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,GAAG,WAAW,CAAC,GACnD,OAAO,CAAC,kBAAkB,CAAC;IAiBxB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAK3E,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAM5E,OAAO,CAAC,uBAAuB;IAM/B,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,UAAU;YAIJ,SAAS;YAmCT,SAAS;CAuBxB;AAID,wBAAsB,kBAAkB,CAAC,MAAM,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,eAAe,CAAC,CAOjG;AAED,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,IAAI,CAAC,CAK7D"}
@@ -0,0 +1,208 @@
1
+ /**
2
+ * Development Node
3
+ *
4
+ * Local FeltDB authority for development workspaces.
5
+ * Handles workspace creation, persistence, and client coordination.
6
+ */
7
+ import { createDevelopmentWorkspace, isValidWorkspaceId, } from './workspace-identity.js';
8
+ export class DevelopmentNode {
9
+ constructor(config = {}) {
10
+ this.workspaces = new Map();
11
+ this.tasks = new Map();
12
+ this.codeChanges = new Map();
13
+ this.verificationResults = new Map();
14
+ this.isRunning = false;
15
+ this.dataDir = config.dataDir || '.feltdb';
16
+ }
17
+ async start() {
18
+ if (this.isRunning) {
19
+ return;
20
+ }
21
+ try {
22
+ await this.loadState();
23
+ this.isRunning = true;
24
+ }
25
+ catch (error) {
26
+ console.error('Failed to start development node:', error);
27
+ throw error;
28
+ }
29
+ }
30
+ async stop() {
31
+ if (!this.isRunning) {
32
+ return;
33
+ }
34
+ try {
35
+ await this.saveState();
36
+ this.isRunning = false;
37
+ }
38
+ catch (error) {
39
+ console.error('Failed to stop development node:', error);
40
+ throw error;
41
+ }
42
+ }
43
+ async createWorkspace(projectId, name) {
44
+ this.ensureRunning();
45
+ const workspace = createDevelopmentWorkspace(projectId, name);
46
+ this.workspaces.set(workspace.id, workspace);
47
+ await this.saveState();
48
+ return workspace;
49
+ }
50
+ async getWorkspace(workspaceId) {
51
+ this.ensureRunning();
52
+ if (!isValidWorkspaceId(workspaceId)) {
53
+ return null;
54
+ }
55
+ return this.workspaces.get(workspaceId) || null;
56
+ }
57
+ async listWorkspaces(projectId) {
58
+ this.ensureRunning();
59
+ const workspaces = Array.from(this.workspaces.values());
60
+ if (projectId) {
61
+ return workspaces.filter((w) => w.projectId === projectId);
62
+ }
63
+ return workspaces;
64
+ }
65
+ async publishTask(task) {
66
+ this.ensureRunning();
67
+ const id = this.generateId('task');
68
+ const now = Date.now();
69
+ const fullTask = {
70
+ ...task,
71
+ id,
72
+ createdAt: now,
73
+ updatedAt: now,
74
+ };
75
+ this.validateWorkspaceExists(fullTask.workspaceId);
76
+ this.tasks.set(id, fullTask);
77
+ await this.saveState();
78
+ return fullTask;
79
+ }
80
+ async getTask(taskId) {
81
+ this.ensureRunning();
82
+ return this.tasks.get(taskId) || null;
83
+ }
84
+ async listTasks(workspaceId) {
85
+ this.ensureRunning();
86
+ this.validateWorkspaceExists(workspaceId);
87
+ return Array.from(this.tasks.values()).filter((t) => t.workspaceId === workspaceId);
88
+ }
89
+ async publishCodeChange(change) {
90
+ this.ensureRunning();
91
+ const id = this.generateId('change');
92
+ const now = Date.now();
93
+ const fullChange = {
94
+ ...change,
95
+ id,
96
+ createdAt: now,
97
+ updatedAt: now,
98
+ };
99
+ this.validateWorkspaceExists(fullChange.workspaceId);
100
+ this.codeChanges.set(id, fullChange);
101
+ await this.saveState();
102
+ return fullChange;
103
+ }
104
+ async getCodeChange(changeId) {
105
+ this.ensureRunning();
106
+ return this.codeChanges.get(changeId) || null;
107
+ }
108
+ async listCodeChanges(taskId) {
109
+ this.ensureRunning();
110
+ return Array.from(this.codeChanges.values()).filter((c) => c.taskId === taskId);
111
+ }
112
+ async publishVerificationResult(result) {
113
+ this.ensureRunning();
114
+ const id = this.generateId('result');
115
+ const fullResult = {
116
+ ...result,
117
+ id,
118
+ createdAt: Date.now(),
119
+ };
120
+ this.validateWorkspaceExists(fullResult.workspaceId);
121
+ this.verificationResults.set(id, fullResult);
122
+ await this.saveState();
123
+ return fullResult;
124
+ }
125
+ async getVerificationResult(resultId) {
126
+ this.ensureRunning();
127
+ return this.verificationResults.get(resultId) || null;
128
+ }
129
+ async listVerificationResults(taskId) {
130
+ this.ensureRunning();
131
+ return Array.from(this.verificationResults.values()).filter((r) => r.taskId === taskId);
132
+ }
133
+ validateWorkspaceExists(workspaceId) {
134
+ if (!this.workspaces.has(workspaceId)) {
135
+ throw new Error(`Workspace not found: ${workspaceId}`);
136
+ }
137
+ }
138
+ ensureRunning() {
139
+ if (!this.isRunning) {
140
+ throw new Error('Development node is not running. Call start() first.');
141
+ }
142
+ }
143
+ generateId(prefix) {
144
+ return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
145
+ }
146
+ async loadState() {
147
+ try {
148
+ if (typeof window !== 'undefined') {
149
+ return;
150
+ }
151
+ const fs = await import('fs').then((m) => m.promises);
152
+ const path = await import('path');
153
+ const statePath = path.join(this.dataDir, 'state.json');
154
+ try {
155
+ const content = await fs.readFile(statePath, 'utf-8');
156
+ const state = JSON.parse(content);
157
+ this.workspaces = new Map(Object.entries(state.workspaces || {}));
158
+ this.tasks = new Map(Object.entries(state.tasks || {}));
159
+ this.codeChanges = new Map(Object.entries(state.codeChanges || {}));
160
+ this.verificationResults = new Map(Object.entries(state.verificationResults || {}));
161
+ }
162
+ catch {
163
+ this.workspaces.clear();
164
+ this.tasks.clear();
165
+ this.codeChanges.clear();
166
+ this.verificationResults.clear();
167
+ }
168
+ }
169
+ catch {
170
+ // Silent failure in browser environment
171
+ }
172
+ }
173
+ async saveState() {
174
+ try {
175
+ if (typeof window !== 'undefined') {
176
+ return;
177
+ }
178
+ const fs = await import('fs').then((m) => m.promises);
179
+ const path = await import('path');
180
+ const statePath = path.join(this.dataDir, 'state.json');
181
+ const state = {
182
+ workspaces: Object.fromEntries(this.workspaces),
183
+ tasks: Object.fromEntries(this.tasks),
184
+ codeChanges: Object.fromEntries(this.codeChanges),
185
+ verificationResults: Object.fromEntries(this.verificationResults),
186
+ };
187
+ await fs.mkdir(this.dataDir, { recursive: true });
188
+ await fs.writeFile(statePath, JSON.stringify(state, null, 2));
189
+ }
190
+ catch (error) {
191
+ console.error('Failed to save development node state:', error);
192
+ }
193
+ }
194
+ }
195
+ let globalDevelopmentNode = null;
196
+ export async function getDevelopmentNode(config) {
197
+ if (!globalDevelopmentNode) {
198
+ globalDevelopmentNode = new DevelopmentNode(config);
199
+ await globalDevelopmentNode.start();
200
+ }
201
+ return globalDevelopmentNode;
202
+ }
203
+ export async function shutdownDevelopmentNode() {
204
+ if (globalDevelopmentNode) {
205
+ await globalDevelopmentNode.stop();
206
+ globalDevelopmentNode = null;
207
+ }
208
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @feltdb/core Development Workspace
3
+ *
4
+ * Shared development state coordination for Browser, IDE, and Agent clients.
5
+ *
6
+ * Public API:
7
+ * - connectDevelopmentWorkspace() - canonical client connection
8
+ * - discoverDevelopmentWorkspace() - find workspace from project directory
9
+ * - resolvePairingCode() - convert pairing code to workspace ID
10
+ *
11
+ * These enable any client (browser, IDE, agent) to discover and connect
12
+ * to the same shared development workspace.
13
+ */
14
+ export type { DevelopmentWorkspace, ClientType, WorkspaceEventPayload, DevelopmentTask, CodeChange, VerificationResult, SourceLocation, WorkspaceClient, WorkspaceDiscovery, } from './workspace-types.js';
15
+ export type { WorkspaceConnectionOptions, WorkspaceMetadata, PairingTokenData, ClientInfo, } from './workspace-connection.js';
16
+ export { connectDevelopmentWorkspace, discoverDevelopmentWorkspace, resolvePairingCode, DevelopmentWorkspaceConnection, } from './workspace-connection.js';
17
+ export { createWorkspaceId, isValidWorkspaceId, createDevelopmentWorkspace, updateWorkspaceTimestamp, discoverWorkspace, persistWorkspaceDiscovery, } from './workspace-identity.js';
18
+ export { DevelopmentNode, getDevelopmentNode, shutdownDevelopmentNode, } from './development-node.js';
19
+ export type { DevelopmentNodeConfig } from './development-node.js';
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/workspace/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,YAAY,EACV,oBAAoB,EACpB,UAAU,EACV,qBAAqB,EACrB,eAAe,EACf,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EACV,0BAA0B,EAC1B,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,GACX,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,kBAAkB,EAClB,8BAA8B,GAC/B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,0BAA0B,EAC1B,wBAAwB,EACxB,iBAAiB,EACjB,yBAAyB,GAC1B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @feltdb/core Development Workspace
3
+ *
4
+ * Shared development state coordination for Browser, IDE, and Agent clients.
5
+ *
6
+ * Public API:
7
+ * - connectDevelopmentWorkspace() - canonical client connection
8
+ * - discoverDevelopmentWorkspace() - find workspace from project directory
9
+ * - resolvePairingCode() - convert pairing code to workspace ID
10
+ *
11
+ * These enable any client (browser, IDE, agent) to discover and connect
12
+ * to the same shared development workspace.
13
+ */
14
+ export { connectDevelopmentWorkspace, discoverDevelopmentWorkspace, resolvePairingCode, DevelopmentWorkspaceConnection, } from './workspace-connection.js';
15
+ export { createWorkspaceId, isValidWorkspaceId, createDevelopmentWorkspace, updateWorkspaceTimestamp, discoverWorkspace, persistWorkspaceDiscovery, } from './workspace-identity.js';
16
+ export { DevelopmentNode, getDevelopmentNode, shutdownDevelopmentNode, } from './development-node.js';
@@ -0,0 +1,174 @@
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 type { ClientType } from './workspace-types.js';
8
+ export interface WorkspaceConnectionOptions {
9
+ pairingCode?: string;
10
+ workspaceId?: string;
11
+ projectDir?: string;
12
+ clientId?: string;
13
+ clientType?: ClientType;
14
+ endpoint?: string;
15
+ auth?: {
16
+ token: string;
17
+ apiKey?: string;
18
+ };
19
+ }
20
+ export interface WorkspaceMetadata {
21
+ workspaceId: string;
22
+ projectId: string;
23
+ version: number;
24
+ }
25
+ export interface PairingTokenData {
26
+ token: string;
27
+ workspaceId: string;
28
+ expiresAt: number;
29
+ }
30
+ export interface ClientInfo {
31
+ clientId: string;
32
+ clientType: ClientType;
33
+ connectedAt: number;
34
+ capabilities: string[];
35
+ }
36
+ /**
37
+ * Discover workspace from .feltdb/workspace.json
38
+ *
39
+ * Usage:
40
+ * ```
41
+ * const workspace = await discoverDevelopmentWorkspace({
42
+ * projectDir: process.cwd()
43
+ * })
44
+ * ```
45
+ */
46
+ export declare function discoverDevelopmentWorkspace(options: {
47
+ projectDir: string;
48
+ }): Promise<WorkspaceMetadata>;
49
+ /**
50
+ * Resolve pairing code to workspace ID
51
+ *
52
+ * Pairing codes are short-lived tokens (FELT-XXXX) that resolve to
53
+ * workspace IDs. They expire after 15 minutes.
54
+ *
55
+ * Used by clients to auto-discover workspace without manual entry.
56
+ */
57
+ export declare function resolvePairingCode(pairingCode: string, projectDir?: string): Promise<string>;
58
+ /**
59
+ * Connect to a Development Workspace
60
+ *
61
+ * Canonical API for clients to establish connection to shared workspace.
62
+ *
63
+ * Usage via pairing code (browser/IDE discovery):
64
+ * ```
65
+ * const workspace = await connectDevelopmentWorkspace({
66
+ * pairingCode: "FELT-7K3P",
67
+ * clientId: "vscode-randy",
68
+ * clientType: "ide"
69
+ * })
70
+ * ```
71
+ *
72
+ * Usage via workspace ID (agent/CLI):
73
+ * ```
74
+ * const workspace = await connectDevelopmentWorkspace({
75
+ * workspaceId: "ws_myapp_1234567890_abc123",
76
+ * projectDir: process.cwd(),
77
+ * clientId: "claude-code",
78
+ * clientType: "agent"
79
+ * })
80
+ * ```
81
+ *
82
+ * Usage via endpoint (remote connection):
83
+ * ```
84
+ * const workspace = await connectDevelopmentWorkspace({
85
+ * workspaceId: "ws_...",
86
+ * endpoint: "http://localhost:7700",
87
+ * auth: { token: "..." }
88
+ * })
89
+ * ```
90
+ */
91
+ export declare function connectDevelopmentWorkspace(options: WorkspaceConnectionOptions): Promise<DevelopmentWorkspaceConnection>;
92
+ /**
93
+ * Development Workspace Connection
94
+ *
95
+ * Represents an active connection to a shared development workspace.
96
+ * Provides methods to publish, subscribe, and query shared state.
97
+ */
98
+ export declare class DevelopmentWorkspaceConnection {
99
+ workspaceId: string;
100
+ clientId: string;
101
+ clientType: ClientType;
102
+ private options;
103
+ private subscriptions;
104
+ private connectedAt;
105
+ private connectedClients;
106
+ constructor(workspaceId: string, clientId: string, clientType: ClientType, options: WorkspaceConnectionOptions);
107
+ /**
108
+ * Establish connection to workspace
109
+ */
110
+ connect(): Promise<void>;
111
+ /**
112
+ * Close connection to workspace
113
+ */
114
+ disconnect(): Promise<void>;
115
+ /**
116
+ * Register this client as connected
117
+ */
118
+ private registerClient;
119
+ /**
120
+ * Get capabilities for this client type
121
+ */
122
+ private getCapabilities;
123
+ /**
124
+ * List connected clients in workspace
125
+ */
126
+ clients(): ClientInfo[];
127
+ /**
128
+ * Subscribe to workspace entity changes
129
+ *
130
+ * Usage:
131
+ * ```
132
+ * workspace.subscribe("development_task", (event) => {
133
+ * console.log(`Task ${event.entityId}: ${event.type}`)
134
+ * })
135
+ * ```
136
+ */
137
+ subscribe<T = unknown>(collection: string, handler: (event: WorkspaceEventPayload<T>) => void): () => void;
138
+ /**
139
+ * Publish entity to workspace
140
+ *
141
+ * Creates new entity in workspace collection.
142
+ */
143
+ publish<T extends object>(collection: string, entity: T): Promise<string>;
144
+ /**
145
+ * Get entity from workspace
146
+ */
147
+ get<T>(collection: string, entityId: string): Promise<T | null>;
148
+ /**
149
+ * Query entities in workspace collection
150
+ */
151
+ query<T>(collection: string): Promise<T[]>;
152
+ /**
153
+ * Update entity in workspace
154
+ */
155
+ update<T extends object>(collection: string, entityId: string, updates: Partial<T>): Promise<void>;
156
+ /**
157
+ * Notify subscribers of entity changes
158
+ */
159
+ private notifySubscribers;
160
+ }
161
+ /**
162
+ * Event payload for workspace changes
163
+ */
164
+ export interface WorkspaceEventPayload<T = unknown> {
165
+ id: string;
166
+ workspaceId: string;
167
+ collection: string;
168
+ entityId: string;
169
+ type: 'created' | 'updated' | 'deleted';
170
+ value?: T;
171
+ timestamp: number;
172
+ originClientId: string;
173
+ }
174
+ //# sourceMappingURL=workspace-connection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-connection.d.ts","sourceRoot":"","sources":["../../src/workspace/workspace-connection.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,WAAW,0BAA0B;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC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