@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,550 @@
|
|
|
1
|
+
import { type RuntimeScopeCarrier } from "@pinet/transport-core";
|
|
2
|
+
import type { ReactionCommandSettings } from "./reaction-triggers.js";
|
|
3
|
+
export interface SlackBridgeSettings {
|
|
4
|
+
botToken?: string;
|
|
5
|
+
appToken?: string;
|
|
6
|
+
appId?: string;
|
|
7
|
+
appConfigToken?: string;
|
|
8
|
+
allowedUsers?: string[];
|
|
9
|
+
allowAllWorkspaceUsers?: boolean;
|
|
10
|
+
defaultChannel?: string;
|
|
11
|
+
logChannel?: string;
|
|
12
|
+
logLevel?: "errors" | "actions" | "verbose";
|
|
13
|
+
suggestedPrompts?: {
|
|
14
|
+
title: string;
|
|
15
|
+
message: string;
|
|
16
|
+
}[];
|
|
17
|
+
reactionCommands?: ReactionCommandSettings;
|
|
18
|
+
runtimeMode?: "off" | "single" | "broker" | "follower";
|
|
19
|
+
brokerPrompt?: string;
|
|
20
|
+
autoConnect?: boolean;
|
|
21
|
+
autoFollow?: boolean;
|
|
22
|
+
ralphLoopIntervalMs?: number;
|
|
23
|
+
ralphSnoozeAfterEmptyCycles?: number;
|
|
24
|
+
ralphSnoozeDurationMs?: number;
|
|
25
|
+
skinTheme?: string;
|
|
26
|
+
agentName?: string;
|
|
27
|
+
agentEmoji?: string;
|
|
28
|
+
meshSecret?: string;
|
|
29
|
+
meshSecretPath?: string;
|
|
30
|
+
imessage?: {
|
|
31
|
+
enabled?: boolean;
|
|
32
|
+
};
|
|
33
|
+
security?: {
|
|
34
|
+
readOnly?: boolean;
|
|
35
|
+
requireConfirmation?: string[];
|
|
36
|
+
blockedTools?: string[];
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export interface ResolvedPinetMeshAuthSettings {
|
|
40
|
+
meshSecret: string | null;
|
|
41
|
+
meshSecretPath: string | null;
|
|
42
|
+
}
|
|
43
|
+
export declare function buildSlackCompatibilityScope(options?: {
|
|
44
|
+
teamId?: string | null;
|
|
45
|
+
channelId?: string | null;
|
|
46
|
+
installId?: string | null;
|
|
47
|
+
instanceId?: string | null;
|
|
48
|
+
instanceName?: string | null;
|
|
49
|
+
}): RuntimeScopeCarrier;
|
|
50
|
+
export declare function resolvePinetMeshAuth(settings: SlackBridgeSettings, env?: NodeJS.ProcessEnv): ResolvedPinetMeshAuthSettings;
|
|
51
|
+
export declare function loadSettings(settingsPath?: string): SlackBridgeSettings;
|
|
52
|
+
export declare function resolveAllowAllWorkspaceUsers(settings: SlackBridgeSettings, envVar?: string | undefined): boolean;
|
|
53
|
+
export declare function buildAllowlist(settings: SlackBridgeSettings, envVar?: string, allowAllEnvVar?: string | undefined): Set<string> | null;
|
|
54
|
+
export declare function describeSlackUserAccess(allowlist: Set<string> | null, options?: {
|
|
55
|
+
allowAllWorkspaceUsers?: boolean;
|
|
56
|
+
}): string;
|
|
57
|
+
export declare function getSlackUserAccessWarning(allowlist: Set<string> | null): string | null;
|
|
58
|
+
export declare function isUserAllowed(allowlist: Set<string> | null, userId: string): boolean;
|
|
59
|
+
export interface InboxMessage {
|
|
60
|
+
channel: string;
|
|
61
|
+
threadTs: string;
|
|
62
|
+
userId: string;
|
|
63
|
+
text: string;
|
|
64
|
+
timestamp: string;
|
|
65
|
+
isChannelMention?: boolean;
|
|
66
|
+
brokerInboxId?: number;
|
|
67
|
+
metadata?: Record<string, unknown> | null;
|
|
68
|
+
scope?: RuntimeScopeCarrier | null;
|
|
69
|
+
}
|
|
70
|
+
export interface SqliteJournalModeResult {
|
|
71
|
+
journal_mode?: string | null;
|
|
72
|
+
}
|
|
73
|
+
export declare function getSqliteJournalMode(result?: SqliteJournalModeResult): string;
|
|
74
|
+
export declare function isSqliteWalEnabled(result?: SqliteJournalModeResult): boolean;
|
|
75
|
+
export declare function buildSqliteWalFallbackWarning(component: string, result?: SqliteJournalModeResult): string;
|
|
76
|
+
export declare function formatInboxMessages(messages: InboxMessage[], userNames: {
|
|
77
|
+
get(key: string): string | undefined;
|
|
78
|
+
}): string;
|
|
79
|
+
export declare function isTerminalPinetStandDownMessage(body: string | null | undefined): boolean;
|
|
80
|
+
export declare function formatPinetInboxMessages(entries: FollowerInboxEntry[]): string;
|
|
81
|
+
export type PinetControlCommand = "interrupt" | "reload" | "exit";
|
|
82
|
+
export interface PinetRemoteControlState {
|
|
83
|
+
currentCommand: PinetControlCommand | null;
|
|
84
|
+
queuedCommand: PinetControlCommand | null;
|
|
85
|
+
}
|
|
86
|
+
export interface PinetRemoteControlRequestResult extends PinetRemoteControlState {
|
|
87
|
+
accepted: boolean;
|
|
88
|
+
shouldStartNow: boolean;
|
|
89
|
+
status: "start" | "queued" | "covered";
|
|
90
|
+
scheduledCommand: PinetControlCommand;
|
|
91
|
+
ackDisposition: "immediate" | "on_start";
|
|
92
|
+
}
|
|
93
|
+
export declare function parsePinetControlCommand(value: unknown): PinetControlCommand | null;
|
|
94
|
+
export declare function queuePinetRemoteControl(state: PinetRemoteControlState, command: PinetControlCommand): PinetRemoteControlRequestResult;
|
|
95
|
+
export declare function finishPinetRemoteControl(state: PinetRemoteControlState): PinetRemoteControlState & {
|
|
96
|
+
nextCommand: PinetControlCommand | null;
|
|
97
|
+
};
|
|
98
|
+
export interface PinetRuntimeReloader<State> {
|
|
99
|
+
getCurrentRole: () => "broker" | "follower" | null;
|
|
100
|
+
snapshotState: () => State;
|
|
101
|
+
restoreState: (snapshot: State) => void;
|
|
102
|
+
refreshState: () => void;
|
|
103
|
+
validateRefreshedState: () => void | Promise<void>;
|
|
104
|
+
stopRuntime: () => Promise<void>;
|
|
105
|
+
startRuntime: (role: "broker" | "follower") => Promise<void>;
|
|
106
|
+
}
|
|
107
|
+
export declare function reloadPinetRuntimeSafely<State>(reloader: PinetRuntimeReloader<State>): Promise<void>;
|
|
108
|
+
export interface PinetControlEnvelope {
|
|
109
|
+
type: "pinet:control";
|
|
110
|
+
action: PinetControlCommand;
|
|
111
|
+
}
|
|
112
|
+
export declare function getPinetControlCommandFromText(text: string | undefined): PinetControlCommand | null;
|
|
113
|
+
export declare function buildPinetControlMetadata(command: PinetControlCommand): PinetControlEnvelope;
|
|
114
|
+
export declare function buildPinetControlMessage(command: PinetControlCommand): string;
|
|
115
|
+
export declare function normalizeOutgoingPinetControlMessage(body: string, metadata?: Record<string, unknown>): {
|
|
116
|
+
body: string;
|
|
117
|
+
metadata: Record<string, unknown>;
|
|
118
|
+
} | null;
|
|
119
|
+
export type PinetSkinStatusKey = "idle" | "working" | "healthy" | "stale" | "ghost" | "resumable";
|
|
120
|
+
export type PinetSkinStatusVocabulary = Partial<Record<PinetSkinStatusKey, string>>;
|
|
121
|
+
export declare function extractPinetControlCommand(message: {
|
|
122
|
+
threadId?: string;
|
|
123
|
+
body?: string;
|
|
124
|
+
metadata?: Record<string, unknown> | null;
|
|
125
|
+
}): PinetControlCommand | null;
|
|
126
|
+
export declare const FORM_METHODS: Set<string>;
|
|
127
|
+
export declare function buildSlackRequest(method: string, token: string, body?: Record<string, unknown>): {
|
|
128
|
+
url: string;
|
|
129
|
+
init: RequestInit;
|
|
130
|
+
};
|
|
131
|
+
export interface AbortableOperationTracker {
|
|
132
|
+
run<T>(operation: (signal: AbortSignal) => Promise<T>): Promise<T>;
|
|
133
|
+
abortAndWait(): Promise<void>;
|
|
134
|
+
isAborting(): boolean;
|
|
135
|
+
}
|
|
136
|
+
export declare function createAbortError(message?: string): Error;
|
|
137
|
+
export declare function isAbortError(error: unknown): boolean;
|
|
138
|
+
export declare function abortableDelay(ms: number, signal: AbortSignal): Promise<void>;
|
|
139
|
+
export declare function createAbortableOperationTracker(): AbortableOperationTracker;
|
|
140
|
+
export declare function stripBotMention(text: string, botUserId: string): string;
|
|
141
|
+
export declare function isChannelId(nameOrId: string): boolean;
|
|
142
|
+
export interface AgentCapabilities {
|
|
143
|
+
repo?: string;
|
|
144
|
+
repoRoot?: string;
|
|
145
|
+
branch?: string;
|
|
146
|
+
workdirDirty?: boolean;
|
|
147
|
+
role?: string;
|
|
148
|
+
tools?: string[];
|
|
149
|
+
tags?: string[];
|
|
150
|
+
scope?: RuntimeScopeCarrier | null;
|
|
151
|
+
}
|
|
152
|
+
export type AgentHealth = "healthy" | "stale" | "ghost" | "resumable";
|
|
153
|
+
export interface AgentDisplayInfo {
|
|
154
|
+
emoji: string;
|
|
155
|
+
name: string;
|
|
156
|
+
id: string;
|
|
157
|
+
pid?: number;
|
|
158
|
+
status: "working" | "idle";
|
|
159
|
+
metadata?: {
|
|
160
|
+
cwd?: string;
|
|
161
|
+
branch?: string;
|
|
162
|
+
workdirDirty?: boolean;
|
|
163
|
+
workdirDirtyFileCount?: number;
|
|
164
|
+
gitProbeFailed?: boolean;
|
|
165
|
+
gitProbedAt?: string;
|
|
166
|
+
host?: string;
|
|
167
|
+
repo?: string;
|
|
168
|
+
role?: string;
|
|
169
|
+
worktreePath?: string;
|
|
170
|
+
worktreeKind?: "main" | "linked";
|
|
171
|
+
brokerManaged?: boolean;
|
|
172
|
+
brokerManagedBy?: string;
|
|
173
|
+
launchSource?: string;
|
|
174
|
+
tmuxSession?: string;
|
|
175
|
+
brokerManagedAt?: string;
|
|
176
|
+
skinTheme?: string;
|
|
177
|
+
personality?: string;
|
|
178
|
+
skinStatusVocabulary?: PinetSkinStatusVocabulary;
|
|
179
|
+
capabilities?: AgentCapabilities | null;
|
|
180
|
+
scope?: RuntimeScopeCarrier | null;
|
|
181
|
+
} | null;
|
|
182
|
+
lastHeartbeat?: string;
|
|
183
|
+
leaseExpiresAt?: string | null;
|
|
184
|
+
heartbeatAgeMs?: number | null;
|
|
185
|
+
heartbeatSummary?: string | null;
|
|
186
|
+
leaseSummary?: string | null;
|
|
187
|
+
health?: AgentHealth;
|
|
188
|
+
ghost?: boolean;
|
|
189
|
+
stuck?: boolean;
|
|
190
|
+
idleSince?: string | null;
|
|
191
|
+
lastActivity?: string | null;
|
|
192
|
+
idleDuration?: string | null;
|
|
193
|
+
lastActivityAge?: string | null;
|
|
194
|
+
outboundCount?: number | null;
|
|
195
|
+
pendingInboxCount?: number | null;
|
|
196
|
+
capabilityTags?: string[];
|
|
197
|
+
routingScore?: number;
|
|
198
|
+
routingReasons?: string[];
|
|
199
|
+
}
|
|
200
|
+
export interface AgentVisibilityInput {
|
|
201
|
+
emoji: string;
|
|
202
|
+
name: string;
|
|
203
|
+
id: string;
|
|
204
|
+
pid?: number;
|
|
205
|
+
status: "working" | "idle";
|
|
206
|
+
metadata?: Record<string, unknown> | null;
|
|
207
|
+
lastHeartbeat?: string;
|
|
208
|
+
lastSeen?: string;
|
|
209
|
+
disconnectedAt?: string | null;
|
|
210
|
+
resumableUntil?: string | null;
|
|
211
|
+
idleSince?: string | null;
|
|
212
|
+
lastActivity?: string | null;
|
|
213
|
+
outboundCount?: number | null;
|
|
214
|
+
pendingInboxCount?: number | null;
|
|
215
|
+
}
|
|
216
|
+
export interface AgentVisibilityOptions {
|
|
217
|
+
now?: number;
|
|
218
|
+
heartbeatTimeoutMs?: number;
|
|
219
|
+
heartbeatIntervalMs?: number;
|
|
220
|
+
}
|
|
221
|
+
export interface AgentRoutingHint {
|
|
222
|
+
repo?: string;
|
|
223
|
+
branch?: string;
|
|
224
|
+
role?: string;
|
|
225
|
+
requiredTools?: string[];
|
|
226
|
+
task?: string;
|
|
227
|
+
}
|
|
228
|
+
export declare function shortenPath(p: string, homedir: string): string;
|
|
229
|
+
export declare function extractAgentCapabilities(metadata: Record<string, unknown> | null | undefined): AgentCapabilities;
|
|
230
|
+
export declare function buildAgentCapabilityTags(capabilities: AgentCapabilities): string[];
|
|
231
|
+
export interface MeshVisibilityOptions {
|
|
232
|
+
includeGhosts?: boolean;
|
|
233
|
+
now?: number;
|
|
234
|
+
recentDisconnectWindowMs: number;
|
|
235
|
+
}
|
|
236
|
+
export declare function isAgentVisibleInMesh(agent: {
|
|
237
|
+
disconnectedAt?: string | null;
|
|
238
|
+
}, options: MeshVisibilityOptions): boolean;
|
|
239
|
+
export declare function filterAgentsForMeshVisibility<T extends {
|
|
240
|
+
disconnectedAt?: string | null;
|
|
241
|
+
}>(agents: T[], options: MeshVisibilityOptions): T[];
|
|
242
|
+
export declare function buildAgentDisplayInfo(agent: AgentVisibilityInput, options?: AgentVisibilityOptions): AgentDisplayInfo;
|
|
243
|
+
export declare function rankAgentsForRouting(agents: AgentDisplayInfo[], hint: AgentRoutingHint): AgentDisplayInfo[];
|
|
244
|
+
export declare const DEFAULT_RALPH_LOOP_INTERVAL_MS: number;
|
|
245
|
+
export declare const DEFAULT_RALPH_LOOP_IDLE_WITH_WORK_THRESHOLD_MS = 60000;
|
|
246
|
+
export declare const DEFAULT_RALPH_LOOP_NUDGE_COOLDOWN_MS: number;
|
|
247
|
+
export declare const DEFAULT_RALPH_LOOP_FOLLOW_UP_COOLDOWN_MS = 60000;
|
|
248
|
+
export declare const DEFAULT_RALPH_LOOP_STUCK_WORKING_THRESHOLD_MS: number;
|
|
249
|
+
export declare const MIN_RALPH_LOOP_INTERVAL_MS = 1000;
|
|
250
|
+
export declare const MAX_RALPH_LOOP_INTERVAL_MS = 2147483647;
|
|
251
|
+
export declare const DEFAULT_RALPH_SNOOZE_DURATION_MS: number;
|
|
252
|
+
export declare const MIN_RALPH_SNOOZE_DURATION_MS = 60000;
|
|
253
|
+
export declare const MAX_RALPH_SNOOZE_DURATION_MS: number;
|
|
254
|
+
export declare const DEFAULT_RALPH_SNOOZE_AFTER_EMPTY_CYCLES = 0;
|
|
255
|
+
export declare const MAX_RALPH_SNOOZE_AFTER_EMPTY_CYCLES = 100;
|
|
256
|
+
export declare function resolveRalphLoopIntervalMs(settings?: SlackBridgeSettings): number;
|
|
257
|
+
export declare function resolveRalphSnoozeDurationMs(settings?: SlackBridgeSettings): number;
|
|
258
|
+
export declare function resolveRalphSnoozeAfterEmptyCycles(settings?: SlackBridgeSettings): number;
|
|
259
|
+
export interface RalphLoopAgentWorkload extends AgentVisibilityInput {
|
|
260
|
+
lastSeen?: string;
|
|
261
|
+
pendingInboxCount: number;
|
|
262
|
+
ownedThreadCount: number;
|
|
263
|
+
}
|
|
264
|
+
export interface RalphLoopEvaluationOptions extends AgentVisibilityOptions {
|
|
265
|
+
idleWithWorkThresholdMs?: number;
|
|
266
|
+
stuckWorkingThresholdMs?: number;
|
|
267
|
+
pendingBacklogCount?: number;
|
|
268
|
+
currentBranch?: string | null;
|
|
269
|
+
expectedMainBranch?: string;
|
|
270
|
+
brokerHeartbeatActive?: boolean;
|
|
271
|
+
brokerMaintenanceActive?: boolean;
|
|
272
|
+
brokerAgentId?: string;
|
|
273
|
+
}
|
|
274
|
+
export interface RalphLoopEvaluationResult {
|
|
275
|
+
ghostAgentIds: string[];
|
|
276
|
+
nudgeAgentIds: string[];
|
|
277
|
+
idleDrainAgentIds: string[];
|
|
278
|
+
stuckAgentIds: string[];
|
|
279
|
+
anomalies: string[];
|
|
280
|
+
}
|
|
281
|
+
export interface RalphLoopGhostAnomalyRewriteResult {
|
|
282
|
+
evaluation: RalphLoopEvaluationResult;
|
|
283
|
+
nonGhostAnomalies: string[];
|
|
284
|
+
newGhostIds: string[];
|
|
285
|
+
clearedGhostIds: string[];
|
|
286
|
+
nextReportedGhostIds: string[];
|
|
287
|
+
}
|
|
288
|
+
export declare function evaluateRalphLoopCycle(workloads: RalphLoopAgentWorkload[], options?: RalphLoopEvaluationOptions): RalphLoopEvaluationResult;
|
|
289
|
+
export interface RalphLoopGhostAnomalyRewriteOptions {
|
|
290
|
+
suppressedGhostIds?: Iterable<string>;
|
|
291
|
+
}
|
|
292
|
+
export declare function rewriteRalphLoopGhostAnomalies(evaluation: RalphLoopEvaluationResult, previousGhostIds?: Iterable<string>, options?: RalphLoopGhostAnomalyRewriteOptions): RalphLoopGhostAnomalyRewriteResult;
|
|
293
|
+
export declare function buildRalphLoopNudgeMessage(pendingInboxCount: number, ownedThreadCount: number, cycleStartedAt?: string): string;
|
|
294
|
+
export declare function buildRalphLoopAnomalySignature(evaluation: RalphLoopEvaluationResult): string;
|
|
295
|
+
export declare function buildRalphLoopStatusMessage(summary: string, cycleStartedAt: string): string;
|
|
296
|
+
export interface RalphLoopFollowUpDeliveryOptions {
|
|
297
|
+
signature: string;
|
|
298
|
+
lastDeliveredSignature?: string;
|
|
299
|
+
lastDeliveredAt?: number;
|
|
300
|
+
now?: number;
|
|
301
|
+
cooldownMs?: number;
|
|
302
|
+
pending?: boolean;
|
|
303
|
+
idle?: boolean;
|
|
304
|
+
}
|
|
305
|
+
export declare function shouldDeliverRalphLoopFollowUp(options: RalphLoopFollowUpDeliveryOptions): boolean;
|
|
306
|
+
export declare function buildRalphLoopFollowUpMessage(evaluation: RalphLoopEvaluationResult, cycleStartedAt: string): string | null;
|
|
307
|
+
export interface RalphLoopCycleNotifications {
|
|
308
|
+
followUpPrompt: string | null;
|
|
309
|
+
anomalyStatus: string | null;
|
|
310
|
+
recoveryStatus: string;
|
|
311
|
+
}
|
|
312
|
+
export declare function buildRalphLoopCycleNotifications(evaluation: RalphLoopEvaluationResult, cycleStartedAt: string): RalphLoopCycleNotifications;
|
|
313
|
+
export declare function buildBrokerProtocolGuardrailsPrompt(): string;
|
|
314
|
+
export declare function buildWorkerPromptGuidelines(): string[];
|
|
315
|
+
export declare function buildPinetSkinPromptGuideline(theme: string | null | undefined, personality: string | null | undefined): string | null;
|
|
316
|
+
export declare function buildIdentityReplyGuidelines(agentEmoji: string, agentName: string, location: string): [string, string, string];
|
|
317
|
+
export interface AgentPersonalityProfile {
|
|
318
|
+
descriptor?: string;
|
|
319
|
+
animal?: string;
|
|
320
|
+
traits: string[];
|
|
321
|
+
}
|
|
322
|
+
export declare function resolveAgentPersonality(agentName: string): AgentPersonalityProfile;
|
|
323
|
+
export declare function buildAgentPersonalityGuidelines(agentName: string): string[];
|
|
324
|
+
export declare function resolvePersistedAgentIdentity(settings: SlackBridgeSettings, persistedName?: string, persistedEmoji?: string, envNickname?: string, seed?: string, role?: AgentIdentityRole): {
|
|
325
|
+
name: string;
|
|
326
|
+
emoji: string;
|
|
327
|
+
};
|
|
328
|
+
export declare function buildAgentStableId(sessionFile?: string, host?: string, cwd?: string, leafId?: string): string;
|
|
329
|
+
export declare function resolveAgentStableId(persistedStableId?: string, sessionFile?: string, host?: string, cwd?: string, leafId?: string): string;
|
|
330
|
+
export declare function buildBrokerStableId(host?: string, cwd?: string): string;
|
|
331
|
+
export declare function resolveBrokerStableId(persistedStableId?: string, host?: string, cwd?: string): string;
|
|
332
|
+
export interface PinetRegistrationContext {
|
|
333
|
+
sessionHeader?: {
|
|
334
|
+
parentSession?: string;
|
|
335
|
+
} | null;
|
|
336
|
+
sessionFile?: string;
|
|
337
|
+
leafId?: string;
|
|
338
|
+
argv?: string[];
|
|
339
|
+
hasUI?: boolean;
|
|
340
|
+
stdinIsTTY?: boolean;
|
|
341
|
+
stdoutIsTTY?: boolean;
|
|
342
|
+
}
|
|
343
|
+
export declare function isLikelyLocalSubagentContext(context?: PinetRegistrationContext): boolean;
|
|
344
|
+
export interface FollowerThreadState {
|
|
345
|
+
channelId: string;
|
|
346
|
+
threadTs: string;
|
|
347
|
+
userId: string;
|
|
348
|
+
source?: string;
|
|
349
|
+
owner?: string;
|
|
350
|
+
}
|
|
351
|
+
export interface FollowerInboxEntry {
|
|
352
|
+
inboxId?: number;
|
|
353
|
+
message: {
|
|
354
|
+
threadId?: string;
|
|
355
|
+
source?: string;
|
|
356
|
+
sender?: string;
|
|
357
|
+
body?: string;
|
|
358
|
+
createdAt?: string;
|
|
359
|
+
metadata: Record<string, unknown> | null;
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
export interface FollowerInboxSyncResult {
|
|
363
|
+
inboxMessages: InboxMessage[];
|
|
364
|
+
threadUpdates: FollowerThreadState[];
|
|
365
|
+
lastDmChannel: string | null;
|
|
366
|
+
changed: boolean;
|
|
367
|
+
}
|
|
368
|
+
export interface TransferredSlackThreadSyncResult {
|
|
369
|
+
threadUpdates: FollowerThreadState[];
|
|
370
|
+
changed: boolean;
|
|
371
|
+
}
|
|
372
|
+
export interface BrokerInboxControlEntry {
|
|
373
|
+
inboxId: number;
|
|
374
|
+
command: PinetControlCommand;
|
|
375
|
+
}
|
|
376
|
+
export interface BrokerInboxSyncResult {
|
|
377
|
+
controlEntries: BrokerInboxControlEntry[];
|
|
378
|
+
inboxMessages: InboxMessage[];
|
|
379
|
+
}
|
|
380
|
+
export declare function isDirectMessageChannel(channel: string): boolean;
|
|
381
|
+
export declare function syncTransferredSlackThreadContexts(entries: FollowerInboxEntry[], existingThreads: ReadonlyMap<string, FollowerThreadState>, agentOwner: string): TransferredSlackThreadSyncResult;
|
|
382
|
+
export declare function syncFollowerInboxEntries(entries: FollowerInboxEntry[], existingThreads: ReadonlyMap<string, FollowerThreadState>, agentOwner: string, lastDmChannel: string | null): FollowerInboxSyncResult;
|
|
383
|
+
export declare function syncBrokerInboxEntries(entries: FollowerInboxEntry[]): BrokerInboxSyncResult;
|
|
384
|
+
export interface FollowerThreadChannelResolution {
|
|
385
|
+
channelId: string | null;
|
|
386
|
+
threadUpdate?: FollowerThreadState;
|
|
387
|
+
changed: boolean;
|
|
388
|
+
}
|
|
389
|
+
export declare function resolveFollowerThreadChannel(threadTs: string | undefined, existingThread: FollowerThreadState | undefined, resolveThread?: (threadTs: string) => Promise<string | null>): Promise<FollowerThreadChannelResolution>;
|
|
390
|
+
export type FollowerRuntimeDiagnosticKind = "broker_disconnect" | "poll_failure" | "registration_refresh_failure" | "reconnect_stopped";
|
|
391
|
+
export type FollowerRuntimeDiagnosticState = "reconnecting" | "degraded" | "error";
|
|
392
|
+
export interface FollowerRuntimeDiagnostic {
|
|
393
|
+
kind: FollowerRuntimeDiagnosticKind;
|
|
394
|
+
state: FollowerRuntimeDiagnosticState;
|
|
395
|
+
reason: string;
|
|
396
|
+
nextStep: string;
|
|
397
|
+
detail?: string;
|
|
398
|
+
}
|
|
399
|
+
export declare function buildFollowerRuntimeDiagnostic(kind: FollowerRuntimeDiagnosticKind, options?: {
|
|
400
|
+
detail?: string | null;
|
|
401
|
+
connected?: boolean;
|
|
402
|
+
}): FollowerRuntimeDiagnostic;
|
|
403
|
+
export declare function formatFollowerRuntimeDiagnosticHealth(diagnostic: FollowerRuntimeDiagnostic | null): string;
|
|
404
|
+
export declare function formatFollowerRuntimeDiagnosticNextStep(diagnostic: FollowerRuntimeDiagnostic | null): string;
|
|
405
|
+
export interface FollowerReconnectUiUpdate {
|
|
406
|
+
nextWasDisconnected: boolean;
|
|
407
|
+
notify?: {
|
|
408
|
+
level: "warning" | "info";
|
|
409
|
+
message: string;
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
export declare function getFollowerReconnectUiUpdate(event: "disconnect" | "reconnect", wasDisconnected: boolean): FollowerReconnectUiUpdate;
|
|
413
|
+
export declare function agentOwnsThread(owner: string | undefined, agentName: string, agentAliases?: Iterable<string>, ownerToken?: string): boolean;
|
|
414
|
+
export declare function normalizeOwnedThreads(threads: Iterable<{
|
|
415
|
+
owner?: string;
|
|
416
|
+
}>, agentName: string, ownerToken: string, agentAliases?: Iterable<string>): boolean;
|
|
417
|
+
export declare function getFollowerOwnedThreadClaims(threads: ReadonlyMap<string, Pick<FollowerThreadState, "threadTs" | "channelId" | "source" | "owner">>, agentName: string, agentAliases?: Iterable<string>, ownerToken?: string): Array<{
|
|
418
|
+
threadTs: string;
|
|
419
|
+
channelId: string;
|
|
420
|
+
source?: string;
|
|
421
|
+
}>;
|
|
422
|
+
export declare function getFollowerOwnedThreadReclaims(threads: ReadonlyMap<string, Pick<FollowerThreadState, "threadTs" | "channelId" | "source" | "owner">>, agentName: string, agentAliases?: Iterable<string>, ownerToken?: string): Array<{
|
|
423
|
+
threadTs: string;
|
|
424
|
+
channelId: string;
|
|
425
|
+
source: string;
|
|
426
|
+
}>;
|
|
427
|
+
/**
|
|
428
|
+
* Cache a thread from a broker inbound message in the local threads map.
|
|
429
|
+
* The broker DB remains the source of truth; this is only a read-through
|
|
430
|
+
* cache so Slack tools can resolve channels without hitting the DB every time.
|
|
431
|
+
*/
|
|
432
|
+
export declare function trackBrokerInboundThread(threads: Map<string, FollowerThreadState>, inMsg: {
|
|
433
|
+
threadId: string;
|
|
434
|
+
channel: string;
|
|
435
|
+
userId?: string;
|
|
436
|
+
source?: string;
|
|
437
|
+
}, owner?: string): void;
|
|
438
|
+
export declare function formatAgentList(agents: AgentDisplayInfo[], homedir: string): string;
|
|
439
|
+
export type AgentIdentityRole = "broker" | "worker";
|
|
440
|
+
export declare function buildPinetOwnerToken(stableId: string): string;
|
|
441
|
+
export declare function generateAgentName(seed?: string, role?: AgentIdentityRole): {
|
|
442
|
+
name: string;
|
|
443
|
+
emoji: string;
|
|
444
|
+
};
|
|
445
|
+
export type PinetSkinRole = "broker" | "worker";
|
|
446
|
+
export interface PinetSkinAssignment {
|
|
447
|
+
theme: string;
|
|
448
|
+
role: PinetSkinRole;
|
|
449
|
+
name: string;
|
|
450
|
+
emoji: string;
|
|
451
|
+
personality: string;
|
|
452
|
+
statusVocabulary?: PinetSkinStatusVocabulary;
|
|
453
|
+
}
|
|
454
|
+
export declare const DEFAULT_PINET_SKIN_THEME = "default";
|
|
455
|
+
export declare const FOUNDATION_PINET_SKIN_THEME = "foundation";
|
|
456
|
+
export declare const COSMERE_PINET_SKIN_THEME = "cosmere";
|
|
457
|
+
export declare function normalizePinetSkinTheme(theme: string | undefined): string | null;
|
|
458
|
+
export declare function buildPinetSkinAssignment(options: {
|
|
459
|
+
theme: string;
|
|
460
|
+
role: PinetSkinRole;
|
|
461
|
+
seed: string;
|
|
462
|
+
}): PinetSkinAssignment;
|
|
463
|
+
export declare function resolveAgentIdentity(settings: SlackBridgeSettings, envNickname?: string, seed?: string, role?: AgentIdentityRole): {
|
|
464
|
+
name: string;
|
|
465
|
+
emoji: string;
|
|
466
|
+
};
|
|
467
|
+
export declare function alignAgentIdentityToRole(currentIdentity: {
|
|
468
|
+
name: string;
|
|
469
|
+
emoji: string;
|
|
470
|
+
}, settings: SlackBridgeSettings, envNickname?: string, seed?: string, role?: AgentIdentityRole): {
|
|
471
|
+
name: string;
|
|
472
|
+
emoji: string;
|
|
473
|
+
};
|
|
474
|
+
export declare function resolveRuntimeAgentIdentity(currentIdentity: {
|
|
475
|
+
name: string;
|
|
476
|
+
emoji: string;
|
|
477
|
+
}, settings: SlackBridgeSettings, envNickname?: string, seed?: string, role?: AgentIdentityRole): {
|
|
478
|
+
name: string;
|
|
479
|
+
emoji: string;
|
|
480
|
+
};
|
|
481
|
+
export interface ConfirmationRequest {
|
|
482
|
+
toolPattern: string;
|
|
483
|
+
action: string;
|
|
484
|
+
requestedAt: number;
|
|
485
|
+
}
|
|
486
|
+
export interface ThreadConfirmationState {
|
|
487
|
+
pending: ConfirmationRequest[];
|
|
488
|
+
approved: ConfirmationRequest[];
|
|
489
|
+
rejected: ConfirmationRequest[];
|
|
490
|
+
}
|
|
491
|
+
export interface RegisterThreadConfirmationRequestResult {
|
|
492
|
+
state: ThreadConfirmationState;
|
|
493
|
+
status: "created" | "refreshed" | "conflict";
|
|
494
|
+
conflict?: ConfirmationRequest;
|
|
495
|
+
}
|
|
496
|
+
export declare const DEFAULT_CONFIRMATION_REQUEST_TTL_MS: number;
|
|
497
|
+
export declare function normalizeThreadConfirmationState(state: ThreadConfirmationState, now?: number, ttlMs?: number): ThreadConfirmationState;
|
|
498
|
+
export declare function isThreadConfirmationStateEmpty(state: ThreadConfirmationState): boolean;
|
|
499
|
+
export declare function confirmationRequestMatches(request: ConfirmationRequest, toolName: string, action: string): boolean;
|
|
500
|
+
export declare function consumeMatchingConfirmationRequest(list: ConfirmationRequest[], toolName: string, action: string): ConfirmationRequest | null;
|
|
501
|
+
export declare function registerThreadConfirmationRequest(state: ThreadConfirmationState, request: ConfirmationRequest, now?: number): RegisterThreadConfirmationRequestResult;
|
|
502
|
+
/**
|
|
503
|
+
* Standard Slack API response shape.
|
|
504
|
+
*/
|
|
505
|
+
export interface SlackResult {
|
|
506
|
+
ok: boolean;
|
|
507
|
+
error?: string;
|
|
508
|
+
[key: string]: unknown;
|
|
509
|
+
}
|
|
510
|
+
export interface CallSlackAPIOptions {
|
|
511
|
+
signal?: AbortSignal;
|
|
512
|
+
retryCount?: number;
|
|
513
|
+
}
|
|
514
|
+
export declare function callSlackAPI(method: string, token: string, body?: Record<string, unknown>, options?: CallSlackAPIOptions): Promise<SlackResult>;
|
|
515
|
+
export declare function isRalphNudgeEntry(entry: {
|
|
516
|
+
message: {
|
|
517
|
+
metadata?: Record<string, unknown> | null;
|
|
518
|
+
};
|
|
519
|
+
}): boolean;
|
|
520
|
+
export declare function isAgentToAgentEntry(entry: {
|
|
521
|
+
message: {
|
|
522
|
+
threadId?: string;
|
|
523
|
+
metadata?: Record<string, unknown> | null;
|
|
524
|
+
};
|
|
525
|
+
}): boolean;
|
|
526
|
+
export declare function partitionFollowerInboxEntries<T extends {
|
|
527
|
+
message: {
|
|
528
|
+
threadId?: string;
|
|
529
|
+
metadata?: Record<string, unknown> | null;
|
|
530
|
+
};
|
|
531
|
+
}>(entries: T[]): {
|
|
532
|
+
nudges: T[];
|
|
533
|
+
agentMessages: T[];
|
|
534
|
+
regular: T[];
|
|
535
|
+
};
|
|
536
|
+
export interface RalphCycleRecord {
|
|
537
|
+
id?: number;
|
|
538
|
+
startedAt: string;
|
|
539
|
+
completedAt: string | null;
|
|
540
|
+
durationMs: number | null;
|
|
541
|
+
ghostAgentIds: string[];
|
|
542
|
+
nudgeAgentIds: string[];
|
|
543
|
+
idleDrainAgentIds: string[];
|
|
544
|
+
stuckAgentIds: string[];
|
|
545
|
+
anomalies: string[];
|
|
546
|
+
anomalySignature: string;
|
|
547
|
+
followUpDelivered: boolean;
|
|
548
|
+
agentCount: number;
|
|
549
|
+
backlogCount: number;
|
|
550
|
+
}
|