@byokit/openclaw 0.9.0 → 0.10.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/dist/engine.js CHANGED
@@ -2,12 +2,12 @@ import { spawn, spawnSync } from 'node:child_process';
2
2
  import { randomBytes, generateKeyPairSync, randomUUID } from 'node:crypto';
3
3
  import { closeSync, existsSync, mkdirSync, openSync, readFileSync, writeFileSync, copyFileSync, rmSync, realpathSync, statSync } from 'node:fs';
4
4
  import { createServer } from 'node:net';
5
- import { join, dirname } from 'node:path';
5
+ import { basename, join, dirname } from 'node:path';
6
6
  import { fileURLToPath } from 'node:url';
7
7
  import { setTimeout as delay } from 'node:timers/promises';
8
- import { AuthStore, AuthStoreUnreadableError } from "./auth-store.js";
8
+ import { AuthStore, AuthStoreUnreadableError, AuthStoreSealSizeError } from "./auth-store.js";
9
9
  import { EngineAlreadyRunningError, pidAlive, StartedProcesses } from "./engine-status.js";
10
- import { EnginePatchError, atomic, prepareEngineSet, processStartTime, readPatchSet, verifyEngineSet } from "./engine-patches.js";
10
+ import { EnginePatchError, atomic, prepareEngineSet, processStartTime, readPatchSet, sha256, verifyEngineSet } from "./engine-patches.js";
11
11
  import { ENGINE_VERSION } from "./constants.js";
12
12
  import { appendUsageBoot } from "./usage-boots.js";
13
13
  import { reconcileConfig, appRecoveryPrefixes } from "./config.js";
@@ -21,7 +21,11 @@ const putChanged = (path, data) => {
21
21
  };
22
22
  const supports = (list, value) => !list ||
23
23
  (!list.includes(`!${value}`) && (list.includes('any') || list.every(item => item.startsWith('!')) || list.includes(value)));
