agent-world 0.12.3 → 0.13.0

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 (74) hide show
  1. package/README.md +15 -0
  2. package/dist/cli/hitl.d.ts +5 -1
  3. package/dist/cli/hitl.js +9 -3
  4. package/dist/cli/index.js +11 -9
  5. package/dist/core/activity-tracker.d.ts +12 -2
  6. package/dist/core/activity-tracker.d.ts.map +1 -1
  7. package/dist/core/activity-tracker.js +41 -5
  8. package/dist/core/activity-tracker.js.map +1 -1
  9. package/dist/core/create-agent-tool.d.ts +23 -25
  10. package/dist/core/create-agent-tool.d.ts.map +1 -1
  11. package/dist/core/create-agent-tool.js +241 -141
  12. package/dist/core/create-agent-tool.js.map +1 -1
  13. package/dist/core/events/memory-manager.js +1 -1
  14. package/dist/core/events/memory-manager.js.map +1 -1
  15. package/dist/core/events/orchestrator.d.ts.map +1 -1
  16. package/dist/core/events/orchestrator.js +14 -5
  17. package/dist/core/events/orchestrator.js.map +1 -1
  18. package/dist/core/events/persistence.d.ts +1 -1
  19. package/dist/core/events/persistence.d.ts.map +1 -1
  20. package/dist/core/events/persistence.js +1 -27
  21. package/dist/core/events/persistence.js.map +1 -1
  22. package/dist/core/events/publishers.d.ts +0 -9
  23. package/dist/core/events/publishers.d.ts.map +1 -1
  24. package/dist/core/events/publishers.js +10 -27
  25. package/dist/core/events/publishers.js.map +1 -1
  26. package/dist/core/events/subscribers.d.ts +1 -1
  27. package/dist/core/events/subscribers.d.ts.map +1 -1
  28. package/dist/core/events/subscribers.js +15 -7
  29. package/dist/core/events/subscribers.js.map +1 -1
  30. package/dist/core/hitl-tool.d.ts +79 -0
  31. package/dist/core/hitl-tool.d.ts.map +1 -0
  32. package/dist/core/hitl-tool.js +306 -0
  33. package/dist/core/hitl-tool.js.map +1 -0
  34. package/dist/core/hitl.d.ts +26 -6
  35. package/dist/core/hitl.d.ts.map +1 -1
  36. package/dist/core/hitl.js +82 -32
  37. package/dist/core/hitl.js.map +1 -1
  38. package/dist/core/index.d.ts +3 -2
  39. package/dist/core/index.d.ts.map +1 -1
  40. package/dist/core/index.js +3 -2
  41. package/dist/core/index.js.map +1 -1
  42. package/dist/core/llm-manager.d.ts +2 -0
  43. package/dist/core/llm-manager.d.ts.map +1 -1
  44. package/dist/core/llm-manager.js +16 -9
  45. package/dist/core/llm-manager.js.map +1 -1
  46. package/dist/core/managers.d.ts +24 -3
  47. package/dist/core/managers.d.ts.map +1 -1
  48. package/dist/core/managers.js +103 -52
  49. package/dist/core/managers.js.map +1 -1
  50. package/dist/core/mcp-server-registry.d.ts +3 -1
  51. package/dist/core/mcp-server-registry.d.ts.map +1 -1
  52. package/dist/core/mcp-server-registry.js +7 -1
  53. package/dist/core/mcp-server-registry.js.map +1 -1
  54. package/dist/core/tool-utils.d.ts +3 -1
  55. package/dist/core/tool-utils.d.ts.map +1 -1
  56. package/dist/core/tool-utils.js +55 -25
  57. package/dist/core/tool-utils.js.map +1 -1
  58. package/dist/core/types.d.ts +2 -17
  59. package/dist/core/types.d.ts.map +1 -1
  60. package/dist/core/types.js +0 -2
  61. package/dist/core/types.js.map +1 -1
  62. package/dist/core/utils.d.ts +9 -0
  63. package/dist/core/utils.d.ts.map +1 -1
  64. package/dist/core/utils.js +28 -3
  65. package/dist/core/utils.js.map +1 -1
  66. package/dist/public/assets/index-BW41BxMy.css +1 -0
  67. package/dist/public/assets/index-kO6UJFwK.js +96 -0
  68. package/dist/public/index.html +2 -2
  69. package/dist/server/api.js +29 -41
  70. package/dist/server/sse-handler.d.ts +3 -2
  71. package/dist/server/sse-handler.js +19 -11
  72. package/package.json +1 -1
  73. package/dist/public/assets/index-BO20H4xt.js +0 -96
  74. package/dist/public/assets/index-ETY7W5_S.css +0 -1
