@frontmcp/sdk 1.8.7 → 1.9.1-rc.1
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.
- package/adapter/adapter.instance.d.ts +4 -0
- package/adapter/adapter.instance.d.ts.map +1 -1
- package/adapter/adapter.registry.d.ts +2 -0
- package/adapter/adapter.registry.d.ts.map +1 -1
- package/adapter/adapter.utils.d.ts.map +1 -1
- package/agent/agent-call-chain.d.ts +21 -0
- package/agent/agent-call-chain.d.ts.map +1 -0
- package/agent/agent.instance.d.ts +70 -15
- package/agent/agent.instance.d.ts.map +1 -1
- package/agent/agent.registry.d.ts +4 -2
- package/agent/agent.registry.d.ts.map +1 -1
- package/agent/agent.scope.d.ts +18 -1
- package/agent/agent.scope.d.ts.map +1 -1
- package/agent/agent.utils.d.ts +11 -7
- package/agent/agent.utils.d.ts.map +1 -1
- package/agent/flows/call-agent.flow.d.ts +9 -1
- package/agent/flows/call-agent.flow.d.ts.map +1 -1
- package/agent/hooks/agent.hooks.d.ts +4 -4
- package/agent/hooks/agent.hooks.d.ts.map +1 -1
- package/app/instances/app.local.instance.d.ts.map +1 -1
- package/app/instances/app.remote.instance.d.ts +1 -0
- package/app/instances/app.remote.instance.d.ts.map +1 -1
- package/auth/session/session-store.factory.d.ts +1 -1
- package/auth/session/session-store.factory.d.ts.map +1 -1
- package/auth/session/utils/session-id.utils.d.ts +5 -0
- package/auth/session/utils/session-id.utils.d.ts.map +1 -1
- package/browser/index.cjs +72709 -0
- package/browser/index.mjs +72075 -0
- package/channel/channel-notification.service.d.ts +24 -5
- package/channel/channel-notification.service.d.ts.map +1 -1
- package/channel/channel-scope.helper.d.ts +2 -0
- package/channel/channel-scope.helper.d.ts.map +1 -1
- package/channel/channel.instance.d.ts +7 -2
- package/channel/channel.instance.d.ts.map +1 -1
- package/channel/flows/list-channels.flow.d.ts.map +1 -1
- package/channel/flows/send-channel-notification.flow.d.ts +14 -1
- package/channel/flows/send-channel-notification.flow.d.ts.map +1 -1
- package/channel/reply/channel-reply.tool.d.ts.map +1 -1
- package/common/availability/availability.utils.d.ts +4 -3
- package/common/availability/availability.utils.d.ts.map +1 -1
- package/common/dynamic/dynamic.adapter.d.ts +13 -7
- package/common/dynamic/dynamic.adapter.d.ts.map +1 -1
- package/common/dynamic/dynamic.plugin.d.ts +9 -4
- package/common/dynamic/dynamic.plugin.d.ts.map +1 -1
- package/common/dynamic/dynamic.utils.d.ts +7 -1
- package/common/dynamic/dynamic.utils.d.ts.map +1 -1
- package/common/entries/channel.entry.d.ts +1 -1
- package/common/entries/channel.entry.d.ts.map +1 -1
- package/common/entries/scope.entry.d.ts +26 -0
- package/common/entries/scope.entry.d.ts.map +1 -1
- package/common/interfaces/agent.interface.d.ts +19 -3
- package/common/interfaces/agent.interface.d.ts.map +1 -1
- package/common/interfaces/execution-context.interface.d.ts +10 -4
- package/common/interfaces/execution-context.interface.d.ts.map +1 -1
- package/common/interfaces/prompt.interface.d.ts +12 -0
- package/common/interfaces/prompt.interface.d.ts.map +1 -1
- package/common/metadata/agent.metadata.d.ts +36 -19
- package/common/metadata/agent.metadata.d.ts.map +1 -1
- package/common/metadata/app.metadata.d.ts +26 -1
- package/common/metadata/app.metadata.d.ts.map +1 -1
- package/common/metadata/channel.metadata.d.ts +1 -0
- package/common/metadata/channel.metadata.d.ts.map +1 -1
- package/common/metadata/front-mcp.metadata.d.ts +1265 -81
- package/common/metadata/front-mcp.metadata.d.ts.map +1 -1
- package/common/metadata/hook.metadata.d.ts +10 -0
- package/common/metadata/hook.metadata.d.ts.map +1 -1
- package/common/metadata/job.metadata.d.ts +1 -1
- package/common/metadata/output-policy.d.ts +1 -1
- package/common/metadata/prompt.metadata.d.ts +1 -0
- package/common/metadata/prompt.metadata.d.ts.map +1 -1
- package/common/metadata/resource.metadata.d.ts +2 -0
- package/common/metadata/resource.metadata.d.ts.map +1 -1
- package/common/metadata/skill.metadata.d.ts +20 -3
- package/common/metadata/skill.metadata.d.ts.map +1 -1
- package/common/metadata/tool.metadata.d.ts +2 -1
- package/common/metadata/tool.metadata.d.ts.map +1 -1
- package/common/metadata/workflow.metadata.d.ts +2 -2
- package/common/records/agent.record.d.ts +5 -1
- package/common/records/agent.record.d.ts.map +1 -1
- package/common/schemas/http-output.schema.d.ts +4 -4
- package/common/tokens/front-mcp.tokens.d.ts.map +1 -1
- package/common/tokens/server.tokens.d.ts +1 -0
- package/common/tokens/server.tokens.d.ts.map +1 -1
- package/common/types/options/elicitation/schema.d.ts +19 -0
- package/common/types/options/elicitation/schema.d.ts.map +1 -1
- package/common/types/options/http/schema.d.ts.map +1 -1
- package/common/types/options/redis/index.d.ts +3 -3
- package/common/types/options/redis/index.d.ts.map +1 -1
- package/common/types/options/redis/interfaces.d.ts +19 -2
- package/common/types/options/redis/interfaces.d.ts.map +1 -1
- package/common/types/options/redis/schema.d.ts +84 -0
- package/common/types/options/redis/schema.d.ts.map +1 -1
- package/common/types/options/session/interfaces.d.ts +4 -2
- package/common/types/options/session/interfaces.d.ts.map +1 -1
- package/common/types/options/skills-http/schema.d.ts +8 -8
- package/common/types/options/sqlite/interfaces.d.ts +8 -0
- package/common/types/options/sqlite/interfaces.d.ts.map +1 -1
- package/common/types/options/sqlite/resolve.d.ts.map +1 -1
- package/common/types/options/sqlite/schema.d.ts +1 -0
- package/common/types/options/sqlite/schema.d.ts.map +1 -1
- package/common/types/options/transport/interfaces.d.ts +3 -9
- package/common/types/options/transport/interfaces.d.ts.map +1 -1
- package/common/types/options/transport/schema.d.ts +78 -0
- package/common/types/options/transport/schema.d.ts.map +1 -1
- package/common/utils/path.utils.d.ts.map +1 -1
- package/context/call-surface.d.ts +3 -2
- package/context/call-surface.d.ts.map +1 -1
- package/context/frontmcp-context-storage.d.ts +7 -0
- package/context/frontmcp-context-storage.d.ts.map +1 -1
- package/direct/create.d.ts.map +1 -1
- package/direct/direct-server.d.ts +11 -5
- package/direct/direct-server.d.ts.map +1 -1
- package/direct/direct.types.d.ts +100 -14
- package/direct/direct.types.d.ts.map +1 -1
- package/direct/index.d.ts +1 -1
- package/direct/index.d.ts.map +1 -1
- package/direct/runtime-tools.d.ts +16 -0
- package/direct/runtime-tools.d.ts.map +1 -0
- package/errors/agent.errors.d.ts +13 -1
- package/errors/agent.errors.d.ts.map +1 -1
- package/errors/error-handler.d.ts.map +1 -1
- package/errors/index.d.ts +3 -3
- package/errors/index.d.ts.map +1 -1
- package/errors/mcp.error.d.ts +3 -0
- package/errors/mcp.error.d.ts.map +1 -1
- package/errors/registry.errors.d.ts +13 -0
- package/errors/registry.errors.d.ts.map +1 -1
- package/errors/transport.errors.d.ts +17 -0
- package/errors/transport.errors.d.ts.map +1 -1
- package/esm/index.mjs +14590 -11878
- package/ext-apps/ext-apps.handler.d.ts +1 -1
- package/ext-apps/ext-apps.handler.d.ts.map +1 -1
- package/flows/flow.instance.d.ts.map +1 -1
- package/front-mcp/front-mcp.d.ts +8 -0
- package/front-mcp/front-mcp.d.ts.map +1 -1
- package/front-mcp/front-mcp.providers.d.ts.map +1 -1
- package/front-mcp/static-startup.check.d.ts.map +1 -1
- package/ha/ha-config.d.ts +21 -0
- package/ha/ha-config.d.ts.map +1 -0
- package/ha/ha-headers.d.ts +18 -2
- package/ha/ha-headers.d.ts.map +1 -1
- package/ha/ha-manager.d.ts +24 -2
- package/ha/ha-manager.d.ts.map +1 -1
- package/ha/ha.types.d.ts +2 -0
- package/ha/ha.types.d.ts.map +1 -1
- package/ha/heartbeat.service.d.ts +9 -0
- package/ha/heartbeat.service.d.ts.map +1 -1
- package/ha/index.d.ts +3 -1
- package/ha/index.d.ts.map +1 -1
- package/ha/notification-relay.d.ts +15 -18
- package/ha/notification-relay.d.ts.map +1 -1
- package/ha/relay-messages.d.ts +114 -0
- package/ha/relay-messages.d.ts.map +1 -0
- package/ha/session-takeover.d.ts.map +1 -1
- package/hooks/entry-class-hooks.d.ts +27 -0
- package/hooks/entry-class-hooks.d.ts.map +1 -0
- package/hooks/hook.registry.d.ts +11 -0
- package/hooks/hook.registry.d.ts.map +1 -1
- package/hooks/hooks.utils.d.ts +19 -5
- package/hooks/hooks.utils.d.ts.map +1 -1
- package/index.d.ts +31 -13
- package/index.d.ts.map +1 -1
- package/index.js +15521 -12803
- package/job/execution/job-execution.manager.d.ts.map +1 -1
- package/job/job.instance.d.ts.map +1 -1
- package/job/job.registry.d.ts.map +1 -1
- package/metrics/index.d.ts +1 -1
- package/metrics/index.d.ts.map +1 -1
- package/metrics/metrics.routes.d.ts +23 -0
- package/metrics/metrics.routes.d.ts.map +1 -1
- package/notification/index.d.ts +1 -1
- package/notification/index.d.ts.map +1 -1
- package/notification/notification.service.d.ts +24 -0
- package/notification/notification.service.d.ts.map +1 -1
- package/package.json +17 -11
- package/plugin/plugin.registry.d.ts +5 -1
- package/plugin/plugin.registry.d.ts.map +1 -1
- package/prompt/flows/get-prompt.flow.d.ts +3 -0
- package/prompt/flows/get-prompt.flow.d.ts.map +1 -1
- package/prompt/prompt.instance.d.ts.map +1 -1
- package/prompt/prompt.registry.d.ts +19 -1
- package/prompt/prompt.registry.d.ts.map +1 -1
- package/provider/provider.registry.d.ts +33 -3
- package/provider/provider.registry.d.ts.map +1 -1
- package/resource/flows/read-resource.flow.d.ts +3 -0
- package/resource/flows/read-resource.flow.d.ts.map +1 -1
- package/resource/resource.instance.d.ts.map +1 -1
- package/resource/resource.registry.d.ts +19 -1
- package/resource/resource.registry.d.ts.map +1 -1
- package/scope/flows/http.request.flow.d.ts +12 -1
- package/scope/flows/http.request.flow.d.ts.map +1 -1
- package/scope/scope.instance.d.ts +12 -1
- package/scope/scope.instance.d.ts.map +1 -1
- package/scope/server-entries.helper.d.ts +8 -0
- package/scope/server-entries.helper.d.ts.map +1 -0
- package/server/adapters/express.host.adapter.d.ts.map +1 -1
- package/server/middleware/cors-env.d.ts +17 -0
- package/server/middleware/cors-env.d.ts.map +1 -0
- package/server/security/security-audit.d.ts +2 -0
- package/server/security/security-audit.d.ts.map +1 -1
- package/server/server.instance.d.ts.map +1 -1
- package/skill/auth/skill-http-auth.d.ts.map +1 -1
- package/skill/cache/skill-http-cache.holder.d.ts.map +1 -1
- package/skill/errors/skill-validation.error.d.ts +2 -2
- package/skill/errors/skill-validation.error.d.ts.map +1 -1
- package/skill/providers/memory-skill.provider.d.ts +22 -15
- package/skill/providers/memory-skill.provider.d.ts.map +1 -1
- package/skill/skill.registry.d.ts +8 -6
- package/skill/skill.registry.d.ts.map +1 -1
- package/task/store/task-store.factory.d.ts +1 -0
- package/task/store/task-store.factory.d.ts.map +1 -1
- package/task/task.types.d.ts +2 -0
- package/task/task.types.d.ts.map +1 -1
- package/tool/flows/call-tool.flow.d.ts +3 -0
- package/tool/flows/call-tool.flow.d.ts.map +1 -1
- package/tool/flows/tools-list.flow.d.ts.map +1 -1
- package/tool/tool.instance.d.ts.map +1 -1
- package/tool/tool.registry.d.ts +10 -1
- package/tool/tool.registry.d.ts.map +1 -1
- package/tool/ui/ui-option-warnings.d.ts.map +1 -1
- package/tool/ui/ui-shared.d.ts.map +1 -1
- package/transport/adapters/sse-transport.d.ts +1 -1
- package/transport/adapters/sse-transport.d.ts.map +1 -1
- package/transport/bus/redis-transport-bus.d.ts +28 -21
- package/transport/bus/redis-transport-bus.d.ts.map +1 -1
- package/transport/event-stores/event-store.factory.d.ts.map +1 -1
- package/transport/flow-error-output.d.ts +8 -0
- package/transport/flow-error-output.d.ts.map +1 -0
- package/transport/flows/handle.mcp-20260728.flow.d.ts.map +1 -1
- package/transport/flows/handle.sse.flow.d.ts.map +1 -1
- package/transport/flows/handle.streamable-http.flow.d.ts.map +1 -1
- package/transport/in-memory-server.d.ts.map +1 -1
- package/transport/mcp-handlers/initialize-request.handler.d.ts.map +1 -1
- package/transport/relay/index.d.ts +5 -0
- package/transport/relay/index.d.ts.map +1 -0
- package/transport/relay/relay-flow.d.ts +17 -0
- package/transport/relay/relay-flow.d.ts.map +1 -0
- package/transport/relay/relay-http.d.ts +109 -0
- package/transport/relay/relay-http.d.ts.map +1 -0
- package/transport/relay/relay-scope.helper.d.ts +46 -0
- package/transport/relay/relay-scope.helper.d.ts.map +1 -0
- package/transport/relay/session-relay.d.ts +105 -0
- package/transport/relay/session-relay.d.ts.map +1 -0
- package/transport/session-mode.check.d.ts +18 -0
- package/transport/session-mode.check.d.ts.map +1 -0
- package/transport/transport.registry.d.ts +61 -2
- package/transport/transport.registry.d.ts.map +1 -1
- package/transport/transport.remote.d.ts +16 -5
- package/transport/transport.remote.d.ts.map +1 -1
- package/transport/transport.types.d.ts +20 -11
- package/transport/transport.types.d.ts.map +1 -1
- package/transport/web-fetch-handler.d.ts +11 -0
- package/transport/web-fetch-handler.d.ts.map +1 -1
- package/transport/web-standard-mcp.d.ts.map +1 -1
- package/utils/dynamic-import.utils.d.ts +20 -0
- package/utils/dynamic-import.utils.d.ts.map +1 -0
- package/utils/lineage.utils.d.ts +7 -0
- package/utils/lineage.utils.d.ts.map +1 -1
- package/workflow/engine/workflow-step.executor.d.ts.map +1 -1
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
*/
|
|
10
10
|
import type { FrontMcpLogger } from '../common';
|
|
11
|
-
import type
|
|
11
|
+
import { type ExtAppsHostCapabilities, type ExtAppsJsonRpcRequest, type ExtAppsJsonRpcResponse } from './ext-apps.types';
|
|
12
12
|
/**
|
|
13
13
|
* Context for handling ext-apps messages.
|
|
14
14
|
* Provides access to scope services for routing requests.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ext-apps.handler.d.ts","sourceRoot":"","sources":["../../src/ext-apps/ext-apps.handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"ext-apps.handler.d.ts","sourceRoot":"","sources":["../../src/ext-apps/ext-apps.handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAIL,KAAK,uBAAuB,EAG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":["../../src/flows/flow.instance.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAEL,SAAS,EAGT,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,YAAY,EAEjB,KAAK,UAAU,EAMf,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,KAAK,EACV,KAAK,IAAI,EACV,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"flow.instance.d.ts","sourceRoot":"","sources":["../../src/flows/flow.instance.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAEL,SAAS,EAGT,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,YAAY,EAEjB,KAAK,UAAU,EAMf,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,KAAK,EACV,KAAK,IAAI,EACV,MAAM,WAAW,CAAC;AAMnB,OAAO,KAAK,gBAAgB,MAAM,+BAA+B,CAAC;AA4BlE,qBAAa,YAAY,CAAC,IAAI,SAAS,QAAQ,CAAE,SAAQ,SAAS,CAAC,IAAI,CAAC;IACtE,QAAQ,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC;IAC3B,QAAQ,CAAC,eAAe,EAAE,gBAAgB,CAAC;IAC3C,OAAO,CAAC,IAAI,CAAkB;IAC9B,OAAO,CAAC,SAAS,CAAW;IAC5B,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiB;gBAE5B,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,CAAC,SAAS,CAAC,EAAE,eAAe,EAAE,gBAAgB;cAW1F,UAAU;IA8FpB,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC;IAa3D;;;;;;;;;;;;OAYG;IACG,SAAS,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC;IAyBzD;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IASzB;;;;;;;;;OASG;YACW,cAAc;IAoBtB,GAAG,CAAC,KAAK,EAAE,WAAW,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;CAoUrG"}
|
package/front-mcp/front-mcp.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ export declare class FrontMcpInstance implements FrontMcpInterface {
|
|
|
18
18
|
constructor(config: FrontMcpConfigType);
|
|
19
19
|
initialize(): Promise<void>;
|
|
20
20
|
start(): Promise<void>;
|
|
21
|
+
/** Where this server serves MCP, as reported to the `frontmcp dev --stdio` bridge. */
|
|
22
|
+
private devListenerInfo;
|
|
21
23
|
/**
|
|
22
24
|
* Get the configuration used to create this FrontMCP instance.
|
|
23
25
|
*/
|
|
@@ -47,6 +49,12 @@ export declare class FrontMcpInstance implements FrontMcpInterface {
|
|
|
47
49
|
* stats are process-global.
|
|
48
50
|
*/
|
|
49
51
|
private wireMetricsService;
|
|
52
|
+
/**
|
|
53
|
+
* The `/metrics` service when `metrics.enabled: true`, `undefined` otherwise.
|
|
54
|
+
* Shared by the Express host (`wireMetricsService`) and `createFetchHandler()`,
|
|
55
|
+
* so both transports serve the endpoint from the same config.
|
|
56
|
+
*/
|
|
57
|
+
private createMetricsService;
|
|
50
58
|
static bootstrap(options: FrontMcpConfigInput | FrontMcpConfigType): Promise<void>;
|
|
51
59
|
/**
|
|
52
60
|
* Creates and initializes a FrontMCP instance without starting the HTTP server.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"front-mcp.d.ts","sourceRoot":"","sources":["../../src/front-mcp/front-mcp.ts"],"names":[],"mappings":"AAEA,OAAO,EAML,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACv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ts","sourceRoot":"","sources":["../../src/front-mcp/front-mcp.providers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"front-mcp.providers.d.ts","sourceRoot":"","sources":["../../src/front-mcp/front-mcp.providers.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,KAAK,kBAAkB,EACvB,KAAK,YAAY,EAElB,MAAM,WAAW,CAAC;AAyCnB,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,YAAY,EAAE,CAKrF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"static-startup.check.d.ts","sourceRoot":"","sources":["../../src/front-mcp/static-startup.check.ts"],"names":[],"mappings":"AA+BA,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EAGxB,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"static-startup.check.d.ts","sourceRoot":"","sources":["../../src/front-mcp/static-startup.check.ts"],"names":[],"mappings":"AA+BA,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EAGxB,MAAM,WAAW,CAAC;AA+LnB;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,mBAAmB,GAAG,kBAAkB,GAAG,IAAI,CA6BhG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HA configuration from the environment.
|
|
3
|
+
*
|
|
4
|
+
* `frontmcp build --target distributed` writes the `ha` block of the
|
|
5
|
+
* deployment in `frontmcp.config` to these variables in the generated setup
|
|
6
|
+
* file; they can also be set directly on the pod.
|
|
7
|
+
*/
|
|
8
|
+
import type { HaConfig } from './ha.types';
|
|
9
|
+
/** Environment variables read by {@link resolveHaConfigFromEnv}. */
|
|
10
|
+
export declare const HA_ENV: {
|
|
11
|
+
readonly heartbeatIntervalMs: "FRONTMCP_HA_HEARTBEAT_INTERVAL_MS";
|
|
12
|
+
readonly heartbeatTtlMs: "FRONTMCP_HA_HEARTBEAT_TTL_MS";
|
|
13
|
+
readonly takeoverGracePeriodMs: "FRONTMCP_HA_TAKEOVER_GRACE_MS";
|
|
14
|
+
readonly redisKeyPrefix: "FRONTMCP_HA_KEY_PREFIX";
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* HA overrides set in the environment. Missing or invalid values are left out,
|
|
18
|
+
* so the defaults apply to them.
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolveHaConfigFromEnv(): Partial<HaConfig>;
|
|
21
|
+
//# sourceMappingURL=ha-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ha-config.d.ts","sourceRoot":"","sources":["../../src/ha/ha-config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,oEAAoE;AACpE,eAAO,MAAM,MAAM;;;;;CAKT,CAAC;AASX;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAAC,QAAQ,CAAC,CAW1D"}
|
package/ha/ha-headers.d.ts
CHANGED
|
@@ -1,15 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Load-balancer affinity headers for distributed deployments.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* `X-FrontMCP-Machine-Id` goes on every response a distributed instance sends — the host
|
|
5
|
+
* adapters (Express, web-fetch) add it where their security headers are added, so MCP responses
|
|
6
|
+
* of every protocol revision, health probes, metrics and 404s all carry it. The session flows'
|
|
7
|
+
* hookable `applyNodeHeaders` stage sets it as well, and adds the affinity cookie.
|
|
5
8
|
*/
|
|
6
9
|
import { buildSetCookie } from '@frontmcp/utils';
|
|
7
10
|
interface HeaderResponse {
|
|
8
11
|
setHeader(name: string, value: string | string[]): unknown;
|
|
9
12
|
getHeader(name: string): unknown;
|
|
10
13
|
}
|
|
14
|
+
/** The `X-FrontMCP-Machine-Id` header for this instance, or `undefined` outside distributed deployments. */
|
|
15
|
+
export declare function machineIdHeader(): readonly [name: string, value: string] | undefined;
|
|
11
16
|
/** Set `X-FrontMCP-Machine-Id` on the response. No-op outside distributed deployments. */
|
|
12
|
-
export declare function applyMachineIdHeader(response: HeaderResponse): boolean;
|
|
17
|
+
export declare function applyMachineIdHeader(response: Pick<HeaderResponse, 'setHeader'>): boolean;
|
|
18
|
+
type SameSite = 'Strict' | 'Lax' | 'None';
|
|
19
|
+
/**
|
|
20
|
+
* The affinity cookie's name and attributes. `frontmcp build` turns a deployment's
|
|
21
|
+
* `server.cookies` block (`affinity`, `domain`, `sameSite`) into these variables:
|
|
22
|
+
* FRONTMCP_AFFINITY_COOKIE, FRONTMCP_AFFINITY_COOKIE_DOMAIN, FRONTMCP_AFFINITY_COOKIE_SAMESITE.
|
|
23
|
+
*/
|
|
24
|
+
export declare function affinityCookieOptions(): {
|
|
25
|
+
name: string;
|
|
26
|
+
domain?: string;
|
|
27
|
+
sameSite?: SameSite;
|
|
28
|
+
};
|
|
13
29
|
/** Set the machine-id header plus the node affinity cookie. */
|
|
14
30
|
export declare function applyNodeAffinity(response: HeaderResponse, request: Parameters<typeof buildSetCookie>[1]): void;
|
|
15
31
|
export {};
|
package/ha/ha-headers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ha-headers.d.ts","sourceRoot":"","sources":["../../src/ha/ha-headers.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ha-headers.d.ts","sourceRoot":"","sources":["../../src/ha/ha-headers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,cAAc,EAA2C,MAAM,iBAAiB,CAAC;AAI1F,UAAU,cAAc;IACtB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC;IAC3D,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CAClC;AAED,4GAA4G;AAC5G,wBAAgB,eAAe,IAAI,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,GAAG,SAAS,CAGpF;AAED,0FAA0F;AAC1F,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,IAAI,CAAC,cAAc,EAAE,WAAW,CAAC,GAAG,OAAO,CAKzF;AAED,KAAK,QAAQ,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;AAE1C;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,QAAQ,CAAA;CAAE,CAO9F;AAED,+DAA+D;AAC/D,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAO/G"}
|
package/ha/ha-manager.d.ts
CHANGED
|
@@ -8,11 +8,21 @@
|
|
|
8
8
|
import { type HaConfig, type TakeoverResult } from './ha.types';
|
|
9
9
|
import { type HeartbeatRedisClient } from './heartbeat.service';
|
|
10
10
|
import { NotificationRelay, type RelayHandler, type RelayRedisClient } from './notification-relay';
|
|
11
|
+
import type { HaRelayMessage } from './relay-messages';
|
|
11
12
|
import { type TakeoverRedisClient } from './session-takeover';
|
|
13
|
+
/**
|
|
14
|
+
* What the orphan scanner read from a session record it claimed.
|
|
15
|
+
*/
|
|
16
|
+
export interface ClaimedSessionInfo {
|
|
17
|
+
/** Transport protocol of the session (e.g. `streamable-http`). */
|
|
18
|
+
protocol?: string;
|
|
19
|
+
/** Token hash the session is bound to. */
|
|
20
|
+
authorizationId?: string;
|
|
21
|
+
}
|
|
12
22
|
/**
|
|
13
23
|
* Callback invoked when an orphaned session is successfully claimed.
|
|
14
24
|
*/
|
|
15
|
-
export type OrphanHandler = (sessionId: string, previousNodeId: string) => void | Promise<void>;
|
|
25
|
+
export type OrphanHandler = (sessionId: string, previousNodeId: string, session: ClaimedSessionInfo) => void | Promise<void>;
|
|
16
26
|
/**
|
|
17
27
|
* Options for the orphan session scanner.
|
|
18
28
|
*/
|
|
@@ -93,12 +103,24 @@ export declare class HaManager {
|
|
|
93
103
|
attemptTakeover(sessionKey: string, expectedOldNodeId: string): Promise<TakeoverResult>;
|
|
94
104
|
/** Check if a specific node is alive. */
|
|
95
105
|
isNodeAlive(nodeId: string): Promise<boolean>;
|
|
106
|
+
/** This node's liveness generation (see {@link HeartbeatService.livenessGeneration}). */
|
|
107
|
+
livenessGeneration(): number | undefined;
|
|
96
108
|
/** Get all alive node IDs. */
|
|
97
109
|
getAliveNodes(): Promise<string[]>;
|
|
98
110
|
/** Get the notification relay (undefined if pub/sub not configured). */
|
|
99
111
|
getRelay(): NotificationRelay | undefined;
|
|
100
|
-
/** Subscribe to relay
|
|
112
|
+
/** Subscribe to this pod's relay channel (notifications, session destroys, relayed requests). */
|
|
101
113
|
subscribeRelay(handler: RelayHandler): Promise<void>;
|
|
114
|
+
/**
|
|
115
|
+
* Publish a message to another pod's relay channel.
|
|
116
|
+
* @returns How many subscribers received it — 0 when that pod does not listen, or when
|
|
117
|
+
* pub/sub is not configured on this pod.
|
|
118
|
+
*/
|
|
119
|
+
publishToNode(nodeId: string, message: HaRelayMessage): Promise<number>;
|
|
120
|
+
/** The relay channel name of a pod. */
|
|
121
|
+
relayChannelOf(nodeId: string): string;
|
|
122
|
+
/** The effective HA configuration (defaults merged with overrides). */
|
|
123
|
+
getConfig(): Readonly<HaConfig>;
|
|
102
124
|
/** Update the heartbeat with current session count. */
|
|
103
125
|
setSessionCount(count: number): void;
|
|
104
126
|
/** Whether HA services are running. */
|
package/ha/ha-manager.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ha-manager.d.ts","sourceRoot":"","sources":["../../src/ha/ha-manager.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAqB,KA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H,kBAAkB,CAAC,OAAO,EAAE,oBAAoB,GAAG,IAAI;IAoBvD,4BAA4B;IACtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAqB3B;;;;;;OAMG;IACG,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAY7F,yCAAyC;IACnC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAInD,yFAAyF;IACzF,kBAAkB,IAAI,MAAM,GAAG,SAAS;IAIxC,8BAA8B;IACxB,aAAa,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAIxC,wEAAwE;IACxE,QAAQ,IAAI,iBAAiB,GAAG,SAAS;IAIzC,iGAAiG;IAC3F,cAAc,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAM1D;;;;OAIG;IACG,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;IAK7E,uCAAuC;IACvC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAItC,uEAAuE;IACvE,SAAS,IAAI,QAAQ,CAAC,QAAQ,CAAC;IAI/B,uDAAuD;IACvD,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIpC,uCAAuC;IACvC,SAAS,IAAI,OAAO;IAIpB,+CAA+C;IAC/C,SAAS,IAAI,MAAM;IAInB;;;;;;;;OAQG;YACW,aAAa;CAuE5B"}
|
package/ha/ha.types.d.ts
CHANGED
|
@@ -38,5 +38,7 @@ export interface TakeoverResult {
|
|
|
38
38
|
claimed: boolean;
|
|
39
39
|
sessionId: string;
|
|
40
40
|
previousNodeId?: string;
|
|
41
|
+
/** When the session was claimed (epoch ms), as recorded in its `reassignedAt`. */
|
|
42
|
+
reassignedAt?: number;
|
|
41
43
|
}
|
|
42
44
|
//# sourceMappingURL=ha.types.d.ts.map
|
package/ha/ha.types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ha.types.d.ts","sourceRoot":"","sources":["../../src/ha/ha.types.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,iFAAiF;IACjF,mBAAmB,EAAE,MAAM,CAAC;IAC5B,iGAAiG;IACjG,cAAc,EAAE,MAAM,CAAC;IACvB,8FAA8F;IAC9F,qBAAqB,EAAE,MAAM,CAAC;IAC9B,4DAA4D;IAC5D,cAAc,EAAE,MAAM,CAAC;IACvB,yGAAyG;IACzG,kBAAkB,EAAE,MAAM,CAAC;IAC3B,0GAA0G;IAC1G,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,uCAAuC;AACvC,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,QAAQ,CAOhD,CAAC;AAEF,4DAA4D;AAC5D,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,YAAY,GAAG,YAAY,GAAG,SAAS,CAAC;AAErF,uCAAuC;AACvC,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,4CAA4C;AAC5C,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"ha.types.d.ts","sourceRoot":"","sources":["../../src/ha/ha.types.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,iFAAiF;IACjF,mBAAmB,EAAE,MAAM,CAAC;IAC5B,iGAAiG;IACjG,cAAc,EAAE,MAAM,CAAC;IACvB,8FAA8F;IAC9F,qBAAqB,EAAE,MAAM,CAAC;IAC9B,4DAA4D;IAC5D,cAAc,EAAE,MAAM,CAAC;IACvB,yGAAyG;IACzG,kBAAkB,EAAE,MAAM,CAAC;IAC3B,0GAA0G;IAC1G,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,uCAAuC;AACvC,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,QAAQ,CAOhD,CAAC;AAEF,4DAA4D;AAC5D,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,YAAY,GAAG,YAAY,GAAG,SAAS,CAAC;AAErF,uCAAuC;AACvC,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,4CAA4C;AAC5C,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kFAAkF;IAClF,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -25,6 +25,8 @@ export declare class HeartbeatService {
|
|
|
25
25
|
private readonly intervalMs;
|
|
26
26
|
private readonly ttlMs;
|
|
27
27
|
private sessionCount;
|
|
28
|
+
private lastBeatAt;
|
|
29
|
+
private lapses;
|
|
28
30
|
constructor(redis: HeartbeatRedisClient, nodeId: string, config?: Partial<HaConfig>);
|
|
29
31
|
/** Start the heartbeat interval. */
|
|
30
32
|
start(): void;
|
|
@@ -36,9 +38,16 @@ export declare class HeartbeatService {
|
|
|
36
38
|
isAlive(nodeId: string): Promise<boolean>;
|
|
37
39
|
/** Get the heartbeat value for a specific node. */
|
|
38
40
|
getHeartbeat(nodeId: string): Promise<HeartbeatValue | null>;
|
|
41
|
+
/**
|
|
42
|
+
* The span of uninterrupted liveness this node is in: it changes after every gap in which
|
|
43
|
+
* this node's heartbeat may have expired (another node could then take its sessions over),
|
|
44
|
+
* and is `undefined` while the heartbeat may be expired.
|
|
45
|
+
*/
|
|
46
|
+
livenessGeneration(): number | undefined;
|
|
39
47
|
/** Get all alive node IDs by scanning heartbeat keys. */
|
|
40
48
|
getAliveNodes(): Promise<string[]>;
|
|
41
49
|
private heartbeatKey;
|
|
42
50
|
private writeHeartbeat;
|
|
51
|
+
private recordBeat;
|
|
43
52
|
}
|
|
44
53
|
//# sourceMappingURL=heartbeat.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heartbeat.service.d.ts","sourceRoot":"","sources":["../../src/ha/heartbeat.service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAqB,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAEnF;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAClF,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACzC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAClC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACrC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CAC1C;AAED,qBAAa,gBAAgB;
|
|
1
|
+
{"version":3,"file":"heartbeat.service.d.ts","sourceRoot":"","sources":["../../src/ha/heartbeat.service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAqB,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAEnF;;;GAGG;AACH,MAAM,WAAW,oBAA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,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAUlE;;;;OAIG;IACH,kBAAkB,IAAI,MAAM,GAAG,SAAS;IAIxC,yDAAyD;IACnD,aAAa,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAKxC,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,UAAU;CAInB"}
|
package/ha/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export { HaManager, type HaManagerOptions } from './ha-manager';
|
|
1
|
+
export { HaManager, type HaManagerOptions, type ClaimedSessionInfo, type OrphanHandler, type OrphanScannerOptions, } from './ha-manager';
|
|
2
2
|
export { HeartbeatService, type HeartbeatRedisClient } from './heartbeat.service';
|
|
3
3
|
export { attemptSessionTakeover, type TakeoverRedisClient } from './session-takeover';
|
|
4
4
|
export { NotificationRelay, type RelayRedisClient, type RelayHandler, type RelayMessage } from './notification-relay';
|
|
5
|
+
export { isRequestRelayMessage, type CancelRelayMessage, type DestroySessionRelayMessage, type HaRelayMessage, type NotificationRelayMessage, type RelayedHttpRequest, type RelayResponseEvent, type RequestRelayMessage, type ResponseRelayMessage, } from './relay-messages';
|
|
6
|
+
export { resolveHaConfigFromEnv, HA_ENV } from './ha-config';
|
|
5
7
|
export { DEFAULT_FRONTMCP_NODE_COOKIE, DEFAULT_FRONTMCP_MACHINE_ID_HEADER } from './ha.constants';
|
|
6
8
|
export type { HaConfig, DeploymentMode, HeartbeatValue, TakeoverResult } from './ha.types';
|
|
7
9
|
export { DEFAULT_HA_CONFIG } from './ha.types';
|
package/ha/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ha/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ha/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,oBAAoB,GAC1B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gBAAgB,EAAE,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAClF,OAAO,EAAE,sBAAsB,EAAE,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACtF,OAAO,EAAE,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACtH,OAAO,EACL,qBAAqB,EACrB,KAAK,kBAAkB,EACvB,KAAK,0BAA0B,EAC/B,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,GAC1B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,4BAA4B,EAAE,kCAAkC,EAAE,MAAM,gBAAgB,CAAC;AAClG,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC3F,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -2,30 +2,20 @@
|
|
|
2
2
|
* Notification Relay — Redis Pub/Sub Cross-Pod Messaging
|
|
3
3
|
*
|
|
4
4
|
* Each pod subscribes to its own channel (`mcp:ha:notify:{nodeId}`).
|
|
5
|
-
*
|
|
6
|
-
* it
|
|
5
|
+
* Other pods publish to it to deliver a notification to a session it owns,
|
|
6
|
+
* ask it to destroy a session, or relay an HTTP request for one of its
|
|
7
|
+
* sessions (see {@link HaRelayMessage}).
|
|
7
8
|
*/
|
|
8
9
|
import { type HaConfig } from './ha.types';
|
|
10
|
+
import type { HaRelayMessage, NotificationRelayMessage } from './relay-messages';
|
|
9
11
|
/**
|
|
10
12
|
* Notification message relayed between pods.
|
|
11
13
|
*/
|
|
12
|
-
export
|
|
13
|
-
/** Target session ID */
|
|
14
|
-
sessionId: string;
|
|
15
|
-
/** MCP notification to deliver */
|
|
16
|
-
notification: {
|
|
17
|
-
method: string;
|
|
18
|
-
params?: Record<string, unknown>;
|
|
19
|
-
};
|
|
20
|
-
/** Source pod that originated the notification */
|
|
21
|
-
sourceNodeId: string;
|
|
22
|
-
/** Timestamp of relay */
|
|
23
|
-
timestamp: number;
|
|
24
|
-
}
|
|
14
|
+
export type RelayMessage = NotificationRelayMessage;
|
|
25
15
|
/**
|
|
26
|
-
* Handler invoked when a
|
|
16
|
+
* Handler invoked when a message arrives on this pod's relay channel.
|
|
27
17
|
*/
|
|
28
|
-
export type RelayHandler = (message:
|
|
18
|
+
export type RelayHandler = (message: HaRelayMessage) => void | Promise<void>;
|
|
29
19
|
/**
|
|
30
20
|
* Minimal Redis pub/sub client interface.
|
|
31
21
|
* Requires a dedicated connection for subscribing (ioredis pattern).
|
|
@@ -46,6 +36,8 @@ export declare class NotificationRelay {
|
|
|
46
36
|
private readonly channel;
|
|
47
37
|
private readonly keyPrefix;
|
|
48
38
|
constructor(subscriber: RelayRedisClient, publisher: RelayRedisClient, nodeId: string, config?: Partial<HaConfig>);
|
|
39
|
+
/** The relay channel of a node. */
|
|
40
|
+
channelOf(nodeId: string): string;
|
|
49
41
|
/** Start listening for relay messages on this pod's channel. */
|
|
50
42
|
subscribe(handler: RelayHandler): Promise<void>;
|
|
51
43
|
/** Stop listening and clean up. */
|
|
@@ -54,7 +46,12 @@ export declare class NotificationRelay {
|
|
|
54
46
|
* Publish a notification to a target pod's channel.
|
|
55
47
|
* Used when a notification targets a session not owned by this pod.
|
|
56
48
|
*/
|
|
57
|
-
publish(targetNodeId: string, sessionId: string, notification:
|
|
49
|
+
publish(targetNodeId: string, sessionId: string, notification: NotificationRelayMessage['notification']): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Publish any relay message to a target pod's channel.
|
|
52
|
+
* @returns How many subscribers received it — 0 when nothing listens on that pod's channel.
|
|
53
|
+
*/
|
|
54
|
+
send(targetNodeId: string, message: HaRelayMessage): Promise<number>;
|
|
58
55
|
private onMessage;
|
|
59
56
|
}
|
|
60
57
|
//# sourceMappingURL=notification-relay.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-relay.d.ts","sourceRoot":"","sources":["../../src/ha/notification-relay.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"notification-relay.d.ts","sourceRoot":"","sources":["../../src/ha/notification-relay.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAqB,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAEjF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,wBAAwB,CAAC;AAEpD;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE7E;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7C,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/C,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3D,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAAC;IAChF,kBAAkB,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IAC3C,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAAC;CAC7F;AAED,qBAAa,iBAAiB;IAM1B,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM;IAPzB,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAGhB,UAAU,EAAE,gBAAgB,EAC5B,SAAS,EAAE,gBAAgB,EAC3B,MAAM,EAAE,MAAM,EAC/B,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC;IAM5B,mCAAmC;IACnC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAIjC,gEAAgE;IAC1D,SAAS,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAOrD,mCAAmC;IAC7B,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAUlC;;;OAGG;IACG,OAAO,CACX,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,wBAAwB,CAAC,cAAc,CAAC,GACrD,OAAO,CAAC,IAAI,CAAC;IAUhB;;;OAGG;IACG,IAAI,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;IAI1E,OAAO,CAAC,SAAS,CAef;CACH"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Messages carried on a node's HA relay channel (`{redisKeyPrefix}notify:{nodeId}`).
|
|
3
|
+
*
|
|
4
|
+
* Every node subscribes to its own channel. Other nodes publish to it to deliver
|
|
5
|
+
* a notification to a session it owns, ask it to destroy one, or relay an HTTP
|
|
6
|
+
* request for one of its sessions and receive the response back on their own
|
|
7
|
+
* channel.
|
|
8
|
+
*/
|
|
9
|
+
/** A notification for a session owned by the receiving node. */
|
|
10
|
+
export interface NotificationRelayMessage {
|
|
11
|
+
/** Absent on messages published before relay kinds existed. */
|
|
12
|
+
kind?: 'notification';
|
|
13
|
+
/** Target session ID */
|
|
14
|
+
sessionId: string;
|
|
15
|
+
/** MCP notification to deliver */
|
|
16
|
+
notification: {
|
|
17
|
+
method: string;
|
|
18
|
+
params?: Record<string, unknown>;
|
|
19
|
+
};
|
|
20
|
+
/** Source pod that originated the notification */
|
|
21
|
+
sourceNodeId: string;
|
|
22
|
+
/** Timestamp of relay */
|
|
23
|
+
timestamp: number;
|
|
24
|
+
}
|
|
25
|
+
/** Ask the receiving node to destroy its transport for a session. */
|
|
26
|
+
export interface DestroySessionRelayMessage {
|
|
27
|
+
kind: 'destroy-session';
|
|
28
|
+
sessionId: string;
|
|
29
|
+
reason?: string;
|
|
30
|
+
sourceNodeId: string;
|
|
31
|
+
timestamp: number;
|
|
32
|
+
}
|
|
33
|
+
/** The parts of an HTTP request a relayed request carries to the session owner. */
|
|
34
|
+
export interface RelayedHttpRequest {
|
|
35
|
+
method: string;
|
|
36
|
+
/** Path and query, as received (`/mcp?x=1`). */
|
|
37
|
+
url: string;
|
|
38
|
+
/** Path without the query (`/mcp`). */
|
|
39
|
+
path: string;
|
|
40
|
+
headers: Record<string, string | string[]>;
|
|
41
|
+
query: Record<string, unknown>;
|
|
42
|
+
/** The parsed body (JSON), when the request had one. */
|
|
43
|
+
body?: unknown;
|
|
44
|
+
/** `http` or `https`, as the receiving node saw it. */
|
|
45
|
+
protocol?: string;
|
|
46
|
+
/** Whether the client connection to the receiving node was TLS. */
|
|
47
|
+
encrypted?: boolean;
|
|
48
|
+
/** Socket peer address of the client on the receiving node. */
|
|
49
|
+
peerAddress?: string;
|
|
50
|
+
}
|
|
51
|
+
/** An HTTP request for a session the receiving node owns. */
|
|
52
|
+
export interface RequestRelayMessage {
|
|
53
|
+
kind: 'relay-request';
|
|
54
|
+
/** Correlates the response frames with this request. */
|
|
55
|
+
requestId: string;
|
|
56
|
+
/** Node that received the request; the response frames are published to it. */
|
|
57
|
+
sourceNodeId: string;
|
|
58
|
+
sessionId: string;
|
|
59
|
+
request: RelayedHttpRequest;
|
|
60
|
+
timestamp: number;
|
|
61
|
+
/** How often the owner sends a `keepalive` frame while it serves the request (ms). */
|
|
62
|
+
keepaliveMs?: number;
|
|
63
|
+
}
|
|
64
|
+
/** One step of a relayed response, in the order the owner produced it. */
|
|
65
|
+
export type RelayResponseEvent =
|
|
66
|
+
/** The owner received the request and is serving it. */
|
|
67
|
+
{
|
|
68
|
+
event: 'ack';
|
|
69
|
+
}
|
|
70
|
+
/** The owner is still serving the request (sent while the response is quiet). */
|
|
71
|
+
| {
|
|
72
|
+
event: 'keepalive';
|
|
73
|
+
}
|
|
74
|
+
/** Status line and headers. */
|
|
75
|
+
| {
|
|
76
|
+
event: 'head';
|
|
77
|
+
status: number;
|
|
78
|
+
headers: Record<string, string | string[]>;
|
|
79
|
+
}
|
|
80
|
+
/** A body chunk (`base64` for bytes, `utf8` for text). */
|
|
81
|
+
| {
|
|
82
|
+
event: 'data';
|
|
83
|
+
data: string;
|
|
84
|
+
encoding: 'utf8' | 'base64';
|
|
85
|
+
}
|
|
86
|
+
/** The response is complete. */
|
|
87
|
+
| {
|
|
88
|
+
event: 'end';
|
|
89
|
+
}
|
|
90
|
+
/** The owner could not finish the response. */
|
|
91
|
+
| {
|
|
92
|
+
event: 'error';
|
|
93
|
+
message: string;
|
|
94
|
+
};
|
|
95
|
+
/** A response frame for a relayed request, published back to the node that relayed it. */
|
|
96
|
+
export type ResponseRelayMessage = {
|
|
97
|
+
kind: 'relay-response';
|
|
98
|
+
requestId: string;
|
|
99
|
+
/** The owner that served the request. */
|
|
100
|
+
sourceNodeId: string;
|
|
101
|
+
} & RelayResponseEvent;
|
|
102
|
+
/** The relaying node's client went away: stop serving the request. */
|
|
103
|
+
export interface CancelRelayMessage {
|
|
104
|
+
kind: 'relay-cancel';
|
|
105
|
+
requestId: string;
|
|
106
|
+
sourceNodeId: string;
|
|
107
|
+
}
|
|
108
|
+
/** Any message on a node's relay channel. */
|
|
109
|
+
export type HaRelayMessage = NotificationRelayMessage | DestroySessionRelayMessage | RequestRelayMessage | ResponseRelayMessage | CancelRelayMessage;
|
|
110
|
+
/** Kinds of the request-relay messages. */
|
|
111
|
+
export type RequestRelayKind = 'relay-request' | 'relay-response' | 'relay-cancel';
|
|
112
|
+
/** Whether a relay channel message belongs to a relayed HTTP request. */
|
|
113
|
+
export declare function isRequestRelayMessage(message: HaRelayMessage): message is RequestRelayMessage | ResponseRelayMessage | CancelRelayMessage;
|
|
114
|
+
//# sourceMappingURL=relay-messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relay-messages.d.ts","sourceRoot":"","sources":["../../src/ha/relay-messages.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,gEAAgE;AAChE,MAAM,WAAW,wBAAwB;IACvC,+DAA+D;IAC/D,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,wBAAwB;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,kCAAkC;IAClC,YAAY,EAAE;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAClC,CAAC;IACF,kDAAkD;IAClD,YAAY,EAAE,MAAM,CAAC;IACrB,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,qEAAqE;AACrE,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,iBAAiB,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,mFAAmF;AAC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;GAWG;AACH,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,mBAAmB,EAC1B,UAAU,EAAE,MAAM,EAClB,iBAAiB,EAAE,MAAM,EACzB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"session-takeover.d.ts","sourceRoot":"","sources":["../../src/ha/session-takeover.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACvF;AAwCD;;;;;;;;;;;GAWG;AACH,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,mBAAmB,EAC1B,UAAU,EAAE,MAAM,EAClB,iBAAiB,EAAE,MAAM,EACzB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,cAAc,CAAC,CAWzB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type FlowName, type FlowPhase, type HookRecord } from '../common';
|
|
2
|
+
/** A flow's plan: its stages by phase. */
|
|
3
|
+
type EntryFlowPlan = Partial<Record<FlowPhase, readonly string[]>>;
|
|
4
|
+
/**
|
|
5
|
+
* Where the hooks an entry class (`@Tool`, `@Resource`, `@Prompt`, `@Agent`) declares join a run of
|
|
6
|
+
* the flow that serves the entry. They run on the instance built for the call, so they join while
|
|
7
|
+
* the stage that builds it runs.
|
|
8
|
+
*/
|
|
9
|
+
export interface EntryClassHooksJoin {
|
|
10
|
+
/** The flow that serves the entry (`tools:call-tool`, ...). */
|
|
11
|
+
flow: FlowName;
|
|
12
|
+
/** That flow's plan. */
|
|
13
|
+
plan: EntryFlowPlan;
|
|
14
|
+
/** The stage that builds the entry's instance. */
|
|
15
|
+
contextStage: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The hooks an entry class declares that can never run, each described for a startup error:
|
|
19
|
+
* - on its own flow, a stage the run passes before the entry's instance exists (and `Will` or
|
|
20
|
+
* `Around` on the stage that builds it);
|
|
21
|
+
* - on a list flow, which lists entries without building any instance.
|
|
22
|
+
*/
|
|
23
|
+
export declare function describeUnreachableEntryClassHooks(hooks: readonly HookRecord[], join: EntryClassHooksJoin, listFlows: readonly string[]): string[];
|
|
24
|
+
/** The startup error for an entry class whose hooks would never run. */
|
|
25
|
+
export declare function unreachableHooksMessage(kind: string, className: string, problems: readonly string[]): string;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=entry-class-hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry-class-hooks.d.ts","sourceRoot":"","sources":["../../src/hooks/entry-class-hooks.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAE3E,0CAA0C;AAC1C,KAAK,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;AAEnE;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,+DAA+D;IAC/D,IAAI,EAAE,QAAQ,CAAC;IACf,wBAAwB;IACxB,IAAI,EAAE,aAAa,CAAC;IACpB,kDAAkD;IAClD,YAAY,EAAE,MAAM,CAAC;CACtB;AAaD;;;;;GAKG;AACH,wBAAgB,kCAAkC,CAChD,KAAK,EAAE,SAAS,UAAU,EAAE,EAC5B,IAAI,EAAE,mBAAmB,EACzB,SAAS,EAAE,SAAS,MAAM,EAAE,GAC3B,MAAM,EAAE,CAoBV;AAED,wEAAwE;AACxE,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAM5G"}
|
package/hooks/hook.registry.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export default class HookRegistry extends RegistryAbstract<HookEntry, HookRecord
|
|
|
11
11
|
private entriesByCls;
|
|
12
12
|
private hooksByFlow;
|
|
13
13
|
private hooksByFlowStage;
|
|
14
|
+
/** The registry whose flow hooks this one serves too (see {@link inheritFrom}). */
|
|
15
|
+
private inherited?;
|
|
14
16
|
constructor(providers: ProviderRegistry, list: HookType[]);
|
|
15
17
|
protected buildMap(): RegistryBuildMapResult<HookRecord>;
|
|
16
18
|
protected buildGraph(): void;
|
|
@@ -25,8 +27,17 @@ export default class HookRegistry extends RegistryAbstract<HookEntry, HookRecord
|
|
|
25
27
|
private indexByFlowStage;
|
|
26
28
|
private initializeOne;
|
|
27
29
|
registerHooks(embedded: boolean, ...records: HookRecord[]): Promise<void[]>;
|
|
30
|
+
/**
|
|
31
|
+
* Also serve the flow hooks `parent` runs for entries of `ownerId`, after this registry's own hooks
|
|
32
|
+
* of the same priority. An `@Agent` with `execution.inheritPlugins` uses it: its tools run in the
|
|
33
|
+
* agent's private scope, and then get the hooks of the plugins installed on the agent's app and on
|
|
34
|
+
* the server too. A hook of a plugin class installed both here and there runs once, as installed here.
|
|
35
|
+
*/
|
|
36
|
+
inheritFrom(parent: HookRegistry, ownerId: string): void;
|
|
28
37
|
/** Hooks for a given *flow*, filtered by owner if provided, sorted by priority (desc). */
|
|
29
38
|
getFlowHooksForOwner<Name extends FlowName>(flow: Name, ownerId?: string): HookEntry<FlowInputOf<Name>, Name, FlowStagesOf<Name>, FlowCtxOf<Name>>[];
|
|
39
|
+
/** This registry's own hooks for a given *flow*, filtered by owner if provided, sorted by priority (desc). */
|
|
40
|
+
private getOwnFlowHooksForOwner;
|
|
30
41
|
/** Hooks defined on a given *class* (metadata.target), sorted by priority (desc). */
|
|
31
42
|
getClsHooks(token: Token): HookEntry[];
|
|
32
43
|
/** All hooks (instances, unordered) */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hook.registry.d.ts","sourceRoot":"","sources":["../../src/hooks/hook.registry.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,KAAK,EACX,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,gBAAgB,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,KAAK,sBAAsB,EAAE,MAAM,aAAa,CAAC;AA0B5E,0GAA0G;AAC1G,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAKpD;AAaD,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,gBAAgB,CAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC;IAC3F,KAAK,EAAE,UAAU,CAAC;IAElB,iFAAiF;IACjF,YAAY,EAAE,GAAG,CAAC,KAAK,EAAE,UAAU,EAAE,CAAC,CAAa;IAEnD,kEAAkE;IAClE,OAAO,CAAC,YAAY,CAAsC;IAC1D,OAAO,CAAC,WAAW,CAAyC;IAC5D,OAAO,CAAC,gBAAgB,CAAsD;
|
|
1
|
+
{"version":3,"file":"hook.registry.d.ts","sourceRoot":"","sources":["../../src/hooks/hook.registry.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,KAAK,EACX,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,gBAAgB,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,KAAK,sBAAsB,EAAE,MAAM,aA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8G;IAC9G,OAAO,CAAC,uBAAuB;IAyB/B,qFAAqF;IACrF,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,EAAE;IAItC,uCAAuC;IACvC,QAAQ,IAAI,SAAS,EAAE;IAIvB,2DAA2D;IAC3D,YAAY,CAAC,IAAI,SAAS,QAAQ,EAChC,IAAI,EAAE,IAAI,GACT,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE;IAS5E,sEAAsE;IACtE,iBAAiB,CAAC,IAAI,SAAS,QAAQ,EACrC,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,GACjC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE;CAS7E"}
|
package/hooks/hooks.utils.d.ts
CHANGED
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
import { type Token } from '@frontmcp/di';
|
|
2
|
-
import { type HookEntry, type HookMetadata, type HookRecord } from '../common';
|
|
2
|
+
import { type EntryOwnerRef, type HookContextRun, type HookEntry, type HookMetadata, type HookRecord, type ProviderType } from '../common';
|
|
3
|
+
import type ProviderRegistry from '../provider/provider.registry';
|
|
3
4
|
export declare function collectHook(cls: Token): HookMetadata[];
|
|
4
5
|
/**
|
|
5
6
|
* Hook records declared on a class, from either the class itself (an entry class such as a
|
|
6
7
|
* `@Tool`, whose methods run on each call's instance) or an instance of it (a plugin or provider).
|
|
7
8
|
*/
|
|
8
9
|
export declare function normalizeHooksFromCls(source: any): HookRecord[];
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Hook records declared on the providers a registry defines: on its singletons, and on the class of
|
|
12
|
+
* each CONTEXT-scoped provider, whose hooks run on the instance built for each flow run.
|
|
13
|
+
*
|
|
14
|
+
* @param only - When given, only the providers with these tokens.
|
|
15
|
+
*/
|
|
16
|
+
export declare function normalizeHooksFromProviders(providers: ProviderRegistry, only?: ReadonlySet<Token>): HookRecord[];
|
|
17
|
+
/**
|
|
18
|
+
* Hook records of the providers a server declares (`@FrontMcp({ providers })`), owned by its scope so
|
|
19
|
+
* they run for every app's entries. The framework's own scope providers are left out.
|
|
20
|
+
*/
|
|
21
|
+
export declare function serverProviderHooks(providers: ProviderRegistry, declared: readonly ProviderType[] | undefined, owner: EntryOwnerRef): HookRecord[];
|
|
22
|
+
/**
|
|
23
|
+
* Give each hook declared on a CONTEXT-scoped provider the instance of that provider for this flow run;
|
|
24
|
+
* other hooks are returned as they are.
|
|
25
|
+
*/
|
|
26
|
+
export declare function bindContextHookTargets<T extends Pick<HookEntry, 'metadata'>>(hooks: readonly T[], run: HookContextRun): Promise<Array<T | Pick<HookEntry, 'metadata'>>>;
|
|
13
27
|
/** An entry class's hooks aimed at one call's instance, so each call runs them on its own instance. */
|
|
14
28
|
export declare function hooksBoundTo(entries: readonly HookEntry[], instance: object): Array<Pick<HookEntry, 'metadata'>>;
|
|
15
29
|
//# sourceMappingURL=hooks.utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.utils.d.ts","sourceRoot":"","sources":["../../src/hooks/hooks.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,KAAK,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,
|
|
1
|
+
{"version":3,"file":"hooks.utils.d.ts","sourceRoot":"","sources":["../../src/hooks/hooks.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,KAAK,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,YAAY,E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