@xfxstudio/claworld 0.2.14 → 0.2.16

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.
@@ -3,12 +3,6 @@ import {
3
3
  normalizeRuntimeRegistration,
4
4
  resolveRuntimeAppToken,
5
5
  } from './account-identity.js';
6
- import {
7
- CHAT_REQUEST_APPROVAL_POLICY_MODES,
8
- CHAT_REQUEST_APPROVAL_POLICY_ORIGIN_TYPES,
9
- DEFAULT_CHAT_REQUEST_APPROVAL_POLICY_MODE,
10
- normalizeChatRequestApprovalPolicy,
11
- } from '../../product-shell/contracts/chat-request-approval-policy.js';
12
6
 
13
7
  const REQUIRED_KEYS = ['enabled', 'serverUrl', 'apiKey', 'accountId'];
14
8
 
@@ -124,45 +118,6 @@ const SINGLE_ACCOUNT_PROPERTIES = {
124
118
  },
125
119
  },
126
120
  },
127
- approval: {
128
- type: 'object',
129
- additionalProperties: false,
130
- properties: {
131
- mode: {
132
- type: 'string',
133
- enum: [...CHAT_REQUEST_APPROVAL_POLICY_MODES],
134
- description: 'Declarative inbound chat-request approval policy for this account.',
135
- default: DEFAULT_CHAT_REQUEST_APPROVAL_POLICY_MODE,
136
- },
137
- blocks: {
138
- type: 'object',
139
- additionalProperties: false,
140
- properties: {
141
- originTypes: {
142
- type: 'array',
143
- items: {
144
- type: 'string',
145
- enum: [...CHAT_REQUEST_APPROVAL_POLICY_ORIGIN_TYPES],
146
- },
147
- description: 'Optional canonical chat-request origin types that should be rejected by backend policy.',
148
- },
149
- worldIds: {
150
- type: 'array',
151
- items: {
152
- type: 'string',
153
- minLength: 1,
154
- },
155
- description: 'Optional world ids that should be rejected by backend policy.',
156
- },
157
- },
158
- },
159
- autoAccept: {
160
- type: 'boolean',
161
- description: 'Legacy alias. `true` maps to `approval.mode = "open"` and `false` maps to `approval.mode = "manual_review"`.',
162
- default: false,
163
- },
164
- },
165
- },
166
121
  testing: {
167
122
  type: 'object',
168
123
  additionalProperties: false,
@@ -204,7 +159,7 @@ export const claworldChannelConfigJsonSchema = {
204
159
  export const claworldChannelConfigSchema = {
205
160
  channelId: CLAWORLD_CHANNEL_ID,
206
161
  required: REQUIRED_KEYS,
207
- optional: ['name', 'heartbeatSeconds', 'reconnect', 'routing', 'approval', 'testing', 'appToken', 'registration', 'relay', 'toolProfile', 'defaultAccount', 'accounts'],
162
+ optional: ['name', 'heartbeatSeconds', 'reconnect', 'routing', 'testing', 'appToken', 'registration', 'relay', 'toolProfile', 'defaultAccount', 'accounts'],
208
163
  jsonSchema: claworldChannelConfigJsonSchema,
209
164
  description:
210
165
  '最小 OpenClaw claworld channel 配置;支持单账号或 accounts.<id> 多账号模式。canonical flow uses appToken + registration.displayName bootstrap.',
@@ -284,12 +239,6 @@ export function validateClaworldChannelConfig(config = {}, accountId = null) {
284
239
  const errors = [];
285
240
  const registration = normalizeRuntimeRegistration(candidate);
286
241
  const appToken = resolveRuntimeAppToken(candidate);
287
- const approval = normalizeChatRequestApprovalPolicy(candidate.approval, {
288
- legacyAutoAccept: typeof candidate.approval?.autoAccept === 'boolean'
289
- ? candidate.approval.autoAccept
290
- : null,
291
- });
292
-
293
242
  const configuredIds = listConfiguredClaworldAccountIds(config);
294
243
  const hasMultipleAccounts = configuredIds.length > 1;
295
244
  const explicitDefaultAccount = String(root?.defaultAccount || '').trim();
@@ -354,7 +303,6 @@ export function validateClaworldChannelConfig(config = {}, accountId = null) {
354
303
  fallbackTarget,
355
304
  allowHumanInterrupt: candidate.routing?.allowHumanInterrupt !== false,
356
305
  },
357
- approval,
358
306
  testing: {
359
307
  allowBridgedCommandDispatch: candidate.testing?.allowBridgedCommandDispatch === true,
360
308
  },
@@ -391,7 +339,6 @@ export function inspectClaworldChannelAccount(config = {}, accountId = null) {
391
339
  heartbeatSeconds: normalized.heartbeatSeconds,
392
340
  reconnect: normalized.reconnect,
393
341
  routing: normalized.routing,
394
- approval: normalized.approval,
395
342
  testing: normalized.testing,
396
343
  appToken: normalized.appToken || null,
397
344
  registration: normalized.registration,
@@ -421,7 +368,6 @@ export function resolveClaworldRuntimeConfig(config = {}, accountId = null) {
421
368
  return {
422
369
  ...result.normalized,
423
370
  accountId: result.normalized.accountId || accountId || readDefaultAccountId(config) || 'default',
424
- approval: result.normalized.approval,
425
371
  relay: result.normalized.relay,
426
372
  };
427
373
  }
@@ -6,10 +6,6 @@ import {
6
6
  CLAWORLD_READ_ONLY_OPENCLAW_TOOL_NAMES,
7
7
  CLAWORLD_TOOL_PROFILES,
8
8
  } from '../runtime/tool-inventory.js';
9
- import {
10
- DEFAULT_CHAT_REQUEST_APPROVAL_POLICY_MODE,
11
- normalizeChatRequestApprovalMode,
12
- } from '../../product-shell/contracts/chat-request-approval-policy.js';
13
9
 
14
10
  export const DEFAULT_CLAWORLD_SERVER_URL = 'https://claworld.love';
15
11
  export const DEFAULT_CLAWORLD_API_KEY = 'local-test';
@@ -17,7 +13,6 @@ export const DEFAULT_CLAWORLD_AGENT_ID = 'main';
17
13
  export const DEFAULT_CLAWORLD_ACCOUNT_ID = 'claworld';
18
14
  export const DEFAULT_CLAWORLD_TOOL_PROFILE = 'default';
19
15
  export const DEFAULT_CLAWORLD_DM_SCOPE = 'per-channel-peer';
20
- export const DEFAULT_CLAWORLD_APPROVAL_MODE = DEFAULT_CHAT_REQUEST_APPROVAL_POLICY_MODE;
21
16
  export const DEFAULT_CLAWORLD_SESSION_TARGET = 'mainagent';
22
17
  export const DEFAULT_CLAWORLD_FALLBACK_TARGET = 'mainagent';
23
18
  export const CLAWORLD_PLUGIN_TOOL_ALLOW_ENTRY = 'claworld';
@@ -346,9 +341,6 @@ function buildManagedAccountEntry(options = {}) {
346
341
  accountId: options.accountId,
347
342
  name: normalizeText(options.name, normalizeText(options.displayName, null)),
348
343
  routing: buildManagedRoutingEntry(options),
349
- approval: {
350
- mode: normalizeChatRequestApprovalMode(options.approvalMode, DEFAULT_CLAWORLD_APPROVAL_MODE),
351
- },
352
344
  };
353
345
 
354
346
  if (options.appToken) {
@@ -373,7 +365,6 @@ function buildManagedAccountEntry(options = {}) {
373
365
  }
374
366
 
375
367
  function buildMergedAccountEntry(existingAccount = {}, options = {}) {
376
- const existingApproval = ensureObject(existingAccount.approval);
377
368
  const existingRelay = ensureObject(existingAccount.relay);
378
369
  const existingRegistration = ensureObject(existingAccount.registration);
379
370
  const merged = {
@@ -384,10 +375,6 @@ function buildMergedAccountEntry(existingAccount = {}, options = {}) {
384
375
  accountId: options.accountId,
385
376
  name: normalizeText(options.name, normalizeText(existingAccount.name, normalizeText(options.displayName, null))),
386
377
  routing: buildManagedRoutingEntry(options, existingAccount.routing),
387
- approval: {
388
- ...existingApproval,
389
- mode: normalizeChatRequestApprovalMode(options.approvalMode, DEFAULT_CLAWORLD_APPROVAL_MODE),
390
- },
391
378
  ...(options.defaultTargetAgentId
392
379
  ? {
393
380
  relay: {
@@ -589,17 +576,6 @@ export function resolveDefaultManagedDisplayName(accountId = DEFAULT_CLAWORLD_AC
589
576
  return `${titleCase(accountId)} Channel Agent`;
590
577
  }
591
578
 
592
- function resolveStoredApprovalMode(existingAccount = {}) {
593
- const existingApproval = ensureObject(existingAccount.approval);
594
- if (normalizeText(existingApproval.mode, null)) {
595
- return normalizeChatRequestApprovalMode(existingApproval.mode, DEFAULT_CLAWORLD_APPROVAL_MODE);
596
- }
597
- if (typeof existingApproval.autoAccept === 'boolean') {
598
- return existingApproval.autoAccept ? 'open' : DEFAULT_CLAWORLD_APPROVAL_MODE;
599
- }
600
- return DEFAULT_CLAWORLD_APPROVAL_MODE;
601
- }
602
-
603
579
  export function resolveClaworldManagedRuntimeOptions({
604
580
  cfg = {},
605
581
  accountId = null,
@@ -673,15 +649,6 @@ export function resolveClaworldManagedRuntimeOptions({
673
649
  explicitRegistrationDisplayName,
674
650
  existingRegistrationDisplayName,
675
651
  );
676
- const approvalMode = normalizeChatRequestApprovalMode(
677
- normalizeText(overrides.approvalMode, null),
678
- typeof overrides.autoAccept === 'boolean'
679
- ? (overrides.autoAccept ? 'open' : DEFAULT_CLAWORLD_APPROVAL_MODE)
680
- : normalizeChatRequestApprovalMode(
681
- normalizeText(existingBackup.approvalMode, null),
682
- resolveStoredApprovalMode(existingAccount),
683
- ),
684
- );
685
652
 
686
653
  return {
687
654
  repoRoot: normalizeText(overrides.repoRoot, null),
@@ -700,7 +667,6 @@ export function resolveClaworldManagedRuntimeOptions({
700
667
  displayName,
701
668
  name,
702
669
  defaultTargetAgentId: normalizeText(overrides.defaultTargetAgentId, null),
703
- approvalMode,
704
670
  sessionDmScope: normalizeText(
705
671
  overrides.sessionDmScope,
706
672
  normalizeText(existingBackup.sessionDmScope, DEFAULT_CLAWORLD_DM_SCOPE),
@@ -910,7 +876,6 @@ export function stripClaworldManagedRuntimeConfig(inputConfig = {}, {
910
876
  displayName: normalizeText(existingAccount.name, normalizeText(existingAgent?.name, null)),
911
877
  name: normalizeText(existingAccount.name, null),
912
878
  registrationDisplayName: normalizeRegistrationDisplayName(existingAccount?.registration?.displayName, null),
913
- approvalMode: normalizeChatRequestApprovalMode(existingAccount?.approval?.mode, DEFAULT_CLAWORLD_APPROVAL_MODE),
914
879
  sessionDmScope: normalizeText(config?.session?.dmScope, DEFAULT_CLAWORLD_DM_SCOPE),
915
880
  toolProfile: existingToolProfile,
916
881
  preservedAt: new Date().toISOString(),