@cotal-ai/cli 0.133.12 → 0.135.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat/static-session.d.ts +1 -1
- package/dist/chat/static-session.d.ts.map +1 -1
- package/dist/chat/static-session.js +3 -2
- package/dist/chat/static-session.js.map +1 -1
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +2 -2
- package/dist/command.js.map +1 -1
- package/dist/commands/agents.d.ts +1 -117
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +13 -178
- package/dist/commands/agents.js.map +1 -1
- package/dist/commands/channel-members.d.ts.map +1 -1
- package/dist/commands/channel-members.js +15 -6
- package/dist/commands/channel-members.js.map +1 -1
- package/dist/commands/console.js +5 -4
- package/dist/commands/console.js.map +1 -1
- package/dist/commands/down-manifest.d.ts.map +1 -1
- package/dist/commands/down-manifest.js +2 -2
- package/dist/commands/down-manifest.js.map +1 -1
- package/dist/commands/down.d.ts.map +1 -1
- package/dist/commands/down.js +8 -7
- package/dist/commands/down.js.map +1 -1
- package/dist/commands/history-limit.d.ts +16 -0
- package/dist/commands/history-limit.d.ts.map +1 -0
- package/dist/commands/history-limit.js +152 -0
- package/dist/commands/history-limit.js.map +1 -0
- package/dist/commands/history.d.ts +28 -3
- package/dist/commands/history.d.ts.map +1 -1
- package/dist/commands/history.js +30 -8
- package/dist/commands/history.js.map +1 -1
- package/dist/commands/meshes.d.ts.map +1 -1
- package/dist/commands/meshes.js +29 -12
- package/dist/commands/meshes.js.map +1 -1
- package/dist/commands/models.d.ts.map +1 -1
- package/dist/commands/models.js +4 -3
- package/dist/commands/models.js.map +1 -1
- package/dist/commands/persona-remote.js +1 -2
- package/dist/commands/persona-remote.js.map +1 -1
- package/dist/commands/setup-start.d.ts.map +1 -1
- package/dist/commands/setup-start.js +7 -1
- package/dist/commands/setup-start.js.map +1 -1
- package/dist/commands/spawn.d.ts +1 -37
- package/dist/commands/spawn.d.ts.map +1 -1
- package/dist/commands/spawn.js +24 -43
- package/dist/commands/spawn.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +4 -3
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/team-agent-apply.d.ts.map +1 -1
- package/dist/commands/team-agent-apply.js +6 -5
- package/dist/commands/team-agent-apply.js.map +1 -1
- package/dist/commands/team-agent-remove.d.ts.map +1 -1
- package/dist/commands/team-agent-remove.js +6 -5
- package/dist/commands/team-agent-remove.js.map +1 -1
- package/dist/commands/team-deploy-apply.d.ts.map +1 -1
- package/dist/commands/team-deploy-apply.js +1 -2
- package/dist/commands/team-deploy-apply.js.map +1 -1
- package/dist/commands/team.d.ts.map +1 -1
- package/dist/commands/team.js +2 -2
- package/dist/commands/team.js.map +1 -1
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +20 -18
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +5 -4
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/watch.d.ts.map +1 -1
- package/dist/commands/watch.js +5 -17
- package/dist/commands/watch.js.map +1 -1
- package/dist/commands/who.d.ts.map +1 -1
- package/dist/commands/who.js +1 -1
- package/dist/commands/who.js.map +1 -1
- package/dist/console/app.d.ts +1 -1
- package/dist/console/app.d.ts.map +1 -1
- package/dist/console/app.js +6 -5
- package/dist/console/app.js.map +1 -1
- package/dist/console/commands.d.ts +2 -3
- package/dist/console/commands.d.ts.map +1 -1
- package/dist/console/commands.js.map +1 -1
- package/dist/console/launch.d.ts +1 -1
- package/dist/console/launch.d.ts.map +1 -1
- package/dist/console/mesh.d.ts +2 -2
- package/dist/console/mesh.d.ts.map +1 -1
- package/dist/console/mesh.js +2 -2
- package/dist/console/mesh.js.map +1 -1
- package/dist/console/root.d.ts +2 -16
- package/dist/console/root.d.ts.map +1 -1
- package/dist/console/root.js +6 -30
- package/dist/console/root.js.map +1 -1
- package/dist/console/ui/CommandPalette.d.ts +2 -2
- package/dist/console/ui/CommandPalette.d.ts.map +1 -1
- package/dist/console/ui/CommandPalette.js.map +1 -1
- package/dist/console/ui/Dm.d.ts +1 -1
- package/dist/console/ui/Dm.d.ts.map +1 -1
- package/dist/console/ui/Tiles.d.ts +1 -1
- package/dist/console/ui/Tiles.d.ts.map +1 -1
- package/dist/console/ui/topo/Topo.d.ts +1 -0
- package/dist/console/ui/topo/Topo.d.ts.map +1 -1
- package/dist/console/ui/topo/Topo.js +2 -1
- package/dist/console/ui/topo/Topo.js.map +1 -1
- package/dist/console/ui/topo/model.d.ts +3 -0
- package/dist/console/ui/topo/model.d.ts.map +1 -1
- package/dist/console/ui/topo/model.js +12 -4
- package/dist/console/ui/topo/model.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/lib/control.d.ts +5 -280
- package/dist/lib/control.d.ts.map +1 -1
- package/dist/lib/control.js +24 -782
- package/dist/lib/control.js.map +1 -1
- package/dist/lib/controller-preserve.d.ts.map +1 -1
- package/dist/lib/controller-preserve.js +5 -4
- package/dist/lib/controller-preserve.js.map +1 -1
- package/dist/lib/endpoint-errors.d.ts +1 -3
- package/dist/lib/endpoint-errors.d.ts.map +1 -1
- package/dist/lib/endpoint-errors.js +1 -6
- package/dist/lib/endpoint-errors.js.map +1 -1
- package/dist/lib/endpoint-scatter.d.ts.map +1 -1
- package/dist/lib/endpoint-scatter.js +1 -2
- package/dist/lib/endpoint-scatter.js.map +1 -1
- package/dist/lib/manager-choice.d.ts +2 -31
- package/dist/lib/manager-choice.d.ts.map +1 -1
- package/dist/lib/manager-choice.js +10 -61
- package/dist/lib/manager-choice.js.map +1 -1
- package/dist/lib/manifest/live.js +1 -1
- package/dist/lib/manifest/live.js.map +1 -1
- package/dist/lib/manifest/spawn-plan.d.ts.map +1 -1
- package/dist/lib/manifest/spawn-plan.js +2 -2
- package/dist/lib/manifest/spawn-plan.js.map +1 -1
- package/dist/lib/restore.d.ts.map +1 -1
- package/dist/lib/restore.js +34 -5
- package/dist/lib/restore.js.map +1 -1
- package/dist/lib/service-census.d.ts +10 -10
- package/dist/lib/service-install-intent.d.ts +2 -2
- package/dist/lib/service-instances.d.ts +1 -1
- package/dist/lib/service-supervision.d.ts +1 -1
- package/dist/lib/service-systemd-attempt-read.d.ts +3 -3
- package/dist/lib/service-uninstall-intent.d.ts +3 -3
- package/dist/lib/space-schema-report.d.ts +5 -5
- package/dist/lib/space-schema-report.d.ts.map +1 -1
- package/dist/lib/space-schema-report.js +1 -0
- package/dist/lib/space-schema-report.js.map +1 -1
- package/dist/lib/stack-runs.d.ts.map +1 -1
- package/dist/lib/stack-runs.js +4 -3
- package/dist/lib/stack-runs.js.map +1 -1
- package/dist/lib/team-channel-removal.js +2 -2
- package/dist/lib/team-channel-removal.js.map +1 -1
- package/dist/lib/team-retained.d.ts.map +1 -1
- package/dist/lib/team-retained.js +4 -3
- package/dist/lib/team-retained.js.map +1 -1
- package/dist/lib/teardown-spare.d.ts.map +1 -1
- package/dist/lib/teardown-spare.js +4 -3
- package/dist/lib/teardown-spare.js.map +1 -1
- package/dist/lib/transient.js +1 -1
- package/dist/lib/transient.js.map +1 -1
- package/dist/render.js +1 -1
- package/dist/render.js.map +1 -1
- package/dist/ui.d.ts +0 -7
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +1 -24
- package/dist/ui.js.map +1 -1
- package/dist/watch-data.d.ts +1 -1
- package/dist/watch-data.d.ts.map +1 -1
- package/dist/watch-json.js +1 -1
- package/dist/watch-json.js.map +1 -1
- package/dist/watch-view.d.ts +1 -1
- package/dist/watch-view.d.ts.map +1 -1
- package/dist/watch-view.js +1 -1
- package/dist/watch-view.js.map +1 -1
- package/package.json +5 -6
- package/dist/console/control.d.ts +0 -141
- package/dist/console/control.d.ts.map +0 -1
- package/dist/console/control.js +0 -191
- package/dist/console/control.js.map +0 -1
- package/dist/lib/dial-retry.d.ts +0 -33
- package/dist/lib/dial-retry.d.ts.map +0 -1
- package/dist/lib/dial-retry.js +0 -70
- package/dist/lib/dial-retry.js.map +0 -1
- package/dist/view/mesh-view.d.ts +0 -213
- package/dist/view/mesh-view.d.ts.map +0 -1
- package/dist/view/mesh-view.js +0 -527
- package/dist/view/mesh-view.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dial-retry.d.ts","sourceRoot":"","sources":["../../src/lib/dial-retry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD;wEACwE;AACxE,eAAO,MAAM,aAAa,IAAI,CAAC;AAC/B,8DAA8D;AAC9D,eAAO,MAAM,kBAAkB,OAAQ,CAAC;AACxC;;8BAE8B;AAC9B,eAAO,MAAM,eAAe,OAAQ,CAAC;AAErC;wBACwB;AACxB,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;AAE9C,qGAAqG;AACrG,wBAAgB,SAAS,CAAC,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAI3D;AAED,iGAAiG;AACjG,qBAAa,eAAgB,SAAQ,KAAK;IAC5B,QAAQ,CAAC,KAAK,EAAE,SAAS;IAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO;gBAAnE,KAAK,EAAE,SAAS,EAAW,QAAQ,EAAE,MAAM,EAAW,IAAI,EAAE,OAAO;CAIzF;AAED;;4EAE4E;AAC5E,wBAAsB,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAWzE;AAED;;;;yEAIyE;AACzE,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,eAAe,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,EAAE,OAAO,GAAG,cAAc,CAWrJ"}
|
package/dist/lib/dial-retry.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { setTimeout as delay } from "node:timers/promises";
|
|
2
|
-
import { TimeoutError } from "@nats-io/transport-node";
|
|
3
|
-
import { isAuthRejection } from "@cotal-ai/core";
|
|
4
|
-
import { ConnectRefusal } from "@cotal-ai/workspace";
|
|
5
|
-
/** Attempts a refused or timed-out connect gets, the first included. Nothing is published on a
|
|
6
|
-
* connection that never opened, so trying it again repeats nothing. */
|
|
7
|
-
export const DIAL_ATTEMPTS = 4;
|
|
8
|
-
/** The fixed wait between those attempts, in milliseconds. */
|
|
9
|
-
export const DIAL_RETRY_WAIT_MS = 1_000;
|
|
10
|
-
/** How long one connect may take, in milliseconds. A connect that is admitted finishes well inside
|
|
11
|
-
* it; a broker waiting on an auth service that does not answer would otherwise hold it for the
|
|
12
|
-
* transport's 20 seconds. */
|
|
13
|
-
export const DIAL_TIMEOUT_MS = 5_000;
|
|
14
|
-
/** The stage a failed connect ended at, or undefined for any other failure, which is not retried. */
|
|
15
|
-
export function dialStage(e) {
|
|
16
|
-
if (isAuthRejection(e))
|
|
17
|
-
return "refused";
|
|
18
|
-
if (e instanceof TimeoutError)
|
|
19
|
-
return "timeout";
|
|
20
|
-
return undefined;
|
|
21
|
-
}
|
|
22
|
-
/** Every attempt at a connect ended at the same boundary, so nothing was sent on any of them. */
|
|
23
|
-
export class DialNotAdmitted extends Error {
|
|
24
|
-
stage;
|
|
25
|
-
attempts;
|
|
26
|
-
last;
|
|
27
|
-
constructor(stage, attempts, last) {
|
|
28
|
-
super(last instanceof Error ? last.message : String(last), { cause: last });
|
|
29
|
-
this.stage = stage;
|
|
30
|
-
this.attempts = attempts;
|
|
31
|
-
this.last = last;
|
|
32
|
-
this.name = "DialNotAdmitted";
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
/** Run `dial` until it opens, trying again after a refused or timed-out attempt, up to
|
|
36
|
-
* {@link DIAL_ATTEMPTS}. Throws {@link DialNotAdmitted} when every attempt ended that way, and any
|
|
37
|
-
* other failure at once. `dial` builds its connection afresh each time. */
|
|
38
|
-
export async function dialWithRetry(dial) {
|
|
39
|
-
for (let attempt = 1;; attempt++) {
|
|
40
|
-
try {
|
|
41
|
-
return await dial();
|
|
42
|
-
}
|
|
43
|
-
catch (e) {
|
|
44
|
-
const stage = dialStage(e);
|
|
45
|
-
if (!stage)
|
|
46
|
-
throw e;
|
|
47
|
-
if (attempt >= DIAL_ATTEMPTS)
|
|
48
|
-
throw new DialNotAdmitted(stage, attempt, e);
|
|
49
|
-
await delay(DIAL_RETRY_WAIT_MS);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
/** A connection the broker did not admit on any attempt, as a refusal at the connect stage: `to` is
|
|
54
|
-
* what the command connects to and `unsent` what it therefore did not send. It says how the
|
|
55
|
-
* attempts ended in plain words; the broker's own words stay in the native detail. On a user-auth
|
|
56
|
-
* mesh the auth service decides admission at connect, as the view exchange decides it before; a
|
|
57
|
-
* refused view is transient there, so this refusal is transient too. */
|
|
58
|
-
export function notAdmittedRefusal(e, to, unsent, target, userAuth) {
|
|
59
|
-
const how = e.stage === "refused" ? `the broker refused all ${e.attempts} attempts` : `none of ${e.attempts} attempts opened within ${DIAL_TIMEOUT_MS / 1000} seconds`;
|
|
60
|
-
const message = `could not connect to ${to}: ${how}, so ${unsent}`;
|
|
61
|
-
const remedy = e.stage === "refused"
|
|
62
|
-
? userAuth ? "the space's auth service logs why it refused this connection" : undefined
|
|
63
|
-
: "nothing was sent, so the command can be run again once the broker admits connections";
|
|
64
|
-
return new ConnectRefusal(remedy ? `✗ ${message} - ${remedy}` : `✗ ${message}`, undefined, {
|
|
65
|
-
cause: e, kind: "transient", code: e.stage === "refused" ? "PERMISSION_DENIED" : "TARGET_UNAVAILABLE",
|
|
66
|
-
...(remedy ? { parts: { message, remedy } } : {}), target,
|
|
67
|
-
native: { code: `connect-${e.stage}`, detail: { stage: "connect", attempts: e.attempts, reason: e.message } },
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
//# sourceMappingURL=dial-retry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dial-retry.js","sourceRoot":"","sources":["../../src/lib/dial-retry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD;wEACwE;AACxE,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC;AAC/B,8DAA8D;AAC9D,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC;AACxC;;8BAE8B;AAC9B,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC;AAMrC,qGAAqG;AACrG,MAAM,UAAU,SAAS,CAAC,CAAU;IAClC,IAAI,eAAe,CAAC,CAAC,CAAC;QAAE,OAAO,SAAS,CAAC;IACzC,IAAI,CAAC,YAAY,YAAY;QAAE,OAAO,SAAS,CAAC;IAChD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,iGAAiG;AACjG,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACnB;IAA2B;IAA2B;IAA3E,YAAqB,KAAgB,EAAW,QAAgB,EAAW,IAAa;QACtF,KAAK,CAAC,IAAI,YAAY,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QADzD,UAAK,GAAL,KAAK,CAAW;QAAW,aAAQ,GAAR,QAAQ,CAAQ;QAAW,SAAI,GAAJ,IAAI,CAAS;QAEtF,IAAI,CA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;QACzF,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,oBAAoB;QACrG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM;QACzD,MAAM,EAAE,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE;KAC9G,CAAC,CAAC;AACL,CAAC"}
|
package/dist/view/mesh-view.d.ts
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from "node:events";
|
|
2
|
-
import type { CotalEndpoint, EndpointRef, MembershipSnapshot, Presence, PresenceStatus } from "@cotal-ai/core";
|
|
3
|
-
export type FeedDelivery = "multicast" | "unicast" | "anycast";
|
|
4
|
-
/** One feed row. A same-sender/same-text unicast burst coalesces into a single entry with a
|
|
5
|
-
* deterministic id (the first message's) and ts (the earliest), so a history prefill and the
|
|
6
|
-
* live tap dedupe-by-id and order correctly. `text` is plain — the surface colors it. */
|
|
7
|
-
export interface FeedEntry {
|
|
8
|
-
id: string;
|
|
9
|
-
ts: number;
|
|
10
|
-
from: EndpointRef;
|
|
11
|
-
delivery: FeedDelivery;
|
|
12
|
-
channel?: string;
|
|
13
|
-
toService?: string;
|
|
14
|
-
toIds?: string[];
|
|
15
|
-
toNames?: string[];
|
|
16
|
-
count?: number;
|
|
17
|
-
/** This row arrived on an agent's structured-event channel rather than a chat channel.
|
|
18
|
-
*
|
|
19
|
-
* DERIVED ONCE, HERE, because the header's rule is that a surface lays this model out and never
|
|
20
|
-
* re-derives it. Every surface that wanted to tell event traffic from chat would otherwise
|
|
21
|
-
* re-spell the convention locally, and three copies of a classifier is three chances to disagree
|
|
22
|
-
* about one channel. Absent on unicast and anycast rows, which carry no channel at all. */
|
|
23
|
-
events?: boolean;
|
|
24
|
-
text: string;
|
|
25
|
-
}
|
|
26
|
-
export interface StatusCounts {
|
|
27
|
-
working: number;
|
|
28
|
-
waiting: number;
|
|
29
|
-
idle: number;
|
|
30
|
-
offline: number;
|
|
31
|
-
}
|
|
32
|
-
/** One message inside a DM thread (un-coalesced). */
|
|
33
|
-
export interface DmMessage {
|
|
34
|
-
ts: number;
|
|
35
|
-
from: string;
|
|
36
|
-
to: string;
|
|
37
|
-
text: string;
|
|
38
|
-
}
|
|
39
|
-
/** A conversation between a peer and one counterparty. */
|
|
40
|
-
export interface DmThread {
|
|
41
|
-
with: string;
|
|
42
|
-
role?: string;
|
|
43
|
-
status: PresenceStatus;
|
|
44
|
-
lastTs: number;
|
|
45
|
-
messages: DmMessage[];
|
|
46
|
-
}
|
|
47
|
-
/** A peer's whole DM footprint — every counterparty it has talked to. */
|
|
48
|
-
export interface DmPeer {
|
|
49
|
-
name: string;
|
|
50
|
-
role?: string;
|
|
51
|
-
status: PresenceStatus;
|
|
52
|
-
lastTs: number;
|
|
53
|
-
conversations: DmThread[];
|
|
54
|
-
}
|
|
55
|
-
/** Derived operator signals — golden-signal counts, who needs attention, the DM roll-up. */
|
|
56
|
-
export interface MeshSignals {
|
|
57
|
-
counts: StatusCounts;
|
|
58
|
-
/** Agents blocked / needing input, name-ordered. NOT age-ordered: presence carries no
|
|
59
|
-
* status-transition time, so how long a peer has been blocked is not knowable from the wire. */
|
|
60
|
-
waiting: Presence[];
|
|
61
|
-
/** Oldest heartbeat among LIVE agents — a liveness signal ("is anyone going quiet?"), NOT a
|
|
62
|
-
* blocked-duration. {@link Presence.ts} is republished every heartbeat, so it can never say how
|
|
63
|
-
* long an agent has been waiting. Undefined when no agent is live. */
|
|
64
|
-
stalestLiveTs?: number;
|
|
65
|
-
dms: DmPeer[];
|
|
66
|
-
}
|
|
67
|
-
/** The broker-authoritative membership feed as THIS viewer last saw it. Two facts, kept apart so a
|
|
68
|
-
* failed read can never be mistaken for an empty feed: `snapshot` is the last successful read;
|
|
69
|
-
* `unreadable` is the reason the most recent read or watch attempt failed (a fact about the
|
|
70
|
-
* viewer, cleared by the next successful read). A feed that does not exist (no delivery daemon:
|
|
71
|
-
* the bucket is absent, or it was never written) is a snapshot with no `asOf` and no members, which
|
|
72
|
-
* renders as traffic-only: a fact about the mesh, and a different one. */
|
|
73
|
-
export interface MembershipView {
|
|
74
|
-
snapshot?: MembershipSnapshot;
|
|
75
|
-
unreadable?: string;
|
|
76
|
-
}
|
|
77
|
-
export interface MeshSnapshot {
|
|
78
|
-
agents: Presence[];
|
|
79
|
-
endpoints: Presence[];
|
|
80
|
-
/** `messages`: the broker's retained count (capped per sender, so it can stop climbing under
|
|
81
|
-
* live traffic). `arrivals`: messages this viewer saw ARRIVE on the live tap since it started,
|
|
82
|
-
* monotonic, dropped with the channel: the honest base for an unread badge. */
|
|
83
|
-
channels: {
|
|
84
|
-
channel: string;
|
|
85
|
-
messages: number;
|
|
86
|
-
arrivals: number;
|
|
87
|
-
}[];
|
|
88
|
-
feed: FeedEntry[];
|
|
89
|
-
/** Broker-authoritative channel membership (the delivery daemon's CONNZ view plus the durable
|
|
90
|
-
* registry), as last read; the topology lens overlays it to show silent subscribers. */
|
|
91
|
-
membership: MembershipView;
|
|
92
|
-
/** `msgsPerSec`: the rolling 1 s rate. `activity`: a fixed 15-bucket message-volume series over
|
|
93
|
-
* the last 60 s (one ~4 s bucket each), oldest→newest, raw counts: the status bar's sparkline. */
|
|
94
|
-
rates: {
|
|
95
|
-
msgsPerSec: number;
|
|
96
|
-
activity: number[];
|
|
97
|
-
};
|
|
98
|
-
status: {
|
|
99
|
-
connected: boolean;
|
|
100
|
-
space: string;
|
|
101
|
-
dmVisible: boolean;
|
|
102
|
-
error?: string;
|
|
103
|
-
warning?: string;
|
|
104
|
-
};
|
|
105
|
-
signals: MeshSignals;
|
|
106
|
-
nameOf: (id: string) => string;
|
|
107
|
-
}
|
|
108
|
-
export interface MeshViewOptions {
|
|
109
|
-
/** Feed cap, in entries. Default 300. */
|
|
110
|
-
window?: number;
|
|
111
|
-
/** The read-only tap subject. `chatWildcard(space)` narrows to multicast (auth — DMs/anycast
|
|
112
|
-
* stay confidential); `spaceWildcard(space)` or undefined taps the whole space (god-view). */
|
|
113
|
-
tapSubject?: string;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Events:
|
|
117
|
-
* - `"entry"` `(e: FeedEntry)` — one live feed row, as it lands (for the stream renderer).
|
|
118
|
-
* - `"presence"` `(ev: PresenceEvent)` — forwarded presence change (join/update/offline).
|
|
119
|
-
* - `"warning"` `(e: Error)` — a recoverable endpoint notice for the stream renderer.
|
|
120
|
-
* - `"change"` `(s: MeshSnapshot)` — a batched snapshot every ~75ms (for dashboards).
|
|
121
|
-
*/
|
|
122
|
-
export declare class MeshView extends EventEmitter {
|
|
123
|
-
private readonly ep;
|
|
124
|
-
private roster;
|
|
125
|
-
private byId;
|
|
126
|
-
private channelCounts;
|
|
127
|
-
private arrivals;
|
|
128
|
-
private feed;
|
|
129
|
-
private seen;
|
|
130
|
-
private pending;
|
|
131
|
-
private dmLog;
|
|
132
|
-
private recentTs;
|
|
133
|
-
private msgsPerSec;
|
|
134
|
-
private bucketCounts;
|
|
135
|
-
private bucketEpoch;
|
|
136
|
-
private connected;
|
|
137
|
-
private error?;
|
|
138
|
-
private presenceCurrent;
|
|
139
|
-
private errorWhilePresenceStale;
|
|
140
|
-
private warning?;
|
|
141
|
-
private dirty;
|
|
142
|
-
private membership;
|
|
143
|
-
private membershipWatch?;
|
|
144
|
-
private membershipTimer?;
|
|
145
|
-
private readonly window;
|
|
146
|
-
private readonly tapSubject?;
|
|
147
|
-
private readonly chatOnly;
|
|
148
|
-
private timers;
|
|
149
|
-
private readonly onRoster;
|
|
150
|
-
private readonly onPresence;
|
|
151
|
-
private readonly onError;
|
|
152
|
-
/** A broker restart reconnects the transport without a new `connection`, and its errors (the
|
|
153
|
-
* presence stream missing until the space is provisioned again) arrive while the presence view
|
|
154
|
-
* is stale. When that view is current again the outage is over, so its error clears with it
|
|
155
|
-
* (AGENT-2889). An error raised while the view was current stays until the next connection. */
|
|
156
|
-
private readonly onPresenceView;
|
|
157
|
-
/** A rebuilt connection clears the fault that dropped the old one, so the view reports itself
|
|
158
|
-
* connected again instead of keeping that error for good. */
|
|
159
|
-
private readonly onConnection;
|
|
160
|
-
private readonly onWarning;
|
|
161
|
-
constructor(ep: CotalEndpoint, opts?: MeshViewOptions);
|
|
162
|
-
start(): Promise<void>;
|
|
163
|
-
stop(): Promise<void>;
|
|
164
|
-
/** Read the broker-authoritative membership feed and follow it. A membership fault is never
|
|
165
|
-
* a connection fault: it lands on `membership.unreadable` (with its reason), not on
|
|
166
|
-
* `status.error`, because the mesh is fine and only this viewer's read of one feed is not. */
|
|
167
|
-
private startMembership;
|
|
168
|
-
/** A heartbeat moves only `asOf`, so it is copied into the last snapshot instead of costing a
|
|
169
|
-
* bucket re-read (#4904); a member change is read back in full, and a heartbeat that arrives
|
|
170
|
-
* while the last read failed is the retry. */
|
|
171
|
-
private onMembershipChange;
|
|
172
|
-
private scheduleMembership;
|
|
173
|
-
/** One read of the feed. Three outcomes, kept distinct: a snapshot (readable, whatever it holds),
|
|
174
|
-
* an absent feed (readable in the sense that the mesh has no daemon writing one: an empty
|
|
175
|
-
* snapshot, traffic-only), and a failed read (`unreadable`, reason kept, last snapshot kept so
|
|
176
|
-
* the reason is shown against what was last known rather than against nothing). */
|
|
177
|
-
private loadMembership;
|
|
178
|
-
snapshot(): MeshSnapshot;
|
|
179
|
-
nameOf: (id: string) => string;
|
|
180
|
-
private setRoster;
|
|
181
|
-
/** Live read-only tap. Drops control/presence/trace frames (deliveryOf → null). A payload
|
|
182
|
-
* from.name is sender-chosen display text, not identity (#1399): the roster is the only writer
|
|
183
|
-
* of id→name, so a spoofed name can never re-key a thread or a label. */
|
|
184
|
-
private ingest;
|
|
185
|
-
/** Group a same-sender/same-text unicast burst into one feed entry over BURST_MS, and retain
|
|
186
|
-
* each raw message for the DM roll-up. */
|
|
187
|
-
private coalesce;
|
|
188
|
-
private flushBurst;
|
|
189
|
-
/** Append to the feed, dedupe by id, keep it windowed, and notify stream consumers. */
|
|
190
|
-
private push;
|
|
191
|
-
private trim;
|
|
192
|
-
private recordDm;
|
|
193
|
-
/** One-shot backlog: prefill each channel's history (multicast), plus the DM backlog when DMs
|
|
194
|
-
* are visible (god-view — `dmHistory` needs an admin cred), deduped by id, oldest-first. */
|
|
195
|
-
private prefill;
|
|
196
|
-
/** Best-effort DM backlog for the roll-up — only meaningful for a god-view cred; a non-admin
|
|
197
|
-
* observer's `dmHistory` throws (ACL), which just leaves the DM lens live-only. A history
|
|
198
|
-
* row's from.name is payload text, never an id→name source (#1399). */
|
|
199
|
-
private prefillDms;
|
|
200
|
-
private refreshChannels;
|
|
201
|
-
private signals;
|
|
202
|
-
/** Group raw DMs into per-peer rows; each peer lists its counterparties (conversations).
|
|
203
|
-
* Only pairs that actually talked — never the n² cross-product. Conversations key on the two
|
|
204
|
-
* AUTHENTICATED ids; display names, roles and statuses resolve through the roster by id, so a
|
|
205
|
-
* payload `from.name` cannot move a line into another peer's thread (#1399). */
|
|
206
|
-
private rollupDms;
|
|
207
|
-
/** Advance the activity ring to `now`: shift past buckets out the left, fill the gap with zeros,
|
|
208
|
-
* so idle time decays the series. The newest (last) bucket is always the current ~4s window. */
|
|
209
|
-
private roll;
|
|
210
|
-
/** The single batch point: recompute the rolling rate, then emit one snapshot if dirty. */
|
|
211
|
-
private flush;
|
|
212
|
-
}
|
|
213
|
-
//# sourceMappingURL=mesh-view.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mesh-view.d.ts","sourceRoot":"","sources":["../../src/view/mesh-view.ts"],"names":[],"mappings":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