1: <?php
2:
3: declare(strict_types=1);
4:
5: /**
6: * This file is part of the Nexus MCP SDK package.
7: *
8: * (c) 2026 John Paul E. Balandan, CPA <paulbalandan@gmail.com>
9: *
10: * For the full copyright and license information, please view
11: * the LICENSE file that was distributed with this source code.
12: */
13:
14: namespace Nexus\Mcp\Extension\Tasks\Server\Store;
15:
16: use Nexus\Mcp\Core\Schema\Request\InputRequest;
17: use Nexus\Mcp\Core\Schema\Result\InputResponse;
18: use Nexus\Mcp\Extension\Tasks\Schema\Enum\TaskStatus;
19:
20: /**
21: * A store-side snapshot of one task.
22: */
23: final readonly class TaskRecord
24: {
25: /**
26: * @param non-empty-string $taskId
27: * @param non-empty-string $toolName The `tools/call` tool the task runs
28: * @param non-empty-string $createdAt ISO 8601
29: * @param non-empty-string $lastUpdatedAt ISO 8601
30: * @param null|array<array-key, mixed> $arguments The original call arguments
31: * @param null|array<string, mixed> $result The stored result payload, once completed
32: * @param null|array<string, mixed> $error The stored error payload, once failed
33: * @param array<int|non-empty-string, InputRequest> $pendingInputRequests Input requests awaiting `tasks/update` answers
34: * @param array<int|non-empty-string, InputResponse> $inputResponses Accumulated answers, re-dispatched with `$requestState`
35: * @param null|string $requestState The continuation token the parked result carried
36: * @param array<array-key, true> $issuedInputKeys Every input-request key issued over the task's lifetime
37: * @param null|non-empty-string $statusMessage
38: */
39: public function __construct(
40: public string $taskId,
41: public string $toolName,
42: public TaskStatus $status,
43: public string $createdAt,
44: public string $lastUpdatedAt,
45: public ?int $ttlMs,
46: public int $pollIntervalMs,
47: public ?array $arguments = null,
48: public ?array $result = null,
49: public ?array $error = null,
50: public array $pendingInputRequests = [],
51: public array $inputResponses = [],
52: public ?string $requestState = null,
53: public array $issuedInputKeys = [],
54: public ?string $statusMessage = null,
55: ) {
56: }
57: }
58: