@hua-labs/tap 0.1.1 → 0.2.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/README.md +123 -152
- package/dist/bridges/codex-app-server-auth-gateway.d.mts +8 -0
- package/dist/bridges/codex-app-server-auth-gateway.mjs +183 -0
- package/dist/bridges/codex-app-server-auth-gateway.mjs.map +1 -0
- package/dist/bridges/codex-bridge-runner.d.mts +10 -1
- package/dist/bridges/codex-bridge-runner.mjs +233 -121
- package/dist/bridges/codex-bridge-runner.mjs.map +1 -1
- package/dist/cli.mjs +2728 -991
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +139 -5
- package/dist/index.mjs +528 -69
- package/dist/index.mjs.map +1 -1
- package/dist/mcp-server.d.mts +2 -0
- package/dist/mcp-server.mjs +22174 -0
- package/dist/mcp-server.mjs.map +1 -0
- package/package.json +7 -4
package/dist/index.d.mts
CHANGED
|
@@ -8,6 +8,8 @@ interface AdapterContext {
|
|
|
8
8
|
repoRoot: string;
|
|
9
9
|
stateDir: string;
|
|
10
10
|
platform: Platform;
|
|
11
|
+
/** Instance ID for TAP_AGENT_ID env injection. Set by 'tap add'. */
|
|
12
|
+
instanceId?: string;
|
|
11
13
|
}
|
|
12
14
|
interface ProbeResult {
|
|
13
15
|
installed: boolean;
|
|
@@ -83,10 +85,32 @@ interface HeadlessConfig {
|
|
|
83
85
|
/** Severity floor for quality-threshold strategy. Default: "high" */
|
|
84
86
|
qualitySeverityFloor: "critical" | "high" | "medium";
|
|
85
87
|
}
|
|
88
|
+
interface AppServerAuthState {
|
|
89
|
+
mode: "query-token";
|
|
90
|
+
protectedUrl: string;
|
|
91
|
+
upstreamUrl: string;
|
|
92
|
+
tokenPath: string;
|
|
93
|
+
gatewayPid: number | null;
|
|
94
|
+
gatewayLogPath: string | null;
|
|
95
|
+
}
|
|
96
|
+
interface AppServerState {
|
|
97
|
+
url: string;
|
|
98
|
+
pid: number | null;
|
|
99
|
+
managed: boolean;
|
|
100
|
+
healthy: boolean;
|
|
101
|
+
lastCheckedAt: string;
|
|
102
|
+
lastHealthyAt: string | null;
|
|
103
|
+
logPath: string | null;
|
|
104
|
+
manualCommand: string;
|
|
105
|
+
auth?: AppServerAuthState | null;
|
|
106
|
+
}
|
|
86
107
|
interface BridgeState {
|
|
87
108
|
pid: number;
|
|
88
109
|
statePath: string;
|
|
89
110
|
lastHeartbeat: string;
|
|
111
|
+
appServer?: AppServerState | null;
|
|
112
|
+
/** Instance-specific daemon state dir (thread/heartbeat/processed markers). */
|
|
113
|
+
runtimeStateDir?: string | null;
|
|
90
114
|
}
|
|
91
115
|
/** Runtime instance state. Supports multiple instances per runtime (e.g. codex-reviewer, codex-builder). */
|
|
92
116
|
interface InstanceState {
|
|
@@ -140,8 +164,8 @@ interface TapStateV1 {
|
|
|
140
164
|
packageVersion: string;
|
|
141
165
|
runtimes: Partial<Record<RuntimeName, RuntimeState>>;
|
|
142
166
|
}
|
|
143
|
-
type CommandName = "init" | "init-worktree" | "add" | "remove" | "status" | "serve" | "bridge" | "dashboard" | "unknown";
|
|
144
|
-
type CommandCode = "TAP_INIT_OK" | "TAP_ADD_OK" | "TAP_REMOVE_OK" | "TAP_STATUS_OK" | "TAP_SERVE_OK" | "TAP_NO_OP" | "TAP_ALREADY_INITIALIZED" | "TAP_NOT_INITIALIZED" | "TAP_RUNTIME_UNKNOWN" | "TAP_RUNTIME_NOT_FOUND" | "TAP_CONFIG_INVALID" | "TAP_LOCAL_SERVER_MISSING" | "TAP_INVALID_ARGUMENT" | "TAP_INSTANCE_NOT_FOUND" | "TAP_INSTANCE_AMBIGUOUS" | "TAP_PORT_CONFLICT" | "TAP_PATCH_FAILED" | "TAP_VERIFY_FAILED" | "TAP_ROLLBACK_FAILED" | "TAP_BRIDGE_START_OK" | "TAP_BRIDGE_START_FAILED" | "TAP_BRIDGE_STOP_OK" | "TAP_BRIDGE_STATUS_OK" | "TAP_BRIDGE_NOT_RUNNING" | "TAP_BRIDGE_SCRIPT_MISSING" | "TAP_SERVE_NO_SERVER" | "TAP_SERVE_BUN_REQUIRED" | "TAP_REVIEW_START_OK" | "TAP_REVIEW_TERMINATED" | "TAP_INTERNAL_ERROR";
|
|
167
|
+
type CommandName = "init" | "init-worktree" | "add" | "remove" | "status" | "serve" | "bridge" | "up" | "down" | "dashboard" | "doctor" | "unknown";
|
|
168
|
+
type CommandCode = "TAP_INIT_OK" | "TAP_ADD_OK" | "TAP_REMOVE_OK" | "TAP_STATUS_OK" | "TAP_SERVE_OK" | "TAP_NO_OP" | "TAP_ALREADY_INITIALIZED" | "TAP_NOT_INITIALIZED" | "TAP_RUNTIME_UNKNOWN" | "TAP_RUNTIME_NOT_FOUND" | "TAP_CONFIG_INVALID" | "TAP_LOCAL_SERVER_MISSING" | "TAP_INVALID_ARGUMENT" | "TAP_INSTANCE_NOT_FOUND" | "TAP_INSTANCE_AMBIGUOUS" | "TAP_PORT_CONFLICT" | "TAP_PATCH_FAILED" | "TAP_VERIFY_FAILED" | "TAP_ROLLBACK_FAILED" | "TAP_BRIDGE_START_OK" | "TAP_BRIDGE_START_FAILED" | "TAP_BRIDGE_STOP_OK" | "TAP_BRIDGE_STATUS_OK" | "TAP_BRIDGE_NOT_RUNNING" | "TAP_BRIDGE_SCRIPT_MISSING" | "TAP_UP_OK" | "TAP_DOWN_OK" | "TAP_SERVE_NO_SERVER" | "TAP_SERVE_BUN_REQUIRED" | "TAP_REVIEW_START_OK" | "TAP_REVIEW_TERMINATED" | "TAP_INTERNAL_ERROR";
|
|
145
169
|
interface CommandResult<T = Record<string, unknown>> {
|
|
146
170
|
ok: boolean;
|
|
147
171
|
command: CommandName;
|
|
@@ -158,7 +182,7 @@ declare function loadState(repoRoot: string): TapState | null;
|
|
|
158
182
|
declare function saveState(repoRoot: string, state: TapState): void;
|
|
159
183
|
declare function createInitialState(commsDir: string, repoRoot: string, packageVersion: string): TapState;
|
|
160
184
|
|
|
161
|
-
declare const version
|
|
185
|
+
declare const version: string;
|
|
162
186
|
|
|
163
187
|
/**
|
|
164
188
|
* Shared config (tap-config.json) — git tracked, repo-level defaults.
|
|
@@ -190,7 +214,7 @@ interface TapResolvedConfig {
|
|
|
190
214
|
appServerUrl: string;
|
|
191
215
|
}
|
|
192
216
|
/** Config resolution source for diagnostics. */
|
|
193
|
-
type ConfigSource = "cli-flag" | "env" | "local-config" | "shared-config" | "auto";
|
|
217
|
+
type ConfigSource = "cli-flag" | "env" | "local-config" | "shared-config" | "legacy-shell-config" | "auto";
|
|
194
218
|
interface ConfigResolution {
|
|
195
219
|
config: TapResolvedConfig;
|
|
196
220
|
sources: Record<keyof TapResolvedConfig, ConfigSource>;
|
|
@@ -228,6 +252,116 @@ declare function updateBridgeHeartbeat(stateDir: string, instanceId: InstanceId)
|
|
|
228
252
|
*/
|
|
229
253
|
declare function getHeartbeatAge(stateDir: string, instanceId: InstanceId): number | null;
|
|
230
254
|
|
|
255
|
+
/**
|
|
256
|
+
* Dashboard data collection engine.
|
|
257
|
+
* Aggregates: agents (comms presence), bridges (state + PID), PRs (gh CLI).
|
|
258
|
+
*
|
|
259
|
+
* Ref: tap public repo tap-ops-dashboard.ps1 (single-agent view)
|
|
260
|
+
* M74 extends to control-tower view (all agents, all bridges, all PRs).
|
|
261
|
+
*/
|
|
262
|
+
interface AgentInfo {
|
|
263
|
+
name: string;
|
|
264
|
+
status: string | null;
|
|
265
|
+
lastActivity: string | null;
|
|
266
|
+
joinedAt: string | null;
|
|
267
|
+
}
|
|
268
|
+
interface BridgeInfo {
|
|
269
|
+
instanceId: string;
|
|
270
|
+
runtime: string;
|
|
271
|
+
status: "running" | "stopped" | "stale";
|
|
272
|
+
pid: number | null;
|
|
273
|
+
port: number | null;
|
|
274
|
+
heartbeatAge: number | null;
|
|
275
|
+
headless: boolean;
|
|
276
|
+
}
|
|
277
|
+
interface PRInfo {
|
|
278
|
+
number: number;
|
|
279
|
+
title: string;
|
|
280
|
+
author: string;
|
|
281
|
+
state: string;
|
|
282
|
+
url: string;
|
|
283
|
+
}
|
|
284
|
+
interface DashboardWarning {
|
|
285
|
+
level: "warn" | "error";
|
|
286
|
+
message: string;
|
|
287
|
+
}
|
|
288
|
+
interface DashboardSnapshot {
|
|
289
|
+
generatedAt: string;
|
|
290
|
+
repoRoot: string;
|
|
291
|
+
commsDir: string;
|
|
292
|
+
agents: AgentInfo[];
|
|
293
|
+
bridges: BridgeInfo[];
|
|
294
|
+
prs: PRInfo[];
|
|
295
|
+
warnings: DashboardWarning[];
|
|
296
|
+
}
|
|
297
|
+
declare function collectDashboardSnapshot(repoRoot?: string, commsDirOverride?: string): DashboardSnapshot;
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* State/Control API — programmatic access to tap state.
|
|
301
|
+
* GUI and autopilot consume these functions instead of shelling out to CLI.
|
|
302
|
+
*
|
|
303
|
+
* M105: JSON contract for getDashboardSnapshot, streamEvents.
|
|
304
|
+
*/
|
|
305
|
+
|
|
306
|
+
interface StateApiOptions {
|
|
307
|
+
repoRoot?: string;
|
|
308
|
+
commsDir?: string;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Get a point-in-time snapshot of all tap state:
|
|
312
|
+
* agents, bridges, PRs, and warnings.
|
|
313
|
+
*
|
|
314
|
+
* This is the read-only entry point for GUI dashboards and autopilot.
|
|
315
|
+
*/
|
|
316
|
+
declare function getDashboardSnapshot(options?: StateApiOptions): DashboardSnapshot;
|
|
317
|
+
interface EventStreamOptions extends StateApiOptions {
|
|
318
|
+
/** Poll interval in milliseconds (default: 2000) */
|
|
319
|
+
intervalMs?: number;
|
|
320
|
+
/** AbortSignal to stop the stream */
|
|
321
|
+
signal?: AbortSignal;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Async generator that yields dashboard snapshots at regular intervals.
|
|
325
|
+
* Useful for SSE or WebSocket push to GUI clients.
|
|
326
|
+
*
|
|
327
|
+
* Stops when the AbortSignal fires or the consumer breaks out.
|
|
328
|
+
*/
|
|
329
|
+
declare function streamEvents(options?: EventStreamOptions): AsyncGenerator<DashboardSnapshot>;
|
|
330
|
+
/**
|
|
331
|
+
* Resolve tap configuration for API consumers.
|
|
332
|
+
* Returns paths and settings without requiring CLI args.
|
|
333
|
+
*/
|
|
334
|
+
declare function getConfig(options?: StateApiOptions): {
|
|
335
|
+
repoRoot: string;
|
|
336
|
+
commsDir: string;
|
|
337
|
+
stateDir: string;
|
|
338
|
+
appServerUrl: string;
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Minimal HTTP transport for tap State API.
|
|
343
|
+
* localhost-only, no external dependencies (uses node:http).
|
|
344
|
+
*
|
|
345
|
+
* Endpoints:
|
|
346
|
+
* GET /api/snapshot — DashboardSnapshot JSON
|
|
347
|
+
* GET /api/events — SSE stream of snapshots
|
|
348
|
+
* GET /api/config — Resolved tap configuration
|
|
349
|
+
* GET /health — Health check
|
|
350
|
+
*/
|
|
351
|
+
|
|
352
|
+
interface HttpServerOptions extends StateApiOptions {
|
|
353
|
+
/** Port to listen on (default: 4580) */
|
|
354
|
+
port?: number;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Start a localhost-only HTTP server for the tap State API.
|
|
358
|
+
* Resolves after the server is listening. Rejects on bind failure (e.g. EADDRINUSE).
|
|
359
|
+
*/
|
|
360
|
+
declare function startHttpServer(options?: HttpServerOptions): Promise<{
|
|
361
|
+
port: number;
|
|
362
|
+
close: () => Promise<void>;
|
|
363
|
+
}>;
|
|
364
|
+
|
|
231
365
|
/**
|
|
232
366
|
* Common Node.js runtime resolver for all tap-comms child processes.
|
|
233
367
|
*
|
|
@@ -269,4 +403,4 @@ declare function resolveNodeRuntime(configCommand: string, repoRoot: string): Re
|
|
|
269
403
|
*/
|
|
270
404
|
declare function buildRuntimeEnv(repoRoot: string, baseEnv?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
271
405
|
|
|
272
|
-
export { type AdapterContext, type ApplyResult, type ArtifactKind, type BridgeMode, type BridgeState, type CommandCode, type CommandName, type CommandResult, type ConfigOverrides, type ConfigResolution, type ConfigSource, type InstanceId, type InstanceState, LOCAL_CONFIG_FILE, type OwnedArtifact, type PatchOp, type PatchOpType, type PatchPlan, type Platform, type ProbeResult, type ResolvedRuntime, type RuntimeAdapter, type RuntimeName, type RuntimeSource, type RuntimeState, SHARED_CONFIG_FILE, type TapLocalConfig, type TapResolvedConfig, type TapSharedConfig, type TapState, type TapStateV1, type VerifyCheck, type VerifyResult, buildRuntimeEnv, createInitialState, getFnmBinDir, getHeartbeatAge, loadLocalConfig, loadSharedConfig, loadState, probeFnmNode, readNodeVersion, resolveConfig, resolveNodeRuntime, rotateLog, saveLocalConfig, saveSharedConfig, saveState, stateExists, updateBridgeHeartbeat, version };
|
|
406
|
+
export { type AdapterContext, type AgentInfo, type AppServerAuthState, type AppServerState, type ApplyResult, type ArtifactKind, type BridgeInfo, type BridgeMode, type BridgeState, type CommandCode, type CommandName, type CommandResult, type ConfigOverrides, type ConfigResolution, type ConfigSource, type DashboardSnapshot, type DashboardWarning, type EventStreamOptions, type HttpServerOptions, type InstanceId, type InstanceState, LOCAL_CONFIG_FILE, type OwnedArtifact, type PRInfo, type PatchOp, type PatchOpType, type PatchPlan, type Platform, type ProbeResult, type ResolvedRuntime, type RuntimeAdapter, type RuntimeName, type RuntimeSource, type RuntimeState, SHARED_CONFIG_FILE, type StateApiOptions, type TapLocalConfig, type TapResolvedConfig, type TapSharedConfig, type TapState, type TapStateV1, type VerifyCheck, type VerifyResult, buildRuntimeEnv, collectDashboardSnapshot, createInitialState, getConfig, getDashboardSnapshot, getFnmBinDir, getHeartbeatAge, loadLocalConfig, loadSharedConfig, loadState, probeFnmNode, readNodeVersion, resolveConfig, resolveNodeRuntime, rotateLog, saveLocalConfig, saveSharedConfig, saveState, startHttpServer, stateExists, streamEvents, updateBridgeHeartbeat, version };
|