Skip to content

Commit d75678d

Browse files
committed
fix(claws): align lifecycle UI with schema v1
1 parent 8dc4fcc commit d75678d

13 files changed

Lines changed: 262 additions & 10 deletions

File tree

‎apps/android/app/src/main/java/ai/openclaw/app/gateway/GatewayProtocol.kt‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ enum class GatewayMethod(
164164
DoctorMemoryRepairDreamingArtifacts("doctor.memory.repairDreamingArtifacts"),
165165
DoctorMemoryDedupeDreamDiary("doctor.memory.dedupeDreamDiary"),
166166
DoctorMemoryRemHarness("doctor.memory.remHarness"),
167+
ClawsStatus("claws.status"),
168+
ClawsDoctor("claws.doctor"),
167169
LogsTail("logs.tail"),
168170
ChannelsStatus("channels.status"),
169171
ChannelsStart("channels.start"),

‎apps/shared/OpenClawKit/Sources/OpenClawProtocol/GatewayModels.swift‎

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11134,6 +11134,184 @@ public struct WebLoginWaitParams: Codable, Sendable {
1113411134
}
1113511135
}
1113611136

11137+
public struct ClawDoctorFinding: Codable, Sendable {
11138+
public let severity: AnyCodable
11139+
public let message: String
11140+
public let path: String?
11141+
public let requirement: String?
11142+
public let fixhint: String?
11143+
11144+
public init(
11145+
severity: AnyCodable,
11146+
message: String,
11147+
path: String? = nil,
11148+
requirement: String? = nil,
11149+
fixhint: String? = nil)
11150+
{
11151+
self.severity = severity
11152+
self.message = message
11153+
self.path = path
11154+
self.requirement = requirement
11155+
self.fixhint = fixhint
11156+
}
11157+
11158+
private enum CodingKeys: String, CodingKey {
11159+
case severity
11160+
case message
11161+
case path
11162+
case requirement
11163+
case fixhint = "fixHint"
11164+
}
11165+
}
11166+
11167+
public struct ClawResourceStatus: Codable, Sendable {
11168+
public let kind: AnyCodable
11169+
public let id: String
11170+
public let state: AnyCodable
11171+
public let relationship: AnyCodable?
11172+
public let origin: AnyCodable?
11173+
public let independentowner: Bool?
11174+
11175+
public init(
11176+
kind: AnyCodable,
11177+
id: String,
11178+
state: AnyCodable,
11179+
relationship: AnyCodable? = nil,
11180+
origin: AnyCodable? = nil,
11181+
independentowner: Bool? = nil)
11182+
{
11183+
self.kind = kind
11184+
self.id = id
11185+
self.state = state
11186+
self.relationship = relationship
11187+
self.origin = origin
11188+
self.independentowner = independentowner
11189+
}
11190+
11191+
private enum CodingKeys: String, CodingKey {
11192+
case kind
11193+
case id
11194+
case state
11195+
case relationship
11196+
case origin
11197+
case independentowner = "independentOwner"
11198+
}
11199+
}
11200+
11201+
public struct ClawStatusEntry: Codable, Sendable {
11202+
public let agentid: String
11203+
public let name: String
11204+
public let version: String
11205+
public let sourcekind: AnyCodable
11206+
public let status: AnyCodable
11207+
public let agentstate: AnyCodable
11208+
public let bootstrapstate: AnyCodable
11209+
public let orphaned: Bool
11210+
public let addedatms: Int
11211+
public let updatedatms: Int
11212+
public let resources: [ClawResourceStatus]
11213+
11214+
public init(
11215+
agentid: String,
11216+
name: String,
11217+
version: String,
11218+
sourcekind: AnyCodable,
11219+
status: AnyCodable,
11220+
agentstate: AnyCodable,
11221+
bootstrapstate: AnyCodable,
11222+
orphaned: Bool,
11223+
addedatms: Int,
11224+
updatedatms: Int,
11225+
resources: [ClawResourceStatus])
11226+
{
11227+
self.agentid = agentid
11228+
self.name = name
11229+
self.version = version
11230+
self.sourcekind = sourcekind
11231+
self.status = status
11232+
self.agentstate = agentstate
11233+
self.bootstrapstate = bootstrapstate
11234+
self.orphaned = orphaned
11235+
self.addedatms = addedatms
11236+
self.updatedatms = updatedatms
11237+
self.resources = resources
11238+
}
11239+
11240+
private enum CodingKeys: String, CodingKey {
11241+
case agentid = "agentId"
11242+
case name
11243+
case version
11244+
case sourcekind = "sourceKind"
11245+
case status
11246+
case agentstate = "agentState"
11247+
case bootstrapstate = "bootstrapState"
11248+
case orphaned
11249+
case addedatms = "addedAtMs"
11250+
case updatedatms = "updatedAtMs"
11251+
case resources
11252+
}
11253+
}
11254+
11255+
public struct ClawsDoctorParams: Codable, Sendable {}
11256+
11257+
public struct ClawsDoctorResult: Codable, Sendable {
11258+
public let schemaversion: String
11259+
public let findings: [ClawDoctorFinding]
11260+
public let summary: [String: AnyCodable]
11261+
11262+
public init(
11263+
schemaversion: String,
11264+
findings: [ClawDoctorFinding],
11265+
summary: [String: AnyCodable])
11266+
{
11267+
self.schemaversion = schemaversion
11268+
self.findings = findings
11269+
self.summary = summary
11270+
}
11271+
11272+
private enum CodingKeys: String, CodingKey {
11273+
case schemaversion = "schemaVersion"
11274+
case findings
11275+
case summary
11276+
}
11277+
}
11278+
11279+
public struct ClawsStatusParams: Codable, Sendable {
11280+
public let target: String?
11281+
11282+
public init(
11283+
target: String? = nil)
11284+
{
11285+
self.target = target
11286+
}
11287+
11288+
private enum CodingKeys: String, CodingKey {
11289+
case target
11290+
}
11291+
}
11292+
11293+
public struct ClawsStatusResult: Codable, Sendable {
11294+
public let schemaversion: String
11295+
public let records: [ClawStatusEntry]
11296+
public let summary: [String: AnyCodable]
11297+
11298+
public init(
11299+
schemaversion: String,
11300+
records: [ClawStatusEntry],
11301+
summary: [String: AnyCodable])
11302+
{
11303+
self.schemaversion = schemaversion
11304+
self.records = records
11305+
self.summary = summary
11306+
}
11307+
11308+
private enum CodingKeys: String, CodingKey {
11309+
case schemaversion = "schemaVersion"
11310+
case records
11311+
case summary
11312+
}
11313+
}
11314+
1113711315
public struct AgentSummary: Codable, Sendable {
1113811316
public let id: String
1113911317
public let kind: AgentKind?

‎docs/cli/claws.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,8 +404,8 @@ credentials, sessions, and unowned local state are excluded.
404404

405405
## Inspect Claws in the Control UI
406406

407-
When the connected Gateway starts with `OPENCLAW_EXPERIMENTAL_CLAWS=1`, the
408-
Control UI adds a **Claws** destination. It shows installed Claws, lifecycle
407+
When experimental Claws are enabled on the connected Gateway, the Control UI
408+
adds a **Claws** destination. It shows installed Claws, lifecycle
409409
health, doctor findings, and managed/referenced provenance. The Gateway
410410
advertises this surface to the UI and returns a secret-safe projection; the
411411
browser does not receive the environment flag, package paths, configuration

‎packages/gateway-protocol/src/schema/claws.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ export const ClawStatusEntrySchema = closedObject({
6464
Type.Literal("modified"),
6565
Type.Literal("missing"),
6666
]),
67+
bootstrapState: Type.Union([
68+
Type.Literal("pending"),
69+
Type.Literal("complete"),
70+
Type.Literal("modified"),
71+
Type.Literal("unsafe"),
72+
Type.Literal("unknown"),
73+
]),
6774
orphaned: Type.Boolean(),
6875
addedAtMs: Type.Integer({ minimum: 0 }),
6976
updatedAtMs: Type.Integer({ minimum: 0 }),

‎scripts/check-protocol-registry.mjs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ const ownerModules = [
111111
...schemaModulesSource.matchAll(/^export \* from "\.\/schema\/([^"]+)\.js";$/gmu),
112112
].map((match) => match[1]);
113113
check(
114-
ownerModules.length === 52 && new Set(ownerModules).size === ownerModules.length,
115-
"schema-modules.ts must contain one unique 52-module owner list",
114+
ownerModules.length === 53 && new Set(ownerModules).size === ownerModules.length,
115+
"schema-modules.ts must contain one unique 53-module owner list",
116116
);
117117
check(
118118
schemaModulesSource.split("\n").filter(Boolean).length === ownerModules.length,

‎src/gateway/server-methods/claws.test.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ describe("Claw gateway projections", () => {
3333
updatedAtMs: 2,
3434
},
3535
agentState: "present",
36+
bootstrapState: "complete",
37+
bootstrap: { state: "complete", workspace: "/secret/workspace", path: "BOOTSTRAP.md" },
3638
workspaceFiles: [
3739
{
3840
path: "SOUL.md",
@@ -75,6 +77,7 @@ describe("Claw gateway projections", () => {
7577
const result = projectClawsStatus([record]);
7678
expect(validateClawsStatusResult(result)).toBe(true);
7779
expect(result.summary).toMatchObject({ claws: 1, healthy: 1, managed: 4, referenced: 1 });
80+
expect(result.records[0]?.bootstrapState).toBe("complete");
7881
expect(result.records[0]?.resources).toEqual(
7982
expect.arrayContaining([
8083
expect.objectContaining({

‎src/gateway/server-methods/claws.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ function projectStatusRecord(record: ClawStatusRecord): ClawStatusEntry {
9090
sourceKind: record.install.claw.kind,
9191
status: record.install.status,
9292
agentState: record.agentState,
93+
bootstrapState: record.bootstrapState,
9394
orphaned: record.orphaned === true,
9495
addedAtMs: record.install.addedAtMs,
9596
updatedAtMs: record.install.updatedAtMs,
@@ -101,6 +102,7 @@ function isHealthy(record: ClawStatusEntry): boolean {
101102
const healthyResourceStates = new Set(["present", "unchanged", "complete"]);
102103
return (
103104
record.status === "complete" &&
105+
record.bootstrapState === "complete" &&
104106
!record.orphaned &&
105107
record.resources.every((resource) => healthyResourceStates.has(resource.state))
106108
);

‎ui/src/app-navigation.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ describe("subtitleForRoute", () => {
369369
sessions: "Active threads and defaults.",
370370
usage: "API usage and costs.",
371371
cron: "Scheduled tasks and recurring agent runs.",
372-
tasks: "Background tasks: subagents, cron runs, CLI.",
372+
tasks: "Background tasks: subagents, automation runs, CLI.",
373373
agents: "Workspaces, tools, identities.",
374374
skills: "Skills and API keys.",
375375
plugins: "Install and manage optional capabilities.",
@@ -379,7 +379,7 @@ describe("subtitleForRoute", () => {
379379
communications: "Messages and text-to-speech settings.",
380380
appearance: "Theme, UI, and setup wizard settings.",
381381
lobsterdex: "Every lobster palette that has visited this browser.",
382-
automation: "Commands, hooks, cron, and plugins.",
382+
automation: "Commands, hooks, automations, and plugins.",
383383
mcp: "MCP servers, auth, tools, and diagnostics.",
384384
memory: "Memory engine, backend, search, and dreaming.",
385385
talk: "Realtime voice: provider, model, and speaker voice.",

‎ui/src/i18n/locales/en.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1987,6 +1987,7 @@ export const en: TranslationMap = {
19871987
agent: "Agent",
19881988
source: "Source",
19891989
updated: "Updated",
1990+
bootstrap: "First-run setup",
19901991
independentOwner: "Also used outside this Claw",
19911992
resourceKinds: {
19921993
agent: "Agent",
@@ -2008,6 +2009,7 @@ export const en: TranslationMap = {
20082009
pending: "Pending",
20092010
failed: "Failed",
20102011
removed: "Removed",
2012+
unknown: "Unknown",
20112013
},
20122014
origins: {
20132015
clawIntroduced: "Added by this Claw",

‎ui/src/pages/claws/claws-page.ts‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,18 @@ import {
1414
type ApplicationContext,
1515
type ApplicationGatewaySnapshot,
1616
} from "../../app/context.ts";
17-
import { renderPluginsHubTabs, type PluginsHubTab } from "../../components/plugins-hub-tabs.ts";
17+
import { renderHubTabs } from "../../components/hub-tabs.ts";
1818
import { renderSettingsWorkspace } from "../../components/settings-workspace.ts";
1919
import { t } from "../../i18n/index.ts";
2020
import { isGatewayMethodAdvertised } from "../../lib/gateway-methods.ts";
2121
import { OpenClawLightDomElement } from "../../lit/openclaw-element.ts";
2222
import { SubscriptionsController } from "../../lit/subscriptions-controller.ts";
2323
import "../../styles/claws.css";
24+
import {
25+
PLUGINS_HUB_PANEL_ID,
26+
pluginsHubTabs,
27+
type PluginsHubTab,
28+
} from "../plugins/plugins-hub.ts";
2429
import { renderClaws } from "./view.ts";
2530

2631
function errorMessage(error: unknown): string {
@@ -68,7 +73,7 @@ class ClawsPage extends OpenClawLightDomElement {
6873
const wasConnected = this.connected;
6974
const wasAvailable = this.available;
7075
this.client = snapshot.client;
71-
this.connected = snapshot.connected;
76+
this.connected = snapshot.phase === "connected";
7277
this.available =
7378
isGatewayMethodAdvertised(snapshot, "claws.status") === true &&
7479
isGatewayMethodAdvertised(snapshot, "claws.doctor") === true;
@@ -175,9 +180,13 @@ class ClawsPage extends OpenClawLightDomElement {
175180
</section>
176181
${renderSettingsWorkspace(html`
177182
<div class="plugins-hub-tabs-row">
178-
${renderPluginsHubTabs({
183+
${renderHubTabs({
184+
id: "plugins",
179185
active: "claws",
180-
showClaws: true,
186+
tabs: pluginsHubTabs(null, true),
187+
ariaLabel: t("pluginsPage.hubTablistLabel"),
188+
panelId: PLUGINS_HUB_PANEL_ID,
189+
className: "plugins-tabs",
181190
onSelect: (tab) => this.selectHubTab(tab),
182191
})}
183192
</div>

0 commit comments

Comments
 (0)