ofiere-openclaw-plugin 4.49.0 → 4.50.0-probe.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 +1 -1
- package/src/tools.ts +106 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ofiere-openclaw-plugin",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.50.0-probe.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"],
|
package/src/tools.ts
CHANGED
|
@@ -6535,6 +6535,13 @@ export function registerTools(
|
|
|
6535
6535
|
// ── Register agent_end hook for server-side brain extraction ──
|
|
6536
6536
|
registerBrainExtractionHook(api, supabase, userId, fallbackAgentId);
|
|
6537
6537
|
|
|
6538
|
+
// ── CYCLE 10 PROBE — verify subagent_* hook payload shapes ─────────────
|
|
6539
|
+
// Probe-only build (4.50.0-probe.x). Logs full payload on first fire of
|
|
6540
|
+
// each native subagent hook + triggers a one-shot subagent.run 8s after
|
|
6541
|
+
// init so we capture spawning → spawned → ended lifecycle. Removed in
|
|
6542
|
+
// 4.50.0 production release.
|
|
6543
|
+
registerCycle10Probe(api);
|
|
6544
|
+
|
|
6538
6545
|
// ── Count and log ──
|
|
6539
6546
|
const toolCount = 16;
|
|
6540
6547
|
const callerName = getCallingAgentName(api);
|
|
@@ -6924,6 +6931,105 @@ function registerBrainExtractionHook(
|
|
|
6924
6931
|
}
|
|
6925
6932
|
}
|
|
6926
6933
|
|
|
6934
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
6935
|
+
// CYCLE 10 PROBE — REMOVE/DISABLE BEFORE PRODUCTION 4.50.x
|
|
6936
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
6937
|
+
// One-shot diagnostic that logs the full payload shape of every native
|
|
6938
|
+
// subagent_* hook, then triggers a single api.runtime.subagent.run so the
|
|
6939
|
+
// lifecycle fires end-to-end. Used to verify field names before the real
|
|
6940
|
+
// subagent_ended handler is written. Activated by env var
|
|
6941
|
+
// OFIERE_CYCLE10_PROBE=1; otherwise inert.
|
|
6942
|
+
//
|
|
6943
|
+
// Captured in cycle 10 BUGSHOOT under hook key [ofiere-probe].
|
|
6944
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
6945
|
+
|
|
6946
|
+
function registerCycle10Probe(api: any): void {
|
|
6947
|
+
const safeStringify = (obj: unknown, max = 4000): string => {
|
|
6948
|
+
try {
|
|
6949
|
+
const seen = new WeakSet<object>();
|
|
6950
|
+
const out = JSON.stringify(obj, (_k, v) => {
|
|
6951
|
+
if (typeof v === "object" && v !== null) {
|
|
6952
|
+
if (seen.has(v)) return "[Circular]";
|
|
6953
|
+
seen.add(v);
|
|
6954
|
+
}
|
|
6955
|
+
if (typeof v === "function") return `[Function ${v.name || "anon"}]`;
|
|
6956
|
+
return v;
|
|
6957
|
+
}, 2);
|
|
6958
|
+
return out.length > max ? out.slice(0, max) + "...[truncated]" : out;
|
|
6959
|
+
} catch (e) {
|
|
6960
|
+
return `[stringify-fail: ${e instanceof Error ? e.message : String(e)}]`;
|
|
6961
|
+
}
|
|
6962
|
+
};
|
|
6963
|
+
|
|
6964
|
+
const hookNames = [
|
|
6965
|
+
"subagent_spawning",
|
|
6966
|
+
"subagent_spawned",
|
|
6967
|
+
"subagent_delivery_target",
|
|
6968
|
+
"subagent_ended",
|
|
6969
|
+
];
|
|
6970
|
+
for (const hook of hookNames) {
|
|
6971
|
+
try {
|
|
6972
|
+
api.on?.(hook, (event: any, ctx: any) => {
|
|
6973
|
+
try {
|
|
6974
|
+
api.logger.info?.(
|
|
6975
|
+
`[ofiere-probe] ${hook} event=${safeStringify(event, 2000)} ctx=${safeStringify(ctx, 2000)}`,
|
|
6976
|
+
);
|
|
6977
|
+
} catch (e) {
|
|
6978
|
+
api.logger.warn?.(`[ofiere-probe] ${hook} log failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
6979
|
+
}
|
|
6980
|
+
});
|
|
6981
|
+
api.logger.info?.(`[ofiere-probe] ${hook} hook registered`);
|
|
6982
|
+
} catch (e) {
|
|
6983
|
+
api.logger.warn?.(`[ofiere-probe] ${hook} hook register failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
6984
|
+
}
|
|
6985
|
+
}
|
|
6986
|
+
|
|
6987
|
+
// One-shot spawn 8s after init so the gateway is fully up.
|
|
6988
|
+
setTimeout(async () => {
|
|
6989
|
+
const sessionKey = `agent:celia:subagent:probe-${Date.now().toString(36).slice(-6)}`;
|
|
6990
|
+
api.logger.info?.(`[ofiere-probe] firing api.runtime.subagent.run sessionKey=${sessionKey}`);
|
|
6991
|
+
try {
|
|
6992
|
+
const runtime = (api as any)?.runtime;
|
|
6993
|
+
if (!runtime?.subagent?.run) {
|
|
6994
|
+
api.logger.error?.(
|
|
6995
|
+
`[ofiere-probe] api.runtime.subagent.run NOT AVAILABLE on this OpenClaw version. ` +
|
|
6996
|
+
`runtime keys: ${runtime ? Object.keys(runtime).join(",") : "(no runtime)"}`,
|
|
6997
|
+
);
|
|
6998
|
+
return;
|
|
6999
|
+
}
|
|
7000
|
+
const result = await runtime.subagent.run({
|
|
7001
|
+
sessionKey,
|
|
7002
|
+
message: "Reply with exactly the text PROBE-OK and nothing else.",
|
|
7003
|
+
deliver: false,
|
|
7004
|
+
});
|
|
7005
|
+
api.logger.info?.(`[ofiere-probe] subagent.run returned ${safeStringify(result, 1000)}`);
|
|
7006
|
+
|
|
7007
|
+
// Try waitForRun + getSessionMessages immediately so we capture the
|
|
7008
|
+
// full transcript shape even before subagent_ended fires.
|
|
7009
|
+
if (result?.runId && runtime.subagent.waitForRun) {
|
|
7010
|
+
try {
|
|
7011
|
+
const waitResult = await runtime.subagent.waitForRun({ runId: result.runId, timeoutMs: 30000 });
|
|
7012
|
+
api.logger.info?.(`[ofiere-probe] waitForRun returned ${safeStringify(waitResult, 2000)}`);
|
|
7013
|
+
} catch (e) {
|
|
7014
|
+
api.logger.warn?.(`[ofiere-probe] waitForRun threw: ${e instanceof Error ? e.message : String(e)}`);
|
|
7015
|
+
}
|
|
7016
|
+
}
|
|
7017
|
+
if (runtime.subagent.getSessionMessages) {
|
|
7018
|
+
try {
|
|
7019
|
+
const msgsResult = await runtime.subagent.getSessionMessages({ sessionKey, limit: 10 });
|
|
7020
|
+
api.logger.info?.(`[ofiere-probe] getSessionMessages returned ${safeStringify(msgsResult, 4000)}`);
|
|
7021
|
+
} catch (e) {
|
|
7022
|
+
api.logger.warn?.(`[ofiere-probe] getSessionMessages threw: ${e instanceof Error ? e.message : String(e)}`);
|
|
7023
|
+
}
|
|
7024
|
+
}
|
|
7025
|
+
} catch (e) {
|
|
7026
|
+
api.logger.error?.(
|
|
7027
|
+
`[ofiere-probe] subagent.run threw: ${e instanceof Error ? `${e.name}: ${e.message}\n${e.stack}` : String(e)}`,
|
|
7028
|
+
);
|
|
7029
|
+
}
|
|
7030
|
+
}, 8000);
|
|
7031
|
+
}
|
|
7032
|
+
|
|
6927
7033
|
// ── Brain Context Bootstrap Injection ──────────────────────────────────────
|
|
6928
7034
|
// Injects the calling agent's active memories into the system prompt via
|
|
6929
7035
|
// api.on("before_prompt_build"). Uses the TMT hierarchy:
|