Skip to content

Commit 1adaa28

Browse files
[plugin sdk] Add generic plugin host-hook contracts (#72287)
Merged via squash. Prepared head SHA: 68e5f2c Co-authored-by: 100yenadmin <239388517+100yenadmin@users.noreply.github.com> Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com> Reviewed-by: @jalehman
1 parent ef1e974 commit 1adaa28

96 files changed

Lines changed: 7247 additions & 282 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Docs: https://docs.openclaw.ai
1515
- Gateway/startup: pass the plugin metadata snapshot from config validation into plugin bootstrap so startup reuses one manifest product instead of rebuilding plugin metadata. Thanks @shakkernerd.
1616
- Plugin SDK/testing: promote bundled plugin/provider/channel contract helpers to focused SDK test subpaths and retire the repo-only `test/helpers/plugins` TypeScript bridge. Thanks @vincentkoc.
1717
- Plugin SDK/testing: add a focused `plugin-sdk/plugin-test-api` helper subpath and move bundled plugin registration tests off the repo-only plugin API bridge. Thanks @vincentkoc.
18+
- Plugin SDK: add generic host hooks for session state, next-turn context, trusted tool policy, UI descriptors, events, scheduler cleanup, and run-scoped plugin context. (#72287) Thanks @100yenadmin.
1819
- Plugin SDK/testing: expose provider catalog, wizard, registry, manifest, public-artifact, outbound, and TTS contract helpers through documented SDK testing seams so bundled plugin tests no longer import repo `src/**` internals. Thanks @vincentkoc.
1920
- Matrix: attach versioned structured approval metadata to pending approval messages so capable Matrix clients can render richer approval UI while body text and reaction fallback keep working. (#72432) Thanks @kakahu2015.
2021

apps/macos/Sources/OpenClawProtocol/GatewayModels.swift

Lines changed: 135 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1881,6 +1881,58 @@ public struct SessionsPatchParams: Codable, Sendable {
18811881
}
18821882
}
18831883

1884+
public struct SessionsPluginPatchParams: Codable, Sendable {
1885+
public let key: String
1886+
public let pluginid: String
1887+
public let namespace: String
1888+
public let value: AnyCodable?
1889+
public let unset: Bool?
1890+
1891+
public init(
1892+
key: String,
1893+
pluginid: String,
1894+
namespace: String,
1895+
value: AnyCodable?,
1896+
unset: Bool?)
1897+
{
1898+
self.key = key
1899+
self.pluginid = pluginid
1900+
self.namespace = namespace
1901+
self.value = value
1902+
self.unset = unset
1903+
}
1904+
1905+
private enum CodingKeys: String, CodingKey {
1906+
case key
1907+
case pluginid = "pluginId"
1908+
case namespace
1909+
case value
1910+
case unset
1911+
}
1912+
}
1913+
1914+
public struct SessionsPluginPatchResult: Codable, Sendable {
1915+
public let ok: Bool
1916+
public let key: String
1917+
public let value: AnyCodable?
1918+
1919+
public init(
1920+
ok: Bool,
1921+
key: String,
1922+
value: AnyCodable?)
1923+
{
1924+
self.ok = ok
1925+
self.key = key
1926+
self.value = value
1927+
}
1928+
1929+
private enum CodingKeys: String, CodingKey {
1930+
case ok
1931+
case key
1932+
case value
1933+
}
1934+
}
1935+
18841936
public struct SessionsResetParams: Codable, Sendable {
18851937
public let key: String
18861938
public let reason: AnyCodable?
@@ -3292,6 +3344,8 @@ public struct ToolCatalogEntry: Codable, Sendable {
32923344
public let source: AnyCodable
32933345
public let pluginid: String?
32943346
public let optional: Bool?
3347+
public let risk: AnyCodable?
3348+
public let tags: [String]?
32953349
public let defaultprofiles: [AnyCodable]
32963350

32973351
public init(
@@ -3301,6 +3355,8 @@ public struct ToolCatalogEntry: Codable, Sendable {
33013355
source: AnyCodable,
33023356
pluginid: String?,
33033357
optional: Bool?,
3358+
risk: AnyCodable?,
3359+
tags: [String]?,
33043360
defaultprofiles: [AnyCodable])
33053361
{
33063362
self.id = id
@@ -3309,6 +3365,8 @@ public struct ToolCatalogEntry: Codable, Sendable {
33093365
self.source = source
33103366
self.pluginid = pluginid
33113367
self.optional = optional
3368+
self.risk = risk
3369+
self.tags = tags
33123370
self.defaultprofiles = defaultprofiles
33133371
}
33143372

@@ -3319,6 +3377,8 @@ public struct ToolCatalogEntry: Codable, Sendable {
33193377
case source
33203378
case pluginid = "pluginId"
33213379
case optional
3380+
case risk
3381+
case tags
33223382
case defaultprofiles = "defaultProfiles"
33233383
}
33243384
}
@@ -3401,6 +3461,8 @@ public struct ToolsEffectiveEntry: Codable, Sendable {
34013461
public let source: AnyCodable
34023462
public let pluginid: String?
34033463
public let channelid: String?
3464+
public let risk: AnyCodable?
3465+
public let tags: [String]?
34043466

34053467
public init(
34063468
id: String,
@@ -3409,7 +3471,9 @@ public struct ToolsEffectiveEntry: Codable, Sendable {
34093471
rawdescription: String,
34103472
source: AnyCodable,
34113473
pluginid: String?,
3412-
channelid: String?)
3474+
channelid: String?,
3475+
risk: AnyCodable?,
3476+
tags: [String]?)
34133477
{
34143478
self.id = id
34153479
self.label = label
@@ -3418,6 +3482,8 @@ public struct ToolsEffectiveEntry: Codable, Sendable {
34183482
self.source = source
34193483
self.pluginid = pluginid
34203484
self.channelid = channelid
3485+
self.risk = risk
3486+
self.tags = tags
34213487
}
34223488

34233489
private enum CodingKeys: String, CodingKey {
@@ -3428,6 +3494,8 @@ public struct ToolsEffectiveEntry: Codable, Sendable {
34283494
case source
34293495
case pluginid = "pluginId"
34303496
case channelid = "channelId"
3497+
case risk
3498+
case tags
34313499
}
34323500
}
34333501

@@ -4215,6 +4283,72 @@ public struct PluginApprovalResolveParams: Codable, Sendable {
42154283
}
42164284
}
42174285

4286+
public struct PluginControlUiDescriptor: Codable, Sendable {
4287+
public let id: String
4288+
public let pluginid: String
4289+
public let pluginname: String?
4290+
public let surface: AnyCodable
4291+
public let label: String
4292+
public let description: String?
4293+
public let placement: String?
4294+
public let schema: AnyCodable?
4295+
public let requiredscopes: [String]?
4296+
4297+
public init(
4298+
id: String,
4299+
pluginid: String,
4300+
pluginname: String?,
4301+
surface: AnyCodable,
4302+
label: String,
4303+
description: String?,
4304+
placement: String?,
4305+
schema: AnyCodable?,
4306+
requiredscopes: [String]?)
4307+
{
4308+
self.id = id
4309+
self.pluginid = pluginid
4310+
self.pluginname = pluginname
4311+
self.surface = surface
4312+
self.label = label
4313+
self.description = description
4314+
self.placement = placement
4315+
self.schema = schema
4316+
self.requiredscopes = requiredscopes
4317+
}
4318+
4319+
private enum CodingKeys: String, CodingKey {
4320+
case id
4321+
case pluginid = "pluginId"
4322+
case pluginname = "pluginName"
4323+
case surface
4324+
case label
4325+
case description
4326+
case placement
4327+
case schema
4328+
case requiredscopes = "requiredScopes"
4329+
}
4330+
}
4331+
4332+
public struct PluginsUiDescriptorsParams: Codable, Sendable {}
4333+
4334+
public struct PluginsUiDescriptorsResult: Codable, Sendable {
4335+
public let ok: Bool
4336+
public let descriptors: [PluginControlUiDescriptor]
4337+
4338+
public init(
4339+
ok: Bool,
4340+
descriptors: [PluginControlUiDescriptor])
4341+
{
4342+
self.ok = ok
4343+
self.descriptors = descriptors
4344+
}
4345+
4346+
private enum CodingKeys: String, CodingKey {
4347+
case ok
4348+
case descriptors
4349+
}
4350+
}
4351+
42184352
public struct DevicePairListParams: Codable, Sendable {}
42194353

42204354
public struct DevicePairApproveParams: Codable, Sendable {

0 commit comments

Comments
 (0)