(options: AgentOptions)
| 175 | readonly taskId: string |
| 176 | |
| 177 | constructor(options: AgentOptions) { |
| 178 | this.options = options |
| 179 | this.taskId = options.resume?.id ?? randomUUID() |
| 180 | this.hooks = new HookRunner({ |
| 181 | cwd: options.cwd, |
| 182 | sessionId: this.taskId, |
| 183 | transcriptPath: getSessionFilePath(this.taskId), |
| 184 | config: options.hooks, |
| 185 | onSystemMessage: (message, isError) => |
| 186 | options.callbacks.onEvent({ type: "system", message, isError }), |
| 187 | getSignal: () => this.abortController?.signal, |
| 188 | }) |
| 189 | if (options.resume) { |
| 190 | this.messages = options.resume.messages |
| 191 | this.todos = options.resume.todos |
| 192 | this.totalCost = options.resume.totalCost |
| 193 | this.contextTokens = options.resume.contextTokens |
| 194 | this.title = options.resume.title |
| 195 | this.createdAt = options.resume.createdAt |
| 196 | this.firstMessageSent = this.messages.length > 0 |
| 197 | } |
| 198 | this.sessionApproveEdits = options.autoApproveEdits |
| 199 | this.mcp = options.mcp |
| 200 | // Build the system prompt with AGENTS.md memory files and the skills |
| 201 | // catalog injected, so the model sees project/user instructions and |
| 202 | // knows which skills it can invoke. An explicit override (from |
| 203 | // `orbcode -s <text>`) bypasses the default entirely. |
| 204 | const memoryFiles = options.systemPromptOverride ? [] : loadMemoryFiles(options.cwd) |
| 205 | const skills = options.systemPromptOverride ? new Map() : loadSkills(options.cwd) |
| 206 | this.systemPrompt = options.systemPromptOverride |
| 207 | ? options.systemPromptOverride |
| 208 | : buildSystemPrompt(options.cwd, { memoryFiles, skills }) |
| 209 | this.client = createLLMClient({ |
| 210 | token: options.token, |
| 211 | modelId: options.modelId, |
| 212 | taskId: this.taskId, |
| 213 | organizationId: options.organizationId, |
| 214 | repo: detectRepo(options.cwd), |
| 215 | baseUrl: options.baseUrl, |
| 216 | }) |
| 217 | } |
| 218 | |
| 219 | setModel(modelId: string): void { |
| 220 | this.options.modelId = modelId |
nothing calls this directly
no test coverage detected