@byokit/openclaw 0.9.0 → 0.11.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;
@@ -173,7 +256,7 @@ export class Engine {
173
256
  const pluginDir = join(this.root, 'plugin');
174
257
  mkdirSync(pluginDir, { recursive: true, mode: 0o700 });
175
258
  // The shipped plugin follows the kit on every prepare too: a state dir from an older kit must not keep its gate.
176
- for (const f of ['package.json', 'index.js', 'keys.js', 'usage.js']) {
259
+ for (const f of ['package.json', 'index.js', 'keys.js', 'usage.js', 'accounts.js']) {
177
260
  const source = join(kitDir, 'plugin', f);
178
261
  putChanged(join(pluginDir, f), readFileSync(source, 'utf8'));
179
262
  }
@@ -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
@@ -2,7 +2,7 @@ import type { SealingAdapter } from '@byokit/secrets';
2
2
  import { type AddKeyResult } from './keys.ts';
3
3
  import { type RouteView } from './routes.ts';
4
4
  import type { BrowserHost, BrowserOptions } from './browser.ts';
5
- import type { Approval, CallOptions, Decision, GatewayMethod, GatewayParams, GatewayResult, GatewayTransport, Hello, KitState, KitEventName, KitEventPayload, LearningCapture, LearningMode, Member, RunEnd, RunEvent, RunSpec, OutputSchema, SchemaOutput, SignInOptions, SignInView, ToolHost, ToolSpec } from './types.ts';
5
+ import type { Account, AccountId, Approval, CallOptions, Decision, Defaults, GatewayMethod, GatewayParams, GatewayResult, GatewayTransport, Hello, KitState, KitEventName, KitEventPayload, LearningCapture, LearningMode, Member, RunEnd, RunEvent, RunSpec, OutputSchema, SchemaOutput, SignInOptions, SignInView, ToolHost, ToolSpec } from './types.ts';
6
6
  export type KitOptions = {
7
7
  stateDir: string;
8
8
  authSeal?: SealingAdapter;
@@ -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
  };
@@ -53,6 +54,8 @@ export declare class OpenClawKit {
53
54
  private transport?;
54
55
  private greeting?;
55
56
  private members?;
57
+ private readonly locks;
58
+ private accountsCtl?;
56
59
  private readonly bridge;
57
60
  private readonly keys;
58
61
  private readonly admission;
@@ -109,6 +112,10 @@ export declare class OpenClawKit {
109
112
  done: Promise<SignInView>;
110
113
  };
111
114
  signOut(member: Member, provider: string): Promise<void>;
115
+ accounts(member: Member): Promise<Account[]>;
116
+ renameAccount(member: Member, id: AccountId, name: string): Promise<Account>;
117
+ defaults(member: Member): Promise<Defaults>;
118
+ setDefaults(member: Member, d: Defaults): Promise<void>;
112
119
  /** Save an explicitly supplied API key (billed per use) in this member's separate key agent. */
113
120
  addKey(agentId: Member, o: {
114
121
  authChoice: string;
package/dist/kit.js CHANGED
@@ -6,9 +6,12 @@ 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";
13
+ import { createAccounts } from "./accounts.js";
14
+ import { createLocks } from "./locks.js";
12
15
  import { keyAgentId, KEY_PREFIX, MEMBER_ID } from "./members.js";
13
16
  import { confirmRetainedLogin as confirmLogin, migrateRetainedLogin as migrateLogin } from "./migrate.js";
14
17
  import { createRuns, signedInProviders } from "./runs.js";
@@ -176,6 +179,7 @@ const operatorMethods = new Set([
176
179
  'openclaw.chat',
177
180
  'openclaw.chat.history',
178
181
  'openclaw.setup.activate',
182
+ 'openclaw.setup.activate.start',
179
183
  'openclaw.setup.auth.start',
180
184
  'openclaw.setup.detect',
181
185
  'openclaw.setup.prepare.start',
@@ -427,6 +431,8 @@ export class OpenClawKit {
427
431
  transport;
428
432
  greeting;
429
433
  members;
434
+ locks = createLocks();
435
+ accountsCtl;
430
436
  // One bridge and one approval surface per kit: listeners and run registrations survive reconnects (B3).
431
437
  // Only the socket itself is per-connection. Approvals always reaches the live transport through this.request().
432
438
  bridge;
@@ -739,6 +745,8 @@ export class OpenClawKit {
739
745
  if (!operatorMethods.has(name) && !nodeMethods.has(name))
740
746
  this.o.log?.(`gateway has unknown method: ${name}`);
741
747
  this.members = createMembers({ request: transport.request.bind(transport), root: this.engine.root });
748
+ this.accountsCtl = createAccounts({ request: transport.request.bind(transport), root: this.engine.root,
749
+ ensure: (member) => this.ensureMember(member), locks: this.locks });
742
750
  // The fail-closed tool bridge feeds the kit's single Approval surface (5.9, O5).
743
751
  await this.bridge.start();
744
752
  this.off.push(transport.onEvent((e) => this.approvalsCtl.handleEvent(e)));
@@ -754,8 +762,13 @@ export class OpenClawKit {
754
762
  const patchFailure = this.current.why === 'engine-patch';
755
763
  if (transport && this.transport === transport)
756
764
  await this.disconnect();
757
- await this.engine.stop();
765
+ const refused = await this.engine.stop().then(() => undefined, refusedOnly);
758
766
  await this.closeBrowsers();
767
+ const sealRefusal = refused ?? (error instanceof AuthStoreSealSizeError ? error : undefined);
768
+ if (sealRefusal) {
769
+ this.setState({ phase: 'failed', why: 'auth-store-seal-size', sealSize: { size: sealRefusal.size, cap: sealRefusal.cap, file: sealRefusal.file } });
770
+ throw sealRefusal;
771
+ }
759
772
  if (error instanceof Error && 'code' in error && error.code === 'engine-already-running') {
760
773
  this.setState({ phase: 'failed', why: 'engine-already-running' });
761
774
  throw error;
@@ -782,6 +795,7 @@ export class OpenClawKit {
782
795
  this.transport = undefined;
783
796
  this.greeting = undefined;
784
797
  this.members = undefined;
798
+ this.accountsCtl = undefined;
785
799
  this.browserPolicySessions.clear();
786
800
  this.bridge.stop();
787
801
  await transport?.stop();
@@ -912,6 +926,28 @@ export class OpenClawKit {
912
926
  signOut(member, provider) {
913
927
  return engineSignOut(this.signInCtx(), member, provider);
914
928
  }
929
+ // accounts (5.15, O14 step S5): the per-member index with listing, defaults and rename. Adding,
930
+ // removing, models, room, pick and move arrive in later steps.
931
+ accounts(member) {
932
+ if (!this.accountsCtl)
933
+ return Promise.reject(new Error('gateway not ready'));
934
+ return this.accountsCtl.list(member);
935
+ }
936
+ renameAccount(member, id, name) {
937
+ if (!this.accountsCtl)
938
+ return Promise.reject(new Error('gateway not ready'));
939
+ return this.accountsCtl.rename(member, id, name);
940
+ }
941
+ defaults(member) {
942
+ if (!this.accountsCtl)
943
+ return Promise.reject(new Error('gateway not ready'));
944
+ return this.accountsCtl.defaults(member);
945
+ }
946
+ setDefaults(member, d) {
947
+ if (!this.accountsCtl)
948
+ return Promise.reject(new Error('gateway not ready'));
949
+ return this.accountsCtl.setDefaults(member, d);
950
+ }
915
951
  /** Save an explicitly supplied API key (billed per use) in this member's separate key agent. */
916
952
  addKey(agentId, o) {
917
953
  return this.keys.add(agentId, o);
@@ -1012,7 +1048,7 @@ export class OpenClawKit {
1012
1048
  const safe = reconcileConfig(response.config, { root: this.engine.root, stateDir: this.o.stateDir,
1013
1049
  port: Number(readFileSync(join(this.engine.root, 'port'), 'utf8')), pluginId: this.o.plugin?.id ?? 'byokit',
1014
1050
  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() } : {}) });
1051
+ offered: this.o.offered, installPolicy: this.o.installPolicy, ...(this.o.browser ? { browser: this.browserConfig() } : {}) });
1016
1052
  if (this.o.browser && !browserToolPolicySafe(safe, this.toolNames()))
1017
1053
  throw new Error('browser tool policy refused');
1018
1054
  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();
@@ -0,0 +1,5 @@
1
+ export declare function createLocks(): {
2
+ shared<T>(agentId: string, work: () => Promise<T>): Promise<T>;
3
+ exclusive<T>(agentIds: string[], work: () => Promise<T>): Promise<T>;
4
+ live(agentId: string): boolean;
5
+ };