@chorus-aidlc/chorus-openclaw-plugin 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/commands.ts +8 -8
- package/src/event-router.ts +1 -1
- package/src/index.ts +12 -1
package/package.json
CHANGED
package/src/commands.ts
CHANGED
|
@@ -49,14 +49,14 @@ interface AssignmentsResponse {
|
|
|
49
49
|
function formatStatus(checkin: CheckinResponse, connectionStatus: string): string {
|
|
50
50
|
const lines: string[] = [
|
|
51
51
|
`Connection: ${connectionStatus}`,
|
|
52
|
-
`Assignments: ${checkin
|
|
53
|
-
`Notifications: ${checkin
|
|
52
|
+
`Assignments: ${checkin?.pending?.ideasCount ?? 0} ideas, ${checkin?.pending?.tasksCount ?? 0} tasks`,
|
|
53
|
+
`Notifications: ${checkin?.notifications?.unreadCount ?? 0} unread`,
|
|
54
54
|
];
|
|
55
55
|
return lines.join("\n");
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
function formatTaskList(tasks: AssignedTask[]): string {
|
|
59
|
-
if (tasks
|
|
58
|
+
function formatTaskList(tasks: AssignedTask[] | undefined): string {
|
|
59
|
+
if (!tasks?.length) {
|
|
60
60
|
return "No assigned tasks.";
|
|
61
61
|
}
|
|
62
62
|
|
|
@@ -66,8 +66,8 @@ function formatTaskList(tasks: AssignedTask[]): string {
|
|
|
66
66
|
return `Assigned tasks (${tasks.length}):\n${lines.join("\n")}`;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
function formatIdeaList(ideas: AssignedIdea[]): string {
|
|
70
|
-
if (ideas
|
|
69
|
+
function formatIdeaList(ideas: AssignedIdea[] | undefined): string {
|
|
70
|
+
if (!ideas?.length) {
|
|
71
71
|
return "No assigned ideas.";
|
|
72
72
|
}
|
|
73
73
|
|
|
@@ -115,7 +115,7 @@ export function registerChorusCommands(
|
|
|
115
115
|
"chorus_get_my_assignments",
|
|
116
116
|
{}
|
|
117
117
|
)) as AssignmentsResponse;
|
|
118
|
-
return { text: formatTaskList(data
|
|
118
|
+
return { text: formatTaskList(data?.tasks) };
|
|
119
119
|
} catch (err) {
|
|
120
120
|
return { text: `Failed to fetch tasks: ${err instanceof Error ? err.message : String(err)}` };
|
|
121
121
|
}
|
|
@@ -128,7 +128,7 @@ export function registerChorusCommands(
|
|
|
128
128
|
"chorus_get_my_assignments",
|
|
129
129
|
{}
|
|
130
130
|
)) as AssignmentsResponse;
|
|
131
|
-
return { text: formatIdeaList(data
|
|
131
|
+
return { text: formatIdeaList(data?.ideas) };
|
|
132
132
|
} catch (err) {
|
|
133
133
|
return { text: `Failed to fetch ideas: ${err instanceof Error ? err.message : String(err)}` };
|
|
134
134
|
}
|
package/src/event-router.ts
CHANGED
|
@@ -38,7 +38,7 @@ export class ChorusEventRouter {
|
|
|
38
38
|
this.config = opts.config;
|
|
39
39
|
this.triggerAgent = opts.triggerAgent;
|
|
40
40
|
this.logger = opts.logger;
|
|
41
|
-
this.projectFilter = new Set(opts.config.projectUuids);
|
|
41
|
+
this.projectFilter = new Set(opts.config.projectUuids ?? []);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
/**
|
package/src/index.ts
CHANGED
|
@@ -48,9 +48,20 @@ const plugin = {
|
|
|
48
48
|
configSchema: chorusConfigSchema,
|
|
49
49
|
|
|
50
50
|
register(api: OpenClawPluginApi) {
|
|
51
|
-
const
|
|
51
|
+
const rawConfig = api.pluginConfig ?? {};
|
|
52
|
+
const config: ChorusPluginConfig = {
|
|
53
|
+
chorusUrl: rawConfig.chorusUrl ?? "",
|
|
54
|
+
apiKey: rawConfig.apiKey ?? "",
|
|
55
|
+
projectUuids: rawConfig.projectUuids ?? [],
|
|
56
|
+
autoStart: rawConfig.autoStart ?? true,
|
|
57
|
+
};
|
|
52
58
|
const logger = api.logger;
|
|
53
59
|
|
|
60
|
+
if (!config.chorusUrl || !config.apiKey) {
|
|
61
|
+
logger.error("Chorus plugin missing required config: chorusUrl and apiKey");
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
54
65
|
// Resolve gateway URL and hooks token from OpenClaw config
|
|
55
66
|
const gatewayPort = api.config?.gateway?.port ?? 18789;
|
|
56
67
|
const gatewayUrl = `http://127.0.0.1:${gatewayPort}`;
|