Files
openclaw/src/plugin-sdk/channel-setup.ts
T
Jesse Merhi 4a2a600809 feat(channels): add channel-owned setup contracts (#112176)
* feat(channels): add channel-owned setup contracts

* test(channels): align legacy setup fixtures

* chore(channels): regenerate config and SDK baselines after rebase

* fix(update): run fresh doctor after current-process core changes

* fix(channels): align add pre-scan with execution precedence

* style(cli): format channels-cli test additions

* fix(channels): restore option-before-positional channel resolution via metadata arity scan

* fix(channels): keep help flags out of metadata arity escalation

* test(update): mock fresh post-update doctor in current-process suites

* style: format review fixes and correct entrypoint mock type

* fix(channels): register only modern contract options for dual-publishing plugins

* test(update): align downgrade suites with fresh-doctor child invocation

* docs(channels): record empty-contract and input-forwarding invariants

* fix(line): keep the shipped --token switch as a channel access token alias

* fix(signal): stop treating exact cross-family loopback endpoints as bind-aligned

* chore(config): regenerate docs config baselines after second rebase

* style: format rebased channels add tests

* fix(channels): enforce field-key and flag-name agreement in setup contracts

* fix(signal): detect container endpoints for bare --http-url setup

* fix(signal): ignore unconfigured accounts in transport collision checks

* fix(channels): validate negated setup flags in contract and normalizer

* fix(signal): preserve existing transport kind when setup detection is unreachable

* style(signal): use direct boolean check in collision guard

* style(signal): type test config literals

* docs(update): record two-read design of fresh-doctor validation gate

* fix(channels): satisfy post-rebase architecture gates

* docs: refresh channel setup map

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-07-22 19:57:42 -04:00

58 lines
2.2 KiB
TypeScript

// Channel setup contracts expose setup wizard hooks and account config writes to plugins.
import type { ChannelSetupWizard } from "../channels/plugins/setup-wizard-types.js";
import type { ChannelSetupAdapter } from "../channels/plugins/types.adapters.js";
export { defineChannelSetupContract } from "../channels/plugins/setup-contract.js";
import {
createOptionalChannelSetupAdapter,
createOptionalChannelSetupWizard,
} from "./optional-channel-setup.js";
export type { ChannelSetupAdapter } from "../channels/plugins/types.adapters.js";
export type { ChannelSetupInput } from "../channels/plugins/setup-input.js";
export type { ChannelSetupDmPolicy, ChannelSetupWizard } from "./setup.js";
export {
DEFAULT_ACCOUNT_ID,
baseUrlTextInput,
createTopLevelChannelDmPolicy,
defineTokenCredential,
formatDocsLink,
setSetupChannelEnabled,
splitSetupEntries,
} from "./setup.js";
/** Metadata used to advertise an optional channel plugin during setup flows. */
type OptionalChannelSetupParams = {
/** Channel id shown in setup status and wizard routing. */
channel: string;
/** Human-readable plugin name used in install guidance. */
label: string;
/** Package spec operators should install to enable the optional channel. */
npmSpec?: string;
/** Docs path linked from setup validation and wizard hints. */
docsPath?: string;
};
/** Paired setup adapter + setup wizard for channels that may not be installed yet. */
export type OptionalChannelSetupSurface = {
/** Adapter that fails validation with install guidance until the plugin is installed. */
setupAdapter: ChannelSetupAdapter;
/** Wizard status/finalize surface that points operators to the missing plugin. */
setupWizard: ChannelSetupWizard;
};
export {
createOptionalChannelSetupAdapter,
createOptionalChannelSetupWizard,
} from "./optional-channel-setup.js";
/** Build both optional setup surfaces from one metadata object. */
export function createOptionalChannelSetupSurface(
/** Optional plugin metadata shared by the adapter and wizard. */
params: OptionalChannelSetupParams,
): OptionalChannelSetupSurface {
return {
setupAdapter: createOptionalChannelSetupAdapter(params),
setupWizard: createOptionalChannelSetupWizard(params),
};
}