fix(copilot): mark internal hook injections as agent-initiated

Apply the internal initiator marker to automated continuation, recovery, babysitter, stop-hook, and hook-message injections so Copilot attribution consistently sets x-initiator=agent for system-generated prompts.
This commit is contained in:
Maxim Harizanov
2026-02-18 21:54:20 +02:00
parent a85f7efb1d
commit 850fb0378e
10 changed files with 39 additions and 15 deletions
@@ -1,7 +1,11 @@
import type { PluginInput } from "@opencode-ai/plugin"
import type { BackgroundManager } from "../../features/background-agent"
import { normalizeSDKResponse, resolveInheritedPromptTools } from "../../shared"
import {
createInternalAgentTextPart,
normalizeSDKResponse,
resolveInheritedPromptTools,
} from "../../shared"
import {
findNearestMessageWithFields,
findNearestMessageWithFieldsFromSDK,
@@ -151,7 +155,7 @@ ${todoList}`
agent: agentName,
...(model !== undefined ? { model } : {}),
...(inheritedTools ? { tools: inheritedTools } : {}),
parts: [{ type: "text", text: prompt }],
parts: [createInternalAgentTextPart(prompt)],
},
query: { directory: ctx.directory },
})