MCPcopy Index your code
hub / github.com/github/copilot-sdk / deserializeHookInput

Function deserializeHookInput

nodejs/src/session.ts:68–79  ·  view source on GitHub ↗

* Convert a raw hook input received over the wire into its public-facing shape. * This deserializes the numeric Unix-ms `timestamp` field on BaseHookInput * into a Date and maps the wire `cwd` field to `workingDirectory`.

(raw: unknown)

Source from the content-addressed store, hash-verified

66 * into a Date and maps the wire `cwd` field to `workingDirectory`.
67 */
68function deserializeHookInput(raw: unknown): unknown {
69 if (
70 !raw ||
71 typeof raw !== "object" ||
72 typeof (raw as { timestamp?: unknown }).timestamp !== "number"
73 ) {
74 return raw;
75 }
76 const obj = raw as Record<string, unknown> & { timestamp: number; cwd?: string };
77 const { cwd, ...rest } = obj;
78 return { ...rest, timestamp: new Date(obj.timestamp), workingDirectory: cwd };
79}
80
81function isOpenCanvasInstance(value: unknown): value is OpenCanvasInstance {
82 if (!value || typeof value !== "object") {

Callers 1

_handleHooksInvokeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…