@songsid/agend 2.3.5-alpha.6 → 2.3.5-alpha.7
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/auth-api.js +11 -0
- package/dist/auth-api.js.map +1 -1
- package/dist/authority/web-authority.d.ts +13 -0
- package/dist/authority/web-authority.js +12 -0
- package/dist/authority/web-authority.js.map +1 -1
- package/dist/backend/claude-code.js +47 -9
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/kiro.js +1 -1
- package/dist/backend/kiro.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/channel/access-manager.d.ts +1 -6
- package/dist/channel/access-manager.js +4 -94
- package/dist/channel/access-manager.js.map +1 -1
- package/dist/channel/adapters/discord.d.ts +0 -2
- package/dist/channel/adapters/discord.js +0 -8
- package/dist/channel/adapters/discord.js.map +1 -1
- package/dist/channel/adapters/telegram.d.ts +0 -3
- package/dist/channel/adapters/telegram.js +1 -30
- package/dist/channel/adapters/telegram.js.map +1 -1
- package/dist/channel/types.d.ts +0 -2
- package/dist/cli.js +1 -19
- package/dist/cli.js.map +1 -1
- package/dist/fleet-manager.d.ts +59 -1
- package/dist/fleet-manager.js +336 -28
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/concepts/SKILL.md +22 -7
- package/dist/general-knowledge/steering/core-rules.md +6 -4
- package/dist/hub/buttons.js +4 -2
- package/dist/hub/buttons.js.map +1 -1
- package/dist/hub/catalog.d.ts +1 -1
- package/dist/hub/catalog.js +82 -15
- package/dist/hub/catalog.js.map +1 -1
- package/dist/hub/compose/server.d.ts +4 -1
- package/dist/hub/compose/server.js +29 -3
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/directory/directory.d.ts +1 -1
- package/dist/hub/directory/directory.js +32 -23
- package/dist/hub/directory/directory.js.map +1 -1
- package/dist/hub/directory/index.d.ts +1 -1
- package/dist/hub/directory/types.d.ts +8 -2
- package/dist/hub/directory/types.js.map +1 -1
- package/dist/hub/group-policy/admin-context.d.ts +23 -0
- package/dist/hub/group-policy/admin-context.js +52 -0
- package/dist/hub/group-policy/admin-context.js.map +1 -0
- package/dist/hub/group-policy/admin-dto.d.ts +235 -0
- package/dist/hub/group-policy/admin-dto.js +55 -0
- package/dist/hub/group-policy/admin-dto.js.map +1 -0
- package/dist/hub/group-policy/admin-inventory.d.ts +24 -0
- package/dist/hub/group-policy/admin-inventory.js +72 -0
- package/dist/hub/group-policy/admin-inventory.js.map +1 -0
- package/dist/hub/group-policy/admin-read.d.ts +21 -0
- package/dist/hub/group-policy/admin-read.js +90 -0
- package/dist/hub/group-policy/admin-read.js.map +1 -0
- package/dist/hub/group-policy/authorization.d.ts +43 -0
- package/dist/hub/group-policy/authorization.js +170 -0
- package/dist/hub/group-policy/authorization.js.map +1 -0
- package/dist/hub/group-policy/resources.d.ts +9 -1
- package/dist/hub/group-policy/resources.js +30 -5
- package/dist/hub/group-policy/resources.js.map +1 -1
- package/dist/hub/group-policy/store.d.ts +8 -2
- package/dist/hub/group-policy/store.js +9 -3
- package/dist/hub/group-policy/store.js.map +1 -1
- package/dist/hub/http/compose.js +6 -7
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/core.d.ts +23 -3
- package/dist/hub/http/core.js +138 -5
- package/dist/hub/http/core.js.map +1 -1
- package/dist/hub/http/deps.d.ts +3 -0
- package/dist/hub/policy.d.ts +3 -1
- package/dist/hub/policy.js +13 -6
- package/dist/hub/policy.js.map +1 -1
- package/dist/hub/rooms.d.ts +1 -0
- package/dist/hub/rooms.js +76 -26
- package/dist/hub/rooms.js.map +1 -1
- package/dist/hub/sessions.js +2 -1
- package/dist/hub/sessions.js.map +1 -1
- package/dist/hub/types.d.ts +2 -0
- package/dist/locale.js +26 -20
- package/dist/locale.js.map +1 -1
- package/dist/runtime-api.js +10 -2
- package/dist/runtime-api.js.map +1 -1
- package/dist/settings-api.js +3 -2
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-change.d.ts +10 -0
- package/dist/settings-change.js +17 -1
- package/dist/settings-change.js.map +1 -1
- package/dist/settings-confirmation.d.ts +25 -1
- package/dist/settings-confirmation.js +11 -3
- package/dist/settings-confirmation.js.map +1 -1
- package/dist/settings-effect.js +18 -6
- package/dist/settings-effect.js.map +1 -1
- package/dist/settings-http-confirmation.d.ts +21 -0
- package/dist/settings-http-confirmation.js +74 -3
- package/dist/settings-http-confirmation.js.map +1 -1
- package/dist/structured-signin.js +3 -1
- package/dist/structured-signin.js.map +1 -1
- package/dist/tips.js +4 -4
- package/dist/tips.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.js.map +1 -1
- package/dist/ui/accounts-keepalive.js +4 -3
- package/dist/ui/accounts-manage.js +2 -2
- package/dist/ui/accounts-view.js +18 -7
- package/dist/ui/backend-signin.js +12 -3
- package/dist/ui/general-location.js +28 -14
- package/dist/ui/hub-chat-store.js +2 -1
- package/dist/ui/hub-grant-strings.js +13 -0
- package/dist/ui/hub-owner-strings.js +6 -2
- package/dist/ui/hub-strings.js +4 -2
- package/dist/ui/panel-hub.js +68 -23
- package/dist/ui/panel-log.js +2 -2
- package/dist/ui/panel-runtimes.js +14 -6
- package/dist/ui/panel-settings.js +7 -19
- package/dist/ui/runtime-cli-install.js +24 -4
- package/dist/ui/settings-confirm.js +28 -0
- package/dist/ui/settings-devices.js +6 -10
- package/dist/ui/settings-hub-membership.js +6 -6
- package/dist/ui/settings-hub-section.js +35 -0
- package/dist/ui/settings-hub.js +6 -2
- package/dist/ui/settings-layout.js +6 -2
- package/dist/ui/settings-named-test.js +2 -2
- package/dist/ui/settings-outside.js +1 -1
- package/dist/ui/settings-quota-notice.js +8 -6
- package/dist/ui/settings-registry.js +3 -0
- package/dist/ui/settings-strings.js +6 -6
- package/dist/ui/shared/app-i18n.js +4 -2
- package/dist/ui/shared/app-route.js +1 -1
- package/dist/ui/shared/app-shell.js +102 -5
- package/dist/ui/shared/app.css +16 -0
- package/dist/ui/shared/chat-strings.js +8 -8
- package/dist/ui/shared/hub-owner.css +2 -2
- package/dist/ui/shared/hub-signin.css +24 -0
- package/dist/ui/shared/view-strings.js +4 -4
- package/dist/ui/structured-signin.js +16 -8
- package/dist/usage/providers.d.ts +1 -0
- package/dist/usage/providers.js +13 -9
- package/dist/usage/providers.js.map +1 -1
- package/dist/web-api.d.ts +5 -0
- package/dist/web-api.js +15 -6
- package/dist/web-api.js.map +1 -1
- package/dist/web-remote-access.d.ts +6 -0
- package/dist/web-remote-access.js +10 -1
- package/dist/web-remote-access.js.map +1 -1
- package/dist/web-shell-routes.d.ts +1 -1
- package/dist/web-shell-routes.js +1 -1
- package/dist/web-shell-routes.js.map +1 -1
- package/dist/windows-cli-api.d.ts +8 -0
- package/dist/windows-cli-api.js +10 -0
- package/dist/windows-cli-api.js.map +1 -1
- package/package.json +2 -1
package/dist/hub/http/core.js
CHANGED
|
@@ -3,24 +3,30 @@
|
|
|
3
3
|
* rows and the fresh directory check (with its concurrency bound). No I/O on import.
|
|
4
4
|
*/
|
|
5
5
|
import { randomUUID } from "node:crypto";
|
|
6
|
-
import { HubProtocolError } from "../validation.js";
|
|
7
|
-
import { personKeyString } from "../identity.js";
|
|
6
|
+
import { HubProtocolError, person as personSchema, validated } from "../validation.js";
|
|
7
|
+
import { personKeyString, sha256 } from "../identity.js";
|
|
8
|
+
import { exposureOf, readExposure } from "../catalog.js";
|
|
9
|
+
import { HubGroupAuthorizationError } from "../group-policy/authorization.js";
|
|
10
|
+
import { HubGroupPolicyError } from "../group-policy/store.js";
|
|
8
11
|
/** At most this many directory checks in flight per person, and in all; more is backpressure (429), never a cached allow. */
|
|
9
12
|
export const DIRECTORY_PER_PERSON = 4;
|
|
10
13
|
export const DIRECTORY_TOTAL = 32;
|
|
14
|
+
const LEGACY_OPERATION = Object.freeze({ source: "legacy", assertCurrent() { } });
|
|
11
15
|
export class HubCore {
|
|
12
16
|
deps;
|
|
13
17
|
sql;
|
|
18
|
+
lifetime;
|
|
14
19
|
inflight = new Map();
|
|
15
20
|
total = 0;
|
|
16
|
-
constructor(deps, sql) {
|
|
21
|
+
constructor(deps, sql, lifetime = () => true) {
|
|
17
22
|
this.deps = deps;
|
|
18
23
|
this.sql = sql;
|
|
24
|
+
this.lifetime = lifetime;
|
|
19
25
|
}
|
|
20
26
|
now() { return this.deps.now?.() ?? Date.now(); }
|
|
21
27
|
/** Refuses once the server is fenced (and before every write: a stale continuation never commits). */
|
|
22
28
|
live() { try {
|
|
23
|
-
return this.deps.current().serverEnabled() === true;
|
|
29
|
+
return this.lifetime() === true && this.deps.current().serverEnabled() === true;
|
|
24
30
|
}
|
|
25
31
|
catch {
|
|
26
32
|
return false;
|
|
@@ -28,16 +34,87 @@ export class HubCore {
|
|
|
28
34
|
check() { if (!this.live())
|
|
29
35
|
throw new HubProtocolError("unavailable"); }
|
|
30
36
|
/** One synchronous unit of work on the Hub DB; a promise returned from `work` is refused. */
|
|
31
|
-
atomic(work) {
|
|
37
|
+
atomic(work, permit) {
|
|
32
38
|
this.check();
|
|
33
39
|
return this.deps.uow.atomic((tx) => {
|
|
34
40
|
this.check();
|
|
41
|
+
permit?.assertCurrent();
|
|
35
42
|
const out = work(this.sql(tx), tx);
|
|
36
43
|
if (out && typeof out.then === "function")
|
|
37
44
|
throw new HubProtocolError("invalid");
|
|
45
|
+
permit?.assertCurrent();
|
|
38
46
|
return out;
|
|
39
47
|
});
|
|
40
48
|
}
|
|
49
|
+
/** A group refusal is bounded protocol data, never a directory exception or DN. */
|
|
50
|
+
async group(work) {
|
|
51
|
+
try {
|
|
52
|
+
const permit = await work();
|
|
53
|
+
return { source: permit.source, assertCurrent() {
|
|
54
|
+
try {
|
|
55
|
+
permit.assertCurrent();
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
throw new HubProtocolError("unavailable");
|
|
59
|
+
}
|
|
60
|
+
} };
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
if (error instanceof HubGroupAuthorizationError && (error.reason === "denied" || error.reason === "resume-required"))
|
|
64
|
+
throw new HubProtocolError("denied");
|
|
65
|
+
if (error instanceof HubGroupPolicyError)
|
|
66
|
+
throw new HubProtocolError("unavailable");
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/** A synchronous session fence is mandatory when group checks can await LDAP. */
|
|
71
|
+
groupContext(ctx) {
|
|
72
|
+
const fence = ctx.isCurrent?.bind(ctx);
|
|
73
|
+
return { requestId: ctx.requestId, current: () => this.live() && fence?.() === true };
|
|
74
|
+
}
|
|
75
|
+
async groupAsker(person, ctx) {
|
|
76
|
+
const groups = this.deps.groups;
|
|
77
|
+
if (!groups)
|
|
78
|
+
return LEGACY_OPERATION;
|
|
79
|
+
const permit = await this.group(() => groups.asker(person, ctx));
|
|
80
|
+
return { source: permit.source, assertCurrent: () => {
|
|
81
|
+
if (this.deps.groups !== groups)
|
|
82
|
+
throw new HubProtocolError("unavailable");
|
|
83
|
+
permit.assertCurrent();
|
|
84
|
+
} };
|
|
85
|
+
}
|
|
86
|
+
/** Fresh asker + exact fleet/exposure provenance. An allow is for this operation only. */
|
|
87
|
+
async groupExposure(exposureId, asker, ctx) {
|
|
88
|
+
const groups = this.deps.groups;
|
|
89
|
+
if (!groups)
|
|
90
|
+
return LEGACY_OPERATION;
|
|
91
|
+
const exposure = this.atomic(db => { const row = readExposure(db, exposureId); return row && exposureOf(row); });
|
|
92
|
+
if (!exposure)
|
|
93
|
+
throw new HubProtocolError("not-found");
|
|
94
|
+
const fleet = this.deps.store.read().fleets.find(f => f.id === exposure.fleetId);
|
|
95
|
+
if (!fleet || personKeyString(fleet.owner) !== personKeyString(exposure.owner))
|
|
96
|
+
throw new HubProtocolError("revoked");
|
|
97
|
+
const serializedExposure = JSON.stringify(exposure), serializedFleet = JSON.stringify(fleet), permits = [];
|
|
98
|
+
if (asker)
|
|
99
|
+
permits.push(await this.groupAsker(asker, ctx));
|
|
100
|
+
const fleetPermit = await this.group(() => groups.check({ kind: "fleet", id: fleet.id, revision: fleet.generation, owner: fleet.owner }, ctx));
|
|
101
|
+
permits.push(fleetPermit);
|
|
102
|
+
if (fleet.status !== "active" && fleetPermit.source !== "legacy")
|
|
103
|
+
throw new HubProtocolError("revoked");
|
|
104
|
+
permits.push(await this.group(() => groups.check({ kind: "exposure", id: exposure.id, revision: exposure.revision, owner: exposure.owner }, ctx)));
|
|
105
|
+
const permit = { assertCurrent: () => {
|
|
106
|
+
if (!this.live() || ctx.current() !== true || this.deps.groups !== groups)
|
|
107
|
+
throw new HubProtocolError("unavailable");
|
|
108
|
+
for (const proof of permits)
|
|
109
|
+
proof.assertCurrent();
|
|
110
|
+
const row = this.atomic(db => readExposure(db, exposure.id));
|
|
111
|
+
if (!row || JSON.stringify(exposureOf(row)) !== serializedExposure
|
|
112
|
+
|| JSON.stringify(this.deps.store.read().fleets.find(f => f.id === fleet.id)) !== serializedFleet)
|
|
113
|
+
throw new HubProtocolError("stale");
|
|
114
|
+
} };
|
|
115
|
+
permit.assertCurrent();
|
|
116
|
+
return permit;
|
|
117
|
+
}
|
|
41
118
|
/** Audit inside the caller's transaction: a failed append aborts the whole unit (hub.md §4). */
|
|
42
119
|
audit(tx, event) {
|
|
43
120
|
const { at, ...rest } = event;
|
|
@@ -58,6 +135,52 @@ export class HubCore {
|
|
|
58
135
|
throw new HubProtocolError("uncertain");
|
|
59
136
|
}
|
|
60
137
|
}
|
|
138
|
+
/** These wrappers share one bounded identity selection path; their callers own the operation's authority check. */
|
|
139
|
+
async lookupPairingOwner(login) {
|
|
140
|
+
return this.lookupSelectedPerson(login, "pairing");
|
|
141
|
+
}
|
|
142
|
+
async lookupGrantRecipient(login) {
|
|
143
|
+
return this.lookupSelectedPerson(login, "grant");
|
|
144
|
+
}
|
|
145
|
+
async lookupSelectedPerson(login, operation) {
|
|
146
|
+
const lookup = operation === "pairing" ? this.deps.directory.lookupForPairing : this.deps.directory.lookupForGrant;
|
|
147
|
+
if (!lookup)
|
|
148
|
+
return personByLogin(this, login); // Older injected drivers retain the same known-person behavior.
|
|
149
|
+
const key = `directory-login:${sha256(login.toLowerCase())}`, mine = this.inflight.get(key) ?? 0;
|
|
150
|
+
if (mine >= DIRECTORY_PER_PERSON || this.total >= DIRECTORY_TOTAL)
|
|
151
|
+
throw new HubProtocolError("backpressure");
|
|
152
|
+
this.check();
|
|
153
|
+
this.inflight.set(key, mine + 1);
|
|
154
|
+
this.total++;
|
|
155
|
+
let result;
|
|
156
|
+
try {
|
|
157
|
+
result = await lookup.call(this.deps.directory, login);
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
throw new HubProtocolError("unavailable");
|
|
161
|
+
}
|
|
162
|
+
finally {
|
|
163
|
+
const n = (this.inflight.get(key) ?? 1) - 1;
|
|
164
|
+
if (n > 0)
|
|
165
|
+
this.inflight.set(key, n);
|
|
166
|
+
else
|
|
167
|
+
this.inflight.delete(key);
|
|
168
|
+
this.total--;
|
|
169
|
+
}
|
|
170
|
+
this.check();
|
|
171
|
+
if (!result.ok) {
|
|
172
|
+
if (result.reason === "unavailable")
|
|
173
|
+
throw new HubProtocolError("unavailable");
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
const selected = validated(personSchema, result.person.key);
|
|
177
|
+
if (selected.realm !== this.deps.directory.realm || typeof result.person.login !== "string"
|
|
178
|
+
|| result.person.login.toLowerCase() !== login.toLowerCase())
|
|
179
|
+
throw new HubProtocolError("unavailable");
|
|
180
|
+
// The directory's fresh immutable-id recheck, not the login or cached person rows, decides the selected identity.
|
|
181
|
+
const current = await this.current(selected);
|
|
182
|
+
return current && current.login.toLowerCase() === login.toLowerCase() ? selected : null;
|
|
183
|
+
}
|
|
61
184
|
/**
|
|
62
185
|
* A fresh directory eligibility check (no allow-cache). Ineligible or unreachable is denied; the person's row records
|
|
63
186
|
* what was seen. Bounded per person and in all — over the bound is "backpressure".
|
|
@@ -121,4 +244,14 @@ export async function personByLogin(core, login) {
|
|
|
121
244
|
const person = personFromString(id), now = await core.current(person);
|
|
122
245
|
return now && now.login.toLowerCase() === label.toLowerCase() ? person : null;
|
|
123
246
|
}
|
|
247
|
+
/** Only the existing authenticated Hub-admin pairing operation may select an unsigned-in directory owner. */
|
|
248
|
+
export async function pairingOwnerByLogin(core, ctx, input) {
|
|
249
|
+
await ctx.requireAdmin();
|
|
250
|
+
const login = input.trim();
|
|
251
|
+
if (!login || login.length > 256)
|
|
252
|
+
return null;
|
|
253
|
+
const owner = await core.lookupPairingOwner(login);
|
|
254
|
+
await ctx.current(); // No stale admin session may use a lookup completed after it was signed out.
|
|
255
|
+
return owner;
|
|
256
|
+
}
|
|
124
257
|
//# sourceMappingURL=core.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/hub/http/core.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAMjD,6HAA6H;AAC7H,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AACtC,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAElC,MAAM,OAAO,OAAO;IAGG,IAAI;IAAgC,GAAG;IAF3C,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC9C,KAAK,GAAG,CAAC,CAAC;IAClB,YAAqB,IAAiB,EAAmB,GAAkB;oBAAtD,IAAI;mBAAgC,GAAG;IAAkB,CAAC;IAC/E,GAAG,KAAa,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACzD,sGAAsG;IACtG,IAAI,KAAc,IAAI,CAAC;QAAC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,aAAa,EAAE,KAAK,IA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CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,GAAG;QAAE,OAAO,IAAI,CAAC;IAC9C,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;IACnD,MAAM,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,6EAA6E;IAClG,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/hub/http/deps.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import type { HubPollBallot } from "../types.js";
|
|
|
12
12
|
export interface HubHttpConfig {
|
|
13
13
|
readonly hubId: string;
|
|
14
14
|
readonly name: string;
|
|
15
|
+
readonly memberOrigin: string;
|
|
15
16
|
readonly webOrigin: string;
|
|
16
17
|
readonly administrator: PersonKey;
|
|
17
18
|
}
|
|
@@ -41,6 +42,8 @@ export interface HubHttpDeps {
|
|
|
41
42
|
audit: HubAuditSink;
|
|
42
43
|
directory: HubDirectory;
|
|
43
44
|
pairing: HubPairingService;
|
|
45
|
+
/** Server-owned group permits; absent only in legacy injected compositions. */
|
|
46
|
+
groups?: import("../group-policy/authorization.js").HubGroupAuthorization;
|
|
44
47
|
store: HubTransportStore;
|
|
45
48
|
config: HubHttpConfig;
|
|
46
49
|
preview?: Readonly<import("../preview.js").HubPreviewView>;
|
package/dist/hub/policy.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type Database from "better-sqlite3";
|
|
2
2
|
import type { HubAuthorizationLease, HubAuthorizationRequest, HubAuthorizationResult, HubExposure, HubGrant } from "./types.js";
|
|
3
3
|
import type { HubLinkContext } from "./server.js";
|
|
4
|
-
import { type HubCore } from "./http/core.js";
|
|
4
|
+
import { type HubCore, type HubOperationPermit } from "./http/core.js";
|
|
5
5
|
export declare const LEASE_MS = 5000;
|
|
6
6
|
/** P1 question lifetime (hub.md §2: at most 24 hours). */
|
|
7
7
|
export declare const QUESTION_LIFETIME_MS: number;
|
|
@@ -48,6 +48,8 @@ export declare class HubPolicyService {
|
|
|
48
48
|
constructor(core: HubCore);
|
|
49
49
|
/** Both people of a message are eligible in the directory now (two fresh lookups, bounded). */
|
|
50
50
|
peopleEligible(msg: Pick<MessageRow, "asker" | "owner">): Promise<boolean>;
|
|
51
|
+
/** Group authority is re-resolved for this exact message, never borrowed from its admission lease. */
|
|
52
|
+
operation(msg: MessageRow, link: HubLinkContext): Promise<HubOperationPermit>;
|
|
51
53
|
/** A member's `authorize.request` on its current link → a lease for exactly that operation, or a bounded refusal. */
|
|
52
54
|
authorize(input: HubAuthorizationRequest, link: HubLinkContext): Promise<HubAuthorizationResult>;
|
|
53
55
|
/**
|
package/dist/hub/policy.js
CHANGED
|
@@ -49,6 +49,15 @@ export class HubPolicyService {
|
|
|
49
49
|
async peopleEligible(msg) {
|
|
50
50
|
return (await this.core.eligible(personFromString(msg.asker))) && (await this.core.eligible(personFromString(msg.owner)));
|
|
51
51
|
}
|
|
52
|
+
/** Group authority is re-resolved for this exact message, never borrowed from its admission lease. */
|
|
53
|
+
async operation(msg, link) {
|
|
54
|
+
if (!(await this.peopleEligible(msg)))
|
|
55
|
+
throw new HubProtocolError("revoked");
|
|
56
|
+
const permit = await this.core.groupExposure(msg.exposure_id, personFromString(msg.asker), { requestId: randomUUID(), current: () => link.current() });
|
|
57
|
+
if (!link.current())
|
|
58
|
+
throw new HubProtocolError("stale");
|
|
59
|
+
return permit;
|
|
60
|
+
}
|
|
52
61
|
/** A member's `authorize.request` on its current link → a lease for exactly that operation, or a bounded refusal. */
|
|
53
62
|
async authorize(input, link) {
|
|
54
63
|
let request;
|
|
@@ -78,15 +87,13 @@ export class HubPolicyService {
|
|
|
78
87
|
return refuse("not-found");
|
|
79
88
|
if (request.exposureRevision !== first.exposure_revision)
|
|
80
89
|
return refuse("stale", first);
|
|
81
|
-
let
|
|
90
|
+
let permit;
|
|
82
91
|
try {
|
|
83
|
-
|
|
92
|
+
permit = await this.operation(first, link);
|
|
84
93
|
}
|
|
85
94
|
catch (e) {
|
|
86
|
-
return refuse(e instanceof HubProtocolError && e.code === "
|
|
95
|
+
return refuse(e instanceof HubProtocolError && (e.code === "revoked" || e.code === "denied") ? e.code : "unavailable", first);
|
|
87
96
|
}
|
|
88
|
-
if (!eligible)
|
|
89
|
-
return refuse("revoked", first);
|
|
90
97
|
if (!link.current())
|
|
91
98
|
return { ok: false, reasonCode: "stale" };
|
|
92
99
|
const now = this.core.now();
|
|
@@ -116,7 +123,7 @@ export class HubPolicyService {
|
|
|
116
123
|
messageId: msg.id, roomId: msg.room_id, fleetId: link.fleetId, exposureId: msg.exposure_id, ownerAtEvent: personFromString(msg.owner),
|
|
117
124
|
grantId: msg.grant_id, grantRevision: msg.grant_revision });
|
|
118
125
|
return { ok: true, lease };
|
|
119
|
-
});
|
|
126
|
+
}, permit);
|
|
120
127
|
}
|
|
121
128
|
catch (e) {
|
|
122
129
|
const code = e instanceof HubProtocolError ? e.code : "unavailable";
|
package/dist/hub/policy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy.js","sourceRoot":"","sources":["../../src/hub/policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAGtD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"policy.js","sourceRoot":"","sources":["../../src/hub/policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,i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C;QACjE,IAAI,GAAG,CAAC,QAAQ;YAAE,MAAM,IAAI,gBAAgB,CAAC,UAAU,CAAC,CAAC;QACzD,EAAE,CAAC,OAAO,CAAC,sDAAsD,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAC3F,CAAC;CACF;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
package/dist/hub/rooms.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export interface HubFileView {
|
|
|
26
26
|
}
|
|
27
27
|
export interface HubRoomEntryView extends HubRoomEntry {
|
|
28
28
|
buttons?: import("../reply-buttons-controller.js").ReplyButtonsView;
|
|
29
|
+
pollResult?: true;
|
|
29
30
|
expired?: boolean;
|
|
30
31
|
questionFiles?: HubFileView[];
|
|
31
32
|
answerFiles?: HubFileView[];
|
package/dist/hub/rooms.js
CHANGED
|
@@ -103,20 +103,21 @@ export class HubRoomsService {
|
|
|
103
103
|
if (!ownerId || !(await this.core.eligible(personFromString(ownerId))))
|
|
104
104
|
throw new HubProtocolError("revoked");
|
|
105
105
|
await ctx.current();
|
|
106
|
-
|
|
106
|
+
const permit = await this.core.groupExposure(room.exposure_id, asker, this.core.groupContext(ctx));
|
|
107
|
+
return { asker, room, permit };
|
|
107
108
|
}
|
|
108
109
|
/** Before any upload body is read: the asker, their room and grant, a link that takes files, and room in their budget. */
|
|
109
110
|
async uploadAdmit(ctx, roomId, declaredBytes) {
|
|
110
|
-
const store = this.store(), { asker } = await this.ownerEligible(ctx, roomId), now = this.core.now();
|
|
111
|
+
const store = this.store(), { asker, permit } = await this.ownerEligible(ctx, roomId), now = this.core.now();
|
|
111
112
|
this.core.atomic((db) => {
|
|
112
113
|
const { exposure } = this.askerRoom(db, roomId, asker, now, "ask");
|
|
113
114
|
this.requireFiles(exposure.fleetId);
|
|
114
115
|
store.admit(db, { uploader: personKeyString(asker) }, declaredBytes);
|
|
115
|
-
});
|
|
116
|
+
}, permit);
|
|
116
117
|
}
|
|
117
118
|
/** The asker's file for a later question in this room: only while the fleet's link takes files. Pending one hour. */
|
|
118
119
|
async upload(ctx, roomId, name, bytes) {
|
|
119
|
-
const store = this.store(), { asker } = await this.ownerEligible(ctx, roomId), now = this.core.now();
|
|
120
|
+
const store = this.store(), { asker, permit } = await this.ownerEligible(ctx, roomId), now = this.core.now();
|
|
120
121
|
return this.core.atomic((db, tx) => {
|
|
121
122
|
const { room, exposure, grant } = this.askerRoom(db, roomId, asker, now, "ask");
|
|
122
123
|
this.requireFiles(exposure.fleetId);
|
|
@@ -125,11 +126,11 @@ export class HubRoomsService {
|
|
|
125
126
|
reasonCode: `question:${ref.size}:${ref.mime}:${ref.sha256}`, contentRef: this.core.deps.content.put(tx, { question: ref.name }),
|
|
126
127
|
roomId, fleetId: exposure.fleetId, exposureId: exposure.id, ownerAtEvent: exposure.owner, grantId: grant.id, grantRevision: grant.revision });
|
|
127
128
|
return fileView(roomId, ref);
|
|
128
|
-
});
|
|
129
|
+
}, permit);
|
|
129
130
|
}
|
|
130
131
|
/** One of this room's files, for its asker while read-own-room holds; every read is audited. */
|
|
131
132
|
async download(ctx, roomId, fileId) {
|
|
132
|
-
const store = this.store(), { asker } = await this.ownerEligible(ctx, roomId), now = this.core.now();
|
|
133
|
+
const store = this.store(), { asker, permit } = await this.ownerEligible(ctx, roomId), now = this.core.now();
|
|
133
134
|
return this.core.atomic((db, tx) => {
|
|
134
135
|
const { exposure, grant } = this.askerRoom(db, roomId, asker, now, "read-own-room");
|
|
135
136
|
const row = store.row(db, fileId);
|
|
@@ -140,7 +141,7 @@ export class HubRoomsService {
|
|
|
140
141
|
reasonCode: `${row.direction}:${row.size}:${row.mime}:${row.sha256}`, ...(row.message_id ? { messageId: row.message_id } : {}),
|
|
141
142
|
roomId, fleetId: exposure.fleetId, exposureId: exposure.id, ownerAtEvent: exposure.owner, grantId: grant.id, grantRevision: grant.revision });
|
|
142
143
|
return { name: row.name, mime: row.mime, image: isInlineImage(row.mime), bytes };
|
|
143
|
-
});
|
|
144
|
+
}, permit);
|
|
144
145
|
}
|
|
145
146
|
/** Open (or find) the asker's room for one exposure under one grant that applies to them now. */
|
|
146
147
|
async open(ctx, exposureId, grantId) {
|
|
@@ -149,6 +150,7 @@ export class HubRoomsService {
|
|
|
149
150
|
if (!owner || !(await this.core.eligible(personFromString(owner))))
|
|
150
151
|
throw new HubProtocolError("not-found");
|
|
151
152
|
await ctx.current();
|
|
153
|
+
const permit = await this.core.groupExposure(exposureId, asker, this.core.groupContext(ctx));
|
|
152
154
|
return this.core.atomic((db, tx) => {
|
|
153
155
|
const e = readExposure(db, exposureId), g = readGrant(db, grantId);
|
|
154
156
|
if (!e || !g)
|
|
@@ -168,7 +170,7 @@ export class HubRoomsService {
|
|
|
168
170
|
this.core.audit(tx, { requestId: ctx.requestId, actor: { kind: "person", person: asker }, action: "room.opened", result: "completed",
|
|
169
171
|
roomId: room.id, fleetId: exposure.fleetId, exposureId, ownerAtEvent: exposure.owner, grantId, grantRevision: grant.revision });
|
|
170
172
|
return { ...roomOf(room), exposure };
|
|
171
|
-
});
|
|
173
|
+
}, permit);
|
|
172
174
|
}
|
|
173
175
|
/**
|
|
174
176
|
* This person's rooms, the most recently active first, as the chat's conversation list draws them (#3226 B): the
|
|
@@ -178,9 +180,31 @@ export class HubRoomsService {
|
|
|
178
180
|
* has negotiated (D's link.features; none until then).
|
|
179
181
|
*/
|
|
180
182
|
async list(ctx) {
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
|
|
183
|
+
const asker = await ctx.requirePerson(), me = personKeyString(asker), context = this.core.groupContext(ctx);
|
|
184
|
+
const askerPermit = await this.core.groupAsker(asker, context);
|
|
185
|
+
const rows = this.core.atomic(db => db.prepare(`${ROOM_VIEW_SQL} WHERE r.asker=? ORDER BY (r.state='active') DESC, last_at DESC LIMIT 100`).all(me));
|
|
186
|
+
const proofs = new Map();
|
|
187
|
+
for (const row of rows)
|
|
188
|
+
if (!proofs.has(row.exposure_id)) {
|
|
189
|
+
try {
|
|
190
|
+
proofs.set(row.exposure_id, await this.core.groupExposure(row.exposure_id, null, context));
|
|
191
|
+
}
|
|
192
|
+
catch (e) {
|
|
193
|
+
if (e instanceof HubProtocolError && (e.code === "denied" || e.code === "revoked"))
|
|
194
|
+
proofs.set(row.exposure_id, null);
|
|
195
|
+
else
|
|
196
|
+
throw e;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
askerPermit.assertCurrent();
|
|
200
|
+
return this.core.atomic(db => rows.flatMap(row => {
|
|
201
|
+
const proof = proofs.get(row.exposure_id);
|
|
202
|
+
if (proof === null)
|
|
203
|
+
return [];
|
|
204
|
+
proof?.assertCurrent();
|
|
205
|
+
const fresh = db.prepare(`${ROOM_VIEW_SQL} WHERE r.id=? AND r.asker=?`).get(row.id, me);
|
|
206
|
+
return fresh ? [roomListItem(fresh, this.featuresOf(fresh.fleet_id))] : [];
|
|
207
|
+
}), askerPermit);
|
|
184
208
|
}
|
|
185
209
|
/**
|
|
186
210
|
* #3226 C (the user's choice): who asked one of the owner's agents, when, and how it went — never what was asked or
|
|
@@ -205,11 +229,17 @@ export class HubRoomsService {
|
|
|
205
229
|
* route asks it after its own read, but this answers alone). The messages answer carries it, fresh each poll.
|
|
206
230
|
*/
|
|
207
231
|
async view(ctx, roomId) {
|
|
208
|
-
const
|
|
232
|
+
const asker = await ctx.requirePerson(), me = personKeyString(asker);
|
|
209
233
|
const row = this.core.atomic((db) => db.prepare(`${ROOM_VIEW_SQL} WHERE r.id=? AND r.asker=?`).get(roomId, me));
|
|
210
234
|
if (!row)
|
|
211
235
|
throw new HubProtocolError("not-found");
|
|
212
|
-
|
|
236
|
+
const permit = await this.core.groupExposure(row.exposure_id, asker, this.core.groupContext(ctx));
|
|
237
|
+
return this.core.atomic(db => {
|
|
238
|
+
const fresh = db.prepare(`${ROOM_VIEW_SQL} WHERE r.id=? AND r.asker=?`).get(roomId, me);
|
|
239
|
+
if (!fresh)
|
|
240
|
+
throw new HubProtocolError("not-found");
|
|
241
|
+
return roomListItem(fresh, this.featuresOf(fresh.fleet_id));
|
|
242
|
+
}, permit);
|
|
213
243
|
}
|
|
214
244
|
/** What the room's fleet link negotiated (D's link.features, #3241): none while it has no current link. */
|
|
215
245
|
featuresOf(fleetId) {
|
|
@@ -231,9 +261,10 @@ export class HubRoomsService {
|
|
|
231
261
|
if (!ownerId || !(await this.core.eligible(personFromString(ownerId))))
|
|
232
262
|
throw new HubProtocolError("revoked");
|
|
233
263
|
await ctx.current();
|
|
264
|
+
const permit = await this.core.groupExposure(room.exposure_id, asker, this.core.groupContext(ctx));
|
|
234
265
|
const out = this.core.atomic((db, tx) => this.insertQuestion(db, tx, {
|
|
235
266
|
roomId, asker, idempotencyKey, text, requestId: ctx.requestId, actor: { kind: "person", person: asker },
|
|
236
|
-
}, fileIds));
|
|
267
|
+
}, fileIds), permit);
|
|
237
268
|
if (out.fleet)
|
|
238
269
|
void this.flush(out.fleet);
|
|
239
270
|
return out.receipt;
|
|
@@ -285,6 +316,7 @@ export class HubRoomsService {
|
|
|
285
316
|
if (!ownerId || !(await this.core.eligible(personFromString(ownerId))))
|
|
286
317
|
throw new HubProtocolError("revoked");
|
|
287
318
|
await ctx.current();
|
|
319
|
+
const permit = await this.core.groupExposure(room.exposure_id, asker, this.core.groupContext(ctx));
|
|
288
320
|
const rows = this.core.atomic((db) => {
|
|
289
321
|
const r = db.prepare("SELECT * FROM hub_rooms WHERE id=?").get(roomId);
|
|
290
322
|
const e = readExposure(db, r.exposure_id), g = readGrant(db, r.grant_id);
|
|
@@ -300,15 +332,25 @@ export class HubRoomsService {
|
|
|
300
332
|
const store = this.core.deps.attachments;
|
|
301
333
|
const files = store ? this.core.atomic((db) => new Map(rows.map(m => [m.id, { question: store.forMessage(db, m.id, "question"), answer: store.forMessage(db, m.id, "answer") }]))) : null;
|
|
302
334
|
const views = this.core.atomic(db => new Map(rows.map(m => [m.id, this.buttons.view(db, m.id)])));
|
|
303
|
-
|
|
335
|
+
// The exact agent prompt stays in durable delivery, not in the asker's prose. Use the server-owned result
|
|
336
|
+
// binding (including pre-existing rows), never a text prefix a person could also type. Bound the projection
|
|
337
|
+
// query to this authorized page; no schema or delivery/digest change is needed.
|
|
338
|
+
const pollResults = rows.length ? this.core.atomic(db => new Set(db.prepare(`SELECT result_message_id FROM hub_answer_buttons
|
|
339
|
+
WHERE room_id=? AND result_message_id IN (${rows.map(() => "?").join(",")})`).all(roomId, ...rows.map(m => m.id))
|
|
340
|
+
.map(row => row.result_message_id))) : new Set();
|
|
341
|
+
const entries = rows.map((m) => {
|
|
304
342
|
const q = this.core.deps.content.get(m.question_ref), a = m.answer_ref ? this.core.deps.content.get(m.answer_ref) : undefined;
|
|
305
343
|
const expired = q === undefined || (m.answer_ref !== null && a === undefined);
|
|
306
344
|
// #3226 B: when it was asked (the chat's time on the question), beside the receipt's stage time; D: the files, as B maps them.
|
|
307
345
|
const f = files?.get(m.id), qf = f?.question.map(r => fileView(roomId, r)) ?? [], af = f?.answer.map(r => fileView(roomId, r)) ?? [];
|
|
308
346
|
return { messageId: m.id, sequence: m.sequence, receipt: receiptOf(m), askedAt: m.created_at, ...(views.get(m.id) ? { buttons: views.get(m.id) } : {}),
|
|
309
|
-
|
|
347
|
+
// Explicit blank also replaces the old prompt in a cached tab's merged entry; old renderers show no text.
|
|
348
|
+
...(pollResults.has(m.id) ? { pollResult: true, question: "" } : q?.question !== undefined ? { question: q.question } : {}),
|
|
349
|
+
...(a?.answer !== undefined ? { answer: a.answer } : {}), ...(expired ? { expired: true } : {}),
|
|
310
350
|
...(qf.length ? { questionFiles: qf } : {}), ...(af.length ? { answerFiles: af } : {}) };
|
|
311
351
|
});
|
|
352
|
+
permit.assertCurrent();
|
|
353
|
+
return entries;
|
|
312
354
|
}
|
|
313
355
|
/**
|
|
314
356
|
* Send this fleet's queued questions over its current, reconciled link (one flush at a time per fleet). Questions
|
|
@@ -328,12 +370,15 @@ export class HubRoomsService {
|
|
|
328
370
|
for (const first of pending) {
|
|
329
371
|
if (!link.current())
|
|
330
372
|
return false;
|
|
331
|
-
let eligible =
|
|
373
|
+
let eligible = true, permit;
|
|
332
374
|
try {
|
|
333
|
-
|
|
375
|
+
permit = await this.policy.operation(first, link);
|
|
334
376
|
}
|
|
335
|
-
catch {
|
|
336
|
-
|
|
377
|
+
catch (e) {
|
|
378
|
+
if (e instanceof HubProtocolError && e.code === "revoked")
|
|
379
|
+
eligible = false;
|
|
380
|
+
else
|
|
381
|
+
return false; // Group unknown/denied holds the queue; never fabricates delivery or cancellation.
|
|
337
382
|
}
|
|
338
383
|
const now = this.core.now();
|
|
339
384
|
const frame = this.core.atomic((db, tx) => {
|
|
@@ -367,12 +412,19 @@ export class HubRoomsService {
|
|
|
367
412
|
});
|
|
368
413
|
if (!frame)
|
|
369
414
|
continue;
|
|
415
|
+
try {
|
|
416
|
+
permit?.assertCurrent();
|
|
417
|
+
}
|
|
418
|
+
catch {
|
|
419
|
+
return false;
|
|
420
|
+
}
|
|
370
421
|
const transport = this.core.deps.transport();
|
|
371
422
|
if (!transport || !link.current())
|
|
372
423
|
return false;
|
|
373
424
|
// Socket acceptance only. Recorded as sent on this link after S1 accepted it; a crash in between re-sends the
|
|
374
425
|
// same message id, which the member dedups.
|
|
375
426
|
try {
|
|
427
|
+
permit?.assertCurrent();
|
|
376
428
|
await transport.send(fleetId, frame);
|
|
377
429
|
}
|
|
378
430
|
catch {
|
|
@@ -435,8 +487,7 @@ export class HubRoomsService {
|
|
|
435
487
|
throw new HubProtocolError("conflict");
|
|
436
488
|
return { ...receiptOf(first), contentDigest: first.content_digest, stage: "answered", sequence: Math.max(1, first.member_sequence) };
|
|
437
489
|
}
|
|
438
|
-
|
|
439
|
-
throw new HubProtocolError("revoked");
|
|
490
|
+
const permit = await this.policy.operation(first, link);
|
|
440
491
|
if (!link.current())
|
|
441
492
|
throw new HubProtocolError("stale");
|
|
442
493
|
const now = this.core.now();
|
|
@@ -469,7 +520,7 @@ export class HubRoomsService {
|
|
|
469
520
|
}
|
|
470
521
|
const done = readMessage(db, a.messageId);
|
|
471
522
|
return { messageId: done.id, contentDigest: done.content_digest, stage: "answered", sequence: Math.max(1, done.member_sequence), at: done.stage_at };
|
|
472
|
-
});
|
|
523
|
+
}, permit);
|
|
473
524
|
this.buttons.arm();
|
|
474
525
|
return receipt;
|
|
475
526
|
}
|
|
@@ -484,8 +535,7 @@ export class HubRoomsService {
|
|
|
484
535
|
const ours = (row, msg) => !!row && row.direction === "question" && row.state === "bound" && !!msg && msg.fleet_id === link.fleetId;
|
|
485
536
|
if (!ours(located.row, located.msg))
|
|
486
537
|
throw new HubProtocolError("not-found");
|
|
487
|
-
|
|
488
|
-
throw new HubProtocolError("revoked");
|
|
538
|
+
const permit = await this.policy.operation(located.msg, link);
|
|
489
539
|
if (!link.current())
|
|
490
540
|
throw new HubProtocolError("stale");
|
|
491
541
|
const now = this.core.now();
|
|
@@ -504,7 +554,7 @@ export class HubRoomsService {
|
|
|
504
554
|
reasonCode: `question:${row.size}:${row.mime}:${row.sha256}`, messageId: msg.id, roomId: msg.room_id, fleetId: link.fleetId, exposureId: msg.exposure_id,
|
|
505
555
|
ownerAtEvent: personFromString(msg.owner), grantId: msg.grant_id, grantRevision: msg.grant_revision });
|
|
506
556
|
return { id: row.id, offset: input.offset, total: chunk.total, sha256: row.sha256, data: chunk.data.toString("base64") };
|
|
507
|
-
});
|
|
557
|
+
}, permit);
|
|
508
558
|
}
|
|
509
559
|
/** attachments-v1: one chunk of an answer's file from the member, before the answer that names it. */
|
|
510
560
|
attachmentPut(input, link) {
|