@pinet/slack-bridge 0.1.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/LICENSE +21 -0
- package/README.md +570 -0
- package/dist/activity-log.d.ts +62 -0
- package/dist/activity-log.js +293 -0
- package/dist/agent-completion-runtime.d.ts +17 -0
- package/dist/agent-completion-runtime.js +26 -0
- package/dist/agent-event-runtime.d.ts +13 -0
- package/dist/agent-event-runtime.js +27 -0
- package/dist/agent-prompt-guidance.d.ts +22 -0
- package/dist/agent-prompt-guidance.js +46 -0
- package/dist/broker/adapters/slack.d.ts +74 -0
- package/dist/broker/adapters/slack.js +563 -0
- package/dist/broker/adapters/types.d.ts +1 -0
- package/dist/broker/adapters/types.js +1 -0
- package/dist/broker/agent-messaging.d.ts +1 -0
- package/dist/broker/agent-messaging.js +1 -0
- package/dist/broker/auth.d.ts +1 -0
- package/dist/broker/auth.js +1 -0
- package/dist/broker/client.d.ts +167 -0
- package/dist/broker/client.js +624 -0
- package/dist/broker/control-plane-dashboard.d.ts +98 -0
- package/dist/broker/control-plane-dashboard.js +213 -0
- package/dist/broker/ghost-reaper.d.ts +49 -0
- package/dist/broker/ghost-reaper.js +209 -0
- package/dist/broker/index.d.ts +36 -0
- package/dist/broker/index.js +90 -0
- package/dist/broker/leader.d.ts +1 -0
- package/dist/broker/leader.js +1 -0
- package/dist/broker/maintenance.d.ts +1 -0
- package/dist/broker/maintenance.js +1 -0
- package/dist/broker/message-send.d.ts +1 -0
- package/dist/broker/message-send.js +1 -0
- package/dist/broker/paths.d.ts +1 -0
- package/dist/broker/paths.js +1 -0
- package/dist/broker/raw-tcp-loopback.d.ts +1 -0
- package/dist/broker/raw-tcp-loopback.js +1 -0
- package/dist/broker/router.d.ts +1 -0
- package/dist/broker/router.js +1 -0
- package/dist/broker/schema.d.ts +9 -0
- package/dist/broker/schema.js +63 -0
- package/dist/broker/socket-server.d.ts +120 -0
- package/dist/broker/socket-server.js +1087 -0
- package/dist/broker/types.d.ts +1 -0
- package/dist/broker/types.js +1 -0
- package/dist/broker-delivery.d.ts +10 -0
- package/dist/broker-delivery.js +26 -0
- package/dist/broker-inbound-persistence.d.ts +11 -0
- package/dist/broker-inbound-persistence.js +22 -0
- package/dist/broker-prompt-loader.d.ts +34 -0
- package/dist/broker-prompt-loader.js +185 -0
- package/dist/broker-runtime-access.d.ts +14 -0
- package/dist/broker-runtime-access.js +20 -0
- package/dist/broker-runtime.d.ts +100 -0
- package/dist/broker-runtime.js +533 -0
- package/dist/broker-thread-owner-hints.d.ts +10 -0
- package/dist/broker-thread-owner-hints.js +14 -0
- package/dist/canvases.d.ts +80 -0
- package/dist/canvases.js +221 -0
- package/dist/command-registration-runtime.d.ts +9 -0
- package/dist/command-registration-runtime.js +9 -0
- package/dist/core-tool-guardrails.d.ts +24 -0
- package/dist/core-tool-guardrails.js +66 -0
- package/dist/deploy-manifest.d.ts +27 -0
- package/dist/deploy-manifest.js +197 -0
- package/dist/follower-delivery.d.ts +16 -0
- package/dist/follower-delivery.js +70 -0
- package/dist/follower-runtime.d.ts +61 -0
- package/dist/follower-runtime.js +350 -0
- package/dist/git-metadata.d.ts +35 -0
- package/dist/git-metadata.js +88 -0
- package/dist/guardrails.d.ts +69 -0
- package/dist/guardrails.js +283 -0
- package/dist/helpers.d.ts +550 -0
- package/dist/helpers.js +2711 -0
- package/dist/home-tab.d.ts +27 -0
- package/dist/home-tab.js +242 -0
- package/dist/imessage-tools.d.ts +33 -0
- package/dist/imessage-tools.js +96 -0
- package/dist/inbox-drain-runtime.d.ts +30 -0
- package/dist/inbox-drain-runtime.js +71 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1330 -0
- package/dist/persisted-runtime-state.d.ts +52 -0
- package/dist/persisted-runtime-state.js +98 -0
- package/dist/pinet-activity-formatting.d.ts +20 -0
- package/dist/pinet-activity-formatting.js +43 -0
- package/dist/pinet-agent-status.d.ts +36 -0
- package/dist/pinet-agent-status.js +48 -0
- package/dist/pinet-commands.d.ts +70 -0
- package/dist/pinet-commands.js +402 -0
- package/dist/pinet-confirmation-replies.d.ts +7 -0
- package/dist/pinet-confirmation-replies.js +30 -0
- package/dist/pinet-control-plane-dashboard.d.ts +34 -0
- package/dist/pinet-control-plane-dashboard.js +86 -0
- package/dist/pinet-home-tabs.d.ts +36 -0
- package/dist/pinet-home-tabs.js +101 -0
- package/dist/pinet-maintenance-delivery.d.ts +22 -0
- package/dist/pinet-maintenance-delivery.js +45 -0
- package/dist/pinet-mesh-ops.d.ts +97 -0
- package/dist/pinet-mesh-ops.js +266 -0
- package/dist/pinet-registration-gate.d.ts +14 -0
- package/dist/pinet-registration-gate.js +42 -0
- package/dist/pinet-remote-control-acks.d.ts +16 -0
- package/dist/pinet-remote-control-acks.js +46 -0
- package/dist/pinet-remote-control.d.ts +17 -0
- package/dist/pinet-remote-control.js +74 -0
- package/dist/pinet-runtime-composition.d.ts +27 -0
- package/dist/pinet-runtime-composition.js +20 -0
- package/dist/pinet-tools.d.ts +67 -0
- package/dist/pinet-tools.js +1211 -0
- package/dist/prompts/broker/default.md +41 -0
- package/dist/prompts/broker/tmux.md +49 -0
- package/dist/ralph-loop.d.ts +76 -0
- package/dist/ralph-loop.js +524 -0
- package/dist/reaction-triggers.d.ts +25 -0
- package/dist/reaction-triggers.js +171 -0
- package/dist/repo-tool-guardrails.d.ts +20 -0
- package/dist/repo-tool-guardrails.js +81 -0
- package/dist/runtime-agent-context.d.ts +93 -0
- package/dist/runtime-agent-context.js +302 -0
- package/dist/runtime-mode.d.ts +10 -0
- package/dist/runtime-mode.js +39 -0
- package/dist/scheduled-wakeups.d.ts +1 -0
- package/dist/scheduled-wakeups.js +1 -0
- package/dist/session-ui-runtime.d.ts +20 -0
- package/dist/session-ui-runtime.js +163 -0
- package/dist/single-player-runtime.d.ts +71 -0
- package/dist/single-player-runtime.js +436 -0
- package/dist/skins/cosmere.json +1571 -0
- package/dist/skins/foundation.json +1304 -0
- package/dist/slack-access.d.ts +186 -0
- package/dist/slack-access.js +462 -0
- package/dist/slack-api.d.ts +2 -0
- package/dist/slack-api.js +1 -0
- package/dist/slack-block-kit.d.ts +36 -0
- package/dist/slack-block-kit.js +242 -0
- package/dist/slack-export.d.ts +31 -0
- package/dist/slack-export.js +206 -0
- package/dist/slack-message-context.d.ts +15 -0
- package/dist/slack-message-context.js +207 -0
- package/dist/slack-modals.d.ts +13 -0
- package/dist/slack-modals.js +79 -0
- package/dist/slack-pinet-runtime-adapter.d.ts +16 -0
- package/dist/slack-pinet-runtime-adapter.js +72 -0
- package/dist/slack-presence.d.ts +36 -0
- package/dist/slack-presence.js +89 -0
- package/dist/slack-request-runtime.d.ts +8 -0
- package/dist/slack-request-runtime.js +19 -0
- package/dist/slack-runtime-access.d.ts +28 -0
- package/dist/slack-runtime-access.js +107 -0
- package/dist/slack-scope-diagnostics.d.ts +31 -0
- package/dist/slack-scope-diagnostics.js +235 -0
- package/dist/slack-socket-dedup.d.ts +7 -0
- package/dist/slack-socket-dedup.js +135 -0
- package/dist/slack-thread-status.d.ts +41 -0
- package/dist/slack-thread-status.js +156 -0
- package/dist/slack-tool-policy-runtime.d.ts +36 -0
- package/dist/slack-tool-policy-runtime.js +96 -0
- package/dist/slack-tools.d.ts +52 -0
- package/dist/slack-tools.js +2688 -0
- package/dist/slack-turn-guardrails.d.ts +19 -0
- package/dist/slack-turn-guardrails.js +36 -0
- package/dist/slack-upload.d.ts +49 -0
- package/dist/slack-upload.js +224 -0
- package/dist/task-assignments.d.ts +45 -0
- package/dist/task-assignments.js +527 -0
- package/dist/thread-confirmations.d.ts +22 -0
- package/dist/thread-confirmations.js +139 -0
- package/dist/tool-registration-runtime.d.ts +13 -0
- package/dist/tool-registration-runtime.js +13 -0
- package/dist/ttl-cache.d.ts +47 -0
- package/dist/ttl-cache.js +105 -0
- package/manifest.yaml +57 -0
- package/package.json +60 -0
- package/skills/pinet-skin-creator/SKILL.md +109 -0
- package/skills/pinet-skin-creator/references/descriptor-format.md +99 -0
- package/skills/pinet-skin-creator/references/safety-checklist.md +56 -0
- package/skills/pinet-skin-creator/templates/pinet-skin-descriptor.json +77 -0
- package/skills/slack-bridge/SKILL.md +360 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import { BrokerDB } from "./schema.js";
|
|
3
|
+
import { loadOrCreateMeshSecret } from "./auth.js";
|
|
4
|
+
import { BrokerSocketServer } from "./socket-server.js";
|
|
5
|
+
import { assertLoopbackTcpHost } from "./raw-tcp-loopback.js";
|
|
6
|
+
import { LeaderLock } from "./leader.js";
|
|
7
|
+
import { getDefaultSocketPath } from "./paths.js";
|
|
8
|
+
export { BrokerDB } from "./schema.js";
|
|
9
|
+
export { BrokerSocketServer } from "./socket-server.js";
|
|
10
|
+
export { LeaderLock } from "./leader.js";
|
|
11
|
+
/**
|
|
12
|
+
* Start the broker: acquire leader lock, initialize SQLite, start the Unix socket server.
|
|
13
|
+
* Only one broker may run at a time — enforced by a PID lock file.
|
|
14
|
+
*
|
|
15
|
+
* Throws if another broker process already holds the lock.
|
|
16
|
+
*/
|
|
17
|
+
export async function startBroker(options = {}) {
|
|
18
|
+
// Resolve listen target: explicit target > socketPath > default
|
|
19
|
+
const target = options.listenTarget ?? {
|
|
20
|
+
type: "unix",
|
|
21
|
+
path: options.socketPath ?? getDefaultSocketPath(),
|
|
22
|
+
};
|
|
23
|
+
if (target.type === "tcp") {
|
|
24
|
+
assertLoopbackTcpHost(target.host, "broker listen target");
|
|
25
|
+
}
|
|
26
|
+
// ── Leader lock: prevent split-brain (issue #119) ────
|
|
27
|
+
const lock = new LeaderLock(options.lockPath);
|
|
28
|
+
if (!lock.tryAcquire()) {
|
|
29
|
+
throw new Error("Another pinet broker is already running. Only one broker may be active at a time.");
|
|
30
|
+
}
|
|
31
|
+
const db = new BrokerDB(options.dbPath);
|
|
32
|
+
try {
|
|
33
|
+
db.initialize();
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
lock.release();
|
|
37
|
+
throw err;
|
|
38
|
+
}
|
|
39
|
+
// Clean up stale socket file (Unix only)
|
|
40
|
+
if (target.type === "unix") {
|
|
41
|
+
try {
|
|
42
|
+
const stat = fs.statSync(target.path);
|
|
43
|
+
if (stat.isSocket())
|
|
44
|
+
fs.unlinkSync(target.path);
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
/* doesn't exist — fine */
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const meshSecret = options.meshSecret?.trim() || null;
|
|
51
|
+
const meshSecretPath = options.meshSecretPath?.trim() || null;
|
|
52
|
+
const resolvedMeshSecret = meshSecret || (meshSecretPath ? loadOrCreateMeshSecret(meshSecretPath) : null);
|
|
53
|
+
const server = new BrokerSocketServer(db, target, {
|
|
54
|
+
...(resolvedMeshSecret ? { meshSecret: resolvedMeshSecret } : {}),
|
|
55
|
+
});
|
|
56
|
+
try {
|
|
57
|
+
await server.start();
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
db.close();
|
|
61
|
+
lock.release();
|
|
62
|
+
throw err;
|
|
63
|
+
}
|
|
64
|
+
const adapters = [];
|
|
65
|
+
const broker = {
|
|
66
|
+
db,
|
|
67
|
+
server,
|
|
68
|
+
lock,
|
|
69
|
+
adapters,
|
|
70
|
+
addAdapter(adapter) {
|
|
71
|
+
adapters.push(adapter);
|
|
72
|
+
server.setOutboundMessageAdapters(adapters);
|
|
73
|
+
},
|
|
74
|
+
async stop() {
|
|
75
|
+
for (const adapter of adapters) {
|
|
76
|
+
try {
|
|
77
|
+
await adapter.disconnect();
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
// best effort
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
adapters.length = 0;
|
|
84
|
+
await server.stop();
|
|
85
|
+
db.close();
|
|
86
|
+
lock.release();
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
return broker;
|
|
90
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@pinet/broker-core/leader";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@pinet/broker-core/leader";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@pinet/broker-core/maintenance";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@pinet/broker-core/maintenance";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@pinet/broker-core/message-send";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@pinet/broker-core/message-send";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@pinet/broker-core/paths";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@pinet/broker-core/paths";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@pinet/broker-core/raw-tcp-loopback";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@pinet/broker-core/raw-tcp-loopback";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@pinet/broker-core/router";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@pinet/broker-core/router";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BrokerDB as CoreBrokerDB, CURRENT_BROKER_SCHEMA_VERSION, DEFAULT_DISCONNECTED_PURGE_GRACE_MS, DEFAULT_RESUMABLE_WINDOW_MS, defaultDbPath, type TaskAssignmentAwaitingReplyInfo } from "@pinet/broker-core/schema";
|
|
2
|
+
import type { RalphCycleRecord } from "../helpers.js";
|
|
3
|
+
export { CURRENT_BROKER_SCHEMA_VERSION, DEFAULT_DISCONNECTED_PURGE_GRACE_MS, DEFAULT_RESUMABLE_WINDOW_MS, defaultDbPath, };
|
|
4
|
+
export type { TaskAssignmentAwaitingReplyInfo };
|
|
5
|
+
export declare class BrokerDB extends CoreBrokerDB {
|
|
6
|
+
initialize(): void;
|
|
7
|
+
recordRalphCycle(record: Omit<RalphCycleRecord, "id">): number;
|
|
8
|
+
getRecentRalphCycles(limit?: number): RalphCycleRecord[];
|
|
9
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { BrokerDB as CoreBrokerDB, CURRENT_BROKER_SCHEMA_VERSION, DEFAULT_DISCONNECTED_PURGE_GRACE_MS, DEFAULT_RESUMABLE_WINDOW_MS, defaultDbPath, } from "@pinet/broker-core/schema";
|
|
2
|
+
function ensureRalphCycleTable(db) {
|
|
3
|
+
db.exec(`
|
|
4
|
+
CREATE TABLE IF NOT EXISTS ralph_cycles (
|
|
5
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
6
|
+
started_at TEXT NOT NULL,
|
|
7
|
+
completed_at TEXT,
|
|
8
|
+
duration_ms INTEGER,
|
|
9
|
+
ghost_agent_ids TEXT NOT NULL DEFAULT '[]',
|
|
10
|
+
nudge_agent_ids TEXT NOT NULL DEFAULT '[]',
|
|
11
|
+
idle_drain_agent_ids TEXT NOT NULL DEFAULT '[]',
|
|
12
|
+
stuck_agent_ids TEXT NOT NULL DEFAULT '[]',
|
|
13
|
+
anomalies TEXT NOT NULL DEFAULT '[]',
|
|
14
|
+
anomaly_signature TEXT NOT NULL DEFAULT '',
|
|
15
|
+
follow_up_delivered INTEGER NOT NULL DEFAULT 0,
|
|
16
|
+
agent_count INTEGER NOT NULL DEFAULT 0,
|
|
17
|
+
backlog_count INTEGER NOT NULL DEFAULT 0
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
CREATE INDEX IF NOT EXISTS idx_ralph_cycles_started
|
|
21
|
+
ON ralph_cycles(started_at);
|
|
22
|
+
`);
|
|
23
|
+
}
|
|
24
|
+
export { CURRENT_BROKER_SCHEMA_VERSION, DEFAULT_DISCONNECTED_PURGE_GRACE_MS, DEFAULT_RESUMABLE_WINDOW_MS, defaultDbPath, };
|
|
25
|
+
export class BrokerDB extends CoreBrokerDB {
|
|
26
|
+
initialize() {
|
|
27
|
+
super.initialize();
|
|
28
|
+
ensureRalphCycleTable(this.getDb());
|
|
29
|
+
}
|
|
30
|
+
recordRalphCycle(record) {
|
|
31
|
+
const db = this.getDb();
|
|
32
|
+
const info = db
|
|
33
|
+
.prepare(`INSERT INTO ralph_cycles (
|
|
34
|
+
started_at, completed_at, duration_ms,
|
|
35
|
+
ghost_agent_ids, nudge_agent_ids, idle_drain_agent_ids, stuck_agent_ids,
|
|
36
|
+
anomalies, anomaly_signature, follow_up_delivered,
|
|
37
|
+
agent_count, backlog_count
|
|
38
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
|
|
39
|
+
.run(record.startedAt, record.completedAt, record.durationMs, JSON.stringify(record.ghostAgentIds), JSON.stringify(record.nudgeAgentIds), JSON.stringify(record.idleDrainAgentIds), JSON.stringify(record.stuckAgentIds), JSON.stringify(record.anomalies), record.anomalySignature, record.followUpDelivered ? 1 : 0, record.agentCount, record.backlogCount);
|
|
40
|
+
return Number(info.lastInsertRowid);
|
|
41
|
+
}
|
|
42
|
+
getRecentRalphCycles(limit = 20) {
|
|
43
|
+
const db = this.getDb();
|
|
44
|
+
const rows = db
|
|
45
|
+
.prepare("SELECT * FROM ralph_cycles ORDER BY started_at DESC LIMIT ?")
|
|
46
|
+
.all(limit);
|
|
47
|
+
return rows.map((row) => ({
|
|
48
|
+
id: row.id,
|
|
49
|
+
startedAt: row.started_at,
|
|
50
|
+
completedAt: row.completed_at,
|
|
51
|
+
durationMs: row.duration_ms,
|
|
52
|
+
ghostAgentIds: JSON.parse(row.ghost_agent_ids),
|
|
53
|
+
nudgeAgentIds: JSON.parse(row.nudge_agent_ids),
|
|
54
|
+
idleDrainAgentIds: JSON.parse(row.idle_drain_agent_ids),
|
|
55
|
+
stuckAgentIds: JSON.parse(row.stuck_agent_ids),
|
|
56
|
+
anomalies: JSON.parse(row.anomalies),
|
|
57
|
+
anomalySignature: row.anomaly_signature,
|
|
58
|
+
followUpDelivered: row.follow_up_delivered === 1,
|
|
59
|
+
agentCount: row.agent_count,
|
|
60
|
+
backlogCount: row.backlog_count,
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import type { BrokerDB } from "./schema.js";
|
|
2
|
+
import type { BrokerMessage, MessageAdapter } from "./types.js";
|
|
3
|
+
export declare const DEFAULT_HEARTBEAT_TIMEOUT_MS = 15000;
|
|
4
|
+
export declare const DEFAULT_PRUNE_INTERVAL_MS = 5000;
|
|
5
|
+
export declare const DEFAULT_AUTH_TIMEOUT_MS = 2000;
|
|
6
|
+
export type ListenTarget = {
|
|
7
|
+
type: "unix";
|
|
8
|
+
path: string;
|
|
9
|
+
} | {
|
|
10
|
+
type: "tcp";
|
|
11
|
+
host: string;
|
|
12
|
+
port: number;
|
|
13
|
+
};
|
|
14
|
+
export type AgentMessageCallback = (targetAgentId: string, msg: BrokerMessage, metadata: Record<string, unknown>) => void;
|
|
15
|
+
export type AgentStatusChangeCallback = (agentId: string, status: "working" | "idle") => void;
|
|
16
|
+
export type AgentRegistrationResolver = (input: {
|
|
17
|
+
agentId: string;
|
|
18
|
+
name: string;
|
|
19
|
+
emoji: string;
|
|
20
|
+
pid: number;
|
|
21
|
+
stableId?: string;
|
|
22
|
+
metadata?: Record<string, unknown>;
|
|
23
|
+
}) => {
|
|
24
|
+
name: string;
|
|
25
|
+
emoji: string;
|
|
26
|
+
metadata?: Record<string, unknown>;
|
|
27
|
+
} | null;
|
|
28
|
+
export interface BrokerSocketServerOptions {
|
|
29
|
+
heartbeatTimeoutMs?: number;
|
|
30
|
+
pruneIntervalMs?: number;
|
|
31
|
+
authTimeoutMs?: number;
|
|
32
|
+
meshSecret?: string;
|
|
33
|
+
}
|
|
34
|
+
export declare class BrokerSocketServer {
|
|
35
|
+
private server;
|
|
36
|
+
private readonly target;
|
|
37
|
+
private readonly db;
|
|
38
|
+
private readonly router;
|
|
39
|
+
private readonly connections;
|
|
40
|
+
private readonly heartbeatTimeoutMs;
|
|
41
|
+
private readonly pruneIntervalMs;
|
|
42
|
+
private readonly authTimeoutMs;
|
|
43
|
+
private readonly meshSecret;
|
|
44
|
+
private pruneTimer;
|
|
45
|
+
private assignedPort;
|
|
46
|
+
private agentMessageCallback;
|
|
47
|
+
private agentStatusChangeCallback;
|
|
48
|
+
private outboundMessageAdapters;
|
|
49
|
+
private agentRegistrationResolver;
|
|
50
|
+
constructor(db: BrokerDB, target?: ListenTarget | string, options?: BrokerSocketServerOptions);
|
|
51
|
+
start(): Promise<void>;
|
|
52
|
+
stop(): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Get connection info for clients. Returns the socket path (Unix)
|
|
55
|
+
* or { host, port } (TCP).
|
|
56
|
+
*/
|
|
57
|
+
getConnectInfo(): {
|
|
58
|
+
type: "unix";
|
|
59
|
+
path: string;
|
|
60
|
+
} | {
|
|
61
|
+
type: "tcp";
|
|
62
|
+
host: string;
|
|
63
|
+
port: number;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Register a callback invoked whenever a worker sends an agent-to-agent
|
|
67
|
+
* message via the socket server. The broker uses this to push messages
|
|
68
|
+
* targeting itself into its in-memory inbox.
|
|
69
|
+
*/
|
|
70
|
+
onAgentMessage(cb: AgentMessageCallback): void;
|
|
71
|
+
/**
|
|
72
|
+
* Register a callback invoked whenever a connected agent explicitly updates
|
|
73
|
+
* its broker status. The broker uses idle transitions to kick maintenance so
|
|
74
|
+
* backlog can be reassigned immediately.
|
|
75
|
+
*/
|
|
76
|
+
onAgentStatusChange(cb: AgentStatusChangeCallback): void;
|
|
77
|
+
setAgentRegistrationResolver(resolver: AgentRegistrationResolver | null): void;
|
|
78
|
+
setOutboundMessageAdapters(adapters: ReadonlyArray<Pick<MessageAdapter, "name" | "send" | "invokeCapability">>): void;
|
|
79
|
+
private startPruning;
|
|
80
|
+
private stopPruning;
|
|
81
|
+
private clearAuthTimer;
|
|
82
|
+
private startAuthTimer;
|
|
83
|
+
private disconnectDuplicateConnections;
|
|
84
|
+
private findLiveStableIdConflict;
|
|
85
|
+
private onConnection;
|
|
86
|
+
private processBuffer;
|
|
87
|
+
private dispatchRequest;
|
|
88
|
+
private send;
|
|
89
|
+
private handleRequest;
|
|
90
|
+
private handleAuth;
|
|
91
|
+
private handleRegister;
|
|
92
|
+
private handleUnregister;
|
|
93
|
+
private handleHeartbeat;
|
|
94
|
+
private handleInboxPoll;
|
|
95
|
+
private handleInboxRead;
|
|
96
|
+
private handleInboxAck;
|
|
97
|
+
private handleSend;
|
|
98
|
+
private handleMessageSend;
|
|
99
|
+
private handleThreadsList;
|
|
100
|
+
private handleAgentsList;
|
|
101
|
+
private handleThreadClaim;
|
|
102
|
+
private handleResolveThread;
|
|
103
|
+
private handleAgentMessage;
|
|
104
|
+
private handleAgentBroadcast;
|
|
105
|
+
private handleLaneList;
|
|
106
|
+
private handleLaneUpsert;
|
|
107
|
+
private handleLaneParticipant;
|
|
108
|
+
private handlePortLeaseAcquire;
|
|
109
|
+
private handlePortLeaseRenew;
|
|
110
|
+
private handlePortLeaseRelease;
|
|
111
|
+
private handlePortLeaseStatus;
|
|
112
|
+
private handlePortLeaseList;
|
|
113
|
+
private handlePortLeaseExpire;
|
|
114
|
+
private handleScheduleCreate;
|
|
115
|
+
private handleStatusUpdate;
|
|
116
|
+
private handleAdapterCapability;
|
|
117
|
+
private handleLegacySlackProxy;
|
|
118
|
+
private dispatchAdapterCapability;
|
|
119
|
+
private applyAdapterCapabilityEffects;
|
|
120
|
+
}
|