(opts: {
state?: TaskState
statusMessage?: Message
hasStatus?: boolean
history?: Message[]
artifacts?: Artifact[]
})
| 49 | } |
| 50 | |
| 51 | function task(opts: { |
| 52 | state?: TaskState |
| 53 | statusMessage?: Message |
| 54 | hasStatus?: boolean |
| 55 | history?: Message[] |
| 56 | artifacts?: Artifact[] |
| 57 | }): Task { |
| 58 | const hasStatus = opts.hasStatus ?? (opts.state !== undefined || opts.statusMessage !== undefined) |
| 59 | return { |
| 60 | id: 'task-1', |
| 61 | contextId: 'ctx-1', |
| 62 | status: hasStatus |
| 63 | ? { |
| 64 | state: opts.state ?? TaskState.TASK_STATE_UNSPECIFIED, |
| 65 | message: opts.statusMessage, |
| 66 | timestamp: undefined, |
| 67 | } |
| 68 | : undefined, |
| 69 | artifacts: opts.artifacts ?? [], |
| 70 | history: opts.history ?? [], |
| 71 | metadata: undefined, |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | describe('buildUserMessage', () => { |
| 76 | it('builds a text-only user message', () => { |
no outgoing calls
no test coverage detected