@@ -1,210 +1,310 @@
1
1
  /**
2
- * Create Agent Tool Module - Built-in tool for approval-gated agent creation.
2
+ * Create Agent Tool Module - Built-in tool for approval-gated agent creation
3
3
  *
4
4
  * Purpose:
5
- * - Provide a deterministic `create_agent` built-in tool that creates agents after explicit user approval.
5
+ * - Expose a built-in `create_agent` tool that creates one new agent after explicit user approval.
6
6
  *
7
7
  * Key Features:
8
- * - Requires `name` and supports optional `autoReply`, `role`, and `nextAgent` arguments.
9
- * - Enforces a mandatory HITL approval check before creating any agent.
10
- * - Inherits provider/model from world-level `chatLLMProvider` / `chatLLMModel` when configured.
11
- * - Generates a stable system prompt template for new agents.
12
- * - Returns structured JSON payloads for success, denial, and error outcomes.
8
+ * - Requires `name` and supports optional `autoReply`, `role`, and `nextAgent` inputs.
9
+ * - Enforces HITL approval with deterministic deny/timeout handling before persistence.
10
+ * - Generates deterministic system prompt text for multi-agent routing.
11
+ * - Uses world-level chat provider/model settings with deterministic fallbacks.
13
12
  *
14
- * Notes on Implementation:
15
- * - Uses `requestWorldOption` for approval (no custom approval protocol).
16
- * - Uses core `createAgent` manager API to preserve existing persistence and CRUD event behavior.
17
- * - Applies deterministic defaults when world-level provider/model are not configured.
13
+ * Implementation Notes:
14
+ * - Uses manager-level `createAgent` as the persistence boundary.
15
+ * - Returns deterministic JSON-string payloads for success, denial, and errors.
16
+ * - Keeps runtime contract canonical (`autoReply`, `nextAgent`) while aliases are handled upstream.
18
17
  *
19
18
  * Recent Changes:
20
- * - 2026-02-19: Initial implementation of approval-gated `create_agent` built-in tool.
19
+ * - 2026-02-20: Added post-create HITL informational confirmation (`Agent <name> has been created`) with `refreshAfterDismiss` metadata set to true.
20
+ * - 2026-02-20: Pre-claim agent creation slot before approval dialog to prevent parallel-call race where both calls pass approval before either calls createAgent.
21
+ * - 2026-02-20: Updated tool create path to allow manager-level create during the current in-flight world processing turn.
22
+ * - 2026-02-20: Updated `create_agent` default behavior so omitted `autoReply` resolves to `false`.
23
+ * - 2026-02-20: Added initial built-in `create_agent` tool implementation with mandatory approval gate.
21
24
  */
22
25
  import { requestWorldOption } from './hitl.js';
23
- import { createAgent } from './managers.js';
24
- import { LLMProvider } from './types.js';
25
- import { toKebabCase } from './utils.js';
26
+ import { createAgent, claimAgentCreationSlot } from './managers.js';
27
+ import { LLMProvider, EventType } from './types.js';
28
+ import { publishEvent } from './events/publishers.js';
26
29
  const APPROVAL_OPTION_YES = 'yes';
27
30
  const APPROVAL_OPTION_NO = 'no';
31
+ const INFO_OPTION_DISMISS = 'dismiss';
32
+ const DEFAULT_NEXT_AGENT = 'human';
28
33
  const DEFAULT_PROVIDER = LLMProvider.OPENAI;
29
34
  const DEFAULT_MODEL = 'gpt-4';
30
- const DEFAULT_NEXT_AGENT = 'human';
31
- const MAX_ROLE_LENGTH = 240;
32
- function normalizeSingleLineText(value) {
33
- if (typeof value !== 'string')
34
- return '';
35
- return value.replace(/\s+/g, ' ').trim();
35
+ function stringifyResult(payload) {
36
+ return JSON.stringify(payload);
36
37
  }
37
- function resolveRole(role) {
38
- const normalized = normalizeSingleLineText(role);
39
- if (!normalized)
40
- return '';
41
- return normalized.slice(0, MAX_ROLE_LENGTH);
42
- }
43
- function resolveNextAgent(nextAgent) {
44
- const normalized = normalizeSingleLineText(nextAgent);
45
- if (!normalized)
46
- return DEFAULT_NEXT_AGENT;
47
- const stripped = normalized.startsWith('@') ? normalized.slice(1) : normalized;
48
- const token = toKebabCase(stripped);
49
- return token || DEFAULT_NEXT_AGENT;
38
+ function normalizeWhitespace(value) {
39
+ return value.replace(/\s+/g, ' ').trim();
50
40
  }
51
- function resolveProvider(world) {
52
- const configured = normalizeSingleLineText(world?.chatLLMProvider).toLowerCase();
53
- const allProviders = new Set(Object.values(LLMProvider));
54
- if (configured && allProviders.has(configured)) {
55
- return configured;
41
+ function validateAndNormalizeArgs(args) {
42
+ if (typeof args.name !== 'string' || !args.name.trim()) {
43
+ return { valid: false, error: 'Missing required parameter: name' };
56
44
  }
57
- return DEFAULT_PROVIDER;
58
- }
59
- function resolveModel(world) {
60
- const configured = normalizeSingleLineText(world?.chatLLMModel);
61
- return configured || DEFAULT_MODEL;
45
+ if (args.autoReply !== undefined && typeof args.autoReply !== 'boolean') {
46
+ return { valid: false, error: 'Parameter autoReply must be a boolean when provided' };
47
+ }
48
+ if (args.role !== undefined && typeof args.role !== 'string') {
49
+ return { valid: false, error: 'Parameter role must be a string when provided' };
50
+ }
51
+ if (args.nextAgent !== undefined && typeof args.nextAgent !== 'string') {
52
+ return { valid: false, error: 'Parameter nextAgent must be a string when provided' };
53
+ }
54
+ const name = normalizeWhitespace(args.name);
55
+ const autoReply = args.autoReply ?? false;
56
+ const role = typeof args.role === 'string' && args.role.trim()
57
+ ? normalizeWhitespace(args.role)
58
+ : null;
59
+ const nextAgent = typeof args.nextAgent === 'string' && args.nextAgent.trim()
60
+ ? normalizeWhitespace(args.nextAgent)
61
+ : DEFAULT_NEXT_AGENT;
62
+ return {
63
+ valid: true,
64
+ args: { name, autoReply, role, nextAgent },
65
+ };
62
66
  }
63
- function buildSystemPrompt(name, role, nextAgent) {
64
- const roleSentence = role ? `Your role is ${role}.` : 'Your role is not specified.';
65
- return [
66
- `You are agent ${name}. ${roleSentence}`,
67
- '',
68
- 'Always respond in exactly this structure:',
69
- `@${nextAgent}`,
70
- '{Your response}',
71
- ].join('\n');
67
+ function buildDeterministicSystemPrompt(name, role, nextAgent) {
68
+ const firstLine = role
69
+ ? `You are agent ${name}. Your role is ${role}.`
70
+ : `You are agent ${name}.`;
71
+ return `${firstLine}\n\nAlways respond in exactly this structure:\n@${nextAgent}\n{Your response}`;
72
72
  }
73
- function formatResult(payload) {
74
- return JSON.stringify(payload, null, 2);
73
+ function resolveProviderAndModel(world) {
74
+ const provider = typeof world?.chatLLMProvider === 'string' && world.chatLLMProvider.trim()
75
+ ? world.chatLLMProvider
76
+ : DEFAULT_PROVIDER;
77
+ const model = typeof world?.chatLLMModel === 'string' && world.chatLLMModel.trim()
78
+ ? world.chatLLMModel.trim()
79
+ : DEFAULT_MODEL;
80
+ return { provider: provider, model };
75
81
  }
76
- function formatErrorResult(message) {
77
- return formatResult({
78
- success: false,
79
- created: false,
80
- error: message,
82
+ async function requestCreateAgentApproval(options) {
83
+ const approval = await requestWorldOption(options.world, {
84
+ title: `Create agent ${options.name}?`,
85
+ message: [
86
+ `Create a new agent named "${options.name}"?`,
87
+ `Auto reply: ${options.autoReply ? 'enabled' : 'disabled'}`,
88
+ `Role: ${options.role ?? '(none)'}`,
89
+ `Next agent: ${options.nextAgent}`,
90
+ ].join('\n'),
91
+ chatId: options.chatId,
92
+ defaultOptionId: APPROVAL_OPTION_NO,
93
+ options: [
94
+ { id: APPROVAL_OPTION_YES, label: 'Yes', description: 'Create the agent now.' },
95
+ { id: APPROVAL_OPTION_NO, label: 'No', description: 'Do not create the agent.' },
96
+ ],
97
+ metadata: {
98
+ tool: 'create_agent',
99
+ name: options.name,
100
+ autoReply: options.autoReply,
101
+ role: options.role,
102
+ nextAgent: options.nextAgent,
103
+ },
81
104
  });
105
+ if (approval.optionId === APPROVAL_OPTION_YES) {
106
+ return { approved: true, reason: 'approved' };
107
+ }
108
+ if (approval.source === 'timeout') {
109
+ return { approved: false, reason: 'timeout' };
110
+ }
111
+ return { approved: false, reason: 'user_denied' };
82
112
  }
83
- function formatDeniedResult(optionId, source, message) {
84
- return formatResult({
85
- success: false,
86
- created: false,
87
- approval: {
88
- optionId,
89
- source,
90
- approved: false,
113
+ async function requestCreateAgentCreatedInfo(options) {
114
+ await requestWorldOption(options.world, {
115
+ title: `Agent ${options.name} created`,
116
+ message: [
117
+ `Agent ${options.name} has been created.`,
118
+ `Auto reply: ${options.autoReply ? 'enabled' : 'disabled'}`,
119
+ `Role: ${options.role ?? '(none)'}`,
120
+ `Next agent: ${options.nextAgent}`,
121
+ `Provider: ${options.provider}`,
122
+ `Model: ${options.model}`,
123
+ ].join('\n'),
124
+ chatId: options.chatId,
125
+ defaultOptionId: INFO_OPTION_DISMISS,
126
+ options: [
127
+ { id: INFO_OPTION_DISMISS, label: 'Dismiss', description: 'Close this confirmation.' },
128
+ ],
129
+ metadata: {
130
+ kind: 'create_agent_created',
131
+ refreshAfterDismiss: true,
132
+ agent: {
133
+ name: options.name,
134
+ autoReply: options.autoReply,
135
+ role: options.role,
136
+ nextAgent: options.nextAgent,
137
+ provider: options.provider,
138
+ model: options.model,
139
+ },
91
140
  },
92
- message,
93
141
  });
94
142
  }
95
143
  export function createCreateAgentToolDefinition() {
96
144
  return {
97
- description: 'Create a new agent after explicit user approval. Requires `name`; supports optional `autoReply`, `role`, and `nextAgent`.',
145
+ description: 'Create a new agent after explicit user approval. Requires name. Optional: autoReply (alias auto-reply), role, nextAgent (alias next agent).',
98
146
  parameters: {
99
147
  type: 'object',
100
148
  properties: {
101
149
  name: {
102
150
  type: 'string',
103
- description: 'Name for the new agent.',
151
+ description: 'Required agent display name.',
104
152
  },
105
153
  autoReply: {
106
154
  type: 'boolean',
107
- description: 'Optional auto-reply flag. Defaults to true.',
155
+ description: 'Optional auto-reply toggle. Alias forms like "auto-reply" are accepted.',
108
156
  },
109
157
  role: {
110
158
  type: 'string',
111
- description: 'Optional role sentence used in the generated system prompt.',
159
+ description: 'Optional role sentence fragment for deterministic system prompt generation.',
112
160
  },
113
161
  nextAgent: {
114
162
  type: 'string',
115
- description: 'Optional mention target used in the generated response template.',
163
+ description: 'Optional next agent mention target. Alias forms like "next agent" are accepted.',
116
164
  },
117
165
  },
118
166
  required: ['name'],
119
167
  additionalProperties: false,
120
168
  },
121
169
  execute: async (args, _sequenceId, _parentToolCall, context) => {
170
+ const normalized = validateAndNormalizeArgs(args || {});
171
+ if (!normalized.valid) {
172
+ return stringifyResult({
173
+ ok: false,
174
+ status: 'error',
175
+ code: 'validation_error',
176
+ created: false,
177
+ message: normalized.error,
178
+ });
179
+ }
180
+ const world = context?.world;
181
+ const worldId = String(world?.id || '').trim();
182
+ const chatId = context?.chatId ?? world?.currentChatId ?? null;
183
+ if (!world || !worldId) {
184
+ return stringifyResult({
185
+ ok: false,
186
+ status: 'error',
187
+ code: 'approval_unavailable',
188
+ created: false,
189
+ message: 'create_agent requires a valid world context to request approval.',
190
+ });
191
+ }
192
+ // Claim the creation slot BEFORE showing the approval dialog.
193
+ // This prevents a race where two parallel create_agent calls both pass approval
194
+ // before either calls createAgent — the second call would then find the agent
195
+ // already exists and fail with a confusing post-approval error.
196
+ const slot = await claimAgentCreationSlot(worldId, normalized.args.name);
197
+ if (!slot.claimed) {
198
+ return stringifyResult({
199
+ ok: false,
200
+ status: 'error',
201
+ code: 'agent_exists',
202
+ created: false,
203
+ name: normalized.args.name,
204
+ message: slot.reason === 'already_pending'
205
+ ? `Agent '${normalized.args.name}' is already being created.`
206
+ : `Agent '${normalized.args.name}' already exists.`,
207
+ });
208
+ }
209
+ // Track whether createAgent was called so the finally block knows whether
210
+ // to release the slot manually (createAgent's own finally handles it otherwise).
211
+ let createAgentCalled = false;
122
212
  try {
123
- const name = normalizeSingleLineText(args?.name);
124
- if (!name) {
125
- return formatErrorResult('Missing required parameter: name');
126
- }
127
- const world = context?.world;
128
- const worldId = normalizeSingleLineText(world?.id);
129
- if (!world || !worldId || !world.eventEmitter) {
130
- return formatErrorResult('Approval context unavailable: world runtime is required for create_agent.');
131
- }
132
- const autoReply = args?.autoReply !== undefined ? !!args.autoReply : true;
133
- const role = resolveRole(args?.role);
134
- const nextAgent = resolveNextAgent(args?.nextAgent);
135
- const provider = resolveProvider(world);
136
- const model = resolveModel(world);
137
- const systemPrompt = buildSystemPrompt(name, role, nextAgent);
138
- const chatId = context?.chatId ?? world.currentChatId ?? null;
139
- const approval = await requestWorldOption(world, {
140
- title: `Create agent ${name}?`,
141
- message: [
142
- `Create a new agent with name "${name}"?`,
143
- `autoReply: ${String(autoReply)}`,
144
- `role: ${role || '(not specified)'}`,
145
- `nextAgent: ${nextAgent}`,
146
- `provider: ${provider}`,
147
- `model: ${model}`,
148
- ].join('\n'),
213
+ const approval = await requestCreateAgentApproval({
214
+ world,
149
215
  chatId,
150
- defaultOptionId: APPROVAL_OPTION_NO,
151
- options: [
152
- {
153
- id: APPROVAL_OPTION_YES,
154
- label: 'Yes',
155
- description: 'Create this agent now.',
156
- },
157
- {
158
- id: APPROVAL_OPTION_NO,
159
- label: 'No',
160
- description: 'Do not create this agent.',
161
- },
162
- ],
163
- metadata: {
164
- tool: 'create_agent',
165
- name,
166
- autoReply,
167
- role,
168
- nextAgent,
169
- provider,
170
- model,
171
- },
216
+ name: normalized.args.name,
217
+ autoReply: normalized.args.autoReply,
218
+ role: normalized.args.role,
219
+ nextAgent: normalized.args.nextAgent,
172
220
  });
173
- if (approval.optionId !== APPROVAL_OPTION_YES) {
174
- const denialMessage = approval.source === 'timeout'
175
- ? `Agent creation timed out and defaulted to ${approval.optionId}.`
176
- : 'User denied agent creation.';
177
- return formatDeniedResult(approval.optionId, approval.source, denialMessage);
221
+ if (!approval.approved) {
222
+ return stringifyResult({
223
+ ok: false,
224
+ status: 'denied',
225
+ created: false,
226
+ reason: approval.reason,
227
+ name: normalized.args.name,
228
+ });
178
229
  }
179
- const createdAgent = await createAgent(worldId, {
180
- name,
230
+ const { provider, model } = resolveProviderAndModel(world);
231
+ const systemPrompt = buildDeterministicSystemPrompt(normalized.args.name, normalized.args.role, normalized.args.nextAgent);
232
+ const createParams = {
233
+ name: normalized.args.name,
181
234
  type: 'default',
182
- autoReply,
235
+ autoReply: normalized.args.autoReply,
183
236
  provider,
184
237
  model,
185
238
  systemPrompt,
186
- }, { allowWhileProcessing: true });
187
- return formatResult({
188
- success: true,
239
+ };
240
+ createAgentCalled = true;
241
+ const createdAgent = await createAgent(worldId, createParams, {
242
+ allowWhileWorldProcessing: true,
243
+ slotAlreadyClaimed: true,
244
+ });
245
+ // Notify UI to refresh the agent list
246
+ publishEvent(world, EventType.SYSTEM, {
247
+ eventType: 'agent-created',
248
+ agent: {
249
+ id: createdAgent.id,
250
+ name: createdAgent.name,
251
+ type: createdAgent.type,
252
+ autoReply: createdAgent.autoReply ?? false,
253
+ },
254
+ }, chatId);
255
+ try {
256
+ await requestCreateAgentCreatedInfo({
257
+ world,
258
+ chatId,
259
+ name: createdAgent.name,
260
+ autoReply: createdAgent.autoReply ?? false,
261
+ role: normalized.args.role,
262
+ nextAgent: normalized.args.nextAgent,
263
+ provider: createdAgent.provider,
264
+ model: createdAgent.model,
265
+ });
266
+ }
267
+ catch {
268
+ // Agent creation already succeeded. Failure to show a follow-up info
269
+ // prompt must not turn a successful create into an error result.
270
+ }
271
+ return stringifyResult({
272
+ ok: true,
273
+ status: 'created',
189
274
  created: true,
190
275
  agent: {
191
276
  id: createdAgent.id,
192
277
  name: createdAgent.name,
193
- autoReply: createdAgent.autoReply !== false,
278
+ type: createdAgent.type,
279
+ autoReply: createdAgent.autoReply ?? false,
194
280
  provider: createdAgent.provider,
195
281
  model: createdAgent.model,
196
- role: role || null,
197
- nextAgent,
198
- systemPrompt: createdAgent.systemPrompt || systemPrompt,
282
+ },
283
+ effective: {
284
+ role: normalized.args.role,
285
+ nextAgent: normalized.args.nextAgent,
286
+ systemPrompt,
199
287
  },
200
288
  });
201
289
  }
202
290
  catch (error) {
203
- if (error instanceof Error && error.name === 'AbortError') {
204
- throw error;
205
- }
206
291
  const message = error instanceof Error ? error.message : String(error);
207
- return formatErrorResult(message);
292
+ return stringifyResult({
293
+ ok: false,
294
+ status: 'error',
295
+ code: 'create_failed',
296
+ created: false,
297
+ name: normalized.args.name,
298
+ message,
299
+ });
300
+ }
301
+ finally {
302
+ // Release the slot if createAgent was never called (denial, timeout, or
303
+ // pre-creation error). If createAgent was called, its own finally already
304
+ // cleaned up — calling release() again is safe (idempotent Set.delete).
305
+ if (!createAgentCalled) {
306
+ slot.release();
307
+ }
208
308
  }
209
309
  },
210
310
  };
@@ -1 +1 @@
1
- {"version":3,"file":"create-agent-tool.js","sourceRoot":"","sources":["../../core/create-agent-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;A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,EAAE,KAAK;oBACT,MAAM,EAAE,OAAO;oBACf,IAAI,EAAE,eAAe;oBACrB,OAAO,EAAE,KAAK;oBACd,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,IAAI;oBAC1B,OAAO;iBACR,CAAC,CAAC;YACL,CAAC;oBAAS,CAAC;gBACT,wEAAwE;gBACxE,0EAA0E;gBAC1E,wEAAwE;gBACxE,IAAI,CAAC,iBAAiB,EAAE,CAAC;oBACvB,IAAI,CAAC,OAAO,EAAE,CAAC;gBACjB,CAAC;YACH,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -382,7 +382,7 @@ export async function saveIncomingMessageToMemory(world, agent, messageEvent) {
382
382
  * Used for auto-execution flow where tools are executed automatically
383
383
  */
384
384
  export async function continueLLMAfterToolExecution(world, agent, chatId, options) {
385
- const completeActivity = beginWorldActivity(world, `agent:${agent.id}`);
385
+ const completeActivity = beginWorldActivity(world, `agent:${agent.id}`, chatId ?? undefined);
386
386
  try {
387
387
  let hopCount = options?.hopCount ?? 0;
388
388
  const maxToolHops = 50;