@n8n/agents 0.8.1 → 0.9.1

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 (103) hide show
  1. package/dist/build.tsbuildinfo +1 -1
  2. package/dist/index.d.ts +10 -2
  3. package/dist/index.js +57 -4
  4. package/dist/index.js.map +1 -1
  5. package/dist/integrations/langsmith.js +28 -2
  6. package/dist/integrations/langsmith.js.map +1 -1
  7. package/dist/runtime/agent-runtime.d.ts +12 -1
  8. package/dist/runtime/agent-runtime.js +243 -119
  9. package/dist/runtime/agent-runtime.js.map +1 -1
  10. package/dist/runtime/episodic-memory-defaults.d.ts +17 -0
  11. package/dist/runtime/episodic-memory-defaults.js +615 -0
  12. package/dist/runtime/episodic-memory-defaults.js.map +1 -0
  13. package/dist/runtime/episodic-memory.d.ts +45 -0
  14. package/dist/runtime/episodic-memory.js +479 -0
  15. package/dist/runtime/episodic-memory.js.map +1 -0
  16. package/dist/runtime/execution-counter.d.ts +9 -0
  17. package/dist/runtime/execution-counter.js +16 -0
  18. package/dist/runtime/execution-counter.js.map +1 -0
  19. package/dist/runtime/fix-tool-call.d.ts +7 -0
  20. package/dist/runtime/fix-tool-call.js +38 -0
  21. package/dist/runtime/fix-tool-call.js.map +1 -0
  22. package/dist/runtime/lazy-ai.d.ts +2 -0
  23. package/dist/runtime/lazy-ai.js +12 -0
  24. package/dist/runtime/lazy-ai.js.map +1 -0
  25. package/dist/runtime/mcp-connection.d.ts +1 -1
  26. package/dist/runtime/mcp-connection.js +71 -16
  27. package/dist/runtime/mcp-connection.js.map +1 -1
  28. package/dist/runtime/memory-lifecycle.d.ts +34 -0
  29. package/dist/runtime/memory-lifecycle.js +63 -0
  30. package/dist/runtime/memory-lifecycle.js.map +1 -0
  31. package/dist/runtime/memory-store.d.ts +22 -7
  32. package/dist/runtime/memory-store.js +240 -50
  33. package/dist/runtime/memory-store.js.map +1 -1
  34. package/dist/runtime/message-list.d.ts +1 -0
  35. package/dist/runtime/message-list.js +5 -0
  36. package/dist/runtime/message-list.js.map +1 -1
  37. package/dist/runtime/messages.js +14 -1
  38. package/dist/runtime/messages.js.map +1 -1
  39. package/dist/runtime/model-factory.d.ts +5 -1
  40. package/dist/runtime/model-factory.js +3 -2
  41. package/dist/runtime/model-factory.js.map +1 -1
  42. package/dist/runtime/observation-log-defaults.js +6 -5
  43. package/dist/runtime/observation-log-defaults.js.map +1 -1
  44. package/dist/runtime/observation-log-observer.d.ts +7 -13
  45. package/dist/runtime/observation-log-observer.js +11 -21
  46. package/dist/runtime/observation-log-observer.js.map +1 -1
  47. package/dist/runtime/observation-log-reflector.d.ts +5 -5
  48. package/dist/runtime/observation-log-reflector.js +9 -21
  49. package/dist/runtime/observation-log-reflector.js.map +1 -1
  50. package/dist/runtime/scoped-memory-task-runner.d.ts +2 -4
  51. package/dist/runtime/scoped-memory-task-runner.js +3 -7
  52. package/dist/runtime/scoped-memory-task-runner.js.map +1 -1
  53. package/dist/runtime/stream.js +11 -1
  54. package/dist/runtime/stream.js.map +1 -1
  55. package/dist/runtime/title-generation.d.ts +5 -2
  56. package/dist/runtime/title-generation.js +7 -3
  57. package/dist/runtime/title-generation.js.map +1 -1
  58. package/dist/runtime/tool-adapter.d.ts +1 -1
  59. package/dist/runtime/tool-adapter.js +5 -4
  60. package/dist/runtime/tool-adapter.js.map +1 -1
  61. package/dist/sdk/agent.d.ts +10 -0
  62. package/dist/sdk/agent.js +77 -11
  63. package/dist/sdk/agent.js.map +1 -1
  64. package/dist/sdk/memory.d.ts +6 -2
  65. package/dist/sdk/memory.js +57 -3
  66. package/dist/sdk/memory.js.map +1 -1
  67. package/dist/sdk/telemetry.d.ts +1 -0
  68. package/dist/sdk/telemetry.js +7 -0
  69. package/dist/sdk/telemetry.js.map +1 -1
  70. package/dist/skills/index.d.ts +6 -0
  71. package/dist/skills/index.js +29 -0
  72. package/dist/skills/index.js.map +1 -0
  73. package/dist/skills/prompt.d.ts +6 -0
  74. package/dist/skills/prompt.js +49 -0
  75. package/dist/skills/prompt.js.map +1 -0
  76. package/dist/skills/registry.d.ts +14 -0
  77. package/dist/skills/registry.js +380 -0
  78. package/dist/skills/registry.js.map +1 -0
  79. package/dist/skills/tools.d.ts +6 -0
  80. package/dist/skills/tools.js +312 -0
  81. package/dist/skills/tools.js.map +1 -0
  82. package/dist/skills/types.d.ts +141 -0
  83. package/dist/skills/types.js +15 -0
  84. package/dist/skills/types.js.map +1 -0
  85. package/dist/skills/validator.d.ts +15 -0
  86. package/dist/skills/validator.js +336 -0
  87. package/dist/skills/validator.js.map +1 -0
  88. package/dist/types/index.d.ts +4 -4
  89. package/dist/types/index.js +1 -3
  90. package/dist/types/index.js.map +1 -1
  91. package/dist/types/runtime/event.d.ts +1 -1
  92. package/dist/types/sdk/agent-builder.d.ts +4 -1
  93. package/dist/types/sdk/agent.d.ts +2 -1
  94. package/dist/types/sdk/memory.d.ts +153 -2
  95. package/dist/types/sdk/observation-log.d.ts +7 -10
  96. package/dist/types/sdk/observation-log.js +0 -9
  97. package/dist/types/sdk/observation-log.js.map +1 -1
  98. package/dist/types/sdk/observation.d.ts +1 -4
  99. package/dist/workspace/tools/execute-command.js +2 -0
  100. package/dist/workspace/tools/execute-command.js.map +1 -1
  101. package/dist/workspace/types.d.ts +1 -0
  102. package/dist/workspace/types.js.map +1 -1
  103. package/package.json +28 -3
