Skip to content

Commit 26e5794

Browse files
committed
refactor: inline RequestContextParams interface into RequestContext constructor parameters
1 parent 4c9582d commit 26e5794

1 file changed

Lines changed: 8 additions & 22 deletions

File tree

src/server/agent_execution/request_context.ts

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,28 @@
11
import { Message, SendMessageRequest, Task } from '../../index.js';
22
import { ServerCallContext } from '../context.js';
33

4-
export interface RequestContextParams {
5-
/** The incoming `SendMessageRequest` payload. Its `message` field MUST be set. */
6-
request: SendMessageRequest;
7-
/** The server call context associated with this request. */
8-
context: ServerCallContext;
9-
/** The resolved task ID (either from the request or server-generated). */
10-
taskId: string;
11-
/** The resolved context ID (either from the request or server-generated). */
12-
contextId: string;
13-
/** The existing `Task` object retrieved from the store, if any. */
14-
task?: Task;
15-
/** A list of other tasks related to the current request (e.g., for tool use). */
16-
referenceTasks?: Task[];
17-
}
18-
194
/**
205
* Holds information about the current request being processed by the server.
216
*
227
* Wraps the incoming {@link SendMessageRequest} so agent executors can reach
238
* the full payload (message, configuration, metadata, tenant) via `request`.
249
*/
2510
export class RequestContext {
26-
/** The incoming request payload, including `message`, `configuration`, `metadata`, and `tenant`. */
2711
public readonly request: SendMessageRequest;
28-
/** The server call context associated with this request. */
2912
public readonly context: ServerCallContext;
30-
/** The resolved task ID for this request. */
3113
public readonly taskId: string;
32-
/** The resolved context ID for this request. */
3314
public readonly contextId: string;
34-
/** The existing `Task` object retrieved from the store, if any. */
3515
public readonly task?: Task;
36-
/** A list of other tasks related to the current request (e.g., for tool use). */
3716
public readonly referenceTasks?: Task[];
3817

39-
constructor(params: RequestContextParams) {
18+
constructor(params: {
19+
request: SendMessageRequest;
20+
context: ServerCallContext;
21+
taskId: string;
22+
contextId: string;
23+
task?: Task;
24+
referenceTasks?: Task[];
25+
}) {
4026
if (!params.request.message) {
4127
throw new Error('RequestContext requires request.message to be set.');
4228
}

0 commit comments

Comments
 (0)