ofiere-openclaw-plugin 4.39.2 → 4.40.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ofiere-openclaw-plugin",
3
- "version": "4.39.2",
3
+ "version": "4.40.1",
4
4
  "type": "module",
5
5
  "description": "OpenClaw plugin for Ofiere PM - 16 meta-tools covering tasks, agents, projects, scheduling, knowledge, workflows, notifications, memory, prompts, constellation, space file management, execution plan builder, SOP management, agent brain, talent management, and corporate frameworks",
6
6
  "keywords": ["openclaw", "ofiere", "project-management", "agents", "plugin"],
package/src/prompt.ts CHANGED
@@ -13,7 +13,7 @@
13
13
 
14
14
  const TOOL_SUMMARIES: Record<string, string> = {
15
15
  OFIERE_TASK_OPS: "Manage tasks: list, create, update, delete, approvals",
16
- OFIERE_AGENT_OPS: "Query agents: list all with IDs, names, roles",
16
+ OFIERE_AGENT_OPS: "Query + manage agents and their staff subagents",
17
17
  OFIERE_PROJECT_OPS: "PM hierarchy: spaces, folders, dependencies",
18
18
  OFIERE_SCHEDULE_OPS: "Calendar: list, create, update, delete events",
19
19
  OFIERE_KNOWLEDGE_OPS: "Knowledge library: search, list, create, update, delete",
@@ -48,7 +48,12 @@ Actions: "list", "create", "update", "delete", "add_approval", "list_approvals",
48
48
  - list_approvals: List approvals. Optional: task_id, approval_status (pending|approved|rejected)
49
49
  - resolve_approval: Approve/reject. Requires: approval_id, approval_status. Optional: comment`,
50
50
 
51
- OFIERE_AGENT_OPS: `Query agents. Action: "list" — see all agents with IDs, names, roles for task assignment.`,
51
+ OFIERE_AGENT_OPS: `Query + manage agents and their staff subagents.
52
+ Actions: "list", "list_subagents", "create_subagent", "delete_subagent"
53
+ - list: All top-level agents (chiefs / native + OpenClaw) with IDs, names, roles. Use for task assignment lookup.
54
+ - list_subagents: Staff under a chief. Required: chief_agent_id.
55
+ - create_subagent: Add a staff subagent under a chief (max 5 per chief). Required: chief_agent_id, name. Optional: role (default "Staff"), codename, color_hex.
56
+ - delete_subagent: Remove a staff subagent. Required: subagent_id.`,
52
57
 
53
58
  OFIERE_PROJECT_OPS: `Manage PM hierarchy.
54
59
  Actions: "list_spaces", "create_space", "update_space", "delete_space", "list_folders", "create_folder", "update_folder", "delete_folder", "list_dependencies", "add_dependency", "remove_dependency"
package/src/tools.ts CHANGED
@@ -1088,9 +1088,12 @@ function registerAgentOps(
1088
1088
  name: "OFIERE_AGENT_OPS",
1089
1089
  label: "Ofiere Agent Operations",
1090
1090
  description:
1091
- `Query agents in the Ofiere PM system.\n\n` +
1091
+ `Query and manage agents + their staff subagents in the Ofiere PM system.\n\n` +
1092
1092
  `Actions:\n` +
1093
- `- "list": List all available agents with their IDs, names, roles, and status. Use this to find the correct agent_id for task assignment.`,
1093
+ `- "list": List all top-level agents (chiefs / native + OpenClaw) with their IDs, names, roles, and status. Use this to find the correct agent_id for task assignment.\n` +
1094
+ `- "list_subagents": List staff subagents under a chief. Required: chief_agent_id.\n` +
1095
+ `- "create_subagent": Create a staff subagent under a chief (max 5 per chief). Required: chief_agent_id, name. Optional: role (default "Staff"), codename, color_hex (default "#64748b").\n` +
1096
+ `- "delete_subagent": Remove a staff subagent. Required: subagent_id.`,
1094
1097
  parameters: {
1095
1098
  type: "object",
1096
1099
  required: ["action"],
@@ -1098,8 +1101,14 @@ function registerAgentOps(
1098
1101
  action: {
1099
1102
  type: "string",
1100
1103
  description: "The operation to perform",
1101
- enum: ["list"],
1104
+ enum: ["list", "list_subagents", "create_subagent", "delete_subagent"],
1102
1105
  },
1106
+ chief_agent_id: { type: "string", description: "Chief agent ID (required for list_subagents, create_subagent)" },
1107
+ subagent_id: { type: "string", description: "Subagent ID (required for delete_subagent)" },
1108
+ name: { type: "string", description: "Subagent display name (required for create_subagent)" },
1109
+ role: { type: "string", description: "Subagent role label, e.g. 'Staff', 'Analyst'. Defaults to 'Staff'." },
1110
+ codename: { type: "string", description: "Optional subagent codename" },
1111
+ color_hex: { type: "string", description: "Optional subagent UI color, default '#64748b'" },
1103
1112
  },
1104
1113
  },
1105
1114
  async execute(_id: string, params: Record<string, unknown>) {
@@ -1108,8 +1117,14 @@ function registerAgentOps(
1108
1117
  switch (action) {
1109
1118
  case "list":
1110
1119
  return handleListAgents(api, supabase, userId, fallbackAgentId);
1120
+ case "list_subagents":
1121
+ return handleListSubagents(supabase, userId, params);
1122
+ case "create_subagent":
1123
+ return handleCreateSubagent(supabase, userId, params);
1124
+ case "delete_subagent":
1125
+ return handleDeleteSubagent(supabase, userId, params);
1111
1126
  default:
1112
- return err(`Unknown action "${action}". Valid actions: list`);
1127
+ return err(`Unknown action "${action}". Valid actions: list, list_subagents, create_subagent, delete_subagent`);
1113
1128
  }
1114
1129
  },
1115
1130
  });
@@ -4847,7 +4862,7 @@ function registerSOPOps(
4847
4862
  `- "get": Get full SOP details. Required: sop_id\n` +
4848
4863
  `- "update": Modify SOP. Required: sop_id. Optional: title, sop_data, status, department\n` +
4849
4864
  `- "delete": Remove SOP. Required: sop_id\n` +
4850
- `- "list_subagents": List subagents for a chief. Required: chief_agent_id\n` +
4865
+ `- "list_subagents": List subagents for a chief. Required: chief_agent_id. (Provided here for convenience when scoping SOP authoring; team management lives in OFIERE_AGENT_OPS.)\n` +
4851
4866
  `- "apply_template": Create SOP from template. Required: agent_id, template_id. Optional: title, department\n` +
4852
4867
  `- "propose_attach": Propose attaching SOPs to a run target (conversation/task/scheduler_event). Returns token cost + confirmation_token. Required: target_kind, target_id, doc_ids[]. The user MUST be asked to approve before commit.\n` +
4853
4868
  `- "commit_attach": Commit a proposed attachment. Required: target_kind, target_id, doc_ids[], confirmation_token (from propose_attach). Only call AFTER user approves the token cost.\n` +
@@ -4931,7 +4946,7 @@ function registerSOPOps(
4931
4946
  case "get": return handleSOPGet(supabase, userId, params);
4932
4947
  case "update": return handleSOPUpdate(supabase, userId, params);
4933
4948
  case "delete": return handleSOPDelete(supabase, userId, params);
4934
- case "list_subagents": return handleSOPListSubagents(supabase, userId, params);
4949
+ case "list_subagents": return handleListSubagents(supabase, userId, params);
4935
4950
  case "apply_template": return handleSOPApplyTemplate(supabase, userId, resolveAgent, params);
4936
4951
  case "propose_attach": return handleProposeAttach({ supabase, userId, docKind: "sop", params });
4937
4952
  case "commit_attach": return handleCommitAttach({ supabase, userId, docKind: "sop", params });
@@ -5176,7 +5191,12 @@ async function handleSOPDelete(supabase: SupabaseClient, userId: string, params:
5176
5191
  } catch (e) { return err(e instanceof Error ? e.message : String(e)); }
5177
5192
  }
5178
5193
 
5179
- async function handleSOPListSubagents(supabase: SupabaseClient, userId: string, params: Record<string, unknown>): Promise<ToolResult> {
5194
+ // ── Shared subagent handlers (used by OFIERE_AGENT_OPS; SOP_OPS keeps a
5195
+ // convenience wrapper for `list_subagents` only). ──────────────────────────
5196
+
5197
+ const MAX_SUBAGENTS_PER_CHIEF = 5;
5198
+
5199
+ async function handleListSubagents(supabase: SupabaseClient, userId: string, params: Record<string, unknown>): Promise<ToolResult> {
5180
5200
  try {
5181
5201
  if (!params.chief_agent_id) return err("Missing required field: chief_agent_id");
5182
5202
  const { data, error } = await supabase
@@ -5186,7 +5206,57 @@ async function handleSOPListSubagents(supabase: SupabaseClient, userId: string,
5186
5206
  .eq("chief_agent_id", params.chief_agent_id as string)
5187
5207
  .order("created_at", { ascending: true });
5188
5208
  if (error) return err(error.message);
5189
- return ok({ subagents: data || [], count: (data || []).length, max_allowed: 5 });
5209
+ return ok({ subagents: data || [], count: (data || []).length, max_allowed: MAX_SUBAGENTS_PER_CHIEF });
5210
+ } catch (e) { return err(e instanceof Error ? e.message : String(e)); }
5211
+ }
5212
+
5213
+ async function handleCreateSubagent(supabase: SupabaseClient, userId: string, params: Record<string, unknown>): Promise<ToolResult> {
5214
+ try {
5215
+ const chiefAgentId = params.chief_agent_id as string | undefined;
5216
+ const name = params.name as string | undefined;
5217
+ if (!chiefAgentId) return err("Missing required field: chief_agent_id");
5218
+ if (!name) return err("Missing required field: name");
5219
+
5220
+ // Enforce per-chief cap (mirrors POST /api/sop/subagents in dashboard)
5221
+ const { count, error: countErr } = await supabase
5222
+ .from("agent_subagents")
5223
+ .select("id", { count: "exact", head: true })
5224
+ .eq("user_id", userId)
5225
+ .eq("chief_agent_id", chiefAgentId);
5226
+ if (countErr) return err(countErr.message);
5227
+ if ((count ?? 0) >= MAX_SUBAGENTS_PER_CHIEF) {
5228
+ return err(`Maximum ${MAX_SUBAGENTS_PER_CHIEF} subagents per department chief`);
5229
+ }
5230
+
5231
+ const role = (params.role as string) || "Staff";
5232
+ const codename = (params.codename as string) ?? null;
5233
+ const colorHex = (params.color_hex as string) || "#64748b";
5234
+
5235
+ const { data, error } = await supabase
5236
+ .from("agent_subagents")
5237
+ .insert({ user_id: userId, chief_agent_id: chiefAgentId, name, role, codename, color_hex: colorHex })
5238
+ .select("id, user_id, chief_agent_id, name, role, codename, color_hex, created_at")
5239
+ .single();
5240
+ if (error) return err(error.message);
5241
+ return ok({ subagent: data, message: `Subagent "${name}" created under chief ${chiefAgentId}` });
5242
+ } catch (e) { return err(e instanceof Error ? e.message : String(e)); }
5243
+ }
5244
+
5245
+ async function handleDeleteSubagent(supabase: SupabaseClient, userId: string, params: Record<string, unknown>): Promise<ToolResult> {
5246
+ try {
5247
+ const subagentId = params.subagent_id as string | undefined;
5248
+ if (!subagentId) return err("Missing required field: subagent_id");
5249
+
5250
+ const { data, error } = await supabase
5251
+ .from("agent_subagents")
5252
+ .delete()
5253
+ .eq("id", subagentId)
5254
+ .eq("user_id", userId)
5255
+ .select("id, name")
5256
+ .maybeSingle();
5257
+ if (error) return err(error.message);
5258
+ if (!data) return err("Subagent not found — nothing deleted");
5259
+ return ok({ message: `Subagent "${data.name}" deleted`, deleted: true });
5190
5260
  } catch (e) { return err(e instanceof Error ? e.message : String(e)); }
5191
5261
  }
5192
5262