MCPcopy Index your code
hub / github.com/github/copilot-sdk / getSystemMessageConfigForMode

Method getSystemMessageConfigForMode

nodejs/src/client.ts:1206–1240  ·  view source on GitHub ↗

* Returns the systemMessage config to use, adjusted for the current mode. * In empty mode we ensure the environment_context section is removed * unless the app has already taken control of it. `append` (and * unspecified) mode is promoted to `customize` so we can also strip * env

(
        supplied: SystemMessageConfig | undefined
    )

Source from the content-addressed store, hash-verified

1204 * customize and append modes.
1205 */
1206 private getSystemMessageConfigForMode(
1207 supplied: SystemMessageConfig | undefined
1208 ): SystemMessageConfig | undefined {
1209 if (this.options.mode !== "empty") return supplied;
1210 if (!supplied) {
1211 return {
1212 mode: "customize",
1213 sections: { environment_context: { action: "remove" } },
1214 };
1215 }
1216 switch (supplied.mode) {
1217 case "replace":
1218 return supplied;
1219 case "customize":
1220 if (supplied.sections?.environment_context) return supplied;
1221 return {
1222 ...supplied,
1223 sections: {
1224 ...supplied.sections,
1225 environment_context: { action: "remove" },
1226 },
1227 };
1228 case "append":
1229 case undefined:
1230 // Promote to customize so we can also strip environment_context.
1231 // The runtime appends `content` to additional instructions in
1232 // both customize and append modes, so the caller's text is
1233 // preserved verbatim.
1234 return {
1235 mode: "customize",
1236 content: supplied.content,
1237 sections: { environment_context: { action: "remove" } },
1238 };
1239 }
1240 }
1241
1242 /**
1243 * Mode-specific options applied via session.options.update after create/resume.

Callers 2

createSessionMethod · 0.95
resumeSessionMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected