MCPcopy Index your code
hub / github.com/anomalyco/opencode / taskMessage

Function taskMessage

packages/opencode/test/cli/run/subagent-data.test.ts:52–136  ·  view source on GitHub ↗
(sessionID: string, status: "running" | "completed" | "interrupted" = "completed")

Source from the content-addressed store, hash-verified

50}
51
52function taskMessage(sessionID: string, status: "running" | "completed" | "interrupted" = "completed"): SessionMessage {
53 if (status === "running") {
54 return {
55 parts: [
56 {
57 id: `part-${sessionID}`,
58 sessionID: "parent-1",
59 messageID: `msg-${sessionID}`,
60 type: "tool",
61 callID: `call-${sessionID}`,
62 tool: "task",
63 state: {
64 status: "running",
65 input: {
66 description: "Scan reducer paths",
67 subagent_type: "explore",
68 },
69 title: "Reducer touchpoints",
70 metadata: {
71 sessionId: sessionID,
72 toolcalls: 4,
73 },
74 time: { start: 1 },
75 },
76 },
77 ],
78 }
79 }
80
81 if (status === "interrupted") {
82 return {
83 parts: [
84 {
85 id: `part-${sessionID}`,
86 sessionID: "parent-1",
87 messageID: `msg-${sessionID}`,
88 type: "tool",
89 callID: `call-${sessionID}`,
90 tool: "task",
91 state: {
92 status: "error",
93 input: {
94 description: "Scan reducer paths",
95 subagent_type: "explore",
96 },
97 error: "Tool execution aborted",
98 metadata: {
99 sessionId: sessionID,
100 toolcalls: 4,
101 interrupted: true,
102 },
103 time: { start: 1, end: 2 },
104 },
105 },
106 ],
107 }
108 }
109

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected