@aifight/aifight 0.1.0-alpha.6 → 0.1.0-alpha.8
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 +73 -6
- package/dist/bin.mjs +193 -144
- package/dist/index.mjs +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +3 -2
- package/dist/types/agents/agent.d.ts +0 -82
- package/dist/types/agents/state-machine.d.ts +0 -96
- package/dist/types/bridge/auto-update.d.ts +0 -53
- package/dist/types/bridge/config.d.ts +0 -35
- package/dist/types/bridge/hermes-provider.d.ts +0 -9
- package/dist/types/bridge/openclaw-provider.d.ts +0 -9
- package/dist/types/bridge/pairing.d.ts +0 -18
- package/dist/types/bridge/provider.d.ts +0 -18
- package/dist/types/bridge/runner.d.ts +0 -30
- package/dist/types/bridge/service.d.ts +0 -55
- package/dist/types/bridge/update-check.d.ts +0 -23
- package/dist/types/cli/agent-resolver.d.ts +0 -25
- package/dist/types/cli/argv.d.ts +0 -13
- package/dist/types/cli/commands/agent-list.d.ts +0 -2
- package/dist/types/cli/commands/agent-status.d.ts +0 -2
- package/dist/types/cli/commands/bridge-accept.d.ts +0 -2
- package/dist/types/cli/commands/bridge-challenge.d.ts +0 -2
- package/dist/types/cli/commands/bridge-connect.d.ts +0 -2
- package/dist/types/cli/commands/bridge-register.d.ts +0 -7
- package/dist/types/cli/commands/bridge-run.d.ts +0 -7
- package/dist/types/cli/commands/bridge-service.d.ts +0 -5
- package/dist/types/cli/commands/bridge-set.d.ts +0 -2
- package/dist/types/cli/commands/bridge-start.d.ts +0 -2
- package/dist/types/cli/commands/bridge-status.d.ts +0 -2
- package/dist/types/cli/commands/bridge-uninstall.d.ts +0 -4
- package/dist/types/cli/commands/bridge-update.d.ts +0 -2
- package/dist/types/cli/commands/config-init.d.ts +0 -2
- package/dist/types/cli/commands/config-probe.d.ts +0 -2
- package/dist/types/cli/commands/config-validate.d.ts +0 -2
- package/dist/types/cli/commands/daily-off.d.ts +0 -2
- package/dist/types/cli/commands/daily-on.d.ts +0 -2
- package/dist/types/cli/commands/daily-set.d.ts +0 -2
- package/dist/types/cli/commands/daily-show.d.ts +0 -2
- package/dist/types/cli/commands/doctor.d.ts +0 -2
- package/dist/types/cli/commands/init.d.ts +0 -2
- package/dist/types/cli/commands/join.d.ts +0 -2
- package/dist/types/cli/commands/leave.d.ts +0 -2
- package/dist/types/cli/commands/mcp.d.ts +0 -2
- package/dist/types/cli/commands/runtime-management.d.ts +0 -18
- package/dist/types/cli/commands/runtime-setup-state.d.ts +0 -21
- package/dist/types/cli/commands/runtime-setup.d.ts +0 -25
- package/dist/types/cli/commands/serve.d.ts +0 -2
- package/dist/types/cli/commands/service/launchd.d.ts +0 -71
- package/dist/types/cli/commands/service/platform.d.ts +0 -69
- package/dist/types/cli/commands/service/systemd.d.ts +0 -55
- package/dist/types/cli/commands/service/types.d.ts +0 -64
- package/dist/types/cli/commands/service-install.d.ts +0 -29
- package/dist/types/cli/commands/setup.d.ts +0 -2
- package/dist/types/cli/commands/shutdown.d.ts +0 -2
- package/dist/types/cli/commands/stubs.d.ts +0 -24
- package/dist/types/cli/commands/version.d.ts +0 -2
- package/dist/types/cli/control-client.d.ts +0 -59
- package/dist/types/cli/format.d.ts +0 -52
- package/dist/types/cli/main.d.ts +0 -18
- package/dist/types/cli/runtime-files.d.ts +0 -11
- package/dist/types/cli/shared.d.ts +0 -74
- package/dist/types/controlapi/profile-routes.d.ts +0 -49
- package/dist/types/controlapi/server.d.ts +0 -3
- package/dist/types/controlapi/types.d.ts +0 -136
- package/dist/types/daemon/agent-decision-adapter.d.ts +0 -40
- package/dist/types/daemon/lifecycle.d.ts +0 -85
- package/dist/types/daemon/router.d.ts +0 -97
- package/dist/types/daemon/runtime-files-write.d.ts +0 -76
- package/dist/types/identity/identity-manager.d.ts +0 -59
- package/dist/types/llm/adapter-registry.d.ts +0 -27
- package/dist/types/llm/adapters/anthropic-messages.d.ts +0 -2
- package/dist/types/llm/adapters/deepseek-chat-completions.d.ts +0 -2
- package/dist/types/llm/adapters/openai-chat-compat.d.ts +0 -2
- package/dist/types/llm/adapters/openai-chat-completions.d.ts +0 -2
- package/dist/types/llm/adapters/openai-responses.d.ts +0 -2
- package/dist/types/llm/adapters/types.d.ts +0 -128
- package/dist/types/llm/capabilities/validate-capabilities.d.ts +0 -68
- package/dist/types/mcp/control-client.d.ts +0 -54
- package/dist/types/mcp/profile-tools.d.ts +0 -10
- package/dist/types/mcp/server.d.ts +0 -10
- package/dist/types/mcp/tools.d.ts +0 -31
- package/dist/types/mcp/types.d.ts +0 -27
- package/dist/types/profile/config-schema.d.ts +0 -199
- package/dist/types/profile/identity-schema.d.ts +0 -75
- package/dist/types/profile/index.d.ts +0 -7
- package/dist/types/profile/migrate.d.ts +0 -16
- package/dist/types/profile/profile-loader.d.ts +0 -64
- package/dist/types/profile/secret-ref.d.ts +0 -82
- package/dist/types/profile/soul.d.ts +0 -46
- package/dist/types/profile/strategy-schema.d.ts +0 -70
- package/dist/types/reflection/proposal-store.d.ts +0 -50
- package/dist/types/reflection/reflection-engine.d.ts +0 -81
- package/dist/types/scheduler/daily.d.ts +0 -47
- package/dist/types/scheduler/types.d.ts +0 -42
- package/dist/types/session/match-session-manager.d.ts +0 -113
- package/dist/types/session/session-context-builder.d.ts +0 -68
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import type { ControlClient, CreateControlClientOptions } from "./control-client";
|
|
2
|
-
import type { HelloResult } from "../index";
|
|
3
|
-
import type { BridgeServiceDeps } from "../bridge/service";
|
|
4
|
-
/** Per-handler injectable environment. Defaults wired to process I/O +
|
|
5
|
-
* real fs + native fetch. Tests pass overrides for stdout/stderr capture
|
|
6
|
-
* + hello stub + fetchImpl pointing at a temporary M1-16 server. */
|
|
7
|
-
export interface HandlerEnv {
|
|
8
|
-
readonly stdout: (s: string) => void;
|
|
9
|
-
readonly stderr: (s: string) => void;
|
|
10
|
-
/** Override for the M1-01 schemas/types self-test used by `doctor`.
|
|
11
|
-
* Default: real `hello` from runtime/src/index.ts (lazy-imported by
|
|
12
|
-
* the doctor handler so other commands do not pull in the
|
|
13
|
-
* schemas-loading cost). */
|
|
14
|
-
readonly hello?: () => HelloResult;
|
|
15
|
-
/** Override fetch implementation for tests. Default globalThis.fetch. */
|
|
16
|
-
readonly fetchImpl?: typeof fetch;
|
|
17
|
-
/** Optional rebootstrap log hook (forwarded to control-client). */
|
|
18
|
-
readonly onLog?: (event: {
|
|
19
|
-
code: string;
|
|
20
|
-
message: string;
|
|
21
|
-
}) => void;
|
|
22
|
-
/** Default 10000 ms per Step 2b directive (must not drop below ~3000
|
|
23
|
-
* for normal commands). doctor uses its own 3000 ms one-shot fetch. */
|
|
24
|
-
readonly baseTimeoutMs?: number;
|
|
25
|
-
/** Optional bridge service manager overrides for tests and controlled installs. */
|
|
26
|
-
readonly bridgeService?: BridgeServiceDeps;
|
|
27
|
-
}
|
|
28
|
-
export interface HandlerArgs {
|
|
29
|
-
/** Positional argv with the command (and subcommand for `agent`/`daily`)
|
|
30
|
-
* already stripped by the dispatcher in main.ts. */
|
|
31
|
-
readonly positional: readonly string[];
|
|
32
|
-
/** All globally-known flags merged from the single argv pass. */
|
|
33
|
-
readonly flags: Readonly<Record<string, string | number | boolean>>;
|
|
34
|
-
/** True when `--json` was set (any position — floating flag, rev2 fix #1). */
|
|
35
|
-
readonly jsonMode: boolean;
|
|
36
|
-
}
|
|
37
|
-
/** Build a controlClient that lazily reads token+port from the daemon
|
|
38
|
-
* files. version / doctor / Tier B/C stubs do NOT call this. */
|
|
39
|
-
export declare function makeClient(env: HandlerEnv, extra?: Partial<CreateControlClientOptions>): ControlClient;
|
|
40
|
-
/** Centralised game enum for client-side validation (Risks #11 — CLI
|
|
41
|
-
* hard-codes the supported list rather than fetching from server, so a
|
|
42
|
-
* contract drift surfaces as a usage error rather than a daemon round
|
|
43
|
-
* trip). */
|
|
44
|
-
export declare const SUPPORTED_GAMES: ReadonlyArray<string>;
|
|
45
|
-
export declare function isSupportedGame(g: string): boolean;
|
|
46
|
-
/** Class for argv-parser-style usage errors that should map to exit 2.
|
|
47
|
-
* Distinct from AgentResolverError (which uses its own kind discriminator). */
|
|
48
|
-
export declare class UsageError extends Error {
|
|
49
|
-
readonly name = "UsageError";
|
|
50
|
-
readonly hint?: string;
|
|
51
|
-
constructor(message: string, hint?: string);
|
|
52
|
-
}
|
|
53
|
-
/** Expected runtime/API failures that should be shown as ordinary command
|
|
54
|
-
* errors (exit 1), not catchall programmer failures (exit 99). */
|
|
55
|
-
export declare class CommandError extends Error {
|
|
56
|
-
readonly name = "CommandError";
|
|
57
|
-
readonly code: string;
|
|
58
|
-
readonly exitCode: number;
|
|
59
|
-
readonly hint?: string;
|
|
60
|
-
constructor(code: string, message: string, opts?: {
|
|
61
|
-
readonly exitCode?: number;
|
|
62
|
-
readonly hint?: string;
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
/** Step 3b — assert positional arity at the top of every handler BEFORE
|
|
66
|
-
* any side-effect (controlClient / network / fs). Extra positionals
|
|
67
|
-
* must NOT silently fall through to a successful POST (e.g.
|
|
68
|
-
* `aifight shutdown anything` previously still POSTed /v1/shutdown).
|
|
69
|
-
*
|
|
70
|
-
* Throws UsageError → main.ts funnel maps to exit 2 + usage hint.
|
|
71
|
-
* No-args handlers call `expectArity(args, 0, 0, "...")`;
|
|
72
|
-
* optional-arg handlers (e.g. agent status [<name>]) use min=0 max=1;
|
|
73
|
-
* fixed-arity handlers (e.g. daily set <game> <count>) use min=max=N. */
|
|
74
|
-
export declare function expectArity(args: HandlerArgs, min: number, max: number, usage: string): void;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
export interface ProfileRouteDeps {
|
|
2
|
-
/**
|
|
3
|
-
* Resolve the on-disk directory for an agent slug.
|
|
4
|
-
* Defaults to resolveAgentDir from profile-loader.
|
|
5
|
-
*/
|
|
6
|
-
resolveAgentDir?: (slug: string) => string;
|
|
7
|
-
/**
|
|
8
|
-
* List session IDs for an agent from the daemon's active state.
|
|
9
|
-
* Returns [] when the daemon has no state for this slug or the function
|
|
10
|
-
* is not wired (stubs for CLI-only deployments).
|
|
11
|
-
*/
|
|
12
|
-
listSessions?: (agentSlug: string) => SessionSummary[];
|
|
13
|
-
/**
|
|
14
|
-
* Fetch a single session summary by sessionId.
|
|
15
|
-
* Returns null when the session is not found.
|
|
16
|
-
*/
|
|
17
|
-
getSessionSummary?: (sessionId: string) => SessionSummary | null;
|
|
18
|
-
}
|
|
19
|
-
export interface SessionSummary {
|
|
20
|
-
readonly sessionId: string;
|
|
21
|
-
readonly agentSlug: string;
|
|
22
|
-
readonly game: string;
|
|
23
|
-
readonly startedAt: number;
|
|
24
|
-
readonly endedAt?: number;
|
|
25
|
-
readonly outcome?: "win" | "loss" | "draw" | "forfeit" | string;
|
|
26
|
-
readonly ratingDelta?: number;
|
|
27
|
-
}
|
|
28
|
-
export interface ProfileHandlerContext {
|
|
29
|
-
readonly params: Readonly<Record<string, string>>;
|
|
30
|
-
readonly body: unknown;
|
|
31
|
-
}
|
|
32
|
-
export interface ProfileRouteResult {
|
|
33
|
-
readonly status: number;
|
|
34
|
-
readonly body: unknown;
|
|
35
|
-
}
|
|
36
|
-
declare class ProfileRouteError extends Error {
|
|
37
|
-
readonly name = "ProfileRouteError";
|
|
38
|
-
readonly status: number;
|
|
39
|
-
readonly code: string;
|
|
40
|
-
readonly details?: Record<string, unknown>;
|
|
41
|
-
constructor(status: number, code: string, message: string, details?: Record<string, unknown>);
|
|
42
|
-
}
|
|
43
|
-
export interface ProfileRoute {
|
|
44
|
-
readonly method: "GET" | "POST";
|
|
45
|
-
readonly path: string;
|
|
46
|
-
readonly handle: (ctx: ProfileHandlerContext) => Promise<ProfileRouteResult>;
|
|
47
|
-
}
|
|
48
|
-
export declare function createProfileRoutes(deps?: ProfileRouteDeps): ProfileRoute[];
|
|
49
|
-
export { ProfileRouteError };
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import type { AgentInstanceSnapshot } from "../agents/agent";
|
|
2
|
-
import type { DailyScheduler } from "../scheduler/daily";
|
|
3
|
-
import type { DailyScheduleConfig } from "../scheduler/types";
|
|
4
|
-
export interface ControlAgentHandle {
|
|
5
|
-
snapshot(): AgentInstanceSnapshot;
|
|
6
|
-
}
|
|
7
|
-
export interface ControlJoinQueueOptions {
|
|
8
|
-
readonly oneShot?: boolean;
|
|
9
|
-
readonly count?: number;
|
|
10
|
-
}
|
|
11
|
-
export interface ControlRouterTarget {
|
|
12
|
-
listAgents(): readonly AgentInstanceSnapshot[];
|
|
13
|
-
/** Throws RouterAgentNotFoundError when no agent matches. Handler
|
|
14
|
-
* catches by `error.kind === "router_agent_not_found"` (duck-typed,
|
|
15
|
-
* no instanceof) and maps to HTTP 404. Other RouterError kinds map
|
|
16
|
-
* to 500 internal_error. */
|
|
17
|
-
getAgent(selector: {
|
|
18
|
-
readonly name: string;
|
|
19
|
-
}): ControlAgentHandle;
|
|
20
|
-
joinQueue(selector: {
|
|
21
|
-
readonly name: string;
|
|
22
|
-
}, game: string, mode?: string, opts?: ControlJoinQueueOptions): void;
|
|
23
|
-
leaveQueue(selector: {
|
|
24
|
-
readonly name: string;
|
|
25
|
-
}): void;
|
|
26
|
-
}
|
|
27
|
-
export type ControlLogLevel = "info" | "warn" | "error";
|
|
28
|
-
export type ControlLogCode = "server_listening" | "server_closed" | "request_received" | "request_completed" | "auth_failed" | "handler_threw" | "shutdown_requested";
|
|
29
|
-
export interface ControlLogEvent {
|
|
30
|
-
readonly level: ControlLogLevel;
|
|
31
|
-
readonly code: ControlLogCode;
|
|
32
|
-
readonly message: string;
|
|
33
|
-
readonly method?: string;
|
|
34
|
-
readonly path?: string;
|
|
35
|
-
readonly status?: number;
|
|
36
|
-
readonly durationMs?: number;
|
|
37
|
-
readonly host?: string;
|
|
38
|
-
readonly port?: number;
|
|
39
|
-
/** auth_failed: missing_header | invalid_format | token_mismatch | token_unset */
|
|
40
|
-
readonly reason?: string;
|
|
41
|
-
readonly cause?: unknown;
|
|
42
|
-
}
|
|
43
|
-
export interface ControlServerOptions {
|
|
44
|
-
/** Default "127.0.0.1". server binds 127.0.0.1 only — no remote
|
|
45
|
-
* exposure path in M1; TLS / remote access is M5+ scope. */
|
|
46
|
-
readonly host?: string;
|
|
47
|
-
/** Default 0 → OS picks an unused port; resolve via address(). */
|
|
48
|
-
readonly port?: number;
|
|
49
|
-
/** Sync, called per request to fetch the currently-valid Bearer
|
|
50
|
-
* token. Returning null → 401 token_unset (daemon has not generated
|
|
51
|
-
* the token file yet, or rotated it). M1-18 daemon lifecycle wires
|
|
52
|
-
* this to a cached token-file reader. */
|
|
53
|
-
readonly tokenSource: () => string | null;
|
|
54
|
-
readonly router: ControlRouterTarget;
|
|
55
|
-
/** agent name → that agent's DailyScheduler. Returning null →
|
|
56
|
-
* schedule endpoint returns 404 not_found (rev3 fix #2 —
|
|
57
|
-
* resolveScheduler helper enforces). */
|
|
58
|
-
readonly schedulerLookup?: (agentName: string) => DailyScheduler | null;
|
|
59
|
-
/** rev2 fix #4 — daemon source-of-truth current cfg reader. Used by
|
|
60
|
-
* GET /schedule + POST /pause + POST /resume when the server's
|
|
61
|
-
* internal lastSetSchedules cache misses (e.g. first POST /pause
|
|
62
|
-
* after daemon startup with strategy.json initial schedule). May
|
|
63
|
-
* return null when the agent has no configured schedule yet. */
|
|
64
|
-
readonly scheduleConfigLookup?: (agentName: string) => DailyScheduleConfig | null;
|
|
65
|
-
/** rev4 fix — daemon graceful stop callback. May return void or
|
|
66
|
-
* Promise<void>. The server calls it via:
|
|
67
|
-
* setImmediate(() => {
|
|
68
|
-
* Promise.resolve()
|
|
69
|
-
* .then(() => opts.onShutdown?.())
|
|
70
|
-
* .catch((cause) => safeLog({code:"handler_threw", level:"error", cause, ...}));
|
|
71
|
-
* });
|
|
72
|
-
* so neither a synchronous throw NOR a rejected Promise can escape
|
|
73
|
-
* as an unhandled rejection — both are funnelled through .catch
|
|
74
|
-
* into safeLog. The client has already received the 200 response by
|
|
75
|
-
* then, and the failure is logged via onLog without crashing the
|
|
76
|
-
* server.
|
|
77
|
-
*
|
|
78
|
-
* rev3 wrote this as `Promise.resolve(opts.onShutdown?.()).catch(...)`
|
|
79
|
-
* which only caught async rejections — a synchronous throw escaped
|
|
80
|
-
* the setImmediate callback because `opts.onShutdown?.()` is
|
|
81
|
-
* evaluated BEFORE `Promise.resolve(...)` runs, so the throw never
|
|
82
|
-
* reaches Promise.resolve at all. The corrected `.then(() => ...)`
|
|
83
|
-
* shape relies on the standard Promise behavior that any throw
|
|
84
|
-
* inside a `.then` callback is automatically converted to a
|
|
85
|
-
* rejected Promise (and any returned rejected Promise is propagated),
|
|
86
|
-
* so `.catch` reliably covers both shapes with one path. */
|
|
87
|
-
readonly onShutdown?: () => Promise<void> | void;
|
|
88
|
-
/** Called on lifecycle / request / auth events. Wrapped via safeLog
|
|
89
|
-
* internally; throws are swallowed so a faulty logger cannot crash
|
|
90
|
-
* the server (matches M1-15 onNotify pattern). */
|
|
91
|
-
readonly onLog?: (event: ControlLogEvent) => void;
|
|
92
|
-
/** Default 1_048_576 (1 MiB). parseJsonBody aborts and returns 413
|
|
93
|
-
* payload_too_large past this; rev3 fix #4 requires the 413
|
|
94
|
-
* response to be flushed BEFORE any best-effort req.destroy(),
|
|
95
|
-
* so the client receives an HTTP 413 rather than ECONNRESET. */
|
|
96
|
-
readonly bodyLimitBytes?: number;
|
|
97
|
-
/** Defaults to a Date.now-backed clock; injectable for tests
|
|
98
|
-
* (matches M1-15 SchedulerClock pattern). */
|
|
99
|
-
readonly clock?: {
|
|
100
|
-
readonly now: () => number;
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
export interface ControlServerAddress {
|
|
104
|
-
readonly host: string;
|
|
105
|
-
readonly port: number;
|
|
106
|
-
}
|
|
107
|
-
export interface ControlServer {
|
|
108
|
-
/** Bind host:port and resolve with the actual bound port. Throws
|
|
109
|
-
* ControlServerError("invalid_state") when called twice or after
|
|
110
|
-
* close(); rejects with ControlServerError("bind_failed") when
|
|
111
|
-
* the OS rejects the bind (EADDRINUSE / EACCES / ...). */
|
|
112
|
-
listen(): Promise<number>;
|
|
113
|
-
/** Sync; returns null when the server has not yet listened. */
|
|
114
|
-
address(): ControlServerAddress | null;
|
|
115
|
-
/** Drain in-flight requests then close. Idempotent: pre-listen and
|
|
116
|
-
* post-close calls resolve as no-ops. 5-second grace before forcing
|
|
117
|
-
* remaining sockets shut via http.Server.closeAllConnections (Node
|
|
118
|
-
* 18.2+). */
|
|
119
|
-
close(): Promise<void>;
|
|
120
|
-
}
|
|
121
|
-
export type ControlServerErrorKind = "invalid_state" | "bind_failed";
|
|
122
|
-
export declare class ControlServerError extends Error {
|
|
123
|
-
readonly name = "ControlServerError";
|
|
124
|
-
readonly kind: ControlServerErrorKind;
|
|
125
|
-
readonly cause: unknown;
|
|
126
|
-
constructor(kind: ControlServerErrorKind, message: string, cause?: unknown);
|
|
127
|
-
}
|
|
128
|
-
export type ControlErrorCode = "unauthorized" | "not_found" | "method_not_allowed" | "bad_request" | "unsupported_media_type" | "payload_too_large" | "not_implemented" | "service_unavailable" | "internal_error";
|
|
129
|
-
export interface ControlErrorBody {
|
|
130
|
-
readonly error: {
|
|
131
|
-
readonly code: ControlErrorCode;
|
|
132
|
-
readonly message: string;
|
|
133
|
-
readonly details?: Readonly<Record<string, unknown>>;
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
export type { DailyScheduler, DailyScheduleConfig };
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { AgentDecisionProvider } from "../agents/agent";
|
|
2
|
-
import type { ReconnectingWSClient, ReconnectingWSClientOptions } from "../wsclient/reconnect";
|
|
3
|
-
import type { DecisionProvider } from "../decision/provider";
|
|
4
|
-
import type { GameType, StrategyProfile } from "../decision/types";
|
|
5
|
-
export interface GameStartCacheEntry {
|
|
6
|
-
readonly game: GameType;
|
|
7
|
-
readonly playerId: string;
|
|
8
|
-
readonly rules: unknown;
|
|
9
|
-
}
|
|
10
|
-
export type GameStartCache = Map<string, GameStartCacheEntry>;
|
|
11
|
-
export declare function createGameStartCache(): GameStartCache;
|
|
12
|
-
export type ReconnectFactory = (opts: ReconnectingWSClientOptions) => Promise<ReconnectingWSClient>;
|
|
13
|
-
/**
|
|
14
|
-
* Builds a `connect` factory for `AgentInstanceOptions.connect`. It
|
|
15
|
-
* delegates to `createReconnectingWSClient(opts)` (or a caller-supplied
|
|
16
|
-
* factory for tests), then attaches a sidecar `client.onMessage` handler
|
|
17
|
-
* that snoops `game_start` envelopes and caches the immutable
|
|
18
|
-
* per-match metadata adapter.decide() needs later.
|
|
19
|
-
*
|
|
20
|
-
* The sidecar does NOT consume the message — wsclient still delivers it
|
|
21
|
-
* to the AgentInstance's own onMessage handler in parallel (M1-06
|
|
22
|
-
* sealed multi-handler API).
|
|
23
|
-
*/
|
|
24
|
-
export declare function buildConnectWithGameStartCache(cache: GameStartCache, factory?: ReconnectFactory): (opts: ReconnectingWSClientOptions) => Promise<ReconnectingWSClient>;
|
|
25
|
-
export declare class AgentDecisionBridgeError extends Error {
|
|
26
|
-
readonly name = "AgentDecisionBridgeError";
|
|
27
|
-
readonly code: "missing_game_start_metadata";
|
|
28
|
-
readonly matchId: string;
|
|
29
|
-
constructor(matchId: string, message: string);
|
|
30
|
-
}
|
|
31
|
-
export interface BuildAgentDecisionAdapterOptions {
|
|
32
|
-
readonly provider: DecisionProvider;
|
|
33
|
-
readonly strategyProfile: StrategyProfile;
|
|
34
|
-
readonly cache: GameStartCache;
|
|
35
|
-
/** Subtracted from action_request.timeout_ms to derive the
|
|
36
|
-
* decisionBudgetMs passed to M1-14 provider. Default 5000 ms. */
|
|
37
|
-
readonly decisionBudgetSafetyMs?: number;
|
|
38
|
-
}
|
|
39
|
-
export declare function buildAgentDecisionAdapter(opts: BuildAgentDecisionAdapterOptions): AgentDecisionProvider;
|
|
40
|
-
export declare function buildLlmApiKeyResolver(agentName: string): (provider: string, model: string) => string;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { type AgentRow } from "../store/sqlite";
|
|
2
|
-
import type { DailyScheduleConfig } from "../scheduler/types";
|
|
3
|
-
import { type ControlLogEvent } from "../controlapi/types";
|
|
4
|
-
import type { StrategyProfile } from "../decision/types";
|
|
5
|
-
import { buildConnectWithGameStartCache } from "./agent-decision-adapter";
|
|
6
|
-
export interface DaemonOptions {
|
|
7
|
-
/** Default "127.0.0.1". Plan ADR-013 locks to loopback in M1; daemon
|
|
8
|
-
* validates in cli/commands/serve.ts (Step 3 wires --host argv). */
|
|
9
|
-
readonly host?: string;
|
|
10
|
-
/** Default 0 — OS picks an unused port. Resolved bound port surfaces
|
|
11
|
-
* on `DaemonHandle.bound.port`. */
|
|
12
|
-
readonly port?: number;
|
|
13
|
-
readonly onLog?: (event: DaemonLogEvent) => void;
|
|
14
|
-
readonly testHooks?: DaemonTestHooks;
|
|
15
|
-
}
|
|
16
|
-
export type DaemonLogLevel = "info" | "warn" | "error";
|
|
17
|
-
export type DaemonLogCode = "lock_acquired" | "agents_loaded" | "control_server_listening" | "runtime_files_written" | "daemon_ready" | "signal_received" | "shutdown_initiated" | "shutdown_completed" | "shutdown_forced" | "agent_load_failed" | "agent_skipped_turn" | "control_server_proxy" | "lock_release_failed" | "tmp_cleanup_failed";
|
|
18
|
-
export interface DaemonLogEvent {
|
|
19
|
-
readonly level: DaemonLogLevel;
|
|
20
|
-
readonly code: DaemonLogCode;
|
|
21
|
-
readonly message: string;
|
|
22
|
-
readonly cause?: unknown;
|
|
23
|
-
/** Only set when `code === "control_server_proxy"` — forwarded
|
|
24
|
-
* M1-16 ControlLogEvent payload. */
|
|
25
|
-
readonly controlEvent?: ControlLogEvent;
|
|
26
|
-
}
|
|
27
|
-
export interface DaemonTestHooks {
|
|
28
|
-
/** Override timer functions (force-exit timer, etc). */
|
|
29
|
-
readonly setTimeout?: typeof globalThis.setTimeout;
|
|
30
|
-
readonly clearTimeout?: typeof globalThis.clearTimeout;
|
|
31
|
-
/** Override process.on signal subscription. Default attaches to
|
|
32
|
-
* process; tests inject a fake emitter so signals can be simulated
|
|
33
|
-
* without sending real SIGINT to the test runner. The returned
|
|
34
|
-
* function detaches the listener. */
|
|
35
|
-
readonly onSignal?: (sig: NodeJS.Signals, listener: () => void) => () => void;
|
|
36
|
-
/** Override `process.exit`. Production path uses `process.exit`;
|
|
37
|
-
* tests inject a recorder so the test runner is never killed. Used
|
|
38
|
-
* only on force-exit / second-signal paths (rev3 fix #3). */
|
|
39
|
-
readonly exit?: (code: number) => void;
|
|
40
|
-
/** Override agent row loading. Production reads SQLite via
|
|
41
|
-
* openDatabase().listAgents(). Tests inject fixtures without a real
|
|
42
|
-
* DB. */
|
|
43
|
-
readonly loadAgents?: () => readonly AgentRow[];
|
|
44
|
-
/** Override strategy profile loading. Production reads
|
|
45
|
-
* `getRuntimeHome()/agents/<name>/strategy.json` (post-Step-2 path
|
|
46
|
-
* detail; Step 2 minimum is testHook-driven and tests inject
|
|
47
|
-
* fixtures). Throw to trigger per-agent skip. */
|
|
48
|
-
readonly loadStrategy?: (agentName: string) => StrategyProfile;
|
|
49
|
-
/** Override daily-schedule config loading. Returning null = no
|
|
50
|
-
* scheduler. */
|
|
51
|
-
readonly loadDailyConfig?: (agentName: string) => DailyScheduleConfig | null;
|
|
52
|
-
/** Override `os.platform()` for case 26 (Windows SIGTERM omission). */
|
|
53
|
-
readonly platform?: NodeJS.Platform;
|
|
54
|
-
/** Override the wsclient connect factory used by AgentInstance.
|
|
55
|
-
* Default = `createReconnectingWSClient` from M1-07. Tests inject
|
|
56
|
-
* to capture wsclient options (asserts apiKey === platformKey, etc)
|
|
57
|
-
* without opening a real socket. */
|
|
58
|
-
readonly wsConnectFactory?: Parameters<typeof buildConnectWithGameStartCache>[1];
|
|
59
|
-
/** Force-exit timeout in ms. Default 30000 (TED 拍板点 #7).
|
|
60
|
-
* Tests use a small value (e.g. 50ms) to validate timeout behavior
|
|
61
|
-
* without making the suite slow. */
|
|
62
|
-
readonly forceExitTimeoutMs?: number;
|
|
63
|
-
}
|
|
64
|
-
export type ShutdownReason = {
|
|
65
|
-
readonly source: "signal";
|
|
66
|
-
readonly signal: NodeJS.Signals;
|
|
67
|
-
} | {
|
|
68
|
-
readonly source: "control_api";
|
|
69
|
-
} | {
|
|
70
|
-
readonly source: "startup_failure";
|
|
71
|
-
readonly cause: unknown;
|
|
72
|
-
};
|
|
73
|
-
export interface DaemonHandle {
|
|
74
|
-
readonly bound: {
|
|
75
|
-
readonly host: string;
|
|
76
|
-
readonly port: number;
|
|
77
|
-
};
|
|
78
|
-
/** Idempotent — second call returns the same promise as the first. */
|
|
79
|
-
requestShutdown(reason: ShutdownReason): Promise<number>;
|
|
80
|
-
/** Long-lived completion. Resolves with the final exit code; never
|
|
81
|
-
* rejects. runServe() awaits this to keep the foreground process
|
|
82
|
-
* alive (rev2 fix #1). */
|
|
83
|
-
readonly closed: Promise<number>;
|
|
84
|
-
}
|
|
85
|
-
export declare function startDaemon(opts?: DaemonOptions): Promise<DaemonHandle>;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import type { AgentInstanceSnapshot } from "../agents/agent";
|
|
2
|
-
export interface RouterAgentConfig {
|
|
3
|
-
readonly name: string;
|
|
4
|
-
readonly id?: string;
|
|
5
|
-
readonly enabled?: boolean;
|
|
6
|
-
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
7
|
-
}
|
|
8
|
-
export interface RouterAgentRuntime {
|
|
9
|
-
start(): Promise<AgentInstanceSnapshot>;
|
|
10
|
-
stop(reason?: string): Promise<void>;
|
|
11
|
-
joinQueue(game: string, mode?: string, opts?: {
|
|
12
|
-
readonly oneShot?: boolean;
|
|
13
|
-
readonly count?: number;
|
|
14
|
-
}): void;
|
|
15
|
-
leaveQueue(): void;
|
|
16
|
-
confirmMatch(confirmId?: string): void;
|
|
17
|
-
snapshot(): AgentInstanceSnapshot;
|
|
18
|
-
onState(handler: (snapshot: AgentInstanceSnapshot) => void): () => void;
|
|
19
|
-
}
|
|
20
|
-
export type RouterAgentFactory = (config: RouterAgentConfig) => RouterAgentRuntime;
|
|
21
|
-
export type RouterAgentSelector = string | {
|
|
22
|
-
readonly name?: string;
|
|
23
|
-
readonly id?: string;
|
|
24
|
-
};
|
|
25
|
-
export interface RouterSnapshot {
|
|
26
|
-
readonly agents: readonly AgentInstanceSnapshot[];
|
|
27
|
-
}
|
|
28
|
-
export interface MultiAgentRouterOptions {
|
|
29
|
-
readonly agents?: readonly RouterAgentConfig[];
|
|
30
|
-
readonly agentFactory: RouterAgentFactory;
|
|
31
|
-
readonly onNotify?: (event: RouterNotifyEvent) => void;
|
|
32
|
-
}
|
|
33
|
-
export interface RouterNotifyEvent {
|
|
34
|
-
readonly level: "info" | "warning" | "error";
|
|
35
|
-
readonly code: string;
|
|
36
|
-
readonly message: string;
|
|
37
|
-
readonly agent?: string;
|
|
38
|
-
readonly cause?: unknown;
|
|
39
|
-
}
|
|
40
|
-
export type RouterErrorKind = "router_duplicate_agent" | "router_agent_not_found" | "router_selector_mismatch" | "router_agent_factory" | "router_agent_lifecycle";
|
|
41
|
-
export declare abstract class RouterError extends Error {
|
|
42
|
-
abstract readonly kind: RouterErrorKind;
|
|
43
|
-
readonly cause: unknown;
|
|
44
|
-
protected constructor(message: string, cause?: unknown);
|
|
45
|
-
}
|
|
46
|
-
export declare class RouterDuplicateAgentError extends RouterError {
|
|
47
|
-
readonly name = "RouterDuplicateAgentError";
|
|
48
|
-
readonly kind: "router_duplicate_agent";
|
|
49
|
-
readonly field: "name" | "id";
|
|
50
|
-
readonly value: string;
|
|
51
|
-
constructor(field: "name" | "id", value: string);
|
|
52
|
-
}
|
|
53
|
-
export declare class RouterAgentNotFoundError extends RouterError {
|
|
54
|
-
readonly name = "RouterAgentNotFoundError";
|
|
55
|
-
readonly kind: "router_agent_not_found";
|
|
56
|
-
readonly selector: RouterAgentSelector;
|
|
57
|
-
constructor(selector: RouterAgentSelector);
|
|
58
|
-
}
|
|
59
|
-
export declare class RouterSelectorMismatchError extends RouterError {
|
|
60
|
-
readonly name = "RouterSelectorMismatchError";
|
|
61
|
-
readonly kind: "router_selector_mismatch";
|
|
62
|
-
readonly nameSelector: string;
|
|
63
|
-
readonly idSelector: string;
|
|
64
|
-
constructor(nameSelector: string, idSelector: string);
|
|
65
|
-
}
|
|
66
|
-
export declare class RouterAgentFactoryError extends RouterError {
|
|
67
|
-
readonly name = "RouterAgentFactoryError";
|
|
68
|
-
readonly kind: "router_agent_factory";
|
|
69
|
-
readonly agentName: string;
|
|
70
|
-
constructor(agentName: string, cause: unknown);
|
|
71
|
-
}
|
|
72
|
-
export declare class RouterAgentLifecycleError extends RouterError {
|
|
73
|
-
readonly name = "RouterAgentLifecycleError";
|
|
74
|
-
readonly kind: "router_agent_lifecycle";
|
|
75
|
-
readonly agentName: string;
|
|
76
|
-
readonly operation: "start" | "stop" | "remove";
|
|
77
|
-
constructor(agentName: string, operation: "start" | "stop" | "remove", cause: unknown);
|
|
78
|
-
}
|
|
79
|
-
export declare class MultiAgentRouter {
|
|
80
|
-
#private;
|
|
81
|
-
constructor(opts: MultiAgentRouterOptions);
|
|
82
|
-
addAgent(config: RouterAgentConfig): void;
|
|
83
|
-
removeAgent(selector: RouterAgentSelector): Promise<void>;
|
|
84
|
-
getAgent(selector: RouterAgentSelector): RouterAgentRuntime;
|
|
85
|
-
listAgents(): readonly AgentInstanceSnapshot[];
|
|
86
|
-
snapshot(): RouterSnapshot;
|
|
87
|
-
startAgent(selector: RouterAgentSelector): Promise<AgentInstanceSnapshot>;
|
|
88
|
-
stopAgent(selector: RouterAgentSelector, reason?: string): Promise<void>;
|
|
89
|
-
startAll(): Promise<RouterSnapshot>;
|
|
90
|
-
stopAll(reason?: string): Promise<void>;
|
|
91
|
-
joinQueue(selector: RouterAgentSelector, game: string, mode?: string, opts?: {
|
|
92
|
-
readonly oneShot?: boolean;
|
|
93
|
-
readonly count?: number;
|
|
94
|
-
}): void;
|
|
95
|
-
leaveQueue(selector: RouterAgentSelector): void;
|
|
96
|
-
confirmMatch(selector: RouterAgentSelector, confirmId?: string): void;
|
|
97
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
export type RuntimeFilesWriteErrorKind = "write_failed" | "lock_held_by_other" | "lock_acquire_failed";
|
|
2
|
-
export declare class RuntimeFilesWriteError extends Error {
|
|
3
|
-
readonly name = "RuntimeFilesWriteError";
|
|
4
|
-
readonly kind: RuntimeFilesWriteErrorKind;
|
|
5
|
-
readonly filePath: string;
|
|
6
|
-
/** Set when kind === "lock_held_by_other"; the holding process's PID
|
|
7
|
-
* as recorded in the pid file. Caller maps to exit-6 + user message. */
|
|
8
|
-
readonly heldByPid?: number;
|
|
9
|
-
readonly cause?: unknown;
|
|
10
|
-
constructor(kind: RuntimeFilesWriteErrorKind, filePath: string, message: string, init?: {
|
|
11
|
-
heldByPid?: number;
|
|
12
|
-
cause?: unknown;
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
/** Generates a fresh 64-char hex token (32 random bytes encoded). */
|
|
16
|
-
export declare function generateToken(): string;
|
|
17
|
-
/** Atomic write: token file at `getRuntimeHome()/token` mode 0600.
|
|
18
|
-
* Internal: writes to `<path>.<pid>.<counter>.tmp` then `fs.renameSync`.
|
|
19
|
-
* Asserts token matches /^[0-9a-f]{64}$/ before write (TED Q2 — hex
|
|
20
|
-
* literal assertion to defeat future regressions that swap the random
|
|
21
|
-
* source for one emitting non-printable bytes / mixed case). */
|
|
22
|
-
export declare function writeToken(token: string): void;
|
|
23
|
-
/** Atomic write: port file at `getRuntimeHome()/port` mode 0644.
|
|
24
|
-
* Content = `String(port)` no trailing newline. Range checked
|
|
25
|
-
* [1, 65535] (matches M1-17 read-side validator). */
|
|
26
|
-
export declare function writePort(port: number): void;
|
|
27
|
-
/** Atomic write: pid file at `getRuntimeHome()/pid` mode 0644.
|
|
28
|
-
* Content = `String(pid)` no trailing newline. */
|
|
29
|
-
export declare function writePid(pid: number): void;
|
|
30
|
-
/** Best-effort unlink of token + port + pid files on graceful shutdown.
|
|
31
|
-
* ENOENT is silent (file already gone). Other failures only log via
|
|
32
|
-
* onLog so shutdown sequence never throws on cleanup. */
|
|
33
|
-
export declare function unlinkRuntimeFiles(opts: {
|
|
34
|
-
onLog?: (msg: string) => void;
|
|
35
|
-
}): void;
|
|
36
|
-
/** Cleans up `*.tmp` files in `getRuntimeHome()` left over from a
|
|
37
|
-
* previous daemon crash. Called once at startup before any write.
|
|
38
|
-
* Failures silent — best-effort only. */
|
|
39
|
-
export declare function cleanupStaleTmpFiles(): void;
|
|
40
|
-
export interface LockHandle {
|
|
41
|
-
/** Releases lock + unlinks lock file. Idempotent — second call no-op. */
|
|
42
|
-
release(): void;
|
|
43
|
-
}
|
|
44
|
-
export interface AcquireDaemonLockOptions {
|
|
45
|
-
/** Override `process.kill(pid, 0)` liveness probe for tests. Default
|
|
46
|
-
* uses `process.kill(pid, 0)` and treats EPERM (cross-user, can't
|
|
47
|
-
* signal) as `true` (alive) so we never overwrite a foreign daemon's
|
|
48
|
-
* lock — TED 拍板点 #6 + Group 2 case 17 "EPERM 不能确认 → safe
|
|
49
|
-
* 保留". Production callers omit this option. */
|
|
50
|
-
readonly processIsAlive?: (pid: number) => boolean;
|
|
51
|
-
}
|
|
52
|
-
/** Acquire exclusive lock at `getRuntimeHome()/lock` (`O_EXCL` create).
|
|
53
|
-
*
|
|
54
|
-
* Outcomes when the lock file already exists (EEXIST):
|
|
55
|
-
* - **valid pid + alive (per probe)** → throw `lock_held_by_other`
|
|
56
|
-
* with `heldByPid` set; lock + pid files preserved.
|
|
57
|
-
* - **valid pid + dead** → STALE; clean lock + pid + retry once.
|
|
58
|
-
* - **pid file missing / corrupt content / read error** → AMBIGUOUS;
|
|
59
|
-
* throw `lock_acquire_failed`, **preserve lock + pid files**, do
|
|
60
|
-
* not invoke the liveness probe. This window is exactly when a
|
|
61
|
-
* racing daemon has just acquired the lock but has not yet written
|
|
62
|
-
* its pid (Step 2 startup order: `acquireDaemonLock()` then
|
|
63
|
-
* `writePid(process.pid)`); collapsing it into stale-cleanup would
|
|
64
|
-
* let daemon B steal daemon A's live lock and acquire its own
|
|
65
|
-
* (TED rev8 review-fix — multi-instance guarantee P1).
|
|
66
|
-
* - **stale-cleanup retry STILL races (EEXIST again)** → throw
|
|
67
|
-
* `lock_acquire_failed` (rare; another daemon snuck in between
|
|
68
|
-
* our unlink and our second openSync).
|
|
69
|
-
* - **non-EEXIST FS error on openSync** (permission denied, ENOSPC,
|
|
70
|
-
* etc.) → throw `lock_acquire_failed`.
|
|
71
|
-
* - **same process already holds this exact lock** → throw
|
|
72
|
-
* `lock_acquire_failed` (reentrancy guard, TED Group 2 case 19).
|
|
73
|
-
*
|
|
74
|
-
* Caller maps `lock_held_by_other` to exit 6 ("daemon already
|
|
75
|
-
* running"); `lock_acquire_failed` to exit 1 (TED 拍板点 #8). */
|
|
76
|
-
export declare function acquireDaemonLock(opts?: AcquireDaemonLockOptions): LockHandle;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import type { AgentIdentity } from "../profile/identity-schema.js";
|
|
2
|
-
export type PlatformEnvironment = "local" | "beta" | "prod";
|
|
3
|
-
export interface RegisterAgentOptions {
|
|
4
|
-
readonly agentSlug: string;
|
|
5
|
-
readonly displayName: string;
|
|
6
|
-
readonly model?: string;
|
|
7
|
-
readonly description?: string;
|
|
8
|
-
readonly environment: PlatformEnvironment;
|
|
9
|
-
readonly platformBaseURL: string;
|
|
10
|
-
readonly hostType?: string;
|
|
11
|
-
}
|
|
12
|
-
export interface RegisterAgentResult {
|
|
13
|
-
readonly agentId: string;
|
|
14
|
-
readonly apiKey: string;
|
|
15
|
-
readonly claimUrl?: string;
|
|
16
|
-
readonly claimToken?: string;
|
|
17
|
-
}
|
|
18
|
-
export interface IdentityStatus {
|
|
19
|
-
readonly agentSlug: string;
|
|
20
|
-
readonly hasIdentity: boolean;
|
|
21
|
-
readonly environment?: string;
|
|
22
|
-
readonly platformAgentId?: string;
|
|
23
|
-
readonly apiKeyAvailable: boolean;
|
|
24
|
-
}
|
|
25
|
-
export declare function getPlatformBaseURL(env: PlatformEnvironment): string;
|
|
26
|
-
/**
|
|
27
|
-
* Register a new agent on the AIFight platform and store identity locally.
|
|
28
|
-
*/
|
|
29
|
-
export declare function registerAgent(opts: RegisterAgentOptions): Promise<{
|
|
30
|
-
identity: AgentIdentity;
|
|
31
|
-
result: RegisterAgentResult;
|
|
32
|
-
}>;
|
|
33
|
-
/**
|
|
34
|
-
* Load identity.json for an agent slug.
|
|
35
|
-
*/
|
|
36
|
-
export declare function loadIdentity(agentSlug: string): Promise<AgentIdentity | null>;
|
|
37
|
-
/**
|
|
38
|
-
* Resolve the platform API key from identity's SecretRef.
|
|
39
|
-
*/
|
|
40
|
-
export declare function resolvePlatformApiKey(identity: AgentIdentity): Promise<string>;
|
|
41
|
-
/**
|
|
42
|
-
* Check identity status without resolving secrets.
|
|
43
|
-
*/
|
|
44
|
-
export declare function checkIdentityStatus(agentSlug: string): Promise<IdentityStatus>;
|
|
45
|
-
/**
|
|
46
|
-
* Verify platform identity by calling /api/agents/me/status.
|
|
47
|
-
*/
|
|
48
|
-
export declare function verifyPlatformIdentity(identity: AgentIdentity): Promise<{
|
|
49
|
-
verified: boolean;
|
|
50
|
-
agentId?: string;
|
|
51
|
-
isClaimed?: boolean;
|
|
52
|
-
error?: string;
|
|
53
|
-
}>;
|
|
54
|
-
/**
|
|
55
|
-
* Rotate the platform agent API key.
|
|
56
|
-
*/
|
|
57
|
-
export declare function rotatePlatformApiKey(agentSlug: string, ownerToken: string): Promise<{
|
|
58
|
-
newApiKey: string;
|
|
59
|
-
}>;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { LLMAdapter, LLMProtocol } from "./adapters/types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Register an adapter for a protocol. Overwrites any existing adapter
|
|
4
|
-
* for the same protocol (useful for testing).
|
|
5
|
-
*/
|
|
6
|
-
export declare function registerAdapter(adapter: LLMAdapter): void;
|
|
7
|
-
/**
|
|
8
|
-
* Get the adapter for a protocol. Returns undefined if not registered.
|
|
9
|
-
*/
|
|
10
|
-
export declare function getAdapter(protocol: LLMProtocol | string): LLMAdapter | undefined;
|
|
11
|
-
/**
|
|
12
|
-
* Get the adapter for a protocol, or throw if not registered.
|
|
13
|
-
*/
|
|
14
|
-
export declare function requireAdapter(protocol: LLMProtocol | string): LLMAdapter;
|
|
15
|
-
/**
|
|
16
|
-
* List all registered protocol names.
|
|
17
|
-
*/
|
|
18
|
-
export declare function listRegisteredProtocols(): string[];
|
|
19
|
-
/**
|
|
20
|
-
* Clear all registered adapters (for testing).
|
|
21
|
-
*/
|
|
22
|
-
export declare function clearAdapters(): void;
|
|
23
|
-
/**
|
|
24
|
-
* Register all built-in P0 adapters. Called at daemon startup.
|
|
25
|
-
* Lazy-imports adapters to keep the registry module lightweight.
|
|
26
|
-
*/
|
|
27
|
-
export declare function registerBuiltinAdapters(): Promise<void>;
|