@ai-setting/roy-agent-core 1.7.64 → 1.7.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/env/environment.d.ts +27 -0
  2. package/dist/env/event-source/event-source-handlers.js +3 -2
  3. package/dist/env/event-source/index.js +4 -3
  4. package/dist/env/index.js +7 -6
  5. package/dist/env/task/delegate/delegate-tool.d.ts +2 -2
  6. package/dist/env/task/hooks/contexts.d.ts +34 -0
  7. package/dist/env/task/hooks/verdict.d.ts +170 -0
  8. package/dist/env/task/index.js +3 -2
  9. package/dist/env/task/mcp/index.js +2 -1
  10. package/dist/env/task/plugins/__e2e__/laya-chain-validate.d.ts +15 -0
  11. package/dist/env/task/plugins/__e2e__/laya-decision-branches.d.ts +18 -0
  12. package/dist/env/task/plugins/__e2e__/laya-decision-e2e-live.d.ts +27 -0
  13. package/dist/env/task/plugins/__e2e__/laya-e2e-verify.d.ts +17 -0
  14. package/dist/env/task/plugins/decision-hint-plugin.d.ts +144 -0
  15. package/dist/env/task/plugins/decision-port.d.ts +119 -0
  16. package/dist/env/task/plugins/decision-renderers.d.ts +33 -0
  17. package/dist/env/task/plugins/index.d.ts +1 -0
  18. package/dist/env/task/plugins/index.js +8 -1
  19. package/dist/env/task/plugins/laya-decision-plugin.d.ts +136 -0
  20. package/dist/env/task/plugins/laya-port.d.ts +143 -0
  21. package/dist/env/task/plugins/laya-render.d.ts +100 -0
  22. package/dist/env/task/tools/index.js +2 -1
  23. package/dist/index.js +7 -6
  24. package/dist/shared/@ai-setting/{roy-agent-core-1h5bbqcg.js → roy-agent-core-18am1h07.js} +1 -1
  25. package/dist/shared/@ai-setting/{roy-agent-core-vncwfzw5.js → roy-agent-core-6z412atw.js} +39 -2
  26. package/dist/shared/@ai-setting/{roy-agent-core-vd9zak15.js → roy-agent-core-e42v9bcq.js} +1 -1
  27. package/dist/shared/@ai-setting/{roy-agent-core-ry2eztft.js → roy-agent-core-f6c0nadn.js} +958 -94
  28. package/dist/shared/@ai-setting/{roy-agent-core-e4hehcdr.js → roy-agent-core-hmdcz3g9.js} +3 -2
  29. package/dist/shared/@ai-setting/{roy-agent-core-xw4wsj38.js → roy-agent-core-t0ktaevq.js} +48 -2
  30. package/dist/shared/@ai-setting/roy-agent-core-tr3ep81v.js +397 -0
  31. package/package.json +1 -1
@@ -1,6 +1,10 @@
1
1
  import {
2
- createAutoTaskPlugin
3
- } from "./roy-agent-core-ry2eztft.js";
2
+ createAutoTaskPlugin,
3
+ createLayaDecisionPlugin
4
+ } from "./roy-agent-core-f6c0nadn.js";
5
+ import {
6
+ TaskHookPoints
7
+ } from "./roy-agent-core-1pg0fepg.js";
4
8
  import {
5
9
  ContextError,
6
10
  ErrorCodes
@@ -55,6 +59,33 @@ init_env_context();
55
59
  import * as fsSync from "fs";
56
60
  import * as path from "path";
57
61
  var logger = createLogger("environment");
62
+ function registerLayaDecisionTaskHook(taskComponent, options) {
63
+ if (!taskComponent) {
64
+ logger.warn("[registerLayaDecisionTaskHook] TaskComponent not available — skip (fail-open)");
65
+ return false;
66
+ }
67
+ try {
68
+ const hook = createLayaDecisionPlugin(options);
69
+ taskComponent.unregisterHook(TaskHookPoints.BEFORE_CREATE, hook.name);
70
+ taskComponent.registerHook(TaskHookPoints.BEFORE_CREATE, {
71
+ name: hook.name,
72
+ priority: hook.priority,
73
+ execute: async (ctx) => {
74
+ try {
75
+ const data = ctx && typeof ctx === "object" && "data" in ctx ? ctx.data : ctx;
76
+ await hook.execute(data);
77
+ } catch (err) {
78
+ logger.warn(`[registerLayaDecisionTaskHook] hook execution failed (ignored): ${err?.message}`);
79
+ }
80
+ }
81
+ });
82
+ logger.info(`[registerLayaDecisionTaskHook] registered hook "${hook.name}" at ${TaskHookPoints.BEFORE_CREATE} (priority=${hook.priority})`);
83
+ return true;
84
+ } catch (err) {
85
+ logger.warn(`[registerLayaDecisionTaskHook] registration failed (ignored): ${err?.message}`);
86
+ return false;
87
+ }
88
+ }
58
89
  var DEFAULT_AGENT_NAME = "Roy";
59
90
  function injectAgentNamePlaceholder(prompt, context) {
60
91
  if (!prompt.includes("{{agent_name}}")) {
@@ -251,6 +282,12 @@ class BaseEnvironment extends BaseComponent {
251
282
  }
252
283
  logger.debug(`[handle_query] Injected memory/workspace_dir for existing agent: ${agentName}`);
253
284
  }
285
+ try {
286
+ const taskComponent = this.getComponent("task");
287
+ registerLayaDecisionTaskHook(taskComponent);
288
+ } catch (err) {
289
+ logger.warn(`[handle_query] Failed to register LayaDecisionTaskHook: ${err}`);
290
+ }
254
291
  const result = await agentComponent.run(agent.name, query, context);
255
292
  if (result.error) {
256
293
  if (result.originalError instanceof ContextError) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  builtInHandlers
3
- } from "./roy-agent-core-1h5bbqcg.js";
3
+ } from "./roy-agent-core-18am1h07.js";
4
4
  import {
5
5
  envKeyToConfigKey
6
6
  } from "./roy-agent-core-7hh0brvs.js";