ofiere-openclaw-plugin 4.39.1 → 4.40.0
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 +3 -2
- package/src/prompt.ts +1 -1
- package/src/tools.ts +64 -3
- package/tsconfig.json +19 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ofiere-openclaw-plugin",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.40.0",
|
|
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"],
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
"index.ts",
|
|
15
15
|
"src",
|
|
16
16
|
"openclaw.plugin.json",
|
|
17
|
-
"README.md"
|
|
17
|
+
"README.md",
|
|
18
|
+
"tsconfig.json"
|
|
18
19
|
],
|
|
19
20
|
"scripts": {
|
|
20
21
|
"typecheck": "tsc --noEmit",
|
package/src/prompt.ts
CHANGED
|
@@ -107,7 +107,7 @@ Actions: "list", "get", "create", "update", "delete", "add_nodes", "execute"
|
|
|
107
107
|
- Execution maps ALL fields: execution_steps, goals, constraints, system_prompt`,
|
|
108
108
|
|
|
109
109
|
OFIERE_SOP_OPS: `Standard Operating Procedures.
|
|
110
|
-
Actions: "list_templates", "create", "list", "get", "update", "delete", "list_subagents", "apply_template", "propose_attach", "commit_attach"
|
|
110
|
+
Actions: "list_templates", "create", "list", "get", "update", "delete", "list_subagents", "create_subagent", "delete_subagent", "apply_template", "propose_attach", "commit_attach"
|
|
111
111
|
- sop_data: { title, purpose, scope, applicability, prerequisites:{ conditions, required_tools, required_permissions, safety_warnings }, procedure_steps[], expected_outputs[], escalation_rules[], acceptance_criteria[], rollback_procedure, notes }
|
|
112
112
|
- Legacy field names still accepted (objective→purpose, steps→procedure_steps, deliverables→expected_outputs, escalationRules→escalation_rules, successCriteria→acceptance_criteria) — prefer new names.
|
|
113
113
|
- propose_attach / commit_attach: attach SOPs to a run (target_kind: conversation|task|scheduler_event). Tier rule: SOPs only attach to STAFF-tier targets; for c-suite use OFIERE_FRAMEWORK_OPS instead. propose_attach returns a token-cost summary + confirmation_token (5-min ttl). You MUST surface the cost and ask the user before calling commit_attach. The user must explicitly approve.
|
package/src/tools.ts
CHANGED
|
@@ -4848,6 +4848,8 @@ function registerSOPOps(
|
|
|
4848
4848
|
`- "update": Modify SOP. Required: sop_id. Optional: title, sop_data, status, department\n` +
|
|
4849
4849
|
`- "delete": Remove SOP. Required: sop_id\n` +
|
|
4850
4850
|
`- "list_subagents": List subagents for a chief. Required: chief_agent_id\n` +
|
|
4851
|
+
`- "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` +
|
|
4852
|
+
`- "delete_subagent": Delete a staff subagent. Required: subagent_id\n` +
|
|
4851
4853
|
`- "apply_template": Create SOP from template. Required: agent_id, template_id. Optional: title, department\n` +
|
|
4852
4854
|
`- "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
4855
|
`- "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` +
|
|
@@ -4871,10 +4873,15 @@ function registerSOPOps(
|
|
|
4871
4873
|
type: "object",
|
|
4872
4874
|
required: ["action"],
|
|
4873
4875
|
properties: {
|
|
4874
|
-
action: { type: "string", enum: ["list_templates", "create", "list", "get", "update", "delete", "list_subagents", "apply_template", "propose_attach", "commit_attach"], description: "Valid actions: list_templates, create, list, get, update, delete, list_subagents, apply_template, propose_attach, commit_attach" },
|
|
4876
|
+
action: { type: "string", enum: ["list_templates", "create", "list", "get", "update", "delete", "list_subagents", "create_subagent", "delete_subagent", "apply_template", "propose_attach", "commit_attach"], description: "Valid actions: list_templates, create, list, get, update, delete, list_subagents, create_subagent, delete_subagent, apply_template, propose_attach, commit_attach" },
|
|
4875
4877
|
sop_id: { type: "string", description: "SOP ID (required for get, update, delete)" },
|
|
4876
4878
|
agent_id: { type: "string", description: "Agent ID (required for create, list filter, apply_template)" },
|
|
4877
|
-
chief_agent_id: { type: "string", description: "Chief agent ID (required for list_subagents)" },
|
|
4879
|
+
chief_agent_id: { type: "string", description: "Chief agent ID (required for list_subagents, create_subagent)" },
|
|
4880
|
+
subagent_id: { type: "string", description: "Subagent ID (required for delete_subagent)" },
|
|
4881
|
+
name: { type: "string", description: "Subagent display name (required for create_subagent)" },
|
|
4882
|
+
role: { type: "string", description: "Subagent role label, e.g. 'Staff', 'Analyst'. Defaults to 'Staff'." },
|
|
4883
|
+
codename: { type: "string", description: "Optional subagent codename" },
|
|
4884
|
+
color_hex: { type: "string", description: "Optional subagent UI color, default '#64748b'" },
|
|
4878
4885
|
template_id: { type: "string", description: "Template ID (required for apply_template)" },
|
|
4879
4886
|
target_kind: { type: "string", enum: ["conversation", "task", "scheduler_event"], description: "Run target kind (for propose_attach/commit_attach)" },
|
|
4880
4887
|
target_id: { type: "string", description: "Run target id (for propose_attach/commit_attach)" },
|
|
@@ -4932,10 +4939,12 @@ function registerSOPOps(
|
|
|
4932
4939
|
case "update": return handleSOPUpdate(supabase, userId, params);
|
|
4933
4940
|
case "delete": return handleSOPDelete(supabase, userId, params);
|
|
4934
4941
|
case "list_subagents": return handleSOPListSubagents(supabase, userId, params);
|
|
4942
|
+
case "create_subagent": return handleSOPCreateSubagent(supabase, userId, params);
|
|
4943
|
+
case "delete_subagent": return handleSOPDeleteSubagent(supabase, userId, params);
|
|
4935
4944
|
case "apply_template": return handleSOPApplyTemplate(supabase, userId, resolveAgent, params);
|
|
4936
4945
|
case "propose_attach": return handleProposeAttach({ supabase, userId, docKind: "sop", params });
|
|
4937
4946
|
case "commit_attach": return handleCommitAttach({ supabase, userId, docKind: "sop", params });
|
|
4938
|
-
default: return err(`Unknown action "${action}". Valid: list_templates, create, list, get, update, delete, list_subagents, apply_template, propose_attach, commit_attach`);
|
|
4947
|
+
default: return err(`Unknown action "${action}". Valid: list_templates, create, list, get, update, delete, list_subagents, create_subagent, delete_subagent, apply_template, propose_attach, commit_attach`);
|
|
4939
4948
|
}
|
|
4940
4949
|
},
|
|
4941
4950
|
});
|
|
@@ -5190,6 +5199,58 @@ async function handleSOPListSubagents(supabase: SupabaseClient, userId: string,
|
|
|
5190
5199
|
} catch (e) { return err(e instanceof Error ? e.message : String(e)); }
|
|
5191
5200
|
}
|
|
5192
5201
|
|
|
5202
|
+
const MAX_SUBAGENTS_PER_CHIEF = 5;
|
|
5203
|
+
|
|
5204
|
+
async function handleSOPCreateSubagent(supabase: SupabaseClient, userId: string, params: Record<string, unknown>): Promise<ToolResult> {
|
|
5205
|
+
try {
|
|
5206
|
+
const chiefAgentId = params.chief_agent_id as string | undefined;
|
|
5207
|
+
const name = params.name as string | undefined;
|
|
5208
|
+
if (!chiefAgentId) return err("Missing required field: chief_agent_id");
|
|
5209
|
+
if (!name) return err("Missing required field: name");
|
|
5210
|
+
|
|
5211
|
+
// Enforce per-chief cap (mirrors POST /api/sop/subagents in dashboard)
|
|
5212
|
+
const { count, error: countErr } = await supabase
|
|
5213
|
+
.from("agent_subagents")
|
|
5214
|
+
.select("id", { count: "exact", head: true })
|
|
5215
|
+
.eq("user_id", userId)
|
|
5216
|
+
.eq("chief_agent_id", chiefAgentId);
|
|
5217
|
+
if (countErr) return err(countErr.message);
|
|
5218
|
+
if ((count ?? 0) >= MAX_SUBAGENTS_PER_CHIEF) {
|
|
5219
|
+
return err(`Maximum ${MAX_SUBAGENTS_PER_CHIEF} subagents per department chief`);
|
|
5220
|
+
}
|
|
5221
|
+
|
|
5222
|
+
const role = (params.role as string) || "Staff";
|
|
5223
|
+
const codename = (params.codename as string) ?? null;
|
|
5224
|
+
const colorHex = (params.color_hex as string) || "#64748b";
|
|
5225
|
+
|
|
5226
|
+
const { data, error } = await supabase
|
|
5227
|
+
.from("agent_subagents")
|
|
5228
|
+
.insert({ user_id: userId, chief_agent_id: chiefAgentId, name, role, codename, color_hex: colorHex })
|
|
5229
|
+
.select("id, user_id, chief_agent_id, name, role, codename, color_hex, created_at")
|
|
5230
|
+
.single();
|
|
5231
|
+
if (error) return err(error.message);
|
|
5232
|
+
return ok({ subagent: data, message: `Subagent "${name}" created under chief ${chiefAgentId}` });
|
|
5233
|
+
} catch (e) { return err(e instanceof Error ? e.message : String(e)); }
|
|
5234
|
+
}
|
|
5235
|
+
|
|
5236
|
+
async function handleSOPDeleteSubagent(supabase: SupabaseClient, userId: string, params: Record<string, unknown>): Promise<ToolResult> {
|
|
5237
|
+
try {
|
|
5238
|
+
const subagentId = params.subagent_id as string | undefined;
|
|
5239
|
+
if (!subagentId) return err("Missing required field: subagent_id");
|
|
5240
|
+
|
|
5241
|
+
const { data, error } = await supabase
|
|
5242
|
+
.from("agent_subagents")
|
|
5243
|
+
.delete()
|
|
5244
|
+
.eq("id", subagentId)
|
|
5245
|
+
.eq("user_id", userId)
|
|
5246
|
+
.select("id, name")
|
|
5247
|
+
.maybeSingle();
|
|
5248
|
+
if (error) return err(error.message);
|
|
5249
|
+
if (!data) return err("Subagent not found — nothing deleted");
|
|
5250
|
+
return ok({ message: `Subagent "${data.name}" deleted`, deleted: true });
|
|
5251
|
+
} catch (e) { return err(e instanceof Error ? e.message : String(e)); }
|
|
5252
|
+
}
|
|
5253
|
+
|
|
5193
5254
|
async function handleSOPApplyTemplate(
|
|
5194
5255
|
supabase: SupabaseClient, userId: string,
|
|
5195
5256
|
resolveAgent: (id?: string) => Promise<string | null>,
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"lib": ["ES2022"],
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"forceConsistentCasingInFileNames": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"noImplicitAny": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"noEmit": true,
|
|
14
|
+
"allowImportingTsExtensions": false,
|
|
15
|
+
"isolatedModules": true
|
|
16
|
+
},
|
|
17
|
+
"include": ["index.ts", "src/**/*.ts"],
|
|
18
|
+
"exclude": ["node_modules"]
|
|
19
|
+
}
|