@joe-broadhead/messaging-bin-darwin-x64 0.9.4 → 0.9.5
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/bin/messagingd +2 -2
- package/lib/messagingd.mjs +77 -15
- package/package.json +1 -1
package/bin/messagingd
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: package/bin/messagingd
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 80647088 bytes
|
|
4
|
+
sha256: 07707290327691d46b590d0f7e6967ffdba79be6795010ab1c5b8626fc49ef42
|
package/lib/messagingd.mjs
CHANGED
|
@@ -8917,7 +8917,13 @@ var init_conversations = __esm(() => {
|
|
|
8917
8917
|
"conv.search": Read(strictObject({ key: Key, query: string2().min(1).max(200), cid: ConvId.optional(), from: ParticipantId.optional(), after: Millis.optional(), before: Millis.optional(), thread: Ulid.optional(), has: _enum(["file", "link"]).optional(), ...Page }), union([EventPage, Hold])),
|
|
8918
8918
|
"conv.context": Read(strictObject({ key: Key, ...Cid, event: Ulid, before: number2().int().min(0).max(20).optional(), after: number2().int().min(0).max(20).optional() }), union([object({ events: array(EventView).max(41), root: EventView.optional() }), Hold])),
|
|
8919
8919
|
"conv.access": Read(strictObject({ key: SessionKey, cid: ConvId.optional(), ...Page }), object({ conversations: array(object({ conv: ConvView, reason: _enum(["seat", "allow", "ask"]), lookbackDays: number2().int().positive().max(LIMITS.retainDaysMax), indexedFrom: Millis.optional(), complete: boolean2(), gap: IndexGap.optional() })).max(50), cursor: Cursor })),
|
|
8920
|
-
"context.get": Read(Empty, object({
|
|
8920
|
+
"context.get": Read(Empty, object({
|
|
8921
|
+
revision: Revision,
|
|
8922
|
+
rules: ContextRules,
|
|
8923
|
+
defaults: ContextRules,
|
|
8924
|
+
rulesUnreadable: literal(true).optional(),
|
|
8925
|
+
effective: array(object({ agent: ContextAgent, cid: ConvId, access: ContextAccess })).max(500)
|
|
8926
|
+
})),
|
|
8921
8927
|
"context.set": Write(strictObject({ rules: ContextRules, default: strictObject({ access: ContextAccess }).optional(), revision: Revision.optional() })),
|
|
8922
8928
|
"context.set.preview": Read(strictObject({ rules: ContextRules, default: strictObject({ access: ContextAccess }).optional(), revision: Revision.optional() }), object({ revision: Revision, changes: array(object({ agent: ContextAgent, cid: ConvId, from: ContextAccess, to: ContextAccess })).max(500) })),
|
|
8923
8929
|
"conv.policy": Write(strictObject({ ...Cid, agentContext: AgentContext })),
|
|
@@ -10417,7 +10423,7 @@ var init_channel_card2 = __esm(() => {
|
|
|
10417
10423
|
});
|
|
10418
10424
|
|
|
10419
10425
|
// packages/core/dist/version.js
|
|
10420
|
-
var VERSION = "0.9.
|
|
10426
|
+
var VERSION = "0.9.5";
|
|
10421
10427
|
|
|
10422
10428
|
// packages/core/dist/wire.js
|
|
10423
10429
|
function parseWire(text, options = {}) {
|
|
@@ -17087,6 +17093,8 @@ function resolveContext(args) {
|
|
|
17087
17093
|
return { access: "forbidden", source: "self" };
|
|
17088
17094
|
if (args.conv.agentContext !== "members")
|
|
17089
17095
|
return { access: "forbidden", source: "policy" };
|
|
17096
|
+
if (args.rulesUnknown)
|
|
17097
|
+
return { access: "forbidden", source: "unknown" };
|
|
17090
17098
|
if (isConsumerName(args.agent)) {
|
|
17091
17099
|
const rule = matchContextRule(rules, args.agent, args.conv.cid, kind, { cidsOnly: true, namedOnly: true });
|
|
17092
17100
|
if (rule === undefined)
|
|
@@ -21193,27 +21201,42 @@ class ConversationContextRules {
|
|
|
21193
21201
|
this.host = host;
|
|
21194
21202
|
}
|
|
21195
21203
|
rules() {
|
|
21204
|
+
return this.#read().rules;
|
|
21205
|
+
}
|
|
21206
|
+
unknown() {
|
|
21207
|
+
return this.#read().unknown;
|
|
21208
|
+
}
|
|
21209
|
+
#read() {
|
|
21196
21210
|
const engine = this.host.engine();
|
|
21197
21211
|
if (!engine)
|
|
21198
|
-
return EMPTY3;
|
|
21212
|
+
return { rules: EMPTY3, unknown: true };
|
|
21199
21213
|
const self = selfConvId(this.host.person());
|
|
21200
21214
|
const head = engine.options.store.convHead(self);
|
|
21201
|
-
const
|
|
21215
|
+
const listed = engine.selfListed();
|
|
21216
|
+
const key = `${head === undefined ? "" : `${head.seq}:${head.hash}`}:${engine.options.keys.generation(self)}:${listed === undefined ? "?" : listed ? "yes" : "no"}`;
|
|
21202
21217
|
if (this.#cached?.head === key)
|
|
21203
|
-
return this.#cached
|
|
21218
|
+
return this.#cached;
|
|
21219
|
+
if (head === undefined && listed !== false) {
|
|
21220
|
+
this.#cached = { head: key, rules: EMPTY3, unknown: true };
|
|
21221
|
+
return this.#cached;
|
|
21222
|
+
}
|
|
21204
21223
|
let rules = EMPTY3;
|
|
21224
|
+
let unknown = false;
|
|
21205
21225
|
if (head !== undefined) {
|
|
21206
21226
|
for (const { entry, body } of engine.options.store.convEntries(self)) {
|
|
21207
21227
|
const event = entry.event;
|
|
21208
21228
|
if (event?.class !== "op" || event.body?.op !== "setting" || event.body.kind !== "context")
|
|
21209
21229
|
continue;
|
|
21210
21230
|
const parsed = SettingBody.safeParse(body);
|
|
21211
|
-
if (parsed.success && parsed.data.s === "context")
|
|
21231
|
+
if (parsed.success && parsed.data.s === "context") {
|
|
21212
21232
|
rules = parsed.data.rules;
|
|
21233
|
+
unknown = false;
|
|
21234
|
+
} else
|
|
21235
|
+
unknown = true;
|
|
21213
21236
|
}
|
|
21214
21237
|
}
|
|
21215
|
-
this.#cached = { head: key, rules };
|
|
21216
|
-
return
|
|
21238
|
+
this.#cached = { head: key, rules, unknown };
|
|
21239
|
+
return this.#cached;
|
|
21217
21240
|
}
|
|
21218
21241
|
defaults() {
|
|
21219
21242
|
const rules = this.rules();
|
|
@@ -21284,7 +21307,7 @@ class ConversationContextRules {
|
|
|
21284
21307
|
return rows;
|
|
21285
21308
|
}
|
|
21286
21309
|
#decide(rules, conv, agent) {
|
|
21287
|
-
const decision = resolveContext({ person: this.host.person(), agent, conv, rules });
|
|
21310
|
+
const decision = resolveContext({ person: this.host.person(), agent, conv, rules, rulesUnknown: this.unknown() });
|
|
21288
21311
|
return decision.access === "forbidden" ? "off" : decision.access;
|
|
21289
21312
|
}
|
|
21290
21313
|
revision() {
|
|
@@ -21299,12 +21322,22 @@ class ConversationContextRules {
|
|
|
21299
21322
|
const engine = this.host.engine();
|
|
21300
21323
|
if (!engine)
|
|
21301
21324
|
throw new MessagingError("not_ready", "the conversation engine is not ready");
|
|
21325
|
+
const self = selfConvId(this.host.person());
|
|
21326
|
+
try {
|
|
21327
|
+
await this.#ensureSelf(engine, self);
|
|
21328
|
+
} catch (error) {
|
|
21329
|
+
this.#cached = undefined;
|
|
21330
|
+
if (this.unknown())
|
|
21331
|
+
throw new MessagingError("invalid_state", RULES_NOT_HERE);
|
|
21332
|
+
throw error;
|
|
21333
|
+
}
|
|
21334
|
+
this.#cached = undefined;
|
|
21335
|
+
if (this.unknown())
|
|
21336
|
+
throw new MessagingError("invalid_state", RULES_NOT_HERE);
|
|
21302
21337
|
const next = level === undefined ? [...rules] : withDefault(rules, level);
|
|
21303
21338
|
ContextRules.parse(next);
|
|
21304
21339
|
if (expected !== undefined && expected !== this.revision())
|
|
21305
21340
|
throw new MessagingError("conflict", "the rules changed since they were read: read them again and reapply your change");
|
|
21306
|
-
const self = selfConvId(this.host.person());
|
|
21307
|
-
await this.#ensureSelf(engine, self);
|
|
21308
21341
|
await engine.queueSetting(self, "context", { s: "context", rules: next });
|
|
21309
21342
|
await engine.flush(self);
|
|
21310
21343
|
this.#cached = undefined;
|
|
@@ -21341,7 +21374,7 @@ function withDefault(rules, level) {
|
|
|
21341
21374
|
const kept = rules.filter((rule) => !(rule.agent === "*" && ("kind" in rule.scope)));
|
|
21342
21375
|
return [...kept, ...ContextKind.options.map((kind) => ({ agent: "*", scope: { kind }, access: level }))];
|
|
21343
21376
|
}
|
|
21344
|
-
var CAP = 500, EMPTY3;
|
|
21377
|
+
var CAP = 500, RULES_NOT_HERE = "Your context rules have not reached this device yet, so they cannot be changed here. Change them on another of your devices, or make any change there (mark a conversation read) and they arrive here within a minute.", EMPTY3;
|
|
21345
21378
|
var init_conv_context = __esm(() => {
|
|
21346
21379
|
init_dist();
|
|
21347
21380
|
init_conv_read();
|
|
@@ -21973,7 +22006,13 @@ class ConversationIpc {
|
|
|
21973
22006
|
if (seat && (!seat.device || seat.device === this.options.own().device)) {
|
|
21974
22007
|
return { access: "allow", since: seat.since, after: 0, reason: "seat", days: state.retainDays, threadsOnly };
|
|
21975
22008
|
}
|
|
21976
|
-
const decision = resolveContext({
|
|
22009
|
+
const decision = resolveContext({
|
|
22010
|
+
person: scope.own,
|
|
22011
|
+
agent: scope.agent,
|
|
22012
|
+
conv: { ...state, persons: state.participants.map((p) => p.person) },
|
|
22013
|
+
rules: this.#rules.rules(),
|
|
22014
|
+
rulesUnknown: this.#rules.unknown()
|
|
22015
|
+
});
|
|
21977
22016
|
const days = decision.access === "forbidden" ? 0 : decision.lookbackDays;
|
|
21978
22017
|
return { access: decision.access, since: 0, after: this.options.now() - days * 86400000, reason: decision.access === "ask" ? "ask" : "allow", days, threadsOnly };
|
|
21979
22018
|
}
|
|
@@ -22886,7 +22925,13 @@ class ConversationIpc {
|
|
|
22886
22925
|
if (method === "seats.list")
|
|
22887
22926
|
return this.#seats(engine, scope);
|
|
22888
22927
|
if (method === "context.get") {
|
|
22889
|
-
return {
|
|
22928
|
+
return {
|
|
22929
|
+
revision: this.#rules.revision(),
|
|
22930
|
+
rules: [...this.#rules.rules()],
|
|
22931
|
+
defaults: this.#rules.defaults(),
|
|
22932
|
+
effective: this.#rules.effective(),
|
|
22933
|
+
...this.#rules.unknown() ? { rulesUnreadable: true } : {}
|
|
22934
|
+
};
|
|
22890
22935
|
}
|
|
22891
22936
|
if (method === "context.set.preview") {
|
|
22892
22937
|
const preview = this.#rules.preview(p.rules, p.default?.access);
|
|
@@ -31489,6 +31534,13 @@ function timelineEntry(log, served, body, invalid, junk) {
|
|
|
31489
31534
|
return { ...common, status: "available", body: opened.data };
|
|
31490
31535
|
return { ...common, status: junk.has(served.seq) ? "junk" : "missing-key" };
|
|
31491
31536
|
}
|
|
31537
|
+
function selfFirst(heads, self) {
|
|
31538
|
+
const front = [];
|
|
31539
|
+
const rest = [];
|
|
31540
|
+
for (const head of heads)
|
|
31541
|
+
(head.cid === self ? front : rest).push(head);
|
|
31542
|
+
return [...front, ...rest];
|
|
31543
|
+
}
|
|
31492
31544
|
|
|
31493
31545
|
class ConversationEngine {
|
|
31494
31546
|
options;
|
|
@@ -31738,10 +31790,20 @@ class ConversationEngine {
|
|
|
31738
31790
|
refreshAdmissions() {
|
|
31739
31791
|
return refreshConversationAdmissions(this.options);
|
|
31740
31792
|
}
|
|
31793
|
+
#selfListed;
|
|
31794
|
+
selfListed() {
|
|
31795
|
+
return this.#selfListed;
|
|
31796
|
+
}
|
|
31797
|
+
noteSelfListed(listed) {
|
|
31798
|
+
this.#selfListed = listed;
|
|
31799
|
+
}
|
|
31741
31800
|
async syncAll() {
|
|
31742
31801
|
const failures = [];
|
|
31743
31802
|
const listed = new Set;
|
|
31744
|
-
|
|
31803
|
+
const heads = await conversationHeads(this.options.link);
|
|
31804
|
+
const self = selfConvId(this.options.person);
|
|
31805
|
+
this.noteSelfListed(heads.some((head) => head.cid === self));
|
|
31806
|
+
for (const head of selfFirst(heads, self)) {
|
|
31745
31807
|
listed.add(head.cid);
|
|
31746
31808
|
try {
|
|
31747
31809
|
await this.sync(head.cid);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@joe-broadhead/messaging-bin-darwin-x64",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.5",
|
|
4
4
|
"description": "The self-contained messagingd executable for one platform: the Messaging daemon and its CLI (`messagingd cli …`, or invoked as `messaging`), with no Node.js, npm install or install script on the machine",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Joe Broadhead",
|