bedrock-agentcore 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/README.md +94 -114
  2. package/dist/src/_utils/endpoints.d.ts +28 -0
  3. package/dist/src/_utils/endpoints.d.ts.map +1 -0
  4. package/dist/src/_utils/endpoints.js +44 -0
  5. package/dist/src/_utils/endpoints.js.map +1 -0
  6. package/dist/src/identity/client.d.ts +40 -0
  7. package/dist/src/identity/client.d.ts.map +1 -0
  8. package/dist/src/identity/client.js +109 -0
  9. package/dist/src/identity/client.js.map +1 -0
  10. package/dist/src/identity/index.d.ts +22 -0
  11. package/dist/src/identity/index.d.ts.map +1 -0
  12. package/dist/src/identity/index.js +24 -0
  13. package/dist/src/identity/index.js.map +1 -0
  14. package/dist/src/identity/types.d.ts +82 -0
  15. package/dist/src/identity/types.d.ts.map +1 -0
  16. package/dist/src/identity/types.js +5 -0
  17. package/dist/src/identity/types.js.map +1 -0
  18. package/dist/src/identity/wrappers.d.ts +54 -0
  19. package/dist/src/identity/wrappers.d.ts.map +1 -0
  20. package/dist/src/identity/wrappers.js +95 -0
  21. package/dist/src/identity/wrappers.js.map +1 -0
  22. package/dist/src/runtime/app.d.ts +144 -0
  23. package/dist/src/runtime/app.d.ts.map +1 -0
  24. package/dist/src/runtime/app.js +485 -0
  25. package/dist/src/runtime/app.js.map +1 -0
  26. package/dist/src/runtime/client.d.ts +154 -0
  27. package/dist/src/runtime/client.d.ts.map +1 -0
  28. package/dist/src/runtime/client.js +319 -0
  29. package/dist/src/runtime/client.js.map +1 -0
  30. package/dist/src/runtime/context.d.ts +33 -0
  31. package/dist/src/runtime/context.d.ts.map +1 -0
  32. package/dist/src/runtime/context.js +49 -0
  33. package/dist/src/runtime/context.js.map +1 -0
  34. package/dist/src/runtime/index.d.ts +8 -0
  35. package/dist/src/runtime/index.d.ts.map +1 -0
  36. package/dist/src/runtime/index.js +7 -0
  37. package/dist/src/runtime/index.js.map +1 -0
  38. package/dist/src/runtime/types.d.ts +429 -0
  39. package/dist/src/runtime/types.d.ts.map +1 -0
  40. package/dist/src/runtime/types.js +26 -0
  41. package/dist/src/runtime/types.js.map +1 -0
  42. package/dist/src/tools/browser/integrations/strands/click-tool.d.ts +20 -0
  43. package/dist/src/tools/browser/integrations/strands/click-tool.d.ts.map +1 -0
  44. package/dist/src/tools/browser/integrations/strands/click-tool.js +33 -0
  45. package/dist/src/tools/browser/integrations/strands/click-tool.js.map +1 -0
  46. package/dist/src/tools/browser/integrations/strands/evaluate-tool.d.ts +20 -0
  47. package/dist/src/tools/browser/integrations/strands/evaluate-tool.d.ts.map +1 -0
  48. package/dist/src/tools/browser/integrations/strands/evaluate-tool.js +34 -0
  49. package/dist/src/tools/browser/integrations/strands/evaluate-tool.js.map +1 -0
  50. package/dist/src/tools/browser/integrations/strands/get-html-tool.d.ts +19 -0
  51. package/dist/src/tools/browser/integrations/strands/get-html-tool.d.ts.map +1 -0
  52. package/dist/src/tools/browser/integrations/strands/get-html-tool.js +32 -0
  53. package/dist/src/tools/browser/integrations/strands/get-html-tool.js.map +1 -0
  54. package/dist/src/tools/browser/integrations/strands/get-text-tool.d.ts +19 -0
  55. package/dist/src/tools/browser/integrations/strands/get-text-tool.d.ts.map +1 -0
  56. package/dist/src/tools/browser/integrations/strands/get-text-tool.js +32 -0
  57. package/dist/src/tools/browser/integrations/strands/get-text-tool.js.map +1 -0
  58. package/dist/src/tools/browser/integrations/strands/index.d.ts +25 -0
  59. package/dist/src/tools/browser/integrations/strands/index.d.ts.map +1 -0
  60. package/dist/src/tools/browser/integrations/strands/index.js +25 -0
  61. package/dist/src/tools/browser/integrations/strands/index.js.map +1 -0
  62. package/dist/src/tools/browser/integrations/strands/navigate-tool.d.ts +21 -0
  63. package/dist/src/tools/browser/integrations/strands/navigate-tool.d.ts.map +1 -0
  64. package/dist/src/tools/browser/integrations/strands/navigate-tool.js +41 -0
  65. package/dist/src/tools/browser/integrations/strands/navigate-tool.js.map +1 -0
  66. package/dist/src/tools/browser/integrations/strands/screenshot-tool.d.ts +29 -0
  67. package/dist/src/tools/browser/integrations/strands/screenshot-tool.d.ts.map +1 -0
  68. package/dist/src/tools/browser/integrations/strands/screenshot-tool.js +52 -0
  69. package/dist/src/tools/browser/integrations/strands/screenshot-tool.js.map +1 -0
  70. package/dist/src/tools/browser/integrations/strands/tools.d.ts +119 -0
  71. package/dist/src/tools/browser/integrations/strands/tools.d.ts.map +1 -0
  72. package/dist/src/tools/browser/integrations/strands/tools.js +141 -0
  73. package/dist/src/tools/browser/integrations/strands/tools.js.map +1 -0
  74. package/dist/src/tools/browser/integrations/strands/type-tool.d.ts +22 -0
  75. package/dist/src/tools/browser/integrations/strands/type-tool.d.ts.map +1 -0
  76. package/dist/src/tools/browser/integrations/strands/type-tool.js +37 -0
  77. package/dist/src/tools/browser/integrations/strands/type-tool.js.map +1 -0
  78. package/dist/src/tools/browser/integrations/vercel-ai/tools.d.ts +1 -1
  79. package/dist/src/tools/browser/integrations/vercel-ai/tools.js +1 -1
  80. package/dist/src/tools/code-interpreter/client.d.ts +2 -0
  81. package/dist/src/tools/code-interpreter/client.d.ts.map +1 -1
  82. package/dist/src/tools/code-interpreter/client.js +31 -25
  83. package/dist/src/tools/code-interpreter/client.js.map +1 -1
  84. package/dist/src/tools/code-interpreter/integrations/strands/execute-code-tool.d.ts +28 -0
  85. package/dist/src/tools/code-interpreter/integrations/strands/execute-code-tool.d.ts.map +1 -0
  86. package/dist/src/tools/code-interpreter/integrations/strands/execute-code-tool.js +47 -0
  87. package/dist/src/tools/code-interpreter/integrations/strands/execute-code-tool.js.map +1 -0
  88. package/dist/src/tools/code-interpreter/integrations/strands/execute-command-tool.d.ts +27 -0
  89. package/dist/src/tools/code-interpreter/integrations/strands/execute-command-tool.d.ts.map +1 -0
  90. package/dist/src/tools/code-interpreter/integrations/strands/execute-command-tool.js +42 -0
  91. package/dist/src/tools/code-interpreter/integrations/strands/execute-command-tool.js.map +1 -0
  92. package/dist/src/tools/code-interpreter/integrations/strands/file-operations-tool.d.ts +33 -0
  93. package/dist/src/tools/code-interpreter/integrations/strands/file-operations-tool.d.ts.map +1 -0
  94. package/dist/src/tools/code-interpreter/integrations/strands/file-operations-tool.js +78 -0
  95. package/dist/src/tools/code-interpreter/integrations/strands/file-operations-tool.js.map +1 -0
  96. package/dist/src/tools/code-interpreter/integrations/strands/index.d.ts +32 -0
  97. package/dist/src/tools/code-interpreter/integrations/strands/index.d.ts.map +1 -0
  98. package/dist/src/tools/code-interpreter/integrations/strands/index.js +32 -0
  99. package/dist/src/tools/code-interpreter/integrations/strands/index.js.map +1 -0
  100. package/dist/src/tools/code-interpreter/integrations/strands/tools.d.ts +94 -0
  101. package/dist/src/tools/code-interpreter/integrations/strands/tools.d.ts.map +1 -0
  102. package/dist/src/tools/code-interpreter/integrations/strands/tools.js +112 -0
  103. package/dist/src/tools/code-interpreter/integrations/strands/tools.js.map +1 -0
  104. package/dist/src/tools/code-interpreter/integrations/vercel-ai/execute-code-tool.d.ts +2 -2
  105. package/dist/src/tools/code-interpreter/integrations/vercel-ai/execute-code-tool.js +2 -2
  106. package/dist/src/tools/code-interpreter/integrations/vercel-ai/execute-command-tool.d.ts +2 -2
  107. package/dist/src/tools/code-interpreter/integrations/vercel-ai/execute-command-tool.js +2 -2
  108. package/dist/src/tools/code-interpreter/integrations/vercel-ai/file-operations-tool.d.ts +3 -3
  109. package/dist/src/tools/code-interpreter/integrations/vercel-ai/file-operations-tool.js +2 -2
  110. package/dist/src/tools/code-interpreter/integrations/vercel-ai/index.d.ts +1 -1
  111. package/dist/src/tools/code-interpreter/integrations/vercel-ai/index.js +1 -1
  112. package/dist/src/tools/code-interpreter/integrations/vercel-ai/tools.d.ts +1 -1
  113. package/dist/src/tools/code-interpreter/integrations/vercel-ai/tools.js +1 -1
  114. package/package.json +46 -11
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Type definitions for AgentCore Identity SDK
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/identity/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Higher-order functions for wrapping tools with automatic credential injection
3
+ */
4
+ import type { OAuth2WrapperConfig, ApiKeyWrapperConfig } from './types.js';
5
+ /**
6
+ * Helper type to extract all parameters except the last one (the token/apiKey)
7
+ */
8
+ type InitParams<T extends unknown[]> = T extends [...infer Init, unknown] ? Init : never;
9
+ /**
10
+ * Wraps an async function to automatically inject OAuth2 access token.
11
+ * The token is injected as the last parameter of the wrapped function.
12
+ *
13
+ * @param config - OAuth2 configuration
14
+ * @returns Function wrapper that injects token as last parameter
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * const myTool = withAccessToken({
19
+ * workloadIdentityToken: token,
20
+ * providerName: 'github',
21
+ * scopes: ['repo'],
22
+ * authFlow: 'M2M'
23
+ * })(async (input: string, token: string) => {
24
+ * // Use token to call GitHub API
25
+ * return { result: input };
26
+ * });
27
+ *
28
+ * await myTool('hello'); // token injected automatically
29
+ * ```
30
+ */
31
+ export declare function withAccessToken(config: OAuth2WrapperConfig): <TParams extends [...unknown[], string], TReturn>(fn: (...args: TParams) => Promise<TReturn>) => ((...args: InitParams<TParams>) => Promise<TReturn>);
32
+ /**
33
+ * Wraps an async function to automatically inject API key.
34
+ * The API key is injected as the last parameter of the wrapped function.
35
+ *
36
+ * @param config - API key configuration
37
+ * @returns Function wrapper that injects API key as last parameter
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * const myTool = withApiKey({
42
+ * workloadIdentityToken: token,
43
+ * providerName: 'openai'
44
+ * })(async (input: string, apiKey: string) => {
45
+ * // Use API key to call OpenAI API
46
+ * return { result: input };
47
+ * });
48
+ *
49
+ * await myTool('hello'); // apiKey injected automatically
50
+ * ```
51
+ */
52
+ export declare function withApiKey(config: ApiKeyWrapperConfig): <TParams extends [...unknown[], string], TReturn>(fn: (...args: TParams) => Promise<TReturn>) => ((...args: InitParams<TParams>) => Promise<TReturn>);
53
+ export {};
54
+ //# sourceMappingURL=wrappers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrappers.d.ts","sourceRoot":"","sources":["../../../src/identity/wrappers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAG1E;;GAEG;AACH,KAAK,UAAU,CAAC,CAAC,SAAS,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,MAAM,IAAI,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,KAAK,CAAA;AAExF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,mBAAmB,IAGjD,OAAO,SAAS,CAAC,GAAG,OAAO,EAAE,EAAE,MAAM,CAAC,EAAE,OAAO,EACrD,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,KACzC,CAAC,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC,CA6BxD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,mBAAmB,IAG5C,OAAO,SAAS,CAAC,GAAG,OAAO,EAAE,EAAE,MAAM,CAAC,EAAE,OAAO,EACrD,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,KACzC,CAAC,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC,CAsBxD"}
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Higher-order functions for wrapping tools with automatic credential injection
3
+ */
4
+ import { IdentityClient } from './client.js';
5
+ import { getContext } from '../runtime/context.js';
6
+ /**
7
+ * Wraps an async function to automatically inject OAuth2 access token.
8
+ * The token is injected as the last parameter of the wrapped function.
9
+ *
10
+ * @param config - OAuth2 configuration
11
+ * @returns Function wrapper that injects token as last parameter
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * const myTool = withAccessToken({
16
+ * workloadIdentityToken: token,
17
+ * providerName: 'github',
18
+ * scopes: ['repo'],
19
+ * authFlow: 'M2M'
20
+ * })(async (input: string, token: string) => {
21
+ * // Use token to call GitHub API
22
+ * return { result: input };
23
+ * });
24
+ *
25
+ * await myTool('hello'); // token injected automatically
26
+ * ```
27
+ */
28
+ export function withAccessToken(config) {
29
+ const client = new IdentityClient();
30
+ return (fn) => {
31
+ return async (...args) => {
32
+ // Get context and fallback to it if config doesn't provide token
33
+ const context = getContext();
34
+ const workloadToken = config.workloadIdentityToken ?? context?.workloadAccessToken;
35
+ if (!workloadToken) {
36
+ throw new Error('workloadIdentityToken not provided and no context available. ' +
37
+ 'Either pass workloadIdentityToken in config or call from within a request handler.');
38
+ }
39
+ const token = await client.getOAuth2Token({
40
+ providerName: config.providerName,
41
+ scopes: config.scopes,
42
+ authFlow: config.authFlow,
43
+ workloadIdentityToken: workloadToken,
44
+ onAuthUrl: config.onAuthUrl,
45
+ forceAuthentication: config.forceAuthentication,
46
+ callbackUrl: config.callbackUrl ?? context?.oauth2CallbackUrl,
47
+ customState: config.customState,
48
+ customParameters: config.customParameters,
49
+ });
50
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
51
+ return fn(...[...args, token]);
52
+ };
53
+ };
54
+ }
55
+ /**
56
+ * Wraps an async function to automatically inject API key.
57
+ * The API key is injected as the last parameter of the wrapped function.
58
+ *
59
+ * @param config - API key configuration
60
+ * @returns Function wrapper that injects API key as last parameter
61
+ *
62
+ * @example
63
+ * ```typescript
64
+ * const myTool = withApiKey({
65
+ * workloadIdentityToken: token,
66
+ * providerName: 'openai'
67
+ * })(async (input: string, apiKey: string) => {
68
+ * // Use API key to call OpenAI API
69
+ * return { result: input };
70
+ * });
71
+ *
72
+ * await myTool('hello'); // apiKey injected automatically
73
+ * ```
74
+ */
75
+ export function withApiKey(config) {
76
+ const client = new IdentityClient();
77
+ return (fn) => {
78
+ return async (...args) => {
79
+ // Get context and fallback to it if config doesn't provide token
80
+ const context = getContext();
81
+ const workloadToken = config.workloadIdentityToken ?? context?.workloadAccessToken;
82
+ if (!workloadToken) {
83
+ throw new Error('workloadIdentityToken not provided and no context available. ' +
84
+ 'Either pass workloadIdentityToken in config or call from within a request handler.');
85
+ }
86
+ const apiKey = await client.getApiKey({
87
+ providerName: config.providerName,
88
+ workloadIdentityToken: workloadToken,
89
+ });
90
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
91
+ return fn(...[...args, apiKey]);
92
+ };
93
+ };
94
+ }
95
+ //# sourceMappingURL=wrappers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrappers.js","sourceRoot":"","sources":["../../../src/identity/wrappers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAOlD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,eAAe,CAAC,MAA2B;IACzD,MAAM,MAAM,GAAG,IAAI,cAAc,EAAE,CAAA;IAEnC,OAAO,CACL,EAA0C,EACY,EAAE;QACxD,OAAO,KAAK,EAAE,GAAG,IAAyB,EAAoB,EAAE;YAC9D,iEAAiE;YACjE,MAAM,OAAO,GAAG,UAAU,EAAE,CAAA;YAC5B,MAAM,aAAa,GAAG,MAAM,CAAC,qBAAqB,IAAI,OAAO,EAAE,mBAAmB,CAAA;YAElF,IAAI,CAAC,aAAa,EAAE,CAAC;gBACnB,MAAM,IAAI,KAAK,CACb,+DAA+D;oBAC7D,oFAAoF,CACvF,CAAA;YACH,CAAC;YAED,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC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,CAAC,CAAA;IACH,CAAC,CAAA;AACH,CAAC"}
@@ -0,0 +1,144 @@
1
+ import { z } from 'zod';
2
+ import type { BedrockAgentCoreAppParams, AsyncTaskStatus, HealthStatus } from './types.js';
3
+ /**
4
+ * Fastify-based HTTP server for hosting agents on AWS Bedrock AgentCore Runtime.
5
+ *
6
+ * This class provides an HTTP server that implements the AgentCore Runtime protocol
7
+ * with health check and invocation endpoints. The server runs on port 8080 and
8
+ * handles both JSON responses and Server-Sent Events (SSE) streaming.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * const app = new BedrockAgentCoreApp({
13
+ * invocationHandler: {
14
+ * requestSchema: z.object({ message: z.string() }),
15
+ * process: async (request, context) => {
16
+ * console.log(`Processing request with session ${context.sessionId}`)
17
+ * return `Hello ${request.message}!`
18
+ * }
19
+ * }
20
+ * })
21
+ *
22
+ * app.run()
23
+ * ```
24
+ */
25
+ export declare class BedrockAgentCoreApp<TSchema extends z.ZodSchema = z.ZodSchema<unknown>> {
26
+ private readonly _app;
27
+ private readonly _config;
28
+ private readonly _handler;
29
+ private _websocketHandler;
30
+ private readonly _activeTasksMap;
31
+ private _taskCounter;
32
+ private _pingHandler;
33
+ private _forcedPingStatus?;
34
+ private _lastStatusUpdateTime;
35
+ private _lastKnownStatus?;
36
+ /**
37
+ * Creates a new BedrockAgentCoreApp instance.
38
+ *
39
+ * @param params - Configuration including handler and optional settings
40
+ */
41
+ constructor(params: BedrockAgentCoreAppParams<TSchema>);
42
+ /**
43
+ * Starts the Fastify server on port 8080.
44
+ */
45
+ run(): void;
46
+ /**
47
+ * Register an async task for health tracking.
48
+ *
49
+ * @param name - Human-readable task name
50
+ * @param metadata - Optional task metadata
51
+ * @returns Task ID for completion tracking
52
+ */
53
+ addAsyncTask(name: string, metadata?: Record<string, unknown>): number;
54
+ /**
55
+ * Mark an async task as complete.
56
+ *
57
+ * @param taskId - Task ID from addAsyncTask
58
+ * @returns True if task was found and removed
59
+ */
60
+ completeAsyncTask(taskId: number): boolean;
61
+ /**
62
+ * Get current ping status based on priority system.
63
+ * Priority: Forced \> Custom Handler \> Automatic
64
+ *
65
+ * @returns Current health status
66
+ */
67
+ getCurrentPingStatus(): HealthStatus;
68
+ /**
69
+ * Decorator to automatically track async tasks.
70
+ * Status becomes HealthyBusy during execution.
71
+ *
72
+ * @param fn - Async function to wrap
73
+ * @returns Wrapped function with automatic task tracking
74
+ * @throws Error if fn is not an async function
75
+ */
76
+ asyncTask<T extends (...args: unknown[]) => Promise<unknown>>(fn: T): T;
77
+ /**
78
+ * Get information about currently running async tasks.
79
+ *
80
+ * @returns Task status with count and details
81
+ */
82
+ getAsyncTaskInfo(): AsyncTaskStatus;
83
+ /**
84
+ * Sets up HTTP routes for the server.
85
+ */
86
+ private _setupRoutes;
87
+ /**
88
+ * Register custom content type parsers using Fastify's native addContentTypeParser.
89
+ */
90
+ private _setupContentTypeParsers;
91
+ /**
92
+ * Registers Fastify plugins.
93
+ */
94
+ private _registerPlugins;
95
+ /**
96
+ * Gets the logger configuration based on BedrockAgentCoreAppConfig.
97
+ *
98
+ * @returns Fastify logger configuration
99
+ */
100
+ private _getLoggerConfig;
101
+ /**
102
+ * Handles health check requests.
103
+ *
104
+ * @param request - Fastify request object
105
+ * @param reply - Fastify reply object
106
+ */
107
+ private _handlePing;
108
+ /**
109
+ * Handles agent invocation requests.
110
+ *
111
+ * @param request - Fastify request object
112
+ * @param reply - Fastify reply object
113
+ */
114
+ private _handleInvocation;
115
+ /**
116
+ * Checks if a value is an async generator.
117
+ *
118
+ * @param value - Value to check
119
+ * @returns True if the value is an async generator
120
+ */
121
+ private _isAsyncGenerator;
122
+ /**
123
+ * Handles streaming response using Server-Sent Events (SSE) via Fastify SSE plugin.
124
+ *
125
+ * @param reply - Fastify reply object
126
+ * @param generator - Async generator that yields data chunks
127
+ */
128
+ private _handleStreamingResponse;
129
+ /**
130
+ * Handles WebSocket connections at /ws endpoint.
131
+ *
132
+ * @param connection - Fastify WebSocket connection
133
+ * @param request - Fastify request object
134
+ */
135
+ private _handleWebSocket;
136
+ /**
137
+ * Extracts request context from the incoming request.
138
+ *
139
+ * @param request - Fastify request object
140
+ * @returns Request context with sessionId, headers, and request-scoped logger
141
+ */
142
+ private _extractContext;
143
+ }
144
+ //# sourceMappingURL=app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/runtime/app.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAYvB,OAAO,KAAK,EACV,yBAAyB,EAOzB,eAAe,EACf,YAAY,EACb,MAAM,YAAY,CAAA;AAOnB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,mBAAmB,CAAC,OAAO,SAAS,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC;IACjF,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAiB;IACtC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA2B;IACnD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA2E;IACpG,OAAO,CAAC,iBAAiB,CAA8B;IACvD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAwC;IACxE,OAAO,CAAC,YAAY,CAAY;IAChC,OAAO,CAAC,YAAY,CAA0D;IAC9E,OAAO,CAAC,iBAAiB,CAAC,CAAc;IACxC,OAAO,CAAC,qBAAqB,CAAqB;IAClD,OAAO,CAAC,gBAAgB,CAAC,CAAc;IAEvC;;;;OAIG;gBACS,MAAM,EAAE,yBAAyB,CAAC,OAAO,CAAC;IA0BtD;;OAEG;IACH,GAAG,IAAI,IAAI;IAmBX;;;;;;OAMG;IACI,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;IAa7E;;;;;OAKG;IACI,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAIjD;;;;;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