openloops 0.1.31 → 0.1.33
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/dist/clients/llm-client.d.ts +5 -0
- package/dist/clients/llm-client.js +73 -15
- package/dist/clients/llm-client.mjs +73 -15
- package/dist/clients/llm-error.d.ts +9 -0
- package/dist/clients/llm-error.js +69 -0
- package/dist/clients/llm-error.mjs +45 -0
- package/dist/clients/llm-types.d.ts +61 -0
- package/dist/clients/llm-types.js +16 -0
- package/dist/clients/llm-types.mjs +0 -0
- package/dist/clients/pi-ai-adapter.d.ts +7 -0
- package/dist/clients/pi-ai-adapter.js +137 -0
- package/dist/clients/pi-ai-adapter.mjs +113 -0
- package/dist/{agent → harness}/agent-loop.d.ts +11 -1
- package/dist/{agent → harness}/agent-state.js +1 -1
- package/dist/{agent → harness}/agent-state.mjs +1 -1
- package/dist/{agent → harness}/agent.d.ts +34 -3
- package/dist/harness/agent.js +546 -0
- package/dist/harness/agent.mjs +530 -0
- package/dist/{agent → harness}/index.js +5 -5
- package/dist/harness/native-tools.d.ts +23 -0
- package/dist/harness/native-tools.js +251 -0
- package/dist/harness/native-tools.mjs +227 -0
- package/dist/harness/tool-catalog.d.ts +16 -0
- package/dist/harness/tool-catalog.js +85 -0
- package/dist/harness/tool-catalog.mjs +59 -0
- package/dist/harness/tool-pipeline.d.ts +42 -0
- package/dist/harness/tool-pipeline.js +200 -0
- package/dist/harness/tool-pipeline.mjs +177 -0
- package/dist/harness/utils/describe-shape.d.ts +2 -0
- package/dist/harness/utils/describe-shape.js +56 -0
- package/dist/harness/utils/describe-shape.mjs +32 -0
- package/dist/harness/utils/grounding.d.ts +6 -0
- package/dist/harness/utils/grounding.js +79 -0
- package/dist/harness/utils/grounding.mjs +53 -0
- package/dist/harness/workspace.d.ts +44 -0
- package/dist/harness/workspace.js +95 -0
- package/dist/harness/workspace.mjs +78 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/dist/loops/agi/index.d.ts +1 -0
- package/dist/loops/agi/index.js +22 -0
- package/dist/loops/agi/index.mjs +1 -0
- package/dist/loops/agi/loop.d.ts +24 -0
- package/dist/loops/agi/loop.js +220 -0
- package/dist/loops/agi/loop.mjs +197 -0
- package/dist/loops/agi/skills/reasoning-engine.d.ts +14 -0
- package/dist/loops/agi/skills/reasoning-engine.js +94 -0
- package/dist/loops/agi/skills/reasoning-engine.mjs +71 -0
- package/dist/loops/index.d.ts +1 -0
- package/dist/loops/index.js +3 -1
- package/dist/loops/index.mjs +1 -0
- package/dist/loops/plan-execute/plan-execute-loop.d.ts +2 -1
- package/dist/loops/plan-execute/plan-execute-loop.js +90 -35
- package/dist/loops/plan-execute/plan-execute-loop.mjs +80 -25
- package/dist/loops/shared/skills/action-planner.js +7 -4
- package/dist/loops/shared/skills/action-planner.mjs +7 -4
- package/dist/loops/shared/skills/final-responder.js +4 -3
- package/dist/loops/shared/skills/final-responder.mjs +4 -3
- package/dist/loops/shared/skills/state-observer.js +6 -2
- package/dist/loops/shared/skills/state-observer.mjs +6 -2
- package/dist/services/chats/entities/chat-message.entity.d.ts +4 -1
- package/dist/services/chats/entities/chat-message.entity.js +7 -3
- package/dist/services/chats/entities/chat-message.entity.mjs +7 -3
- package/dist/services/chats/entities/chat.entity.d.ts +10 -11
- package/dist/services/chats/entities/chat.entity.js +17 -21
- package/dist/services/chats/entities/chat.entity.mjs +17 -21
- package/dist/services/chats/lambdas/get-chat-by-id/get-chat-by-id.use-case.d.ts +2 -0
- package/dist/services/chats/lambdas/get-chat-by-id/get-chat-by-id.use-case.js +4 -4
- package/dist/services/chats/lambdas/get-chat-by-id/get-chat-by-id.use-case.mjs +2 -2
- package/dist/services/tasks/entities/agent-action.entity.d.ts +111 -0
- package/dist/services/tasks/entities/agent-action.entity.js +271 -0
- package/dist/services/tasks/entities/agent-action.entity.mjs +247 -0
- package/dist/services/tasks/entities/agent-task.entity.d.ts +176 -0
- package/dist/services/tasks/entities/agent-task.entity.js +695 -0
- package/dist/services/tasks/entities/agent-task.entity.mjs +662 -0
- package/dist/services/tasks/entities/index.d.ts +2 -0
- package/dist/services/tasks/entities/index.js +24 -0
- package/dist/services/tasks/entities/index.mjs +2 -0
- package/dist/services/tasks/index.d.ts +3 -0
- package/dist/services/tasks/index.js +26 -0
- package/dist/services/tasks/index.mjs +3 -0
- package/dist/services/tasks/lambdas/create-agent-action/create-agent-action.use-case.d.ts +14 -0
- package/dist/services/tasks/lambdas/create-agent-action/create-agent-action.use-case.js +60 -0
- package/dist/services/tasks/lambdas/create-agent-action/create-agent-action.use-case.mjs +31 -0
- package/dist/services/tasks/lambdas/create-agent-action/index.d.ts +1 -0
- package/dist/services/tasks/lambdas/create-agent-action/index.js +22 -0
- package/dist/services/tasks/lambdas/create-agent-action/index.mjs +1 -0
- package/dist/services/tasks/lambdas/create-agent-task/create-agent-task.use-case.d.ts +14 -0
- package/dist/services/tasks/lambdas/create-agent-task/create-agent-task.use-case.js +60 -0
- package/dist/services/tasks/lambdas/create-agent-task/create-agent-task.use-case.mjs +31 -0
- package/dist/services/tasks/lambdas/create-agent-task/index.d.ts +1 -0
- package/dist/services/tasks/lambdas/create-agent-task/index.js +22 -0
- package/dist/services/tasks/lambdas/create-agent-task/index.mjs +1 -0
- package/dist/services/tasks/lambdas/get-agent-task-by-id/get-agent-task-by-id.use-case.d.ts +14 -0
- package/dist/services/tasks/lambdas/get-agent-task-by-id/get-agent-task-by-id.use-case.js +55 -0
- package/dist/services/tasks/lambdas/get-agent-task-by-id/get-agent-task-by-id.use-case.mjs +26 -0
- package/dist/services/tasks/lambdas/get-agent-task-by-id/index.d.ts +1 -0
- package/dist/services/tasks/lambdas/get-agent-task-by-id/index.js +22 -0
- package/dist/services/tasks/lambdas/get-agent-task-by-id/index.mjs +1 -0
- package/dist/services/tasks/lambdas/index.d.ts +7 -0
- package/dist/services/tasks/lambdas/index.js +46 -0
- package/dist/services/tasks/lambdas/index.mjs +17 -0
- package/dist/services/tasks/lambdas/list-agent-actions-by-task/index.d.ts +1 -0
- package/dist/services/tasks/lambdas/list-agent-actions-by-task/index.js +22 -0
- package/dist/services/tasks/lambdas/list-agent-actions-by-task/index.mjs +1 -0
- package/dist/services/tasks/lambdas/list-agent-actions-by-task/list-agent-actions-by-task.use-case.d.ts +16 -0
- package/dist/services/tasks/lambdas/list-agent-actions-by-task/list-agent-actions-by-task.use-case.js +62 -0
- package/dist/services/tasks/lambdas/list-agent-actions-by-task/list-agent-actions-by-task.use-case.mjs +33 -0
- package/dist/services/tasks/lambdas/list-agent-tasks-by-chat/index.d.ts +1 -0
- package/dist/services/tasks/lambdas/list-agent-tasks-by-chat/index.js +22 -0
- package/dist/services/tasks/lambdas/list-agent-tasks-by-chat/index.mjs +1 -0
- package/dist/services/tasks/lambdas/list-agent-tasks-by-chat/list-agent-tasks-by-chat.use-case.d.ts +16 -0
- package/dist/services/tasks/lambdas/list-agent-tasks-by-chat/list-agent-tasks-by-chat.use-case.js +62 -0
- package/dist/services/tasks/lambdas/list-agent-tasks-by-chat/list-agent-tasks-by-chat.use-case.mjs +33 -0
- package/dist/services/tasks/lambdas/update-agent-action/index.d.ts +1 -0
- package/dist/services/tasks/lambdas/update-agent-action/index.js +22 -0
- package/dist/services/tasks/lambdas/update-agent-action/index.mjs +1 -0
- package/dist/services/tasks/lambdas/update-agent-action/update-agent-action.use-case.d.ts +15 -0
- package/dist/services/tasks/lambdas/update-agent-action/update-agent-action.use-case.js +67 -0
- package/dist/services/tasks/lambdas/update-agent-action/update-agent-action.use-case.mjs +38 -0
- package/dist/services/tasks/lambdas/update-agent-task/index.d.ts +1 -0
- package/dist/services/tasks/lambdas/update-agent-task/index.js +22 -0
- package/dist/services/tasks/lambdas/update-agent-task/index.mjs +1 -0
- package/dist/services/tasks/lambdas/update-agent-task/update-agent-task.use-case.d.ts +15 -0
- package/dist/services/tasks/lambdas/update-agent-task/update-agent-task.use-case.js +67 -0
- package/dist/services/tasks/lambdas/update-agent-task/update-agent-task.use-case.mjs +38 -0
- package/dist/services/tasks/module.d.ts +15 -0
- package/dist/services/tasks/module.js +76 -0
- package/dist/services/tasks/module.mjs +47 -0
- package/dist/services/tasks/repositories/agent-action.repository.d.ts +8 -0
- package/dist/services/tasks/repositories/agent-action.repository.js +62 -0
- package/dist/services/tasks/repositories/agent-action.repository.mjs +33 -0
- package/dist/services/tasks/repositories/agent-task.repository.d.ts +9 -0
- package/dist/services/tasks/repositories/agent-task.repository.js +65 -0
- package/dist/services/tasks/repositories/agent-task.repository.mjs +36 -0
- package/dist/services/tasks/repositories/index.d.ts +2 -0
- package/dist/services/tasks/repositories/index.js +24 -0
- package/dist/services/tasks/repositories/index.mjs +2 -0
- package/dist/services/traces/entities/agent-trace-entry.entity.d.ts +30 -0
- package/dist/services/traces/entities/agent-trace-entry.entity.js +85 -0
- package/dist/services/traces/entities/agent-trace-entry.entity.mjs +62 -0
- package/dist/services/traces/entities/index.d.ts +1 -0
- package/dist/services/traces/entities/index.js +22 -0
- package/dist/services/traces/entities/index.mjs +1 -0
- package/dist/services/traces/index.d.ts +3 -0
- package/dist/services/traces/index.js +26 -0
- package/dist/services/traces/index.mjs +3 -0
- package/dist/services/traces/lambdas/create-agent-traces/create-agent-traces.use-case.d.ts +16 -0
- package/dist/services/traces/lambdas/create-agent-traces/create-agent-traces.use-case.js +62 -0
- package/dist/services/traces/lambdas/create-agent-traces/create-agent-traces.use-case.mjs +33 -0
- package/dist/services/traces/lambdas/create-agent-traces/index.d.ts +1 -0
- package/dist/services/traces/lambdas/create-agent-traces/index.js +22 -0
- package/dist/services/traces/lambdas/create-agent-traces/index.mjs +1 -0
- package/dist/services/traces/lambdas/index.d.ts +2 -0
- package/dist/services/traces/lambdas/index.js +31 -0
- package/dist/services/traces/lambdas/index.mjs +7 -0
- package/dist/services/traces/lambdas/list-agent-traces-by-chat/index.d.ts +1 -0
- package/dist/services/traces/lambdas/list-agent-traces-by-chat/index.js +22 -0
- package/dist/services/traces/lambdas/list-agent-traces-by-chat/index.mjs +1 -0
- package/dist/services/traces/lambdas/list-agent-traces-by-chat/list-agent-traces-by-chat.use-case.d.ts +18 -0
- package/dist/services/traces/lambdas/list-agent-traces-by-chat/list-agent-traces-by-chat.use-case.js +67 -0
- package/dist/services/traces/lambdas/list-agent-traces-by-chat/list-agent-traces-by-chat.use-case.mjs +38 -0
- package/dist/services/traces/module.d.ts +5 -0
- package/dist/services/traces/module.js +41 -0
- package/dist/services/traces/module.mjs +17 -0
- package/dist/services/traces/repositories/agent-trace.repository.d.ts +7 -0
- package/dist/services/traces/repositories/agent-trace.repository.js +55 -0
- package/dist/services/traces/repositories/agent-trace.repository.mjs +26 -0
- package/dist/services/traces/repositories/index.d.ts +1 -0
- package/dist/services/traces/repositories/index.js +22 -0
- package/dist/services/traces/repositories/index.mjs +1 -0
- package/dist/services/workspaces/entities/index.d.ts +1 -0
- package/dist/services/workspaces/entities/index.js +22 -0
- package/dist/services/workspaces/entities/index.mjs +1 -0
- package/dist/services/workspaces/entities/workspace-item.entity.d.ts +33 -0
- package/dist/services/workspaces/entities/workspace-item.entity.js +95 -0
- package/dist/services/workspaces/entities/workspace-item.entity.mjs +72 -0
- package/dist/services/workspaces/index.d.ts +3 -0
- package/dist/services/workspaces/index.js +26 -0
- package/dist/services/workspaces/index.mjs +3 -0
- package/dist/services/workspaces/lambdas/delete-workspace-item/delete-workspace-item.use-case.d.ts +17 -0
- package/dist/services/workspaces/lambdas/delete-workspace-item/delete-workspace-item.use-case.js +68 -0
- package/dist/services/workspaces/lambdas/delete-workspace-item/delete-workspace-item.use-case.mjs +39 -0
- package/dist/services/workspaces/lambdas/delete-workspace-item/index.d.ts +1 -0
- package/dist/services/workspaces/lambdas/delete-workspace-item/index.js +22 -0
- package/dist/services/workspaces/lambdas/delete-workspace-item/index.mjs +1 -0
- package/dist/services/workspaces/lambdas/get-workspace-item/get-workspace-item.use-case.d.ts +17 -0
- package/dist/services/workspaces/lambdas/get-workspace-item/get-workspace-item.use-case.js +67 -0
- package/dist/services/workspaces/lambdas/get-workspace-item/get-workspace-item.use-case.mjs +38 -0
- package/dist/services/workspaces/lambdas/get-workspace-item/index.d.ts +1 -0
- package/dist/services/workspaces/lambdas/get-workspace-item/index.js +22 -0
- package/dist/services/workspaces/lambdas/get-workspace-item/index.mjs +1 -0
- package/dist/services/workspaces/lambdas/index.d.ts +5 -0
- package/dist/services/workspaces/lambdas/index.js +40 -0
- package/dist/services/workspaces/lambdas/index.mjs +13 -0
- package/dist/services/workspaces/lambdas/list-workspace-items/index.d.ts +1 -0
- package/dist/services/workspaces/lambdas/list-workspace-items/index.js +22 -0
- package/dist/services/workspaces/lambdas/list-workspace-items/index.mjs +1 -0
- package/dist/services/workspaces/lambdas/list-workspace-items/list-workspace-items.use-case.d.ts +18 -0
- package/dist/services/workspaces/lambdas/list-workspace-items/list-workspace-items.use-case.js +69 -0
- package/dist/services/workspaces/lambdas/list-workspace-items/list-workspace-items.use-case.mjs +40 -0
- package/dist/services/workspaces/lambdas/save-workspace-item/index.d.ts +1 -0
- package/dist/services/workspaces/lambdas/save-workspace-item/index.js +22 -0
- package/dist/services/workspaces/lambdas/save-workspace-item/index.mjs +1 -0
- package/dist/services/workspaces/lambdas/save-workspace-item/save-workspace-item.use-case.d.ts +14 -0
- package/dist/services/workspaces/lambdas/save-workspace-item/save-workspace-item.use-case.js +76 -0
- package/dist/services/workspaces/lambdas/save-workspace-item/save-workspace-item.use-case.mjs +47 -0
- package/dist/services/workspaces/lambdas/search-workspace-items/index.d.ts +1 -0
- package/dist/services/workspaces/lambdas/search-workspace-items/index.js +22 -0
- package/dist/services/workspaces/lambdas/search-workspace-items/index.mjs +1 -0
- package/dist/services/workspaces/lambdas/search-workspace-items/search-workspace-items.use-case.d.ts +19 -0
- package/dist/services/workspaces/lambdas/search-workspace-items/search-workspace-items.use-case.js +73 -0
- package/dist/services/workspaces/lambdas/search-workspace-items/search-workspace-items.use-case.mjs +44 -0
- package/dist/services/workspaces/module.d.ts +11 -0
- package/dist/services/workspaces/module.js +62 -0
- package/dist/services/workspaces/module.mjs +35 -0
- package/dist/services/workspaces/repositories/index.d.ts +1 -0
- package/dist/services/workspaces/repositories/index.js +22 -0
- package/dist/services/workspaces/repositories/index.mjs +1 -0
- package/dist/services/workspaces/repositories/workspace-item.repository.d.ts +18 -0
- package/dist/services/workspaces/repositories/workspace-item.repository.js +74 -0
- package/dist/services/workspaces/repositories/workspace-item.repository.mjs +45 -0
- package/dist/skills/runtime-context.d.ts +8 -0
- package/dist/skills/runtime-context.js +65 -0
- package/dist/skills/runtime-context.mjs +42 -0
- package/dist/skills/skill.d.ts +7 -0
- package/dist/skills/skill.js +26 -60
- package/dist/skills/skill.mjs +26 -60
- package/dist/tools/tool.d.ts +6 -0
- package/dist/tools/tool.js +56 -0
- package/dist/tools/tool.mjs +56 -0
- package/package.json +3 -3
- package/dist/agent/agent.js +0 -327
- package/dist/agent/agent.mjs +0 -303
- package/dist/services/chats/entities/agent-action.entity.d.ts +0 -58
- package/dist/services/chats/entities/agent-action.entity.js +0 -151
- package/dist/services/chats/entities/agent-action.entity.mjs +0 -128
- package/dist/services/chats/entities/agent-task.entity.d.ts +0 -59
- package/dist/services/chats/entities/agent-task.entity.js +0 -231
- package/dist/services/chats/entities/agent-task.entity.mjs +0 -207
- package/dist/services/chats/entities/chat-context.entity.d.ts +0 -39
- package/dist/services/chats/entities/chat-context.entity.js +0 -70
- package/dist/services/chats/entities/chat-context.entity.mjs +0 -47
- /package/dist/{agent → harness}/agent-loop.js +0 -0
- /package/dist/{agent → harness}/agent-loop.mjs +0 -0
- /package/dist/{agent → harness}/agent-state.d.ts +0 -0
- /package/dist/{agent → harness}/index.d.ts +0 -0
- /package/dist/{agent → harness}/index.mjs +0 -0
- /package/dist/{agent → harness}/utils/rank-tools-by-keywords.d.ts +0 -0
- /package/dist/{agent → harness}/utils/rank-tools-by-keywords.js +0 -0
- /package/dist/{agent → harness}/utils/rank-tools-by-keywords.mjs +0 -0
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import "../../../chunk-CF3WOMB3.mjs";
|
|
2
|
-
import { ObjectId } from "mongodb";
|
|
3
|
-
import { BaseEntity } from "../../../common/base/base.entity.js";
|
|
4
|
-
import { AgentAction } from "./agent-action.entity";
|
|
5
|
-
var TaskStatus = /* @__PURE__ */ ((TaskStatus2) => {
|
|
6
|
-
TaskStatus2["PENDING"] = "pending";
|
|
7
|
-
TaskStatus2["IN_PROGRESS"] = "in_progress";
|
|
8
|
-
TaskStatus2["AWAITING_USER"] = "awaiting_user";
|
|
9
|
-
TaskStatus2["COMPLETED"] = "completed";
|
|
10
|
-
TaskStatus2["PAUSED"] = "paused";
|
|
11
|
-
TaskStatus2["ABANDONED"] = "abandoned";
|
|
12
|
-
TaskStatus2["CANCELLED"] = "cancelled";
|
|
13
|
-
TaskStatus2["FAILED"] = "failed";
|
|
14
|
-
return TaskStatus2;
|
|
15
|
-
})(TaskStatus || {});
|
|
16
|
-
const STEP_REF = /^\{\{step_([\w-]+)\.output\}\}$/;
|
|
17
|
-
const STEP_REF_GLOBAL = /\{\{step_([\w-]+)\.output\}\}/g;
|
|
18
|
-
const CONTEXT_REF = /^\{\{context\.([\w.-]+)\}\}$/;
|
|
19
|
-
const CONTEXT_REF_GLOBAL = /\{\{context\.([\w.-]+)\}\}/g;
|
|
20
|
-
function stringifyValue(value) {
|
|
21
|
-
return typeof value === "object" ? JSON.stringify(value) : String(value);
|
|
22
|
-
}
|
|
23
|
-
class AgentTask extends BaseEntity {
|
|
24
|
-
constructor(props, status, goal, nextNode, threadId, previousTaskId, summary, loopName, actions = []) {
|
|
25
|
-
super(props);
|
|
26
|
-
this.props = props;
|
|
27
|
-
this.status = status;
|
|
28
|
-
this.goal = goal;
|
|
29
|
-
this.nextNode = nextNode;
|
|
30
|
-
this.threadId = threadId;
|
|
31
|
-
this.previousTaskId = previousTaskId;
|
|
32
|
-
this.summary = summary;
|
|
33
|
-
this.loopName = loopName;
|
|
34
|
-
this.actions = actions;
|
|
35
|
-
}
|
|
36
|
-
props;
|
|
37
|
-
status;
|
|
38
|
-
goal;
|
|
39
|
-
nextNode;
|
|
40
|
-
threadId;
|
|
41
|
-
previousTaskId;
|
|
42
|
-
summary;
|
|
43
|
-
loopName;
|
|
44
|
-
actions;
|
|
45
|
-
static factory(task) {
|
|
46
|
-
const taskId = task._id && ObjectId.isValid(task._id) ? new ObjectId(task._id) : new ObjectId();
|
|
47
|
-
return AgentTask.fromJSON({
|
|
48
|
-
...task,
|
|
49
|
-
_id: taskId,
|
|
50
|
-
status: task.status ?? "in_progress" /* IN_PROGRESS */
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
static fromJSON(props) {
|
|
54
|
-
return new AgentTask(
|
|
55
|
-
props,
|
|
56
|
-
props.status,
|
|
57
|
-
props.goal,
|
|
58
|
-
props.nextNode,
|
|
59
|
-
props.threadId,
|
|
60
|
-
props.previousTaskId,
|
|
61
|
-
props.summary,
|
|
62
|
-
props.loopName,
|
|
63
|
-
props.actions?.map((a) => AgentAction.factory(a)) ?? []
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
toJSON() {
|
|
67
|
-
return {
|
|
68
|
-
...super.toJSON(),
|
|
69
|
-
status: this.status,
|
|
70
|
-
goal: this.goal,
|
|
71
|
-
nextNode: this.nextNode,
|
|
72
|
-
threadId: this.threadId,
|
|
73
|
-
previousTaskId: this.previousTaskId,
|
|
74
|
-
summary: this.summary,
|
|
75
|
-
loopName: this.loopName,
|
|
76
|
-
actions: this.actions.map((a) => a.toJSON())
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
get id() {
|
|
80
|
-
return this._id.toString();
|
|
81
|
-
}
|
|
82
|
-
addAction(descriptor) {
|
|
83
|
-
const action = AgentAction.factory({
|
|
84
|
-
name: descriptor.name,
|
|
85
|
-
stepId: descriptor.stepId,
|
|
86
|
-
args: descriptor.args,
|
|
87
|
-
dependsOn: descriptor.dependsOn,
|
|
88
|
-
reasoning: descriptor.reasoning,
|
|
89
|
-
author: descriptor.author
|
|
90
|
-
});
|
|
91
|
-
this.actions.push(action);
|
|
92
|
-
return action;
|
|
93
|
-
}
|
|
94
|
-
getAction(ref) {
|
|
95
|
-
return this.actions.find((a) => a.id === ref || a.stepId === ref);
|
|
96
|
-
}
|
|
97
|
-
findLastByName(name) {
|
|
98
|
-
return this.actions.slice().reverse().find((a) => a.name === name);
|
|
99
|
-
}
|
|
100
|
-
/** Actions en `pending` cuyas dependencias (por stepId o id) ya están `completed` */
|
|
101
|
-
get readyActions() {
|
|
102
|
-
const completedRefs = new Set(
|
|
103
|
-
this.actions.filter((a) => a.status === "completed").flatMap((a) => [a.id, a.stepId].filter(Boolean))
|
|
104
|
-
);
|
|
105
|
-
return this.actions.filter((a) => a.isReady && a.dependenciesSatisfiedBy(completedRefs));
|
|
106
|
-
}
|
|
107
|
-
get failedActions() {
|
|
108
|
-
return this.actions.filter((a) => a.status === "failed");
|
|
109
|
-
}
|
|
110
|
-
get lastExecutedAction() {
|
|
111
|
-
return this.actions.slice().reverse().find((a) => a.isTerminal);
|
|
112
|
-
}
|
|
113
|
-
setNextNode(node) {
|
|
114
|
-
this.nextNode = node;
|
|
115
|
-
}
|
|
116
|
-
complete(summary) {
|
|
117
|
-
this.status = "completed" /* COMPLETED */;
|
|
118
|
-
if (summary) this.summary = summary;
|
|
119
|
-
this.nextNode = void 0;
|
|
120
|
-
}
|
|
121
|
-
fail() {
|
|
122
|
-
this.status = "failed" /* FAILED */;
|
|
123
|
-
this.nextNode = void 0;
|
|
124
|
-
}
|
|
125
|
-
cancel() {
|
|
126
|
-
this.status = "cancelled" /* CANCELLED */;
|
|
127
|
-
this.nextNode = void 0;
|
|
128
|
-
}
|
|
129
|
-
pause() {
|
|
130
|
-
if (this.status === "in_progress" /* IN_PROGRESS */ || this.status === "awaiting_user" /* AWAITING_USER */) {
|
|
131
|
-
this.status = "paused" /* PAUSED */;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
reopen() {
|
|
135
|
-
this.status = "in_progress" /* IN_PROGRESS */;
|
|
136
|
-
this.nextNode = void 0;
|
|
137
|
-
}
|
|
138
|
-
resolveArgs(action, context) {
|
|
139
|
-
return this.resolveValue(action.args, context);
|
|
140
|
-
}
|
|
141
|
-
resolveValue(value, context) {
|
|
142
|
-
if (typeof value === "string") {
|
|
143
|
-
const stepMatch = value.match(STEP_REF);
|
|
144
|
-
if (stepMatch) {
|
|
145
|
-
const target = this.findActionByRef(stepMatch[1]);
|
|
146
|
-
return target?.output !== void 0 ? target.output : value;
|
|
147
|
-
}
|
|
148
|
-
const contextMatch = value.match(CONTEXT_REF);
|
|
149
|
-
if (contextMatch) {
|
|
150
|
-
const resolved = this.readContextValue(contextMatch[1], context);
|
|
151
|
-
return resolved !== void 0 ? resolved : value;
|
|
152
|
-
}
|
|
153
|
-
return value.replace(STEP_REF_GLOBAL, (_, ref) => {
|
|
154
|
-
const target = this.findActionByRef(ref);
|
|
155
|
-
return target?.output !== void 0 ? stringifyValue(target.output) : "";
|
|
156
|
-
}).replace(CONTEXT_REF_GLOBAL, (_, name) => {
|
|
157
|
-
const resolved = this.readContextValue(name, context);
|
|
158
|
-
return resolved !== void 0 ? stringifyValue(resolved) : "";
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
if (Array.isArray(value)) {
|
|
162
|
-
return value.map((item) => this.resolveValue(item, context));
|
|
163
|
-
}
|
|
164
|
-
if (value !== null && typeof value === "object") {
|
|
165
|
-
const resolved = {};
|
|
166
|
-
for (const key of Object.keys(value)) {
|
|
167
|
-
resolved[key] = this.resolveValue(value[key], context);
|
|
168
|
-
}
|
|
169
|
-
return resolved;
|
|
170
|
-
}
|
|
171
|
-
return value;
|
|
172
|
-
}
|
|
173
|
-
findActionByRef(ref) {
|
|
174
|
-
return this.actions.find((a) => a.stepId === ref || a.id === ref);
|
|
175
|
-
}
|
|
176
|
-
readContextValue(name, context) {
|
|
177
|
-
const matches = context.selectContext({ taskId: this.id, name });
|
|
178
|
-
return matches?.[0]?.content;
|
|
179
|
-
}
|
|
180
|
-
/** Crea una action nueva y la corre de inmediato (estilo reactivo) */
|
|
181
|
-
async runTool(descriptor, tool, context, baseParams) {
|
|
182
|
-
const action = this.addAction(descriptor);
|
|
183
|
-
return this.executeToolAction(action, tool, context, baseParams);
|
|
184
|
-
}
|
|
185
|
-
/** Corre una action ya encolada (estilo por lotes: actionPlanner encola, esto ejecuta cuando está `ready`) */
|
|
186
|
-
async runReadyAction(actionRef, tool, context, baseParams) {
|
|
187
|
-
const action = this.getAction(actionRef);
|
|
188
|
-
if (!action) throw new Error(`[AgentTask] Action "${actionRef}" not found`);
|
|
189
|
-
return this.executeToolAction(action, tool, context, baseParams);
|
|
190
|
-
}
|
|
191
|
-
async executeToolAction(action, tool, context, baseParams) {
|
|
192
|
-
const resolvedArgs = this.resolveArgs(action, context);
|
|
193
|
-
const executed = await action.runTool(tool, resolvedArgs, baseParams);
|
|
194
|
-
if (executed.status === "completed" && executed.name) {
|
|
195
|
-
context.addContext({
|
|
196
|
-
taskId: this.id,
|
|
197
|
-
meta: { name: executed.name, type: "tool_output", shortDescription: `Output of ${executed.name}` },
|
|
198
|
-
content: executed.output
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
return executed;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
export {
|
|
205
|
-
AgentTask,
|
|
206
|
-
TaskStatus
|
|
207
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
type ContextRecordType = 'message' | 'file' | 'entity' | 'tool_output' | 'artifact' | 'summary';
|
|
2
|
-
export interface ContextRecord {
|
|
3
|
-
taskId: string;
|
|
4
|
-
meta: {
|
|
5
|
-
name: string;
|
|
6
|
-
type: ContextRecordType;
|
|
7
|
-
shortDescription: string;
|
|
8
|
-
};
|
|
9
|
-
content: any;
|
|
10
|
-
}
|
|
11
|
-
export interface ChatContextProps {
|
|
12
|
-
items?: ContextRecord[];
|
|
13
|
-
}
|
|
14
|
-
export declare class ChatContext {
|
|
15
|
-
private readonly props;
|
|
16
|
-
items?: ContextRecord[] | undefined;
|
|
17
|
-
private readonly MEMORY_CONTEXT_MAX_CHARS;
|
|
18
|
-
static fromJSON(props: ChatContextProps): ChatContext;
|
|
19
|
-
constructor(props: ChatContextProps, items?: ContextRecord[] | undefined);
|
|
20
|
-
get length(): number;
|
|
21
|
-
get allMeta(): {
|
|
22
|
-
name: string;
|
|
23
|
-
type: ContextRecordType;
|
|
24
|
-
shortDescription: string;
|
|
25
|
-
}[] | undefined;
|
|
26
|
-
toJSON(): ChatContextProps;
|
|
27
|
-
addContext(contextRecord: any): void;
|
|
28
|
-
selectContext(filters: {
|
|
29
|
-
taskId: string;
|
|
30
|
-
name: string;
|
|
31
|
-
}): ContextRecord[] | undefined;
|
|
32
|
-
lastContext(filters: {
|
|
33
|
-
taskId: string;
|
|
34
|
-
name: string;
|
|
35
|
-
}): ContextRecord | undefined;
|
|
36
|
-
compress(): void;
|
|
37
|
-
pruneContext(): void;
|
|
38
|
-
}
|
|
39
|
-
export {};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var chat_context_entity_exports = {};
|
|
20
|
-
__export(chat_context_entity_exports, {
|
|
21
|
-
ChatContext: () => ChatContext
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(chat_context_entity_exports);
|
|
24
|
-
class ChatContext {
|
|
25
|
-
constructor(props, items) {
|
|
26
|
-
this.props = props;
|
|
27
|
-
this.items = items;
|
|
28
|
-
}
|
|
29
|
-
props;
|
|
30
|
-
items;
|
|
31
|
-
MEMORY_CONTEXT_MAX_CHARS = 1e4;
|
|
32
|
-
static fromJSON(props) {
|
|
33
|
-
return new ChatContext(
|
|
34
|
-
props,
|
|
35
|
-
props.items
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
get length() {
|
|
39
|
-
return this.items ? JSON.stringify(this.items).length : 0;
|
|
40
|
-
}
|
|
41
|
-
get allMeta() {
|
|
42
|
-
return this.items?.map((item) => item.meta);
|
|
43
|
-
}
|
|
44
|
-
toJSON() {
|
|
45
|
-
return {
|
|
46
|
-
items: this.items
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
addContext(contextRecord) {
|
|
50
|
-
this.items ??= [];
|
|
51
|
-
this.items.push(contextRecord);
|
|
52
|
-
}
|
|
53
|
-
selectContext(filters) {
|
|
54
|
-
return this.items?.filter((item) => {
|
|
55
|
-
return (filters.taskId === void 0 || item.taskId === filters.taskId) && (filters.name === void 0 || item.meta.name === filters.name);
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
lastContext(filters) {
|
|
59
|
-
const matches = this.selectContext(filters);
|
|
60
|
-
return matches?.[matches.length - 1];
|
|
61
|
-
}
|
|
62
|
-
compress() {
|
|
63
|
-
}
|
|
64
|
-
pruneContext() {
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
68
|
-
0 && (module.exports = {
|
|
69
|
-
ChatContext
|
|
70
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import "../../../chunk-CF3WOMB3.mjs";
|
|
2
|
-
class ChatContext {
|
|
3
|
-
constructor(props, items) {
|
|
4
|
-
this.props = props;
|
|
5
|
-
this.items = items;
|
|
6
|
-
}
|
|
7
|
-
props;
|
|
8
|
-
items;
|
|
9
|
-
MEMORY_CONTEXT_MAX_CHARS = 1e4;
|
|
10
|
-
static fromJSON(props) {
|
|
11
|
-
return new ChatContext(
|
|
12
|
-
props,
|
|
13
|
-
props.items
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
get length() {
|
|
17
|
-
return this.items ? JSON.stringify(this.items).length : 0;
|
|
18
|
-
}
|
|
19
|
-
get allMeta() {
|
|
20
|
-
return this.items?.map((item) => item.meta);
|
|
21
|
-
}
|
|
22
|
-
toJSON() {
|
|
23
|
-
return {
|
|
24
|
-
items: this.items
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
addContext(contextRecord) {
|
|
28
|
-
this.items ??= [];
|
|
29
|
-
this.items.push(contextRecord);
|
|
30
|
-
}
|
|
31
|
-
selectContext(filters) {
|
|
32
|
-
return this.items?.filter((item) => {
|
|
33
|
-
return (filters.taskId === void 0 || item.taskId === filters.taskId) && (filters.name === void 0 || item.meta.name === filters.name);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
lastContext(filters) {
|
|
37
|
-
const matches = this.selectContext(filters);
|
|
38
|
-
return matches?.[matches.length - 1];
|
|
39
|
-
}
|
|
40
|
-
compress() {
|
|
41
|
-
}
|
|
42
|
-
pruneContext() {
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
export {
|
|
46
|
-
ChatContext
|
|
47
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|