@generacy-ai/agency 0.0.0-preview-20260228204303
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/LICENSE +21 -0
- package/dist/channels/index.d.ts +10 -0
- package/dist/channels/index.d.ts.map +1 -0
- package/dist/channels/index.js +9 -0
- package/dist/channels/index.js.map +1 -0
- package/dist/channels/manager.d.ts +184 -0
- package/dist/channels/manager.d.ts.map +1 -0
- package/dist/channels/manager.js +414 -0
- package/dist/channels/manager.js.map +1 -0
- package/dist/channels/types.d.ts +71 -0
- package/dist/channels/types.d.ts.map +1 -0
- package/dist/channels/types.js +19 -0
- package/dist/channels/types.js.map +1 -0
- package/dist/channels/version.d.ts +18 -0
- package/dist/channels/version.d.ts.map +1 -0
- package/dist/channels/version.js +28 -0
- package/dist/channels/version.js.map +1 -0
- package/dist/cli.d.ts +19 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +44 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +5 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/loader.d.ts +48 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +158 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/schema.d.ts +86 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +52 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/core-api/core-api.d.ts +27 -0
- package/dist/core-api/core-api.d.ts.map +1 -0
- package/dist/core-api/core-api.js +275 -0
- package/dist/core-api/core-api.js.map +1 -0
- package/dist/core-api/index.d.ts +8 -0
- package/dist/core-api/index.d.ts.map +1 -0
- package/dist/core-api/index.js +7 -0
- package/dist/core-api/index.js.map +1 -0
- package/dist/core-api/types.d.ts +73 -0
- package/dist/core-api/types.d.ts.map +1 -0
- package/dist/core-api/types.js +8 -0
- package/dist/core-api/types.js.map +1 -0
- package/dist/errors/agency-error.d.ts +73 -0
- package/dist/errors/agency-error.d.ts.map +1 -0
- package/dist/errors/agency-error.js +88 -0
- package/dist/errors/agency-error.js.map +1 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +2 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/facets/binder.d.ts +83 -0
- package/dist/facets/binder.d.ts.map +1 -0
- package/dist/facets/binder.js +174 -0
- package/dist/facets/binder.js.map +1 -0
- package/dist/facets/index.d.ts +13 -0
- package/dist/facets/index.d.ts.map +1 -0
- package/dist/facets/index.js +14 -0
- package/dist/facets/index.js.map +1 -0
- package/dist/facets/registry.d.ts +135 -0
- package/dist/facets/registry.d.ts.map +1 -0
- package/dist/facets/registry.js +271 -0
- package/dist/facets/registry.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -0
- package/dist/modes/config-loader.d.ts +35 -0
- package/dist/modes/config-loader.d.ts.map +1 -0
- package/dist/modes/config-loader.js +130 -0
- package/dist/modes/config-loader.js.map +1 -0
- package/dist/modes/index.d.ts +9 -0
- package/dist/modes/index.d.ts.map +1 -0
- package/dist/modes/index.js +7 -0
- package/dist/modes/index.js.map +1 -0
- package/dist/modes/inheritance-resolver.d.ts +32 -0
- package/dist/modes/inheritance-resolver.d.ts.map +1 -0
- package/dist/modes/inheritance-resolver.js +184 -0
- package/dist/modes/inheritance-resolver.js.map +1 -0
- package/dist/modes/manager.d.ts +191 -0
- package/dist/modes/manager.d.ts.map +1 -0
- package/dist/modes/manager.js +379 -0
- package/dist/modes/manager.js.map +1 -0
- package/dist/modes/pattern-matcher.d.ts +59 -0
- package/dist/modes/pattern-matcher.d.ts.map +1 -0
- package/dist/modes/pattern-matcher.js +97 -0
- package/dist/modes/pattern-matcher.js.map +1 -0
- package/dist/modes/types.d.ts +149 -0
- package/dist/modes/types.d.ts.map +1 -0
- package/dist/modes/types.js +41 -0
- package/dist/modes/types.js.map +1 -0
- package/dist/output/format-error.d.ts +19 -0
- package/dist/output/format-error.d.ts.map +1 -0
- package/dist/output/format-error.js +59 -0
- package/dist/output/format-error.js.map +1 -0
- package/dist/output/index.d.ts +27 -0
- package/dist/output/index.d.ts.map +1 -0
- package/dist/output/index.js +30 -0
- package/dist/output/index.js.map +1 -0
- package/dist/output/success-messages.d.ts +45 -0
- package/dist/output/success-messages.d.ts.map +1 -0
- package/dist/output/success-messages.js +48 -0
- package/dist/output/success-messages.js.map +1 -0
- package/dist/output/terse-output.d.ts +99 -0
- package/dist/output/terse-output.d.ts.map +1 -0
- package/dist/output/terse-output.js +205 -0
- package/dist/output/terse-output.js.map +1 -0
- package/dist/output/types.d.ts +48 -0
- package/dist/output/types.d.ts.map +1 -0
- package/dist/output/types.js +26 -0
- package/dist/output/types.js.map +1 -0
- package/dist/plugins/dependency-resolver.d.ts +72 -0
- package/dist/plugins/dependency-resolver.d.ts.map +1 -0
- package/dist/plugins/dependency-resolver.js +206 -0
- package/dist/plugins/dependency-resolver.js.map +1 -0
- package/dist/plugins/discovery.d.ts +68 -0
- package/dist/plugins/discovery.d.ts.map +1 -0
- package/dist/plugins/discovery.js +224 -0
- package/dist/plugins/discovery.js.map +1 -0
- package/dist/plugins/index.d.ts +7 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +9 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/loader.d.ts +142 -0
- package/dist/plugins/loader.d.ts.map +1 -0
- package/dist/plugins/loader.js +393 -0
- package/dist/plugins/loader.js.map +1 -0
- package/dist/plugins/manifest.d.ts +106 -0
- package/dist/plugins/manifest.d.ts.map +1 -0
- package/dist/plugins/manifest.js +125 -0
- package/dist/plugins/manifest.js.map +1 -0
- package/dist/plugins/types.d.ts +285 -0
- package/dist/plugins/types.d.ts.map +1 -0
- package/dist/plugins/types.js +9 -0
- package/dist/plugins/types.js.map +1 -0
- package/dist/schemas/attribution-metrics/index.d.ts +623 -0
- package/dist/schemas/attribution-metrics/index.d.ts.map +1 -0
- package/dist/schemas/attribution-metrics/index.js +144 -0
- package/dist/schemas/attribution-metrics/index.js.map +1 -0
- package/dist/schemas/common/ids.d.ts +55 -0
- package/dist/schemas/common/ids.d.ts.map +1 -0
- package/dist/schemas/common/ids.js +85 -0
- package/dist/schemas/common/ids.js.map +1 -0
- package/dist/schemas/common/index.d.ts +3 -0
- package/dist/schemas/common/index.d.ts.map +1 -0
- package/dist/schemas/common/index.js +5 -0
- package/dist/schemas/common/index.js.map +1 -0
- package/dist/schemas/common/timestamps.d.ts +16 -0
- package/dist/schemas/common/timestamps.d.ts.map +1 -0
- package/dist/schemas/common/timestamps.js +29 -0
- package/dist/schemas/common/timestamps.js.map +1 -0
- package/dist/schemas/data-export/index.d.ts +1994 -0
- package/dist/schemas/data-export/index.d.ts.map +1 -0
- package/dist/schemas/data-export/index.js +147 -0
- package/dist/schemas/data-export/index.js.map +1 -0
- package/dist/schemas/decision-model/index.d.ts +1806 -0
- package/dist/schemas/decision-model/index.d.ts.map +1 -0
- package/dist/schemas/decision-model/index.js +114 -0
- package/dist/schemas/decision-model/index.js.map +1 -0
- package/dist/schemas/extension-comms/index.d.ts +2815 -0
- package/dist/schemas/extension-comms/index.d.ts.map +1 -0
- package/dist/schemas/extension-comms/index.js +222 -0
- package/dist/schemas/extension-comms/index.js.map +1 -0
- package/dist/schemas/github-app/index.d.ts +420 -0
- package/dist/schemas/github-app/index.d.ts.map +1 -0
- package/dist/schemas/github-app/index.js +130 -0
- package/dist/schemas/github-app/index.js.map +1 -0
- package/dist/schemas/index.d.ts +4 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +8 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/knowledge-store/index.d.ts +2335 -0
- package/dist/schemas/knowledge-store/index.d.ts.map +1 -0
- package/dist/schemas/knowledge-store/index.js +190 -0
- package/dist/schemas/knowledge-store/index.js.map +1 -0
- package/dist/schemas/learning-loop/index.d.ts +874 -0
- package/dist/schemas/learning-loop/index.d.ts.map +1 -0
- package/dist/schemas/learning-loop/index.js +170 -0
- package/dist/schemas/learning-loop/index.js.map +1 -0
- package/dist/schemas/platform-api/auth/api-key.d.ts +352 -0
- package/dist/schemas/platform-api/auth/api-key.d.ts.map +1 -0
- package/dist/schemas/platform-api/auth/api-key.js +98 -0
- package/dist/schemas/platform-api/auth/api-key.js.map +1 -0
- package/dist/schemas/platform-api/auth/auth-token.d.ts +228 -0
- package/dist/schemas/platform-api/auth/auth-token.d.ts.map +1 -0
- package/dist/schemas/platform-api/auth/auth-token.js +78 -0
- package/dist/schemas/platform-api/auth/auth-token.js.map +1 -0
- package/dist/schemas/platform-api/auth/index.d.ts +5 -0
- package/dist/schemas/platform-api/auth/index.d.ts.map +1 -0
- package/dist/schemas/platform-api/auth/index.js +9 -0
- package/dist/schemas/platform-api/auth/index.js.map +1 -0
- package/dist/schemas/platform-api/auth/session.d.ts +312 -0
- package/dist/schemas/platform-api/auth/session.d.ts.map +1 -0
- package/dist/schemas/platform-api/auth/session.js +79 -0
- package/dist/schemas/platform-api/auth/session.js.map +1 -0
- package/dist/schemas/platform-api/index.d.ts +4 -0
- package/dist/schemas/platform-api/index.d.ts.map +1 -0
- package/dist/schemas/platform-api/index.js +8 -0
- package/dist/schemas/platform-api/index.js.map +1 -0
- package/dist/schemas/platform-api/organization/index.d.ts +4 -0
- package/dist/schemas/platform-api/organization/index.d.ts.map +1 -0
- package/dist/schemas/platform-api/organization/index.js +6 -0
- package/dist/schemas/platform-api/organization/index.js.map +1 -0
- package/dist/schemas/platform-api/organization/invite.d.ts +398 -0
- package/dist/schemas/platform-api/organization/invite.d.ts.map +1 -0
- package/dist/schemas/platform-api/organization/invite.js +95 -0
- package/dist/schemas/platform-api/organization/invite.js.map +1 -0
- package/dist/schemas/platform-api/organization/membership.d.ts +295 -0
- package/dist/schemas/platform-api/organization/membership.d.ts.map +1 -0
- package/dist/schemas/platform-api/organization/membership.js +83 -0
- package/dist/schemas/platform-api/organization/membership.js.map +1 -0
- package/dist/schemas/platform-api/organization/organization.d.ts +345 -0
- package/dist/schemas/platform-api/organization/organization.d.ts.map +1 -0
- package/dist/schemas/platform-api/organization/organization.js +100 -0
- package/dist/schemas/platform-api/organization/organization.js.map +1 -0
- package/dist/schemas/platform-api/subscription/feature-entitlement.d.ts +160 -0
- package/dist/schemas/platform-api/subscription/feature-entitlement.d.ts.map +1 -0
- package/dist/schemas/platform-api/subscription/feature-entitlement.js +62 -0
- package/dist/schemas/platform-api/subscription/feature-entitlement.js.map +1 -0
- package/dist/schemas/platform-api/subscription/generacy-tier.d.ts +1060 -0
- package/dist/schemas/platform-api/subscription/generacy-tier.d.ts.map +1 -0
- package/dist/schemas/platform-api/subscription/generacy-tier.js +117 -0
- package/dist/schemas/platform-api/subscription/generacy-tier.js.map +1 -0
- package/dist/schemas/platform-api/subscription/humancy-tier.d.ts +979 -0
- package/dist/schemas/platform-api/subscription/humancy-tier.d.ts.map +1 -0
- package/dist/schemas/platform-api/subscription/humancy-tier.js +121 -0
- package/dist/schemas/platform-api/subscription/humancy-tier.js.map +1 -0
- package/dist/schemas/platform-api/subscription/index.d.ts +5 -0
- package/dist/schemas/platform-api/subscription/index.d.ts.map +1 -0
- package/dist/schemas/platform-api/subscription/index.js +11 -0
- package/dist/schemas/platform-api/subscription/index.js.map +1 -0
- package/dist/schemas/platform-api/subscription/usage-limit.d.ts +298 -0
- package/dist/schemas/platform-api/subscription/usage-limit.d.ts.map +1 -0
- package/dist/schemas/platform-api/subscription/usage-limit.js +78 -0
- package/dist/schemas/platform-api/subscription/usage-limit.js.map +1 -0
- package/dist/schemas/tool-result.d.ts +92 -0
- package/dist/schemas/tool-result.d.ts.map +1 -0
- package/dist/schemas/tool-result.js +30 -0
- package/dist/schemas/tool-result.js.map +1 -0
- package/dist/scripts/generate-tool-naming-schemas.d.ts +3 -0
- package/dist/scripts/generate-tool-naming-schemas.d.ts.map +1 -0
- package/dist/scripts/generate-tool-naming-schemas.js +30 -0
- package/dist/scripts/generate-tool-naming-schemas.js.map +1 -0
- package/dist/scripts/generate-tool-result-schema.d.ts +3 -0
- package/dist/scripts/generate-tool-result-schema.d.ts.map +1 -0
- package/dist/scripts/generate-tool-result-schema.js +21 -0
- package/dist/scripts/generate-tool-result-schema.js.map +1 -0
- package/dist/server/agency-server.d.ts +158 -0
- package/dist/server/agency-server.d.ts.map +1 -0
- package/dist/server/agency-server.js +381 -0
- package/dist/server/agency-server.js.map +1 -0
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +2 -0
- package/dist/server/index.js.map +1 -0
- package/dist/telemetry/bus.d.ts +50 -0
- package/dist/telemetry/bus.d.ts.map +1 -0
- package/dist/telemetry/bus.js +85 -0
- package/dist/telemetry/bus.js.map +1 -0
- package/dist/telemetry/config.d.ts +43 -0
- package/dist/telemetry/config.d.ts.map +1 -0
- package/dist/telemetry/config.js +32 -0
- package/dist/telemetry/config.js.map +1 -0
- package/dist/telemetry/factory.d.ts +36 -0
- package/dist/telemetry/factory.d.ts.map +1 -0
- package/dist/telemetry/factory.js +40 -0
- package/dist/telemetry/factory.js.map +1 -0
- package/dist/telemetry/index.d.ts +10 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +15 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/telemetry/interceptor.d.ts +24 -0
- package/dist/telemetry/interceptor.d.ts.map +1 -0
- package/dist/telemetry/interceptor.js +76 -0
- package/dist/telemetry/interceptor.js.map +1 -0
- package/dist/telemetry/manager.d.ts +89 -0
- package/dist/telemetry/manager.d.ts.map +1 -0
- package/dist/telemetry/manager.js +162 -0
- package/dist/telemetry/manager.js.map +1 -0
- package/dist/telemetry/providers/file.d.ts +161 -0
- package/dist/telemetry/providers/file.d.ts.map +1 -0
- package/dist/telemetry/providers/file.js +329 -0
- package/dist/telemetry/providers/file.js.map +1 -0
- package/dist/telemetry/providers/index.d.ts +3 -0
- package/dist/telemetry/providers/index.d.ts.map +1 -0
- package/dist/telemetry/providers/index.js +3 -0
- package/dist/telemetry/providers/index.js.map +1 -0
- package/dist/telemetry/providers/memory.d.ts +67 -0
- package/dist/telemetry/providers/memory.d.ts.map +1 -0
- package/dist/telemetry/providers/memory.js +210 -0
- package/dist/telemetry/providers/memory.js.map +1 -0
- package/dist/telemetry/schemas.d.ts +392 -0
- package/dist/telemetry/schemas.d.ts.map +1 -0
- package/dist/telemetry/schemas.js +173 -0
- package/dist/telemetry/schemas.js.map +1 -0
- package/dist/telemetry/types.d.ts +76 -0
- package/dist/telemetry/types.d.ts.map +1 -0
- package/dist/telemetry/types.js +2 -0
- package/dist/telemetry/types.js.map +1 -0
- package/dist/tools/index.d.ts +6 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +6 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/naming/action.d.ts +24 -0
- package/dist/tools/naming/action.d.ts.map +1 -0
- package/dist/tools/naming/action.js +29 -0
- package/dist/tools/naming/action.js.map +1 -0
- package/dist/tools/naming/index.d.ts +7 -0
- package/dist/tools/naming/index.d.ts.map +1 -0
- package/dist/tools/naming/index.js +7 -0
- package/dist/tools/naming/index.js.map +1 -0
- package/dist/tools/naming/prefix.d.ts +42 -0
- package/dist/tools/naming/prefix.d.ts.map +1 -0
- package/dist/tools/naming/prefix.js +46 -0
- package/dist/tools/naming/prefix.js.map +1 -0
- package/dist/tools/naming/tool-catalog.d.ts +15 -0
- package/dist/tools/naming/tool-catalog.d.ts.map +1 -0
- package/dist/tools/naming/tool-catalog.js +2 -0
- package/dist/tools/naming/tool-catalog.js.map +1 -0
- package/dist/tools/naming/tool-definition.d.ts +71 -0
- package/dist/tools/naming/tool-definition.d.ts.map +1 -0
- package/dist/tools/naming/tool-definition.js +48 -0
- package/dist/tools/naming/tool-definition.js.map +1 -0
- package/dist/tools/naming/tool-name.d.ts +47 -0
- package/dist/tools/naming/tool-name.d.ts.map +1 -0
- package/dist/tools/naming/tool-name.js +90 -0
- package/dist/tools/naming/tool-name.js.map +1 -0
- package/dist/tools/naming/validation-error.d.ts +113 -0
- package/dist/tools/naming/validation-error.d.ts.map +1 -0
- package/dist/tools/naming/validation-error.js +178 -0
- package/dist/tools/naming/validation-error.js.map +1 -0
- package/dist/tools/prefixes.d.ts +28 -0
- package/dist/tools/prefixes.d.ts.map +1 -0
- package/dist/tools/prefixes.js +24 -0
- package/dist/tools/prefixes.js.map +1 -0
- package/dist/tools/registry.d.ts +115 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +187 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/types.d.ts +128 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +25 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools/validation.d.ts +28 -0
- package/dist/tools/validation.d.ts.map +1 -0
- package/dist/tools/validation.js +93 -0
- package/dist/tools/validation.js.map +1 -0
- package/dist/utils/dependency.d.ts +86 -0
- package/dist/utils/dependency.d.ts.map +1 -0
- package/dist/utils/dependency.js +256 -0
- package/dist/utils/dependency.js.map +1 -0
- package/dist/utils/git.d.ts +93 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +136 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/grouping.d.ts +212 -0
- package/dist/utils/grouping.d.ts.map +1 -0
- package/dist/utils/grouping.js +566 -0
- package/dist/utils/grouping.js.map +1 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +12 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/task-parser.d.ts +149 -0
- package/dist/utils/task-parser.d.ts.map +1 -0
- package/dist/utils/task-parser.js +585 -0
- package/dist/utils/task-parser.js.map +1 -0
- package/package.json +94 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 The Generacy AI Authors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Channels module for Agency
|
|
3
|
+
*
|
|
4
|
+
* Provides inter-plugin communication via pub/sub channels.
|
|
5
|
+
*/
|
|
6
|
+
export type { ChannelDefinition, MessageEnvelope, MessageHandler, Unsubscribe, ChannelState, CreateMessageOptions, PendingResponse, DeliveryResult, } from './types.js';
|
|
7
|
+
export { createMessageEnvelope } from './types.js';
|
|
8
|
+
export { ChannelManager, ChannelErrorCodes, BUILT_IN_CHANNELS } from './manager.js';
|
|
9
|
+
export { isVersionCompatible } from './version.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/channels/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EACV,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,WAAW,EACX,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,cAAc,GACf,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Channels module for Agency
|
|
3
|
+
*
|
|
4
|
+
* Provides inter-plugin communication via pub/sub channels.
|
|
5
|
+
*/
|
|
6
|
+
export { createMessageEnvelope } from './types.js';
|
|
7
|
+
export { ChannelManager, ChannelErrorCodes, BUILT_IN_CHANNELS } from './manager.js';
|
|
8
|
+
export { isVersionCompatible } from './version.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/channels/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAaH,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Channel Manager for Agency
|
|
3
|
+
*
|
|
4
|
+
* Manages inter-plugin communication channels using a pub/sub pattern.
|
|
5
|
+
* Channels are registered by plugins and can be used for decoupled messaging.
|
|
6
|
+
*/
|
|
7
|
+
import type { ChannelDefinition, MessageEnvelope } from '../plugins/types.js';
|
|
8
|
+
import type { MessageHandler, Unsubscribe, DeliveryResult } from './types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Channel manager error codes (re-export for convenience)
|
|
11
|
+
*/
|
|
12
|
+
export declare const ChannelErrorCodes: {
|
|
13
|
+
readonly CHANNEL_NOT_FOUND: "CHANNEL_NOT_FOUND";
|
|
14
|
+
readonly CHANNEL_ALREADY_EXISTS: "CHANNEL_ALREADY_REGISTERED";
|
|
15
|
+
readonly CHANNEL_VERSION_MISMATCH: "CHANNEL_VERSION_MISMATCH";
|
|
16
|
+
readonly CHANNEL_TIMEOUT: "CHANNEL_TIMEOUT";
|
|
17
|
+
readonly CHANNEL_DELIVERY_FAILED: "CHANNEL_DELIVERY_FAILED";
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Built-in channel definitions
|
|
21
|
+
*/
|
|
22
|
+
export declare const BUILT_IN_CHANNELS: ChannelDefinition[];
|
|
23
|
+
/**
|
|
24
|
+
* Channel Manager for inter-plugin communication
|
|
25
|
+
*
|
|
26
|
+
* Provides a simple pub/sub mechanism for plugins to communicate
|
|
27
|
+
* without direct coupling.
|
|
28
|
+
*/
|
|
29
|
+
export declare class ChannelManager {
|
|
30
|
+
private readonly channels;
|
|
31
|
+
/**
|
|
32
|
+
* Register a new communication channel
|
|
33
|
+
*
|
|
34
|
+
* @param channel Channel definition
|
|
35
|
+
* @throws AgencyError if channel already exists
|
|
36
|
+
*/
|
|
37
|
+
registerChannel(channel: ChannelDefinition): void;
|
|
38
|
+
/**
|
|
39
|
+
* Unregister a channel
|
|
40
|
+
*
|
|
41
|
+
* @param name Channel name to unregister
|
|
42
|
+
* @returns true if channel was found and removed
|
|
43
|
+
*/
|
|
44
|
+
unregisterChannel(name: string): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Check if a channel exists
|
|
47
|
+
*
|
|
48
|
+
* @param name Channel name
|
|
49
|
+
* @returns true if channel is registered
|
|
50
|
+
*/
|
|
51
|
+
hasChannel(name: string): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Get channel definition
|
|
54
|
+
*
|
|
55
|
+
* @param name Channel name
|
|
56
|
+
* @returns Channel definition or undefined
|
|
57
|
+
*/
|
|
58
|
+
getChannel(name: string): ChannelDefinition | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Get all registered channel names
|
|
61
|
+
*
|
|
62
|
+
* @returns Array of channel names
|
|
63
|
+
*/
|
|
64
|
+
getChannelNames(): string[];
|
|
65
|
+
/**
|
|
66
|
+
* Get all registered channel definitions
|
|
67
|
+
*
|
|
68
|
+
* @returns Array of channel definitions
|
|
69
|
+
*/
|
|
70
|
+
getChannels(): ChannelDefinition[];
|
|
71
|
+
/**
|
|
72
|
+
* Find a channel by ID with optional version filtering
|
|
73
|
+
*
|
|
74
|
+
* @param id Channel ID to find
|
|
75
|
+
* @param minVersion Minimum required version (optional)
|
|
76
|
+
* @returns Channel definition if found and version compatible, undefined otherwise
|
|
77
|
+
*/
|
|
78
|
+
findChannel(id: string, minVersion?: string): ChannelDefinition | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Find channels paired with the given channel
|
|
81
|
+
*
|
|
82
|
+
* @param channel Channel to find pairs for
|
|
83
|
+
* @returns Array of paired channel definitions
|
|
84
|
+
*/
|
|
85
|
+
findPair(channel: ChannelDefinition): ChannelDefinition[];
|
|
86
|
+
/**
|
|
87
|
+
* Subscribe to a channel
|
|
88
|
+
*
|
|
89
|
+
* @param channel Channel name
|
|
90
|
+
* @param handler Message handler function
|
|
91
|
+
* @returns Unsubscribe function
|
|
92
|
+
* @throws AgencyError if channel doesn't exist
|
|
93
|
+
*/
|
|
94
|
+
subscribe<T>(channel: string, handler: MessageHandler<T>): Unsubscribe;
|
|
95
|
+
/**
|
|
96
|
+
* Send a message to a channel with async parallel delivery
|
|
97
|
+
*
|
|
98
|
+
* @param channel Channel name
|
|
99
|
+
* @param message Message envelope to send
|
|
100
|
+
* @returns Delivery result with success count and any errors
|
|
101
|
+
* @throws AgencyError if channel doesn't exist or all handlers fail
|
|
102
|
+
*/
|
|
103
|
+
send<T>(channel: string, message: MessageEnvelope<T>): Promise<DeliveryResult>;
|
|
104
|
+
/**
|
|
105
|
+
* Convenience method to send a message with auto-generated envelope
|
|
106
|
+
*
|
|
107
|
+
* @param channel Channel name
|
|
108
|
+
* @param sender Sender plugin ID
|
|
109
|
+
* @param payload Message payload
|
|
110
|
+
* @param correlationId Optional correlation ID
|
|
111
|
+
* @returns Delivery result with success count and any errors
|
|
112
|
+
*/
|
|
113
|
+
sendMessage<T>(channel: string, sender: string, payload: T, correlationId?: string): Promise<DeliveryResult>;
|
|
114
|
+
/**
|
|
115
|
+
* Default timeout for sendAndWait in milliseconds
|
|
116
|
+
*/
|
|
117
|
+
private static readonly DEFAULT_TIMEOUT;
|
|
118
|
+
/**
|
|
119
|
+
* Send a message and wait for a response with matching correlation ID
|
|
120
|
+
*
|
|
121
|
+
* @param channelId Channel to send to
|
|
122
|
+
* @param message Message envelope to send
|
|
123
|
+
* @param timeout Timeout in milliseconds (default: 30000)
|
|
124
|
+
* @returns Promise that resolves with the response message
|
|
125
|
+
* @throws AgencyError if channel doesn't exist or timeout occurs
|
|
126
|
+
*/
|
|
127
|
+
sendAndWait<T, R = unknown>(channelId: string, message: MessageEnvelope<T>, timeout?: number): Promise<MessageEnvelope<R>>;
|
|
128
|
+
/**
|
|
129
|
+
* Get the number of subscribers for a channel
|
|
130
|
+
*
|
|
131
|
+
* @param channel Channel name
|
|
132
|
+
* @returns Number of subscribers or 0 if channel doesn't exist
|
|
133
|
+
*/
|
|
134
|
+
getSubscriberCount(channel: string): number;
|
|
135
|
+
/**
|
|
136
|
+
* Get the message count for a channel
|
|
137
|
+
*
|
|
138
|
+
* @param channel Channel name
|
|
139
|
+
* @returns Number of messages sent or 0 if channel doesn't exist
|
|
140
|
+
*/
|
|
141
|
+
getMessageCount(channel: string): number;
|
|
142
|
+
/**
|
|
143
|
+
* Get all channels registered by a specific owner
|
|
144
|
+
*
|
|
145
|
+
* @param owner Owner plugin ID
|
|
146
|
+
* @returns Array of channel definitions
|
|
147
|
+
*/
|
|
148
|
+
getChannelsByOwner(owner: string): ChannelDefinition[];
|
|
149
|
+
/**
|
|
150
|
+
* Unregister all channels owned by a plugin
|
|
151
|
+
*
|
|
152
|
+
* @param owner Owner plugin ID
|
|
153
|
+
* @returns Number of channels removed
|
|
154
|
+
*/
|
|
155
|
+
unregisterChannelsByOwner(owner: string): number;
|
|
156
|
+
/**
|
|
157
|
+
* Clear all channels
|
|
158
|
+
*/
|
|
159
|
+
clear(): void;
|
|
160
|
+
/**
|
|
161
|
+
* Register all built-in Agency channels
|
|
162
|
+
*
|
|
163
|
+
* This should be called during Agency initialization to set up
|
|
164
|
+
* the standard channels for lifecycle, mode, telemetry, and bridging.
|
|
165
|
+
*/
|
|
166
|
+
registerBuiltInChannels(): void;
|
|
167
|
+
/**
|
|
168
|
+
* Get statistics about all channels
|
|
169
|
+
*
|
|
170
|
+
* @returns Object with channel statistics
|
|
171
|
+
*/
|
|
172
|
+
getStats(): {
|
|
173
|
+
totalChannels: number;
|
|
174
|
+
totalSubscribers: number;
|
|
175
|
+
totalMessages: number;
|
|
176
|
+
channelStats: Array<{
|
|
177
|
+
name: string;
|
|
178
|
+
owner: string;
|
|
179
|
+
subscribers: number;
|
|
180
|
+
messages: number;
|
|
181
|
+
}>;
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/channels/manager.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAiC,cAAc,EAAE,MAAM,YAAY,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OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAS;IAEhD;;;;;;;;OAQG;IACG,WAAW,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,EAC9B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC,EAC3B,OAAO,GAAE,MAAuC,GAC/C,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IA0D9B;;;;;OAKG;IACH,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAI3C;;;;;OAKG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAIxC;;;;;OAKG;IACH,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB,EAAE;IAMtD;;;;;OAKG;IACH,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAWhD;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;;;;OAKG;IACH,uBAAuB,IAAI,IAAI;IAQ/B;;;;OAIG;IACH,QAAQ,IAAI;QACV,aAAa,EAAE,MAAM,CAAC;QACtB,gBAAgB,EAAE,MAAM,CAAC;QACzB,aAAa,EAAE,MAAM,CAAC;QACtB,YAAY,EAAE,KAAK,CAAC;YAClB,IAAI,EAAE,MAAM,CAAC;YACb,KAAK,EAAE,MAAM,CAAC;YACd,WAAW,EAAE,MAAM,CAAC;YACpB,QAAQ,EAAE,MAAM,CAAC;SAClB,CAAC,CAAC;KACJ;CA4BF"}
|
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Channel Manager for Agency
|
|
3
|
+
*
|
|
4
|
+
* Manages inter-plugin communication channels using a pub/sub pattern.
|
|
5
|
+
* Channels are registered by plugins and can be used for decoupled messaging.
|
|
6
|
+
*/
|
|
7
|
+
import { AgencyError, ErrorCodes } from '../errors/index.js';
|
|
8
|
+
import { createMessageEnvelope } from './types.js';
|
|
9
|
+
import { isVersionCompatible } from './version.js';
|
|
10
|
+
/**
|
|
11
|
+
* Channel manager error codes (re-export for convenience)
|
|
12
|
+
*/
|
|
13
|
+
export const ChannelErrorCodes = {
|
|
14
|
+
CHANNEL_NOT_FOUND: ErrorCodes.CHANNEL_NOT_FOUND,
|
|
15
|
+
CHANNEL_ALREADY_EXISTS: ErrorCodes.CHANNEL_ALREADY_REGISTERED,
|
|
16
|
+
CHANNEL_VERSION_MISMATCH: ErrorCodes.CHANNEL_VERSION_MISMATCH,
|
|
17
|
+
CHANNEL_TIMEOUT: ErrorCodes.CHANNEL_TIMEOUT,
|
|
18
|
+
CHANNEL_DELIVERY_FAILED: ErrorCodes.CHANNEL_DELIVERY_FAILED,
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Built-in channel definitions
|
|
22
|
+
*/
|
|
23
|
+
export const BUILT_IN_CHANNELS = [
|
|
24
|
+
{
|
|
25
|
+
name: 'agency.lifecycle',
|
|
26
|
+
version: '1.0.0',
|
|
27
|
+
description: 'Plugin lifecycle events (start, stop, reload)',
|
|
28
|
+
owner: '@generacy-ai/agency',
|
|
29
|
+
messageTypes: ['start', 'stop', 'reload'],
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'agency.mode',
|
|
33
|
+
version: '1.0.0',
|
|
34
|
+
description: 'Mode change notifications',
|
|
35
|
+
owner: '@generacy-ai/agency',
|
|
36
|
+
messageTypes: ['change'],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'agency.telemetry',
|
|
40
|
+
version: '1.0.0',
|
|
41
|
+
description: 'Telemetry event aggregation',
|
|
42
|
+
owner: '@generacy-ai/agency',
|
|
43
|
+
messageTypes: ['event', 'metric'],
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'agency.humancy',
|
|
47
|
+
version: '1.0.0',
|
|
48
|
+
description: 'Bridge to Humancy component',
|
|
49
|
+
owner: '@generacy-ai/agency',
|
|
50
|
+
messageTypes: ['*'],
|
|
51
|
+
pairedWith: {
|
|
52
|
+
component: 'humancy',
|
|
53
|
+
channelId: 'humancy.agency',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
/**
|
|
58
|
+
* Channel Manager for inter-plugin communication
|
|
59
|
+
*
|
|
60
|
+
* Provides a simple pub/sub mechanism for plugins to communicate
|
|
61
|
+
* without direct coupling.
|
|
62
|
+
*/
|
|
63
|
+
export class ChannelManager {
|
|
64
|
+
channels = new Map();
|
|
65
|
+
/**
|
|
66
|
+
* Register a new communication channel
|
|
67
|
+
*
|
|
68
|
+
* @param channel Channel definition
|
|
69
|
+
* @throws AgencyError if channel already exists
|
|
70
|
+
*/
|
|
71
|
+
registerChannel(channel) {
|
|
72
|
+
if (this.channels.has(channel.name)) {
|
|
73
|
+
throw new AgencyError(ErrorCodes.CHANNEL_ALREADY_REGISTERED, `Channel already exists: ${channel.name}`, { channelName: channel.name, existingOwner: this.channels.get(channel.name)?.definition.owner });
|
|
74
|
+
}
|
|
75
|
+
this.channels.set(channel.name, {
|
|
76
|
+
definition: channel,
|
|
77
|
+
subscribers: new Set(),
|
|
78
|
+
messageCount: 0,
|
|
79
|
+
pendingResponses: new Map(),
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Unregister a channel
|
|
84
|
+
*
|
|
85
|
+
* @param name Channel name to unregister
|
|
86
|
+
* @returns true if channel was found and removed
|
|
87
|
+
*/
|
|
88
|
+
unregisterChannel(name) {
|
|
89
|
+
return this.channels.delete(name);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Check if a channel exists
|
|
93
|
+
*
|
|
94
|
+
* @param name Channel name
|
|
95
|
+
* @returns true if channel is registered
|
|
96
|
+
*/
|
|
97
|
+
hasChannel(name) {
|
|
98
|
+
return this.channels.has(name);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Get channel definition
|
|
102
|
+
*
|
|
103
|
+
* @param name Channel name
|
|
104
|
+
* @returns Channel definition or undefined
|
|
105
|
+
*/
|
|
106
|
+
getChannel(name) {
|
|
107
|
+
return this.channels.get(name)?.definition;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Get all registered channel names
|
|
111
|
+
*
|
|
112
|
+
* @returns Array of channel names
|
|
113
|
+
*/
|
|
114
|
+
getChannelNames() {
|
|
115
|
+
return [...this.channels.keys()];
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Get all registered channel definitions
|
|
119
|
+
*
|
|
120
|
+
* @returns Array of channel definitions
|
|
121
|
+
*/
|
|
122
|
+
getChannels() {
|
|
123
|
+
return [...this.channels.values()].map((state) => state.definition);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Find a channel by ID with optional version filtering
|
|
127
|
+
*
|
|
128
|
+
* @param id Channel ID to find
|
|
129
|
+
* @param minVersion Minimum required version (optional)
|
|
130
|
+
* @returns Channel definition if found and version compatible, undefined otherwise
|
|
131
|
+
*/
|
|
132
|
+
findChannel(id, minVersion) {
|
|
133
|
+
const state = this.channels.get(id);
|
|
134
|
+
if (!state) {
|
|
135
|
+
return undefined;
|
|
136
|
+
}
|
|
137
|
+
if (minVersion) {
|
|
138
|
+
const channelVersion = state.definition.version;
|
|
139
|
+
if (!channelVersion || !isVersionCompatible(channelVersion, minVersion)) {
|
|
140
|
+
return undefined;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return state.definition;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Find channels paired with the given channel
|
|
147
|
+
*
|
|
148
|
+
* @param channel Channel to find pairs for
|
|
149
|
+
* @returns Array of paired channel definitions
|
|
150
|
+
*/
|
|
151
|
+
findPair(channel) {
|
|
152
|
+
const pairs = [];
|
|
153
|
+
for (const state of this.channels.values()) {
|
|
154
|
+
const def = state.definition;
|
|
155
|
+
// Check if this channel is paired with the input channel
|
|
156
|
+
if (def.pairedWith &&
|
|
157
|
+
def.pairedWith.channelId === channel.name) {
|
|
158
|
+
pairs.push(def);
|
|
159
|
+
}
|
|
160
|
+
// Also check if input channel is paired with this channel
|
|
161
|
+
if (channel.pairedWith &&
|
|
162
|
+
channel.pairedWith.channelId === def.name) {
|
|
163
|
+
if (!pairs.includes(def)) {
|
|
164
|
+
pairs.push(def);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return pairs;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Subscribe to a channel
|
|
172
|
+
*
|
|
173
|
+
* @param channel Channel name
|
|
174
|
+
* @param handler Message handler function
|
|
175
|
+
* @returns Unsubscribe function
|
|
176
|
+
* @throws AgencyError if channel doesn't exist
|
|
177
|
+
*/
|
|
178
|
+
subscribe(channel, handler) {
|
|
179
|
+
const state = this.channels.get(channel);
|
|
180
|
+
if (!state) {
|
|
181
|
+
throw new AgencyError(ErrorCodes.CHANNEL_NOT_FOUND, `Channel not found: ${channel}`, { channelName: channel });
|
|
182
|
+
}
|
|
183
|
+
state.subscribers.add(handler);
|
|
184
|
+
return () => {
|
|
185
|
+
state.subscribers.delete(handler);
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Send a message to a channel with async parallel delivery
|
|
190
|
+
*
|
|
191
|
+
* @param channel Channel name
|
|
192
|
+
* @param message Message envelope to send
|
|
193
|
+
* @returns Delivery result with success count and any errors
|
|
194
|
+
* @throws AgencyError if channel doesn't exist or all handlers fail
|
|
195
|
+
*/
|
|
196
|
+
async send(channel, message) {
|
|
197
|
+
const state = this.channels.get(channel);
|
|
198
|
+
if (!state) {
|
|
199
|
+
throw new AgencyError(ErrorCodes.CHANNEL_NOT_FOUND, `Channel not found: ${channel}`, { channelName: channel });
|
|
200
|
+
}
|
|
201
|
+
state.messageCount++;
|
|
202
|
+
// Check for response to pending sendAndWait
|
|
203
|
+
// Only intercept if this is a RESPONSE (different message ID than the original request)
|
|
204
|
+
if (message.correlationId) {
|
|
205
|
+
const pending = state.pendingResponses.get(message.correlationId);
|
|
206
|
+
// Only resolve if this is a response (different message ID than the original request)
|
|
207
|
+
if (pending && message.id !== pending.requestMessageId) {
|
|
208
|
+
clearTimeout(pending.timeoutId);
|
|
209
|
+
state.pendingResponses.delete(message.correlationId);
|
|
210
|
+
pending.resolve(message);
|
|
211
|
+
// Response messages are not delivered to subscribers to avoid infinite loops
|
|
212
|
+
return { successCount: 0, errors: [] };
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
// Parallel delivery to all subscribers
|
|
216
|
+
const errors = [];
|
|
217
|
+
let successCount = 0;
|
|
218
|
+
const results = await Promise.allSettled([...state.subscribers].map(async (handler, index) => {
|
|
219
|
+
try {
|
|
220
|
+
await handler(message);
|
|
221
|
+
return { success: true, index };
|
|
222
|
+
}
|
|
223
|
+
catch (error) {
|
|
224
|
+
return { success: false, index, error: error };
|
|
225
|
+
}
|
|
226
|
+
}));
|
|
227
|
+
for (const result of results) {
|
|
228
|
+
if (result.status === 'fulfilled') {
|
|
229
|
+
if (result.value.success) {
|
|
230
|
+
successCount++;
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
errors.push({
|
|
234
|
+
handler: `handler_${result.value.index}`,
|
|
235
|
+
error: result.value.error,
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
// Promise.allSettled should not reject, but handle just in case
|
|
241
|
+
errors.push({
|
|
242
|
+
handler: 'unknown',
|
|
243
|
+
error: result.reason,
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
// If all handlers failed and there were handlers, throw an aggregate error
|
|
248
|
+
if (errors.length > 0 && successCount === 0 && state.subscribers.size > 0) {
|
|
249
|
+
throw new AgencyError(ErrorCodes.CHANNEL_DELIVERY_FAILED, `All message handlers failed for channel: ${channel}`, { channelName: channel, errorCount: errors.length });
|
|
250
|
+
}
|
|
251
|
+
return { successCount, errors };
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Convenience method to send a message with auto-generated envelope
|
|
255
|
+
*
|
|
256
|
+
* @param channel Channel name
|
|
257
|
+
* @param sender Sender plugin ID
|
|
258
|
+
* @param payload Message payload
|
|
259
|
+
* @param correlationId Optional correlation ID
|
|
260
|
+
* @returns Delivery result with success count and any errors
|
|
261
|
+
*/
|
|
262
|
+
async sendMessage(channel, sender, payload, correlationId) {
|
|
263
|
+
const envelope = createMessageEnvelope({
|
|
264
|
+
channel,
|
|
265
|
+
sender,
|
|
266
|
+
payload,
|
|
267
|
+
correlationId,
|
|
268
|
+
});
|
|
269
|
+
return this.send(channel, envelope);
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Default timeout for sendAndWait in milliseconds
|
|
273
|
+
*/
|
|
274
|
+
static DEFAULT_TIMEOUT = 30000;
|
|
275
|
+
/**
|
|
276
|
+
* Send a message and wait for a response with matching correlation ID
|
|
277
|
+
*
|
|
278
|
+
* @param channelId Channel to send to
|
|
279
|
+
* @param message Message envelope to send
|
|
280
|
+
* @param timeout Timeout in milliseconds (default: 30000)
|
|
281
|
+
* @returns Promise that resolves with the response message
|
|
282
|
+
* @throws AgencyError if channel doesn't exist or timeout occurs
|
|
283
|
+
*/
|
|
284
|
+
async sendAndWait(channelId, message, timeout = ChannelManager.DEFAULT_TIMEOUT) {
|
|
285
|
+
const state = this.channels.get(channelId);
|
|
286
|
+
if (!state) {
|
|
287
|
+
throw new AgencyError(ErrorCodes.CHANNEL_NOT_FOUND, `Channel not found: ${channelId}`, { channelName: channelId });
|
|
288
|
+
}
|
|
289
|
+
// Ensure message has a correlation ID
|
|
290
|
+
const correlationId = message.correlationId || crypto.randomUUID();
|
|
291
|
+
const messageWithCorrelation = {
|
|
292
|
+
...message,
|
|
293
|
+
correlationId,
|
|
294
|
+
};
|
|
295
|
+
// Set up response promise and pending entry
|
|
296
|
+
let resolveFn;
|
|
297
|
+
let rejectFn;
|
|
298
|
+
const responsePromise = new Promise((resolve, reject) => {
|
|
299
|
+
resolveFn = resolve;
|
|
300
|
+
rejectFn = reject;
|
|
301
|
+
});
|
|
302
|
+
const timeoutId = setTimeout(() => {
|
|
303
|
+
state.pendingResponses.delete(correlationId);
|
|
304
|
+
rejectFn(new AgencyError(ErrorCodes.CHANNEL_TIMEOUT, `Timeout waiting for response on channel: ${channelId}`, { channelName: channelId, correlationId, timeoutMs: timeout }));
|
|
305
|
+
}, timeout);
|
|
306
|
+
const pending = {
|
|
307
|
+
resolve: resolveFn,
|
|
308
|
+
reject: rejectFn,
|
|
309
|
+
timeoutId,
|
|
310
|
+
requestMessageId: messageWithCorrelation.id,
|
|
311
|
+
};
|
|
312
|
+
// Register the pending response BEFORE sending
|
|
313
|
+
// The send() method will check for this correlation ID only for RESPONSE messages
|
|
314
|
+
// (those with a different message ID than the original request)
|
|
315
|
+
state.pendingResponses.set(correlationId, pending);
|
|
316
|
+
// Send the message - this triggers handlers which may respond
|
|
317
|
+
// The handler response will use the same correlationId, which will be
|
|
318
|
+
// caught by the pending response check in send()
|
|
319
|
+
await this.send(channelId, messageWithCorrelation);
|
|
320
|
+
// Wait for response
|
|
321
|
+
return responsePromise;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Get the number of subscribers for a channel
|
|
325
|
+
*
|
|
326
|
+
* @param channel Channel name
|
|
327
|
+
* @returns Number of subscribers or 0 if channel doesn't exist
|
|
328
|
+
*/
|
|
329
|
+
getSubscriberCount(channel) {
|
|
330
|
+
return this.channels.get(channel)?.subscribers.size ?? 0;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Get the message count for a channel
|
|
334
|
+
*
|
|
335
|
+
* @param channel Channel name
|
|
336
|
+
* @returns Number of messages sent or 0 if channel doesn't exist
|
|
337
|
+
*/
|
|
338
|
+
getMessageCount(channel) {
|
|
339
|
+
return this.channels.get(channel)?.messageCount ?? 0;
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Get all channels registered by a specific owner
|
|
343
|
+
*
|
|
344
|
+
* @param owner Owner plugin ID
|
|
345
|
+
* @returns Array of channel definitions
|
|
346
|
+
*/
|
|
347
|
+
getChannelsByOwner(owner) {
|
|
348
|
+
return [...this.channels.values()]
|
|
349
|
+
.filter((state) => state.definition.owner === owner)
|
|
350
|
+
.map((state) => state.definition);
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Unregister all channels owned by a plugin
|
|
354
|
+
*
|
|
355
|
+
* @param owner Owner plugin ID
|
|
356
|
+
* @returns Number of channels removed
|
|
357
|
+
*/
|
|
358
|
+
unregisterChannelsByOwner(owner) {
|
|
359
|
+
let count = 0;
|
|
360
|
+
for (const [name, state] of this.channels) {
|
|
361
|
+
if (state.definition.owner === owner) {
|
|
362
|
+
this.channels.delete(name);
|
|
363
|
+
count++;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
return count;
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Clear all channels
|
|
370
|
+
*/
|
|
371
|
+
clear() {
|
|
372
|
+
this.channels.clear();
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Register all built-in Agency channels
|
|
376
|
+
*
|
|
377
|
+
* This should be called during Agency initialization to set up
|
|
378
|
+
* the standard channels for lifecycle, mode, telemetry, and bridging.
|
|
379
|
+
*/
|
|
380
|
+
registerBuiltInChannels() {
|
|
381
|
+
for (const channel of BUILT_IN_CHANNELS) {
|
|
382
|
+
if (!this.channels.has(channel.name)) {
|
|
383
|
+
this.registerChannel(channel);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Get statistics about all channels
|
|
389
|
+
*
|
|
390
|
+
* @returns Object with channel statistics
|
|
391
|
+
*/
|
|
392
|
+
getStats() {
|
|
393
|
+
let totalSubscribers = 0;
|
|
394
|
+
let totalMessages = 0;
|
|
395
|
+
const channelStats = [];
|
|
396
|
+
for (const [name, state] of this.channels) {
|
|
397
|
+
totalSubscribers += state.subscribers.size;
|
|
398
|
+
totalMessages += state.messageCount;
|
|
399
|
+
channelStats.push({
|
|
400
|
+
name,
|
|
401
|
+
owner: state.definition.owner,
|
|
402
|
+
subscribers: state.subscribers.size,
|
|
403
|
+
messages: state.messageCount,
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
return {
|
|
407
|
+
totalChannels: this.channels.size,
|
|
408
|
+
totalSubscribers,
|
|
409
|
+
totalMessages,
|
|
410
|
+
channelStats,
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
//# sourceMappingURL=manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.js","sourceRoot":"","sources":["../../src/channels/manager.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAG7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,iBAAiB,EAAE,UAAU,CAAC,iBAAiB;IAC/C,sBAAsB,EAAE,UAAU,CAAC,0BAA0B;IAC7D,wBAAwB,EAAE,UAAU,CAAC,wBAAwB;IAC7D,eAAe,EAAE,UAAU,CAAC,eAAe;IAC3C,uBAAuB,EAAE,UAAU,CAAC,uBAAuB;CACnD,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAwB;IACpD;QACE,IAAI,EAAE,kBAAkB;QACxB,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE,+CAA+C;QAC5D,KAAK,EAAE,qBAAqB;QAC5B,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC;KAC1C;IACD;QACE,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE,2BAA2B;Q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