memeloop 0.0.1 → 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.
Files changed (228) hide show
  1. package/README.md +63 -0
  2. package/dist/browser.cjs +1413 -0
  3. package/dist/browser.cjs.map +1 -0
  4. package/dist/browser.d.cts +3066 -0
  5. package/dist/browser.d.ts +3066 -0
  6. package/dist/browser.js +43 -0
  7. package/dist/chunk-2C6BJZI3.js +382 -0
  8. package/dist/chunk-2C6BJZI3.js.map +1 -0
  9. package/dist/chunk-426CJUZP.js +630 -0
  10. package/dist/chunk-426CJUZP.js.map +1 -0
  11. package/dist/chunk-7ZDTB4VZ.js +63 -0
  12. package/dist/chunk-7ZDTB4VZ.js.map +1 -0
  13. package/dist/chunk-AZFYDWIN.js +98 -0
  14. package/dist/chunk-AZFYDWIN.js.map +1 -0
  15. package/dist/chunk-BGPU4RR7.js +367 -0
  16. package/dist/chunk-BGPU4RR7.js.map +1 -0
  17. package/dist/chunk-CCEFAOSH.js +496 -0
  18. package/dist/chunk-CCEFAOSH.js.map +1 -0
  19. package/dist/chunk-FWSY5HOA.js +63 -0
  20. package/dist/chunk-FWSY5HOA.js.map +1 -0
  21. package/dist/chunk-GYIOMQMY.js +8726 -0
  22. package/dist/chunk-GYIOMQMY.js.map +1 -0
  23. package/dist/chunk-K6P63KD4.js +68 -0
  24. package/dist/chunk-K6P63KD4.js.map +1 -0
  25. package/dist/chunk-KFS2EJT6.js +42 -0
  26. package/dist/chunk-KFS2EJT6.js.map +1 -0
  27. package/dist/chunk-MAJWHAKR.js +3637 -0
  28. package/dist/chunk-MAJWHAKR.js.map +1 -0
  29. package/dist/chunk-MRKY4HGF.js +205 -0
  30. package/dist/chunk-MRKY4HGF.js.map +1 -0
  31. package/dist/chunk-T7FSXWFR.js +2744 -0
  32. package/dist/chunk-T7FSXWFR.js.map +1 -0
  33. package/dist/chunk-VZKQX5PP.js +1 -0
  34. package/dist/chunk-VZKQX5PP.js.map +1 -0
  35. package/dist/chunk-WAI6BODI.js +175 -0
  36. package/dist/chunk-WAI6BODI.js.map +1 -0
  37. package/dist/chunk-YMNXDNDW.js +798 -0
  38. package/dist/chunk-YMNXDNDW.js.map +1 -0
  39. package/dist/conversation.cjs +208 -0
  40. package/dist/conversation.cjs.map +1 -0
  41. package/dist/conversation.d.cts +100 -0
  42. package/dist/conversation.d.ts +100 -0
  43. package/dist/conversation.js +21 -0
  44. package/dist/conversation.js.map +1 -0
  45. package/dist/device-network-portable.cjs +702 -0
  46. package/dist/device-network-portable.cjs.map +1 -0
  47. package/dist/device-network-portable.d.cts +110 -0
  48. package/dist/device-network-portable.d.ts +110 -0
  49. package/dist/device-network-portable.js +53 -0
  50. package/dist/device-network-portable.js.map +1 -0
  51. package/dist/device-network.cjs +906 -0
  52. package/dist/device-network.cjs.map +1 -0
  53. package/dist/device-network.d.cts +6 -0
  54. package/dist/device-network.d.ts +6 -0
  55. package/dist/device-network.js +59 -0
  56. package/dist/device-network.js.map +1 -0
  57. package/dist/fetchProvider-WWnWnQFP.d.ts +91 -0
  58. package/dist/fetchProvider-toTHy5Nu.d.cts +91 -0
  59. package/dist/index.cjs +28051 -5459
  60. package/dist/index.cjs.map +1 -1
  61. package/dist/index.d.cts +94 -1320
  62. package/dist/index.d.ts +94 -1320
  63. package/dist/index.js +10616 -2420
  64. package/dist/index.js.map +1 -1
  65. package/dist/interface-IrKBFtL1.d.cts +493 -0
  66. package/dist/interface-IrKBFtL1.d.ts +493 -0
  67. package/dist/llm-providers.cjs +43 -8
  68. package/dist/llm-providers.cjs.map +1 -1
  69. package/dist/llm-providers.d.cts +2 -1
  70. package/dist/llm-providers.d.ts +2 -1
  71. package/dist/llm-providers.js +4 -2
  72. package/dist/llm-providers.js.map +1 -1
  73. package/dist/loop-api.cjs +5227 -2010
  74. package/dist/loop-api.cjs.map +1 -1
  75. package/dist/loop-api.d.cts +11 -5
  76. package/dist/loop-api.d.ts +11 -5
  77. package/dist/loop-api.js +86 -49
  78. package/dist/mobile.cjs +2711 -0
  79. package/dist/mobile.cjs.map +1 -0
  80. package/dist/mobile.d.cts +6 -0
  81. package/dist/mobile.d.ts +6 -0
  82. package/dist/mobile.js +22 -0
  83. package/dist/mobile.js.map +1 -0
  84. package/dist/orchestration-portable-BHB_YrNN.d.ts +2192 -0
  85. package/dist/orchestration-portable-mvYBvGBb.d.cts +2192 -0
  86. package/dist/orchestration-portable.cjs +9553 -0
  87. package/dist/orchestration-portable.cjs.map +1 -0
  88. package/dist/orchestration-portable.d.cts +5 -0
  89. package/dist/orchestration-portable.d.ts +5 -0
  90. package/dist/orchestration-portable.js +290 -0
  91. package/dist/orchestration-portable.js.map +1 -0
  92. package/dist/pairingInvite-BXPWY3aM.d.cts +149 -0
  93. package/dist/pairingInvite-Cuz0wuq9.d.ts +149 -0
  94. package/dist/promptConcat-0WNFTg4l.d.ts +516 -0
  95. package/dist/promptConcat-D6wr5V-V.d.cts +516 -0
  96. package/dist/providerRegistry-Bi6pAvSj.d.ts +86 -0
  97. package/dist/providerRegistry-CPsktuiX.d.cts +86 -0
  98. package/dist/registry-D0kbxksn.d.cts +393 -0
  99. package/dist/registry-DDbvhlhs.d.ts +393 -0
  100. package/dist/remoteClient-B_spK019.d.ts +87 -0
  101. package/dist/remoteClient-CBggnRy3.d.cts +87 -0
  102. package/dist/runtime-PGWR6FIV.js +18 -0
  103. package/dist/runtime-PGWR6FIV.js.map +1 -0
  104. package/dist/scriptDeploymentPipeline-CXJcC82H.d.ts +2464 -0
  105. package/dist/scriptDeploymentPipeline-yG1ZhVVI.d.cts +2464 -0
  106. package/dist/syncCloudDevices-BEqwgrhD.d.ts +49 -0
  107. package/dist/syncCloudDevices-Ds_Kcgrv.d.cts +49 -0
  108. package/dist/types-7pYti-k9.d.cts +255 -0
  109. package/dist/types-CdFVSntj.d.ts +255 -0
  110. package/package.json +110 -35
  111. package/dist/anthropic.cjs +0 -72
  112. package/dist/anthropic.cjs.map +0 -1
  113. package/dist/anthropic.d.cts +0 -21
  114. package/dist/anthropic.d.ts +0 -21
  115. package/dist/anthropic.js +0 -21
  116. package/dist/anthropic.js.map +0 -1
  117. package/dist/azure.cjs +0 -72
  118. package/dist/azure.cjs.map +0 -1
  119. package/dist/azure.d.cts +0 -21
  120. package/dist/azure.d.ts +0 -21
  121. package/dist/azure.js +0 -21
  122. package/dist/azure.js.map +0 -1
  123. package/dist/chunk-3CN7DFBL.js +0 -4894
  124. package/dist/chunk-3CN7DFBL.js.map +0 -1
  125. package/dist/chunk-4AZ4D7U5.js +0 -32
  126. package/dist/chunk-4AZ4D7U5.js.map +0 -1
  127. package/dist/chunk-6ON4XSOV.js +0 -63
  128. package/dist/chunk-6ON4XSOV.js.map +0 -1
  129. package/dist/chunk-DJQNGIXX.js +0 -4793
  130. package/dist/chunk-DJQNGIXX.js.map +0 -1
  131. package/dist/chunk-FKQP6AOQ.js +0 -32
  132. package/dist/chunk-FKQP6AOQ.js.map +0 -1
  133. package/dist/chunk-OVJ7JJBA.js +0 -35
  134. package/dist/chunk-OVJ7JJBA.js.map +0 -1
  135. package/dist/chunk-P4UZ7IXC.js +0 -42
  136. package/dist/chunk-YHJ2AEFR.js +0 -4933
  137. package/dist/chunk-YHJ2AEFR.js.map +0 -1
  138. package/dist/chunk-YVK7RYRO.js +0 -4973
  139. package/dist/chunk-YVK7RYRO.js.map +0 -1
  140. package/dist/code-assistant.json +0 -114
  141. package/dist/cohere.cjs +0 -72
  142. package/dist/cohere.cjs.map +0 -1
  143. package/dist/cohere.d.cts +0 -21
  144. package/dist/cohere.d.ts +0 -21
  145. package/dist/cohere.js +0 -21
  146. package/dist/cohere.js.map +0 -1
  147. package/dist/deepseek.cjs +0 -72
  148. package/dist/deepseek.cjs.map +0 -1
  149. package/dist/deepseek.d.cts +0 -21
  150. package/dist/deepseek.d.ts +0 -21
  151. package/dist/deepseek.js +0 -21
  152. package/dist/deepseek.js.map +0 -1
  153. package/dist/dist-65U7OYRG.js +0 -1257
  154. package/dist/dist-65U7OYRG.js.map +0 -1
  155. package/dist/fetchProvider-Cu4WkU5O.d.cts +0 -819
  156. package/dist/fetchProvider-Cu4WkU5O.d.ts +0 -819
  157. package/dist/frontend-ui-ux.json +0 -105
  158. package/dist/general-assistant.json +0 -95
  159. package/dist/git-master.json +0 -51
  160. package/dist/google-vertex.cjs +0 -72
  161. package/dist/google-vertex.cjs.map +0 -1
  162. package/dist/google-vertex.d.cts +0 -21
  163. package/dist/google-vertex.d.ts +0 -21
  164. package/dist/google-vertex.js +0 -21
  165. package/dist/google-vertex.js.map +0 -1
  166. package/dist/google.cjs +0 -72
  167. package/dist/google.cjs.map +0 -1
  168. package/dist/google.d.cts +0 -21
  169. package/dist/google.d.ts +0 -21
  170. package/dist/google.js +0 -21
  171. package/dist/google.js.map +0 -1
  172. package/dist/groq.cjs +0 -72
  173. package/dist/groq.cjs.map +0 -1
  174. package/dist/groq.d.cts +0 -21
  175. package/dist/groq.d.ts +0 -21
  176. package/dist/groq.js +0 -21
  177. package/dist/groq.js.map +0 -1
  178. package/dist/index.d.mts +0 -3203
  179. package/dist/index.mjs +0 -7064
  180. package/dist/index.mjs.map +0 -1
  181. package/dist/mistral.cjs +0 -72
  182. package/dist/mistral.cjs.map +0 -1
  183. package/dist/mistral.d.cts +0 -21
  184. package/dist/mistral.d.ts +0 -21
  185. package/dist/mistral.js +0 -21
  186. package/dist/mistral.js.map +0 -1
  187. package/dist/multipart-parser-EJCXIUHC.js +0 -372
  188. package/dist/multipart-parser-EJCXIUHC.js.map +0 -1
  189. package/dist/openai.cjs +0 -72
  190. package/dist/openai.cjs.map +0 -1
  191. package/dist/openai.d.cts +0 -21
  192. package/dist/openai.d.ts +0 -21
  193. package/dist/openai.js +0 -21
  194. package/dist/openai.js.map +0 -1
  195. package/dist/perplexity.cjs +0 -72
  196. package/dist/perplexity.cjs.map +0 -1
  197. package/dist/perplexity.d.cts +0 -21
  198. package/dist/perplexity.d.ts +0 -21
  199. package/dist/perplexity.js +0 -21
  200. package/dist/perplexity.js.map +0 -1
  201. package/dist/playwright.json +0 -52
  202. package/dist/promptConcat-BJdazTg5.d.cts +0 -1832
  203. package/dist/promptConcat-BJdazTg5.d.ts +0 -1832
  204. package/dist/promptConcat-CAkpni_8.d.cts +0 -1834
  205. package/dist/promptConcat-CAkpni_8.d.ts +0 -1834
  206. package/dist/promptConcat-CfH5-GAE.d.cts +0 -1036
  207. package/dist/promptConcat-ChcAZOOL.d.ts +0 -1036
  208. package/dist/promptConcat-G5TnJVRy.d.cts +0 -1800
  209. package/dist/promptConcat-G5TnJVRy.d.ts +0 -1800
  210. package/dist/promptConcat-L72eowzp.d.ts +0 -1090
  211. package/dist/promptConcat-eLHdN7K8.d.cts +0 -1090
  212. package/dist/src-VTSXKG72.js +0 -1409
  213. package/dist/src-VTSXKG72.js.map +0 -1
  214. package/dist/togetherai.cjs +0 -72
  215. package/dist/togetherai.cjs.map +0 -1
  216. package/dist/togetherai.d.cts +0 -21
  217. package/dist/togetherai.d.ts +0 -21
  218. package/dist/togetherai.js +0 -21
  219. package/dist/togetherai.js.map +0 -1
  220. package/dist/types-B0Jm2l38.d.cts +0 -767
  221. package/dist/types-B0Jm2l38.d.ts +0 -767
  222. package/dist/xai.cjs +0 -72
  223. package/dist/xai.cjs.map +0 -1
  224. package/dist/xai.d.cts +0 -21
  225. package/dist/xai.d.ts +0 -21
  226. package/dist/xai.js +0 -21
  227. package/dist/xai.js.map +0 -1
  228. /package/dist/{chunk-P4UZ7IXC.js.map → browser.js.map} +0 -0
