maka-agent 0.2.0-dev.14.20260902 → 0.2.0-dev.16.20260903
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/dist/cli-core.js +0 -1
- package/dist/pi-transcript.js +48 -0
- package/dist/pi-tui-form-interaction.js +497 -0
- package/dist/pi-tui-pickers.js +256 -55
- package/dist/pi-tui-runner.js +215 -12
- package/dist/runtime-host-cli.js +17 -42
- package/dist/runtime-host-lifecycle-transaction.js +31 -13
- package/dist/runtime-host-managed-lifecycle-manager.js +1 -1
- package/dist/runtime-host-onboarding.js +3 -1
- package/dist/runtime-host-openrc-service.js +469 -0
- package/dist/runtime-host-run-command.js +6 -2
- package/dist/runtime-host-service-command.js +3 -3
- package/dist/runtime-host-service-management-command.js +43 -15
- package/dist/runtime-host-session-channel.js +3 -0
- package/dist/runtime-host-session-driver.js +21 -6
- package/dist/runtime-host-setup-command.js +30 -31
- package/dist/tui-context-refresh.js +103 -0
- package/dist/tui-copy-catalog.js +73 -0
- package/native/runtime-host-peer/prebuilds/darwin-arm64/maka_runtime_host_peer.node +0 -0
- package/native/runtime-host-peer/prebuilds/linux-arm64/maka_runtime_host_peer.node +0 -0
- package/native/runtime-host-peer/prebuilds/linux-x64/maka_runtime_host_peer.node +0 -0
- package/native/runtime-host-peer/prebuilds/win32-x64/maka_runtime_host_peer.node +0 -0
- package/node_modules/@maka/core/dist/chat-model-choice.js +4 -0
- package/node_modules/@maka/core/dist/computer-use.js +27 -92
- package/node_modules/@maka/core/dist/interaction.js +577 -3
- package/node_modules/@maka/core/dist/llm-connections.js +4 -0
- package/node_modules/@maka/core/dist/local-memory.js +2 -2
- package/node_modules/@maka/core/dist/model-call-usage-projection.js +3 -0
- package/node_modules/@maka/core/dist/model-metadata.js +26 -7
- package/node_modules/@maka/core/dist/model-thinking.js +17 -0
- package/node_modules/@maka/core/dist/provider-registry.js +1 -0
- package/node_modules/@maka/core/dist/runtime-event.js +23 -1
- package/node_modules/@maka/core/dist/scheduled-task.js +4 -0
- package/node_modules/@maka/core/dist/session.js +95 -2
- package/node_modules/@maka/core/dist/text-sanitize.js +19 -0
- package/node_modules/@maka/core/dist/usage-ledger-merge.js +3 -0
- package/node_modules/@maka/core/dist/usage-record-schema.js +11 -5
- package/node_modules/@maka/core/dist/workhub-creation-intent.js +75 -9
- package/node_modules/@maka/core/dist/workhub-session-resolver.js +50 -0
- package/node_modules/@maka/core/package.json +2 -0
- package/node_modules/@maka/eval/dist/harbor-external-subject.js +2 -1
- package/node_modules/@maka/eval/dist/harness-executor.js +3 -2
- package/node_modules/@maka/eval/dist/install-preflight.js +39 -10
- package/node_modules/@maka/eval/dist/process-termination.js +83 -0
- package/node_modules/@maka/mcp/dist/sep-2243.js +3 -3
- package/node_modules/@maka/runtime/dist/agent-run.js +6 -3
- package/node_modules/@maka/runtime/dist/ai-sdk-backend.js +332 -118
- package/node_modules/@maka/runtime/dist/ai-sdk-compaction-contract.js +6 -1
- package/node_modules/@maka/runtime/dist/ai-sdk-compaction.js +171 -341
- package/node_modules/@maka/runtime/dist/bots/telegram-bridge.js +3 -26
- package/node_modules/@maka/runtime/dist/bundled-skill-catalog.generated.js +1 -1
- package/node_modules/@maka/runtime/dist/computer-use-codec.js +1 -141
- package/node_modules/@maka/runtime/dist/computer-use-tools.js +23 -105
- package/node_modules/@maka/runtime/dist/context-budget-policy.js +20 -26
- package/node_modules/@maka/runtime/dist/context-budget.js +18 -20
- package/node_modules/@maka/runtime/dist/conversation-copy.js +23 -19
- package/node_modules/@maka/runtime/dist/cua-frame-state.js +1 -69
- package/node_modules/@maka/runtime/dist/github-copilot-oauth-enrollment.js +267 -0
- package/node_modules/@maka/runtime/dist/history-compact-checkpoint.js +6 -9
- package/node_modules/@maka/runtime/dist/history-compact-summarizer.js +67 -23
- package/node_modules/@maka/runtime/dist/history-compact-summary-validation.js +11 -18
- package/node_modules/@maka/runtime/dist/history-compaction.js +66 -73
- package/node_modules/@maka/runtime/dist/interaction-authority.js +69 -0
- package/node_modules/@maka/runtime/dist/mcp-tools.js +13 -1
- package/node_modules/@maka/runtime/dist/memory-extraction.js +11 -11
- package/node_modules/@maka/runtime/dist/model-adapter.js +24 -6
- package/node_modules/@maka/runtime/dist/model-factory.js +14 -5
- package/node_modules/@maka/runtime/dist/oauth-provider-contracts.js +28 -1
- package/node_modules/@maka/runtime/dist/openai-codex-history-compactor.js +7 -6
- package/node_modules/@maka/runtime/dist/opencode-session-header.js +29 -0
- package/node_modules/@maka/runtime/dist/runtime-event-read-model.js +11 -1
- package/node_modules/@maka/runtime/dist/runtime-kernel.js +12 -11
- package/node_modules/@maka/runtime/dist/runtime-read-model.js +51 -13
- package/node_modules/@maka/runtime/dist/scheduled-task-tools.js +3 -0
- package/node_modules/@maka/runtime/dist/session-event-runtime-mapper.js +26 -0
- package/node_modules/@maka/runtime/dist/session-manager.js +1 -0
- package/node_modules/@maka/runtime/dist/session-projection-helpers.js +16 -1
- package/node_modules/@maka/runtime/dist/stream-graph-projection.js +6 -0
- package/node_modules/@maka/runtime/dist/stream-graph-read-model.js +5 -0
- package/node_modules/@maka/runtime/dist/stream-usage-fallback-fetch.js +74 -0
- package/node_modules/@maka/runtime/dist/subscription-credentials.js +51 -4
- package/node_modules/@maka/runtime/dist/subscription-model-fetch.js +47 -3
- package/node_modules/@maka/runtime/dist/system-prompt/main-session-prompt.js +20 -1
- package/node_modules/@maka/runtime/dist/test-connection.js +18 -11
- package/node_modules/@maka/runtime/dist/tool-runtime.js +183 -0
- package/node_modules/@maka/runtime/package.json +1 -0
- package/node_modules/@maka/runtime-host/dist/adapter/session-projector.js +14 -0
- package/node_modules/@maka/runtime-host/dist/client/client-capability-channel.js +84 -1
- package/node_modules/@maka/runtime-host/dist/client/host-profile.js +68 -51
- package/node_modules/@maka/runtime-host/dist/client/index.js +1 -1
- package/node_modules/@maka/runtime-host/dist/client/owner-connection-code.js +8 -5
- package/node_modules/@maka/runtime-host/dist/client/peer-client.js +342 -36
- package/node_modules/@maka/runtime-host/dist/client/reconnect-lifecycle.js +60 -4
- package/node_modules/@maka/runtime-host/dist/peer-mesh/index.js +3 -3
- package/node_modules/@maka/runtime-host/dist/peer-mesh/limits.js +1 -1
- package/node_modules/@maka/runtime-host/dist/peer-mesh/model.js +48 -60
- package/node_modules/@maka/runtime-host/dist/peer-mesh/node.js +847 -431
- package/node_modules/@maka/runtime-host/dist/peer-mesh/owner.js +33 -74
- package/node_modules/@maka/runtime-host/dist/peer-mesh/store.js +82 -69
- package/node_modules/@maka/runtime-host/dist/peer-reachability/index.js +21 -0
- package/node_modules/@maka/runtime-host/dist/peer-reachability/model.js +202 -0
- package/node_modules/@maka/runtime-host/dist/peer-reachability/owner.js +119 -0
- package/node_modules/@maka/runtime-host/dist/peer-reachability/publisher.js +245 -0
- package/node_modules/@maka/runtime-host/dist/protocol/agent-graph.js +4 -1
- package/node_modules/@maka/runtime-host/dist/protocol/client-capability.js +68 -0
- package/node_modules/@maka/runtime-host/dist/protocol/connection-effects.js +15 -8
- package/node_modules/@maka/runtime-host/dist/protocol/host-status.js +7 -23
- package/node_modules/@maka/runtime-host/dist/protocol/index.js +47 -1
- package/node_modules/@maka/runtime-host/dist/protocol/oauth.js +25 -1
- package/node_modules/@maka/runtime-host/dist/protocol/operations.js +1 -0
- package/node_modules/@maka/runtime-host/dist/protocol/peer-mesh.js +14 -31
- package/node_modules/@maka/runtime-host/dist/protocol/scheduled-task.js +19 -6
- package/node_modules/@maka/runtime-host/dist/protocol/session-collaboration.js +36 -1
- package/node_modules/@maka/runtime-host/dist/protocol/session-revision.js +11 -2
- package/node_modules/@maka/runtime-host/dist/protocol/usage-pricing.js +16 -2
- package/node_modules/@maka/runtime-host/dist/protocol/workhub-coordination.js +51 -2
- package/node_modules/@maka/runtime-host/dist/server/access-authority.js +35 -2
- package/node_modules/@maka/runtime-host/dist/server/access-credential-store.js +1 -0
- package/node_modules/@maka/runtime-host/dist/server/client-capability-coordinator.js +12 -10
- package/node_modules/@maka/runtime-host/dist/server/client-capability-invocation-broker.js +163 -30
- package/node_modules/@maka/runtime-host/dist/server/connection-effect-coordinator.js +38 -14
- package/node_modules/@maka/runtime-host/dist/server/daily-review-coordinator.js +45 -22
- package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +78 -20
- package/node_modules/@maka/runtime-host/dist/server/execution-model-authority.js +4 -2
- package/node_modules/@maka/runtime-host/dist/server/execution-model-composition.js +2 -1
- package/node_modules/@maka/runtime-host/dist/server/execution-service.js +49 -28
- package/node_modules/@maka/runtime-host/dist/server/host-kernel.js +3 -6
- package/node_modules/@maka/runtime-host/dist/server/interaction-coordinator.js +130 -27
- package/node_modules/@maka/runtime-host/dist/server/interaction-projection.js +30 -1
- package/node_modules/@maka/runtime-host/dist/server/listener-set.js +2 -4
- package/node_modules/@maka/runtime-host/dist/server/message-coordinator.js +16 -3
- package/node_modules/@maka/runtime-host/dist/server/oauth-coordinator.js +66 -3
- package/node_modules/@maka/runtime-host/dist/server/oauth-execution-authority.js +20 -3
- package/node_modules/@maka/runtime-host/dist/server/peer-listener.js +8 -21
- package/node_modules/@maka/runtime-host/dist/server/peer-mesh-authority.js +1 -1
- package/node_modules/@maka/runtime-host/dist/server/root-turn-coordinator.js +6 -3
- package/node_modules/@maka/runtime-host/dist/server/scheduled-task-coordinator.js +72 -12
- package/node_modules/@maka/runtime-host/dist/server/session-revision-coordinator.js +48 -18
- package/node_modules/@maka/runtime-host/dist/server/session-turn-access-request-coordinator.js +43 -26
- package/node_modules/@maka/runtime-host/dist/server/usage-pricing-coordinator.js +15 -1
- package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-action-gate.js +229 -4
- package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-coordinator.js +146 -8
- package/node_modules/@maka/runtime-host/dist/transport/peer-native.js +32 -6
- package/node_modules/@maka/runtime-host/package.json +1 -0
- package/node_modules/@maka/storage/dist/agent-run-store.js +18 -5
- package/node_modules/@maka/storage/dist/codex-session-adapter.js +14 -0
- package/node_modules/@maka/storage/dist/execution-stores.js +5 -0
- package/node_modules/@maka/storage/dist/interaction-store.js +13 -1
- package/node_modules/@maka/storage/dist/runtime-policy/connection-catalog-document.js +9 -3
- package/node_modules/@maka/storage/dist/runtime-policy/coordinator.js +49 -19
- package/node_modules/@maka/storage/dist/runtime-policy/oauth-login-receipt-document.js +3 -1
- package/node_modules/@maka/storage/dist/runtime-policy/onboarding-transaction.js +13 -5
- package/node_modules/@maka/storage/dist/session-copy-cleanup.js +4 -2
- package/node_modules/@maka/storage/dist/session-store.js +39 -6
- package/node_modules/@maka/storage/dist/sqlite-runtime-store.js +16 -9
- package/node_modules/@maka/storage/dist/sqlite-session-metadata-schema.js +30 -3
- package/node_modules/@maka/storage/dist/sqlite-session-metadata-store.js +117 -0
- package/node_modules/@maka/storage/dist/sqlite-usage-store.js +29 -6
- package/node_modules/@maka/storage/dist/usage-stores.js +3 -1
- package/package.json +1 -1
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import { createHash, createPrivateKey, createPublicKey, generateKeyPairSync, randomBytes, sign, timingSafeEqual, verify, } from 'node:crypto';
|
|
20
20
|
import { decodePeerMeshInvitation as decodePeerMeshInvitationWire, } from '../protocol/peer-mesh.js';
|
|
21
|
-
import {
|
|
21
|
+
import { PEER_MESH_MEMBER_ADVERTISEMENT_MAX_BYTES, PEER_MESH_MAX_MEMBERS } from './limits.js';
|
|
22
22
|
import { canonicalPeerMeshDisplayName } from './display-name.js';
|
|
23
|
-
export { PEER_MESH_MAX_INVITATION_RECORDS, PEER_MESH_MAX_MEMBERS, PEER_MESH_MAX_MESHES, PEER_MESH_MAX_PENDING_INVITATIONS, PEER_MESH_MAX_ROUTE_HINTS, PEER_MESH_MAX_TRANSIT_ADDRESSES_PER_RELAY, PEER_MESH_MAX_TRANSIT_RELAY_ADDRESSES,
|
|
23
|
+
export { PEER_MESH_MAX_INVITATION_RECORDS, PEER_MESH_MAX_MEMBERS, PEER_MESH_MAX_MESHES, PEER_MESH_MAX_PENDING_INVITATIONS, PEER_MESH_MAX_ROUTE_HINTS, PEER_MESH_MAX_TRANSIT_ADDRESSES_PER_RELAY, PEER_MESH_MAX_TRANSIT_RELAY_ADDRESSES, PEER_MESH_MEMBER_ADVERTISEMENT_MAX_BYTES, } from './limits.js';
|
|
24
24
|
export function generatePeerMeshAuthorityKeyPair() {
|
|
25
25
|
const { publicKey, privateKey } = generateKeyPairSync('ed25519');
|
|
26
26
|
return Object.freeze({
|
|
@@ -61,12 +61,17 @@ export function validatePeerMeshAuthorityKeyPair(keys) {
|
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
catch (error) {
|
|
64
|
-
throw new Error('Invalid Peer Mesh authority private key', {
|
|
64
|
+
throw new Error('Invalid Peer Mesh authority private key', {
|
|
65
|
+
cause: error,
|
|
66
|
+
});
|
|
65
67
|
}
|
|
66
68
|
if (privateKey.asymmetricKeyType !== 'ed25519') {
|
|
67
69
|
throw new Error('Peer Mesh authority key must be Ed25519');
|
|
68
70
|
}
|
|
69
|
-
const derived = createPublicKey(privateKey).export({
|
|
71
|
+
const derived = createPublicKey(privateKey).export({
|
|
72
|
+
format: 'der',
|
|
73
|
+
type: 'spki',
|
|
74
|
+
});
|
|
70
75
|
if (derived.toString('base64url') !== keys.publicKey) {
|
|
71
76
|
throw new Error('Peer Mesh authority private key does not match its public key');
|
|
72
77
|
}
|
|
@@ -115,7 +120,7 @@ export function validatePeerMeshInvitation(value) {
|
|
|
115
120
|
});
|
|
116
121
|
}
|
|
117
122
|
export function canonicalPeerMeshRoster(value) {
|
|
118
|
-
const keys = ['version', 'meshId', 'revision', 'members', 'closed'];
|
|
123
|
+
const keys = ['version', 'meshId', 'authorityPeerId', 'revision', 'members', 'closed'];
|
|
119
124
|
if (value && typeof value === 'object' && !Array.isArray(value)) {
|
|
120
125
|
if (Object.hasOwn(value, 'displayName'))
|
|
121
126
|
keys.push('displayName');
|
|
@@ -129,11 +134,16 @@ export function canonicalPeerMeshRoster(value) {
|
|
|
129
134
|
if (members.length === 0 || new Set(members).size !== members.length) {
|
|
130
135
|
throw new Error('Peer Mesh roster members must be unique and non-empty');
|
|
131
136
|
}
|
|
137
|
+
const authorityPeerId = token(record.authorityPeerId, 'authorityPeerId', 256);
|
|
138
|
+
if (!members.includes(authorityPeerId)) {
|
|
139
|
+
throw new Error('Peer Mesh authority must be present in its roster');
|
|
140
|
+
}
|
|
132
141
|
if (typeof record.closed !== 'boolean')
|
|
133
142
|
throw new Error('Invalid Peer Mesh roster closed');
|
|
134
143
|
return Object.freeze({
|
|
135
144
|
version: 1,
|
|
136
145
|
meshId: string(record.meshId, 'meshId', 128),
|
|
146
|
+
authorityPeerId,
|
|
137
147
|
revision: integer(record.revision, 'revision', 1),
|
|
138
148
|
members: Object.freeze(members),
|
|
139
149
|
closed: record.closed,
|
|
@@ -142,85 +152,71 @@ export function canonicalPeerMeshRoster(value) {
|
|
|
142
152
|
: { displayName: canonicalPeerMeshDisplayName(record.displayName) }),
|
|
143
153
|
});
|
|
144
154
|
}
|
|
145
|
-
export function
|
|
146
|
-
const
|
|
147
|
-
'peerId',
|
|
148
|
-
'routeHints',
|
|
149
|
-
'coordinationRelays',
|
|
150
|
-
]);
|
|
151
|
-
return Object.freeze({
|
|
152
|
-
peerId: token(record.peerId, 'peerId', 256),
|
|
153
|
-
routeHints: Object.freeze(addressArray(record.routeHints, 'routeHints')),
|
|
154
|
-
coordinationRelays: Object.freeze(addressArray(record.coordinationRelays, 'coordinationRelays')),
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
export function canonicalPeerMeshRouteRecord(value) {
|
|
158
|
-
const keys = ['version', 'peerId', 'sequence', 'expiresAt', 'routeHints', 'coordinationRelays'];
|
|
155
|
+
export function canonicalPeerMeshMemberAdvertisement(value) {
|
|
156
|
+
const keys = ['version', 'meshId', 'peerId', 'revision', 'offersTransit'];
|
|
159
157
|
if (value && typeof value === 'object' && !Array.isArray(value)) {
|
|
160
158
|
if (Object.hasOwn(value, 'endpointKind'))
|
|
161
159
|
keys.push('endpointKind');
|
|
162
160
|
if (Object.hasOwn(value, 'displayName'))
|
|
163
161
|
keys.push('displayName');
|
|
164
|
-
if (Object.hasOwn(value, 'transitMeshId'))
|
|
165
|
-
keys.push('transitMeshId');
|
|
166
162
|
}
|
|
167
|
-
const record = exactObject(value, 'Peer Mesh
|
|
168
|
-
if (record.version !== 1)
|
|
169
|
-
throw new Error('Unsupported Peer Mesh
|
|
163
|
+
const record = exactObject(value, 'Peer Mesh member advertisement', keys);
|
|
164
|
+
if (record.version !== 1) {
|
|
165
|
+
throw new Error('Unsupported Peer Mesh member advertisement version');
|
|
166
|
+
}
|
|
170
167
|
if (record.endpointKind !== undefined &&
|
|
171
168
|
record.endpointKind !== 'client' &&
|
|
172
169
|
record.endpointKind !== 'host') {
|
|
173
170
|
throw new Error('Invalid Peer Mesh endpoint kind');
|
|
174
171
|
}
|
|
175
|
-
|
|
172
|
+
if (typeof record.offersTransit !== 'boolean') {
|
|
173
|
+
throw new Error('Invalid Peer Mesh transit advertisement');
|
|
174
|
+
}
|
|
175
|
+
const advertisement = Object.freeze({
|
|
176
176
|
version: 1,
|
|
177
|
+
meshId: string(record.meshId, 'meshId', 128),
|
|
177
178
|
peerId: token(record.peerId, 'peerId', 256),
|
|
178
|
-
|
|
179
|
-
expiresAt: integer(record.expiresAt, 'route expiry', 1),
|
|
180
|
-
routeHints: Object.freeze(addressArray(record.routeHints, 'routeHints')),
|
|
181
|
-
coordinationRelays: Object.freeze(addressArray(record.coordinationRelays, 'coordinationRelays')),
|
|
179
|
+
revision: integer(record.revision, 'advertisement revision', 1),
|
|
182
180
|
...(record.endpointKind === undefined ? {} : { endpointKind: record.endpointKind }),
|
|
183
181
|
...(record.displayName === undefined
|
|
184
182
|
? {}
|
|
185
183
|
: { displayName: canonicalPeerMeshDisplayName(record.displayName) }),
|
|
186
|
-
|
|
187
|
-
? {}
|
|
188
|
-
: { transitMeshId: string(record.transitMeshId, 'transitMeshId', 128) }),
|
|
184
|
+
offersTransit: record.offersTransit,
|
|
189
185
|
});
|
|
190
|
-
if (
|
|
191
|
-
|
|
186
|
+
if (peerMeshMemberAdvertisementSigningBytes(advertisement).byteLength >
|
|
187
|
+
PEER_MESH_MEMBER_ADVERTISEMENT_MAX_BYTES) {
|
|
188
|
+
throw new Error('Peer Mesh member advertisement is too large');
|
|
192
189
|
}
|
|
193
|
-
return
|
|
190
|
+
return advertisement;
|
|
194
191
|
}
|
|
195
|
-
export function
|
|
196
|
-
const record = exactObject(value, 'signed Peer Mesh
|
|
197
|
-
'
|
|
192
|
+
export function decodeSignedPeerMeshMemberAdvertisement(value) {
|
|
193
|
+
const record = exactObject(value, 'signed Peer Mesh member advertisement', [
|
|
194
|
+
'advertisement',
|
|
198
195
|
'publicKey',
|
|
199
196
|
'signature',
|
|
200
197
|
]);
|
|
201
|
-
const publicKey = canonicalProof(record.publicKey, '
|
|
202
|
-
const signature = canonicalProof(record.signature, '
|
|
198
|
+
const publicKey = canonicalProof(record.publicKey, 'advertisement public key', 256);
|
|
199
|
+
const signature = canonicalProof(record.signature, 'advertisement signature', 256);
|
|
203
200
|
return Object.freeze({
|
|
204
|
-
|
|
201
|
+
advertisement: canonicalPeerMeshMemberAdvertisement(record.advertisement),
|
|
205
202
|
publicKey,
|
|
206
203
|
signature,
|
|
207
204
|
});
|
|
208
205
|
}
|
|
209
|
-
export function
|
|
210
|
-
return Buffer.from(`maka.peer-mesh.
|
|
211
|
-
|
|
212
|
-
...(
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
peerId:
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
...(route.transitMeshId ? { transitMeshId: route.transitMeshId } : {}),
|
|
219
|
-
version: route.version,
|
|
206
|
+
export function peerMeshMemberAdvertisementSigningBytes(advertisement) {
|
|
207
|
+
return Buffer.from(`maka.peer-mesh.member-advertisement.v1\n${JSON.stringify({
|
|
208
|
+
...(advertisement.displayName ? { displayName: advertisement.displayName } : {}),
|
|
209
|
+
...(advertisement.endpointKind ? { endpointKind: advertisement.endpointKind } : {}),
|
|
210
|
+
meshId: advertisement.meshId,
|
|
211
|
+
offersTransit: advertisement.offersTransit,
|
|
212
|
+
peerId: advertisement.peerId,
|
|
213
|
+
revision: advertisement.revision,
|
|
214
|
+
version: advertisement.version,
|
|
220
215
|
})}`);
|
|
221
216
|
}
|
|
222
217
|
function encodeRoster(roster) {
|
|
223
218
|
return Buffer.from(`maka.peer-mesh.roster.v1\n${JSON.stringify({
|
|
219
|
+
authorityPeerId: roster.authorityPeerId,
|
|
224
220
|
closed: roster.closed,
|
|
225
221
|
...(roster.displayName ? { displayName: roster.displayName } : {}),
|
|
226
222
|
members: roster.members,
|
|
@@ -311,11 +307,3 @@ function stringArray(value, label, maxItems, maxLength) {
|
|
|
311
307
|
}
|
|
312
308
|
return value.map((item) => string(item, label, maxLength));
|
|
313
309
|
}
|
|
314
|
-
function addressArray(value, label) {
|
|
315
|
-
const addresses = stringArray(value, label, PEER_MESH_MAX_ROUTE_HINTS, 1024);
|
|
316
|
-
if (addresses.some((address) => !address.startsWith('/') || /\s|[\u0000-\u001f\u007f]/u.test(address)) ||
|
|
317
|
-
new Set(addresses).size !== addresses.length) {
|
|
318
|
-
throw new Error(`Invalid Peer Mesh ${label}`);
|
|
319
|
-
}
|
|
320
|
-
return addresses;
|
|
321
|
-
}
|