@ectplsm/relic 0.3.2 → 0.4.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 (60) hide show
  1. package/LICENCE.md +1 -1
  2. package/README.md +19 -12
  3. package/dist/adapters/mikoshi/client.d.ts +21 -0
  4. package/dist/adapters/mikoshi/client.js +84 -0
  5. package/dist/core/ports/index.d.ts +1 -0
  6. package/dist/core/ports/mikoshi.d.ts +937 -0
  7. package/dist/core/ports/mikoshi.js +209 -0
  8. package/dist/core/sync/crypto.d.ts +55 -0
  9. package/dist/core/sync/crypto.js +189 -0
  10. package/dist/core/sync/memory-hash.d.ts +35 -0
  11. package/dist/core/sync/memory-hash.js +61 -0
  12. package/dist/core/sync/memory-merge.d.ts +13 -0
  13. package/dist/core/sync/memory-merge.js +84 -0
  14. package/dist/core/sync/normalize.d.ts +10 -0
  15. package/dist/core/sync/normalize.js +21 -0
  16. package/dist/core/sync/persona-hash.d.ts +15 -0
  17. package/dist/core/sync/persona-hash.js +36 -0
  18. package/dist/core/usecases/claw-pull.d.ts +44 -0
  19. package/dist/core/usecases/claw-pull.js +117 -0
  20. package/dist/core/usecases/extract.d.ts +0 -1
  21. package/dist/core/usecases/extract.js +13 -27
  22. package/dist/core/usecases/index.d.ts +8 -0
  23. package/dist/core/usecases/index.js +8 -0
  24. package/dist/core/usecases/inject.d.ts +1 -0
  25. package/dist/core/usecases/inject.js +2 -0
  26. package/dist/core/usecases/mikoshi-clone.d.ts +29 -0
  27. package/dist/core/usecases/mikoshi-clone.js +94 -0
  28. package/dist/core/usecases/mikoshi-download.d.ts +29 -0
  29. package/dist/core/usecases/mikoshi-download.js +94 -0
  30. package/dist/core/usecases/mikoshi-memory-pull.d.ts +38 -0
  31. package/dist/core/usecases/mikoshi-memory-pull.js +142 -0
  32. package/dist/core/usecases/mikoshi-memory-push.d.ts +34 -0
  33. package/dist/core/usecases/mikoshi-memory-push.js +105 -0
  34. package/dist/core/usecases/mikoshi-memory-sync.d.ts +36 -0
  35. package/dist/core/usecases/mikoshi-memory-sync.js +175 -0
  36. package/dist/core/usecases/mikoshi-pull.d.ts +44 -0
  37. package/dist/core/usecases/mikoshi-pull.js +124 -0
  38. package/dist/core/usecases/mikoshi-push.d.ts +39 -0
  39. package/dist/core/usecases/mikoshi-push.js +127 -0
  40. package/dist/core/usecases/mikoshi-status.d.ts +37 -0
  41. package/dist/core/usecases/mikoshi-status.js +92 -0
  42. package/dist/core/usecases/sync.d.ts +0 -5
  43. package/dist/core/usecases/sync.js +23 -61
  44. package/dist/interfaces/cli/commands/claw.js +134 -85
  45. package/dist/interfaces/cli/commands/config.js +59 -0
  46. package/dist/interfaces/cli/commands/create.js +17 -16
  47. package/dist/interfaces/cli/commands/init.js +11 -10
  48. package/dist/interfaces/cli/commands/list.js +9 -7
  49. package/dist/interfaces/cli/commands/migrate.js +8 -7
  50. package/dist/interfaces/cli/commands/mikoshi.d.ts +2 -0
  51. package/dist/interfaces/cli/commands/mikoshi.js +565 -0
  52. package/dist/interfaces/cli/commands/refresh-samples.js +10 -9
  53. package/dist/interfaces/cli/index.js +2 -0
  54. package/dist/interfaces/cli/output.d.ts +5 -0
  55. package/dist/interfaces/cli/output.js +16 -0
  56. package/dist/interfaces/cli/spinner.d.ts +13 -0
  57. package/dist/interfaces/cli/spinner.js +47 -0
  58. package/dist/shared/config.d.ts +23 -3
  59. package/dist/shared/config.js +30 -2
  60. package/package.json +1 -1
@@ -0,0 +1,937 @@
1
+ import { z } from "zod";
2
+ export declare const PersonaFileSchema: z.ZodObject<{
3
+ fileType: z.ZodEnum<["SOUL", "IDENTITY", "ENGRAM_JSON"]>;
4
+ filename: z.ZodString;
5
+ }, "strip", z.ZodTypeAny, {
6
+ filename: string;
7
+ fileType: "SOUL" | "IDENTITY" | "ENGRAM_JSON";
8
+ }, {
9
+ filename: string;
10
+ fileType: "SOUL" | "IDENTITY" | "ENGRAM_JSON";
11
+ }>;
12
+ export declare const MemorySummarySchema: z.ZodObject<{
13
+ hasMemory: z.ZodBoolean;
14
+ hasUserFile: z.ZodOptional<z.ZodBoolean>;
15
+ hasMemoryIndex: z.ZodOptional<z.ZodBoolean>;
16
+ memoryEntryCount: z.ZodOptional<z.ZodNumber>;
17
+ latestMemoryDate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
18
+ memoryUpdatedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
19
+ }, "strip", z.ZodTypeAny, {
20
+ hasMemory: boolean;
21
+ hasUserFile?: boolean | undefined;
22
+ hasMemoryIndex?: boolean | undefined;
23
+ memoryEntryCount?: number | undefined;
24
+ latestMemoryDate?: string | null | undefined;
25
+ memoryUpdatedAt?: string | null | undefined;
26
+ }, {
27
+ hasMemory: boolean;
28
+ hasUserFile?: boolean | undefined;
29
+ hasMemoryIndex?: boolean | undefined;
30
+ memoryEntryCount?: number | undefined;
31
+ latestMemoryDate?: string | null | undefined;
32
+ memoryUpdatedAt?: string | null | undefined;
33
+ }>;
34
+ export declare const MikoshiEngramSchema: z.ZodObject<{
35
+ id: z.ZodString;
36
+ sourceEngramId: z.ZodString;
37
+ name: z.ZodString;
38
+ description: z.ZodNullable<z.ZodString>;
39
+ visibility: z.ZodEnum<["PRIVATE", "UNLISTED", "PUBLIC"]>;
40
+ tags: z.ZodArray<z.ZodString, "many">;
41
+ avatarUrl: z.ZodNullable<z.ZodString>;
42
+ createdAt: z.ZodString;
43
+ updatedAt: z.ZodString;
44
+ personaFiles: z.ZodArray<z.ZodObject<{
45
+ fileType: z.ZodEnum<["SOUL", "IDENTITY", "ENGRAM_JSON"]>;
46
+ filename: z.ZodString;
47
+ }, "strip", z.ZodTypeAny, {
48
+ filename: string;
49
+ fileType: "SOUL" | "IDENTITY" | "ENGRAM_JSON";
50
+ }, {
51
+ filename: string;
52
+ fileType: "SOUL" | "IDENTITY" | "ENGRAM_JSON";
53
+ }>, "many">;
54
+ memory: z.ZodOptional<z.ZodObject<{
55
+ hasMemory: z.ZodBoolean;
56
+ hasUserFile: z.ZodOptional<z.ZodBoolean>;
57
+ hasMemoryIndex: z.ZodOptional<z.ZodBoolean>;
58
+ memoryEntryCount: z.ZodOptional<z.ZodNumber>;
59
+ latestMemoryDate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
60
+ memoryUpdatedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
61
+ }, "strip", z.ZodTypeAny, {
62
+ hasMemory: boolean;
63
+ hasUserFile?: boolean | undefined;
64
+ hasMemoryIndex?: boolean | undefined;
65
+ memoryEntryCount?: number | undefined;
66
+ latestMemoryDate?: string | null | undefined;
67
+ memoryUpdatedAt?: string | null | undefined;
68
+ }, {
69
+ hasMemory: boolean;
70
+ hasUserFile?: boolean | undefined;
71
+ hasMemoryIndex?: boolean | undefined;
72
+ memoryEntryCount?: number | undefined;
73
+ latestMemoryDate?: string | null | undefined;
74
+ memoryUpdatedAt?: string | null | undefined;
75
+ }>>;
76
+ }, "strip", z.ZodTypeAny, {
77
+ name: string;
78
+ description: string | null;
79
+ tags: string[];
80
+ id: string;
81
+ createdAt: string;
82
+ updatedAt: string;
83
+ sourceEngramId: string;
84
+ visibility: "PRIVATE" | "UNLISTED" | "PUBLIC";
85
+ avatarUrl: string | null;
86
+ personaFiles: {
87
+ filename: string;
88
+ fileType: "SOUL" | "IDENTITY" | "ENGRAM_JSON";
89
+ }[];
90
+ memory?: {
91
+ hasMemory: boolean;
92
+ hasUserFile?: boolean | undefined;
93
+ hasMemoryIndex?: boolean | undefined;
94
+ memoryEntryCount?: number | undefined;
95
+ latestMemoryDate?: string | null | undefined;
96
+ memoryUpdatedAt?: string | null | undefined;
97
+ } | undefined;
98
+ }, {
99
+ name: string;
100
+ description: string | null;
101
+ tags: string[];
102
+ id: string;
103
+ createdAt: string;
104
+ updatedAt: string;
105
+ sourceEngramId: string;
106
+ visibility: "PRIVATE" | "UNLISTED" | "PUBLIC";
107
+ avatarUrl: string | null;
108
+ personaFiles: {
109
+ filename: string;
110
+ fileType: "SOUL" | "IDENTITY" | "ENGRAM_JSON";
111
+ }[];
112
+ memory?: {
113
+ hasMemory: boolean;
114
+ hasUserFile?: boolean | undefined;
115
+ hasMemoryIndex?: boolean | undefined;
116
+ memoryEntryCount?: number | undefined;
117
+ latestMemoryDate?: string | null | undefined;
118
+ memoryUpdatedAt?: string | null | undefined;
119
+ } | undefined;
120
+ }>;
121
+ export type MikoshiEngram = z.infer<typeof MikoshiEngramSchema>;
122
+ export declare const PersonaFileWithContentSchema: z.ZodObject<{
123
+ fileType: z.ZodEnum<["SOUL", "IDENTITY", "ENGRAM_JSON"]>;
124
+ filename: z.ZodString;
125
+ content: z.ZodString;
126
+ }, "strip", z.ZodTypeAny, {
127
+ filename: string;
128
+ content: string;
129
+ fileType: "SOUL" | "IDENTITY" | "ENGRAM_JSON";
130
+ }, {
131
+ filename: string;
132
+ content: string;
133
+ fileType: "SOUL" | "IDENTITY" | "ENGRAM_JSON";
134
+ }>;
135
+ export declare const MikoshiEngramDetailSchema: z.ZodObject<{
136
+ id: z.ZodString;
137
+ sourceEngramId: z.ZodString;
138
+ name: z.ZodString;
139
+ description: z.ZodNullable<z.ZodString>;
140
+ visibility: z.ZodEnum<["PRIVATE", "UNLISTED", "PUBLIC"]>;
141
+ tags: z.ZodArray<z.ZodString, "many">;
142
+ avatarUrl: z.ZodNullable<z.ZodString>;
143
+ createdAt: z.ZodString;
144
+ updatedAt: z.ZodString;
145
+ personaFiles: z.ZodArray<z.ZodObject<{
146
+ fileType: z.ZodEnum<["SOUL", "IDENTITY", "ENGRAM_JSON"]>;
147
+ filename: z.ZodString;
148
+ content: z.ZodString;
149
+ }, "strip", z.ZodTypeAny, {
150
+ filename: string;
151
+ content: string;
152
+ fileType: "SOUL" | "IDENTITY" | "ENGRAM_JSON";
153
+ }, {
154
+ filename: string;
155
+ content: string;
156
+ fileType: "SOUL" | "IDENTITY" | "ENGRAM_JSON";
157
+ }>, "many">;
158
+ memory: z.ZodOptional<z.ZodObject<{
159
+ hasMemory: z.ZodBoolean;
160
+ hasUserFile: z.ZodOptional<z.ZodBoolean>;
161
+ hasMemoryIndex: z.ZodOptional<z.ZodBoolean>;
162
+ memoryEntryCount: z.ZodOptional<z.ZodNumber>;
163
+ latestMemoryDate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
164
+ memoryUpdatedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
165
+ }, "strip", z.ZodTypeAny, {
166
+ hasMemory: boolean;
167
+ hasUserFile?: boolean | undefined;
168
+ hasMemoryIndex?: boolean | undefined;
169
+ memoryEntryCount?: number | undefined;
170
+ latestMemoryDate?: string | null | undefined;
171
+ memoryUpdatedAt?: string | null | undefined;
172
+ }, {
173
+ hasMemory: boolean;
174
+ hasUserFile?: boolean | undefined;
175
+ hasMemoryIndex?: boolean | undefined;
176
+ memoryEntryCount?: number | undefined;
177
+ latestMemoryDate?: string | null | undefined;
178
+ memoryUpdatedAt?: string | null | undefined;
179
+ }>>;
180
+ }, "strip", z.ZodTypeAny, {
181
+ name: string;
182
+ description: string | null;
183
+ tags: string[];
184
+ id: string;
185
+ createdAt: string;
186
+ updatedAt: string;
187
+ sourceEngramId: string;
188
+ visibility: "PRIVATE" | "UNLISTED" | "PUBLIC";
189
+ avatarUrl: string | null;
190
+ personaFiles: {
191
+ filename: string;
192
+ content: string;
193
+ fileType: "SOUL" | "IDENTITY" | "ENGRAM_JSON";
194
+ }[];
195
+ memory?: {
196
+ hasMemory: boolean;
197
+ hasUserFile?: boolean | undefined;
198
+ hasMemoryIndex?: boolean | undefined;
199
+ memoryEntryCount?: number | undefined;
200
+ latestMemoryDate?: string | null | undefined;
201
+ memoryUpdatedAt?: string | null | undefined;
202
+ } | undefined;
203
+ }, {
204
+ name: string;
205
+ description: string | null;
206
+ tags: string[];
207
+ id: string;
208
+ createdAt: string;
209
+ updatedAt: string;
210
+ sourceEngramId: string;
211
+ visibility: "PRIVATE" | "UNLISTED" | "PUBLIC";
212
+ avatarUrl: string | null;
213
+ personaFiles: {
214
+ filename: string;
215
+ content: string;
216
+ fileType: "SOUL" | "IDENTITY" | "ENGRAM_JSON";
217
+ }[];
218
+ memory?: {
219
+ hasMemory: boolean;
220
+ hasUserFile?: boolean | undefined;
221
+ hasMemoryIndex?: boolean | undefined;
222
+ memoryEntryCount?: number | undefined;
223
+ latestMemoryDate?: string | null | undefined;
224
+ memoryUpdatedAt?: string | null | undefined;
225
+ } | undefined;
226
+ }>;
227
+ export type MikoshiEngramDetail = z.infer<typeof MikoshiEngramDetailSchema>;
228
+ export declare const CreateEngramInputSchema: z.ZodObject<{
229
+ name: z.ZodString;
230
+ sourceEngramId: z.ZodString;
231
+ description: z.ZodOptional<z.ZodString>;
232
+ visibility: z.ZodOptional<z.ZodEnum<["PRIVATE", "UNLISTED", "PUBLIC"]>>;
233
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
234
+ soul: z.ZodString;
235
+ identity: z.ZodString;
236
+ }, "strip", z.ZodTypeAny, {
237
+ soul: string;
238
+ identity: string;
239
+ name: string;
240
+ sourceEngramId: string;
241
+ description?: string | undefined;
242
+ tags?: string[] | undefined;
243
+ visibility?: "PRIVATE" | "UNLISTED" | "PUBLIC" | undefined;
244
+ }, {
245
+ soul: string;
246
+ identity: string;
247
+ name: string;
248
+ sourceEngramId: string;
249
+ description?: string | undefined;
250
+ tags?: string[] | undefined;
251
+ visibility?: "PRIVATE" | "UNLISTED" | "PUBLIC" | undefined;
252
+ }>;
253
+ export type CreateEngramInput = z.infer<typeof CreateEngramInputSchema>;
254
+ export declare const CreateEngramResponseSchema: z.ZodObject<{
255
+ id: z.ZodString;
256
+ sourceEngramId: z.ZodString;
257
+ name: z.ZodString;
258
+ visibility: z.ZodString;
259
+ url: z.ZodString;
260
+ }, "strip", z.ZodTypeAny, {
261
+ url: string;
262
+ name: string;
263
+ id: string;
264
+ sourceEngramId: string;
265
+ visibility: string;
266
+ }, {
267
+ url: string;
268
+ name: string;
269
+ id: string;
270
+ sourceEngramId: string;
271
+ visibility: string;
272
+ }>;
273
+ export type CreateEngramResponse = z.infer<typeof CreateEngramResponseSchema>;
274
+ export declare const UpdatePersonaInputSchema: z.ZodObject<{
275
+ soul: z.ZodString;
276
+ identity: z.ZodString;
277
+ expectedRemotePersonaHash: z.ZodString;
278
+ }, "strip", z.ZodTypeAny, {
279
+ soul: string;
280
+ identity: string;
281
+ expectedRemotePersonaHash: string;
282
+ }, {
283
+ soul: string;
284
+ identity: string;
285
+ expectedRemotePersonaHash: string;
286
+ }>;
287
+ export type UpdatePersonaInput = z.infer<typeof UpdatePersonaInputSchema>;
288
+ export declare const UpdatePersonaResponseSchema: z.ZodObject<{
289
+ engramId: z.ZodString;
290
+ persona: z.ZodObject<{
291
+ hash: z.ZodString;
292
+ updatedAt: z.ZodString;
293
+ }, "strip", z.ZodTypeAny, {
294
+ updatedAt: string;
295
+ hash: string;
296
+ }, {
297
+ updatedAt: string;
298
+ hash: string;
299
+ }>;
300
+ }, "strip", z.ZodTypeAny, {
301
+ engramId: string;
302
+ persona: {
303
+ updatedAt: string;
304
+ hash: string;
305
+ };
306
+ }, {
307
+ engramId: string;
308
+ persona: {
309
+ updatedAt: string;
310
+ hash: string;
311
+ };
312
+ }>;
313
+ export type UpdatePersonaResponse = z.infer<typeof UpdatePersonaResponseSchema>;
314
+ export declare const PersonaSyncTokenSchema: z.ZodObject<{
315
+ hash: z.ZodString;
316
+ updatedAt: z.ZodString;
317
+ }, "strip", z.ZodTypeAny, {
318
+ updatedAt: string;
319
+ hash: string;
320
+ }, {
321
+ updatedAt: string;
322
+ hash: string;
323
+ }>;
324
+ export declare const PersonaSyncStatusSchema: z.ZodObject<{
325
+ exists: z.ZodBoolean;
326
+ token: z.ZodNullable<z.ZodObject<{
327
+ hash: z.ZodString;
328
+ updatedAt: z.ZodString;
329
+ }, "strip", z.ZodTypeAny, {
330
+ updatedAt: string;
331
+ hash: string;
332
+ }, {
333
+ updatedAt: string;
334
+ hash: string;
335
+ }>>;
336
+ files: z.ZodObject<{
337
+ hasSoul: z.ZodBoolean;
338
+ hasIdentity: z.ZodBoolean;
339
+ }, "strip", z.ZodTypeAny, {
340
+ hasSoul: boolean;
341
+ hasIdentity: boolean;
342
+ }, {
343
+ hasSoul: boolean;
344
+ hasIdentity: boolean;
345
+ }>;
346
+ }, "strip", z.ZodTypeAny, {
347
+ files: {
348
+ hasSoul: boolean;
349
+ hasIdentity: boolean;
350
+ };
351
+ exists: boolean;
352
+ token: {
353
+ updatedAt: string;
354
+ hash: string;
355
+ } | null;
356
+ }, {
357
+ files: {
358
+ hasSoul: boolean;
359
+ hasIdentity: boolean;
360
+ };
361
+ exists: boolean;
362
+ token: {
363
+ updatedAt: string;
364
+ hash: string;
365
+ } | null;
366
+ }>;
367
+ export declare const MemorySyncTokenSchema: z.ZodObject<{
368
+ memoryContentHash: z.ZodString;
369
+ bundleHash: z.ZodString;
370
+ version: z.ZodNumber;
371
+ updatedAt: z.ZodString;
372
+ }, "strip", z.ZodTypeAny, {
373
+ updatedAt: string;
374
+ memoryContentHash: string;
375
+ bundleHash: string;
376
+ version: number;
377
+ }, {
378
+ updatedAt: string;
379
+ memoryContentHash: string;
380
+ bundleHash: string;
381
+ version: number;
382
+ }>;
383
+ export declare const MemorySyncSummarySchema: z.ZodObject<{
384
+ hasUserFile: z.ZodBoolean;
385
+ hasMemoryIndex: z.ZodBoolean;
386
+ memoryEntryCount: z.ZodNumber;
387
+ latestMemoryDate: z.ZodNullable<z.ZodString>;
388
+ }, "strip", z.ZodTypeAny, {
389
+ hasUserFile: boolean;
390
+ hasMemoryIndex: boolean;
391
+ memoryEntryCount: number;
392
+ latestMemoryDate: string | null;
393
+ }, {
394
+ hasUserFile: boolean;
395
+ hasMemoryIndex: boolean;
396
+ memoryEntryCount: number;
397
+ latestMemoryDate: string | null;
398
+ }>;
399
+ export declare const MemorySyncStatusSchema: z.ZodObject<{
400
+ exists: z.ZodBoolean;
401
+ token: z.ZodNullable<z.ZodObject<{
402
+ memoryContentHash: z.ZodString;
403
+ bundleHash: z.ZodString;
404
+ version: z.ZodNumber;
405
+ updatedAt: z.ZodString;
406
+ }, "strip", z.ZodTypeAny, {
407
+ updatedAt: string;
408
+ memoryContentHash: string;
409
+ bundleHash: string;
410
+ version: number;
411
+ }, {
412
+ updatedAt: string;
413
+ memoryContentHash: string;
414
+ bundleHash: string;
415
+ version: number;
416
+ }>>;
417
+ summary: z.ZodNullable<z.ZodObject<{
418
+ hasUserFile: z.ZodBoolean;
419
+ hasMemoryIndex: z.ZodBoolean;
420
+ memoryEntryCount: z.ZodNumber;
421
+ latestMemoryDate: z.ZodNullable<z.ZodString>;
422
+ }, "strip", z.ZodTypeAny, {
423
+ hasUserFile: boolean;
424
+ hasMemoryIndex: boolean;
425
+ memoryEntryCount: number;
426
+ latestMemoryDate: string | null;
427
+ }, {
428
+ hasUserFile: boolean;
429
+ hasMemoryIndex: boolean;
430
+ memoryEntryCount: number;
431
+ latestMemoryDate: string | null;
432
+ }>>;
433
+ }, "strip", z.ZodTypeAny, {
434
+ exists: boolean;
435
+ token: {
436
+ updatedAt: string;
437
+ memoryContentHash: string;
438
+ bundleHash: string;
439
+ version: number;
440
+ } | null;
441
+ summary: {
442
+ hasUserFile: boolean;
443
+ hasMemoryIndex: boolean;
444
+ memoryEntryCount: number;
445
+ latestMemoryDate: string | null;
446
+ } | null;
447
+ }, {
448
+ exists: boolean;
449
+ token: {
450
+ updatedAt: string;
451
+ memoryContentHash: string;
452
+ bundleHash: string;
453
+ version: number;
454
+ } | null;
455
+ summary: {
456
+ hasUserFile: boolean;
457
+ hasMemoryIndex: boolean;
458
+ memoryEntryCount: number;
459
+ latestMemoryDate: string | null;
460
+ } | null;
461
+ }>;
462
+ export declare const SyncStatusResponseSchema: z.ZodObject<{
463
+ engramId: z.ZodString;
464
+ persona: z.ZodObject<{
465
+ exists: z.ZodBoolean;
466
+ token: z.ZodNullable<z.ZodObject<{
467
+ hash: z.ZodString;
468
+ updatedAt: z.ZodString;
469
+ }, "strip", z.ZodTypeAny, {
470
+ updatedAt: string;
471
+ hash: string;
472
+ }, {
473
+ updatedAt: string;
474
+ hash: string;
475
+ }>>;
476
+ files: z.ZodObject<{
477
+ hasSoul: z.ZodBoolean;
478
+ hasIdentity: z.ZodBoolean;
479
+ }, "strip", z.ZodTypeAny, {
480
+ hasSoul: boolean;
481
+ hasIdentity: boolean;
482
+ }, {
483
+ hasSoul: boolean;
484
+ hasIdentity: boolean;
485
+ }>;
486
+ }, "strip", z.ZodTypeAny, {
487
+ files: {
488
+ hasSoul: boolean;
489
+ hasIdentity: boolean;
490
+ };
491
+ exists: boolean;
492
+ token: {
493
+ updatedAt: string;
494
+ hash: string;
495
+ } | null;
496
+ }, {
497
+ files: {
498
+ hasSoul: boolean;
499
+ hasIdentity: boolean;
500
+ };
501
+ exists: boolean;
502
+ token: {
503
+ updatedAt: string;
504
+ hash: string;
505
+ } | null;
506
+ }>;
507
+ memory: z.ZodObject<{
508
+ exists: z.ZodBoolean;
509
+ token: z.ZodNullable<z.ZodObject<{
510
+ memoryContentHash: z.ZodString;
511
+ bundleHash: z.ZodString;
512
+ version: z.ZodNumber;
513
+ updatedAt: z.ZodString;
514
+ }, "strip", z.ZodTypeAny, {
515
+ updatedAt: string;
516
+ memoryContentHash: string;
517
+ bundleHash: string;
518
+ version: number;
519
+ }, {
520
+ updatedAt: string;
521
+ memoryContentHash: string;
522
+ bundleHash: string;
523
+ version: number;
524
+ }>>;
525
+ summary: z.ZodNullable<z.ZodObject<{
526
+ hasUserFile: z.ZodBoolean;
527
+ hasMemoryIndex: z.ZodBoolean;
528
+ memoryEntryCount: z.ZodNumber;
529
+ latestMemoryDate: z.ZodNullable<z.ZodString>;
530
+ }, "strip", z.ZodTypeAny, {
531
+ hasUserFile: boolean;
532
+ hasMemoryIndex: boolean;
533
+ memoryEntryCount: number;
534
+ latestMemoryDate: string | null;
535
+ }, {
536
+ hasUserFile: boolean;
537
+ hasMemoryIndex: boolean;
538
+ memoryEntryCount: number;
539
+ latestMemoryDate: string | null;
540
+ }>>;
541
+ }, "strip", z.ZodTypeAny, {
542
+ exists: boolean;
543
+ token: {
544
+ updatedAt: string;
545
+ memoryContentHash: string;
546
+ bundleHash: string;
547
+ version: number;
548
+ } | null;
549
+ summary: {
550
+ hasUserFile: boolean;
551
+ hasMemoryIndex: boolean;
552
+ memoryEntryCount: number;
553
+ latestMemoryDate: string | null;
554
+ } | null;
555
+ }, {
556
+ exists: boolean;
557
+ token: {
558
+ updatedAt: string;
559
+ memoryContentHash: string;
560
+ bundleHash: string;
561
+ version: number;
562
+ } | null;
563
+ summary: {
564
+ hasUserFile: boolean;
565
+ hasMemoryIndex: boolean;
566
+ memoryEntryCount: number;
567
+ latestMemoryDate: string | null;
568
+ } | null;
569
+ }>;
570
+ }, "strip", z.ZodTypeAny, {
571
+ memory: {
572
+ exists: boolean;
573
+ token: {
574
+ updatedAt: string;
575
+ memoryContentHash: string;
576
+ bundleHash: string;
577
+ version: number;
578
+ } | null;
579
+ summary: {
580
+ hasUserFile: boolean;
581
+ hasMemoryIndex: boolean;
582
+ memoryEntryCount: number;
583
+ latestMemoryDate: string | null;
584
+ } | null;
585
+ };
586
+ engramId: string;
587
+ persona: {
588
+ files: {
589
+ hasSoul: boolean;
590
+ hasIdentity: boolean;
591
+ };
592
+ exists: boolean;
593
+ token: {
594
+ updatedAt: string;
595
+ hash: string;
596
+ } | null;
597
+ };
598
+ }, {
599
+ memory: {
600
+ exists: boolean;
601
+ token: {
602
+ updatedAt: string;
603
+ memoryContentHash: string;
604
+ bundleHash: string;
605
+ version: number;
606
+ } | null;
607
+ summary: {
608
+ hasUserFile: boolean;
609
+ hasMemoryIndex: boolean;
610
+ memoryEntryCount: number;
611
+ latestMemoryDate: string | null;
612
+ } | null;
613
+ };
614
+ engramId: string;
615
+ persona: {
616
+ files: {
617
+ hasSoul: boolean;
618
+ hasIdentity: boolean;
619
+ };
620
+ exists: boolean;
621
+ token: {
622
+ updatedAt: string;
623
+ hash: string;
624
+ } | null;
625
+ };
626
+ }>;
627
+ export type SyncStatusResponse = z.infer<typeof SyncStatusResponseSchema>;
628
+ export declare const ScryptParamsSchema: z.ZodObject<{
629
+ N: z.ZodNumber;
630
+ r: z.ZodNumber;
631
+ p: z.ZodNumber;
632
+ dkLen: z.ZodNumber;
633
+ }, "strip", z.ZodTypeAny, {
634
+ N: number;
635
+ r: number;
636
+ p: number;
637
+ dkLen: number;
638
+ }, {
639
+ N: number;
640
+ r: number;
641
+ p: number;
642
+ dkLen: number;
643
+ }>;
644
+ export declare const MemoryManifestSchema: z.ZodObject<{
645
+ payloadKind: z.ZodLiteral<"memory">;
646
+ bundleVersion: z.ZodNumber;
647
+ hasUserFile: z.ZodBoolean;
648
+ hasMemoryIndex: z.ZodBoolean;
649
+ memoryEntryCount: z.ZodNumber;
650
+ latestMemoryDate: z.ZodNullable<z.ZodString>;
651
+ }, "strip", z.ZodTypeAny, {
652
+ hasUserFile: boolean;
653
+ hasMemoryIndex: boolean;
654
+ memoryEntryCount: number;
655
+ latestMemoryDate: string | null;
656
+ payloadKind: "memory";
657
+ bundleVersion: number;
658
+ }, {
659
+ hasUserFile: boolean;
660
+ hasMemoryIndex: boolean;
661
+ memoryEntryCount: number;
662
+ latestMemoryDate: string | null;
663
+ payloadKind: "memory";
664
+ bundleVersion: number;
665
+ }>;
666
+ export declare const UploadMemoryInputSchema: z.ZodObject<{
667
+ ciphertext: z.ZodString;
668
+ cipherAlgorithm: z.ZodLiteral<"AES-256-GCM">;
669
+ cipherNonce: z.ZodString;
670
+ wrappedBundleKey: z.ZodString;
671
+ wrapAlgorithm: z.ZodLiteral<"AES-256-GCM">;
672
+ kdfAlgorithm: z.ZodLiteral<"scrypt">;
673
+ kdfSalt: z.ZodString;
674
+ kdfParams: z.ZodObject<{
675
+ N: z.ZodNumber;
676
+ r: z.ZodNumber;
677
+ p: z.ZodNumber;
678
+ dkLen: z.ZodNumber;
679
+ }, "strip", z.ZodTypeAny, {
680
+ N: number;
681
+ r: number;
682
+ p: number;
683
+ dkLen: number;
684
+ }, {
685
+ N: number;
686
+ r: number;
687
+ p: number;
688
+ dkLen: number;
689
+ }>;
690
+ manifest: z.ZodObject<{
691
+ payloadKind: z.ZodLiteral<"memory">;
692
+ bundleVersion: z.ZodNumber;
693
+ hasUserFile: z.ZodBoolean;
694
+ hasMemoryIndex: z.ZodBoolean;
695
+ memoryEntryCount: z.ZodNumber;
696
+ latestMemoryDate: z.ZodNullable<z.ZodString>;
697
+ }, "strip", z.ZodTypeAny, {
698
+ hasUserFile: boolean;
699
+ hasMemoryIndex: boolean;
700
+ memoryEntryCount: number;
701
+ latestMemoryDate: string | null;
702
+ payloadKind: "memory";
703
+ bundleVersion: number;
704
+ }, {
705
+ hasUserFile: boolean;
706
+ hasMemoryIndex: boolean;
707
+ memoryEntryCount: number;
708
+ latestMemoryDate: string | null;
709
+ payloadKind: "memory";
710
+ bundleVersion: number;
711
+ }>;
712
+ expectedRemoteMemoryContentHash: z.ZodNullable<z.ZodString>;
713
+ memoryContentHash: z.ZodString;
714
+ bundleHash: z.ZodString;
715
+ }, "strip", z.ZodTypeAny, {
716
+ memoryContentHash: string;
717
+ bundleHash: string;
718
+ ciphertext: string;
719
+ cipherAlgorithm: "AES-256-GCM";
720
+ cipherNonce: string;
721
+ wrappedBundleKey: string;
722
+ wrapAlgorithm: "AES-256-GCM";
723
+ kdfAlgorithm: "scrypt";
724
+ kdfSalt: string;
725
+ kdfParams: {
726
+ N: number;
727
+ r: number;
728
+ p: number;
729
+ dkLen: number;
730
+ };
731
+ manifest: {
732
+ hasUserFile: boolean;
733
+ hasMemoryIndex: boolean;
734
+ memoryEntryCount: number;
735
+ latestMemoryDate: string | null;
736
+ payloadKind: "memory";
737
+ bundleVersion: number;
738
+ };
739
+ expectedRemoteMemoryContentHash: string | null;
740
+ }, {
741
+ memoryContentHash: string;
742
+ bundleHash: string;
743
+ ciphertext: string;
744
+ cipherAlgorithm: "AES-256-GCM";
745
+ cipherNonce: string;
746
+ wrappedBundleKey: string;
747
+ wrapAlgorithm: "AES-256-GCM";
748
+ kdfAlgorithm: "scrypt";
749
+ kdfSalt: string;
750
+ kdfParams: {
751
+ N: number;
752
+ r: number;
753
+ p: number;
754
+ dkLen: number;
755
+ };
756
+ manifest: {
757
+ hasUserFile: boolean;
758
+ hasMemoryIndex: boolean;
759
+ memoryEntryCount: number;
760
+ latestMemoryDate: string | null;
761
+ payloadKind: "memory";
762
+ bundleVersion: number;
763
+ };
764
+ expectedRemoteMemoryContentHash: string | null;
765
+ }>;
766
+ export type UploadMemoryInput = z.infer<typeof UploadMemoryInputSchema>;
767
+ export declare const UploadMemoryResponseSchema: z.ZodObject<{
768
+ engramId: z.ZodString;
769
+ version: z.ZodNumber;
770
+ memoryContentHash: z.ZodString;
771
+ bundleHash: z.ZodString;
772
+ updatedAt: z.ZodString;
773
+ }, "strip", z.ZodTypeAny, {
774
+ updatedAt: string;
775
+ engramId: string;
776
+ memoryContentHash: string;
777
+ bundleHash: string;
778
+ version: number;
779
+ }, {
780
+ updatedAt: string;
781
+ engramId: string;
782
+ memoryContentHash: string;
783
+ bundleHash: string;
784
+ version: number;
785
+ }>;
786
+ export type UploadMemoryResponse = z.infer<typeof UploadMemoryResponseSchema>;
787
+ export declare const DownloadMemoryResponseSchema: z.ZodDiscriminatedUnion<"hasMemory", [z.ZodObject<{
788
+ engramId: z.ZodString;
789
+ hasMemory: z.ZodLiteral<true>;
790
+ version: z.ZodNumber;
791
+ ciphertext: z.ZodString;
792
+ cipherAlgorithm: z.ZodLiteral<"AES-256-GCM">;
793
+ cipherNonce: z.ZodString;
794
+ wrappedBundleKey: z.ZodString;
795
+ wrapAlgorithm: z.ZodLiteral<"AES-256-GCM">;
796
+ kdfAlgorithm: z.ZodLiteral<"scrypt">;
797
+ kdfSalt: z.ZodString;
798
+ kdfParams: z.ZodObject<{
799
+ N: z.ZodNumber;
800
+ r: z.ZodNumber;
801
+ p: z.ZodNumber;
802
+ dkLen: z.ZodNumber;
803
+ }, "strip", z.ZodTypeAny, {
804
+ N: number;
805
+ r: number;
806
+ p: number;
807
+ dkLen: number;
808
+ }, {
809
+ N: number;
810
+ r: number;
811
+ p: number;
812
+ dkLen: number;
813
+ }>;
814
+ manifest: z.ZodObject<{
815
+ payloadKind: z.ZodLiteral<"memory">;
816
+ bundleVersion: z.ZodNumber;
817
+ hasUserFile: z.ZodBoolean;
818
+ hasMemoryIndex: z.ZodBoolean;
819
+ memoryEntryCount: z.ZodNumber;
820
+ latestMemoryDate: z.ZodNullable<z.ZodString>;
821
+ }, "strip", z.ZodTypeAny, {
822
+ hasUserFile: boolean;
823
+ hasMemoryIndex: boolean;
824
+ memoryEntryCount: number;
825
+ latestMemoryDate: string | null;
826
+ payloadKind: "memory";
827
+ bundleVersion: number;
828
+ }, {
829
+ hasUserFile: boolean;
830
+ hasMemoryIndex: boolean;
831
+ memoryEntryCount: number;
832
+ latestMemoryDate: string | null;
833
+ payloadKind: "memory";
834
+ bundleVersion: number;
835
+ }>;
836
+ memoryContentHash: z.ZodString;
837
+ bundleHash: z.ZodString;
838
+ createdAt: z.ZodString;
839
+ updatedAt: z.ZodString;
840
+ }, "strip", z.ZodTypeAny, {
841
+ createdAt: string;
842
+ updatedAt: string;
843
+ hasMemory: true;
844
+ engramId: string;
845
+ memoryContentHash: string;
846
+ bundleHash: string;
847
+ version: number;
848
+ ciphertext: string;
849
+ cipherAlgorithm: "AES-256-GCM";
850
+ cipherNonce: string;
851
+ wrappedBundleKey: string;
852
+ wrapAlgorithm: "AES-256-GCM";
853
+ kdfAlgorithm: "scrypt";
854
+ kdfSalt: string;
855
+ kdfParams: {
856
+ N: number;
857
+ r: number;
858
+ p: number;
859
+ dkLen: number;
860
+ };
861
+ manifest: {
862
+ hasUserFile: boolean;
863
+ hasMemoryIndex: boolean;
864
+ memoryEntryCount: number;
865
+ latestMemoryDate: string | null;
866
+ payloadKind: "memory";
867
+ bundleVersion: number;
868
+ };
869
+ }, {
870
+ createdAt: string;
871
+ updatedAt: string;
872
+ hasMemory: true;
873
+ engramId: string;
874
+ memoryContentHash: string;
875
+ bundleHash: string;
876
+ version: number;
877
+ ciphertext: string;
878
+ cipherAlgorithm: "AES-256-GCM";
879
+ cipherNonce: string;
880
+ wrappedBundleKey: string;
881
+ wrapAlgorithm: "AES-256-GCM";
882
+ kdfAlgorithm: "scrypt";
883
+ kdfSalt: string;
884
+ kdfParams: {
885
+ N: number;
886
+ r: number;
887
+ p: number;
888
+ dkLen: number;
889
+ };
890
+ manifest: {
891
+ hasUserFile: boolean;
892
+ hasMemoryIndex: boolean;
893
+ memoryEntryCount: number;
894
+ latestMemoryDate: string | null;
895
+ payloadKind: "memory";
896
+ bundleVersion: number;
897
+ };
898
+ }>, z.ZodObject<{
899
+ engramId: z.ZodString;
900
+ hasMemory: z.ZodLiteral<false>;
901
+ }, "strip", z.ZodTypeAny, {
902
+ hasMemory: false;
903
+ engramId: string;
904
+ }, {
905
+ hasMemory: false;
906
+ engramId: string;
907
+ }>]>;
908
+ export type DownloadMemoryResponse = z.infer<typeof DownloadMemoryResponseSchema>;
909
+ export declare class MikoshiApiError extends Error {
910
+ readonly status: number;
911
+ readonly code: string | undefined;
912
+ readonly body?: unknown | undefined;
913
+ constructor(status: number, code: string | undefined, message: string, body?: unknown | undefined);
914
+ get isUnauthorized(): boolean;
915
+ get isForbidden(): boolean;
916
+ get isNotFound(): boolean;
917
+ get isConflict(): boolean;
918
+ get isRateLimited(): boolean;
919
+ }
920
+ export interface MikoshiClient {
921
+ /** 認証ユーザーの全Engram一覧 */
922
+ getEngrams(): Promise<MikoshiEngram[]>;
923
+ /** sourceEngramId でリモートEngramを検索 (一覧から絞り込み) */
924
+ getEngramBySourceId(sourceEngramId: string): Promise<MikoshiEngram | null>;
925
+ /** Engram 詳細取得 (persona content 込み) */
926
+ getEngram(engramId: string): Promise<MikoshiEngramDetail>;
927
+ /** 新しいEngramをクラウドに作成 */
928
+ createEngram(input: CreateEngramInput): Promise<CreateEngramResponse>;
929
+ /** Engram の sync 比較トークンを取得 */
930
+ getSyncStatus(engramId: string): Promise<SyncStatusResponse>;
931
+ /** Persona ファイルを上書き (optimistic concurrency) */
932
+ updatePersona(engramId: string, input: UpdatePersonaInput): Promise<UpdatePersonaResponse>;
933
+ /** 暗号化メモリバンドルをアップロード */
934
+ uploadMemory(engramId: string, input: UploadMemoryInput): Promise<UploadMemoryResponse>;
935
+ /** 暗号化メモリバンドルをダウンロード */
936
+ downloadMemory(engramId: string): Promise<DownloadMemoryResponse>;
937
+ }