@@ -0,0 +1,336 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RUNTIME_SKILL_NAME_PATTERN = void 0;
4
+ exports.validateRuntimeSkill = validateRuntimeSkill;
5
+ exports.parseRuntimeSkillMarkdown = parseRuntimeSkillMarkdown;
6
+ const yaml_1 = require("yaml");
7
+ const types_1 = require("./types");
8
+ exports.RUNTIME_SKILL_NAME_PATTERN = /^[a-z0-9][a-z0-9._-]{0,63}$/;
9
+ const RUNTIME_SKILL_FRONTMATTER_FIELDS = [
10
+ 'name',
11
+ 'description',
12
+ 'recommended_tools',
13
+ 'allowed_tools',
14
+ 'interface',
15
+ 'policy',
16
+ 'dependencies',
17
+ 'platforms',
18
+ 'version',
19
+ 'license',
20
+ 'compatibility',
21
+ 'metadata',
22
+ ];
23
+ function validateRuntimeSkill(skill) {
24
+ const errors = [];
25
+ requiredString(skill.id, 'id', errors);
26
+ requiredString(skill.name, 'name', errors);
27
+ requiredString(skill.description, 'description', errors);
28
+ requiredString(skill.instructions, 'instructions', errors);
29
+ if (errors.length > 0)
30
+ return { ok: false, errors };
31
+ return { ok: true, skill };
32
+ }
33
+ function parseRuntimeSkillMarkdown(content, options = {}) {
34
+ const frontmatter = parseFrontmatter(content, options.sourcePath ?? options.path ?? types_1.RUNTIME_SKILL_FILE_NAME);
35
+ if (!frontmatter.ok)
36
+ return frontmatter;
37
+ const errors = [];
38
+ rejectUnknownFields(frontmatter.data, RUNTIME_SKILL_FRONTMATTER_FIELDS, undefined, errors);
39
+ const name = requiredFrontmatterString(frontmatter.data, 'name', errors);
40
+ if (name && (options.validateName ?? true) && !exports.RUNTIME_SKILL_NAME_PATTERN.test(name)) {
41
+ errors.push({
42
+ code: 'invalid_name',
43
+ message: `Invalid skill name "${name}"`,
44
+ field: 'name',
45
+ hint: 'Use lowercase letters, numbers, dots, underscores, or dashes; max length is 64.',
46
+ });
47
+ }
48
+ const description = requiredFrontmatterString(frontmatter.data, 'description', errors);
49
+ const recommendedTools = optionalStringArray(frontmatter.data, 'recommended_tools', errors);
50
+ const allowedTools = optionalStringArray(frontmatter.data, 'allowed_tools', errors);
51
+ const skillInterface = optionalSkillInterface(frontmatter.data, errors);
52
+ const policy = optionalSkillPolicy(frontmatter.data, errors);
53
+ const dependencies = optionalSkillDependencies(frontmatter.data, errors);
54
+ const platforms = optionalStringArray(frontmatter.data, 'platforms', errors)?.map((platform) => platform.toLowerCase());
55
+ const version = optionalFrontmatterString(frontmatter.data, 'version', errors);
56
+ const license = optionalFrontmatterString(frontmatter.data, 'license', errors);
57
+ const compatibility = optionalFrontmatterString(frontmatter.data, 'compatibility', errors);
58
+ const metadata = optionalFrontmatterRecord(frontmatter.data, 'metadata', errors);
59
+ if (errors.length > 0 || !name || !description)
60
+ return { ok: false, errors };
61
+ return validateRuntimeSkill({
62
+ id: options.id ?? name,
63
+ name,
64
+ description,
65
+ instructions: frontmatter.body.trim(),
66
+ ...(options.sourceName ? { sourceName: options.sourceName } : {}),
67
+ ...(options.path ? { path: options.path } : {}),
68
+ ...(options.sourcePath ? { sourcePath: options.sourcePath } : {}),
69
+ ...(options.directory ? { directory: options.directory } : {}),
70
+ ...(options.sourceDirectory ? { sourceDirectory: options.sourceDirectory } : {}),
71
+ ...(options.category ? { category: options.category } : {}),
72
+ ...(recommendedTools ? { recommendedTools } : {}),
73
+ ...(allowedTools ? { allowedTools } : {}),
74
+ ...(skillInterface ? { interface: skillInterface } : {}),
75
+ ...(policy ? { policy } : {}),
76
+ ...(dependencies ? { dependencies } : {}),
77
+ ...(version ? { version } : {}),
78
+ ...(license ? { license } : {}),
79
+ ...(compatibility ? { compatibility } : {}),
80
+ ...(platforms ? { platforms } : {}),
81
+ ...((options.metadata ?? metadata)
82
+ ? { metadata: { ...(metadata ?? {}), ...(options.metadata ?? {}) } }
83
+ : {}),
84
+ });
85
+ }
86
+ function parseFrontmatter(content, sourcePath) {
87
+ const lines = content.split(/\r?\n/);
88
+ if (lines[0]?.trim() !== '---') {
89
+ return {
90
+ ok: false,
91
+ errors: [
92
+ {
93
+ code: 'missing_frontmatter',
94
+ message: `${types_1.RUNTIME_SKILL_FILE_NAME} must start with a YAML frontmatter delimiter`,
95
+ path: sourcePath,
96
+ },
97
+ ],
98
+ };
99
+ }
100
+ const endIndex = lines.findIndex((line, index) => index > 0 && line.trim() === '---');
101
+ if (endIndex === -1) {
102
+ return {
103
+ ok: false,
104
+ errors: [
105
+ {
106
+ code: 'unterminated_frontmatter',
107
+ message: `${types_1.RUNTIME_SKILL_FILE_NAME} frontmatter must end with a YAML delimiter`,
108
+ path: sourcePath,
109
+ },
110
+ ],
111
+ };
112
+ }
113
+ let data;
114
+ try {
115
+ data = (0, yaml_1.parse)(lines.slice(1, endIndex).join('\n'));
116
+ }
117
+ catch (error) {
118
+ return {
119
+ ok: false,
120
+ errors: [
121
+ {
122
+ code: 'invalid_yaml',
123
+ message: `${types_1.RUNTIME_SKILL_FILE_NAME} frontmatter YAML is invalid: ${error instanceof Error ? error.message : String(error)}`,
124
+ path: sourcePath,
125
+ },
126
+ ],
127
+ };
128
+ }
129
+ if (!isRecord(data)) {
130
+ return {
131
+ ok: false,
132
+ errors: [
133
+ {
134
+ code: 'frontmatter_not_object',
135
+ message: `${types_1.RUNTIME_SKILL_FILE_NAME} frontmatter must be a YAML object`,
136
+ path: sourcePath,
137
+ },
138
+ ],
139
+ };
140
+ }
141
+ return { ok: true, data, body: lines.slice(endIndex + 1).join('\n') };
142
+ }
143
+ function requiredString(value, field, errors, displayField = field) {
144
+ const normalized = optionalString(value);
145
+ if (!normalized) {
146
+ errors.push({
147
+ code: 'missing_required_field',
148
+ message: `Missing required field "${displayField}"`,
149
+ field: displayField,
150
+ });
151
+ }
152
+ return normalized;
153
+ }
154
+ function requiredFrontmatterString(frontmatter, field, errors, displayField = field) {
155
+ return requiredString(frontmatter[field], field, errors, displayField);
156
+ }
157
+ function optionalFrontmatterString(frontmatter, field, errors, displayField = field) {
158
+ const value = frontmatter[field];
159
+ if (value === undefined || value === null)
160
+ return undefined;
161
+ const normalized = optionalString(value);
162
+ if (!normalized) {
163
+ errors.push({
164
+ code: 'invalid_field',
165
+ message: `Field "${displayField}" must be a non-empty string`,
166
+ field: displayField,
167
+ });
168
+ }
169
+ return normalized;
170
+ }
171
+ function optionalStringArray(frontmatter, field, errors, displayField = field) {
172
+ const value = frontmatter[field];
173
+ if (value === undefined || value === null)
174
+ return undefined;
175
+ if (typeof value === 'string' && value.trim() !== '')
176
+ return [value.trim()];
177
+ if (!Array.isArray(value)) {
178
+ errors.push({
179
+ code: 'invalid_field',
180
+ message: `Field "${displayField}" must be a string array`,
181
+ field: displayField,
182
+ });
183
+ return undefined;
184
+ }
185
+ const strings = value
186
+ .map((item) => optionalString(item))
187
+ .filter((item) => Boolean(item));
188
+ if (strings.length !== value.length) {
189
+ errors.push({
190
+ code: 'invalid_field',
191
+ message: `Field "${displayField}" must contain only non-empty strings`,
192
+ field: displayField,
193
+ });
194
+ }
195
+ return strings.length > 0 ? strings : undefined;
196
+ }
197
+ function optionalFrontmatterRecord(frontmatter, field, errors, displayField = field) {
198
+ const value = frontmatter[field];
199
+ if (value === undefined || value === null)
200
+ return undefined;
201
+ if (!isRecord(value)) {
202
+ errors.push({
203
+ code: 'invalid_field',
204
+ message: `Field "${displayField}" must be a YAML object`,
205
+ field: displayField,
206
+ });
207
+ return undefined;
208
+ }
209
+ return value;
210
+ }
211
+ function optionalBoolean(frontmatter, field, errors, displayField = field) {
212
+ const value = frontmatter[field];
213
+ if (value === undefined || value === null)
214
+ return undefined;
215
+ if (typeof value !== 'boolean') {
216
+ errors.push({
217
+ code: 'invalid_field',
218
+ message: `Field "${displayField}" must be a boolean`,
219
+ field: displayField,
220
+ });
221
+ return undefined;
222
+ }
223
+ return value;
224
+ }
225
+ function optionalSkillInterface(frontmatter, errors) {
226
+ const value = optionalFrontmatterRecord(frontmatter, 'interface', errors);
227
+ if (!value)
228
+ return undefined;
229
+ rejectUnknownFields(value, ['display_name', 'short_description', 'default_prompt', 'icon', 'brand_color'], 'interface', errors);
230
+ const displayName = optionalFrontmatterString(value, 'display_name', errors, 'interface.display_name');
231
+ const shortDescription = optionalFrontmatterString(value, 'short_description', errors, 'interface.short_description');
232
+ const defaultPrompt = optionalFrontmatterString(value, 'default_prompt', errors, 'interface.default_prompt');
233
+ const icon = optionalFrontmatterString(value, 'icon', errors, 'interface.icon');
234
+ const brandColor = optionalFrontmatterString(value, 'brand_color', errors, 'interface.brand_color');
235
+ const skillInterface = {
236
+ ...(displayName ? { displayName } : {}),
237
+ ...(shortDescription ? { shortDescription } : {}),
238
+ ...(defaultPrompt ? { defaultPrompt } : {}),
239
+ ...(icon ? { icon } : {}),
240
+ ...(brandColor ? { brandColor } : {}),
241
+ };
242
+ return hasContractFields(skillInterface) ? skillInterface : undefined;
243
+ }
244
+ function optionalSkillPolicy(frontmatter, errors) {
245
+ const value = optionalFrontmatterRecord(frontmatter, 'policy', errors);
246
+ if (!value)
247
+ return undefined;
248
+ rejectUnknownFields(value, ['allow_implicit_invocation', 'product'], 'policy', errors);
249
+ const allowImplicitInvocation = optionalBoolean(value, 'allow_implicit_invocation', errors, 'policy.allow_implicit_invocation');
250
+ const product = optionalFrontmatterString(value, 'product', errors, 'policy.product');
251
+ const policy = {
252
+ ...(allowImplicitInvocation !== undefined ? { allowImplicitInvocation } : {}),
253
+ ...(product ? { product } : {}),
254
+ };
255
+ return hasContractFields(policy) ? policy : undefined;
256
+ }
257
+ function optionalSkillDependencies(frontmatter, errors) {
258
+ const value = optionalFrontmatterRecord(frontmatter, 'dependencies', errors);
259
+ if (!value)
260
+ return undefined;
261
+ rejectUnknownFields(value, ['tools', 'secrets', 'mcp_servers'], 'dependencies', errors);
262
+ const tools = optionalStringArray(value, 'tools', errors, 'dependencies.tools');
263
+ const secrets = optionalStringArray(value, 'secrets', errors, 'dependencies.secrets');
264
+ const mcpServers = optionalMcpServers(value, errors);
265
+ const dependencies = {
266
+ ...(tools ? { tools } : {}),
267
+ ...(secrets ? { secrets } : {}),
268
+ ...(mcpServers ? { mcpServers } : {}),
269
+ };
270
+ return hasContractFields(dependencies) ? dependencies : undefined;
271
+ }
272
+ function optionalMcpServers(frontmatter, errors) {
273
+ const value = frontmatter.mcp_servers;
274
+ if (value === undefined || value === null)
275
+ return undefined;
276
+ if (!Array.isArray(value)) {
277
+ errors.push({
278
+ code: 'invalid_field',
279
+ message: 'Field "dependencies.mcp_servers" must be an array',
280
+ field: 'dependencies.mcp_servers',
281
+ });
282
+ return undefined;
283
+ }
284
+ const servers = [];
285
+ value.forEach((item, index) => {
286
+ const field = `dependencies.mcp_servers[${index}]`;
287
+ if (!isRecord(item)) {
288
+ errors.push({
289
+ code: 'invalid_field',
290
+ message: `Field "${field}" must be a YAML object`,
291
+ field,
292
+ });
293
+ return;
294
+ }
295
+ rejectUnknownFields(item, ['name', 'description', 'transport', 'url', 'command'], field, errors);
296
+ const name = requiredFrontmatterString(item, 'name', errors, `${field}.name`);
297
+ const description = optionalFrontmatterString(item, 'description', errors, `${field}.description`);
298
+ const transport = optionalFrontmatterString(item, 'transport', errors, `${field}.transport`);
299
+ const url = optionalFrontmatterString(item, 'url', errors, `${field}.url`);
300
+ const command = optionalFrontmatterString(item, 'command', errors, `${field}.command`);
301
+ if (!name)
302
+ return;
303
+ servers.push({
304
+ name,
305
+ ...(description ? { description } : {}),
306
+ ...(transport ? { transport } : {}),
307
+ ...(url ? { url } : {}),
308
+ ...(command ? { command } : {}),
309
+ });
310
+ });
311
+ return servers.length > 0 ? servers : undefined;
312
+ }
313
+ function rejectUnknownFields(value, allowedFields, fieldPrefix, errors) {
314
+ const allowed = new Set(allowedFields);
315
+ for (const field of Object.keys(value)) {
316
+ if (allowed.has(field))
317
+ continue;
318
+ const nestedField = fieldPrefix ? `${fieldPrefix}.${field}` : field;
319
+ errors.push({
320
+ code: 'unknown_field',
321
+ message: `Unknown field "${nestedField}"`,
322
+ field: nestedField,
323
+ hint: 'Use metadata for extension data outside the skill contract.',
324
+ });
325
+ }
326
+ }
327
+ function hasContractFields(value) {
328
+ return Object.keys(value).length > 0;
329
+ }
330
+ function optionalString(value) {
331
+ return typeof value === 'string' && value.trim().length > 0 ? value.trim() : undefined;
332
+ }
333
+ function isRecord(value) {
334
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
335
+ }
336
+ //# sourceMappingURL=validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.js","sourceRoot":"","sources":["../../src/skills/validator.ts"],"names":[],"mappings":";;;AAyCA,oDAWC;AAED,8DA+DC;AArHD,+BAA0C;AAE1C,mCASiB;AAEJ,QAAA,0BAA0B,GAAG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AI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACxC,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC;YAAE,SAAS;QAEjC,MAAM,WAAW,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;QACpE,MAAM,CAAC,IAAI,CAAC;YACX,IAAI,EAAE,eAAe;YACrB,OAAO,EAAE,kBAAkB,WAAW,GAAG;YACzC,KAAK,EAAE,WAAW;YAClB,IAAI,EAAE,6DAA6D;SACnE,CAAC,CAAC;IACJ,CAAC;AACF,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAa;IACvC,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;AACtC,CAAC;AAED,SAAS,cAAc,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACxF,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC/B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC7E,CAAC"}
@@ -4,10 +4,10 @@ export type { Provider, AnthropicThinkingConfig, OpenAIThinkingConfig, GoogleThi
4
4
  export type { AgentResult, StreamChunk, FinishReason, TokenUsage, ModelConfig, RunOptions, ExecutionOptions, AgentExecutionCounter, PersistedExecutionOptions, ResumeOptions, GenerateResult, StreamResult, SubAgentUsage, BuiltAgent, AgentRunState, AgentResumeData, PendingToolCall, SerializableAgentState, } from './sdk/agent';
5
5
  export type { SerializedMessageList } from './runtime/message-list';
6
6
  export type { ToolContext, InterruptibleToolContext, BuiltTool, BuiltProviderTool, } from './sdk/tool';
7
- export type { Thread, BuiltMemory, ObservationCapableMemory, MemoryDescriptor, SemanticRecallConfig, MemoryConfig, ObservationLogMemoryConfig, ObservationalMemoryConfig, CheckpointStore, TitleGenerationConfig, } from './sdk/memory';
8
- export type { ObservationCursor, ScopeKind, } from './sdk/observation';
9
- export type { BuiltObservationLogStore, BuiltObservationLogTaskLockStore, NewObservationLogEntry, ObservationLogEntry, ObservationLogMarker, ObservationLogMerge, ObservationLogObserveFn, ObservationLogObserverInput, ObservationLogReadOptions, ObservationLogReflectFn, ObservationLogReflectorInput, ObservationLogReflection, ObservationLogReflectionResult, ObservationLogScope, ObservationLogScopeKind, ObservationLogStatus, ObservationLogTaskKind, ObservationLogTaskLockHandle, TokenCounter, } from './sdk/observation-log';
10
- export { createObservationLogThreadScopeId, createObservationLogThreadScopePrefix, estimateObservationTokens, OBSERVATION_LOG_MARKERS, OBSERVATION_LOG_STATUSES, } from './sdk/observation-log';
7
+ export type { Thread, BuiltMemory, BuiltEpisodicMemoryStore, EpisodicMemoryConfig, EpisodicMemoryCursor, EpisodicMemoryEmbeddingProviderOptions, EpisodicMemoryEntry, EpisodicMemoryEntrySource, EpisodicMemoryExtractFn, EpisodicMemoryExtraction, EpisodicMemoryExtractionCandidate, EpisodicMemoryExtractorInput, EpisodicMemoryMethods, EpisodicMemoryPrompts, EpisodicMemoryReflectFn, EpisodicMemoryReflection, EpisodicMemoryReflectionApply, EpisodicMemoryReflectionApplyMerge, EpisodicMemoryReflectionMerge, EpisodicMemoryReflectionResult, EpisodicMemoryReflectorInput, EpisodicMemoryScope, EpisodicMemorySearchOptions, EpisodicMemoryStatus, EpisodicMemoryTaskLockHandle, EpisodicMemoryTaskLockMethods, NewEpisodicMemoryCursor, NewEpisodicMemoryEntry, NewEpisodicMemoryEntrySource, NewEpisodicMemoryEntrySourceForEntry, RetrievedEpisodicMemoryEntry, ObservationCapableMemory, MemoryDescriptor, SemanticRecallConfig, MemoryConfig, ObservationLogMemoryConfig, ObservationalMemoryConfig, CheckpointStore, TitleGenerationConfig, } from './sdk/memory';
8
+ export type { ObservationCursor } from './sdk/observation';
9
+ export type { BuiltObservationLogStore, BuiltObservationLogTaskLockStore, NewObservationLogEntry, ObservationLogEntry, ObservationLogMarker, ObservationLogMerge, ObservationLogObserveFn, ObservationLogObserverInput, ObservationLogReadOptions, ObservationLogReflectFn, ObservationLogReflectorInput, ObservationLogReflection, ObservationLogReflectionResult, ObservationLogScope, ObservationLogStatus, ObservationLogTaskKind, ObservationLogTaskLockHandle, TokenCounter, } from './sdk/observation-log';
10
+ export { estimateObservationTokens, OBSERVATION_LOG_MARKERS, OBSERVATION_LOG_STATUSES, } from './sdk/observation-log';
11
11
  export type { EvalInput, EvalScore, JudgeFn, JudgeInput, CheckFn, JudgeHandlerFn, BuiltEval, EvalRunResult, EvalResults, } from './sdk/eval';
12
12
  export type { GuardrailType, GuardrailStrategy, PiiDetectionType, BuiltGuardrail, } from './sdk/guardrail';
13
13
  export type { BuiltTelemetry, AttributeValue, OpaqueTracer, OpaqueTracerProvider, } from './telemetry';
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AgentEvent = exports.OBSERVATION_LOG_STATUSES = exports.OBSERVATION_LOG_MARKERS = exports.estimateObservationTokens = exports.createObservationLogThreadScopePrefix = exports.createObservationLogThreadScopeId = void 0;
3
+ exports.AgentEvent = exports.OBSERVATION_LOG_STATUSES = exports.OBSERVATION_LOG_MARKERS = exports.estimateObservationTokens = void 0;
4
4
  var observation_log_1 = require("./sdk/observation-log");
5
- Object.defineProperty(exports, "createObservationLogThreadScopeId", { enumerable: true, get: function () { return observation_log_1.createObservationLogThreadScopeId; } });
6
- Object.defineProperty(exports, "createObservationLogThreadScopePrefix", { enumerable: true, get: function () { return observation_log_1.createObservationLogThreadScopePrefix; } });
7
5
  Object.defineProperty(exports, "estimateObservationTokens", { enumerable: true, get: function () { return observation_log_1.estimateObservationTokens; } });
8
6
  Object.defineProperty(exports, "OBSERVATION_LOG_MARKERS", { enumerable: true, get: function () { return observation_log_1.OBSERVATION_LOG_MARKERS; } });
9
7
  Object.defineProperty(exports, "OBSERVATION_LOG_STATUSES", { enumerable: true, get: function () { return observation_log_1.OBSERVATION_LOG_STATUSES; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;AAmGA,yDAM+B;AAL9B,oIAAA,iCAAiC,OAAA;AACjC,wIAAA,qCAAqC,OAAA;AACrC,4HAAA,yBAAyB,OAAA;AACzB,0HAAA,uBAAuB,OAAA;AACvB,2HAAA,wBAAwB,OAAA;AA6BzB,yCAA6C;AAApC,mGAAA,UAAU,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;AA4HA,yDAI+B;AAH9B,4HAAA,yBAAyB,OAAA;AACzB,0HAAA,uBAAuB,OAAA;AACvB,2HAAA,wBAAwB,OAAA;AA6BzB,yCAA6C;AAApC,mGAAA,UAAU,OAAA"}
@@ -34,7 +34,7 @@ export type AgentEventData = {
34
34
  type: AgentEvent.Error;
35
35
  message: string;
36
36
  error: unknown;
37
- source?: 'observer' | 'reflector';
37
+ source?: 'observer' | 'reflector' | 'episodic-memory';
38
38
  };
39
39
  export type AgentEventHandler = (data: AgentEventData) => void;
40
40
  export interface AgentMiddleware {
@@ -1,8 +1,9 @@
1
- import type { ModelConfig } from './agent';
1
+ import type { ExecutionOptions, ModelConfig } from './agent';
2
2
  import type { BuiltEval } from './eval';
3
3
  import type { BuiltGuardrail } from './guardrail';
4
4
  import type { CheckpointStore } from './memory';
5
5
  import type { BuiltProviderTool, BuiltTool } from './tool';
6
+ import type { RuntimeSkill, RuntimeSkillSource } from '../../skills';
6
7
  export interface AgentBuilder {
7
8
  model(providerOrIdOrConfig: string | ModelConfig, modelName?: string): this;
8
9
  instructions(text: string): this;
@@ -12,6 +13,7 @@ export interface AgentBuilder {
12
13
  topK?: number;
13
14
  };
14
15
  }): this;
16
+ skills(sourceOrSkills: RuntimeSkillSource | RuntimeSkill[]): this;
15
17
  providerTool(t: BuiltProviderTool): this;
16
18
  thinking(provider: string, config?: Record<string, unknown>): this;
17
19
  toolCallConcurrency(n: number): this;
@@ -24,4 +26,5 @@ export interface AgentBuilder {
24
26
  structuredOutput(schema: unknown): this;
25
27
  telemetry(t: unknown): this;
26
28
  mcp(client: unknown): this;
29
+ configuration(options: ExecutionOptions): this;
27
30
  }
@@ -8,7 +8,7 @@ import type { AgentEvent, AgentEventHandler } from '../runtime/event';
8
8
  import type { SerializedMessageList } from '../runtime/message-list';
9
9
  import type { BuiltTelemetry } from '../telemetry';
10
10
  import type { JSONValue } from '../utils/json';
11
- export type FinishReason = 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other';
11
+ export type FinishReason = 'stop' | 'max-iterations' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other';
12
12
  export type TokenUsage<T extends Record<string, unknown> = Record<string, unknown>> = {
13
13
  promptTokens: number;
14
14
  completionTokens: number;
@@ -212,6 +212,7 @@ export interface SerializableAgentState {
212
212
  finishReason?: FinishReason;
213
213
  usage?: TokenUsage;
214
214
  executionOptions?: PersistedExecutionOptions;
215
+ iterationCount?: number;
215
216
  }
216
217
  export type AgentPersistenceOptions = {
217
218
  threadId: string;
@@ -1,6 +1,7 @@
1
- import type { ModelConfig, SerializableAgentState } from './agent';
1
+ import type { EmbeddingModel } from 'ai';
2
+ import type { AgentExecutionCounter, ModelConfig, SerializableAgentState } from './agent';
2
3
  import type { AgentDbMessage } from './message';
3
- import type { BuiltObservationLogStore, ObservationLogObserveFn, ObservationLogReflectFn } from './observation-log';
4
+ import type { BuiltObservationLogStore, ObservationLogEntry, ObservationLogObserveFn, ObservationLogReflectFn, ObservationLogScope } from './observation-log';
4
5
  import type { JSONObject } from '../utils/json';
5
6
  export interface MemoryDescriptor<TParams extends JSONObject = JSONObject> {
6
7
  name: string;
@@ -61,6 +62,7 @@ export interface BuiltMemory {
61
62
  id: string;
62
63
  score: number;
63
64
  }>>;
65
+ episodic?: EpisodicMemoryMethods;
64
66
  close?(): Promise<void>;
65
67
  describe(): MemoryDescriptor;
66
68
  }
@@ -74,6 +76,154 @@ export interface SemanticRecallConfig {
74
76
  embedder?: string;
75
77
  apiKey?: string;
76
78
  }
79
+ export type EpisodicMemoryStatus = 'active' | 'superseded' | 'dropped';
80
+ export interface EpisodicMemoryScope {
81
+ resourceId: string;
82
+ }
83
+ export interface EpisodicMemoryEntry {
84
+ id: string;
85
+ resourceId: string;
86
+ content: string;
87
+ contentHash: string;
88
+ status: EpisodicMemoryStatus;
89
+ supersededBy: string | null;
90
+ embedding?: number[];
91
+ embeddingModel?: string;
92
+ metadata?: JSONObject | null;
93
+ createdAt: Date;
94
+ updatedAt: Date;
95
+ lastSeenAt: Date;
96
+ }
97
+ export type NewEpisodicMemoryEntry = Omit<EpisodicMemoryEntry, 'id' | 'contentHash' | 'status' | 'supersededBy' | 'createdAt' | 'updatedAt' | 'lastSeenAt'> & {
98
+ contentHash?: string;
99
+ createdAt?: Date;
100
+ lastSeenAt?: Date;
101
+ };
102
+ export interface EpisodicMemoryEntrySource {
103
+ id: string;
104
+ memoryEntryId: string;
105
+ observationId: string;
106
+ threadId: string;
107
+ evidenceText: string;
108
+ createdAt: Date;
109
+ }
110
+ export type NewEpisodicMemoryEntrySource = Omit<EpisodicMemoryEntrySource, 'id' | 'createdAt'> & {
111
+ createdAt?: Date;
112
+ };
113
+ export type NewEpisodicMemoryEntrySourceForEntry = Omit<NewEpisodicMemoryEntrySource, 'memoryEntryId'>;
114
+ export interface EpisodicMemoryCursor extends ObservationLogScope {
115
+ lastIndexedObservationId: string;
116
+ lastIndexedObservationCreatedAt: Date;
117
+ updatedAt: Date;
118
+ }
119
+ export type NewEpisodicMemoryCursor = Omit<EpisodicMemoryCursor, 'updatedAt'> & {
120
+ updatedAt?: Date;
121
+ };
122
+ export interface RetrievedEpisodicMemoryEntry extends EpisodicMemoryEntry {
123
+ lexicalScore: number;
124
+ vectorScore: number;
125
+ rrfScore: number;
126
+ finalScore: number;
127
+ }
128
+ export interface EpisodicMemorySearchOptions {
129
+ topK?: number;
130
+ queryEmbedding?: number[];
131
+ includeStatuses?: EpisodicMemoryStatus[];
132
+ }
133
+ export interface EpisodicMemoryTaskLockHandle {
134
+ resourceId: string;
135
+ holderId: string;
136
+ heldUntil: Date;
137
+ }
138
+ export interface EpisodicMemoryTaskLockMethods {
139
+ acquire(resourceId: string, opts: {
140
+ ttlMs: number;
141
+ holderId: string;
142
+ }): Promise<EpisodicMemoryTaskLockHandle | null>;
143
+ release(handle: EpisodicMemoryTaskLockHandle): Promise<void>;
144
+ }
145
+ export interface EpisodicMemoryMethods {
146
+ saveEntryWithSources(entry: NewEpisodicMemoryEntry, sources: NewEpisodicMemoryEntrySourceForEntry[]): Promise<EpisodicMemoryEntry | null>;
147
+ searchEntries(scope: EpisodicMemoryScope, query: string, opts?: EpisodicMemorySearchOptions): Promise<RetrievedEpisodicMemoryEntry[]>;
148
+ getEntrySources(entryIds: string[]): Promise<EpisodicMemoryEntrySource[]>;
149
+ applyReflection(scope: EpisodicMemoryScope, reflection: EpisodicMemoryReflectionApply): Promise<EpisodicMemoryReflectionResult>;
150
+ getCursor(scope: ObservationLogScope): Promise<EpisodicMemoryCursor | null>;
151
+ setCursor(cursor: NewEpisodicMemoryCursor): Promise<void>;
152
+ taskLock?: EpisodicMemoryTaskLockMethods;
153
+ }
154
+ export interface BuiltEpisodicMemoryStore {
155
+ episodic: EpisodicMemoryMethods;
156
+ }
157
+ export interface EpisodicMemoryExtractionCandidate {
158
+ content: string;
159
+ sources: Array<{
160
+ observationId: string;
161
+ evidence: string;
162
+ }>;
163
+ }
164
+ export interface EpisodicMemoryExtractorInput {
165
+ scope: EpisodicMemoryScope;
166
+ observationScope: ObservationLogScope;
167
+ now: Date;
168
+ observations: ObservationLogEntry[];
169
+ renderedObservations: string;
170
+ existingEntries: RetrievedEpisodicMemoryEntry[];
171
+ executionCounter?: AgentExecutionCounter;
172
+ }
173
+ export interface EpisodicMemoryExtraction {
174
+ entries: EpisodicMemoryExtractionCandidate[];
175
+ }
176
+ export type EpisodicMemoryExtractFn = (input: EpisodicMemoryExtractorInput) => Promise<EpisodicMemoryExtraction>;
177
+ export interface EpisodicMemoryReflectionMerge {
178
+ supersedes: string[];
179
+ content: string;
180
+ }
181
+ export interface EpisodicMemoryReflection {
182
+ drop: string[];
183
+ merge: EpisodicMemoryReflectionMerge[];
184
+ }
185
+ export interface EpisodicMemoryReflectorInput {
186
+ scope: EpisodicMemoryScope;
187
+ now: Date;
188
+ seedEntryIds: string[];
189
+ entries: RetrievedEpisodicMemoryEntry[];
190
+ sources: EpisodicMemoryEntrySource[];
191
+ executionCounter?: AgentExecutionCounter;
192
+ }
193
+ export type EpisodicMemoryReflectFn = (input: EpisodicMemoryReflectorInput) => Promise<EpisodicMemoryReflection>;
194
+ export interface EpisodicMemoryReflectionApplyMerge {
195
+ supersedes: string[];
196
+ entry: NewEpisodicMemoryEntry;
197
+ }
198
+ export interface EpisodicMemoryReflectionApply {
199
+ drop: string[];
200
+ merge: EpisodicMemoryReflectionApplyMerge[];
201
+ }
202
+ export interface EpisodicMemoryReflectionResult {
203
+ droppedIds: string[];
204
+ supersededIds: string[];
205
+ inserted: EpisodicMemoryEntry[];
206
+ }
207
+ export interface EpisodicMemoryPrompts {
208
+ extraction?: string;
209
+ reflection?: string;
210
+ recallToolInstruction?: string;
211
+ }
212
+ export interface EpisodicMemoryEmbeddingProviderOptions {
213
+ apiKey?: string;
214
+ baseURL?: string;
215
+ }
216
+ export interface EpisodicMemoryConfig {
217
+ enabled?: boolean;
218
+ topK?: number;
219
+ maxEntriesPerRun?: number;
220
+ embedder?: EmbeddingModel;
221
+ embeddingModel?: string;
222
+ embeddingProviderOptions?: string | EpisodicMemoryEmbeddingProviderOptions;
223
+ extract?: EpisodicMemoryExtractFn;
224
+ reflect?: EpisodicMemoryReflectFn;
225
+ prompts?: EpisodicMemoryPrompts;
226
+ }
77
227
  export interface TitleGenerationConfig {
78
228
  model?: ModelConfig;
79
229
  instructions?: string;
@@ -96,6 +246,7 @@ interface MemoryConfigBase {
96
246
  lastMessages: number;
97
247
  observationLog?: ObservationLogMemoryConfig;
98
248
  semanticRecall?: SemanticRecallConfig;
249
+ episodicMemory?: EpisodicMemoryConfig;
99
250
  titleGeneration?: TitleGenerationConfig;
100
251
  }
101
252
  export type MemoryConfig = (MemoryConfigBase & {