@runuai/host 0.9.106 → 0.9.107
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/package.json +1 -1
- package/src/index.ts +11 -0
- package/src/main.ts +14 -0
- package/src/protocol.ts +10 -0
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -123,6 +123,7 @@ import {
|
|
|
123
123
|
renameEngineAccount,
|
|
124
124
|
reorderEngineAccounts,
|
|
125
125
|
} from "../lib/engine-accounts";
|
|
126
|
+
import { disconnectEngine } from "../lib/engines";
|
|
126
127
|
|
|
127
128
|
export {
|
|
128
129
|
parseMentions,
|
|
@@ -1271,6 +1272,16 @@ export const hostCommands: HostCommands = {
|
|
|
1271
1272
|
}
|
|
1272
1273
|
},
|
|
1273
1274
|
|
|
1275
|
+
async engineDisconnect(ctx, input) {
|
|
1276
|
+
logCommand(ctx, "engineDisconnect", input.engine);
|
|
1277
|
+
try {
|
|
1278
|
+
disconnectEngine(input.engine);
|
|
1279
|
+
return ok({ disconnected: true });
|
|
1280
|
+
} catch (err) {
|
|
1281
|
+
return failFromUnknown(err);
|
|
1282
|
+
}
|
|
1283
|
+
},
|
|
1284
|
+
|
|
1274
1285
|
async channelResolvePermission(ctx, taskId, agentId, requestId, decision) {
|
|
1275
1286
|
logCommand(ctx, "channelResolvePermission", taskId, agentId, requestId);
|
|
1276
1287
|
try {
|
package/src/main.ts
CHANGED
|
@@ -188,6 +188,7 @@ import {
|
|
|
188
188
|
HOST_ENGINE_CONNECT_PROTOCOL_FEATURE,
|
|
189
189
|
HOST_ENGINE_ACCOUNT_MANAGE_PROTOCOL_FEATURE,
|
|
190
190
|
HOST_ENGINE_ACCOUNT_SCOPES_PROTOCOL_FEATURE,
|
|
191
|
+
HOST_ENGINE_DISCONNECT_PROTOCOL_FEATURE,
|
|
191
192
|
HOST_ENGINE_LOGIN_PROTOCOL_FEATURE,
|
|
192
193
|
isEngineAccountScope,
|
|
193
194
|
HOST_LOGS_PROTOCOL_FEATURE,
|
|
@@ -232,6 +233,7 @@ import {
|
|
|
232
233
|
type FilesOpInput,
|
|
233
234
|
engineAccountScopeFromWire,
|
|
234
235
|
isEngineAccountLabel,
|
|
236
|
+
isEngineConnectKind,
|
|
235
237
|
} from "./protocol";
|
|
236
238
|
|
|
237
239
|
setContainerRuntimeOperationalCheck(() => containerRuntimeProblem() === null);
|
|
@@ -615,6 +617,7 @@ function buildCapabilities(): HostCapabilities {
|
|
|
615
617
|
HOST_ENGINE_CONNECT_PROTOCOL_FEATURE,
|
|
616
618
|
HOST_ENGINE_ACCOUNT_SCOPES_PROTOCOL_FEATURE,
|
|
617
619
|
HOST_ENGINE_ACCOUNT_MANAGE_PROTOCOL_FEATURE,
|
|
620
|
+
HOST_ENGINE_DISCONNECT_PROTOCOL_FEATURE,
|
|
618
621
|
// The echo adapter cannot execute the in-task CLI. Advertising typed
|
|
619
622
|
// dispatch in mock mode would let the composer create a Secretary that
|
|
620
623
|
// has no way to wake crew.
|
|
@@ -2465,6 +2468,16 @@ async function dispatchCommand(
|
|
|
2465
2468
|
if (reordered.ok) sendCapabilities();
|
|
2466
2469
|
return reordered;
|
|
2467
2470
|
}
|
|
2471
|
+
case "engineDisconnect": {
|
|
2472
|
+
const value = args[0];
|
|
2473
|
+
const engine = (value as { engine?: unknown } | undefined)?.engine;
|
|
2474
|
+
if (!isEngineConnectKind(engine)) {
|
|
2475
|
+
throw new Error("invalid command args: expected an engine kind at 0");
|
|
2476
|
+
}
|
|
2477
|
+
const result = await hostCommands.engineDisconnect(ctx, { engine });
|
|
2478
|
+
if (result.ok) sendCapabilities();
|
|
2479
|
+
return result;
|
|
2480
|
+
}
|
|
2468
2481
|
}
|
|
2469
2482
|
}
|
|
2470
2483
|
|
|
@@ -3050,6 +3063,7 @@ const HOST_COMMAND_NAMES = {
|
|
|
3050
3063
|
engineAccountRemove: true,
|
|
3051
3064
|
engineAccountRename: true,
|
|
3052
3065
|
engineAccountReorder: true,
|
|
3066
|
+
engineDisconnect: true,
|
|
3053
3067
|
} satisfies Record<keyof HostCommands, true>;
|
|
3054
3068
|
|
|
3055
3069
|
function isHostCommand(command: string): command is keyof HostCommands {
|
package/src/protocol.ts
CHANGED
|
@@ -113,6 +113,9 @@ export const HOST_ENGINE_CONNECT_PROTOCOL_FEATURE = "host-engine-connect-v1";
|
|
|
113
113
|
* `engineAccountReorder` commands; login `succeeded` events carry the created
|
|
114
114
|
* `accountId` for labeled captures; codex `awaiting_confirmation` carries the
|
|
115
115
|
* device `code`. Extras are advertised in priority order (position). */
|
|
116
|
+
/** Host 0.9.107: `engineDisconnect` — forget the HOST's own credential for an
|
|
117
|
+
* engine (the default slot: .env.local key / login file). Owner-only. */
|
|
118
|
+
export const HOST_ENGINE_DISCONNECT_PROTOCOL_FEATURE = "host-engine-disconnect-v1";
|
|
116
119
|
export const HOST_ENGINE_ACCOUNT_MANAGE_PROTOCOL_FEATURE =
|
|
117
120
|
"host-engine-account-manage-v1";
|
|
118
121
|
export const HOST_ENGINE_ACCOUNT_SCOPES_PROTOCOL_FEATURE =
|
|
@@ -1493,6 +1496,13 @@ export interface HostCommands {
|
|
|
1493
1496
|
ctx: CommandContext,
|
|
1494
1497
|
input: { kind: string; ids: string[]; scope?: string },
|
|
1495
1498
|
): Promise<HostCommandResult<{ reordered: boolean; message?: string }>>;
|
|
1499
|
+
/** Disconnect-v1: forget the host's DEFAULT credential for an engine — the
|
|
1500
|
+
* .env.local key and/or the login file the adapter detects. Extras are
|
|
1501
|
+
* untouched (remove them by id). Re-advertises on success. */
|
|
1502
|
+
engineDisconnect(
|
|
1503
|
+
ctx: CommandContext,
|
|
1504
|
+
input: { engine: EngineConnectKind },
|
|
1505
|
+
): Promise<HostCommandResult<{ disconnected: boolean; message?: string }>>;
|
|
1496
1506
|
cloneRepo(
|
|
1497
1507
|
ctx: CommandContext,
|
|
1498
1508
|
input: CloneRepoInput,
|