24
+ // First failed check of the most recent installMatches call; retained with the npm facts in
25
+ // <stateDir>/logs/engine-install-drift.json before the failed temp is deleted.
26
+ let installDrift;
24
27
  function installMatches(dir) {
28
+ installDrift = undefined;
25
29
  const manifests = ['package.json', 'package-lock.json'].map(file => ({
26
30
  path: join(dir, file), shipped: readFileSync(join(kitDir, 'engine', file)),
27
31
  }));
@@ -29,24 +33,37 @@ function installMatches(dir) {
29
33
  // npm omits optional binaries for other platforms (including the other Linux libc).
30
34
  const report = process.platform === 'linux' ? process.report.getReport() : undefined;
31
35
  const libc = report?.header.glibcVersionRuntime ? 'glibc' : process.platform === 'linux' ? 'musl' : '';
36
+ let reading = 'package.json';
32
37
  try {
33
- if (manifests.some(({ path, shipped }) => !readFileSync(path).equals(shipped)))
34
- return false;
38
+ for (const { path, shipped } of manifests) {
39
+ const installed = readFileSync(path);
40
+ if (!installed.equals(shipped)) {
41
+ installDrift = { setDir: dir, check: 'root-manifest', path: basename(path), expected: sha256(shipped), actual: sha256(installed) };
42
+ return false;
43
+ }
44
+ }
35
45
  for (const [path, pkg] of Object.entries(lock.packages)) {
36
46
  if (!path)
37
47
  continue; // The root manifest is checked byte for byte above.
38
48
  if (pkg.optional && (!supports(pkg.os, process.platform) || !supports(pkg.cpu, process.arch) || !supports(pkg.libc, libc)))
39
49
  continue;
40
- if (JSON.parse(readFileSync(join(dir, path, 'package.json'), 'utf8')).version !== pkg.version)
50
+ reading = `${path}/package.json`;
51
+ const version = JSON.parse(readFileSync(join(dir, path, 'package.json'), 'utf8')).version;
52
+ if (version !== pkg.version) {
53
+ installDrift = { setDir: dir, check: 'package-version', path, expected: pkg.version, actual: String(version) };
41
54
  return false;
55
+ }
42
56
  }
43
57
  return true;
44
58
  }
45
- catch {
59
+ catch (error) {
46
60
  // Missing or unreadable manifests and malformed installed package metadata need repair too.
61
+ installDrift = { setDir: dir, check: 'read', path: reading, readError: String(error.message).slice(0, 300) };
47
62
  return false;
48
63
  }
49
64
  }
65
+ export const refusedOnly = (error) => { if (error instanceof AuthStoreSealSizeError)
66
+ return error; throw error; };
50
67
  export class Engine {
51
68
  root;
52
69
  bridgeSock;
@@ -77,7 +94,32 @@ export class Engine {
77
94
  this.paramPrefix = bridge.paramPrefix;
78
95
  this.authStore = new AuthStore({ root: this.root, stateDir: o.stateDir, engineDir: this.dir, seal: o.authSeal, log: o.log });
79
96
  }
80
- state(phase, why, retryAt) { this.o.onState({ phase, ...(why ? { why } : {}), ...(retryAt ? { retryAt } : {}), ...(this.patchSet !== undefined ? { patchSet: this.patchSet } : {}) }); }
97
+ state(phase, why, retryAt, sealSize) { this.o.onState({ phase, ...(why ? { why } : {}), ...(retryAt ? { retryAt } : {}), ...(sealSize ? { sealSize } : {}), ...(this.patchSet !== undefined ? { patchSet: this.patchSet } : {}) }); }
98
+ // Retained at <stateDir>/logs/engine-install-drift.json (overwritten per failure) after the failed
99
+ // temporary set is deleted: the first failed check, the npm identity and the npm stderr tail.
100
+ // Bounded fields, no environment values or secrets; diagnostics never mask the failure they describe.
101
+ retainInstallDiagnostics(error, npmPath, npmStderrTail) {
102
+ try {
103
+ const npm = spawnSync(npmPath, ['--version'], { encoding: 'utf8', timeout: 5000 });
104
+ const drift = installDrift;
105
+ writeFileSync(join(this.o.stateDir, 'logs', 'engine-install-drift.json'), JSON.stringify({
106
+ at: new Date().toISOString(),
107
+ failedDir: error.file ?? null,
108
+ firstFailedCheck: drift && drift.setDir === error.file
109
+ ? { check: drift.check, path: drift.path, expected: drift.expected ?? null, actual: drift.actual ?? null, readError: drift.readError ?? null }
110
+ : null,
111
+ npm: { path: npmPath, version: npm.status === 0 && npm.stdout ? npm.stdout.trim().slice(0, 100) : null },
112
+ npmStderrTail: npmStderrTail.slice(0, 500),
113
+ }), { mode: 0o600 });
114
+ }
115
+ catch { /* diagnostics must never mask the failure being diagnosed */ }
116
+ }
117
+ exitedState(refused) {
118
+ if (refused instanceof AuthStoreSealSizeError)
119
+ this.state('failed', 'auth-store-seal-size', undefined, { size: refused.size, cap: refused.cap });
120
+ else
121
+ this.state('failed', 'exited');
122
+ }
81
123
  get entry() {
82
124
  if (this.o.spawnEngine && !this.setDir)
83
125
  throw new EnginePatchError('spec', 'engine-set');
@@ -104,6 +146,8 @@ export class Engine {
104
146
  }
105
147
  if (error instanceof AuthStoreUnreadableError)
106
148
  this.state('failed', 'auth-store-unreadable');
149
+ if (error instanceof AuthStoreSealSizeError)
150
+ this.exitedState(error);
107
151
  throw error;
108
152
  });
109
153
  this.prepared = pending;
@@ -129,12 +173,14 @@ export class Engine {
129
173
  if (this.o.spawnEngine) {
130
174
  const lock = JSON.parse(readFileSync(join(kitDir, 'engine/package-lock.json'), 'utf8'));
131
175
  const patches = readPatchSet(join(kitDir, 'engine/patches.json'), ENGINE_VERSION, lock.packages['node_modules/openclaw'].integrity);
176
+ const npmPath = this.o.npmPath ?? 'npm';
177
+ let npmStderrTail = '';
132
178
  const install = async (dir) => {
133
179
  this.state('installing');
134
180
  for (const f of ['package.json', 'package-lock.json'])
135
181
  copyFileSync(join(kitDir, 'engine', f), join(dir, f));
136
182
  await new Promise((resolve, reject) => {
137
- const child = spawn(this.o.npmPath ?? 'npm', ['ci', '--ignore-scripts', '--no-audit', '--no-fund', '--prefix', dir], {
183
+ const child = spawn(npmPath, ['ci', '--ignore-scripts', '--no-audit', '--no-fund', '--prefix', dir], {
138
184
  env: { PATH: process.env.PATH ?? '/usr/bin:/bin', HOME: join(this.root, 'install-home'), npm_config_cache: join(this.root, 'npm-cache'), OPENCLAW_DISABLE_BUNDLED_PLUGIN_POSTINSTALL: '1' },
139
185
  stdio: ['ignore', 'ignore', 'pipe'],
140
186
  });
@@ -142,10 +188,11 @@ export class Engine {
142
188
  this.started.add(child);
143
189
  child.stderr.on('data', chunk => { stderr = (stderr + chunk).slice(-500); });
144
190
  const timer = setTimeout(() => { expired = true; child.kill('SIGKILL'); }, 300_000);
145
- child.once('error', error => { clearTimeout(timer); this.started.forget(child); reject(error); });
191
+ child.once('error', error => { clearTimeout(timer); this.started.forget(child); npmStderrTail = stderr; reject(error); });
146
192
  child.once('exit', code => {
147
193
  clearTimeout(timer);
148
194
  this.started.forget(child);
195
+ npmStderrTail = stderr;
149
196
  if (code === 0 && !expired)
150
197
  resolve();
151
198
  else {
@@ -154,8 +201,44 @@ export class Engine {
154
201
  }
155
202
  });
156
203
  });
204
+ // Newer pins ship a pending package-lifecycle marker that the gateway completes on first boot by
205
+ // running its own scripts, which needs a writable tree. Complete it here, while the set is still
206
+ // writable, with bundled plugin installs disabled: on a fresh install the prune is a no-op and
207
+ // upstream's own script removes the marker. Pins without the script (pre-8.33) skip this.
208
+ const lifecycle = join(dir, 'node_modules/openclaw/scripts/postinstall-bundled-plugins.mjs');
209
+ if (!existsSync(lifecycle))
210
+ return;
211
+ await new Promise((resolve, reject) => {
212
+ const child = spawn(process.execPath, [lifecycle], {
213
+ env: { PATH: process.env.PATH ?? '/usr/bin:/bin', HOME: join(this.root, 'install-home'), npm_config_cache: join(this.root, 'npm-cache'), OPENCLAW_DISABLE_BUNDLED_PLUGIN_POSTINSTALL: '1' },
214
+ stdio: ['ignore', 'ignore', 'pipe'],
215
+ });
216
+ let stderr = '', expired = false;
217
+ this.started.add(child);
218
+ child.stderr.on('data', chunk => { stderr = (stderr + chunk).slice(-500); });
219
+ const timer = setTimeout(() => { expired = true; child.kill('SIGKILL'); }, 120_000);
220
+ child.once('error', error => { clearTimeout(timer); this.started.forget(child); reject(error); });
221
+ child.once('exit', code => {
222
+ clearTimeout(timer);
223
+ this.started.forget(child);
224
+ if (code === 0 && !expired)
225
+ resolve();
226
+ else {
227
+ this.state('failed', 'install');
228
+ reject(new Error(`engine lifecycle: ${expired ? 'timeout' : stderr}`));
229
+ }
230
+ });
231
+ });
157
232
  };
158
- this.setDir = await prepareEngineSet(this.dir, patches, install, installMatches);
233
+ try {
234
+ this.setDir = await prepareEngineSet(this.dir, patches, install, installMatches);
235
+ }
236
+ catch (error) {
237
+ // The failed temp is already deleted; keep its diagnosis for the next natural failure.
238
+ if (error instanceof EnginePatchError && (error.cause === 'drift-after-build' || error.cause === 'write'))
239
+ this.retainInstallDiagnostics(error, npmPath, npmStderrTail);
240
+ throw error;
241
+ }
159
242
  this.wantedSet = patches;
160
243
  atomic(join(this.root, 'engine-set'), this.setDir);
161
244
  this.patchSet = patches.id;
@@ -183,8 +266,8 @@ export class Engine {
183
266
  const path = join(this.root, 'openclaw.json');
184
267
  const saved = existsSync(path) ? JSON.parse(readFileSync(path, 'utf8')) : undefined;
185
268
  const config = reconcileConfig(saved, { root: this.root, stateDir: this.o.stateDir, port: this.port, pluginId: this.o.pluginId,
186
- pluginDir, policyPath: join(kitDir, 'policy', 'policy.mjs'), app: this.o.config, installPolicy: this.o.installPolicy,
187
- browser: this.o.browserConfig?.() });
269
+ pluginDir, policyPath: join(kitDir, 'policy', 'policy.mjs'), app: this.o.config, offered: this.o.offered,
270
+ installPolicy: this.o.installPolicy, browser: this.o.browserConfig?.() });
188
271
  putChanged(path, JSON.stringify(config, null, 2) + '\n');
189
272
  }
190
273
  doctorContext() {
@@ -332,7 +415,8 @@ export class Engine {
332
415
  const fd = openSync(join(this.o.stateDir, 'logs', 'openclaw.log'), 'a', 0o600);
333
416
  const usageDir = join(this.root, 'usage'), bootId = randomUUID();
334
417
  try {
335
- const accounted = this.wantedSet.files.some(file => file.path === 'dist/experience-review-default-6DPIIJds.js');
418
+ // The bundle hash in the Workshop file name changes per release; the stable prefix names the seam.
419
+ const accounted = this.wantedSet.files.some(file => file.path.startsWith('dist/experience-review-default-') && file.path.endsWith('.js'));
336
420
  if (accounted) {
337
421
  appendUsageBoot(usageDir, { bootId, startedAt: Date.now() });
338
422
  env.BYOKIT_ENGINE_USAGE_LEDGER = usageDir;
@@ -365,7 +449,7 @@ export class Engine {
365
449
  if (this.child !== child || this.stopping)
366
450
  return;
367
451
  this.child = undefined;
368
- void this.authStore.stop().then(() => { this.state('failed', 'exited'); this.o.onExit(null); }, () => this.state('failed', 'exited'));
452
+ void this.authStore.stop().then(() => undefined, refusedOnly).then((refused) => { this.exitedState(refused); this.o.onExit(null); }, () => this.state('failed', 'exited'));
369
453
  });
370
454
  if (!child.pid) {
371
455
  this.state('failed', 'exited');
@@ -382,19 +466,24 @@ export class Engine {
382
466
  this.child = undefined;
383
467
  this.removeOwnedPid(child.pid);
384
468
  void (async () => {
385
- await this.authStore.stop();
469
+ let refused = await this.authStore.stop().then(() => undefined, refusedOnly);
386
470
  if (this.stopping)
387
471
  return;
388
- if (code === 78 && !this.repaired) {
472
+ if (!refused && code === 78 && !this.repaired) {
389
473
  this.repaired = true;
390
474
  this.state('repairing');
391
- const result = await this.withAuthStore(async () => this.doctor(60_000));
392
- if (result.status === 0 && !this.stopping) {
393
- await this.start();
394
- return;
475
+ try {
476
+ const result = await this.withAuthStore(async () => this.doctor(60_000));
477
+ if (result.status === 0 && !this.stopping) {
478
+ await this.start();
479
+ return;
480
+ }
481
+ }
482
+ catch (error) {
483
+ refused = refusedOnly(error);
395
484
  }
396
485
  }
397
- this.state('failed', 'exited');
486
+ this.exitedState(refused);
398
487
  this.o.onExit(code);
399
488
  })().catch(() => this.state('failed', 'exited'));
400
489
  });
@@ -1,4 +1,4 @@
1
- import type { AgentWaitParams, AgentsCreateParams, AgentsCreateResult, AgentsDeleteParams, AgentsDeleteResult, AgentsFilesGetParams, AgentsFilesGetResult, AgentsFilesListParams, AgentsFilesListResult, AgentsFilesSetParams, AgentsFilesSetResult, AgentsListParams, AgentsListResult, AgentsUpdateParams, AgentsUpdateResult, AgentsWorkspaceGetParams, AgentsWorkspaceGetResult, AgentsWorkspaceListParams, AgentsWorkspaceListResult, ApprovalGetParams, ApprovalGetResult, ApprovalHistoryParams, ApprovalHistoryResult, ApprovalResolveParams, ApprovalResolveResult, ArtifactsDownloadParams, ArtifactsDownloadResult, ArtifactsGetParams, ArtifactsGetResult, ArtifactsListParams, ArtifactsListResult, AuditActivityListParams, AuditActivityListResult, AuditListParams, AuditListResult, AuditRunInspectResult, BoardDataReadParams, BoardGetParams, BoardPromptAuthorizeParams, BoardUpdateParams, BoardWidgetAppViewParams, BoardWidgetAppViewResult, BoardWidgetGrantParams, BoardWidgetPutParams, BoardWidgetPutResult, ChannelsLogoutParams, ChannelsPairingApproveParams, ChannelsPairingApproveResult, ChannelsPairingDismissParams, ChannelsPairingDismissResult, ChannelsPairingListParams, ChannelsPairingListResult, ChannelsStartParams, ChannelsStatusParams, ChannelsStatusResult, ChannelsStopParams, ChatAbortParams, ChatHistoryParams, ChatInjectParams, ChatMessageGetResult, ChatMetadataParams, ChatToolTitlesParams, ChatToolTitlesResult, CommandsListParams, CommandsListResult, ConfigApplyParams, ConfigGetParams, ConfigPatchParams, ConfigSchemaLookupParams, ConfigSchemaLookupResult, ConfigSchemaParams, ConfigSetParams, ConnectParams, ConversationListParams, ConversationListResult, ConversationSendParams, ConversationSendResult, ConversationTurnCancelParams, ConversationTurnCancelResult, ConversationTurnParams, CronAddParams, CronListParams, CronRunsParams, CronScratchGetResult, CronStatusParams, DesktopLaunchParams, DesktopObserveResult, DevicePairApproveParams, DevicePairListParams, DevicePairRejectParams, DevicePairRemoveParams, DevicePairRenameParams, DevicePairSetupCodeParams, DevicePairSetupCodeResult, DevicePairSetupStatusParams, DevicePairSetupStatusResult, DeviceTokenRevokeParams, DeviceTokenRotateParams, DeviceTokenRotateResult, EnvironmentsCreateParams, EnvironmentsCreateResult, EnvironmentsDestroyParams, EnvironmentsDestroyResult, EnvironmentsListParams, EnvironmentsListResult, EnvironmentsStatusParams, EnvironmentsStatusResult, ExecApprovalGetParams, ExecApprovalGrantsListParams, ExecApprovalGrantsListResult, ExecApprovalGrantsRevokeParams, ExecApprovalGrantsRevokeResult, ExecApprovalRequestParams, ExecApprovalResolveParams, ExecApprovalsGetParams, ExecApprovalsNodeGetParams, ExecApprovalsSetParams, FsListDirParams, FsListDirResult, GatewaySuspendPrepareParams, GatewaySuspendResumeParams, GatewaySuspendResumeResult, GatewaySuspendStatusParams, HooksStatusParams, LogsTailParams, LogsTailResult, MessageActionParams, MigrationsMemoryApplyResult, MigrationsMemoryPlanResult, ModelsAuthLogoutParams, ModelsAuthStatusParams, ModelsListParams, ModelsListResult, ModelsProbeParams, ModelsProbeResult, NodeDescribeParams, NodeEventParams, NodeEventResult, NodeInvokeParams, NodeInvokeProgressParams, NodeInvokeResultParams, NodeListParams, NodePairApproveParams, NodePairListParams, NodePairRejectParams, NodePairRemoveParams, NodePendingAckParams, NodePendingDrainParams, NodePendingDrainResult, NodePendingEnqueueParams, NodePendingEnqueueResult, NodePluginToolsUpdateParams, NodeRenameParams, NodeSkillsUpdateParams, PluginApprovalRequestParams, PluginApprovalResolveParams, PluginsInspectParams, PluginsInspectResult, PluginsInstallResult, PluginsListParams, PluginsListResult, PluginsRefreshParams, PluginsRefreshResult, PluginsSearchParams, PluginsSearchResult, PluginsSessionActionParams, PluginsSetEnabledParams, PluginsSetEnabledResult, PluginsUiDescriptorsParams, PluginsUiDescriptorsResult, PluginsUninstallParams, PluginsUninstallResult, PollParams, PortalCloseParams, PortalCloseResult, PortalListParams, PortalListResult, PortalOpenParams, PortalOpenResult, ProgressCardGetParams, ProgressCardGetResult, ProgressCardPutParams, ProgressCardPutResult, ProjectsAddParams, ProjectsAddResult, ProjectsListParams, ProjectsListResult, ProjectsRegisterParams, ProjectsRegisterResult, ProjectsRemoveParams, ProjectsRemoveResult, ProjectsSearchRemoteParams, ProjectsSearchRemoteResult, PushTestParams, PushTestResult, QuestionGetParams, QuestionGetResult, QuestionListParams, QuestionListResult, QuestionRequestParams, QuestionRequestResult, QuestionWaitAnswerParams, SecretsResolveParams, SecretsResolveResult, SecretsStoreDeleteParams, SecretsStoreListResult, SecretsStoreSetParams, SessionDiscussionInfoParams, SessionDiscussionInfoResult, SessionDiscussionOpenParams, SessionDiscussionOpenResult, SessionMemberAddParams, SessionMemberRemoveParams, SessionMembersListEvidenceResult, SessionMembersListParams, SessionMembersListResult, SessionSuggestionsAddParams, SessionSuggestionsAddResult, SessionSuggestionsListParams, SessionSuggestionsListResult, SessionSuggestionsResolveParams, SessionSuggestionsResolveResult, SessionTypingParams, SessionTypingResult, SessionVisibilitySetParams, SessionVisibilitySetResult, SessionsAbortParams, SessionsAssignOwnerParams, SessionsAssignOwnerResult, SessionsBranchesListParams, SessionsBranchesListResult, SessionsBranchesSwitchParams, SessionsBranchesSwitchResult, SessionsCatalogArchiveParams, SessionsCatalogArchiveResult, SessionsCatalogContinueParams, SessionsCatalogContinueResult, SessionsCatalogListParams, SessionsCatalogListResult, SessionsCatalogReadParams, SessionsCatalogReadResult, SessionsCatalogStartTerminalParams, SessionsCatalogStartTerminalResult, SessionsCleanupParams, SessionsCompactParams, SessionsCompactionBranchParams, SessionsCompactionBranchResult, SessionsCompactionListParams, SessionsCompactionListResult, SessionsCompactionRestoreParams, SessionsCompactionRestoreResult, SessionsCompanionAskParams, SessionsCompanionAskResult, SessionsCompanionResetParams, SessionsCompanionResetResult, SessionsCompanionStateParams, SessionsCompanionStateResult, SessionsCreateParams, SessionsCreateResult, SessionsDeleteParams, SessionsDeleteResult, SessionsDescribeParams, SessionsDiffParams, SessionsDiffResult, SessionsDispatchResult, SessionsFilesGetParams, SessionsFilesGetResult, SessionsFilesListParams, SessionsFilesListResult, SessionsFilesRevealParams, SessionsFilesRevealResult, SessionsFilesSetParams, SessionsFilesSetResult, SessionsForkParams, SessionsForkResult, SessionsGoalClearParams, SessionsGroupsDefaultsParams, SessionsGroupsDefaultsResult, SessionsGroupsDeleteParams, SessionsGroupsListParams, SessionsGroupsListResult, SessionsGroupsPutParams, SessionsGroupsRenameParams, SessionsGroupsUpdateParams, SessionsGroupsUpdateResult, SessionsListParams, SessionsMessagesSubscribeParams, SessionsMessagesUnsubscribeParams, SessionsMoveParams, SessionsMoveResult, SessionsObserverVisibilityParams, SessionsObserverVisibilityResult, SessionsPatchManyParams, SessionsPatchManyResult, SessionsPatchParams, SessionsPatchResult, SessionsPluginPatchParams, SessionsPluginPatchResult, SessionsPreviewParams, SessionsReclaimParams, SessionsReclaimResult, SessionsRecoverParams, SessionsRecoverResult, SessionsResetParams, SessionsResolveParams, SessionsRewindParams, SessionsRewindResult, SessionsSearchParams, SessionsSearchResult, SessionsSendParams, SessionsUsageParams, SkillsBinsParams, SkillsBinsResult, SkillsCuratorStatusParams, SkillsCuratorStatusResult, SkillsDetailParams, SkillsDetailResult, SkillsProposalActionParams, SkillsProposalCreateParams, SkillsProposalDecisionParams, SkillsProposalEvaluateParams, SkillsProposalEvaluateResult, SkillsProposalEventsListParams, SkillsProposalEventsListResult, SkillsProposalHistoryScanParams, SkillsProposalHistoryScanResult, SkillsProposalHistoryStatusParams, SkillsProposalInspectParams, SkillsProposalInspectResult, SkillsProposalRequestRevisionParams, SkillsProposalRequestRevisionResult, SkillsProposalReviseParams, SkillsProposalUpdateParams, SkillsProposalsListParams, SkillsProposalsListResult, SkillsSearchParams, SkillsSearchResult, SkillsSecurityVerdictsParams, SkillsSecurityVerdictsResult, SkillsSkillCardParams, SkillsSkillCardResult, SkillsStatusParams, SkillsUploadBeginParams, SkillsUploadChunkParams, SkillsUploadCommitParams, SystemAgentChatHistoryParams, SystemAgentChatHistoryResult, SystemAgentChatParams, SystemAgentChatResult, SystemAgentSetupActivateParams, SystemAgentSetupActivateResult, SystemAgentSetupAuthStartParams, SystemAgentSetupAuthStartResult, SystemAgentSetupDetectParams, SystemAgentSetupDetectResult, SystemAgentSetupVerifyParams, SystemChangesListParams, SystemChangesListResult, SystemInfoParams, SystemInfoResult, TalkCatalogParams, TalkCatalogResult, TalkClientCloseParams, TalkClientCreateParams, TalkClientSteerParams, TalkClientToolCallParams, TalkClientToolCallResult, TalkClientTranscriptParams, TalkConfigParams, TalkConfigResult, TalkModeParams, TalkSessionAcknowledgeMarkParams, TalkSessionAppendAudioParams, TalkSessionCancelOutputParams, TalkSessionCancelOutputResult, TalkSessionCloseParams, TalkSessionCreateParams, TalkSessionCreateResult, TalkSessionSteerParams, TalkSessionSubmitToolResultParams, TalkSpeakParams, TalkSpeakResult, TaskSuggestionsAcceptParams, TaskSuggestionsAcceptResult, TaskSuggestionsCreateParams, TaskSuggestionsCreateResult, TaskSuggestionsDismissParams, TaskSuggestionsDismissResult, TaskSuggestionsListParams, TaskSuggestionsListResult, TasksCancelParams, TasksCancelResult, TasksGetParams, TasksGetResult, TasksListParams, TasksListResult, TerminalAttachParams, TerminalAttachResult, TerminalCloseParams, TerminalInputParams, TerminalListResult, TerminalOpenParams, TerminalOpenResult, TerminalResizeParams, TerminalUploadParams, TerminalUploadResult, ToolsCatalogParams, ToolsCatalogResult, ToolsEffectiveParams, ToolsEffectiveResult, ToolsInvokeParams, ToolsInvokeResult, TtsSpeakParams, TtsSpeakResult, UiCommandParams, UiCommandResult, UpdateHoldParams, UpdateHoldResult, UpdateRunParams, UpdateStatusParams, UpdateStatusResult, UsersLinkEmailParams, UsersLinkEmailResult, UsersListParams, UsersListResult, UsersPrefsGetParams, UsersPrefsGetResult, UsersPrefsSetParams, UsersPrefsSetResult, UsersSelfParams, UsersSelfResult, UsersSetAvatarParams, UsersSetAvatarResult, UsersSetDisplayNameParams, UsersSetDisplayNameResult, UsersSetRoleParams, UsersSetRoleResult, WakeParams, WebLoginStartParams, WebLoginWaitParams, WebPushTestParams, WizardCancelParams, WizardNextParams, WizardNextResult, WizardStartParams, WizardStartResult, WizardStatusParams, WizardStatusResult, WorkerDesktopLaunchParams, WorkerDesktopLaunchResult, WorkerDesktopObserveParams, WorkerDesktopObserveResult, WorktreesBranchesParams, WorktreesBranchesResult, WorktreesCreateParams, WorktreesGcParams, WorktreesGcResult, WorktreesListParams, WorktreesListResult, WorktreesRemoveParams, WorktreesRemoveResult, WorktreesRestoreParams } from '@openclaw/gateway-protocol';
1
+ import type { AgentWaitParams, AgentsCreateParams, AgentsCreateResult, AgentsDeleteParams, AgentsDeleteResult, AgentsFilesGetParams, AgentsFilesGetResult, AgentsFilesListParams, AgentsFilesListResult, AgentsFilesSetParams, AgentsFilesSetResult, AgentsListParams, AgentsListResult, AgentsUpdateParams, AgentsUpdateResult, AgentsWorkspaceGetParams, AgentsWorkspaceGetResult, AgentsWorkspaceListParams, AgentsWorkspaceListResult, ApprovalGetParams, ApprovalGetResult, ApprovalHistoryParams, ApprovalHistoryResult, ApprovalResolveParams, ApprovalResolveResult, ArtifactsDownloadParams, ArtifactsDownloadResult, ArtifactsGetParams, ArtifactsGetResult, ArtifactsListParams, ArtifactsListResult, AuditActivityListParams, AuditActivityListResult, AuditListParams, AuditListResult, AuditRunInspectResult, BoardDataReadParams, BoardGetParams, BoardPromptAuthorizeParams, BoardUpdateParams, BoardWidgetAppViewParams, BoardWidgetAppViewResult, BoardWidgetGrantParams, BoardWidgetPutParams, BoardWidgetPutResult, ChannelsLogoutParams, ChannelsPairingApproveParams, ChannelsPairingApproveResult, ChannelsPairingDismissParams, ChannelsPairingDismissResult, ChannelsPairingListParams, ChannelsPairingListResult, ChannelsStartParams, ChannelsStatusParams, ChannelsStatusResult, ChannelsStopParams, ChatAbortParams, ChatHistoryParams, ChatInjectParams, ChatMessageGetResult, ChatMetadataParams, ChatToolTitlesParams, ChatToolTitlesResult, CommandsListParams, CommandsListResult, ConfigApplyParams, ConfigGetParams, ConfigPatchParams, ConfigSchemaLookupParams, ConfigSchemaLookupResult, ConfigSchemaParams, ConfigSetParams, ConnectParams, ConversationListParams, ConversationListResult, ConversationSendParams, ConversationSendResult, ConversationTurnCancelParams, ConversationTurnCancelResult, ConversationTurnParams, CronAddParams, CronListParams, CronRunsParams, CronScratchGetResult, CronStatusParams, DesktopLaunchParams, DesktopObserveResult, DevicePairApproveParams, DevicePairListParams, DevicePairRejectParams, DevicePairRemoveParams, DevicePairRenameParams, DevicePairSetupCodeParams, DevicePairSetupCodeResult, DevicePairSetupStatusParams, DevicePairSetupStatusResult, DeviceTokenRevokeParams, DeviceTokenRotateParams, DeviceTokenRotateResult, EnvironmentsCreateParams, EnvironmentsCreateResult, EnvironmentsDestroyParams, EnvironmentsDestroyResult, EnvironmentsListParams, EnvironmentsListResult, EnvironmentsStatusParams, EnvironmentsStatusResult, ExecApprovalGetParams, ExecApprovalGrantsListParams, ExecApprovalGrantsListResult, ExecApprovalGrantsRevokeParams, ExecApprovalGrantsRevokeResult, ExecApprovalRequestParams, ExecApprovalResolveParams, ExecApprovalsGetParams, ExecApprovalsNodeGetParams, ExecApprovalsSetParams, FsListDirParams, FsListDirResult, GatewaySuspendPrepareParams, GatewaySuspendResumeParams, GatewaySuspendResumeResult, GatewaySuspendStatusParams, HooksStatusParams, LogsTailParams, LogsTailResult, MessageActionParams, MigrationsMemoryApplyResult, MigrationsMemoryPlanResult, ModelsAuthLogoutParams, ModelsAuthStatusParams, ModelsListParams, ModelsListResult, ModelsProbeParams, ModelsProbeResult, NodeDescribeParams, NodeEventParams, NodeEventResult, NodeInvokeParams, NodeInvokeProgressParams, NodeInvokeResultParams, NodeListParams, NodePairApproveParams, NodePairListParams, NodePairRejectParams, NodePairRemoveParams, NodePendingAckParams, NodePendingDrainParams, NodePendingDrainResult, NodePendingEnqueueParams, NodePendingEnqueueResult, NodePluginToolsUpdateParams, NodeRenameParams, NodeSkillsUpdateParams, PluginApprovalRequestParams, PluginApprovalResolveParams, PluginsInspectParams, PluginsInspectResult, PluginsInstallResult, PluginsListParams, PluginsListResult, PluginsRefreshParams, PluginsRefreshResult, PluginsSearchParams, PluginsSearchResult, PluginsSessionActionParams, PluginsSetEnabledParams, PluginsSetEnabledResult, PluginsUiDescriptorsParams, PluginsUiDescriptorsResult, PluginsUninstallParams, PluginsUninstallResult, PollParams, PortalCloseParams, PortalCloseResult, PortalListParams, PortalListResult, PortalOpenParams, PortalOpenResult, ProgressCardGetParams, ProgressCardGetResult, ProgressCardPutParams, ProgressCardPutResult, ProjectsAddParams, ProjectsAddResult, ProjectsListParams, ProjectsListResult, ProjectsRegisterParams, ProjectsRegisterResult, ProjectsRemoveParams, ProjectsRemoveResult, ProjectsSearchRemoteParams, ProjectsSearchRemoteResult, PushTestParams, PushTestResult, QuestionGetParams, QuestionGetResult, QuestionListParams, QuestionListResult, QuestionRequestParams, QuestionRequestResult, QuestionWaitAnswerParams, SecretsResolveParams, SecretsResolveResult, SecretsStoreDeleteParams, SecretsStoreListResult, SecretsStoreSetParams, SessionDiscussionInfoParams, SessionDiscussionInfoResult, SessionDiscussionOpenParams, SessionDiscussionOpenResult, SessionMemberAddParams, SessionMemberRemoveParams, SessionMembersListEvidenceResult, SessionMembersListParams, SessionMembersListResult, SessionSuggestionsAddParams, SessionSuggestionsAddResult, SessionSuggestionsListParams, SessionSuggestionsListResult, SessionSuggestionsResolveParams, SessionSuggestionsResolveResult, SessionTypingParams, SessionTypingResult, SessionVisibilitySetParams, SessionVisibilitySetResult, SessionsAbortParams, SessionsAssignOwnerParams, SessionsAssignOwnerResult, SessionsBranchesListParams, SessionsBranchesListResult, SessionsBranchesSwitchParams, SessionsBranchesSwitchResult, SessionsCatalogArchiveParams, SessionsCatalogArchiveResult, SessionsCatalogContinueParams, SessionsCatalogContinueResult, SessionsCatalogListParams, SessionsCatalogListResult, SessionsCatalogReadParams, SessionsCatalogReadResult, SessionsCatalogStartTerminalParams, SessionsCatalogStartTerminalResult, SessionsCleanupParams, SessionsCompactParams, SessionsCompactionBranchParams, SessionsCompactionBranchResult, SessionsCompactionListParams, SessionsCompactionListResult, SessionsCompactionRestoreParams, SessionsCompactionRestoreResult, SessionsCompanionAskParams, SessionsCompanionAskResult, SessionsCompanionResetParams, SessionsCompanionResetResult, SessionsCompanionStateParams, SessionsCompanionStateResult, SessionsCreateParams, SessionsCreateResult, SessionsDeleteParams, SessionsDeleteResult, SessionsDescribeParams, SessionsDiffParams, SessionsDiffResult, SessionsDispatchResult, SessionsFilesGetParams, SessionsFilesGetResult, SessionsFilesListParams, SessionsFilesListResult, SessionsFilesRevealParams, SessionsFilesRevealResult, SessionsFilesSetParams, SessionsFilesSetResult, SessionsForkParams, SessionsForkResult, SessionsGoalClearParams, SessionsGroupsDefaultsParams, SessionsGroupsDefaultsResult, SessionsGroupsDeleteParams, SessionsGroupsListParams, SessionsGroupsListResult, SessionsGroupsPutParams, SessionsGroupsRenameParams, SessionsGroupsUpdateParams, SessionsGroupsUpdateResult, SessionsListParams, SessionsMessagesSubscribeParams, SessionsMessagesUnsubscribeParams, SessionsMoveParams, SessionsMoveResult, SessionsObserverVisibilityParams, SessionsObserverVisibilityResult, SessionsPatchManyParams, SessionsPatchManyResult, SessionsPatchParams, SessionsPatchResult, SessionsPluginPatchParams, SessionsPluginPatchResult, SessionsPreviewParams, SessionsReclaimParams, SessionsReclaimResult, SessionsRecoverParams, SessionsRecoverResult, SessionsResetParams, SessionsResolveParams, SessionsRewindParams, SessionsRewindResult, SessionsSearchParams, SessionsSearchResult, SessionsSendParams, SessionsUsageParams, SkillsBinsParams, SkillsBinsResult, SkillsCuratorStatusParams, SkillsCuratorStatusResult, SkillsDetailParams, SkillsDetailResult, SkillsProposalActionParams, SkillsProposalCreateParams, SkillsProposalDecisionParams, SkillsProposalEvaluateParams, SkillsProposalEvaluateResult, SkillsProposalEventsListParams, SkillsProposalEventsListResult, SkillsProposalHistoryScanParams, SkillsProposalHistoryScanResult, SkillsProposalHistoryStatusParams, SkillsProposalInspectParams, SkillsProposalInspectResult, SkillsProposalRequestRevisionParams, SkillsProposalRequestRevisionResult, SkillsProposalReviseParams, SkillsProposalUpdateParams, SkillsProposalsListParams, SkillsProposalsListResult, SkillsSearchParams, SkillsSearchResult, SkillsSecurityVerdictsParams, SkillsSecurityVerdictsResult, SkillsSkillCardParams, SkillsSkillCardResult, SkillsStatusParams, SkillsUploadBeginParams, SkillsUploadChunkParams, SkillsUploadCommitParams, SystemAgentChatHistoryParams, SystemAgentChatHistoryResult, SystemAgentChatParams, SystemAgentChatResult, SystemAgentSetupActivateParams, SystemAgentSetupActivateResult, SystemAgentSetupActivateStartParams, SystemAgentSetupActivateStartResult, SystemAgentSetupAuthStartParams, SystemAgentSetupAuthStartResult, SystemAgentSetupDetectParams, SystemAgentSetupDetectResult, SystemAgentSetupVerifyParams, SystemChangesListParams, SystemChangesListResult, SystemInfoParams, SystemInfoResult, TalkCatalogParams, TalkCatalogResult, TalkClientCloseParams, TalkClientCreateParams, TalkClientSteerParams, TalkClientToolCallParams, TalkClientToolCallResult, TalkClientTranscriptParams, TalkConfigParams, TalkConfigResult, TalkModeParams, TalkSessionAcknowledgeMarkParams, TalkSessionAppendAudioParams, TalkSessionCancelOutputParams, TalkSessionCancelOutputResult, TalkSessionCloseParams, TalkSessionCreateParams, TalkSessionCreateResult, TalkSessionSteerParams, TalkSessionSubmitToolResultParams, TalkSpeakParams, TalkSpeakResult, TaskSuggestionsAcceptParams, TaskSuggestionsAcceptResult, TaskSuggestionsCreateParams, TaskSuggestionsCreateResult, TaskSuggestionsDismissParams, TaskSuggestionsDismissResult, TaskSuggestionsListParams, TaskSuggestionsListResult, TasksCancelParams, TasksCancelResult, TasksGetParams, TasksGetResult, TasksListParams, TasksListResult, TerminalAttachParams, TerminalAttachResult, TerminalCloseParams, TerminalInputParams, TerminalListResult, TerminalOpenParams, TerminalOpenResult, TerminalResizeParams, TerminalUploadParams, TerminalUploadResult, ToolsCatalogParams, ToolsCatalogResult, ToolsEffectiveParams, ToolsEffectiveResult, ToolsInvokeParams, ToolsInvokeResult, TtsSpeakParams, TtsSpeakResult, UiCommandParams, UiCommandResult, UpdateHoldParams, UpdateHoldResult, UpdateRunParams, UpdateStatusParams, UpdateStatusResult, UsersLinkEmailParams, UsersLinkEmailResult, UsersListParams, UsersListResult, UsersPrefsGetParams, UsersPrefsGetResult, UsersPrefsSetParams, UsersPrefsSetResult, UsersSelfParams, UsersSelfResult, UsersSetAvatarParams, UsersSetAvatarResult, UsersSetDisplayNameParams, UsersSetDisplayNameResult, UsersSetRoleParams, UsersSetRoleResult, WakeParams, WebLoginStartParams, WebLoginWaitParams, WebPushTestParams, WizardCancelParams, WizardNextParams, WizardNextResult, WizardStartParams, WizardStartResult, WizardStatusParams, WizardStatusResult, WorkerDesktopLaunchParams, WorkerDesktopLaunchResult, WorkerDesktopObserveParams, WorkerDesktopObserveResult, WorktreesBranchesParams, WorktreesBranchesResult, WorktreesCreateParams, WorktreesGcParams, WorktreesGcResult, WorktreesListParams, WorktreesListResult, WorktreesRemoveParams, WorktreesRemoveResult, WorktreesRestoreParams } from '@openclaw/gateway-protocol';
2
2
  import type { AuditRunInspectParams, BoardActionParams, BoardEventParams, ConversationTurnResult, CronAddResult, CronGetParams, CronRemoveParams, CronRunParams, CronScratchGetParams, CronScratchSetParams, CronScratchSetResult, CronUpdateParams, DesktopObserveParams, ExecApprovalsNodeSetParams, GatewaySuspendPrepareResult, GatewaySuspendStatusResult, PluginsInstallParams, PluginsSessionActionResult, QuestionResolveParams, QuestionResolveResult, QuestionWaitAnswerResult, SessionsDispatchParams, SessionsGoalUpdateParams, SessionsResolveResult, SkillsInstallParams, SkillsUpdateParams, SystemAgentSetupVerifyResult, TalkClientCreateResult } from './params.ts';
3
3
  export interface GatewayMethods {
4
4
  'agent': {
@@ -913,6 +913,12 @@ export interface GatewayMethods {
913
913
  scope: 'operator.admin';
914
914
  role: 'operator';
915
915
  };
916
+ 'openclaw.setup.activate.start': {
917
+ params: SystemAgentSetupActivateStartParams;
918
+ result: SystemAgentSetupActivateStartResult;
919
+ scope: 'operator.admin';
920
+ role: 'operator';
921
+ };
916
922
  'openclaw.setup.auth.start': {
917
923
  params: SystemAgentSetupAuthStartParams;
918
924
  result: SystemAgentSetupAuthStartResult;
@@ -1178,6 +1178,10 @@ export type SessionApprovalEvent = {
1178
1178
  expiresInDays?: number;
1179
1179
  };
1180
1180
  allowedDecisions: ("allow-once" | "allow-always" | "deny")[];
1181
+ externalResolution?: {
1182
+ label: string;
1183
+ decisions: ("allow-once" | "allow-always")[];
1184
+ };
1181
1185
  } | {
1182
1186
  kind: "system-agent";
1183
1187
  title: string;
@@ -1260,6 +1264,10 @@ export type SessionApprovalEvent = {
1260
1264
  expiresInDays?: number;
1261
1265
  };
1262
1266
  allowedDecisions: ("allow-once" | "allow-always" | "deny")[];
1267
+ externalResolution?: {
1268
+ label: string;
1269
+ decisions: ("allow-once" | "allow-always")[];
1270
+ };
1263
1271
  } | {
1264
1272
  kind: "system-agent";
1265
1273
  title: string;
@@ -1346,6 +1354,10 @@ export type SessionApprovalEvent = {
1346
1354
  expiresInDays?: number;
1347
1355
  };
1348
1356
  allowedDecisions: ("allow-once" | "allow-always" | "deny")[];
1357
+ externalResolution?: {
1358
+ label: string;
1359
+ decisions: ("allow-once" | "allow-always")[];
1360
+ };
1349
1361
  } | {
1350
1362
  kind: "system-agent";
1351
1363
  title: string;
@@ -1432,6 +1444,10 @@ export type SessionApprovalEvent = {
1432
1444
  expiresInDays?: number;
1433
1445
  };
1434
1446
  allowedDecisions: ("allow-once" | "allow-always" | "deny")[];
1447
+ externalResolution?: {
1448
+ label: string;
1449
+ decisions: ("allow-once" | "allow-always")[];
1450
+ };
1435
1451
  } | {
1436
1452
  kind: "system-agent";
1437
1453
  title: string;
@@ -1517,6 +1533,10 @@ export type SessionApprovalEvent = {
1517
1533
  expiresInDays?: number;
1518
1534
  };
1519
1535
  allowedDecisions: ("allow-once" | "allow-always" | "deny")[];
1536
+ externalResolution?: {
1537
+ label: string;
1538
+ decisions: ("allow-once" | "allow-always")[];
1539
+ };
1520
1540
  } | {
1521
1541
  kind: "system-agent";
1522
1542
  title: string;
@@ -1,4 +1,4 @@
1
- // Generated by scripts/gen-methods.ts from the pinned openclaw@2026.8.1 tarball (docs/runtime-kits.md 5.10). Regenerated with `npm run gen:openclaw`, never hand-edited.
1
+ // Generated by scripts/gen-methods.ts from the pinned openclaw@2026.8.35 tarball (docs/runtime-kits.md 5.10). Regenerated with `npm run gen:openclaw`, never hand-edited.
2
2
  // Union patch-ups (Gap 6): these mirror the protocol.schema.json definitions of the same
3
3
  // name, with every anyOf/oneOf branch carrying its full property set (see the generator). The
4
4
  // gateway validates against the same schemas, so the kit accepts exactly what the gateway accepts.
@@ -1,13 +1,13 @@
1
1
  {
2
- "engine": "2026.8.1",
2
+ "engine": "2026.8.35",
3
3
  "protocol": 4,
4
4
  "package": "openclaw",
5
- "methods": 393,
6
- "operatorMethods": 382,
5
+ "methods": 394,
6
+ "operatorMethods": 383,
7
7
  "nodeMethods": 11,
8
8
  "events": 55,
9
- "matchedParams": 301,
10
- "matchedResults": 192,
9
+ "matchedParams": 302,
10
+ "matchedResults": 193,
11
11
  "matchedEvents": 21,
12
12
  "patchedTypes": [
13
13
  "AuditRunInspectParams",
package/dist/index.d.ts CHANGED
@@ -1,12 +1,13 @@
1
1
  export { ENGINE_VERSION, OPERATOR_SCOPES, PROTOCOL_VERSION } from './constants.ts';
2
- export type { Approval, CallOptions, Decision, GatewayEventName, GatewayEventPayload, GatewayMethod, GatewayParams, GatewayResult, GatewayTransport, GateResult, Hello, KitState, KitEventName, KitEventPayload, BrowserPing, LearningCapture, LearningMode, Member, PlanWindow, Route, RunEnd, RunEvent, RunRef, RunSpec, OutputSchema, SchemaOutput, RunUsage, SignInOptions, SignInView, ToolHost, ToolSpec, } from './types.ts';
2
+ export type { Account, AccountId, AccountPick, AccountRef, Approval, CallOptions, Considered, Decision, Defaults, ModelInfo, MoveResult, PickWhy, Room, RoomSpan, RunSelection, SignInState, GatewayEventName, GatewayEventPayload, GatewayMethod, GatewayParams, GatewayResult, GatewayTransport, GateResult, Hello, KitState, KitEventName, KitEventPayload, BrowserPing, LearningCapture, LearningMode, Member, PlanWindow, Route, RunEnd, RunEvent, RunRef, RunSpec, OutputSchema, SchemaOutput, RunUsage, SignInOptions, SignInView, ToolHost, ToolSpec, } from './types.ts';
3
3
  export type { GatewayMethods } from './generated/methods.ts';
4
4
  export type { JsonValue } from './output.ts';
5
5
  export type { RouteFacts, RouteView } from './routes.ts';
6
6
  export { OpenClawKit, type KitOptions, type RetainedLogin } from './kit.ts';
7
7
  export type { AddKeyResult } from './keys.ts';
8
8
  export { stateWords, toAccountView, words, type AccountView, type WordKey } from './words.ts';
9
- export { AuthStoreUnreadableError } from './auth-store.ts';
9
+ export { chooseAccount, consider, resolveSelection, type RoomOf } from './pick.ts';
10
+ export { AuthStoreUnreadableError, AuthStoreSealSizeError } from './auth-store.ts';
10
11
  export { EngineAlreadyRunningError } from './engine-status.ts';
11
12
  export { readAgentDayUsage } from './day-usage.ts';
12
13
  export type { AgentDayUsage, DayUsageClient, EngineStartedCharge, EngineStartedKind } from './day-usage.ts';
package/dist/index.js CHANGED
@@ -3,7 +3,8 @@
3
3
  export { ENGINE_VERSION, OPERATOR_SCOPES, PROTOCOL_VERSION } from "./constants.js";
4
4
  export { OpenClawKit } from "./kit.js";
5
5
  export { stateWords, toAccountView, words } from "./words.js";
6
- export { AuthStoreUnreadableError } from "./auth-store.js";
6
+ export { chooseAccount, consider, resolveSelection } from "./pick.js";
7
+ export { AuthStoreUnreadableError, AuthStoreSealSizeError } from "./auth-store.js";
7
8
  export { EngineAlreadyRunningError } from "./engine-status.js";
8
9
  export { readAgentDayUsage } from "./day-usage.js";
9
10
  export { readAgentUsage, agentUsageOf } from "./usage.js";
package/dist/kit.d.ts CHANGED
@@ -21,6 +21,7 @@ export type KitOptions = {
21
21
  permitted?: (tool: string) => boolean;
22
22
  gateBuiltins?: boolean;
23
23
  config?: object;
24
+ offered?: readonly string[];
24
25
  appOwnedSessions?: {
25
26
  keyPrefixes: string[];
26
27
  };
package/dist/kit.js CHANGED
@@ -6,7 +6,8 @@ import { PROTOCOL_VERSION } from "./constants.js";
6
6
  import { atomic } from "./engine-patches.js";
7
7
  import { Approvals } from "./approvals.js";
8
8
  import { Bridge } from "./bridge.js";
9
- import { Engine } from "./engine.js";
9
+ import { Engine, refusedOnly } from "./engine.js";
10
+ import { AuthStoreSealSizeError } from "./auth-store.js";
10
11
  import { gatewayTransport } from "./transport.js";
11
12
  import { createMembers } from "./members.js";
12
13
  import { keyAgentId, KEY_PREFIX, MEMBER_ID } from "./members.js";
@@ -176,6 +177,7 @@ const operatorMethods = new Set([
176
177
  'openclaw.chat',
177
178
  'openclaw.chat.history',
178
179
  'openclaw.setup.activate',
180
+ 'openclaw.setup.activate.start',
179
181
  'openclaw.setup.auth.start',
180
182
  'openclaw.setup.detect',
181
183
  'openclaw.setup.prepare.start',
@@ -754,8 +756,13 @@ export class OpenClawKit {
754
756
  const patchFailure = this.current.why === 'engine-patch';
755
757
  if (transport && this.transport === transport)
756
758
  await this.disconnect();
757
- await this.engine.stop();
759
+ const refused = await this.engine.stop().then(() => undefined, refusedOnly);
758
760
  await this.closeBrowsers();
761
+ const sealRefusal = refused ?? (error instanceof AuthStoreSealSizeError ? error : undefined);
762
+ if (sealRefusal) {
763
+ this.setState({ phase: 'failed', why: 'auth-store-seal-size', sealSize: { size: sealRefusal.size, cap: sealRefusal.cap, file: sealRefusal.file } });
764
+ throw sealRefusal;
765
+ }
759
766
  if (error instanceof Error && 'code' in error && error.code === 'engine-already-running') {
760
767
  this.setState({ phase: 'failed', why: 'engine-already-running' });
761
768
  throw error;
@@ -1012,7 +1019,7 @@ export class OpenClawKit {
1012
1019
  const safe = reconcileConfig(response.config, { root: this.engine.root, stateDir: this.o.stateDir,
1013
1020
  port: Number(readFileSync(join(this.engine.root, 'port'), 'utf8')), pluginId: this.o.plugin?.id ?? 'byokit',
1014
1021
  pluginDir: join(this.engine.root, 'plugin'), policyPath: fileURLToPath(new URL('../policy/policy.mjs', import.meta.url)), app: patch,
1015
- installPolicy: this.o.installPolicy, ...(this.o.browser ? { browser: this.browserConfig() } : {}) });
1022
+ offered: this.o.offered, installPolicy: this.o.installPolicy, ...(this.o.browser ? { browser: this.browserConfig() } : {}) });
1016
1023
  if (this.o.browser && !browserToolPolicySafe(safe, this.toolNames()))
1017
1024
  throw new Error('browser tool policy refused');
1018
1025
  if (this.o.browser) {
package/dist/link.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { BrowserHost } from './browser.ts';
2
2
  import { type IncomingMessage, type ServerResponse } from 'node:http';
3
- import { type Grant, type Host, type HostOptions } from '@byokit/link';
3
+ import { type Grant, type Host, type HostOptions } from '@byokit/pair';
4
4
  import { type ServeIngress, type Via } from '@byokit/discover';
5
5
  import type { PushAction, RelayClient } from '@byokit/relay';
6
6
  import type { OpenClawKit } from './kit.ts';
package/dist/link.js CHANGED
@@ -1,11 +1,11 @@
1
- // Host-side link adapter (7.1): typed, member-checked ops over @byokit/link, sealed approval push
1
+ // Host-side link adapter (7.1): typed, member-checked ops over @byokit/pair, sealed approval push
2
2
  // via the relay (7.3). Node only.
3
3
  import { randomUUID } from 'node:crypto';
4
4
  import { sealBox } from '@byokit/seal';
5
5
  import { readFileSync } from 'node:fs';
6
6
  import { createServer } from 'node:http';
7
7
  import { WebSocketServer } from 'ws';
8
- import { PublicLinkError, } from '@byokit/link';
8
+ import { PublicLinkError, } from '@byokit/pair';
9
9
  import { reach } from '@byokit/discover';
10
10
  import { ENGINE_VERSION } from "./constants.js";
11
11
  import { b64urlDecode, b64urlEncode, sealNotice } from "./notices.js";
@@ -232,7 +232,7 @@ export function openclawLink(kit, o) {
232
232
  throw refused();
233
233
  const args = isRecord(req.args) ? req.args : {};
234
234
  if (req.op.startsWith('oc.browser.')) {
235
- // Keyed answers may be persisted by @byokit/link. Lease nonces and JPEGs are transient only.
235
+ // Keyed answers may be persisted by @byokit/pair. Lease nonces and JPEGs are transient only.
236
236
  if (req.key !== undefined)
237
237
  throw refused();
238
238
  const host = browser();
package/dist/members.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { GatewayTransport, Member } from './types.ts';
2
2
  export declare const MEMBER_ID: RegExp;
3
3
  export declare const KEY_PREFIX = "byokit-key-";
4
+ export declare const BASE_AGENT = "byokit-base";
4
5
  export declare const keyAgentId: (member: Member) => string;
5
6
  export declare function createMembers(ctx: {
6
7
  request: GatewayTransport['request'];
package/dist/members.js CHANGED
@@ -1,6 +1,13 @@
1
1
  import { join } from 'node:path';
2
+ // Any member that may run: D9's older rule, which a member created before O14 still matches (D17).
2
3
  export const MEMBER_ID = /^[a-z][a-z0-9-]{0,31}$/;
4
+ // D9 for a member the kit creates: no `--` (account agents are `<member>--<6 hex>`) and at most 24 characters.
5
+ const NEW_MEMBER_ID = /^[a-z](?!.*--)[a-z0-9-]{0,23}$/;
3
6
  export const KEY_PREFIX = 'byokit-key-';
7
+ // The inherited auth base every agent reads through (5.15): the kit never creates, signs in to or runs it.
8
+ export const BASE_AGENT = 'byokit-base';
9
+ // The engine's own agents (`main` exists on every install) and the base are never a member, existing or not.
10
+ const RESERVED = new Set(['main', 'openclaw', 'crestodian', BASE_AGENT]);
4
11
  export const keyAgentId = (member) => `${KEY_PREFIX}${member}`;
5
12
  // The engine answers agents.create before its roster hot-reload applies (up to ~113 ms observed), so a turn sent
6
13
  // at once fails as 'unknown agent id'. ensure resolves only once agents.list shows the member.
@@ -10,14 +17,17 @@ export function createMembers(ctx) {
10
17
  const cache = new Map();
11
18
  const listed = (member) => ctx.request('agents.list').then((list) => list.agents.some((agent) => agent.id === member));
12
19
  return { ensure(member) {
13
- if (!MEMBER_ID.test(member) || member.startsWith(KEY_PREFIX))
14
- return Promise.reject(new Error(`invalid member id: ${member}`));
20
+ const invalid = () => new Error(`invalid member id: ${member}`);
21
+ if (!MEMBER_ID.test(member) || member.startsWith(KEY_PREFIX) || RESERVED.has(member))
22
+ return Promise.reject(invalid());
15
23
  const existing = cache.get(member);
16
24
  if (existing)
17
25
  return existing;
18
26
  const workspace = join(ctx.root, 'workspaces', member);
19
27
  const result = (async () => {
20
28
  if (!await listed(member)) {
29
+ if (!NEW_MEMBER_ID.test(member) || member.startsWith('byokit-'))
30
+ throw invalid();
21
31
  await ctx.request('agents.create', { name: member, workspace });
22
32
  const deadline = Date.now() + VISIBLE_TIMEOUT_MS;
23
33
  while (!await listed(member)) {
package/dist/pick.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ import type { Account, AccountId, AccountPick, Considered, Defaults, ModelInfo, PickWhy, Room, RunSelection } from './types.ts';
2
+ export type RoomOf = (a: Account, demand: readonly string[]) => Room;
3
+ /** Every account's `Considered` row, in list order, with the kit-only `bound` applied. */
4
+ export declare function consider(accounts: readonly Account[], defaults: Defaults, sel: RunSelection, room: RoomOf, nowMs: number, models?: (a: Account) => readonly ModelInfo[], bound?: readonly AccountId[]): Considered[];
5
+ /** Auto's winner only; `candidates` are the eligible accounts. Pure and portable; no timers, reads or mid-run switching. */
6
+ export declare function chooseAccount(candidates: readonly Account[], room: (a: Account) => Room, nowMs: number): {
7
+ account: Account;
8
+ why: PickWhy;
9
+ } | undefined;
10
+ /** Resolve once before starting. Without `models`, membership is host-validated and a missing model is ''. */
11
+ export declare function resolveSelection(accounts: readonly Account[], defaults: Defaults, sel: RunSelection, room: RoomOf, nowMs: number, models?: (a: Account) => readonly ModelInfo[], bound?: readonly AccountId[]): AccountPick;