@ai-setting/roy-agent-core 1.6.18 → 1.6.19

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.
@@ -11,7 +11,7 @@ import {
11
11
  larkCliHandler,
12
12
  resolveBountyIMSystemPrompt,
13
13
  timerHandler
14
- } from "../../shared/@ai-setting/roy-agent-core-6mz26khm.js";
14
+ } from "../../shared/@ai-setting/roy-agent-core-8wd5awxg.js";
15
15
  import {
16
16
  BUILT_IN_EVENT_SOURCE_TYPES,
17
17
  BUILT_IN_EVENT_SOURCE_TYPE_LIST,
@@ -22,13 +22,13 @@ import {
22
22
  validateEventSourceConfig
23
23
  } from "../../shared/@ai-setting/roy-agent-core-ds5f75pg.js";
24
24
  import"../../shared/@ai-setting/roy-agent-core-1qjgwjjs.js";
25
- import"../../shared/@ai-setting/roy-agent-core-nreqmmtz.js";
25
+ import"../../shared/@ai-setting/roy-agent-core-btp589bw.js";
26
26
  import"../../shared/@ai-setting/roy-agent-core-az13yzmc.js";
27
27
  import"../../shared/@ai-setting/roy-agent-core-1mrc9a1r.js";
28
28
  import"../../shared/@ai-setting/roy-agent-core-bq1gskrf.js";
29
29
  import"../../shared/@ai-setting/roy-agent-core-jrj30vq3.js";
30
30
  import"../../shared/@ai-setting/roy-agent-core-e25xkv53.js";
31
- import"../../shared/@ai-setting/roy-agent-core-65vpkh7x.js";
31
+ import"../../shared/@ai-setting/roy-agent-core-4djnmd86.js";
32
32
  import"../../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
33
33
  import"../../shared/@ai-setting/roy-agent-core-7hh0brvs.js";
34
34
  import"../../shared/@ai-setting/roy-agent-core-akb8mb9v.js";
package/dist/env/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  BaseEnvironment
3
- } from "../shared/@ai-setting/roy-agent-core-vc8e968b.js";
3
+ } from "../shared/@ai-setting/roy-agent-core-m0wy7p0q.js";
4
4
  import {
5
5
  EventSourceComponent,
6
6
  builtInHandlers,
7
7
  larkCliHandler
8
- } from "../shared/@ai-setting/roy-agent-core-6mz26khm.js";
8
+ } from "../shared/@ai-setting/roy-agent-core-8wd5awxg.js";
9
9
  import {
10
10
  EventSourceInitHooks,
11
11
  getDefaultConfigForType,
@@ -17,13 +17,13 @@ import"../shared/@ai-setting/roy-agent-core-1qjgwjjs.js";
17
17
  import {
18
18
  PluginComponent
19
19
  } from "../shared/@ai-setting/roy-agent-core-gc75v3px.js";
20
- import"../shared/@ai-setting/roy-agent-core-nreqmmtz.js";
20
+ import"../shared/@ai-setting/roy-agent-core-btp589bw.js";
21
21
  import"../shared/@ai-setting/roy-agent-core-az13yzmc.js";
22
22
  import {
23
23
  WorkflowComponent
24
- } from "../shared/@ai-setting/roy-agent-core-f6x6ksz3.js";
24
+ } from "../shared/@ai-setting/roy-agent-core-mekk4as5.js";
25
25
  import"../shared/@ai-setting/roy-agent-core-77wfej1h.js";
26
- import"../shared/@ai-setting/roy-agent-core-yr3fp8tv.js";
26
+ import"../shared/@ai-setting/roy-agent-core-f1cjs6c4.js";
27
27
  import"../shared/@ai-setting/roy-agent-core-6atd905e.js";
28
28
  import"../shared/@ai-setting/roy-agent-core-gmnex23m.js";
29
29
  import"../shared/@ai-setting/roy-agent-core-ez91vxas.js";
@@ -48,13 +48,13 @@ import"../shared/@ai-setting/roy-agent-core-ataagh3a.js";
48
48
  import"../shared/@ai-setting/roy-agent-core-e25xkv53.js";
49
49
  import {
50
50
  TaskComponent
51
- } from "../shared/@ai-setting/roy-agent-core-mvmgy9t0.js";
51
+ } from "../shared/@ai-setting/roy-agent-core-5kc9qtej.js";
52
52
  import"../shared/@ai-setting/roy-agent-core-amkqnyzy.js";
