@zhin.js/service-activity-feedback 2.0.1 → 2.0.2
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/package.json +7 -7
- package/plugin.js +35 -0
- package/plugin.ts +0 -51
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/service-activity-feedback",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Activity Feedback 服务插件(Plugin Runtime)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"./package.json": "./package.json"
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
|
-
"plugin.
|
|
17
|
+
"plugin.js",
|
|
18
18
|
"schema.json",
|
|
19
19
|
"src",
|
|
20
20
|
"lib",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"directory": "plugins/services/activity-feedback"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@zhin.js/agent": "1.0.
|
|
39
|
+
"@zhin.js/agent": "1.0.7",
|
|
40
40
|
"@zhin.js/logger": "1.0.75",
|
|
41
41
|
"@zhin.js/plugin-runtime": "1.1.1"
|
|
42
42
|
},
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"@types/node": "^26.1.0",
|
|
45
45
|
"typescript": "^6.0.3",
|
|
46
46
|
"vitest": "^4.1.10",
|
|
47
|
-
"zhin.js": "5.0.
|
|
47
|
+
"zhin.js": "5.0.2"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@zhin.js/agent": "1.0.
|
|
51
|
-
"zhin.js": "5.0.
|
|
50
|
+
"@zhin.js/agent": "1.0.7",
|
|
51
|
+
"zhin.js": "5.0.2"
|
|
52
52
|
},
|
|
53
53
|
"peerDependenciesMeta": {
|
|
54
54
|
"zhin.js": {
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"zhin": {
|
|
62
62
|
"protocol": 1,
|
|
63
63
|
"type": "plugin",
|
|
64
|
-
"entry": "./plugin.
|
|
64
|
+
"entry": "./plugin.js",
|
|
65
65
|
"engine": "^1.0.0",
|
|
66
66
|
"runtime": "trusted",
|
|
67
67
|
"features": [],
|
package/plugin.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { definePlugin, outboundHostToken } from '@zhin.js/plugin-runtime';
|
|
3
|
+
import { getLogger } from '@zhin.js/logger';
|
|
4
|
+
import { loadActivityFeedbackServiceConfig, } from "./lib/config.js";
|
|
5
|
+
import { bindActivityFeedbackToAIEventBus, createActivityFeedbackOrchestratorForRuntime, } from "./lib/ai-event-binder.js";
|
|
6
|
+
import { createNoopEndpointAccess, createOutboundEndpointAccess, } from "./lib/executor.js";
|
|
7
|
+
const logger = getLogger('activity-feedback');
|
|
8
|
+
/**
|
|
9
|
+
* Activity Feedback service — Plugin Runtime entry.
|
|
10
|
+
*
|
|
11
|
+
* Subscribes AI lifecycle events via `activityFeedbackAiBus`.
|
|
12
|
+
* When Root provides `outboundHostToken`, typing/status text uses
|
|
13
|
+
* ImRuntime.sendEndpointMessage; otherwise phases no-op.
|
|
14
|
+
*/
|
|
15
|
+
export default definePlugin({
|
|
16
|
+
name: 'activity-feedback',
|
|
17
|
+
metadata: {
|
|
18
|
+
displayName: 'Activity Feedback',
|
|
19
|
+
},
|
|
20
|
+
setup(context) {
|
|
21
|
+
const serviceConfig = loadActivityFeedbackServiceConfig(context.config.get());
|
|
22
|
+
if (serviceConfig.enabled === false) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const access = context.resources.has(outboundHostToken)
|
|
26
|
+
? createOutboundEndpointAccess(context.resources.use(outboundHostToken), logger)
|
|
27
|
+
: createNoopEndpointAccess();
|
|
28
|
+
const orchestrator = createActivityFeedbackOrchestratorForRuntime(serviceConfig, logger, access);
|
|
29
|
+
const dispose = bindActivityFeedbackToAIEventBus(orchestrator);
|
|
30
|
+
context.lifecycle.add(() => {
|
|
31
|
+
logger.debug('[ActivityFeedback] Disposing Runtime AI event binder');
|
|
32
|
+
dispose();
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
});
|
package/plugin.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { definePlugin, outboundHostToken } from '@zhin.js/plugin-runtime';
|
|
2
|
-
import { getLogger } from '@zhin.js/logger';
|
|
3
|
-
import {
|
|
4
|
-
loadActivityFeedbackServiceConfig,
|
|
5
|
-
type ActivityFeedbackServiceConfig,
|
|
6
|
-
} from './src/config.js';
|
|
7
|
-
import {
|
|
8
|
-
bindActivityFeedbackToAIEventBus,
|
|
9
|
-
createActivityFeedbackOrchestratorForRuntime,
|
|
10
|
-
} from './src/ai-event-binder.js';
|
|
11
|
-
import {
|
|
12
|
-
createNoopEndpointAccess,
|
|
13
|
-
createOutboundEndpointAccess,
|
|
14
|
-
} from './src/executor.js';
|
|
15
|
-
|
|
16
|
-
const logger = getLogger('activity-feedback');
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Activity Feedback service — Plugin Runtime entry.
|
|
20
|
-
*
|
|
21
|
-
* Subscribes AI lifecycle events via `activityFeedbackAiBus`.
|
|
22
|
-
* When Root provides `outboundHostToken`, typing/status text uses
|
|
23
|
-
* ImRuntime.sendEndpointMessage; otherwise phases no-op.
|
|
24
|
-
*/
|
|
25
|
-
export default definePlugin<ActivityFeedbackServiceConfig>({
|
|
26
|
-
name: 'activity-feedback',
|
|
27
|
-
metadata: {
|
|
28
|
-
displayName: 'Activity Feedback',
|
|
29
|
-
},
|
|
30
|
-
setup(context) {
|
|
31
|
-
const serviceConfig = loadActivityFeedbackServiceConfig(context.config.get());
|
|
32
|
-
if (serviceConfig.enabled === false) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const access = context.resources.has(outboundHostToken)
|
|
37
|
-
? createOutboundEndpointAccess(context.resources.use(outboundHostToken), logger)
|
|
38
|
-
: createNoopEndpointAccess();
|
|
39
|
-
|
|
40
|
-
const orchestrator = createActivityFeedbackOrchestratorForRuntime(
|
|
41
|
-
serviceConfig,
|
|
42
|
-
logger,
|
|
43
|
-
access,
|
|
44
|
-
);
|
|
45
|
-
const dispose = bindActivityFeedbackToAIEventBus(orchestrator);
|
|
46
|
-
context.lifecycle.add(() => {
|
|
47
|
-
logger.debug('[ActivityFeedback] Disposing Runtime AI event binder');
|
|
48
|
-
dispose();
|
|
49
|
-
});
|
|
50
|
-
},
|
|
51
|
-
});
|