feat(plugin): sync OpenClaw slash-command catalog to Fabric
- command-sync.ts: buildFabricCommandSpecs(cfg) reads OpenClaw native command specs via openclaw/plugin-sdk/native-command-registry (listNativeCommandSpecsForConfig + findCommandByNativeName), resolves dynamic arg choices to a static snapshot (resolveCommandArgChoices) — same data Discord registers as slash commands. - syncFabricCommands(): on gateway_start, after inbound starts, PUT the catalog to each connected guild (FabricClient.syncCommands -> PUT /api/commands; idempotent, one per guild). - Fabric stays a TEXT-command surface (no nativeCommands capability): execution still flows as a /<cmd> message into OpenClaw's command system; this catalog only drives frontend autocomplete. Verified: 41 specs built (args/choices incl. dynamic), synced to test-guild1, GET /api/commands round-trips count=41. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -115,6 +115,17 @@ export class FabricClient {
|
||||
return this.post(`${guildEndpoint}/api/channels/${channelId}/leave`, {}, guildToken);
|
||||
}
|
||||
|
||||
// Register the OpenClaw slash-command catalog with this guild (idempotent
|
||||
// full replace). The frontend GETs it for `/` autocomplete; execution
|
||||
// still flows as a normal /<cmd> message into OpenClaw's command system.
|
||||
syncCommands(
|
||||
guildEndpoint: string,
|
||||
guildToken: string,
|
||||
commands: unknown[],
|
||||
): Promise<unknown> {
|
||||
return this.req('PUT', `${guildEndpoint}/api/commands`, guildToken, { commands });
|
||||
}
|
||||
|
||||
// [{ userId, bypass }] — bypass is true only for discuss/work bypass-list
|
||||
channelMembers(
|
||||
guildEndpoint: string,
|
||||
|
||||
Reference in New Issue
Block a user