53
53
  import"../shared/@ai-setting/roy-agent-core-8gxth0eh.js";
54
- import"../shared/@ai-setting/roy-agent-core-n1fx2fx4.js";
54
+ import"../shared/@ai-setting/roy-agent-core-mqeqevym.js";
55
55
  import"../shared/@ai-setting/roy-agent-core-44g3synv.js";
56
56
  import"../shared/@ai-setting/roy-agent-core-zdzkzx5g.js";
57
- import"../shared/@ai-setting/roy-agent-core-65vpkh7x.js";
57
+ import"../shared/@ai-setting/roy-agent-core-4djnmd86.js";
58
58
  import"../shared/@ai-setting/roy-agent-core-c1v263jn.js";
59
59
  import"../shared/@ai-setting/roy-agent-core-tycbpm17.js";
60
60
  import {
@@ -3,8 +3,8 @@ import {
3
3
  PromptConfigSchema,
4
4
  PromptPathSchema,
5
5
  PromptRenderer
6
- } from "../../shared/@ai-setting/roy-agent-core-h07kk80k.js";
7
- import"../../shared/@ai-setting/roy-agent-core-65vpkh7x.js";
6
+ } from "../../shared/@ai-setting/roy-agent-core-5ka95kh7.js";
7
+ import"../../shared/@ai-setting/roy-agent-core-4djnmd86.js";
8
8
  import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
9
9
  import"../../shared/@ai-setting/roy-agent-core-7hh0brvs.js";
10
10
  import"../../shared/@ai-setting/roy-agent-core-akb8mb9v.js";
@@ -3,9 +3,9 @@ import {
3
3
  BackgroundTaskManager,
4
4
  createDelegateTool,
5
5
  createStopTool
6
- } from "../../../shared/@ai-setting/roy-agent-core-n1fx2fx4.js";
6
+ } from "../../../shared/@ai-setting/roy-agent-core-mqeqevym.js";
7
7
  import"../../../shared/@ai-setting/roy-agent-core-44g3synv.js";
8
- import"../../../shared/@ai-setting/roy-agent-core-65vpkh7x.js";
8
+ import"../../../shared/@ai-setting/roy-agent-core-4djnmd86.js";
9
9
  import"../../../shared/@ai-setting/roy-agent-core-c1v263jn.js";
10
10
  import"../../../shared/@ai-setting/roy-agent-core-tycbpm17.js";
11
11
  import"../../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
@@ -5,18 +5,18 @@ import {
5
5
  TaskPriorityEnum,
6
6
  TaskStatusEnum,
7
7
  TaskTypeEnum
8
- } from "../../shared/@ai-setting/roy-agent-core-mvmgy9t0.js";
8
+ } from "../../shared/@ai-setting/roy-agent-core-5kc9qtej.js";
9
9
  import"../../shared/@ai-setting/roy-agent-core-amkqnyzy.js";
10
10
  import {
11
11
  TaskEntityEventTypes
12
12
  } from "../../shared/@ai-setting/roy-agent-core-8gxth0eh.js";
13
- import"../../shared/@ai-setting/roy-agent-core-n1fx2fx4.js";
13
+ import"../../shared/@ai-setting/roy-agent-core-mqeqevym.js";
14
14
  import"../../shared/@ai-setting/roy-agent-core-44g3synv.js";
15
15
  import {
16
16
  SQLiteTaskStore,
17
17
  getDefaultTaskDbPath
18
18
  } from "../../shared/@ai-setting/roy-agent-core-zdzkzx5g.js";
19
- import"../../shared/@ai-setting/roy-agent-core-65vpkh7x.js";
19
+ import"../../shared/@ai-setting/roy-agent-core-4djnmd86.js";
20
20
  import"../../shared/@ai-setting/roy-agent-core-c1v263jn.js";
21
21
  import"../../shared/@ai-setting/roy-agent-core-tycbpm17.js";
22
22
  import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
