feat(plugin): fabric-guild-list + fabric-channel-set-purpose tools + purpose on existing tools
Adds two agent-facing tools that close the discoverability loop:
- fabric-guild-list — enumerates guilds the agent belongs to with
name + purpose + status (no api calls beyond the existing agentLogin
response). Optional nameFilter/purposeFilter for narrowing.
- fabric-channel-set-purpose — PATCH /api/channels/:id { purpose }
so agents can backfill or update an existing channel's purpose.
Extends existing tools:
- fabric-channel-list now returns purpose on each row.
- create-{chat,work,report,discussion}-channel accept optional purpose.
FabricClient + FabricSession type changes carry the new field through.
Manifest contracts.tools updated (jiti loader needs both manifest entry
and onStartup activation to register).
Lets workflows that previously needed hardcoded channel ids instead say
'find a guild whose purpose mentions debate, then a channel of x_type
announce whose purpose covers public debate broadcasts.'
This commit is contained in:
@@ -6,7 +6,15 @@ export type FabricSession = {
|
||||
accessToken: string;
|
||||
refreshToken: string;
|
||||
user: { id: string; email: string; name: string };
|
||||
guilds: Array<{ nodeId: string; name: string; endpoint: string; status: string }>;
|
||||
guilds: Array<{
|
||||
nodeId: string;
|
||||
name: string;
|
||||
endpoint: string;
|
||||
status: string;
|
||||
// free-form description of this guild's role; admin-set on Center.
|
||||
// null when the admin hasn't filled it in yet.
|
||||
purpose?: string | null;
|
||||
}>;
|
||||
guildAccessTokens: Array<{ guildNodeId: string; token: string }>;
|
||||
};
|
||||
|
||||
@@ -100,11 +108,30 @@ export class FabricClient {
|
||||
memberUserIds?: string[];
|
||||
onDuty?: string;
|
||||
listeners?: string[];
|
||||
// free-form purpose; optional. Existing agents can also set/update
|
||||
// it later via setChannelPurpose().
|
||||
purpose?: string;
|
||||
},
|
||||
): Promise<{ id: string }> {
|
||||
return this.post(`${guildEndpoint}/api/channels`, body, guildToken);
|
||||
}
|
||||
|
||||
// PATCH /api/channels/:id — backend currently only patches `purpose`.
|
||||
// Caller must be a member of the channel (or any user if public).
|
||||
setChannelPurpose(
|
||||
guildEndpoint: string,
|
||||
guildToken: string,
|
||||
channelId: string,
|
||||
purpose: string,
|
||||
): Promise<{ id: string; name: string; xType: string; purpose: string | null }> {
|
||||
return this.req(
|
||||
'PATCH',
|
||||
`${guildEndpoint}/api/channels/${channelId}`,
|
||||
guildToken,
|
||||
{ purpose },
|
||||
);
|
||||
}
|
||||
|
||||
closeChannel(guildEndpoint: string, guildToken: string, channelId: string): Promise<unknown> {
|
||||
return this.post(`${guildEndpoint}/api/channels/${channelId}/close`, {}, guildToken);
|
||||
}
|
||||
@@ -212,6 +239,7 @@ export class FabricClient {
|
||||
closed: boolean;
|
||||
lastSeq: number;
|
||||
createdAt: string;
|
||||
purpose?: string | null;
|
||||
}>> {
|
||||
return this.req(
|
||||
'GET',
|
||||
|
||||
Reference in New Issue
Block a user