MCPcopy Create free account
hub / github.com/MatterAIOrg/OrbCode / buildEnvironmentDetails

Method buildEnvironmentDetails

src/core/agent.ts:306–327  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

304 }
305
306 private buildEnvironmentDetails(): string {
307 const files = walkFiles(this.options.cwd, true, 200)
308 const git = getGitSummary(this.options.cwd)
309 const now = new Date()
310 const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone
311 const timeZoneOffset = -now.getTimezoneOffset() / 60
312 const timeZoneOffsetHours = Math.floor(Math.abs(timeZoneOffset))
313 const timeZoneOffsetMinutes = Math.abs(Math.round((Math.abs(timeZoneOffset) - timeZoneOffsetHours) * 60))
314 const timeZoneOffsetStr = `${timeZoneOffset >= 0 ? "+" : "-"}${timeZoneOffsetHours}:${timeZoneOffsetMinutes.toString().padStart(2, "0")}`
315 const linkedRepos = renderLinkedReposSection(this.options.cwd)
316 return `# Environment Details
317
318## Current Workspace Directory (${this.options.cwd}) Files
319${files.join("\n") || "(empty directory)"}
320${files.length >= 200 ? "\n(File list truncated.)" : ""}
321
322${git}
323${linkedRepos ? `\n${linkedRepos}` : ""}
324## Current Time
325Current time in ISO 8601 UTC format: ${now.toISOString()}
326User time zone: ${timeZone}, UTC${timeZoneOffsetStr}`
327 }
328
329 /** Conversation history with internal markers stripped, ready for the model. */
330 private outgoingMessages(): OpenAI.Chat.ChatCompletionMessageParam[] {

Callers 1

runTurnMethod · 0.95

Calls 3

walkFilesFunction · 0.85
getGitSummaryFunction · 0.85
renderLinkedReposSectionFunction · 0.85

Tested by

no test coverage detected