@@ -8,13 +8,13 @@ import {
8
8
  formatExtractorInput,
9
9
  formatExtractorInputFromDescription,
10
10
  parseExtractorOutput
11
- } from "../../../shared/@ai-setting/roy-agent-core-nreqmmtz.js";
11
+ } from "../../../shared/@ai-setting/roy-agent-core-btp589bw.js";
12
12
  import"../../../shared/@ai-setting/roy-agent-core-az13yzmc.js";
13
13
  import"../../../shared/@ai-setting/roy-agent-core-1mrc9a1r.js";
14
14
  import"../../../shared/@ai-setting/roy-agent-core-bq1gskrf.js";
15
15
  import"../../../shared/@ai-setting/roy-agent-core-jrj30vq3.js";
16
16
  import"../../../shared/@ai-setting/roy-agent-core-e25xkv53.js";
17
- import"../../../shared/@ai-setting/roy-agent-core-65vpkh7x.js";
17
+ import"../../../shared/@ai-setting/roy-agent-core-4djnmd86.js";
18
18
  import"../../../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
19
19
  import"../../../shared/@ai-setting/roy-agent-core-sqt96sam.js";
20
20
  import"../../../shared/@ai-setting/roy-agent-core-dtkbj8fk.js";
@@ -5,7 +5,7 @@ import {
5
5
  Scheduler,
6
6
  WorkflowEngine,
7
7
  init_engine
8
- } from "../../../shared/@ai-setting/roy-agent-core-yr3fp8tv.js";
8
+ } from "../../../shared/@ai-setting/roy-agent-core-f1cjs6c4.js";
9
9
  import"../../../shared/@ai-setting/roy-agent-core-6atd905e.js";
10
10
  import"../../../shared/@ai-setting/roy-agent-core-gmnex23m.js";
11
11
  import"../../../shared/@ai-setting/roy-agent-core-ez91vxas.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  WorkflowComponent
3
- } from "../../shared/@ai-setting/roy-agent-core-f6x6ksz3.js";
3
+ } from "../../shared/@ai-setting/roy-agent-core-mekk4as5.js";
4
4
  import"../../shared/@ai-setting/roy-agent-core-77wfej1h.js";
5
- import"../../shared/@ai-setting/roy-agent-core-yr3fp8tv.js";
5
+ import"../../shared/@ai-setting/roy-agent-core-f1cjs6c4.js";
6
6
  import"../../shared/@ai-setting/roy-agent-core-6atd905e.js";
7
7
  import"../../shared/@ai-setting/roy-agent-core-gmnex23m.js";
8
8
  import"../../shared/@ai-setting/roy-agent-core-ez91vxas.js";
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  PromptComponent,
3
3
  PromptStore
4
- } from "./shared/@ai-setting/roy-agent-core-h07kk80k.js";
4
+ } from "./shared/@ai-setting/roy-agent-core-5ka95kh7.js";
5
5
  import {
6
6
  LLMComponent,
7
7
  LLMConfigSchema,
@@ -63,7 +63,7 @@ import {
63
63
  BaseEnvironment,
64
64
  generateDescendingId,
65
65
  generateId
66
- } from "./shared/@ai-setting/roy-agent-core-vc8e968b.js";
66
+ } from "./shared/@ai-setting/roy-agent-core-m0wy7p0q.js";
67
67
  import {
68
68
  BountyIMInstance,
69
69
  EventSourceComponent,
@@ -76,7 +76,7 @@ import {
76
76
  larkCliHandler,
77
77
  resolveBountyIMSystemPrompt,
78
78
  timerHandler
79
- } from "./shared/@ai-setting/roy-agent-core-6mz26khm.js";
79
+ } from "./shared/@ai-setting/roy-agent-core-8wd5awxg.js";
80
80
  import {
81
81
  BUILT_IN_EVENT_SOURCE_TYPES,
82
82
  BUILT_IN_EVENT_SOURCE_TYPE_LIST,
@@ -96,18 +96,18 @@ import {
96
96
  import {
97
97
  TaskTagPlugin,
98
98
  createAutoTaskPlugin
99
- } from "./shared/@ai-setting/roy-agent-core-nreqmmtz.js";
99
+ } from "./shared/@ai-setting/roy-agent-core-btp589bw.js";
100
100
  import {
101
101
  BasePlugin
102
102
  } from "./shared/@ai-setting/roy-agent-core-az13yzmc.js";
103
103
  import {
104
104
  WorkflowComponent
105
- } from "./shared/@ai-setting/roy-agent-core-f6x6ksz3.js";
105
+ } from "./shared/@ai-setting/roy-agent-core-mekk4as5.js";
106
106
  import {
107
107
  init_node_registry_helper,
108
108
  registerDecoratorNodeType
109
109
  } from "./shared/@ai-setting/roy-agent-core-77wfej1h.js";
