@nan0web/communication.app 0.0.0-stage → 0.1.1
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/LICENSE +15 -0
- package/bin/nan0com.js +16 -0
- package/package.json +34 -3
- package/src/domain/ChatRepoModel.js +157 -0
- package/src/domain/CommunicationApp.js +527 -0
- package/src/domain/CrystallizeModel.js +58 -0
- package/src/domain/FractalContactBookModel.js +147 -0
- package/src/domain/PeerGitSyncModel.js +105 -0
- package/src/index.js +13 -0
- package/src/infra/GitTransport.js +155 -0
- package/src/infra/Notifier.js +61 -0
- package/types/domain/ChatRepoModel.d.ts +66 -0
- package/types/domain/CommunicationApp.d.ts +296 -0
- package/types/domain/CrystallizeModel.d.ts +26 -0
- package/types/domain/DomainModel.d.ts +19 -0
- package/types/domain/FractalContactBookModel.d.ts +73 -0
- package/types/domain/PeerGitSyncModel.d.ts +64 -0
- package/types/index.d.ts +5 -0
- package/types/infra/GitTransport.d.ts +53 -0
- package/types/infra/Notifier.d.ts +23 -0
- package/README.md +0 -3
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Subcommand: Register a contact in a 7iOS we/ circle.
|
|
3
|
+
*/
|
|
4
|
+
export class InitCommand extends ModelAsApp {
|
|
5
|
+
static alias: string;
|
|
6
|
+
static UI: {
|
|
7
|
+
initialized: string;
|
|
8
|
+
bootstrapped: string;
|
|
9
|
+
};
|
|
10
|
+
static author: {
|
|
11
|
+
help: string;
|
|
12
|
+
default: string;
|
|
13
|
+
};
|
|
14
|
+
static circle: {
|
|
15
|
+
help: string;
|
|
16
|
+
default: string;
|
|
17
|
+
};
|
|
18
|
+
static bootstrap: {
|
|
19
|
+
help: string;
|
|
20
|
+
default: boolean;
|
|
21
|
+
};
|
|
22
|
+
static tourDir: {
|
|
23
|
+
help: string;
|
|
24
|
+
default: string;
|
|
25
|
+
};
|
|
26
|
+
static dryRun: {
|
|
27
|
+
help: string;
|
|
28
|
+
default: boolean;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* @param {Partial<InitCommand>} [data]
|
|
32
|
+
* @param {Partial<import('@nan0web/ui').ModelAsAppOptions>} [options]
|
|
33
|
+
*/
|
|
34
|
+
constructor(data?: Partial<InitCommand>, options?: Partial<import("@nan0web/ui").ModelAsAppOptions>);
|
|
35
|
+
/** @type {string} Contact soulId */ author: string;
|
|
36
|
+
/** @type {string} 7iOS circle */ circle: string;
|
|
37
|
+
/** @type {boolean} Bootstrap Day 1 tree */ bootstrap: boolean;
|
|
38
|
+
/** @type {string} Tour template directory */ tourDir: string;
|
|
39
|
+
/** @type {boolean} Dry run mode */ dryRun: boolean;
|
|
40
|
+
run(): AsyncGenerator<import("@nan0web/ui/src/core/Intent.js").ShowIntent, import("@nan0web/ui/src/core/Intent.js").ResultIntent, unknown>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Subcommand: Send a message to a sharded chat repository.
|
|
44
|
+
*/
|
|
45
|
+
export class SendCommand extends ModelAsApp {
|
|
46
|
+
static alias: string;
|
|
47
|
+
static UI: {
|
|
48
|
+
sent: string;
|
|
49
|
+
};
|
|
50
|
+
static repo: {
|
|
51
|
+
help: string;
|
|
52
|
+
default: string;
|
|
53
|
+
};
|
|
54
|
+
static chatId: {
|
|
55
|
+
help: string;
|
|
56
|
+
default: string;
|
|
57
|
+
};
|
|
58
|
+
static author: {
|
|
59
|
+
help: string;
|
|
60
|
+
default: string;
|
|
61
|
+
};
|
|
62
|
+
static text: {
|
|
63
|
+
help: string;
|
|
64
|
+
default: string;
|
|
65
|
+
};
|
|
66
|
+
static timestamp: {
|
|
67
|
+
help: string;
|
|
68
|
+
default: string;
|
|
69
|
+
};
|
|
70
|
+
static push: {
|
|
71
|
+
help: string;
|
|
72
|
+
default: boolean;
|
|
73
|
+
};
|
|
74
|
+
static skipIndex: {
|
|
75
|
+
help: string;
|
|
76
|
+
default: boolean;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* @param {Partial<SendCommand>} [data]
|
|
80
|
+
* @param {Partial<import('@nan0web/ui').ModelAsAppOptions>} [options]
|
|
81
|
+
*/
|
|
82
|
+
/**
|
|
83
|
+
* @param {Partial<ViewCommand>} [data]
|
|
84
|
+
* @param {Partial<import('@nan0web/ui').ModelAsAppOptions>} [options]
|
|
85
|
+
*/
|
|
86
|
+
/**
|
|
87
|
+
* @param {Partial<SyncCommand>} [data]
|
|
88
|
+
* @param {Partial<import('@nan0web/ui').ModelAsAppOptions>} [options]
|
|
89
|
+
*/
|
|
90
|
+
constructor(data?: Partial<SyncCommand>, options?: Partial<import("@nan0web/ui").ModelAsAppOptions>);
|
|
91
|
+
/** @type {string} Explicit repository URI */ repo: string;
|
|
92
|
+
/** @type {string} Chat ID for prefix sharding */ chatId: string;
|
|
93
|
+
/** @type {string} Author soulId */ author: string;
|
|
94
|
+
/** @type {string} Message text */ text: string;
|
|
95
|
+
/** @type {string} ISO timestamp */ timestamp: string;
|
|
96
|
+
/** @type {boolean} Commit and push via Git */ push: boolean;
|
|
97
|
+
/** @type {boolean} Skip updating README.md index */ skipIndex: boolean;
|
|
98
|
+
/** @type {any} Optional Git transport port */ $git: any;
|
|
99
|
+
run(): AsyncGenerator<import("@nan0web/ui/src/core/Intent.js").ShowIntent, import("@nan0web/ui/src/core/Intent.js").ResultIntent, unknown>;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Subcommand: View messages for a given date.
|
|
103
|
+
*/
|
|
104
|
+
export class ViewCommand extends ModelAsApp {
|
|
105
|
+
static alias: string;
|
|
106
|
+
static repo: {
|
|
107
|
+
help: string;
|
|
108
|
+
default: string;
|
|
109
|
+
};
|
|
110
|
+
static chatId: {
|
|
111
|
+
help: string;
|
|
112
|
+
default: string;
|
|
113
|
+
};
|
|
114
|
+
static date: {
|
|
115
|
+
help: string;
|
|
116
|
+
default: string;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* @param {Partial<ViewCommand>} [data]
|
|
120
|
+
* @param {Partial<import('@nan0web/ui').ModelAsAppOptions>} [options]
|
|
121
|
+
*/
|
|
122
|
+
constructor(data?: Partial<ViewCommand>, options?: Partial<import("@nan0web/ui").ModelAsAppOptions>);
|
|
123
|
+
/** @type {string} Explicit repository URI */ repo: string;
|
|
124
|
+
/** @type {string} Chat ID for prefix sharding */ chatId: string;
|
|
125
|
+
/** @type {string} Date YYYY-MM-DD */ date: string;
|
|
126
|
+
run(): AsyncGenerator<import("@nan0web/ui/src/core/Intent.js").ShowIntent, import("@nan0web/ui/src/core/Intent.js").ResultIntent, unknown>;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Subcommand: Crystallize a chat message into a document or todo.md.
|
|
130
|
+
*/
|
|
131
|
+
export class CrystallizeCommand extends ModelAsApp {
|
|
132
|
+
static alias: string;
|
|
133
|
+
static UI: {
|
|
134
|
+
crystallized: string;
|
|
135
|
+
};
|
|
136
|
+
static msgUri: {
|
|
137
|
+
help: string;
|
|
138
|
+
default: string;
|
|
139
|
+
};
|
|
140
|
+
static targetDocUri: {
|
|
141
|
+
help: string;
|
|
142
|
+
default: string;
|
|
143
|
+
};
|
|
144
|
+
static kind: {
|
|
145
|
+
help: string;
|
|
146
|
+
default: string;
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* @param {Partial<CrystallizeCommand>} [data]
|
|
150
|
+
* @param {Partial<import('@nan0web/ui').ModelAsAppOptions>} [options]
|
|
151
|
+
*/
|
|
152
|
+
constructor(data?: Partial<CrystallizeCommand>, options?: Partial<import("@nan0web/ui").ModelAsAppOptions>);
|
|
153
|
+
/** @type {string} Source message URI */ msgUri: string;
|
|
154
|
+
/** @type {string} Target document URI */ targetDocUri: string;
|
|
155
|
+
/** @type {string} Entry kind */ kind: string;
|
|
156
|
+
run(): AsyncGenerator<import("@nan0web/ui/src/core/Intent.js").ShowIntent, import("@nan0web/ui/src/core/Intent.js").ResultIntent, unknown>;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Subcommand: Inspect peer branch sync state.
|
|
160
|
+
*/
|
|
161
|
+
export class SyncCommand extends ModelAsApp {
|
|
162
|
+
static alias: string;
|
|
163
|
+
static UI: {
|
|
164
|
+
synced: string;
|
|
165
|
+
};
|
|
166
|
+
static repo: {
|
|
167
|
+
help: string;
|
|
168
|
+
default: string;
|
|
169
|
+
};
|
|
170
|
+
static chatId: {
|
|
171
|
+
help: string;
|
|
172
|
+
default: string;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* @param {Partial<SendCommand>} [data]
|
|
176
|
+
* @param {Partial<import('@nan0web/ui').ModelAsAppOptions>} [options]
|
|
177
|
+
*/
|
|
178
|
+
/**
|
|
179
|
+
* @param {Partial<ViewCommand>} [data]
|
|
180
|
+
* @param {Partial<import('@nan0web/ui').ModelAsAppOptions>} [options]
|
|
181
|
+
*/
|
|
182
|
+
/**
|
|
183
|
+
* @param {Partial<SyncCommand>} [data]
|
|
184
|
+
* @param {Partial<import('@nan0web/ui').ModelAsAppOptions>} [options]
|
|
185
|
+
*/
|
|
186
|
+
constructor(data?: Partial<SyncCommand>, options?: Partial<import("@nan0web/ui").ModelAsAppOptions>);
|
|
187
|
+
/** @type {string} Explicit repository URI */ repo: string;
|
|
188
|
+
/** @type {string} Chat ID for prefix sharding */ chatId: string;
|
|
189
|
+
run(): AsyncGenerator<import("@nan0web/ui/src/core/Intent.js").ShowIntent, import("@nan0web/ui/src/core/Intent.js").ResultIntent, unknown>;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Subcommand: Poll remote Git repository for new messages and notify.
|
|
193
|
+
*/
|
|
194
|
+
export class WatchCommand extends ModelAsApp {
|
|
195
|
+
static alias: string;
|
|
196
|
+
static UI: {
|
|
197
|
+
watching: string;
|
|
198
|
+
fetching: string;
|
|
199
|
+
waiting: string;
|
|
200
|
+
upToDate: string;
|
|
201
|
+
received: string;
|
|
202
|
+
syncWarning: string;
|
|
203
|
+
};
|
|
204
|
+
static repo: {
|
|
205
|
+
help: string;
|
|
206
|
+
default: string;
|
|
207
|
+
};
|
|
208
|
+
static chatId: {
|
|
209
|
+
help: string;
|
|
210
|
+
default: string;
|
|
211
|
+
};
|
|
212
|
+
static interval: {
|
|
213
|
+
help: string;
|
|
214
|
+
default: number;
|
|
215
|
+
};
|
|
216
|
+
static once: {
|
|
217
|
+
help: string;
|
|
218
|
+
default: boolean;
|
|
219
|
+
};
|
|
220
|
+
static maxTicks: {
|
|
221
|
+
help: string;
|
|
222
|
+
default: number;
|
|
223
|
+
};
|
|
224
|
+
static limit: {
|
|
225
|
+
help: string;
|
|
226
|
+
default: number;
|
|
227
|
+
};
|
|
228
|
+
static author: {
|
|
229
|
+
help: string;
|
|
230
|
+
default: string;
|
|
231
|
+
};
|
|
232
|
+
static color: {
|
|
233
|
+
help: string;
|
|
234
|
+
default: boolean;
|
|
235
|
+
};
|
|
236
|
+
/**
|
|
237
|
+
* @param {Partial<WatchCommand>} [data]
|
|
238
|
+
* @param {Partial<import('@nan0web/ui').ModelAsAppOptions> & { git?: any, notify?: any }} [options]
|
|
239
|
+
*/
|
|
240
|
+
/**
|
|
241
|
+
* @param {Partial<SendCommand>} [data]
|
|
242
|
+
* @param {Partial<import('@nan0web/ui').ModelAsAppOptions>} [options]
|
|
243
|
+
*/
|
|
244
|
+
/**
|
|
245
|
+
* @param {Partial<ViewCommand>} [data]
|
|
246
|
+
* @param {Partial<import('@nan0web/ui').ModelAsAppOptions>} [options]
|
|
247
|
+
*/
|
|
248
|
+
/**
|
|
249
|
+
* @param {Partial<SyncCommand>} [data]
|
|
250
|
+
* @param {Partial<import('@nan0web/ui').ModelAsAppOptions>} [options]
|
|
251
|
+
*/
|
|
252
|
+
constructor(data?: Partial<SyncCommand>, options?: Partial<import("@nan0web/ui").ModelAsAppOptions>);
|
|
253
|
+
/** @type {string} Explicit repository URI */ repo: string;
|
|
254
|
+
/** @type {string} Chat ID for prefix sharding */ chatId: string;
|
|
255
|
+
/** @type {number} Polling interval in seconds */ interval: number;
|
|
256
|
+
/** @type {boolean} Run a single poll tick and exit */ once: boolean;
|
|
257
|
+
/** @type {number} Maximum polling ticks */ maxTicks: number;
|
|
258
|
+
/** @type {number} Initial history messages count */ limit: number;
|
|
259
|
+
/** @type {string} Current user author name */ author: string;
|
|
260
|
+
/** @type {boolean} Colorize author names in terminal */ color: boolean;
|
|
261
|
+
/** @type {any} Optional Git transport port */ $git: any;
|
|
262
|
+
/** @type {any} Optional Notifier port */ $notify: any;
|
|
263
|
+
/**
|
|
264
|
+
* Polls remote Git repository and yields received messages.
|
|
265
|
+
* @returns {AsyncGenerator<import('@nan0web/ui').Intent, any, any>}
|
|
266
|
+
*/
|
|
267
|
+
run(): AsyncGenerator<import("@nan0web/ui").Intent, any, any>;
|
|
268
|
+
#private;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Main polymorphic OLMUI application controller for @nan0web/communication.app.
|
|
272
|
+
*/
|
|
273
|
+
export class CommunicationApp extends ModelAsApp {
|
|
274
|
+
static alias: string;
|
|
275
|
+
static UI: {
|
|
276
|
+
title: string;
|
|
277
|
+
};
|
|
278
|
+
static command: {
|
|
279
|
+
help: string;
|
|
280
|
+
options: (typeof InitCommand | typeof SendCommand | typeof ViewCommand | typeof CrystallizeCommand | typeof SyncCommand | typeof WatchCommand)[];
|
|
281
|
+
positional: boolean;
|
|
282
|
+
default: typeof ViewCommand;
|
|
283
|
+
};
|
|
284
|
+
/**
|
|
285
|
+
* @param {Partial<CommunicationApp>} [data]
|
|
286
|
+
* @param {Partial<import('@nan0web/ui').ModelAsAppOptions>} [options]
|
|
287
|
+
*/
|
|
288
|
+
constructor(data?: Partial<CommunicationApp>, options?: Partial<import("@nan0web/ui").ModelAsAppOptions>);
|
|
289
|
+
/** @type {ModelAsApp} Active subcommand instance */ command: ModelAsApp;
|
|
290
|
+
/**
|
|
291
|
+
* Delegates execution polymorphically to the active subcommand model.
|
|
292
|
+
* @returns {AsyncGenerator<import('@nan0web/ui').Intent, any, any>}
|
|
293
|
+
*/
|
|
294
|
+
run(): AsyncGenerator<import("@nan0web/ui").Intent, any, any>;
|
|
295
|
+
}
|
|
296
|
+
import { ModelAsApp } from '@nan0web/ui';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Crystallizes ephemeral chat messages into structured project documents or todo.md.
|
|
3
|
+
*/
|
|
4
|
+
export class CrystallizeModel extends ModelAsApp {
|
|
5
|
+
static UI: {
|
|
6
|
+
errorNoDb: string;
|
|
7
|
+
errorMsgNotFound: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Moves/projects a chat message into targetDocUri preserving authorship and $ref.
|
|
11
|
+
* @param {{ msgUri: string, targetDocUri: string, kind?: 'todo' | 'note' }} input
|
|
12
|
+
* @returns {Promise<{ author: string, $ref: string, targetDocUri: string, kind: string, text: string }>}
|
|
13
|
+
*/
|
|
14
|
+
crystallize(input: {
|
|
15
|
+
msgUri: string;
|
|
16
|
+
targetDocUri: string;
|
|
17
|
+
kind?: "todo" | "note";
|
|
18
|
+
}): Promise<{
|
|
19
|
+
author: string;
|
|
20
|
+
$ref: string;
|
|
21
|
+
targetDocUri: string;
|
|
22
|
+
kind: string;
|
|
23
|
+
text: string;
|
|
24
|
+
}>;
|
|
25
|
+
}
|
|
26
|
+
import { ModelAsApp } from '@nan0web/ui';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base domain model providing safe $db access without procedural fs/path.
|
|
3
|
+
*/
|
|
4
|
+
export class DomainModel extends Model {
|
|
5
|
+
static UI: {
|
|
6
|
+
errorNoDb: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* @param {Partial<DomainModel>} [data]
|
|
10
|
+
* @param {Partial<import('@nan0web/types').ModelOptions>} [options]
|
|
11
|
+
*/
|
|
12
|
+
constructor(data?: Partial<DomainModel>, options?: Partial<import("@nan0web/types").ModelOptions>);
|
|
13
|
+
/**
|
|
14
|
+
* Returns injected @nan0web/db instance or throws ModelError.
|
|
15
|
+
* @returns {import('@nan0web/db').default}
|
|
16
|
+
*/
|
|
17
|
+
get $db(): import("@nan0web/db").default;
|
|
18
|
+
}
|
|
19
|
+
import { Model } from '@nan0web/types';
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/** @type {readonly string[]} */
|
|
2
|
+
export const CANONICAL_CIRCLES: readonly string[];
|
|
3
|
+
/**
|
|
4
|
+
* Fractal contact book for 7iOS we/ circles and Triad project governance.
|
|
5
|
+
*/
|
|
6
|
+
export class FractalContactBookModel extends ModelAsApp {
|
|
7
|
+
static UI: {
|
|
8
|
+
errorNoDb: string;
|
|
9
|
+
errorInvalidCircle: string;
|
|
10
|
+
errorInvalidSoulId: string;
|
|
11
|
+
errorTriadRule: string;
|
|
12
|
+
};
|
|
13
|
+
static circles: {
|
|
14
|
+
help: string;
|
|
15
|
+
default: readonly string[];
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* @param {Partial<FractalContactBookModel>} [data]
|
|
19
|
+
* @param {Partial<import('@nan0web/types').ModelOptions>} [options]
|
|
20
|
+
*/
|
|
21
|
+
constructor(data?: Partial<FractalContactBookModel>, options?: Partial<import("@nan0web/types").ModelOptions>);
|
|
22
|
+
/** @type {string[]} Allowed we/ circles */ circles: string[];
|
|
23
|
+
/**
|
|
24
|
+
* Resolves active we/ circles from root index document or model options.
|
|
25
|
+
* @returns {Promise<string[]>}
|
|
26
|
+
*/
|
|
27
|
+
resolveCircles(): Promise<string[]>;
|
|
28
|
+
/**
|
|
29
|
+
* Registers a contact in one of configured we/ circles.
|
|
30
|
+
* @param {{ soulId: string, circle: string, name: string, devices?: string[], dryRun?: boolean }} input
|
|
31
|
+
* @returns {Promise<{ soulId: string, circle: string, name: string, devices: string[] }>}
|
|
32
|
+
*/
|
|
33
|
+
addContact(input: {
|
|
34
|
+
soulId: string;
|
|
35
|
+
circle: string;
|
|
36
|
+
name: string;
|
|
37
|
+
devices?: string[];
|
|
38
|
+
dryRun?: boolean;
|
|
39
|
+
}): Promise<{
|
|
40
|
+
soulId: string;
|
|
41
|
+
circle: string;
|
|
42
|
+
name: string;
|
|
43
|
+
devices: string[];
|
|
44
|
+
}>;
|
|
45
|
+
/**
|
|
46
|
+
* Creates a shared partner project enforcing the Triad Rule (N >= 3).
|
|
47
|
+
* @param {{ projectId: string, title: string, coreMembers: string[] }} input
|
|
48
|
+
* @returns {Promise<{ projectId: string, title: string, coreMembers: string[] }>}
|
|
49
|
+
*/
|
|
50
|
+
createPartnerProject(input: {
|
|
51
|
+
projectId: string;
|
|
52
|
+
title: string;
|
|
53
|
+
coreMembers: string[];
|
|
54
|
+
}): Promise<{
|
|
55
|
+
projectId: string;
|
|
56
|
+
title: string;
|
|
57
|
+
coreMembers: string[];
|
|
58
|
+
}>;
|
|
59
|
+
/**
|
|
60
|
+
* Bootstraps Day 1 Onboarding tree by copying template files from tourDir.
|
|
61
|
+
* @param {{ tourDir?: string, dryRun?: boolean }} [options]
|
|
62
|
+
* @returns {Promise<{ dryRun: boolean, created: string[], existing: string[] }>}
|
|
63
|
+
*/
|
|
64
|
+
bootstrapDayOneTree(options?: {
|
|
65
|
+
tourDir?: string;
|
|
66
|
+
dryRun?: boolean;
|
|
67
|
+
}): Promise<{
|
|
68
|
+
dryRun: boolean;
|
|
69
|
+
created: string[];
|
|
70
|
+
existing: string[];
|
|
71
|
+
}>;
|
|
72
|
+
}
|
|
73
|
+
import { ModelAsApp } from '@nan0web/ui';
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conflict-free peer branch synchronization model (refs/heads/peers/<soulId>).
|
|
3
|
+
*/
|
|
4
|
+
export class PeerGitSyncModel extends ModelAsApp {
|
|
5
|
+
static BATCH_MODES: string[];
|
|
6
|
+
static MERGE_POLICIES: string[];
|
|
7
|
+
static repo: {
|
|
8
|
+
help: string;
|
|
9
|
+
default: string;
|
|
10
|
+
};
|
|
11
|
+
static batchMode: {
|
|
12
|
+
help: string;
|
|
13
|
+
default: string;
|
|
14
|
+
};
|
|
15
|
+
static mergePolicy: {
|
|
16
|
+
help: string;
|
|
17
|
+
default: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* @param {Partial<PeerGitSyncModel>} [data]
|
|
21
|
+
* @param {Partial<import('@nan0web/ui').ModelAsAppOptions>} [options]
|
|
22
|
+
*/
|
|
23
|
+
constructor(data?: Partial<PeerGitSyncModel>, options?: Partial<import("@nan0web/ui").ModelAsAppOptions>);
|
|
24
|
+
/** @type {string} Repository base URI */ repo: string;
|
|
25
|
+
/** @type {string} Commit batching mode */ batchMode: string;
|
|
26
|
+
/** @type {string} Document merge policy */ mergePolicy: string;
|
|
27
|
+
/** @type {any} Optional Git transport port */ $git: any;
|
|
28
|
+
/**
|
|
29
|
+
* Records a peer message commit into refs/heads/peers/<soulId> without conflicts.
|
|
30
|
+
* @param {{ soulId: string, messageUri: string }} input
|
|
31
|
+
* @returns {Promise<{ branch: string, messageUri: string }>}
|
|
32
|
+
*/
|
|
33
|
+
recordPeerCommit(input: {
|
|
34
|
+
soulId: string;
|
|
35
|
+
messageUri: string;
|
|
36
|
+
}): Promise<{
|
|
37
|
+
branch: string;
|
|
38
|
+
messageUri: string;
|
|
39
|
+
}>;
|
|
40
|
+
/**
|
|
41
|
+
* Returns current peer branches synchronization state.
|
|
42
|
+
* @returns {Promise<{ branches: Record<string, string[]> }>}
|
|
43
|
+
*/
|
|
44
|
+
getSyncState(): Promise<{
|
|
45
|
+
branches: Record<string, string[]>;
|
|
46
|
+
}>;
|
|
47
|
+
/**
|
|
48
|
+
* Commits and pushes a message file via injected Git transport (if present).
|
|
49
|
+
* @param {{ uri: string, author: string }} input
|
|
50
|
+
* @returns {Promise<{ pushed: boolean }>}
|
|
51
|
+
*/
|
|
52
|
+
pushMessage({ uri, author }: {
|
|
53
|
+
uri: string;
|
|
54
|
+
author: string;
|
|
55
|
+
}): Promise<{
|
|
56
|
+
pushed: boolean;
|
|
57
|
+
}>;
|
|
58
|
+
/**
|
|
59
|
+
* Fetches and pulls remote updates via injected Git transport (if present).
|
|
60
|
+
* @returns {Promise<string[]>} Newly pulled .md file URIs
|
|
61
|
+
*/
|
|
62
|
+
pullUpdates(): Promise<string[]>;
|
|
63
|
+
}
|
|
64
|
+
import { ModelAsApp } from '@nan0web/ui';
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { CrystallizeModel } from "./domain/CrystallizeModel.js";
|
|
2
|
+
export { PeerGitSyncModel } from "./domain/PeerGitSyncModel.js";
|
|
3
|
+
export { FractalContactBookModel, CANONICAL_CIRCLES } from "./domain/FractalContactBookModel.js";
|
|
4
|
+
export { ChatRepoModel, parseMessageMarkdown, resolveChatShardUri } from "./domain/ChatRepoModel.js";
|
|
5
|
+
export { CommunicationApp, InitCommand, SendCommand, ViewCommand, CrystallizeCommand, SyncCommand, WatchCommand } from "./domain/CommunicationApp.js";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classifies raw git CLI errors into structured GitTransportError instances.
|
|
3
|
+
* @param {any} err
|
|
4
|
+
* @param {string} command
|
|
5
|
+
* @returns {GitTransportError}
|
|
6
|
+
*/
|
|
7
|
+
export function classifyGitError(err: any, command?: string): GitTransportError;
|
|
8
|
+
/**
|
|
9
|
+
* Structured Git transport error with actionable hint.
|
|
10
|
+
*/
|
|
11
|
+
export class GitTransportError extends Error {
|
|
12
|
+
/**
|
|
13
|
+
* @param {string} message
|
|
14
|
+
* @param {{ code: string, hint: string, command: string, cause?: unknown }} meta
|
|
15
|
+
*/
|
|
16
|
+
constructor(message: string, meta: {
|
|
17
|
+
code: string;
|
|
18
|
+
hint: string;
|
|
19
|
+
command: string;
|
|
20
|
+
cause?: unknown;
|
|
21
|
+
});
|
|
22
|
+
/** @type {string} */ code: string;
|
|
23
|
+
/** @type {string} */ hint: string;
|
|
24
|
+
/** @type {string} */ command: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Git CLI transport port for conflict-free message synchronization.
|
|
28
|
+
*/
|
|
29
|
+
export class GitTransport {
|
|
30
|
+
/**
|
|
31
|
+
* @param {{ cwd?: string, execGit?: (args: string[], cwd: string) => Promise<string> }} [options]
|
|
32
|
+
*/
|
|
33
|
+
constructor(options?: {
|
|
34
|
+
cwd?: string;
|
|
35
|
+
execGit?: (args: string[], cwd: string) => Promise<string>;
|
|
36
|
+
});
|
|
37
|
+
cwd: string;
|
|
38
|
+
execGit: (args: string[], cwd: string) => Promise<string>;
|
|
39
|
+
/**
|
|
40
|
+
* Stages, commits, and pushes a single file (auto-rebases once if remote is ahead).
|
|
41
|
+
* @param {string} filePath
|
|
42
|
+
* @param {string} message
|
|
43
|
+
* @returns {Promise<{ ok: boolean }>}
|
|
44
|
+
*/
|
|
45
|
+
commitAndPush(filePath: string, message: string): Promise<{
|
|
46
|
+
ok: boolean;
|
|
47
|
+
}>;
|
|
48
|
+
/**
|
|
49
|
+
* Fetches remote updates, detects new .md files, and runs git pull --rebase.
|
|
50
|
+
* @returns {Promise<string[]>} List of newly pulled .md file paths
|
|
51
|
+
*/
|
|
52
|
+
fetchAndPullRebase(): Promise<string[]>;
|
|
53
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-platform desktop notifier (macOS, Windows, Linux) with zero external deps.
|
|
3
|
+
*/
|
|
4
|
+
export class Notifier {
|
|
5
|
+
/**
|
|
6
|
+
* @param {{ platform?: string, exec?: (cmd: string, args: string[]) => Promise<any> }} [options]
|
|
7
|
+
*/
|
|
8
|
+
constructor(options?: {
|
|
9
|
+
platform?: string;
|
|
10
|
+
exec?: (cmd: string, args: string[]) => Promise<any>;
|
|
11
|
+
});
|
|
12
|
+
platform: string;
|
|
13
|
+
exec: (cmd: string, args: string[]) => Promise<any>;
|
|
14
|
+
/**
|
|
15
|
+
* Sends a desktop notification on macOS, Windows, or Linux.
|
|
16
|
+
* @param {{ title: string, body: string }} payload
|
|
17
|
+
* @returns {Promise<void>}
|
|
18
|
+
*/
|
|
19
|
+
notify({ title, body }: {
|
|
20
|
+
title: string;
|
|
21
|
+
body: string;
|
|
22
|
+
}): Promise<void>;
|
|
23
|
+
}
|
package/README.md
DELETED