@senpi-ai/runtime 3.0.179 → 3.0.189
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/dist/actions/close-position/close-position.action.d.ts.map +1 -1
- package/dist/actions/close-position/close-position.action.js +1 -6
- package/dist/actions/close-position/close-position.action.js.map +1 -1
- package/dist/actions/llm-decision/openclaw-llm-decision.d.ts +8 -0
- package/dist/actions/llm-decision/openclaw-llm-decision.d.ts.map +1 -1
- package/dist/actions/llm-decision/openclaw-llm-decision.js +56 -1
- package/dist/actions/llm-decision/openclaw-llm-decision.js.map +1 -1
- package/dist/actions/position-tracker/position-tracker.action.d.ts.map +1 -1
- package/dist/actions/position-tracker/position-tracker.action.js +0 -1
- package/dist/actions/position-tracker/position-tracker.action.js.map +1 -1
- package/dist/approvals/approval-store.d.ts +37 -7
- package/dist/approvals/approval-store.d.ts.map +1 -1
- package/dist/approvals/approval-store.js +127 -23
- package/dist/approvals/approval-store.js.map +1 -1
- package/dist/approvals/telemetry.d.ts +28 -3
- package/dist/approvals/telemetry.d.ts.map +1 -1
- package/dist/approvals/telemetry.js +8 -4
- package/dist/approvals/telemetry.js.map +1 -1
- package/dist/approvals/tool-approval-gate.d.ts +85 -0
- package/dist/approvals/tool-approval-gate.d.ts.map +1 -1
- package/dist/approvals/tool-approval-gate.js +197 -15
- package/dist/approvals/tool-approval-gate.js.map +1 -1
- package/dist/approvals/turn-context.d.ts +296 -0
- package/dist/approvals/turn-context.d.ts.map +1 -0
- package/dist/approvals/turn-context.js +594 -0
- package/dist/approvals/turn-context.js.map +1 -0
- package/dist/cli/guide-commands.d.ts.map +1 -1
- package/dist/cli/guide-commands.js +18 -3
- package/dist/cli/guide-commands.js.map +1 -1
- package/dist/cli/senpi-commands.d.ts.map +1 -1
- package/dist/cli/senpi-commands.js +80 -5
- package/dist/cli/senpi-commands.js.map +1 -1
- package/dist/deploy/job.d.ts +32 -0
- package/dist/deploy/job.d.ts.map +1 -1
- package/dist/deploy/job.js +72 -7
- package/dist/deploy/job.js.map +1 -1
- package/dist/deploy/register.d.ts +12 -0
- package/dist/deploy/register.d.ts.map +1 -1
- package/dist/deploy/register.js +85 -2
- package/dist/deploy/register.js.map +1 -1
- package/dist/dsl/events/build-closed-event.d.ts +0 -11
- package/dist/dsl/events/build-closed-event.d.ts.map +1 -1
- package/dist/dsl/events/build-closed-event.js +0 -13
- package/dist/dsl/events/build-closed-event.js.map +1 -1
- package/dist/dsl/events/handlers.d.ts.map +1 -1
- package/dist/dsl/events/handlers.js +5 -9
- package/dist/dsl/events/handlers.js.map +1 -1
- package/dist/dsl/monitor/dsl-failure-events.d.ts +38 -2
- package/dist/dsl/monitor/dsl-failure-events.d.ts.map +1 -1
- package/dist/dsl/monitor/dsl-failure-events.js +67 -4
- package/dist/dsl/monitor/dsl-failure-events.js.map +1 -1
- package/dist/dsl/monitor/process-one-position.d.ts.map +1 -1
- package/dist/dsl/monitor/process-one-position.js +33 -13
- package/dist/dsl/monitor/process-one-position.js.map +1 -1
- package/dist/host/openclaw-host.d.ts +138 -0
- package/dist/host/openclaw-host.d.ts.map +1 -0
- package/dist/host/openclaw-host.js +177 -0
- package/dist/host/openclaw-host.js.map +1 -0
- package/dist/host/plugin-logger.d.ts +99 -0
- package/dist/host/plugin-logger.d.ts.map +1 -0
- package/dist/host/plugin-logger.js +142 -0
- package/dist/host/plugin-logger.js.map +1 -0
- package/dist/index.d.ts +56 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +688 -177
- package/dist/index.js.map +1 -1
- package/dist/prompt/session-context-seed-hook.d.ts +0 -7
- package/dist/prompt/session-context-seed-hook.d.ts.map +1 -1
- package/dist/prompt/session-context-seed-hook.js +1 -1
- package/dist/prompt/session-context-seed-hook.js.map +1 -1
- package/dist/runtime/auto-update/coordinator.d.ts +220 -0
- package/dist/runtime/auto-update/coordinator.d.ts.map +1 -1
- package/dist/runtime/auto-update/coordinator.js +715 -22
- package/dist/runtime/auto-update/coordinator.js.map +1 -1
- package/dist/runtime/auto-update/gateway-restart.d.ts +60 -1
- package/dist/runtime/auto-update/gateway-restart.d.ts.map +1 -1
- package/dist/runtime/auto-update/gateway-restart.js +95 -21
- package/dist/runtime/auto-update/gateway-restart.js.map +1 -1
- package/dist/runtime/auto-update/idle-gate.d.ts +175 -0
- package/dist/runtime/auto-update/idle-gate.d.ts.map +1 -0
- package/dist/runtime/auto-update/idle-gate.js +229 -0
- package/dist/runtime/auto-update/idle-gate.js.map +1 -0
- package/dist/runtime/auto-update/install-results.d.ts +130 -0
- package/dist/runtime/auto-update/install-results.d.ts.map +1 -0
- package/dist/runtime/auto-update/install-results.js +264 -0
- package/dist/runtime/auto-update/install-results.js.map +1 -0
- package/dist/runtime/auto-update/money-call-tracker.d.ts +36 -0
- package/dist/runtime/auto-update/money-call-tracker.d.ts.map +1 -0
- package/dist/runtime/auto-update/money-call-tracker.js +129 -0
- package/dist/runtime/auto-update/money-call-tracker.js.map +1 -0
- package/dist/runtime/auto-update/register-idle-gate.d.ts +70 -0
- package/dist/runtime/auto-update/register-idle-gate.d.ts.map +1 -0
- package/dist/runtime/auto-update/register-idle-gate.js +127 -0
- package/dist/runtime/auto-update/register-idle-gate.js.map +1 -0
- package/dist/runtime/auto-update/run-update-command.d.ts +13 -0
- package/dist/runtime/auto-update/run-update-command.d.ts.map +1 -1
- package/dist/runtime/auto-update/run-update-command.js +18 -0
- package/dist/runtime/auto-update/run-update-command.js.map +1 -1
- package/dist/runtime/auto-update/state-store.d.ts +14 -1
- package/dist/runtime/auto-update/state-store.d.ts.map +1 -1
- package/dist/runtime/auto-update/state-store.js +37 -3
- package/dist/runtime/auto-update/state-store.js.map +1 -1
- package/dist/runtime/auto-update/types.d.ts +52 -0
- package/dist/runtime/auto-update/types.d.ts.map +1 -1
- package/dist/runtime/auto-update/types.js.map +1 -1
- package/dist/runtime/auto-update/update-marker.d.ts +95 -0
- package/dist/runtime/auto-update/update-marker.d.ts.map +1 -0
- package/dist/runtime/auto-update/update-marker.js +185 -0
- package/dist/runtime/auto-update/update-marker.js.map +1 -0
- package/dist/runtime/auto-update/update-schedule.d.ts +67 -0
- package/dist/runtime/auto-update/update-schedule.d.ts.map +1 -0
- package/dist/runtime/auto-update/update-schedule.js +91 -0
- package/dist/runtime/auto-update/update-schedule.js.map +1 -0
- package/dist/runtime/decision-errors.d.ts +7 -0
- package/dist/runtime/decision-errors.d.ts.map +1 -1
- package/dist/runtime/decision-errors.js +15 -0
- package/dist/runtime/decision-errors.js.map +1 -1
- package/dist/runtime/process-state.d.ts +168 -0
- package/dist/runtime/process-state.d.ts.map +1 -0
- package/dist/runtime/process-state.js +81 -0
- package/dist/runtime/process-state.js.map +1 -0
- package/dist/runtime/reconcile-state.d.ts.map +1 -1
- package/dist/runtime/reconcile-state.js +18 -7
- package/dist/runtime/reconcile-state.js.map +1 -1
- package/dist/runtime/strategy-registry.d.ts +16 -0
- package/dist/runtime/strategy-registry.d.ts.map +1 -1
- package/dist/runtime/strategy-registry.js +7 -3
- package/dist/runtime/strategy-registry.js.map +1 -1
- package/dist/runtime/update-apply-deps.d.ts +5 -3
- package/dist/runtime/update-apply-deps.d.ts.map +1 -1
- package/dist/runtime/update-apply-deps.js +15 -3
- package/dist/runtime/update-apply-deps.js.map +1 -1
- package/dist/senpi/client.d.ts +29 -0
- package/dist/senpi/client.d.ts.map +1 -1
- package/dist/senpi/client.js +71 -2
- package/dist/senpi/client.js.map +1 -1
- package/dist/skills-manager/version-manager.d.ts +0 -14
- package/dist/skills-manager/version-manager.d.ts.map +1 -1
- package/dist/skills-manager/version-manager.js +3 -31
- package/dist/skills-manager/version-manager.js.map +1 -1
- package/dist/strategy/strategy-state.d.ts +3 -11
- package/dist/strategy/strategy-state.d.ts.map +1 -1
- package/dist/strategy/strategy-state.js +8 -18
- package/dist/strategy/strategy-state.js.map +1 -1
- package/dist/telemetry/event-builders.d.ts +2 -4
- package/dist/telemetry/event-builders.d.ts.map +1 -1
- package/dist/telemetry/event-builders.js +2 -4
- package/dist/telemetry/event-builders.js.map +1 -1
- package/dist/telemetry/metrics.d.ts +15 -1
- package/dist/telemetry/metrics.d.ts.map +1 -1
- package/dist/telemetry/metrics.js +25 -1
- package/dist/telemetry/metrics.js.map +1 -1
- package/dist/telemetry/otel-sdk.d.ts +12 -0
- package/dist/telemetry/otel-sdk.d.ts.map +1 -1
- package/dist/telemetry/otel-sdk.js +47 -1
- package/dist/telemetry/otel-sdk.js.map +1 -1
- package/dist/telemetry/spans/span-hooks.d.ts +18 -1
- package/dist/telemetry/spans/span-hooks.d.ts.map +1 -1
- package/dist/telemetry/spans/span-hooks.js +304 -103
- package/dist/telemetry/spans/span-hooks.js.map +1 -1
- package/dist/telemetry/tool-plane.d.ts +2 -0
- package/dist/telemetry/tool-plane.d.ts.map +1 -1
- package/dist/telemetry/tool-plane.js +1 -0
- package/dist/telemetry/tool-plane.js.map +1 -1
- package/dist/test-setup.js +7 -1
- package/dist/test-setup.js.map +1 -1
- package/dist/tool-surface/crib-cache.d.ts +21 -0
- package/dist/tool-surface/crib-cache.d.ts.map +1 -0
- package/dist/tool-surface/crib-cache.js +54 -0
- package/dist/tool-surface/crib-cache.js.map +1 -0
- package/dist/tool-surface/crib-hook.d.ts +78 -0
- package/dist/tool-surface/crib-hook.d.ts.map +1 -0
- package/dist/tool-surface/crib-hook.js +225 -0
- package/dist/tool-surface/crib-hook.js.map +1 -0
- package/dist/tool-surface/crib-sheet.d.ts +56 -0
- package/dist/tool-surface/crib-sheet.d.ts.map +1 -0
- package/dist/tool-surface/crib-sheet.js +129 -0
- package/dist/tool-surface/crib-sheet.js.map +1 -0
- package/dist/tool-surface/mcp-tool-source.d.ts +64 -0
- package/dist/tool-surface/mcp-tool-source.d.ts.map +1 -0
- package/dist/tool-surface/mcp-tool-source.js +189 -0
- package/dist/tool-surface/mcp-tool-source.js.map +1 -0
- package/dist/utils/event-catalog.d.ts +144 -90
- package/dist/utils/event-catalog.d.ts.map +1 -1
- package/dist/utils/event-catalog.js +25 -7
- package/dist/utils/event-catalog.js.map +1 -1
- package/dist/widgets/tool.d.ts +9 -0
- package/dist/widgets/tool.d.ts.map +1 -1
- package/dist/widgets/tool.js +1 -0
- package/dist/widgets/tool.js.map +1 -1
- package/openclaw.plugin.json +11 -1
- package/package.json +5 -2
- package/dist/prompt/skill-router-hook.d.ts +0 -24
- package/dist/prompt/skill-router-hook.d.ts.map +0 -1
- package/dist/prompt/skill-router-hook.js +0 -381
- package/dist/prompt/skill-router-hook.js.map +0 -1
- package/dist/skill-router/catalog.d.ts +0 -30
- package/dist/skill-router/catalog.d.ts.map +0 -1
- package/dist/skill-router/catalog.js +0 -131
- package/dist/skill-router/catalog.js.map +0 -1
- package/dist/skill-router/classify-client.d.ts +0 -80
- package/dist/skill-router/classify-client.d.ts.map +0 -1
- package/dist/skill-router/classify-client.js +0 -283
- package/dist/skill-router/classify-client.js.map +0 -1
- package/dist/skill-router/prompt.d.ts +0 -36
- package/dist/skill-router/prompt.d.ts.map +0 -1
- package/dist/skill-router/prompt.js +0 -318
- package/dist/skill-router/prompt.js.map +0 -1
- package/dist/skill-router/resolve.d.ts +0 -41
- package/dist/skill-router/resolve.d.ts.map +0 -1
- package/dist/skill-router/resolve.js +0 -43
- package/dist/skill-router/resolve.js.map +0 -1
|
@@ -0,0 +1,594 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which kind of turn a tool call belongs to: a direct user chat, a cron run, a
|
|
3
|
+
* heartbeat, or another run (R6, D13, D15).
|
|
4
|
+
*
|
|
5
|
+
* The tool hooks' context carries no run trigger on any host
|
|
6
|
+
* (`PluginHookToolContext`, `openclaw-worktrees/v2026.10.10/src/plugins/hook-types.ts:526-548`),
|
|
7
|
+
* but `before_prompt_build`'s agent context does (`trigger`, same field on
|
|
8
|
+
* 5.7, 5.12 and 10.x), and both carry the run id. The tracker records
|
|
9
|
+
* `runId → {sessionKey, kind}` at prompt build and keeps it for the life of the
|
|
10
|
+
* run, so the approval gate can read the turn kind of the call it is gating.
|
|
11
|
+
* `agent_end` does not end that: 10.x fires it per attempt, not per run.
|
|
12
|
+
*
|
|
13
|
+
* On 10.x `before_prompt_build` is a conversation hook: without
|
|
14
|
+
* `plugins.entries.runtime.hooks.allowConversationAccess` nothing is recorded
|
|
15
|
+
* and every lookup reads `unknown` ({@link turnClassificationAvailable} says so
|
|
16
|
+
* at boot).
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Maps a bare host run trigger to a {@link TurnKind}: `user` is a chat;
|
|
20
|
+
* `cron` and `heartbeat` are scheduled runs; any other trigger (`event`,
|
|
21
|
+
* `memory`, `manual`, `overflow`) is `other`; a missing one is `unknown`. The
|
|
22
|
+
* tracker uses it only after the run's provenance has been checked: a
|
|
23
|
+
* `user` trigger alone does not make a run a chat (see {@link TurnContextTracker}).
|
|
24
|
+
*/
|
|
25
|
+
export function turnKindOf(trigger) {
|
|
26
|
+
if (typeof trigger !== "string" || trigger.trim() === "")
|
|
27
|
+
return "unknown";
|
|
28
|
+
const t = trigger.trim();
|
|
29
|
+
if (t === "user")
|
|
30
|
+
return "chat";
|
|
31
|
+
if (t === "cron" || t === "heartbeat")
|
|
32
|
+
return t;
|
|
33
|
+
return "other";
|
|
34
|
+
}
|
|
35
|
+
function nonEmpty(value) {
|
|
36
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
37
|
+
}
|
|
38
|
+
function rec(value) {
|
|
39
|
+
return value && typeof value === "object" ? value : undefined;
|
|
40
|
+
}
|
|
41
|
+
/** The part of `agent:<agentId>:<rest>` after the agent id, lowercased; the whole key when it has another shape. */
|
|
42
|
+
function sessionRest(sessionKey) {
|
|
43
|
+
if (!sessionKey)
|
|
44
|
+
return "";
|
|
45
|
+
const parts = sessionKey.split(":");
|
|
46
|
+
return (parts[0] === "agent" && parts.length > 2 ? parts.slice(2).join(":") : sessionKey).toLowerCase();
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A session the host creates for a spawned child: `agent:<id>:subagent:<uuid>`
|
|
50
|
+
* (10.10 `src/agents/spawn-plan.ts:64-65`, `:subagent:incognito-…`
|
|
51
|
+
* at `subagent-spawn-child-plan.ts:96`; 5.12/5.7 `subagent-spawn.ts:829/821`)
|
|
52
|
+
* or an ACP child `agent:<id>:acp:<uuid>`.
|
|
53
|
+
*/
|
|
54
|
+
export function isChildSession(sessionKey) {
|
|
55
|
+
const rest = sessionRest(sessionKey);
|
|
56
|
+
return rest.startsWith("subagent:") || rest.startsWith("acp:");
|
|
57
|
+
}
|
|
58
|
+
/** The agent id of an `agent:<agentId>:<rest>` key, lowercased; `undefined` for another shape. */
|
|
59
|
+
function sessionAgent(sessionKey) {
|
|
60
|
+
const parts = sessionKey?.trim().toLowerCase().split(":");
|
|
61
|
+
return parts && parts[0] === "agent" && parts.length > 2 ? parts[1] : undefined;
|
|
62
|
+
}
|
|
63
|
+
/** Bounded insertion-ordered map: setting a key moves it to the end; the oldest key goes past `max`. */
|
|
64
|
+
function boundedSet(map, key, value, max) {
|
|
65
|
+
map.delete(key);
|
|
66
|
+
map.set(key, value);
|
|
67
|
+
while (map.size > max)
|
|
68
|
+
map.delete(map.keys().next().value);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* How long a `sessions_send` / `sessions_spawn` call stays matchable to the
|
|
72
|
+
* run it starts (the send's target run, the spawned child). That run normally
|
|
73
|
+
* starts within seconds; a target busy with another run queues the message,
|
|
74
|
+
* so the window is generous. Past it, the origin run is unidentified and the
|
|
75
|
+
* started run is not chat.
|
|
76
|
+
*/
|
|
77
|
+
export const SESSIONS_SEND_MATCH_WINDOW_MS = 10 * 60_000;
|
|
78
|
+
/** Pending origin calls (and open send exchanges) kept at once; the oldest are dropped first. */
|
|
79
|
+
const MAX_ORIGIN_CALLS = 256;
|
|
80
|
+
/**
|
|
81
|
+
* The `inputProvenance.sourceTool` OpenClaw stamps on the run that resumes an orphaned subagent
|
|
82
|
+
* after a gateway restart (`resumeOrphanedSession` in 6.9 `subagent-orphan-recovery`, the same
|
|
83
|
+
* literal in 10.10 `input-provenance`). Its `sourceSessionKey` is the requester, not the run that
|
|
84
|
+
* spawned the child, so the requester session's latest kind says nothing about this run.
|
|
85
|
+
*/
|
|
86
|
+
const SUBAGENT_RESUME_SOURCE_TOOL = "subagent_interrupted_resume";
|
|
87
|
+
/**
|
|
88
|
+
* Whether a `sessions_send` target as named (`agent:main:ops`, or a short
|
|
89
|
+
* `ops`) is the session `sessionKey`. A short name matches the key's tail.
|
|
90
|
+
*/
|
|
91
|
+
function targetMatches(named, sessionKey) {
|
|
92
|
+
if (!named || !sessionKey)
|
|
93
|
+
return false;
|
|
94
|
+
const n = named.trim().toLowerCase();
|
|
95
|
+
const k = sessionKey.trim().toLowerCase();
|
|
96
|
+
return n === k || (!n.startsWith("agent:") && k.endsWith(`:${n}`));
|
|
97
|
+
}
|
|
98
|
+
/** The JSON details of a 10.10 tool result (`jsonResult`: `{ content: [{ text }], details }`, `tool-results.ts:10-12`). */
|
|
99
|
+
function resultDetails(result) {
|
|
100
|
+
const r = rec(result);
|
|
101
|
+
const details = rec(r?.details);
|
|
102
|
+
if (details)
|
|
103
|
+
return details;
|
|
104
|
+
const text = rec(Array.isArray(r?.content) ? r.content[0] : undefined)?.text;
|
|
105
|
+
if (typeof text === "string") {
|
|
106
|
+
try {
|
|
107
|
+
return rec(JSON.parse(text));
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return typeof r?.status === "string" ? r : undefined;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Whether a `sessions_send` result says no target run was (or will be)
|
|
117
|
+
* started for it, or that its run already finished, so the pending call can
|
|
118
|
+
* never be matched correctly (10.10 `sessions-send-tool.schema.ts:30-104`).
|
|
119
|
+
*/
|
|
120
|
+
function sendStartedNoRunToMatch(d) {
|
|
121
|
+
const status = d.status;
|
|
122
|
+
if ((status === "error" || status === "forbidden") && d.sentBeforeError !== true)
|
|
123
|
+
return true;
|
|
124
|
+
if (status === "queued" && d.runStarted === false)
|
|
125
|
+
return true;
|
|
126
|
+
if (status === "accepted" && d.targetDisposition === "steered")
|
|
127
|
+
return true;
|
|
128
|
+
return status === "ok" || status === "no_reply";
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Recent runs by id, bounded, plus what each session's last run was and which
|
|
132
|
+
* kind each spawned child session inherited.
|
|
133
|
+
*
|
|
134
|
+
* Classification (D15: only a run positively identified as a direct chat turn
|
|
135
|
+
* is `chat`; anything not resolvable is not chat), from the
|
|
136
|
+
* `before_prompt_build` context (10.10 `attempt-prompt-build.ts:150-159`:
|
|
137
|
+
* `runId`, `jobId`, `sessionKey`, `trigger`, `inputProvenance`; 5.7/5.12 carry
|
|
138
|
+
* `runId`, `sessionKey`, `trigger` only, `attempt.ts:2563-2574` / `:2948-2959`):
|
|
139
|
+
*
|
|
140
|
+
* 1. `trigger` `cron` / `heartbeat` → that kind.
|
|
141
|
+
* 2. A `sessions_send` target (`inputProvenance` `inter_session` with
|
|
142
|
+
* `sourceTool: "sessions_send"`, 10.10 `sessions-send-tool.ts:470-476`) →
|
|
143
|
+
* the kind of the run that SENT it. The provenance names only the source
|
|
144
|
+
* session, not the sending run, so the sending run is identified from the
|
|
145
|
+
* `sessions_send` call itself: {@link onToolCall} records the calling run's
|
|
146
|
+
* kind with its source session and its named target at `before_tool_call`.
|
|
147
|
+
* A target run consumes the oldest pending send from `sourceSessionKey`
|
|
148
|
+
* whose target is the run's own session, inside
|
|
149
|
+
* {@link SESSIONS_SEND_MATCH_WINDOW_MS}. {@link onToolResult} drops a send
|
|
150
|
+
* whose result says no run was started for it (an error, a `steered` or
|
|
151
|
+
* unstarted `queued` delivery) or that it already finished, and gives a
|
|
152
|
+
* send addressed by `label` / `agentId` its resolved target. Until that
|
|
153
|
+
* result arrives (in wait mode the target run starts while the call is
|
|
154
|
+
* still open), such a send matches a run in any session of the named
|
|
155
|
+
* agent (any agent for a bare label), and only when no send with an exact
|
|
156
|
+
* target matches; candidates of different kinds still read `other`.
|
|
157
|
+
* The reply-back run is recognised too (10.10 `sessions-send-tool.a2a.ts:100,201-208`).
|
|
158
|
+
* It runs in the REQUESTER session, with the target as `sourceSessionKey`
|
|
159
|
+
* and `sourceTool: "sessions_send"`. It takes the kind of the send whose
|
|
160
|
+
* target run started (an open exchange, requester → target). It never
|
|
161
|
+
* takes the requester session's own pending sends.
|
|
162
|
+
* No match, an unclassified sender, or several candidates of different
|
|
163
|
+
* kinds (two runs sending at once; a forward send and a reply-back that
|
|
164
|
+
* could both explain the run) leave the origin unidentified → `other`. A
|
|
165
|
+
* later run on the source session (a chat starting after a heartbeat sent)
|
|
166
|
+
* never changes the answer.
|
|
167
|
+
* Other `inter_session` sources (subagent announce, exec-approval
|
|
168
|
+
* follow-up, `bash-tools.exec-approval-followup.ts:338-342`) → the kind of
|
|
169
|
+
* the `sourceSessionKey` session's last run; `other` when that is unknown.
|
|
170
|
+
* 3. A child session (`subagent:` / `acp:`) → the kind of the run that
|
|
171
|
+
* spawned it. `subagent_spawned` names only the requester session (10.10
|
|
172
|
+
* `subagent-spawn-lifecycle.ts:67-71`: ctx `requesterSessionKey`,
|
|
173
|
+
* `childSessionKey`), so the spawning run is identified the same way as a
|
|
174
|
+
* `sessions_send` sender: {@link onToolCall} records the run's kind at its
|
|
175
|
+
* `sessions_spawn` call (`sessions-spawn-tool.ts:355`), and
|
|
176
|
+
* `subagent_spawned` consumes the oldest pending spawn from the requester
|
|
177
|
+
* session, with the same window and ambiguity rules. Unmatched → `other`.
|
|
178
|
+
* 10.10 hard-codes `trigger: "user"` for these runs
|
|
179
|
+
* (`attempt-execution.ts:362`), and fires `subagent_spawned` after the
|
|
180
|
+
* gateway accepted the child (`subagent-spawn.ts:667`), so a child
|
|
181
|
+
* classified first reads `other` until its origin arrives.
|
|
182
|
+
* 4. `trigger` `event` or `inputProvenance.kind === "internal_system"` (a
|
|
183
|
+
* continuation after background work, `session-event-context.ts:86`;
|
|
184
|
+
* neither carries the originating run) → `other`.
|
|
185
|
+
* 5. A `jobId`, or a `cron:` session, with a non-cron trigger → `other`.
|
|
186
|
+
* 6. `trigger` `user` with no provenance or `external_user` provenance (a
|
|
187
|
+
* webchat `chat.send` turn: `reply-turn-kind.ts:18-24`,
|
|
188
|
+
* `chat-send-user-turn.ts:206`) → `chat`.
|
|
189
|
+
* 7. Any other trigger → `other`; none → `unknown`.
|
|
190
|
+
*
|
|
191
|
+
* Known limit: a gateway `agent` call with no provenance on a main session
|
|
192
|
+
* key (an operator `openclaw agent` run) reads as chat; nothing in the
|
|
193
|
+
* context tells it apart from a webchat turn.
|
|
194
|
+
*/
|
|
195
|
+
export class TurnContextTracker {
|
|
196
|
+
maxRuns;
|
|
197
|
+
now;
|
|
198
|
+
runs = new Map();
|
|
199
|
+
latestBySession = new Map();
|
|
200
|
+
/** The kind of each session's last classified run; kept past `agent_end`, for inheritance. */
|
|
201
|
+
lastKindBySession = new Map();
|
|
202
|
+
/** Child session key → the kind it inherited from its requester. */
|
|
203
|
+
childOrigins = new Map();
|
|
204
|
+
/** `sessions_send` / `sessions_spawn` calls waiting for the run they start, oldest first. */
|
|
205
|
+
origins = [];
|
|
206
|
+
/** Sends whose target run started, waiting for their reply-back run, oldest first. */
|
|
207
|
+
exchanges = [];
|
|
208
|
+
/** Runs recorded since this tracker started; see {@link runsRecorded}. */
|
|
209
|
+
recorded = 0;
|
|
210
|
+
/**
|
|
211
|
+
* @param maxRuns - Runs kept at once, ended ones included (see {@link onRunEnd}); the oldest
|
|
212
|
+
* is dropped past it. A later call of a dropped run reads `unknown`; a retry classifies anew.
|
|
213
|
+
* @param now - Clock for the `sessions_send` match window.
|
|
214
|
+
*/
|
|
215
|
+
constructor(maxRuns = 256, now = Date.now) {
|
|
216
|
+
this.maxRuns = maxRuns;
|
|
217
|
+
this.now = now;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Records a `sessions_send` or `sessions_spawn` call from a `before_tool_call`
|
|
221
|
+
* event/context: the calling run's kind (`unknown` when that run was never
|
|
222
|
+
* classified), its session keys (the call's and the run's own), and for a
|
|
223
|
+
* send the target it names (`params.sessionKey`; a `label` or `agentId`
|
|
224
|
+
* marks it unresolved until the result names it). Any other tool, or
|
|
225
|
+
* malformed input, is ignored.
|
|
226
|
+
*/
|
|
227
|
+
onToolCall(event, ctx) {
|
|
228
|
+
const e = rec(event);
|
|
229
|
+
const c = rec(ctx);
|
|
230
|
+
const tool = nonEmpty(e?.toolName);
|
|
231
|
+
if (tool !== "sessions_send" && tool !== "sessions_spawn")
|
|
232
|
+
return;
|
|
233
|
+
const runId = nonEmpty(e?.runId) ?? nonEmpty(c?.runId);
|
|
234
|
+
const run = runId ? this.runs.get(runId) : undefined;
|
|
235
|
+
const kind = run ? this.lookup({ runId }).kind : "unknown";
|
|
236
|
+
const sources = [...new Set([nonEmpty(c?.sessionKey), run?.sessionKey])].filter((k) => Boolean(k));
|
|
237
|
+
if (sources.length === 0)
|
|
238
|
+
return;
|
|
239
|
+
this.prune();
|
|
240
|
+
const params = rec(e?.params);
|
|
241
|
+
const target = tool === "sessions_send" ? nonEmpty(params?.sessionKey) : undefined;
|
|
242
|
+
const targetAgent = nonEmpty(params?.agentId)?.trim().toLowerCase();
|
|
243
|
+
const unresolved = tool === "sessions_send" && !target && (nonEmpty(params?.label) || targetAgent)
|
|
244
|
+
? { ...(targetAgent ? { targetAgent } : {}) }
|
|
245
|
+
: undefined;
|
|
246
|
+
const toolCallId = nonEmpty(e?.toolCallId) ?? nonEmpty(c?.toolCallId);
|
|
247
|
+
this.origins.push({
|
|
248
|
+
tool,
|
|
249
|
+
kind,
|
|
250
|
+
at: this.now(),
|
|
251
|
+
sources,
|
|
252
|
+
...(target ? { target } : {}),
|
|
253
|
+
...(unresolved ? { unresolved } : {}),
|
|
254
|
+
...(toolCallId ? { toolCallId } : {}),
|
|
255
|
+
});
|
|
256
|
+
while (this.origins.length > MAX_ORIGIN_CALLS)
|
|
257
|
+
this.origins.shift();
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Reads a `sessions_send` / `sessions_spawn` result from an `after_tool_call`
|
|
261
|
+
* event: drops the pending call when the result says it started no run to
|
|
262
|
+
* match (a failed spawn; for a send, {@link sendStartedNoRunToMatch}), and
|
|
263
|
+
* gives a send its resolved target session. Unknown calls, other tools and
|
|
264
|
+
* unreadable results are ignored.
|
|
265
|
+
*/
|
|
266
|
+
onToolResult(event, ctx) {
|
|
267
|
+
const e = rec(event);
|
|
268
|
+
const tool = nonEmpty(e?.toolName);
|
|
269
|
+
if (tool !== "sessions_send" && tool !== "sessions_spawn")
|
|
270
|
+
return;
|
|
271
|
+
const toolCallId = nonEmpty(e?.toolCallId) ?? nonEmpty(rec(ctx)?.toolCallId);
|
|
272
|
+
if (!toolCallId)
|
|
273
|
+
return;
|
|
274
|
+
const index = this.origins.findIndex((o) => o.tool === tool && o.toolCallId === toolCallId);
|
|
275
|
+
if (index < 0)
|
|
276
|
+
return;
|
|
277
|
+
const details = resultDetails(e?.result);
|
|
278
|
+
if (!details)
|
|
279
|
+
return;
|
|
280
|
+
const failed = details.status === "error" || details.status === "forbidden";
|
|
281
|
+
if (tool === "sessions_spawn" ? failed : sendStartedNoRunToMatch(details)) {
|
|
282
|
+
this.origins.splice(index, 1);
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
const resolved = nonEmpty(details.sessionKey);
|
|
286
|
+
if (tool === "sessions_send" && resolved) {
|
|
287
|
+
this.origins[index].target = resolved;
|
|
288
|
+
delete this.origins[index].unresolved;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Records a run from a `before_prompt_build` agent context. Malformed input
|
|
293
|
+
* is ignored. A run is classified once: 10.x fires the hook again for each
|
|
294
|
+
* retry attempt of the same run (after compaction, a model or auth
|
|
295
|
+
* failover), after an `agent_end` for the attempt before it, and by then the
|
|
296
|
+
* origin call or exchange that classified it is consumed, so re-classifying
|
|
297
|
+
* would turn a chat-originated run into `other`. The first answer stands,
|
|
298
|
+
* whatever it was; a scheduled run stays scheduled. Host run ids are fresh per
|
|
299
|
+
* run, so a retained id only ever comes back as a retry (10.10 cron
|
|
300
|
+
* `isolated-agent/run.ts:142`, follow-ups `followup-turn-admission.ts:305`,
|
|
301
|
+
* replies `agent-runner-execution.ts:703`). A caller-supplied id (a `chat.send`
|
|
302
|
+
* or announce idempotency key) names one message; reused, it keeps its first answer.
|
|
303
|
+
*/
|
|
304
|
+
onPromptBuild(ctx) {
|
|
305
|
+
const c = rec(ctx);
|
|
306
|
+
const runId = nonEmpty(c?.runId);
|
|
307
|
+
if (!runId)
|
|
308
|
+
return;
|
|
309
|
+
const sessionKey = nonEmpty(c?.sessionKey);
|
|
310
|
+
const known = this.runs.get(runId);
|
|
311
|
+
if (!known)
|
|
312
|
+
this.recorded += 1;
|
|
313
|
+
const entry = known ?? this.classify(c ?? {}, sessionKey);
|
|
314
|
+
this.runs.delete(runId);
|
|
315
|
+
this.runs.set(runId, entry);
|
|
316
|
+
if (sessionKey) {
|
|
317
|
+
this.latestBySession.set(sessionKey, runId);
|
|
318
|
+
// The resolved kind, not the entry's: a retried child's entry still holds its `other`
|
|
319
|
+
// placeholder, and writing that back would undo the kind `subagent_spawned` gave the session.
|
|
320
|
+
boundedSet(this.lastKindBySession, sessionKey, this.lookup({ runId }).kind, this.maxRuns * 2);
|
|
321
|
+
}
|
|
322
|
+
while (this.runs.size > this.maxRuns) {
|
|
323
|
+
const oldest = this.runs.keys().next().value;
|
|
324
|
+
this.forget(oldest);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Records a spawned child's origin from a `subagent_spawned` context/event:
|
|
329
|
+
* the kind of the run whose `sessions_spawn` call is pending in the requester
|
|
330
|
+
* session (consumed), or `other` when none matches. Malformed input is ignored.
|
|
331
|
+
*/
|
|
332
|
+
onSubagentSpawned(ctx, event) {
|
|
333
|
+
const c = rec(ctx);
|
|
334
|
+
const e = rec(event);
|
|
335
|
+
const child = nonEmpty(c?.childSessionKey) ?? nonEmpty(e?.childSessionKey);
|
|
336
|
+
if (!child)
|
|
337
|
+
return;
|
|
338
|
+
const requester = nonEmpty(c?.requesterSessionKey) ?? nonEmpty(rec(e?.requester)?.sessionKey);
|
|
339
|
+
const kind = this.takeOrigin("sessions_spawn", requester)?.kind ?? "other";
|
|
340
|
+
boundedSet(this.childOrigins, child, kind, this.maxRuns * 2);
|
|
341
|
+
boundedSet(this.lastKindBySession, child, kind, this.maxRuns * 2);
|
|
342
|
+
}
|
|
343
|
+
/** How many runs `before_prompt_build` has recorded since this tracker started. */
|
|
344
|
+
get runsRecorded() {
|
|
345
|
+
return this.recorded;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* An attempt ended (`agent_end`). The run's entry stays: 10.10 fires this per
|
|
349
|
+
* attempt with no retry guard (`run/attempt-finalize.ts:305-308`), a retry keeps
|
|
350
|
+
* the run id, and the hook is fire-and-forget, so it can even land after the
|
|
351
|
+
* retry's prompt build. `maxRuns` bounds the entries. Only the run's claim on
|
|
352
|
+
* its session goes, so a call with no run id never reads a run that ended
|
|
353
|
+
* (`unknown`, which the gate refuses).
|
|
354
|
+
*/
|
|
355
|
+
onRunEnd(runId) {
|
|
356
|
+
const id = nonEmpty(runId);
|
|
357
|
+
if (id)
|
|
358
|
+
this.releaseSession(id);
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* The turn of a tool call: by run id, else by the session's latest recorded
|
|
362
|
+
* run, else `unknown` with the given session key.
|
|
363
|
+
*/
|
|
364
|
+
lookup(params) {
|
|
365
|
+
const sessionKey = nonEmpty(params.sessionKey);
|
|
366
|
+
const runId = nonEmpty(params.runId) ?? (sessionKey ? this.latestBySession.get(sessionKey) : undefined);
|
|
367
|
+
const entry = runId ? this.runs.get(runId) : undefined;
|
|
368
|
+
const key = entry?.sessionKey ?? sessionKey;
|
|
369
|
+
let kind = entry?.kind ?? "unknown";
|
|
370
|
+
if (entry?.pendingChild && entry.sessionKey)
|
|
371
|
+
kind = this.childOrigins.get(entry.sessionKey) ?? entry.kind;
|
|
372
|
+
return { ...(key ? { sessionKey: key } : {}), kind };
|
|
373
|
+
}
|
|
374
|
+
classify(c, sessionKey) {
|
|
375
|
+
const trigger = nonEmpty(c.trigger)?.trim();
|
|
376
|
+
if (trigger === "cron" || trigger === "heartbeat")
|
|
377
|
+
return { sessionKey, kind: trigger };
|
|
378
|
+
const provenance = rec(c.inputProvenance);
|
|
379
|
+
const provenanceKind = nonEmpty(provenance?.kind);
|
|
380
|
+
if (provenanceKind === "inter_session") {
|
|
381
|
+
const source = nonEmpty(provenance?.sourceSessionKey);
|
|
382
|
+
const sourceTool = nonEmpty(provenance?.sourceTool);
|
|
383
|
+
if (sourceTool === "sessions_send") {
|
|
384
|
+
return { sessionKey, kind: this.sendOriginKind(source, sessionKey) };
|
|
385
|
+
}
|
|
386
|
+
if (sourceTool === SUBAGENT_RESUME_SOURCE_TOOL) {
|
|
387
|
+
// An orphaned subagent resumed after a restart runs in its own session; its source is the
|
|
388
|
+
// requester, whose latest run may be a newer chat. It keeps its spawner's kind when this
|
|
389
|
+
// process saw the spawn, else `other` (T-RESTART option D).
|
|
390
|
+
return { sessionKey, kind: (sessionKey ? this.childOrigins.get(sessionKey) : undefined) ?? "other" };
|
|
391
|
+
}
|
|
392
|
+
return { sessionKey, kind: this.kindOfSession(source) };
|
|
393
|
+
}
|
|
394
|
+
if (isChildSession(sessionKey)) {
|
|
395
|
+
const inherited = sessionKey ? this.childOrigins.get(sessionKey) : undefined;
|
|
396
|
+
return inherited ? { sessionKey, kind: inherited } : { sessionKey, kind: "other", pendingChild: true };
|
|
397
|
+
}
|
|
398
|
+
if (trigger === "event" || provenanceKind === "internal_system")
|
|
399
|
+
return { sessionKey, kind: "other" };
|
|
400
|
+
if (nonEmpty(c.jobId) || sessionRest(sessionKey).startsWith("cron:"))
|
|
401
|
+
return { sessionKey, kind: "other" };
|
|
402
|
+
if (trigger === "user" && (provenanceKind === undefined || provenanceKind === "external_user")) {
|
|
403
|
+
return { sessionKey, kind: "chat" };
|
|
404
|
+
}
|
|
405
|
+
return { sessionKey, kind: trigger === undefined ? "unknown" : "other" };
|
|
406
|
+
}
|
|
407
|
+
/** Drops origin calls and exchanges older than the match window. */
|
|
408
|
+
prune() {
|
|
409
|
+
const at = this.now();
|
|
410
|
+
this.origins = this.origins.filter((o) => at - o.at <= SESSIONS_SEND_MATCH_WINDOW_MS);
|
|
411
|
+
this.exchanges = this.exchanges.filter((x) => at - x.at <= SESSIONS_SEND_MATCH_WINDOW_MS);
|
|
412
|
+
}
|
|
413
|
+
/** One kind from several candidates: theirs when all agree and it is known, else `other`. */
|
|
414
|
+
static agreed(kinds) {
|
|
415
|
+
const set = new Set(kinds);
|
|
416
|
+
const [only] = [...set];
|
|
417
|
+
return set.size === 1 && only !== "unknown" ? only : "other";
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* The pending `tool` call from `source` (for a send: aimed at `target`)
|
|
421
|
+
* that started this run, consumed, with the kind the candidates agree on;
|
|
422
|
+
* `undefined` when none matches.
|
|
423
|
+
*/
|
|
424
|
+
takeOrigin(tool, source, target) {
|
|
425
|
+
if (!source)
|
|
426
|
+
return undefined;
|
|
427
|
+
this.prune();
|
|
428
|
+
const fromSource = this.origins.filter((o) => o.tool === tool && o.sources.includes(source));
|
|
429
|
+
let candidates = tool === "sessions_spawn" ? fromSource : fromSource.filter((o) => targetMatches(o.target, target));
|
|
430
|
+
if (candidates.length === 0 && tool === "sessions_send") {
|
|
431
|
+
// A send addressed by label or agent id whose result has not named its
|
|
432
|
+
// target yet: an exact match always wins over these.
|
|
433
|
+
const agent = sessionAgent(target);
|
|
434
|
+
candidates = fromSource.filter((o) => o.unresolved && target !== undefined && (o.unresolved.targetAgent === undefined || o.unresolved.targetAgent === agent));
|
|
435
|
+
}
|
|
436
|
+
const call = candidates[0];
|
|
437
|
+
if (!call)
|
|
438
|
+
return undefined;
|
|
439
|
+
this.origins.splice(this.origins.indexOf(call), 1);
|
|
440
|
+
return { kind: TurnContextTracker.agreed(candidates.map((o) => o.kind)), call };
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* The kind of a run whose provenance says `sessions_send` from `source`, in
|
|
444
|
+
* `sessionKey`: either a target run (a pending send from `source` aimed at
|
|
445
|
+
* this session) or a reply-back run (an open exchange from this session to
|
|
446
|
+
* `source`). Both possible with different kinds, or neither → `other`.
|
|
447
|
+
*/
|
|
448
|
+
sendOriginKind(source, sessionKey) {
|
|
449
|
+
const forward = this.takeOrigin("sessions_send", source, sessionKey);
|
|
450
|
+
const replies = sessionKey
|
|
451
|
+
? this.exchanges.filter((x) => x.requesters.includes(sessionKey) && targetMatches(x.target, source))
|
|
452
|
+
: [];
|
|
453
|
+
const reply = replies[0];
|
|
454
|
+
if (reply)
|
|
455
|
+
this.exchanges.splice(this.exchanges.indexOf(reply), 1);
|
|
456
|
+
if (forward && sessionKey) {
|
|
457
|
+
this.exchanges.push({ kind: forward.kind, at: this.now(), requesters: forward.call.sources, target: sessionKey });
|
|
458
|
+
while (this.exchanges.length > MAX_ORIGIN_CALLS)
|
|
459
|
+
this.exchanges.shift();
|
|
460
|
+
}
|
|
461
|
+
const kinds = [
|
|
462
|
+
...(forward ? [forward.kind] : []),
|
|
463
|
+
...(reply ? [TurnContextTracker.agreed(replies.map((x) => x.kind))] : []),
|
|
464
|
+
];
|
|
465
|
+
return kinds.length === 0 ? "other" : TurnContextTracker.agreed(kinds);
|
|
466
|
+
}
|
|
467
|
+
/** A session's last classified run kind, or `other` when it is unknown (not resolvable is not chat). */
|
|
468
|
+
kindOfSession(sessionKey) {
|
|
469
|
+
const kind = sessionKey ? this.lastKindBySession.get(sessionKey) : undefined;
|
|
470
|
+
return kind && kind !== "unknown" ? kind : "other";
|
|
471
|
+
}
|
|
472
|
+
/** Drops a run for good: the eviction past `maxRuns`. */
|
|
473
|
+
forget(runId) {
|
|
474
|
+
this.releaseSession(runId);
|
|
475
|
+
this.runs.delete(runId);
|
|
476
|
+
}
|
|
477
|
+
/** Stops `runId` being its session's latest run; a newer run in that session is left alone. */
|
|
478
|
+
releaseSession(runId) {
|
|
479
|
+
const sessionKey = this.runs.get(runId)?.sessionKey;
|
|
480
|
+
if (sessionKey && this.latestBySession.get(sessionKey) === runId) {
|
|
481
|
+
this.latestBySession.delete(sessionKey);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Whether this host lets the runtime classify the run a gated call belongs to:
|
|
487
|
+
* one boot-time fact, never decided per run (D15). Both halves must hold.
|
|
488
|
+
*
|
|
489
|
+
* 1. **The host links a tool call to its run.** The gate reads the run id that
|
|
490
|
+
* `before_tool_call` carries. 5.12 and 5.7 add the bundle-MCP tools (every
|
|
491
|
+
* `senpi__` tool) unwrapped and split them with no hook context (5.12
|
|
492
|
+
* `pi-embedded-runner/run/attempt.ts:1228-1235,1275,1737`; 5.7
|
|
493
|
+
* `attempt.ts:1035,1081`), so `pi-tool-definition-adapter.ts:240-244` runs the
|
|
494
|
+
* hook with no ctx and the call arrives with no run id or session key
|
|
495
|
+
* (`pi-tools.before-tool-call.ts:525-534,594-600`). Every `senpi__` call would
|
|
496
|
+
* read `unknown`, so a 5.x host is never available, whatever its config.
|
|
497
|
+
* The first tag that links is 2026.6.1 (`splitSdkTools` passes
|
|
498
|
+
* `catalogToolHookContext`, which carries `runId`). Since 9.5 the bundle
|
|
499
|
+
* tools are also wrapped up front (`attempt-bundle-tools.ts:204` on 10.10).
|
|
500
|
+
* The runtime gates on the modern host (>= 2026.8.1), which includes that.
|
|
501
|
+
* 2. **The conversation hooks register.** The tracker is fed by
|
|
502
|
+
* `before_prompt_build`, a conversation hook on 10.x. A non-bundled plugin's
|
|
503
|
+
* registration is dropped with only a warn diagnostic unless
|
|
504
|
+
* `plugins.entries.<id>.hooks.allowConversationAccess` is `true` (10.10
|
|
505
|
+
* `registry-registrars-tools-hooks.ts:53-63,404-417`,
|
|
506
|
+
* `hook-policy-decisions.ts:10-16`). `allowPromptInjection: false` drops it
|
|
507
|
+
* too (5.12 `registry.ts:2288-2296`).
|
|
508
|
+
*
|
|
509
|
+
* @param config - The whole OpenClaw config the plugin was registered with (`api.config`).
|
|
510
|
+
* @returns `reason` for status surfaces. `configFix` only when a config change
|
|
511
|
+
* would make it available; a host-version limit has none.
|
|
512
|
+
*/
|
|
513
|
+
export function turnClassificationAvailable(params) {
|
|
514
|
+
if (!params.modernHost) {
|
|
515
|
+
return {
|
|
516
|
+
available: false,
|
|
517
|
+
reason: "host cannot link tool calls to runs: OpenClaw 5.x runs MCP tools without their run context",
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
const hooks = rec(rec(rec(rec(rec(params.config)?.plugins)?.entries)?.[params.pluginId])?.hooks);
|
|
521
|
+
const base = `plugins.entries.${params.pluginId}.hooks`;
|
|
522
|
+
if (hooks?.allowPromptInjection === false) {
|
|
523
|
+
return {
|
|
524
|
+
available: false,
|
|
525
|
+
reason: `${base}.allowPromptInjection is false, so before_prompt_build is refused`,
|
|
526
|
+
configFix: `remove ${base}.allowPromptInjection: false`,
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
if (hooks?.allowConversationAccess !== true) {
|
|
530
|
+
return {
|
|
531
|
+
available: false,
|
|
532
|
+
reason: `${base}.allowConversationAccess is not true, so OpenClaw 10.x refuses before_prompt_build`,
|
|
533
|
+
configFix: `set ${base}.allowConversationAccess to true`,
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
return { available: true };
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* Feeds `tracker` from `before_prompt_build` (records; returns nothing, so the
|
|
540
|
+
* prompt is untouched), `subagent_spawned` (a child's origin; not a
|
|
541
|
+
* conversation hook on any host), `before_tool_call` / `after_tool_call`
|
|
542
|
+
* (observe `sessions_send` and `sessions_spawn` calls and their results only,
|
|
543
|
+
* to identify the run that started a target or a child; return nothing, so
|
|
544
|
+
* they decide nothing) and `agent_end` (the run stops being its session's latest; refused
|
|
545
|
+
* without conversation access, where nothing is recorded anyway). Handlers never throw.
|
|
546
|
+
*/
|
|
547
|
+
export function registerTurnContextHooks(params) {
|
|
548
|
+
const { api, tracker } = params;
|
|
549
|
+
api.on("before_prompt_build", (_event, ctx) => {
|
|
550
|
+
try {
|
|
551
|
+
tracker.onPromptBuild(ctx);
|
|
552
|
+
}
|
|
553
|
+
catch {
|
|
554
|
+
// never disturb a turn
|
|
555
|
+
}
|
|
556
|
+
return undefined;
|
|
557
|
+
});
|
|
558
|
+
api.on("subagent_spawned", (event, ctx) => {
|
|
559
|
+
try {
|
|
560
|
+
tracker.onSubagentSpawned(ctx, event);
|
|
561
|
+
}
|
|
562
|
+
catch {
|
|
563
|
+
// never disturb a turn
|
|
564
|
+
}
|
|
565
|
+
return undefined;
|
|
566
|
+
});
|
|
567
|
+
api.on("before_tool_call", (event, ctx) => {
|
|
568
|
+
try {
|
|
569
|
+
tracker.onToolCall(event, ctx);
|
|
570
|
+
}
|
|
571
|
+
catch {
|
|
572
|
+
// never disturb a tool call
|
|
573
|
+
}
|
|
574
|
+
return undefined;
|
|
575
|
+
});
|
|
576
|
+
api.on("after_tool_call", (event, ctx) => {
|
|
577
|
+
try {
|
|
578
|
+
tracker.onToolResult(event, ctx);
|
|
579
|
+
}
|
|
580
|
+
catch {
|
|
581
|
+
// never disturb a tool call
|
|
582
|
+
}
|
|
583
|
+
return undefined;
|
|
584
|
+
});
|
|
585
|
+
api.on("agent_end", (_event, ctx) => {
|
|
586
|
+
try {
|
|
587
|
+
tracker.onRunEnd(rec(ctx)?.runId);
|
|
588
|
+
}
|
|
589
|
+
catch {
|
|
590
|
+
// never disturb a turn
|
|
591
|
+
}
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
//# sourceMappingURL=turn-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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C,MAAM,CAAC;YACP,uBAAuB;QACzB,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guide-commands.d.ts","sourceRoot":"","sources":["../../src/cli/guide-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAqeH,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"guide-commands.d.ts","sourceRoot":"","sources":["../../src/cli/guide-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAqeH,eAAO,MAAM,eAAe,QAyXpB,CAAC;AAIT,kFAAkF;AAClF,UAAU,gBAAgB;IACxB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC;IACvD,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAAC;IAC5C,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC;IAC9D,MAAM,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC;CACxF;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,gBAAgB,EACvB,OAAO,EAAE,MAAM,GACd,IAAI,CA2CN"}
|
|
@@ -684,9 +684,24 @@ senpi auto-update — Plugin auto-update (the runtime package's own version chec
|
|
|
684
684
|
(exit 1, UNAVAILABLE) when auto-update is off in
|
|
685
685
|
config or the coordinator is not running. A forced
|
|
686
686
|
check also runs the
|
|
687
|
-
skills-manager tick
|
|
688
|
-
update
|
|
689
|
-
return nothing at all
|
|
687
|
+
skills-manager tick. On OpenClaw 5.x the path that
|
|
688
|
+
installs an update requests a gateway restart, so the
|
|
689
|
+
call may return nothing at all. On 10.x nothing is
|
|
690
|
+
installed in the call: the update waits for this box's
|
|
691
|
+
spread slot and an idle box (no user turn, approval,
|
|
692
|
+
money call or deploy in flight, no user message for
|
|
693
|
+
15 min, gateway started at least 15 min ago), then
|
|
694
|
+
requests a gateway restart, and the box
|
|
695
|
+
installs it as the gateway comes back.
|
|
696
|
+
The snapshot reason says where it is:
|
|
697
|
+
pending-idle:<v> = waiting for the slot or idle (the
|
|
698
|
+
snapshot's pendingBlockers say why; normal, do not
|
|
699
|
+
re-run check-now to push it);
|
|
700
|
+
updated-restart-requested:<v> / awaiting-restart:<v> =
|
|
701
|
+
restart requested, not loaded yet;
|
|
702
|
+
update-not-loaded:<v> = the restart did not load it
|
|
703
|
+
(retried; after 3 tries parked until a newer release:
|
|
704
|
+
report it, do not loop check-now)
|
|
690
705
|
--json Raw JSON output
|
|
691
706
|
|
|
692
707
|
senpi dsl — Inspect DSL exit engine
|