110
- import"./shared/@ai-setting/roy-agent-core-yr3fp8tv.js";
110
+ import"./shared/@ai-setting/roy-agent-core-f1cjs6c4.js";
111
111
  import"./shared/@ai-setting/roy-agent-core-6atd905e.js";
112
112
  import"./shared/@ai-setting/roy-agent-core-gmnex23m.js";
113
113
  import"./shared/@ai-setting/roy-agent-core-ez91vxas.js";
@@ -150,10 +150,10 @@ import {
150
150
  } from "./shared/@ai-setting/roy-agent-core-e25xkv53.js";
151
151
  import {
152
152
  TaskComponent
153
- } from "./shared/@ai-setting/roy-agent-core-mvmgy9t0.js";
153
+ } from "./shared/@ai-setting/roy-agent-core-5kc9qtej.js";
154
154
  import"./shared/@ai-setting/roy-agent-core-amkqnyzy.js";
155
155
  import"./shared/@ai-setting/roy-agent-core-8gxth0eh.js";
156
- import"./shared/@ai-setting/roy-agent-core-n1fx2fx4.js";
156
+ import"./shared/@ai-setting/roy-agent-core-mqeqevym.js";
157
157
  import"./shared/@ai-setting/roy-agent-core-44g3synv.js";
158
158
  import {
159
159
  SQLiteTaskStore,
@@ -162,7 +162,7 @@ import {
162
162
  import {
163
163
  getBuiltInPrompt,
164
164
  getBuiltInPromptNames
165
- } from "./shared/@ai-setting/roy-agent-core-65vpkh7x.js";
165
+ } from "./shared/@ai-setting/roy-agent-core-4djnmd86.js";
166
166
  import"./shared/@ai-setting/roy-agent-core-c1v263jn.js";
167
167
  import {
168
168
  AgentRegistry
@@ -377,52 +377,67 @@ const status = await query_background_process({ bgProcessId: result.bgProcessId
377
377
 
378
378
  ## Workflow 操作指南
379
379
 
380
- Workflow 是预定义的自动化流程,可以高效解决常见类型的任务。在接手一个复杂任务时,**建议先用 workflow 检索看看有没有现成的解决方案**。
380
+ Workflow 是预定义的自动化流程,可以高效解决常见类型的任务。**Default agent 自身不应直接 bash 跑 workflow**——所有 workflow 调用必须通过 \`delegate_task\` 委托给 \`workflow-runner\` 子智能体执行。
381
+
382
+ ### 如何通过 \`delegate_task\` 调用 workflow(标准路径)
381
383
 
382
- ### 如何用 workflow 辅助解决任务
383
384
  1. **查 tag 发现可用 workflow**:\`workflow tag list\` — 查看 tag 池,找与任务领域匹配的 tag
384
385
  2. **按 tag 搜索 workflow**:\`workflow list --tag <tag>\` — 找到相关的 workflow
385
386
  3. **按关键词搜索**:\`workflow search --keyword <key>\` — 用关键词匹配
386
387
  4. **查看详情**:\`workflow get <name>\` — 了解 workflow 的输入参数和节点流程
387
- 5. **运行 workflow**:\`workflow run <name> --input '{"key":"value"}'\` — 直接执行
388
+ 5. **委托 \`workflow-runner\` 执行**:用下列模板派发
389
+
390
+ \`\`\`text
391
+ delegate_task(
392
+ subagent_type="workflow-runner",
393
+ prompt="调用 workflow_run 执行 workflow <workflow-name>,输入参数: {...}"
394
+ )
395
+ \`\`\`
388
396
 
389
397
  > \uD83D\uDCA1 **什么时候该用 workflow?**
390
- > - ✅ 你的任务与现有 workflow 的 tag 或描述高度匹配时 → 优先用 \`workflow run\`
398
+ > - ✅ 你的任务与现有 workflow 的 tag 或描述高度匹配时 → 委托 \`workflow-runner\` 执行
391
399
  > - ✅ 现有 workflow 可以作为参考模板 → 参考其设计自行实现
392
- > - ❌ 找不到匹配的 workflow → **用传统方式解决**(委托子智能体、直接编码等)
400
+ > - ❌ 找不到匹配的 workflow → **用传统方式解决**(委托 \`roy\` / \`general\` / \`explore\` / 直接编码)
401
+
402
+ ### 可用命令速查(仅供 \`workflow-runner\` 子智能体使用,**default agent 不要直接调用**)
393
403
 
394
- ### 可用命令速查
395
404
  - \`workflow tag list\` — 查看所有 tag
396
405
  - \`workflow list --tag <tag>\` — 按 tag 搜索
397
- - \`workflow search --keyword <key>\` — 按关键词搜索
406
+ - \`workflow search --keyword <keyword>\` — 按关键词搜索
398
407
  - \`workflow get <name>\` — 查看详情
399
- - \`workflow run <name>\`执行 workflow(如果已找到匹配的)
400
- - \`workflow add --file <path> --tags "a,b,c"\` — 添加新 workflow
408
+ - \`workflow add --file <path> --tags "a,b,c"\` 添加新 workflow(默认 1-3 个 tag)
401
409
  - \`workflow validate --file <path>\` — 验证 workflow 定义
402
410
 
411
+ > ⚠️ \`workflow run <name>\` 是 workflow-runner 的内部触发命令——**default agent 不要直接 bash 调用**,必须通过 \`delegate_task(subagent_type="workflow-runner", ...)\` 委托子智能体执行。
412
+
403
413
  ### ⚠️ 重要原则
404
414
  - **Workflow 是辅助手段,不是目的**。如果能找到现成 workflow 就使用它;如果找不到或效果不好,**用非 workflow 方式解决**也是完全正确的
405
415
  - **不要为了用 workflow 而用**,强行创建一个不合适的 workflow 来套用任务不如直接用传统方式解决
406
- - **委托子智能体时**:如果认为有 workflow 可能帮助子智能体,可以在 prompt 中提示子智能体先查询 tag 池搜索可用 workflow
407
-
408
- ### ⚡ Session 恢复(重要,耗时 workflow 必备)
416
+ - **Default agent 不直接调用 workflow**:所有 workflow 调用必须通过 \`delegate_task(subagent_type="workflow-runner", ...)\` 委托子智能体执行
409
417
 
410
- 对于耗时较长、易超时的 workflow(如 \`strict-task-agent\`),如遇超时/中断,可使用 \`-s\` 选项从断点继续运行,**避免重头开始**:
418
+ ### ⚡ Session 恢复(重要,耗时 workflow 必备 — default agent 视角)
411
419
 
412
- # 初次运行(可能超时)
413
- roy-agent workflow run <workflow-name> --input '{"query":"..."}'
420
+ workflow-runner 报告 workflow runId 后,对于耗时较长、易超时的 workflow(如 \`strict-task-agent\`),如遇超时/中断,**default agent 应重新派发 \`delegate_task\` 给 \`workflow-runner\`**,并附带 \`-s\` / \`--session\` 选项让 workflow-runner 从断点继续运行:
414
421
 
415
- # 拿到 Run ID 后(如 workflow_run_1783407282099_1_ah8pho),从中断处继续:
416
- roy-agent workflow run <workflow-name> -s workflow_run_1783407282099_1_ah8pho
422
+ \`\`\`text
423
+ # 初次调用:直接派发 delegate_task(workflow-runner 内部用 workflow_run 启动)
424
+ delegate_task(
425
+ subagent_type="workflow-runner",
426
+ prompt="调用 workflow_run 执行 workflow <workflow-name>,输入参数: {...}"
427
+ )
417
428
 
418
- # 长选项亦可:
419
- roy-agent workflow run <workflow-name> --session workflow_run_1783407282099_1_ah8pho
429
+ # 拿到 runId 后(如 workflow_run_1783407282099_1_ah8pho),从中断处继续:
430
+ delegate_task(
431
+ subagent_type="workflow-runner",
432
+ prompt="调用 workflow_run 续跑 workflow <workflow-name>,-s workflow_run_1783407282099_1_ah8pho"
433
+ )
434
+ \`\`\`
420
435
 
421
- > **重要规则**(Task #1837 — runId == sessionId):
436
+ > **关键规则**(Task #1837 — runId == sessionId):
422
437
  > - Run ID / Session ID 形如 \`workflow_\${Date.now()}_\${counter}_\${random}\`,直接以 \`workflow_\` 开头
423
438
  > - runId 和 sessionId 是同一个值(不再需要 \`workflow_\${runId}\` 派生)
424
- > - 引擎会从 last message 推断恢复点(\`workflow.node.start\` → 节点级 resume;\`workflow.node.end\` → 下一节点;\`workflow.node.interrupt\` → ask_user)
425
- > - agentNode 恢复时会自动 attach \`agentSessionId\`,agent 从中断的 sub-session 继续
439
+ > - 引擎从 last message 推断恢复点(\`workflow.node.start\` → 节点级 resume;\`workflow.node.end\` → 下一节点;\`workflow.node.interrupt\` → ask_user)
440
+ > - agentNode 恢复时自动 attach \`agentSessionId\`,agent 从中断的 sub-session 继续
426
441
  > - 适合长时间 workflow(通过 \`workflow-runner\` 调度的任意 workflow)的超时重试
427
442
 
428
443
  ### {{memory}}`,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  builtInPrompts
3
- } from "./roy-agent-core-65vpkh7x.js";
3
+ } from "./roy-agent-core-4djnmd86.js";
4
4
  import {
5
5
  getXDGPath
6
6
  } from "./roy-agent-core-qxnbvgwe.js";
@@ -8,7 +8,7 @@ import {
8
8
  BackgroundTaskManager,
9
9
  createDelegateTool,
10
10
  createStopTool
11
- } from "./roy-agent-core-n1fx2fx4.js";
11
+ } from "./roy-agent-core-mqeqevym.js";
12
12
  import {
13
13
  SQLiteTaskStore,
14
14
  getDefaultTaskDbPath
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  TaskTagPlugin,
3
3
  createLarkCliTaskNotifyHook
4
- } from "./roy-agent-core-nreqmmtz.js";
4
+ } from "./roy-agent-core-btp589bw.js";
5
5
  import {
6
6
  envKeyToConfigKey
7
7
  } from "./roy-agent-core-7hh0brvs.js";
