build: PaddedCell-style install.mjs + SDK-aligned packaging

install.mjs (--install/--build-only/--uninstall/--openclaw-profile-path),
tsconfig outDir dist/fabric, package.json openclaw file dep + main.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
h z
2026-05-15 17:30:37 +01:00
parent 9221664428
commit 7fed6d07f6
537 changed files with 536836 additions and 3 deletions

46
dist/fabric/src/channel.js vendored Normal file
View File

@@ -0,0 +1,46 @@
import { createChatChannelPlugin, createChannelPluginBase, } from 'openclaw/plugin-sdk/channel-core';
export function resolveFabricAccount(cfg, accountId) {
const section = cfg.channels?.['fabric'];
const centerApiBase = section?.centerApiBase;
if (!centerApiBase)
throw new Error('fabric: channels.fabric.centerApiBase is required');
return {
accountId: accountId ?? null,
centerApiBase,
allowFrom: section?.allowFrom ?? [],
dmPolicy: section?.dmSecurity,
};
}
// Outbound is wired by the entry (it needs the identity registry + client to
// post as the right agent). Channel-turn visible replies go through the
// inbound adapter's delivery callback; this object owns config/security only.
export function buildFabricChannelPlugin(sendText) {
return createChatChannelPlugin({
base: createChannelPluginBase({
id: 'fabric',
setup: {
resolveAccount: resolveFabricAccount,
inspectAccount(cfg, accountId) {
const section = cfg.channels?.['fabric'];
const ok = Boolean(section?.centerApiBase);
return { enabled: ok, configured: ok, tokenStatus: ok ? 'available' : 'missing' };
},
},
}),
security: {
dm: {
channelKey: 'fabric',
resolvePolicy: (a) => a.dmPolicy,
resolveAllowFrom: (a) => a.allowFrom,
defaultPolicy: 'allowlist',
},
},
// Fabric replies thread by being posted into the same channel.
threading: { topLevelReplyToMode: 'channel' },
outbound: {
attachedResults: {
sendText: async (params) => sendText(params),
},
},
});
}