decisionnode 0.2.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.
@@ -0,0 +1,177 @@
1
+ interface CloudConfig {
2
+ access_token?: string;
3
+ refresh_token?: string;
4
+ token_expires_at?: number;
5
+ anon_key?: string;
6
+ user_id?: string;
7
+ username?: string;
8
+ email?: string;
9
+ subscription_tier?: 'free' | 'pro';
10
+ subscription_expires_at?: string;
11
+ last_sync?: string;
12
+ }
13
+ /**
14
+ * Load cloud configuration from disk
15
+ * Automatically refreshes token if expired
16
+ */
17
+ export declare function loadCloudConfig(): Promise<CloudConfig>;
18
+ /**
19
+ * Save cloud configuration to disk
20
+ */
21
+ export declare function saveCloudConfig(config: CloudConfig): Promise<void>;
22
+ /**
23
+ * Check if user is authenticated with cloud
24
+ */
25
+ export declare function isCloudAuthenticated(): Promise<boolean>;
26
+ /**
27
+ * Check if user has Pro subscription
28
+ */
29
+ export declare function isProSubscriber(): Promise<boolean>;
30
+ /**
31
+ * Get cloud embedding for a query (Pro only)
32
+ * Falls back to null if not available
33
+ */
34
+ export declare function getCloudEmbedding(text: string, projectName?: string): Promise<number[] | null>;
35
+ /**
36
+ * Sync decisions to cloud (Pro only)
37
+ */
38
+ export declare function syncDecisionsToCloud(projectName: string, decisions: any[]): Promise<{
39
+ success: boolean;
40
+ synced: string[];
41
+ failed: string[];
42
+ errors?: Record<string, string>;
43
+ embedded: number;
44
+ } | null>;
45
+ /**
46
+ * Get cloud sync status - which decisions are synced
47
+ */
48
+ export declare function getCloudSyncStatus(projectName: string): Promise<{
49
+ synced: string[];
50
+ total_in_cloud: number;
51
+ } | null>;
52
+ /**
53
+ * Login to cloud service
54
+ * Opens browser for authentication, waits for callback
55
+ */
56
+ export declare function loginToCloud(): Promise<boolean>;
57
+ /**
58
+ * Logout from cloud service
59
+ */
60
+ export declare function logoutFromCloud(): Promise<void>;
61
+ /**
62
+ * Get cloud status with detailed info
63
+ */
64
+ export declare function getCloudStatus(): Promise<{
65
+ authenticated: boolean;
66
+ isPro: boolean;
67
+ userId?: string;
68
+ username?: string;
69
+ email?: string;
70
+ expiresAt?: string;
71
+ lastSync?: string;
72
+ }>;
73
+ /**
74
+ * Refresh user profile from cloud (updates subscription status)
75
+ */
76
+ export declare function refreshCloudProfile(): Promise<boolean>;
77
+ /**
78
+ * Delete a decision from cloud (Pro only)
79
+ */
80
+ export declare function deleteDecisionFromCloud(decisionId: string): Promise<boolean>;
81
+ /**
82
+ * Pull decisions from cloud (Pro only)
83
+ */
84
+ export declare function pullDecisionsFromCloud(projectName: string): Promise<any[] | null>;
85
+ /**
86
+ * Cloud decision structure (from Supabase)
87
+ */
88
+ export interface CloudDecision {
89
+ id: string;
90
+ user_id: string;
91
+ project_name: string;
92
+ decision_id: string;
93
+ scope: string;
94
+ decision: string;
95
+ rationale: string | null;
96
+ constraints: string[] | null;
97
+ status: string;
98
+ synced_at: string;
99
+ updated_at: string;
100
+ embedding?: number[];
101
+ }
102
+ /**
103
+ * Sync conflict between local and cloud versions
104
+ */
105
+ export interface SyncConflict {
106
+ decisionId: string;
107
+ scope: string;
108
+ localDecision: string;
109
+ cloudDecision: string;
110
+ localUpdatedAt: string;
111
+ cloudUpdatedAt: string;
112
+ }
113
+ /**
114
+ * Sync metadata for a single decision
115
+ */
116
+ interface DecisionSyncMeta {
117
+ syncedAt: string;
118
+ cloudUpdatedAt?: string;
119
+ localUpdatedAt?: string;
120
+ }
121
+ /**
122
+ * Sync metadata file structure
123
+ */
124
+ interface SyncMetadata {
125
+ lastSyncAt: string;
126
+ decisions: Record<string, DecisionSyncMeta>;
127
+ }
128
+ /**
129
+ * Load sync metadata from disk
130
+ */
131
+ export declare function loadSyncMetadata(projectRoot: string): Promise<SyncMetadata>;
132
+ /**
133
+ * Save sync metadata to disk
134
+ */
135
+ export declare function saveSyncMetadata(projectRoot: string, metadata: SyncMetadata): Promise<void>;
136
+ /**
137
+ * Get auto-sync setting
138
+ */
139
+ export declare function getAutoSyncEnabled(): Promise<boolean>;
140
+ /**
141
+ * Set auto-sync setting
142
+ */
143
+ export declare function setAutoSyncEnabled(enabled: boolean): Promise<void>;
144
+ /**
145
+ * Detect conflicts between local and cloud decisions
146
+ * Returns decisions that need to be pushed, pulled, or have conflicts
147
+ */
148
+ export declare function detectConflicts(projectRoot: string, localDecisions: Array<{
149
+ id: string;
150
+ decision: string;
151
+ updatedAt?: string;
152
+ scope: string;
153
+ }>, cloudDecisions: CloudDecision[]): Promise<{
154
+ toPush: string[];
155
+ toPull: CloudDecision[];
156
+ conflicts: SyncConflict[];
157
+ }>;
158
+ /**
159
+ * Save incoming changes from fetch command
160
+ */
161
+ export declare function saveIncomingChanges(projectRoot: string, changes: {
162
+ toPull: CloudDecision[];
163
+ conflicts: SyncConflict[];
164
+ }): Promise<void>;
165
+ /**
166
+ * Remove specific decisions from incoming changes list (after sync)
167
+ */
168
+ export declare function removeIncomingChanges(projectRoot: string, syncedIds: string[]): Promise<void>;
169
+ /**
170
+ * Resolve a conflict by choosing local or cloud version
171
+ */
172
+ export declare function resolveConflict(projectRoot: string, decisionId: string, resolution: 'local' | 'cloud', cloudDecision?: CloudDecision): Promise<boolean>;
173
+ /**
174
+ * Update sync metadata after successful sync
175
+ */
176
+ export declare function updateSyncMetadata(projectRoot: string, syncedIds: string[], cloudDecisions: CloudDecision[]): Promise<void>;
177
+ export {};