@@ -0,0 +1,49 @@
1
+ import { l as DeviceNetworkService, L as LocalDeviceIdentity, g as DeviceCapabilities, T as TrustedDeviceRecord, D as Device, P as PairingSession, x as LocalPairingRequestOptions, y as MemeLoopProtocol, h as DeviceConnectionGrant, M as MemeLoopDuplexStream, S as SyncResult, C as CloudDeviceClient, w as DeviceTrustStore, c as CloudDeviceRecord } from './types-CdFVSntj.js';
2
+
3
+ interface MemoryDeviceNetworkServiceOptions {
4
+ identity: LocalDeviceIdentity;
5
+ capabilities?: DeviceCapabilities;
6
+ trustedDevices?: TrustedDeviceRecord[];
7
+ }
8
+ declare class MemoryDeviceNetworkService implements DeviceNetworkService {
9
+ private readonly options;
10
+ private started;
11
+ private readonly capabilities;
12
+ private readonly trustedDevices;
13
+ private readonly pairingSessions;
14
+ private readonly listeners;
15
+ private readonly pairingListeners;
16
+ constructor(options: MemoryDeviceNetworkServiceOptions);
17
+ start(): Promise<void>;
18
+ stop(): Promise<void>;
19
+ getLocalDevice(): Promise<Device>;
20
+ listDevices(): Promise<Device[]>;
21
+ observeDevices(listener: (devices: Device[]) => void): () => void;
22
+ listPairingSessions(): Promise<PairingSession[]>;
23
+ observePairingSessions(listener: (sessions: PairingSession[]) => void): () => void;
24
+ requestLocalPairing(peerId: string, _options?: LocalPairingRequestOptions): Promise<PairingSession>;
25
+ acceptPairing(sessionId: string): Promise<void>;
26
+ rejectPairing(sessionId: string): Promise<void>;
27
+ removeTrustedDevice(peerId: string): Promise<void>;
28
+ openStream(peerId: string, _protocol: MemeLoopProtocol, _presentedGrant?: DeviceConnectionGrant): Promise<MemeLoopDuplexStream>;
29
+ sendRpc<T>(peerId: string, _method: string, _parameters: unknown, _presentedGrant?: DeviceConnectionGrant): Promise<T>;
30
+ syncWithDevice(peerId: string, _presentedGrant?: DeviceConnectionGrant): Promise<SyncResult>;
31
+ private confirmCode;
32
+ private emitDevices;
33
+ private emitPairingSessions;
34
+ }
35
+
36
+ /**
37
+ * Fetch visible cloud devices and merge them into the local trust store.
38
+ * - Cloud devices become trusted with trustMode = "cloud-account".
39
+ * - Already-trusted devices are updated (capabilities, lastSeen, multiaddrs).
40
+ * - Revoked cloud devices are NOT removed from local trust store here
41
+ * (revocation should be handled via heartbeat/grant failure).
42
+ * - Returns the synced cloud device records for caller to emit as discovered devices.
43
+ */
44
+ declare function syncCloudDevices(input: {
45
+ cloudClient: CloudDeviceClient;
46
+ trustStore: DeviceTrustStore;
47
+ }): Promise<CloudDeviceRecord[]>;
48
+
49
+ export { MemoryDeviceNetworkService as M, type MemoryDeviceNetworkServiceOptions as a, syncCloudDevices as s };
@@ -0,0 +1,49 @@
1
+ import { l as DeviceNetworkService, L as LocalDeviceIdentity, g as DeviceCapabilities, T as TrustedDeviceRecord, D as Device, P as PairingSession, x as LocalPairingRequestOptions, y as MemeLoopProtocol, h as DeviceConnectionGrant, M as MemeLoopDuplexStream, S as SyncResult, C as CloudDeviceClient, w as DeviceTrustStore, c as CloudDeviceRecord } from './types-7pYti-k9.cjs';
2
+
3
+ interface MemoryDeviceNetworkServiceOptions {
4
+ identity: LocalDeviceIdentity;
5
+ capabilities?: DeviceCapabilities;
6
+ trustedDevices?: TrustedDeviceRecord[];
7
+ }
8
+ declare class MemoryDeviceNetworkService implements DeviceNetworkService {
9
+ private readonly options;
10
+ private started;
11
+ private readonly capabilities;
12
+ private readonly trustedDevices;
13
+ private readonly pairingSessions;
14
+ private readonly listeners;
15
+ private readonly pairingListeners;
16
+ constructor(options: MemoryDeviceNetworkServiceOptions);
17
+ start(): Promise<void>;
18
+ stop(): Promise<void>;
19
+ getLocalDevice(): Promise<Device>;
20
+ listDevices(): Promise<Device[]>;
21
+ observeDevices(listener: (devices: Device[]) => void): () => void;
22
+ listPairingSessions(): Promise<PairingSession[]>;
23
+ observePairingSessions(listener: (sessions: PairingSession[]) => void): () => void;
24
+ requestLocalPairing(peerId: string, _options?: LocalPairingRequestOptions): Promise<PairingSession>;
25
+ acceptPairing(sessionId: string): Promise<void>;
26
+ rejectPairing(sessionId: string): Promise<void>;
27
+ removeTrustedDevice(peerId: string): Promise<void>;
28
+ openStream(peerId: string, _protocol: MemeLoopProtocol, _presentedGrant?: DeviceConnectionGrant): Promise<MemeLoopDuplexStream>;
29
+ sendRpc<T>(peerId: string, _method: string, _parameters: unknown, _presentedGrant?: DeviceConnectionGrant): Promise<T>;
30
+ syncWithDevice(peerId: string, _presentedGrant?: DeviceConnectionGrant): Promise<SyncResult>;
31
+ private confirmCode;
32
+ private emitDevices;
33
+ private emitPairingSessions;
34
+ }
35
+
36
+ /**
37
+ * Fetch visible cloud devices and merge them into the local trust store.
38
+ * - Cloud devices become trusted with trustMode = "cloud-account".
39
+ * - Already-trusted devices are updated (capabilities, lastSeen, multiaddrs).
40
+ * - Revoked cloud devices are NOT removed from local trust store here
41
+ * (revocation should be handled via heartbeat/grant failure).
42
+ * - Returns the synced cloud device records for caller to emit as discovered devices.
43
+ */
44
+ declare function syncCloudDevices(input: {
45
+ cloudClient: CloudDeviceClient;
46
+ trustStore: DeviceTrustStore;
47
+ }): Promise<CloudDeviceRecord[]>;
48
+
49
+ export { MemoryDeviceNetworkService as M, type MemoryDeviceNetworkServiceOptions as a, syncCloudDevices as s };
@@ -0,0 +1,255 @@
1
+ import { V as VersionVector, C as ConversationMeta, b as ChatMessage } from './interface-IrKBFtL1.cjs';
2
+
3
+ type DevicePlatform = 'desktop' | 'mobile' | 'cli';
4
+ type DeviceTrustMode = 'local-pairing' | 'cloud-account';
5
+ type DeviceReachabilityState = 'nearby' | 'online' | 'offline' | 'connecting';
6
+ type DeviceNetworkPath = 'lan' | 'direct' | 'relay';
7
+ type DeviceProtocolDirection = 'inbound' | 'outbound';
8
+ type PairingSessionDirection = 'inbound' | 'outbound';
9
+ type PairingSessionStatus = 'pending' | 'accepted' | 'rejected' | 'expired';
10
+ type MemeLoopProtocol = '/memeloop/rpc/1.0.0' | '/memeloop/sync/1.0.0' | '/memeloop/agent/1.0.0' | '/memeloop/pairing/1.0.0' | '/memeloop/orchestration/1.0.0';
11
+ interface DeviceCapabilities {
12
+ tools: string[];
13
+ mcpServers: string[];
14
+ hasWiki: boolean;
15
+ agentLoop?: boolean;
16
+ imChannels: string[];
17
+ wikis: Array<{
18
+ wikiId: string;
19
+ title?: string;
20
+ pathHint?: string;
21
+ }>;
22
+ }
23
+ interface LocalDeviceIdentity {
24
+ peerId: string;
25
+ publicKeyMultibase: string;
26
+ privateKeyRef: string;
27
+ privateKeyPkcs8Base64Url?: string;
28
+ privateKeyRawSeedBase64Url?: string;
29
+ createdAt: number;
30
+ deviceName: string;
31
+ platform: DevicePlatform;
32
+ }
33
+ interface DeviceNetworkListenOptions {
34
+ addresses: string[];
35
+ announce?: string[];
36
+ }
37
+ interface DeviceReachability {
38
+ state: DeviceReachabilityState;
39
+ paths: DeviceNetworkPath[];
40
+ }
41
+ interface Device {
42
+ peerId: string;
43
+ displayName: string;
44
+ platform: DevicePlatform;
45
+ trustMode: DeviceTrustMode;
46
+ trusted?: boolean;
47
+ reachability: DeviceReachability;
48
+ capabilities: DeviceCapabilities;
49
+ multiaddrs?: string[];
50
+ lastSeen?: number;
51
+ }
52
+ interface TrustedDeviceRecord {
53
+ peerId: string;
54
+ publicKeyMultibase: string;
55
+ deviceName: string;
56
+ platform: DevicePlatform;
57
+ trustMode: DeviceTrustMode;
58
+ accountId?: string;
59
+ createdAt: number;
60
+ lastSeen?: number;
61
+ revokedAt?: number;
62
+ }
63
+ interface DeviceTrustStore {
64
+ loadTrustedDevices(): Promise<TrustedDeviceRecord[]>;
65
+ saveTrustedDevice(record: TrustedDeviceRecord): Promise<void>;
66
+ removeTrustedDevice(peerId: string): Promise<void>;
67
+ }
68
+ interface DeviceAccountBindingRequest {
69
+ peerId: string;
70
+ publicKeyMultibase: string;
71
+ deviceName: string;
72
+ platform: DevicePlatform;
73
+ cloudNonce: string;
74
+ signature: string;
75
+ }
76
+ interface CloudDeviceRecord {
77
+ accountId: string;
78
+ peerId: string;
79
+ publicKeyMultibase: string;
80
+ deviceName: string;
81
+ platform: DevicePlatform;
82
+ capabilities: DeviceCapabilities;
83
+ multiaddrs: string[];
84
+ relayReservations: string[];
85
+ lastSeen: number;
86
+ revokedAt?: number;
87
+ }
88
+ interface DeviceConnectionGrant {
89
+ issuer: 'memeloop-cloud';
90
+ accountId: string;
91
+ subjectPeerId: string;
92
+ allowedPeerIds: string[];
93
+ issuedAt: number;
94
+ expiresAt: number;
95
+ signature: string;
96
+ }
97
+ interface DeviceConnectionGrantVerificationInput {
98
+ grant: DeviceConnectionGrant;
99
+ verificationPublicKeyMultibase: string;
100
+ subjectPeerId?: string;
101
+ allowedPeerId?: string;
102
+ now?: number;
103
+ }
104
+ interface DeviceRelayReservationToken {
105
+ issuer: 'memeloop-cloud';
106
+ accountId: string;
107
+ peerId: string;
108
+ relayMultiaddrs: string[];
109
+ bootstrapMultiaddrs: string[];
110
+ issuedAt: number;
111
+ expiresAt: number;
112
+ signature: string;
113
+ }
114
+ interface DeviceRelayReservationTokenVerificationInput {
115
+ token: DeviceRelayReservationToken;
116
+ verificationPublicKeyMultibase: string;
117
+ peerId?: string;
118
+ now?: number;
119
+ }
120
+ interface PairingSession {
121
+ sessionId: string;
122
+ localPeerId: string;
123
+ remotePeerId: string;
124
+ remotePublicKeyMultibase: string;
125
+ remoteDeviceName: string;
126
+ remotePlatform: DevicePlatform;
127
+ remoteCapabilities: DeviceCapabilities;
128
+ remoteMultiaddrs: string[];
129
+ direction: PairingSessionDirection;
130
+ status: PairingSessionStatus;
131
+ confirmCode: string;
132
+ createdAt: number;
133
+ expiresAt: number;
134
+ }
135
+ interface LocalPairingRequestOptions {
136
+ multiaddrs?: string[];
137
+ }
138
+ interface SyncResult {
139
+ ok: boolean;
140
+ peerId: string;
141
+ syncedAt: number;
142
+ }
143
+ interface MemeLoopDuplexStream {
144
+ source: AsyncIterable<Uint8Array>;
145
+ sink(source: AsyncIterable<Uint8Array>): Promise<void>;
146
+ close(): Promise<void>;
147
+ }
148
+ interface DeviceRpcHandlerInput {
149
+ remotePeerId: string;
150
+ method: string;
151
+ parameters: unknown;
152
+ presentedGrant?: DeviceConnectionGrant;
153
+ }
154
+ type DeviceRpcHandler = (input: DeviceRpcHandlerInput) => Promise<unknown>;
155
+ type AgentExecutionLocation = {
156
+ kind: 'local';
157
+ } | {
158
+ kind: 'device';
159
+ peerId: string;
160
+ };
161
+ type AgentExecutionState = 'idle' | 'running' | 'stopping';
162
+ interface ConversationExecutionPlacement {
163
+ conversationId: string;
164
+ location: AgentExecutionLocation;
165
+ state: AgentExecutionState;
166
+ updatedAt: number;
167
+ }
168
+ interface DeviceAuthorizer {
169
+ canOpenProtocol(input: {
170
+ remotePeerId: string;
171
+ protocol: MemeLoopProtocol;
172
+ direction?: DeviceProtocolDirection;
173
+ presentedGrant?: DeviceConnectionGrant;
174
+ }): Promise<boolean>;
175
+ }
176
+ interface CloudDeviceClient {
177
+ listDevices(): Promise<CloudDeviceRecord[]>;
178
+ getConnectionGrantPublicKey(): Promise<{
179
+ issuer: string;
180
+ publicKeyMultibase: string;
181
+ }>;
182
+ createConnectionGrant(input: {
183
+ subjectPeerId: string;
184
+ allowedPeerIds: string[];
185
+ }): Promise<DeviceConnectionGrant>;
186
+ createRelayReservation(input: {
187
+ peerId: string;
188
+ }): Promise<DeviceRelayReservationToken>;
189
+ createBindingNonce(): Promise<{
190
+ nonce: string;
191
+ accountId: string;
192
+ expiresAt: string;
193
+ }>;
194
+ registerDevice(input: DeviceAccountBindingRequest & {
195
+ identity: LocalDeviceIdentity;
196
+ capabilities: DeviceCapabilities;
197
+ multiaddrs: string[];
198
+ relayReservations: string[];
199
+ }): Promise<{
200
+ ok: boolean;
201
+ peerId: string;
202
+ }>;
203
+ heartbeat(input: {
204
+ peerId: string;
205
+ capabilities: DeviceCapabilities;
206
+ multiaddrs: string[];
207
+ relayReservations: string[];
208
+ }): Promise<{
209
+ ok: boolean;
210
+ }>;
211
+ }
212
+ interface DeviceNetworkService {
213
+ start(): Promise<void>;
214
+ stop(): Promise<void>;
215
+ getLocalDevice(): Promise<Device>;
216
+ listDevices(): Promise<Device[]>;
217
+ observeDevices(listener: (devices: Device[]) => void): () => void;
218
+ listPairingSessions(): Promise<PairingSession[]>;
219
+ observePairingSessions(listener: (sessions: PairingSession[]) => void): () => void;
220
+ requestLocalPairing(peerId: string, options?: LocalPairingRequestOptions): Promise<PairingSession>;
221
+ acceptPairing(sessionId: string): Promise<void>;
222
+ rejectPairing(sessionId: string): Promise<void>;
223
+ removeTrustedDevice(peerId: string): Promise<void>;
224
+ openStream(peerId: string, protocol: MemeLoopProtocol, presentedGrant?: DeviceConnectionGrant): Promise<MemeLoopDuplexStream>;
225
+ sendRpc<T>(peerId: string, method: string, parameters: unknown, presentedGrant?: DeviceConnectionGrant): Promise<T>;
226
+ syncWithDevice(peerId: string, presentedGrant?: DeviceConnectionGrant): Promise<SyncResult>;
227
+ /** Configure Cloud connection. When set, syncCloudDevices() and CloudDeviceAuthorizer become available. */
228
+ configureCloud?(config: {
229
+ cloudUrl: string;
230
+ accessToken: string;
231
+ }): void;
232
+ /** Apply a Cloud-signed private relay admission token and connect to advertised relay/bootstrap peers. */
233
+ configureRelayReservation?(token: DeviceRelayReservationToken): Promise<void>;
234
+ /** Fetch devices from Cloud directory and persist into local trust store. Returns synced devices. */
235
+ syncCloudDevices?(): Promise<CloudDeviceRecord[]>;
236
+ }
237
+ interface ExchangeVersionVectorResult {
238
+ remoteVersion: VersionVector;
239
+ missingForRemote: ConversationMeta[];
240
+ }
241
+ interface AttachmentBlob {
242
+ data: Uint8Array;
243
+ filename: string;
244
+ mimeType: string;
245
+ size: number;
246
+ }
247
+ interface DeviceSyncTransport {
248
+ listPeers(): Promise<Device[]>;
249
+ exchangeVersionVector(peerId: string, localVersion: VersionVector): Promise<ExchangeVersionVectorResult>;
250
+ pullMissingMetadata(peerId: string, sinceVersion: VersionVector): Promise<ConversationMeta[]>;
251
+ pullMissingMessages(peerId: string, conversationId: string, knownMessageIds: string[]): Promise<ChatMessage[]>;
252
+ pullAttachmentBlob(peerId: string, contentHash: string): Promise<AttachmentBlob | null>;
253
+ }
254
+
255
+ export type { AgentExecutionLocation as A, PairingSessionStatus as B, CloudDeviceClient as C, Device as D, ExchangeVersionVectorResult as E, LocalDeviceIdentity as L, MemeLoopDuplexStream as M, PairingSession as P, SyncResult as S, TrustedDeviceRecord as T, AgentExecutionState as a, AttachmentBlob as b, CloudDeviceRecord as c, ConversationExecutionPlacement as d, DeviceAccountBindingRequest as e, DeviceAuthorizer as f, DeviceCapabilities as g, DeviceConnectionGrant as h, DeviceConnectionGrantVerificationInput as i, DeviceNetworkListenOptions as j, DeviceNetworkPath as k, DeviceNetworkService as l, DevicePlatform as m, DeviceProtocolDirection as n, DeviceReachability as o, DeviceReachabilityState as p, DeviceRelayReservationToken as q, DeviceRelayReservationTokenVerificationInput as r, DeviceRpcHandler as s, DeviceRpcHandlerInput as t, DeviceSyncTransport as u, DeviceTrustMode as v, DeviceTrustStore as w, LocalPairingRequestOptions as x, MemeLoopProtocol as y, PairingSessionDirection as z };
@@ -0,0 +1,255 @@
1
+ import { V as VersionVector, C as ConversationMeta, b as ChatMessage } from './interface-IrKBFtL1.js';
2
+
3
+ type DevicePlatform = 'desktop' | 'mobile' | 'cli';
4
+ type DeviceTrustMode = 'local-pairing' | 'cloud-account';
5
+ type DeviceReachabilityState = 'nearby' | 'online' | 'offline' | 'connecting';
6
+ type DeviceNetworkPath = 'lan' | 'direct' | 'relay';
7
+ type DeviceProtocolDirection = 'inbound' | 'outbound';
8
+ type PairingSessionDirection = 'inbound' | 'outbound';
9
+ type PairingSessionStatus = 'pending' | 'accepted' | 'rejected' | 'expired';
10
+ type MemeLoopProtocol = '/memeloop/rpc/1.0.0' | '/memeloop/sync/1.0.0' | '/memeloop/agent/1.0.0' | '/memeloop/pairing/1.0.0' | '/memeloop/orchestration/1.0.0';
11
+ interface DeviceCapabilities {
12
+ tools: string[];
13
+ mcpServers: string[];
14
+ hasWiki: boolean;
15
+ agentLoop?: boolean;
16
+ imChannels: string[];
17
+ wikis: Array<{
18
+ wikiId: string;
19
+ title?: string;
20
+ pathHint?: string;
21
+ }>;
22
+ }
23
+ interface LocalDeviceIdentity {
24
+ peerId: string;
25
+ publicKeyMultibase: string;
26
+ privateKeyRef: string;
27
+ privateKeyPkcs8Base64Url?: string;
28
+ privateKeyRawSeedBase64Url?: string;
29
+ createdAt: number;
30
+ deviceName: string;
31
+ platform: DevicePlatform;
32
+ }
33
+ interface DeviceNetworkListenOptions {
34
+ addresses: string[];
35
+ announce?: string[];
36
+ }
37
+ interface DeviceReachability {
38
+ state: DeviceReachabilityState;
39
+ paths: DeviceNetworkPath[];
40
+ }
41
+ interface Device {
42
+ peerId: string;
43
+ displayName: string;
44
+ platform: DevicePlatform;
45
+ trustMode: DeviceTrustMode;
46
+ trusted?: boolean;
47
+ reachability: DeviceReachability;
48
+ capabilities: DeviceCapabilities;
49
+ multiaddrs?: string[];
50
+ lastSeen?: number;
51
+ }
52
+ interface TrustedDeviceRecord {
53
+ peerId: string;
54
+ publicKeyMultibase: string;
55
+ deviceName: string;
56
+ platform: DevicePlatform;
57
+ trustMode: DeviceTrustMode;
58
+ accountId?: string;
59
+ createdAt: number;
60
+ lastSeen?: number;
61
+ revokedAt?: number;
62
+ }
63
+ interface DeviceTrustStore {
64
+ loadTrustedDevices(): Promise<TrustedDeviceRecord[]>;
65
+ saveTrustedDevice(record: TrustedDeviceRecord): Promise<void>;
66
+ removeTrustedDevice(peerId: string): Promise<void>;
67
+ }
68
+ interface DeviceAccountBindingRequest {
69
+ peerId: string;
70
+ publicKeyMultibase: string;
71
+ deviceName: string;
72
+ platform: DevicePlatform;
73
+ cloudNonce: string;
74
+ signature: string;
75
+ }
76
+ interface CloudDeviceRecord {
77
+ accountId: string;
78
+ peerId: string;
79
+ publicKeyMultibase: string;
80
+ deviceName: string;
81
+ platform: DevicePlatform;
82
+ capabilities: DeviceCapabilities;
83
+ multiaddrs: string[];
84
+ relayReservations: string[];
85
+ lastSeen: number;
86
+ revokedAt?: number;
87
+ }
88
+ interface DeviceConnectionGrant {
89
+ issuer: 'memeloop-cloud';
90
+ accountId: string;
91
+ subjectPeerId: string;
92
+ allowedPeerIds: string[];
93
+ issuedAt: number;
94
+ expiresAt: number;
95
+ signature: string;
96
+ }
97
+ interface DeviceConnectionGrantVerificationInput {
98
+ grant: DeviceConnectionGrant;
99
+ verificationPublicKeyMultibase: string;
100
+ subjectPeerId?: string;
101
+ allowedPeerId?: string;
102
+ now?: number;
103
+ }
104
+ interface DeviceRelayReservationToken {
105
+ issuer: 'memeloop-cloud';
106
+ accountId: string;
107
+ peerId: string;
108
+ relayMultiaddrs: string[];
109
+ bootstrapMultiaddrs: string[];
110
+ issuedAt: number;
111
+ expiresAt: number;
112
+ signature: string;
113
+ }
114
+ interface DeviceRelayReservationTokenVerificationInput {
115
+ token: DeviceRelayReservationToken;
116
+ verificationPublicKeyMultibase: string;
117
+ peerId?: string;
118
+ now?: number;
119
+ }
120
+ interface PairingSession {
121
+ sessionId: string;
122
+ localPeerId: string;
123
+ remotePeerId: string;
124
+ remotePublicKeyMultibase: string;
125
+ remoteDeviceName: string;
126
+ remotePlatform: DevicePlatform;
127
+ remoteCapabilities: DeviceCapabilities;
128
+ remoteMultiaddrs: string[];
129
+ direction: PairingSessionDirection;
130
+ status: PairingSessionStatus;
131
+ confirmCode: string;
132
+ createdAt: number;
133
+ expiresAt: number;
134
+ }
135
+ interface LocalPairingRequestOptions {
136
+ multiaddrs?: string[];
137
+ }
138
+ interface SyncResult {
139
+ ok: boolean;
140
+ peerId: string;
141
+ syncedAt: number;
142
+ }
143
+ interface MemeLoopDuplexStream {
144
+ source: AsyncIterable<Uint8Array>;
145
+ sink(source: AsyncIterable<Uint8Array>): Promise<void>;
146
+ close(): Promise<void>;
147
+ }
148
+ interface DeviceRpcHandlerInput {
149
+ remotePeerId: string;
150
+ method: string;
151
+ parameters: unknown;
152
+ presentedGrant?: DeviceConnectionGrant;
153
+ }
154
+ type DeviceRpcHandler = (input: DeviceRpcHandlerInput) => Promise<unknown>;
155
+ type AgentExecutionLocation = {
156
+ kind: 'local';
157
+ } | {
158
+ kind: 'device';
159
+ peerId: string;
160
+ };
161
+ type AgentExecutionState = 'idle' | 'running' | 'stopping';
162
+ interface ConversationExecutionPlacement {
163
+ conversationId: string;
164
+ location: AgentExecutionLocation;
165
+ state: AgentExecutionState;
166
+ updatedAt: number;
167
+ }
168
+ interface DeviceAuthorizer {
169
+ canOpenProtocol(input: {
170
+ remotePeerId: string;
171
+ protocol: MemeLoopProtocol;
172
+ direction?: DeviceProtocolDirection;
173
+ presentedGrant?: DeviceConnectionGrant;
174
+ }): Promise<boolean>;
175
+ }
176
+ interface CloudDeviceClient {
177
+ listDevices(): Promise<CloudDeviceRecord[]>;
178
+ getConnectionGrantPublicKey(): Promise<{
179
+ issuer: string;
180
+ publicKeyMultibase: string;
181
+ }>;
182
+ createConnectionGrant(input: {
183
+ subjectPeerId: string;
184
+ allowedPeerIds: string[];
185
+ }): Promise<DeviceConnectionGrant>;
186
+ createRelayReservation(input: {
187
+ peerId: string;
188
+ }): Promise<DeviceRelayReservationToken>;
189
+ createBindingNonce(): Promise<{
190
+ nonce: string;
191
+ accountId: string;
192
+ expiresAt: string;
193
+ }>;
194
+ registerDevice(input: DeviceAccountBindingRequest & {
195
+ identity: LocalDeviceIdentity;
196
+ capabilities: DeviceCapabilities;
197
+ multiaddrs: string[];
198
+ relayReservations: string[];
199
+ }): Promise<{
200
+ ok: boolean;
201
+ peerId: string;
202
+ }>;
203
+ heartbeat(input: {
204
+ peerId: string;
205
+ capabilities: DeviceCapabilities;
206
+ multiaddrs: string[];
207
+ relayReservations: string[];
208
+ }): Promise<{
209
+ ok: boolean;
210
+ }>;
211
+ }
212
+ interface DeviceNetworkService {
213
+ start(): Promise<void>;
214
+ stop(): Promise<void>;
215
+ getLocalDevice(): Promise<Device>;
216
+ listDevices(): Promise<Device[]>;
217
+ observeDevices(listener: (devices: Device[]) => void): () => void;
218
+ listPairingSessions(): Promise<PairingSession[]>;
219
+ observePairingSessions(listener: (sessions: PairingSession[]) => void): () => void;
220
+ requestLocalPairing(peerId: string, options?: LocalPairingRequestOptions): Promise<PairingSession>;
221
+ acceptPairing(sessionId: string): Promise<void>;
222
+ rejectPairing(sessionId: string): Promise<void>;
223
+ removeTrustedDevice(peerId: string): Promise<void>;
224
+ openStream(peerId: string, protocol: MemeLoopProtocol, presentedGrant?: DeviceConnectionGrant): Promise<MemeLoopDuplexStream>;
225
+ sendRpc<T>(peerId: string, method: string, parameters: unknown, presentedGrant?: DeviceConnectionGrant): Promise<T>;
226
+ syncWithDevice(peerId: string, presentedGrant?: DeviceConnectionGrant): Promise<SyncResult>;
227
+ /** Configure Cloud connection. When set, syncCloudDevices() and CloudDeviceAuthorizer become available. */
228
+ configureCloud?(config: {
229
+ cloudUrl: string;
230
+ accessToken: string;
231
+ }): void;
232
+ /** Apply a Cloud-signed private relay admission token and connect to advertised relay/bootstrap peers. */
233
+ configureRelayReservation?(token: DeviceRelayReservationToken): Promise<void>;
234
+ /** Fetch devices from Cloud directory and persist into local trust store. Returns synced devices. */
235
+ syncCloudDevices?(): Promise<CloudDeviceRecord[]>;
236
+ }
237
+ interface ExchangeVersionVectorResult {
238
+ remoteVersion: VersionVector;
239
+ missingForRemote: ConversationMeta[];
240
+ }
241
+ interface AttachmentBlob {
242
+ data: Uint8Array;
243
+ filename: string;
244
+ mimeType: string;
245
+ size: number;
246
+ }
247
+ interface DeviceSyncTransport {
248
+ listPeers(): Promise<Device[]>;
249
+ exchangeVersionVector(peerId: string, localVersion: VersionVector): Promise<ExchangeVersionVectorResult>;
250
+ pullMissingMetadata(peerId: string, sinceVersion: VersionVector): Promise<ConversationMeta[]>;
251
+ pullMissingMessages(peerId: string, conversationId: string, knownMessageIds: string[]): Promise<ChatMessage[]>;
252
+ pullAttachmentBlob(peerId: string, contentHash: string): Promise<AttachmentBlob | null>;
253
+ }
254
+
255
+ export type { AgentExecutionLocation as A, PairingSessionStatus as B, CloudDeviceClient as C, Device as D, ExchangeVersionVectorResult as E, LocalDeviceIdentity as L, MemeLoopDuplexStream as M, PairingSession as P, SyncResult as S, TrustedDeviceRecord as T, AgentExecutionState as a, AttachmentBlob as b, CloudDeviceRecord as c, ConversationExecutionPlacement as d, DeviceAccountBindingRequest as e, DeviceAuthorizer as f, DeviceCapabilities as g, DeviceConnectionGrant as h, DeviceConnectionGrantVerificationInput as i, DeviceNetworkListenOptions as j, DeviceNetworkPath as k, DeviceNetworkService as l, DevicePlatform as m, DeviceProtocolDirection as n, DeviceReachability as o, DeviceReachabilityState as p, DeviceRelayReservationToken as q, DeviceRelayReservationTokenVerificationInput as r, DeviceRpcHandler as s, DeviceRpcHandlerInput as t, DeviceSyncTransport as u, DeviceTrustMode as v, DeviceTrustStore as w, LocalPairingRequestOptions as x, MemeLoopProtocol as y, PairingSessionDirection as z };