@dexto/tools-lifecycle 1.7.2 → 1.8.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.
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ToolFactory } from '@dexto/agent-config';
2
2
  import { z } from 'zod';
3
- import { Tool } from '@dexto/core';
3
+ import { Tool } from '@dexto/core/tools';
4
4
 
5
5
  declare const LIFECYCLE_TOOL_NAMES: readonly ["view_logs", "search_history", "memory_list", "memory_get", "memory_create", "memory_update", "memory_delete"];
6
6
  type LifecycleToolName = (typeof LIFECYCLE_TOOL_NAMES)[number];
@@ -26,7 +26,7 @@ __export(memory_tools_exports, {
26
26
  });
27
27
  module.exports = __toCommonJS(memory_tools_exports);
28
28
  var import_zod = require("zod");
29
- var import_core = require("@dexto/core");
29
+ var import_tools = require("@dexto/core/tools");
30
30
  const MemorySourceSchema = import_zod.z.enum(["user", "system"]);
31
31
  const MemoryListInputSchema = import_zod.z.object({
32
32
  tags: import_zod.z.array(import_zod.z.string()).optional().describe("Optional: filter by tags"),
@@ -36,7 +36,7 @@ const MemoryListInputSchema = import_zod.z.object({
36
36
  offset: import_zod.z.number().int().nonnegative().optional().default(0).describe("Optional: pagination offset")
37
37
  }).strict();
38
38
  function createMemoryListTool() {
39
- return (0, import_core.defineTool)({
39
+ return (0, import_tools.defineTool)({
40
40
  id: "memory_list",
41
41
  description: "List stored memories for this agent, with optional filtering.",
42
42
  inputSchema: MemoryListInputSchema,
@@ -54,16 +54,16 @@ function createMemoryListTool() {
54
54
  }
55
55
  filterParts.push(`limit=${input.limit}`);
56
56
  filterParts.push(`offset=${input.offset}`);
57
- return (0, import_core.createLocalToolCallHeader)({
57
+ return (0, import_tools.createLocalToolCallHeader)({
58
58
  title: "List Memories",
59
- argsText: (0, import_core.truncateForHeader)(filterParts.join(" "), 140)
59
+ argsText: (0, import_tools.truncateForHeader)(filterParts.join(" "), 140)
60
60
  });
61
61
  }
62
62
  },
63
63
  async execute(input, context) {
64
64
  const agent = context.agent;
65
65
  if (!agent) {
66
- throw import_core.ToolError.configInvalid("memory_list requires ToolExecutionContext.agent");
66
+ throw import_tools.ToolError.configInvalid("memory_list requires ToolExecutionContext.agent");
67
67
  }
68
68
  const { tags, source, pinned, limit, offset } = input;
69
69
  const options = {
@@ -79,20 +79,20 @@ function createMemoryListTool() {
79
79
  }
80
80
  const MemoryGetInputSchema = import_zod.z.object({ id: import_zod.z.string().describe("Memory ID") }).strict();
81
81
  function createMemoryGetTool() {
82
- return (0, import_core.defineTool)({
82
+ return (0, import_tools.defineTool)({
83
83
  id: "memory_get",
84
84
  description: "Get a memory by ID.",
85
85
  inputSchema: MemoryGetInputSchema,
86
86
  presentation: {
87
- describeHeader: (input) => (0, import_core.createLocalToolCallHeader)({
87
+ describeHeader: (input) => (0, import_tools.createLocalToolCallHeader)({
88
88
  title: "Get Memory",
89
- argsText: (0, import_core.truncateForHeader)(input.id, 140)
89
+ argsText: (0, import_tools.truncateForHeader)(input.id, 140)
90
90
  })
91
91
  },
92
92
  async execute(input, context) {
93
93
  const agent = context.agent;
94
94
  if (!agent) {
95
- throw import_core.ToolError.configInvalid("memory_get requires ToolExecutionContext.agent");
95
+ throw import_tools.ToolError.configInvalid("memory_get requires ToolExecutionContext.agent");
96
96
  }
97
97
  const { id } = input;
98
98
  return await agent.memoryManager.get(id);
@@ -106,20 +106,20 @@ const MemoryCreateInputSchema = import_zod.z.object({
106
106
  pinned: import_zod.z.boolean().optional().default(false).describe("Whether this memory is pinned")
107
107
  }).strict();
108
108
  function createMemoryCreateTool() {
109
- return (0, import_core.defineTool)({
109
+ return (0, import_tools.defineTool)({
110
110
  id: "memory_create",
111
111
  description: "Create a new memory.",
112
112
  inputSchema: MemoryCreateInputSchema,
113
113
  presentation: {
114
- describeHeader: (input) => (0, import_core.createLocalToolCallHeader)({
114
+ describeHeader: (input) => (0, import_tools.createLocalToolCallHeader)({
115
115
  title: "Create Memory",
116
- argsText: (0, import_core.truncateForHeader)(input.content, 140)
116
+ argsText: (0, import_tools.truncateForHeader)(input.content, 140)
117
117
  })
118
118
  },
119
119
  async execute(input, context) {
120
120
  const agent = context.agent;
121
121
  if (!agent) {
122
- throw import_core.ToolError.configInvalid("memory_create requires ToolExecutionContext.agent");
122
+ throw import_tools.ToolError.configInvalid("memory_create requires ToolExecutionContext.agent");
123
123
  }
124
124
  const { content, tags, source, pinned } = input;
125
125
  const metadata = { source, pinned };
@@ -139,7 +139,7 @@ const MemoryUpdateInputSchema = import_zod.z.object({
139
139
  pinned: import_zod.z.boolean().optional().describe("Updated pinned status (optional)")
140
140
  }).strict();
141
141
  function createMemoryUpdateTool() {
142
- return (0, import_core.defineTool)({
142
+ return (0, import_tools.defineTool)({
143
143
  id: "memory_update",
144
144
  description: "Update an existing memory.",
145
145
  inputSchema: MemoryUpdateInputSchema,
@@ -150,8 +150,8 @@ function createMemoryUpdateTool() {
150
150
  if (input.tags !== void 0) updateParts.push("tags");
151
151
  if (input.source !== void 0) updateParts.push("source");
152
152
  if (input.pinned !== void 0) updateParts.push("pinned");
153
- const argsText = updateParts.length > 0 ? (0, import_core.truncateForHeader)(`${input.id} ${updateParts.join(",")}`, 140) : (0, import_core.truncateForHeader)(input.id, 140);
154
- return (0, import_core.createLocalToolCallHeader)({
153
+ const argsText = updateParts.length > 0 ? (0, import_tools.truncateForHeader)(`${input.id} ${updateParts.join(",")}`, 140) : (0, import_tools.truncateForHeader)(input.id, 140);
154
+ return (0, import_tools.createLocalToolCallHeader)({
155
155
  title: "Update Memory",
156
156
  argsText
157
157
  });
@@ -160,7 +160,7 @@ function createMemoryUpdateTool() {
160
160
  async execute(input, context) {
161
161
  const agent = context.agent;
162
162
  if (!agent) {
163
- throw import_core.ToolError.configInvalid("memory_update requires ToolExecutionContext.agent");
163
+ throw import_tools.ToolError.configInvalid("memory_update requires ToolExecutionContext.agent");
164
164
  }
165
165
  const { id, content, tags, source, pinned } = input;
166
166
  const metadataUpdate = {};
@@ -176,20 +176,20 @@ function createMemoryUpdateTool() {
176
176
  }
177
177
  const MemoryDeleteInputSchema = import_zod.z.object({ id: import_zod.z.string().describe("Memory ID") }).strict();
178
178
  function createMemoryDeleteTool() {
179
- return (0, import_core.defineTool)({
179
+ return (0, import_tools.defineTool)({
180
180
  id: "memory_delete",
181
181
  description: "Delete a memory by ID.",
182
182
  inputSchema: MemoryDeleteInputSchema,
183
183
  presentation: {
184
- describeHeader: (input) => (0, import_core.createLocalToolCallHeader)({
184
+ describeHeader: (input) => (0, import_tools.createLocalToolCallHeader)({
185
185
  title: "Delete Memory",
186
- argsText: (0, import_core.truncateForHeader)(input.id, 140)
186
+ argsText: (0, import_tools.truncateForHeader)(input.id, 140)
187
187
  })
188
188
  },
189
189
  async execute(input, context) {
190
190
  const agent = context.agent;
191
191
  if (!agent) {
192
- throw import_core.ToolError.configInvalid("memory_delete requires ToolExecutionContext.agent");
192
+ throw import_tools.ToolError.configInvalid("memory_delete requires ToolExecutionContext.agent");
193
193
  }
194
194
  const { id } = input;
195
195
  await agent.memoryManager.delete(id);
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import type { Tool } from '@dexto/core';
2
+ import type { Tool } from '@dexto/core/tools';
3
3
  declare const MemoryListInputSchema: z.ZodObject<{
4
4
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
5
5
  source: z.ZodOptional<z.ZodEnum<{
@@ -1 +1 @@
1
- {"version":3,"file":"memory-tools.d.ts","sourceRoot":"","sources":["../src/memory-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAqC,IAAI,EAAwB,MAAM,aAAa,CAAC;AAIjG,QAAA,MAAM,qBAAqB;;;;;;;;;kBAoBd,CAAC;AAEd,wBAAgB,oBAAoB,IAAI,IAAI,CAAC,OAAO,qBAAqB,CAAC,CA6CzE;AAED,QAAA,MAAM,oBAAoB;;kBAA8D,CAAC;AAEzF,wBAAgB,mBAAmB,IAAI,IAAI,CAAC,OAAO,oBAAoB,CAAC,CAsBvE;AAED,QAAA,MAAM,uBAAuB;;;;;;;;kBAShB,CAAC;AAEd,wBAAgB,sBAAsB,IAAI,IAAI,CAAC,OAAO,uBAAuB,CAAC,CA4B7E;AAED,QAAA,MAAM,uBAAuB;;;;;;;;;kBAQhB,CAAC;AAEd,wBAAgB,sBAAsB,IAAI,IAAI,CAAC,OAAO,uBAAuB,CAAC,CA0C7E;AAED,QAAA,MAAM,uBAAuB;;kBAA8D,CAAC;AAE5F,wBAAgB,sBAAsB,IAAI,IAAI,CAAC,OAAO,uBAAuB,CAAC,CAuB7E"}
1
+ {"version":3,"file":"memory-tools.d.ts","sourceRoot":"","sources":["../src/memory-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,OAAO,KAAK,EAAE,IAAI,EAAwB,MAAM,mBAAmB,CAAC;AAIpE,QAAA,MAAM,qBAAqB;;;;;;;;;kBAoBd,CAAC;AAEd,wBAAgB,oBAAoB,IAAI,IAAI,CAAC,OAAO,qBAAqB,CAAC,CA6CzE;AAED,QAAA,MAAM,oBAAoB;;kBAA8D,CAAC;AAEzF,wBAAgB,mBAAmB,IAAI,IAAI,CAAC,OAAO,oBAAoB,CAAC,CAsBvE;AAED,QAAA,MAAM,uBAAuB;;;;;;;;kBAShB,CAAC;AAEd,wBAAgB,sBAAsB,IAAI,IAAI,CAAC,OAAO,uBAAuB,CAAC,CA4B7E;AAED,QAAA,MAAM,uBAAuB;;;;;;;;;kBAQhB,CAAC;AAEd,wBAAgB,sBAAsB,IAAI,IAAI,CAAC,OAAO,uBAAuB,CAAC,CA0C7E;AAED,QAAA,MAAM,uBAAuB;;kBAA8D,CAAC;AAE5F,wBAAgB,sBAAsB,IAAI,IAAI,CAAC,OAAO,uBAAuB,CAAC,CAuB7E"}
@@ -1,5 +1,10 @@
1
1
  import { z } from "zod";
2
- import { ToolError, createLocalToolCallHeader, defineTool, truncateForHeader } from "@dexto/core";
2
+ import {
3
+ ToolError,
4
+ createLocalToolCallHeader,
5
+ defineTool,
6
+ truncateForHeader
7
+ } from "@dexto/core/tools";
3
8
  const MemorySourceSchema = z.enum(["user", "system"]);
4
9
  const MemoryListInputSchema = z.object({
5
10
  tags: z.array(z.string()).optional().describe("Optional: filter by tags"),
@@ -22,7 +22,7 @@ __export(search_history_tool_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(search_history_tool_exports);
24
24
  var import_zod = require("zod");
25
- var import_core = require("@dexto/core");
25
+ var import_tools = require("@dexto/core/tools");
26
26
  const SearchHistoryInputSchema = import_zod.z.object({
27
27
  query: import_zod.z.string().describe("The search query to find in conversation history"),
28
28
  mode: import_zod.z.enum(["messages", "sessions"]).describe(
@@ -36,21 +36,21 @@ const SearchHistoryInputSchema = import_zod.z.object({
36
36
  offset: import_zod.z.number().optional().default(0).describe('Optional: offset for pagination (default: 0, only for mode="messages")')
37
37
  }).strict();
38
38
  function createSearchHistoryTool() {
39
- return (0, import_core.defineTool)({
39
+ return (0, import_tools.defineTool)({
40
40
  id: "search_history",
41
41
  description: 'Search through conversation history across sessions. Use mode="messages" to search for specific messages, or mode="sessions" to find sessions containing the query. For message search, you can filter by sessionId (specific session), role (user/assistant/system/tool), limit results, and set pagination offset.',
42
42
  inputSchema: SearchHistoryInputSchema,
43
43
  presentation: {
44
- describeHeader: (input) => (0, import_core.createLocalToolCallHeader)({
44
+ describeHeader: (input) => (0, import_tools.createLocalToolCallHeader)({
45
45
  title: "Search History",
46
- argsText: (0, import_core.truncateForHeader)(`${input.mode}: ${input.query}`, 140)
46
+ argsText: (0, import_tools.truncateForHeader)(`${input.mode}: ${input.query}`, 140)
47
47
  })
48
48
  },
49
49
  async execute(input, context) {
50
50
  const { query, mode, sessionId, role, limit, offset } = input;
51
51
  const searchService = context.services?.search;
52
52
  if (!searchService) {
53
- throw import_core.ToolError.configInvalid(
53
+ throw import_tools.ToolError.configInvalid(
54
54
  "search_history requires ToolExecutionContext.services.search"
55
55
  );
56
56
  }
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import type { Tool } from '@dexto/core';
2
+ import type { Tool } from '@dexto/core/tools';
3
3
  declare const SearchHistoryInputSchema: z.ZodObject<{
4
4
  query: z.ZodString;
5
5
  mode: z.ZodEnum<{
@@ -1 +1 @@
1
- {"version":3,"file":"search-history-tool.d.ts","sourceRoot":"","sources":["../src/search-history-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,IAAI,EAAwB,MAAM,aAAa,CAAC;AAG9D,QAAA,MAAM,wBAAwB;;;;;;;;;;;;;;;kBA6BjB,CAAC;AAEd;;;;;GAKG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAAC,OAAO,wBAAwB,CAAC,CAqC/E"}
1
+ {"version":3,"file":"search-history-tool.d.ts","sourceRoot":"","sources":["../src/search-history-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,OAAO,KAAK,EAAE,IAAI,EAAwB,MAAM,mBAAmB,CAAC;AAEpE,QAAA,MAAM,wBAAwB;;;;;;;;;;;;;;;kBA6BjB,CAAC;AAEd;;;;;GAKG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAAC,OAAO,wBAAwB,CAAC,CAqC/E"}
@@ -1,5 +1,10 @@
1
1
  import { z } from "zod";
2
- import { ToolError, createLocalToolCallHeader, defineTool, truncateForHeader } from "@dexto/core";
2
+ import {
3
+ ToolError,
4
+ createLocalToolCallHeader,
5
+ defineTool,
6
+ truncateForHeader
7
+ } from "@dexto/core/tools";
3
8
  const SearchHistoryInputSchema = z.object({
4
9
  query: z.string().describe("The search query to find in conversation history"),
5
10
  mode: z.enum(["messages", "sessions"]).describe(
@@ -33,7 +33,7 @@ __export(view_logs_tool_exports, {
33
33
  module.exports = __toCommonJS(view_logs_tool_exports);
34
34
  var fs = __toESM(require("node:fs/promises"), 1);
35
35
  var import_zod = require("zod");
36
- var import_core = require("@dexto/core");
36
+ var import_tools = require("@dexto/core/tools");
37
37
  const LOG_LEVEL_VALUES = ["debug", "info", "warn", "error", "silly"];
38
38
  const ViewLogsInputSchema = import_zod.z.object({
39
39
  lines: import_zod.z.number().int().positive().optional().default(200).describe("Number of log lines to return from the end of the log file"),
@@ -90,12 +90,12 @@ async function readTailBytes(filePath, maxBytes) {
90
90
  }
91
91
  }
92
92
  function createViewLogsTool(options) {
93
- return (0, import_core.defineTool)({
93
+ return (0, import_tools.defineTool)({
94
94
  id: "view_logs",
95
95
  description: "View this session log file (tail). Returns the most recent log lines for debugging. If file logging is not configured, returns a message instead.",
96
96
  inputSchema: ViewLogsInputSchema,
97
97
  presentation: {
98
- describeHeader: (input) => (0, import_core.createLocalToolCallHeader)({
98
+ describeHeader: (input) => (0, import_tools.createLocalToolCallHeader)({
99
99
  title: "View Logs",
100
100
  argsText: `${input.lines} lines`
101
101
  })
@@ -122,7 +122,7 @@ function createViewLogsTool(options) {
122
122
  try {
123
123
  tailContent = await readTailBytes(logFilePath, options.maxLogBytes);
124
124
  } catch (error) {
125
- throw import_core.ToolError.executionFailed(
125
+ throw import_tools.ToolError.executionFailed(
126
126
  "view_logs",
127
127
  `Failed to read log file: ${error instanceof Error ? error.message : String(error)}`,
128
128
  context.sessionId
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import type { Tool } from '@dexto/core';
2
+ import type { Tool } from '@dexto/core/tools';
3
3
  declare const ViewLogsInputSchema: z.ZodObject<{
4
4
  lines: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
5
5
  query: z.ZodOptional<z.ZodString>;
@@ -1 +1 @@
1
- {"version":3,"file":"view-logs-tool.d.ts","sourceRoot":"","sources":["../src/view-logs-tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,IAAI,EAAwB,MAAM,aAAa,CAAC;AAK9D,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;kBAwBZ,CAAC;AAyEd,wBAAgB,kBAAkB,CAAC,OAAO,EAAE;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACvB,GAAG,IAAI,CAAC,OAAO,mBAAmB,CAAC,CA4HnC"}
1
+ {"version":3,"file":"view-logs-tool.d.ts","sourceRoot":"","sources":["../src/view-logs-tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,IAAI,EAAwB,MAAM,mBAAmB,CAAC;AAKpE,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;kBAwBZ,CAAC;AAyEd,wBAAgB,kBAAkB,CAAC,OAAO,EAAE;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACvB,GAAG,IAAI,CAAC,OAAO,mBAAmB,CAAC,CA4HnC"}
@@ -1,6 +1,6 @@
1
1
  import * as fs from "node:fs/promises";
2
2
  import { z } from "zod";
3
- import { ToolError, createLocalToolCallHeader, defineTool } from "@dexto/core";
3
+ import { ToolError, createLocalToolCallHeader, defineTool } from "@dexto/core/tools";
4
4
  const LOG_LEVEL_VALUES = ["debug", "info", "warn", "error", "silly"];
5
5
  const ViewLogsInputSchema = z.object({
6
6
  lines: z.number().int().positive().optional().default(200).describe("Number of log lines to return from the end of the log file"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dexto/tools-lifecycle",
3
- "version": "1.7.2",
3
+ "version": "1.8.1",
4
4
  "description": "Lifecycle and self-observation tools for Dexto agents",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -20,8 +20,8 @@
20
20
  ],
21
21
  "dependencies": {
22
22
  "zod": "^4.3.6",
23
- "@dexto/agent-config": "1.7.2",
24
- "@dexto/core": "1.7.2"
23
+ "@dexto/agent-config": "1.8.1",
24
+ "@dexto/core": "1.8.1"
25
25
  },
26
26
  "devDependencies": {
27
27
  "tsup": "^8.0.0",