@@ -6,7 +6,7 @@ import {
6
6
  } from "./roy-agent-core-1mrc9a1r.js";
7
7
  import {
8
8
  WORKFLOW_EXTRACT_PROMPT
9
- } from "./roy-agent-core-65vpkh7x.js";
9
+ } from "./roy-agent-core-4djnmd86.js";
10
10
  import {
11
11
  TaskHookPoints
12
12
  } from "./roy-agent-core-1pg0fepg.js";
@@ -2322,7 +2322,7 @@ var init_engine = __esm(() => {
2322
2322
  scheduler.markFailed(nodeId);
2323
2323
  }
2324
2324
  }
2325
- async checkLoopGuardWithSnapshot(sessionState, templateResolver, reEntryId, _snapshotPreviousOutput) {
2325
+ async checkLoopGuardWithSnapshot(sessionState, templateResolver, reEntryId, snapshotPreviousOutput) {
2326
2326
  const guard = sessionState.dagManager.getLoopGuard(reEntryId);
2327
2327
  if (!guard) {
2328
2328
  return { trip: false, counterKey: "", nextCount: 0 };
@@ -2330,19 +2330,42 @@ var init_engine = __esm(() => {
2330
2330
  const counterKey = `_loop_guard_consecutive_${reEntryId}`;
2331
2331
  const previousCount = sessionState.loopGuardCounters.get(reEntryId) ?? 0;
2332
2332
  const previousValue = templateResolver.resolveValue(guard.previous_signal);
2333
- const cwd = guard.cwd ?? sessionState.config.workflowInput?.project_path ?? process.cwd();
2333
+ const resolvedCwdRaw = templateResolver.resolveValue(guard.cwd);
2334
+ const resolvedCwd = typeof resolvedCwdRaw === "string" && resolvedCwdRaw.length > 0 ? resolvedCwdRaw : undefined;
2335
+ const resolvedCommandRaw = templateResolver.resolveValue(guard.current_signal_command);
2336
+ const resolvedCommand = typeof resolvedCommandRaw === "string" && resolvedCommandRaw.length > 0 ? resolvedCommandRaw : guard.current_signal_command;
2337
+ const cwd = resolvedCwd ?? sessionState.config.workflowInput?.project_path ?? process.cwd();
2334
2338
  let currentValue;
2335
2339
  try {
2336
- const { stdout } = await execFileAsync("/bin/sh", ["-c", guard.current_signal_command], {
2340
+ const { stdout } = await execFileAsync("/bin/sh", ["-c", resolvedCommand], {
2337
2341
  cwd,
2338
2342
  timeout: 1e4
2339
2343
  });
2340
2344
  currentValue = stdout.trim();
2341
2345
  } catch (err) {
2342
- logger3.warn(`[WorkflowEngine] loop_guard command failed for ${reEntryId}: ${err instanceof Error ? err.message : String(err)}. Allowing re-entry.`);
2343
- return { trip: false, counterKey, nextCount: 0 };
2346
+ const errMessage = err instanceof Error ? err.message : String(err);
2347
+ logger3.error(`[WorkflowEngine] loop_guard command failed for ${reEntryId}: ${errMessage}. Counting as no-progress.`);
2348
+ const nextCount2 = previousCount + 1;
2349
+ const maxAllowed2 = guard.max_consecutive_no_progress;
2350
+ if (nextCount2 >= maxAllowed2) {
2351
+ const failMessage = guard.fail_message ?? `loop_guard command failed for ${reEntryId} after ${nextCount2} consecutive re-entries: ${errMessage}`;
2352
+ return { trip: true, failMessage, counterKey, nextCount: nextCount2 };
2353
+ }
2354
+ sessionState.loopGuardCounters.set(reEntryId, nextCount2);
2355
+ return { trip: false, counterKey, nextCount: nextCount2 };
2344
2356
  }
2345
2357
  if (previousValue === undefined) {
2358
+ const snapshotHasContent = snapshotPreviousOutput !== undefined && snapshotPreviousOutput !== null && typeof snapshotPreviousOutput === "object" && Object.keys(snapshotPreviousOutput).length > 0;
2359
+ if (snapshotHasContent) {
2360
+ const nextCount2 = previousCount + 1;
2361
+ const maxAllowed2 = guard.max_consecutive_no_progress;
2362
+ if (nextCount2 >= maxAllowed2) {
2363
+ const failMessage = guard.fail_message ?? `loop_guard previous_signal path unresolved for ${reEntryId} after ${nextCount2} consecutive re-entries: ${guard.previous_signal}`;
2364
+ return { trip: true, failMessage, counterKey, nextCount: nextCount2 };
2365
+ }
2366
+ sessionState.loopGuardCounters.set(reEntryId, nextCount2);
2367
+ return { trip: false, counterKey, nextCount: nextCount2 };
2368
+ }
2346
2369
  return { trip: false, counterKey, nextCount: 0 };
2347
2370
  }
2348
2371
  const isUnchanged = JSON.stringify(previousValue) === JSON.stringify(currentValue);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createAutoTaskPlugin
3
- } from "./roy-agent-core-nreqmmtz.js";
3
+ } from "./roy-agent-core-btp589bw.js";
4
4
  import {
5
5
  ContextError,
6
6
  ErrorCodes
@@ -6,7 +6,7 @@ import {
6
6
  WorkflowEngine,
7
7
  exports_engine,
8
8
  init_engine
9
- } from "./roy-agent-core-yr3fp8tv.js";
9
+ } from "./roy-agent-core-f1cjs6c4.js";
10
10
  import {
11
11
  askUserTool,
12
12
  createRunWorkflowTool,
@@ -4,7 +4,7 @@ import {
4
4
  } from "./roy-agent-core-44g3synv.js";
5
5
  import {
6
6
  builtInPrompts
7
- } from "./roy-agent-core-65vpkh7x.js";
7
+ } from "./roy-agent-core-4djnmd86.js";
8
8
  import {
9
9
  runWithBgTaskIdAsync
10
10
  } from "./roy-agent-core-c1v263jn.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-agent-core",
3
- "version": "1.6.18",
3
+ "version": "1.6.19",
4
4
  "type": "module",
5
5
  "description": "Core SDK for roy-agent - Environment, Components, Tools, Sessions, Tasks",
6
6
  "main": "./dist/index.js",