@dexto/tools-lifecycle 1.6.0 → 1.6.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,8 +1,155 @@
1
- export { lifecycleToolsFactory } from './tool-factory.cjs';
2
- export { LIFECYCLE_TOOL_NAMES, LifecycleToolName, LifecycleToolsConfig, LifecycleToolsConfigSchema } from './tool-factory-config.cjs';
3
- export { createViewLogsTool } from './view-logs-tool.cjs';
4
- export { createSearchHistoryTool } from './search-history-tool.cjs';
5
- export { createMemoryCreateTool, createMemoryDeleteTool, createMemoryGetTool, createMemoryListTool, createMemoryUpdateTool } from './memory-tools.cjs';
6
- import '@dexto/agent-config';
7
- import 'zod';
8
- import '@dexto/core';
1
+ import { ToolFactory } from '@dexto/agent-config';
2
+ import { z } from 'zod';
3
+ import { Tool } from '@dexto/core';
4
+
5
+ declare const LIFECYCLE_TOOL_NAMES: readonly ["view_logs", "search_history", "memory_list", "memory_get", "memory_create", "memory_update", "memory_delete"];
6
+ type LifecycleToolName = (typeof LIFECYCLE_TOOL_NAMES)[number];
7
+ declare const LifecycleToolsConfigSchema: z.ZodObject<{
8
+ type: z.ZodLiteral<"lifecycle-tools">;
9
+ enabledTools: z.ZodOptional<z.ZodArray<z.ZodEnum<["view_logs", "search_history", "memory_list", "memory_get", "memory_create", "memory_update", "memory_delete"]>, "many">>;
10
+ maxLogLines: z.ZodDefault<z.ZodNumber>;
11
+ maxLogBytes: z.ZodDefault<z.ZodNumber>;
12
+ }, "strict", z.ZodTypeAny, {
13
+ type: "lifecycle-tools";
14
+ maxLogLines: number;
15
+ maxLogBytes: number;
16
+ enabledTools?: ("view_logs" | "search_history" | "memory_list" | "memory_get" | "memory_create" | "memory_update" | "memory_delete")[] | undefined;
17
+ }, {
18
+ type: "lifecycle-tools";
19
+ enabledTools?: ("view_logs" | "search_history" | "memory_list" | "memory_get" | "memory_create" | "memory_update" | "memory_delete")[] | undefined;
20
+ maxLogLines?: number | undefined;
21
+ maxLogBytes?: number | undefined;
22
+ }>;
23
+ type LifecycleToolsConfig = z.output<typeof LifecycleToolsConfigSchema>;
24
+
25
+ declare const lifecycleToolsFactory: ToolFactory<LifecycleToolsConfig>;
26
+
27
+ declare const ViewLogsInputSchema: z.ZodObject<{
28
+ lines: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
29
+ query: z.ZodOptional<z.ZodString>;
30
+ level: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["debug", "info", "warn", "error", "silly"]>, z.ZodArray<z.ZodEnum<["debug", "info", "warn", "error", "silly"]>, "many">]>>;
31
+ component: z.ZodOptional<z.ZodString>;
32
+ includeContext: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
33
+ }, "strict", z.ZodTypeAny, {
34
+ lines: number;
35
+ includeContext: boolean;
36
+ query?: string | undefined;
37
+ level?: "debug" | "info" | "warn" | "error" | "silly" | ("debug" | "info" | "warn" | "error" | "silly")[] | undefined;
38
+ component?: string | undefined;
39
+ }, {
40
+ lines?: number | undefined;
41
+ query?: string | undefined;
42
+ level?: "debug" | "info" | "warn" | "error" | "silly" | ("debug" | "info" | "warn" | "error" | "silly")[] | undefined;
43
+ component?: string | undefined;
44
+ includeContext?: boolean | undefined;
45
+ }>;
46
+ declare function createViewLogsTool(options: {
47
+ maxLogLines: number;
48
+ maxLogBytes: number;
49
+ }): Tool<typeof ViewLogsInputSchema>;
50
+
51
+ declare const SearchHistoryInputSchema: z.ZodObject<{
52
+ query: z.ZodString;
53
+ mode: z.ZodEnum<["messages", "sessions"]>;
54
+ sessionId: z.ZodOptional<z.ZodString>;
55
+ role: z.ZodOptional<z.ZodEnum<["user", "assistant", "system", "tool"]>>;
56
+ limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
57
+ offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
58
+ }, "strict", z.ZodTypeAny, {
59
+ query: string;
60
+ limit: number;
61
+ offset: number;
62
+ mode: "messages" | "sessions";
63
+ sessionId?: string | undefined;
64
+ role?: "user" | "system" | "assistant" | "tool" | undefined;
65
+ }, {
66
+ query: string;
67
+ mode: "messages" | "sessions";
68
+ sessionId?: string | undefined;
69
+ limit?: number | undefined;
70
+ offset?: number | undefined;
71
+ role?: "user" | "system" | "assistant" | "tool" | undefined;
72
+ }>;
73
+ /**
74
+ * Create the `search_history` tool.
75
+ *
76
+ * Searches message/session history using the configured SearchService.
77
+ * Requires `ToolExecutionContext.services.search`.
78
+ */
79
+ declare function createSearchHistoryTool(): Tool<typeof SearchHistoryInputSchema>;
80
+
81
+ declare const MemoryListInputSchema: z.ZodObject<{
82
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
83
+ source: z.ZodOptional<z.ZodEnum<["user", "system"]>>;
84
+ pinned: z.ZodOptional<z.ZodBoolean>;
85
+ limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
86
+ offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
87
+ }, "strict", z.ZodTypeAny, {
88
+ limit: number;
89
+ offset: number;
90
+ tags?: string[] | undefined;
91
+ source?: "user" | "system" | undefined;
92
+ pinned?: boolean | undefined;
93
+ }, {
94
+ tags?: string[] | undefined;
95
+ source?: "user" | "system" | undefined;
96
+ pinned?: boolean | undefined;
97
+ limit?: number | undefined;
98
+ offset?: number | undefined;
99
+ }>;
100
+ declare function createMemoryListTool(): Tool<typeof MemoryListInputSchema>;
101
+ declare const MemoryGetInputSchema: z.ZodObject<{
102
+ id: z.ZodString;
103
+ }, "strict", z.ZodTypeAny, {
104
+ id: string;
105
+ }, {
106
+ id: string;
107
+ }>;
108
+ declare function createMemoryGetTool(): Tool<typeof MemoryGetInputSchema>;
109
+ declare const MemoryCreateInputSchema: z.ZodObject<{
110
+ content: z.ZodString;
111
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
112
+ source: z.ZodDefault<z.ZodOptional<z.ZodEnum<["user", "system"]>>>;
113
+ pinned: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
114
+ }, "strict", z.ZodTypeAny, {
115
+ source: "user" | "system";
116
+ pinned: boolean;
117
+ content: string;
118
+ tags?: string[] | undefined;
119
+ }, {
120
+ content: string;
121
+ tags?: string[] | undefined;
122
+ source?: "user" | "system" | undefined;
123
+ pinned?: boolean | undefined;
124
+ }>;
125
+ declare function createMemoryCreateTool(): Tool<typeof MemoryCreateInputSchema>;
126
+ declare const MemoryUpdateInputSchema: z.ZodObject<{
127
+ id: z.ZodString;
128
+ content: z.ZodOptional<z.ZodString>;
129
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
130
+ source: z.ZodOptional<z.ZodEnum<["user", "system"]>>;
131
+ pinned: z.ZodOptional<z.ZodBoolean>;
132
+ }, "strict", z.ZodTypeAny, {
133
+ id: string;
134
+ tags?: string[] | undefined;
135
+ source?: "user" | "system" | undefined;
136
+ pinned?: boolean | undefined;
137
+ content?: string | undefined;
138
+ }, {
139
+ id: string;
140
+ tags?: string[] | undefined;
141
+ source?: "user" | "system" | undefined;
142
+ pinned?: boolean | undefined;
143
+ content?: string | undefined;
144
+ }>;
145
+ declare function createMemoryUpdateTool(): Tool<typeof MemoryUpdateInputSchema>;
146
+ declare const MemoryDeleteInputSchema: z.ZodObject<{
147
+ id: z.ZodString;
148
+ }, "strict", z.ZodTypeAny, {
149
+ id: string;
150
+ }, {
151
+ id: string;
152
+ }>;
153
+ declare function createMemoryDeleteTool(): Tool<typeof MemoryDeleteInputSchema>;
154
+
155
+ export { LIFECYCLE_TOOL_NAMES, type LifecycleToolName, type LifecycleToolsConfig, LifecycleToolsConfigSchema, createMemoryCreateTool, createMemoryDeleteTool, createMemoryGetTool, createMemoryListTool, createMemoryUpdateTool, createSearchHistoryTool, createViewLogsTool, lifecycleToolsFactory };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,11 @@
1
+ /**
2
+ * @dexto/tools-lifecycle
3
+ *
4
+ * Lifecycle and self-observation tools factory for Dexto agents.
5
+ */
1
6
  export { lifecycleToolsFactory } from './tool-factory.js';
2
- export { LIFECYCLE_TOOL_NAMES, LifecycleToolName, LifecycleToolsConfig, LifecycleToolsConfigSchema } from './tool-factory-config.js';
7
+ export { LifecycleToolsConfigSchema, type LifecycleToolsConfig, LIFECYCLE_TOOL_NAMES, type LifecycleToolName, } from './tool-factory-config.js';
3
8
  export { createViewLogsTool } from './view-logs-tool.js';
4
9
  export { createSearchHistoryTool } from './search-history-tool.js';
5
- export { createMemoryCreateTool, createMemoryDeleteTool, createMemoryGetTool, createMemoryListTool, createMemoryUpdateTool } from './memory-tools.js';
6
- import '@dexto/agent-config';
7
- import 'zod';
8
- import '@dexto/core';
10
+ export { createMemoryListTool, createMemoryGetTool, createMemoryCreateTool, createMemoryUpdateTool, createMemoryDeleteTool, } from './memory-tools.js';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EACH,0BAA0B,EAC1B,KAAK,oBAAoB,EACzB,oBAAoB,EACpB,KAAK,iBAAiB,GACzB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EACH,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,GACzB,MAAM,mBAAmB,CAAC"}
@@ -38,9 +38,28 @@ const MemoryListInputSchema = import_zod.z.object({
38
38
  function createMemoryListTool() {
39
39
  return (0, import_core.defineTool)({
40
40
  id: "memory_list",
41
- displayName: "List Memories",
42
41
  description: "List stored memories for this agent, with optional filtering.",
43
42
  inputSchema: MemoryListInputSchema,
43
+ presentation: {
44
+ describeHeader: (input) => {
45
+ const filterParts = [];
46
+ if (input.tags && input.tags.length > 0) {
47
+ filterParts.push(`tags=${input.tags.join(",")}`);
48
+ }
49
+ if (input.source) {
50
+ filterParts.push(`source=${input.source}`);
51
+ }
52
+ if (input.pinned !== void 0) {
53
+ filterParts.push(`pinned=${String(input.pinned)}`);
54
+ }
55
+ filterParts.push(`limit=${input.limit}`);
56
+ filterParts.push(`offset=${input.offset}`);
57
+ return (0, import_core.createLocalToolCallHeader)({
58
+ title: "List Memories",
59
+ argsText: (0, import_core.truncateForHeader)(filterParts.join(" "), 140)
60
+ });
61
+ }
62
+ },
44
63
  async execute(input, context) {
45
64
  const agent = context.agent;
46
65
  if (!agent) {
@@ -62,9 +81,14 @@ const MemoryGetInputSchema = import_zod.z.object({ id: import_zod.z.string().des
62
81
  function createMemoryGetTool() {
63
82
  return (0, import_core.defineTool)({
64
83
  id: "memory_get",
65
- displayName: "Get Memory",
66
84
  description: "Get a memory by ID.",
67
85
  inputSchema: MemoryGetInputSchema,
86
+ presentation: {
87
+ describeHeader: (input) => (0, import_core.createLocalToolCallHeader)({
88
+ title: "Get Memory",
89
+ argsText: (0, import_core.truncateForHeader)(input.id, 140)
90
+ })
91
+ },
68
92
  async execute(input, context) {
69
93
  const agent = context.agent;
70
94
  if (!agent) {
@@ -84,9 +108,14 @@ const MemoryCreateInputSchema = import_zod.z.object({
84
108
  function createMemoryCreateTool() {
85
109
  return (0, import_core.defineTool)({
86
110
  id: "memory_create",
87
- displayName: "Create Memory",
88
111
  description: "Create a new memory.",
89
112
  inputSchema: MemoryCreateInputSchema,
113
+ presentation: {
114
+ describeHeader: (input) => (0, import_core.createLocalToolCallHeader)({
115
+ title: "Create Memory",
116
+ argsText: (0, import_core.truncateForHeader)(input.content, 140)
117
+ })
118
+ },
90
119
  async execute(input, context) {
91
120
  const agent = context.agent;
92
121
  if (!agent) {
@@ -112,9 +141,22 @@ const MemoryUpdateInputSchema = import_zod.z.object({
112
141
  function createMemoryUpdateTool() {
113
142
  return (0, import_core.defineTool)({
114
143
  id: "memory_update",
115
- displayName: "Update Memory",
116
144
  description: "Update an existing memory.",
117
145
  inputSchema: MemoryUpdateInputSchema,
146
+ presentation: {
147
+ describeHeader: (input) => {
148
+ const updateParts = [];
149
+ if (input.content !== void 0) updateParts.push("content");
150
+ if (input.tags !== void 0) updateParts.push("tags");
151
+ if (input.source !== void 0) updateParts.push("source");
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)({
155
+ title: "Update Memory",
156
+ argsText
157
+ });
158
+ }
159
+ },
118
160
  async execute(input, context) {
119
161
  const agent = context.agent;
120
162
  if (!agent) {
@@ -136,9 +178,14 @@ const MemoryDeleteInputSchema = import_zod.z.object({ id: import_zod.z.string().
136
178
  function createMemoryDeleteTool() {
137
179
  return (0, import_core.defineTool)({
138
180
  id: "memory_delete",
139
- displayName: "Delete Memory",
140
181
  description: "Delete a memory by ID.",
141
182
  inputSchema: MemoryDeleteInputSchema,
183
+ presentation: {
184
+ describeHeader: (input) => (0, import_core.createLocalToolCallHeader)({
185
+ title: "Delete Memory",
186
+ argsText: (0, import_core.truncateForHeader)(input.id, 140)
187
+ })
188
+ },
142
189
  async execute(input, context) {
143
190
  const agent = context.agent;
144
191
  if (!agent) {
@@ -1,6 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { Tool } from '@dexto/core';
3
-
2
+ import type { Tool } from '@dexto/core';
4
3
  declare const MemoryListInputSchema: z.ZodObject<{
5
4
  tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
6
5
  source: z.ZodOptional<z.ZodEnum<["user", "system"]>>;
@@ -20,7 +19,7 @@ declare const MemoryListInputSchema: z.ZodObject<{
20
19
  limit?: number | undefined;
21
20
  offset?: number | undefined;
22
21
  }>;
23
- declare function createMemoryListTool(): Tool<typeof MemoryListInputSchema>;
22
+ export declare function createMemoryListTool(): Tool<typeof MemoryListInputSchema>;
24
23
  declare const MemoryGetInputSchema: z.ZodObject<{
25
24
  id: z.ZodString;
26
25
  }, "strict", z.ZodTypeAny, {
@@ -28,7 +27,7 @@ declare const MemoryGetInputSchema: z.ZodObject<{
28
27
  }, {
29
28
  id: string;
30
29
  }>;
31
- declare function createMemoryGetTool(): Tool<typeof MemoryGetInputSchema>;
30
+ export declare function createMemoryGetTool(): Tool<typeof MemoryGetInputSchema>;
32
31
  declare const MemoryCreateInputSchema: z.ZodObject<{
33
32
  content: z.ZodString;
34
33
  tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
@@ -45,7 +44,7 @@ declare const MemoryCreateInputSchema: z.ZodObject<{
45
44
  source?: "user" | "system" | undefined;
46
45
  pinned?: boolean | undefined;
47
46
  }>;
48
- declare function createMemoryCreateTool(): Tool<typeof MemoryCreateInputSchema>;
47
+ export declare function createMemoryCreateTool(): Tool<typeof MemoryCreateInputSchema>;
49
48
  declare const MemoryUpdateInputSchema: z.ZodObject<{
50
49
  id: z.ZodString;
51
50
  content: z.ZodOptional<z.ZodString>;
@@ -65,7 +64,7 @@ declare const MemoryUpdateInputSchema: z.ZodObject<{
65
64
  pinned?: boolean | undefined;
66
65
  content?: string | undefined;
67
66
  }>;
68
- declare function createMemoryUpdateTool(): Tool<typeof MemoryUpdateInputSchema>;
67
+ export declare function createMemoryUpdateTool(): Tool<typeof MemoryUpdateInputSchema>;
69
68
  declare const MemoryDeleteInputSchema: z.ZodObject<{
70
69
  id: z.ZodString;
71
70
  }, "strict", z.ZodTypeAny, {
@@ -73,6 +72,6 @@ declare const MemoryDeleteInputSchema: z.ZodObject<{
73
72
  }, {
74
73
  id: string;
75
74
  }>;
76
- declare function createMemoryDeleteTool(): Tool<typeof MemoryDeleteInputSchema>;
77
-
78
- export { createMemoryCreateTool, createMemoryDeleteTool, createMemoryGetTool, createMemoryListTool, createMemoryUpdateTool };
75
+ export declare function createMemoryDeleteTool(): Tool<typeof MemoryDeleteInputSchema>;
76
+ export {};
77
+ //# sourceMappingURL=memory-tools.d.ts.map
@@ -0,0 +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;;;;;;;;;;;;;;;;;;EAoBd,CAAC;AAEd,wBAAgB,oBAAoB,IAAI,IAAI,CAAC,OAAO,qBAAqB,CAAC,CA6CzE;AAED,QAAA,MAAM,oBAAoB;;;;;;EAA8D,CAAC;AAEzF,wBAAgB,mBAAmB,IAAI,IAAI,CAAC,OAAO,oBAAoB,CAAC,CAsBvE;AAED,QAAA,MAAM,uBAAuB;;;;;;;;;;;;;;;EAShB,CAAC;AAEd,wBAAgB,sBAAsB,IAAI,IAAI,CAAC,OAAO,uBAAuB,CAAC,CA4B7E;AAED,QAAA,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;EAQhB,CAAC;AAEd,wBAAgB,sBAAsB,IAAI,IAAI,CAAC,OAAO,uBAAuB,CAAC,CA0C7E;AAED,QAAA,MAAM,uBAAuB;;;;;;EAA8D,CAAC;AAE5F,wBAAgB,sBAAsB,IAAI,IAAI,CAAC,OAAO,uBAAuB,CAAC,CAuB7E"}
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { ToolError, defineTool } from "@dexto/core";
2
+ import { ToolError, createLocalToolCallHeader, defineTool, truncateForHeader } from "@dexto/core";
3
3
  const MemorySourceSchema = z.enum(["user", "system"]);
4
4
  const MemoryListInputSchema = z.object({
5
5
  tags: z.array(z.string()).optional().describe("Optional: filter by tags"),
@@ -11,9 +11,28 @@ const MemoryListInputSchema = z.object({
11
11
  function createMemoryListTool() {
12
12
  return defineTool({
13
13
  id: "memory_list",
14
- displayName: "List Memories",
15
14
  description: "List stored memories for this agent, with optional filtering.",
16
15
  inputSchema: MemoryListInputSchema,
16
+ presentation: {
17
+ describeHeader: (input) => {
18
+ const filterParts = [];
19
+ if (input.tags && input.tags.length > 0) {
20
+ filterParts.push(`tags=${input.tags.join(",")}`);
21
+ }
22
+ if (input.source) {
23
+ filterParts.push(`source=${input.source}`);
24
+ }
25
+ if (input.pinned !== void 0) {
26
+ filterParts.push(`pinned=${String(input.pinned)}`);
27
+ }
28
+ filterParts.push(`limit=${input.limit}`);
29
+ filterParts.push(`offset=${input.offset}`);
30
+ return createLocalToolCallHeader({
31
+ title: "List Memories",
32
+ argsText: truncateForHeader(filterParts.join(" "), 140)
33
+ });
34
+ }
35
+ },
17
36
  async execute(input, context) {
18
37
  const agent = context.agent;
19
38
  if (!agent) {
@@ -35,9 +54,14 @@ const MemoryGetInputSchema = z.object({ id: z.string().describe("Memory ID") }).
35
54
  function createMemoryGetTool() {
36
55
  return defineTool({
37
56
  id: "memory_get",
38
- displayName: "Get Memory",
39
57
  description: "Get a memory by ID.",
40
58
  inputSchema: MemoryGetInputSchema,
59
+ presentation: {
60
+ describeHeader: (input) => createLocalToolCallHeader({
61
+ title: "Get Memory",
62
+ argsText: truncateForHeader(input.id, 140)
63
+ })
64
+ },
41
65
  async execute(input, context) {
42
66
  const agent = context.agent;
43
67
  if (!agent) {
@@ -57,9 +81,14 @@ const MemoryCreateInputSchema = z.object({
57
81
  function createMemoryCreateTool() {
58
82
  return defineTool({
59
83
  id: "memory_create",
60
- displayName: "Create Memory",
61
84
  description: "Create a new memory.",
62
85
  inputSchema: MemoryCreateInputSchema,
86
+ presentation: {
87
+ describeHeader: (input) => createLocalToolCallHeader({
88
+ title: "Create Memory",
89
+ argsText: truncateForHeader(input.content, 140)
90
+ })
91
+ },
63
92
  async execute(input, context) {
64
93
  const agent = context.agent;
65
94
  if (!agent) {
@@ -85,9 +114,22 @@ const MemoryUpdateInputSchema = z.object({
85
114
  function createMemoryUpdateTool() {
86
115
  return defineTool({
87
116
  id: "memory_update",
88
- displayName: "Update Memory",
89
117
  description: "Update an existing memory.",
90
118
  inputSchema: MemoryUpdateInputSchema,
119
+ presentation: {
120
+ describeHeader: (input) => {
121
+ const updateParts = [];
122
+ if (input.content !== void 0) updateParts.push("content");
123
+ if (input.tags !== void 0) updateParts.push("tags");
124
+ if (input.source !== void 0) updateParts.push("source");
125
+ if (input.pinned !== void 0) updateParts.push("pinned");
126
+ const argsText = updateParts.length > 0 ? truncateForHeader(`${input.id} ${updateParts.join(",")}`, 140) : truncateForHeader(input.id, 140);
127
+ return createLocalToolCallHeader({
128
+ title: "Update Memory",
129
+ argsText
130
+ });
131
+ }
132
+ },
91
133
  async execute(input, context) {
92
134
  const agent = context.agent;
93
135
  if (!agent) {
@@ -109,9 +151,14 @@ const MemoryDeleteInputSchema = z.object({ id: z.string().describe("Memory ID")
109
151
  function createMemoryDeleteTool() {
110
152
  return defineTool({
111
153
  id: "memory_delete",
112
- displayName: "Delete Memory",
113
154
  description: "Delete a memory by ID.",
114
155
  inputSchema: MemoryDeleteInputSchema,
156
+ presentation: {
157
+ describeHeader: (input) => createLocalToolCallHeader({
158
+ title: "Delete Memory",
159
+ argsText: truncateForHeader(input.id, 140)
160
+ })
161
+ },
115
162
  async execute(input, context) {
116
163
  const agent = context.agent;
117
164
  if (!agent) {
@@ -38,9 +38,14 @@ const SearchHistoryInputSchema = import_zod.z.object({
38
38
  function createSearchHistoryTool() {
39
39
  return (0, import_core.defineTool)({
40
40
  id: "search_history",
41
- displayName: "Search History",
42
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.',
43
42
  inputSchema: SearchHistoryInputSchema,
43
+ presentation: {
44
+ describeHeader: (input) => (0, import_core.createLocalToolCallHeader)({
45
+ title: "Search History",
46
+ argsText: (0, import_core.truncateForHeader)(`${input.mode}: ${input.query}`, 140)
47
+ })
48
+ },
44
49
  async execute(input, context) {
45
50
  const { query, mode, sessionId, role, limit, offset } = input;
46
51
  const searchService = context.services?.search;
@@ -1,6 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { Tool } from '@dexto/core';
3
-
2
+ import type { Tool } from '@dexto/core';
4
3
  declare const SearchHistoryInputSchema: z.ZodObject<{
5
4
  query: z.ZodString;
6
5
  mode: z.ZodEnum<["messages", "sessions"]>;
@@ -29,6 +28,6 @@ declare const SearchHistoryInputSchema: z.ZodObject<{
29
28
  * Searches message/session history using the configured SearchService.
30
29
  * Requires `ToolExecutionContext.services.search`.
31
30
  */
32
- declare function createSearchHistoryTool(): Tool<typeof SearchHistoryInputSchema>;
33
-
34
- export { createSearchHistoryTool };
31
+ export declare function createSearchHistoryTool(): Tool<typeof SearchHistoryInputSchema>;
32
+ export {};
33
+ //# sourceMappingURL=search-history-tool.d.ts.map
@@ -0,0 +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;;;;;;;;;;;;;;;;;;;;;EA6BjB,CAAC;AAEd;;;;;GAKG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAAC,OAAO,wBAAwB,CAAC,CAqC/E"}
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { ToolError, defineTool } from "@dexto/core";
2
+ import { ToolError, createLocalToolCallHeader, defineTool, truncateForHeader } from "@dexto/core";
3
3
  const SearchHistoryInputSchema = z.object({
4
4
  query: z.string().describe("The search query to find in conversation history"),
5
5
  mode: z.enum(["messages", "sessions"]).describe(
@@ -15,9 +15,14 @@ const SearchHistoryInputSchema = z.object({
15
15
  function createSearchHistoryTool() {
16
16
  return defineTool({
17
17
  id: "search_history",
18
- displayName: "Search History",
19
18
  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.',
20
19
  inputSchema: SearchHistoryInputSchema,
20
+ presentation: {
21
+ describeHeader: (input) => createLocalToolCallHeader({
22
+ title: "Search History",
23
+ argsText: truncateForHeader(`${input.mode}: ${input.query}`, 140)
24
+ })
25
+ },
21
26
  async execute(input, context) {
22
27
  const { query, mode, sessionId, role, limit, offset } = input;
23
28
  const searchService = context.services?.search;
@@ -1,8 +1,7 @@
1
1
  import { z } from 'zod';
2
-
3
- declare const LIFECYCLE_TOOL_NAMES: readonly ["view_logs", "search_history", "memory_list", "memory_get", "memory_create", "memory_update", "memory_delete"];
4
- type LifecycleToolName = (typeof LIFECYCLE_TOOL_NAMES)[number];
5
- declare const LifecycleToolsConfigSchema: z.ZodObject<{
2
+ export declare const LIFECYCLE_TOOL_NAMES: readonly ["view_logs", "search_history", "memory_list", "memory_get", "memory_create", "memory_update", "memory_delete"];
3
+ export type LifecycleToolName = (typeof LIFECYCLE_TOOL_NAMES)[number];
4
+ export declare const LifecycleToolsConfigSchema: z.ZodObject<{
6
5
  type: z.ZodLiteral<"lifecycle-tools">;
7
6
  enabledTools: z.ZodOptional<z.ZodArray<z.ZodEnum<["view_logs", "search_history", "memory_list", "memory_get", "memory_create", "memory_update", "memory_delete"]>, "many">>;
8
7
  maxLogLines: z.ZodDefault<z.ZodNumber>;
@@ -18,6 +17,5 @@ declare const LifecycleToolsConfigSchema: z.ZodObject<{
18
17
  maxLogLines?: number | undefined;
19
18
  maxLogBytes?: number | undefined;
20
19
  }>;
21
- type LifecycleToolsConfig = z.output<typeof LifecycleToolsConfigSchema>;
22
-
23
- export { LIFECYCLE_TOOL_NAMES, type LifecycleToolName, type LifecycleToolsConfig, LifecycleToolsConfigSchema };
20
+ export type LifecycleToolsConfig = z.output<typeof LifecycleToolsConfigSchema>;
21
+ //# sourceMappingURL=tool-factory-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-factory-config.d.ts","sourceRoot":"","sources":["../src/tool-factory-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,oBAAoB,0HAQvB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtE,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;EA0B1B,CAAC;AAEd,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
@@ -1,7 +1,4 @@
1
- import { ToolFactory } from '@dexto/agent-config';
2
- import { LifecycleToolsConfig } from './tool-factory-config.js';
3
- import 'zod';
4
-
5
- declare const lifecycleToolsFactory: ToolFactory<LifecycleToolsConfig>;
6
-
7
- export { lifecycleToolsFactory };
1
+ import type { ToolFactory } from '@dexto/agent-config';
2
+ import { type LifecycleToolsConfig } from './tool-factory-config.js';
3
+ export declare const lifecycleToolsFactory: ToolFactory<LifecycleToolsConfig>;
4
+ //# sourceMappingURL=tool-factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-factory.d.ts","sourceRoot":"","sources":["../src/tool-factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAEH,KAAK,oBAAoB,EAE5B,MAAM,0BAA0B,CAAC;AAalC,eAAO,MAAM,qBAAqB,EAAE,WAAW,CAAC,oBAAoB,CAyBnE,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Lifecycle Tools Factory Tests
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=tool-factory.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-factory.test.d.ts","sourceRoot":"","sources":["../src/tool-factory.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -92,9 +92,14 @@ async function readTailBytes(filePath, maxBytes) {
92
92
  function createViewLogsTool(options) {
93
93
  return (0, import_core.defineTool)({
94
94
  id: "view_logs",
95
- displayName: "View Logs",
96
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.",
97
96
  inputSchema: ViewLogsInputSchema,
97
+ presentation: {
98
+ describeHeader: (input) => (0, import_core.createLocalToolCallHeader)({
99
+ title: "View Logs",
100
+ argsText: `${input.lines} lines`
101
+ })
102
+ },
98
103
  async execute(parsed, context) {
99
104
  const logFilePath = context.logger.getLogFilePath();
100
105
  if (!logFilePath) {
@@ -1,6 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { Tool } from '@dexto/core';
3
-
2
+ import type { Tool } from '@dexto/core';
4
3
  declare const ViewLogsInputSchema: z.ZodObject<{
5
4
  lines: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
6
5
  query: z.ZodOptional<z.ZodString>;
@@ -20,9 +19,9 @@ declare const ViewLogsInputSchema: z.ZodObject<{
20
19
  component?: string | undefined;
21
20
  includeContext?: boolean | undefined;
22
21
  }>;
23
- declare function createViewLogsTool(options: {
22
+ export declare function createViewLogsTool(options: {
24
23
  maxLogLines: number;
25
24
  maxLogBytes: number;
26
25
  }): Tool<typeof ViewLogsInputSchema>;
27
-
28
- export { createViewLogsTool };
26
+ export {};
27
+ //# sourceMappingURL=view-logs-tool.d.ts.map
@@ -0,0 +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;;;;;;;;;;;;;;;;;;EAwBZ,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, defineTool } from "@dexto/core";
3
+ import { ToolError, createLocalToolCallHeader, defineTool } from "@dexto/core";
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"),
@@ -59,9 +59,14 @@ async function readTailBytes(filePath, maxBytes) {
59
59
  function createViewLogsTool(options) {
60
60
  return defineTool({
61
61
  id: "view_logs",
62
- displayName: "View Logs",
63
62
  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.",
64
63
  inputSchema: ViewLogsInputSchema,
64
+ presentation: {
65
+ describeHeader: (input) => createLocalToolCallHeader({
66
+ title: "View Logs",
67
+ argsText: `${input.lines} lines`
68
+ })
69
+ },
65
70
  async execute(parsed, context) {
66
71
  const logFilePath = context.logger.getLogFilePath();
67
72
  if (!logFilePath) {
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=view-logs-tool.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view-logs-tool.test.d.ts","sourceRoot":"","sources":["../src/view-logs-tool.test.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dexto/tools-lifecycle",
3
- "version": "1.6.0",
3
+ "version": "1.6.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": "^3.25.0",
23
- "@dexto/agent-config": "1.6.0",
24
- "@dexto/core": "1.6.0"
23
+ "@dexto/agent-config": "1.6.1",
24
+ "@dexto/core": "1.6.1"
25
25
  },
26
26
  "devDependencies": {
27
27
  "tsup": "^8.0.0",
@@ -33,7 +33,7 @@
33
33
  "README.md"
34
34
  ],
35
35
  "scripts": {
36
- "build": "tsup",
36
+ "build": "tsup && node ../../scripts/clean-tsbuildinfo.mjs && tsc -b tsconfig.json --emitDeclarationOnly",
37
37
  "typecheck": "tsc --noEmit",
38
38
  "clean": "rm -rf dist"
39
39
  }
@@ -1,78 +0,0 @@
1
- import { z } from 'zod';
2
- import { Tool } from '@dexto/core';
3
-
4
- declare const MemoryListInputSchema: z.ZodObject<{
5
- tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
6
- source: z.ZodOptional<z.ZodEnum<["user", "system"]>>;
7
- pinned: z.ZodOptional<z.ZodBoolean>;
8
- limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
9
- offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
10
- }, "strict", z.ZodTypeAny, {
11
- limit: number;
12
- offset: number;
13
- tags?: string[] | undefined;
14
- source?: "user" | "system" | undefined;
15
- pinned?: boolean | undefined;
16
- }, {
17
- tags?: string[] | undefined;
18
- source?: "user" | "system" | undefined;
19
- pinned?: boolean | undefined;
20
- limit?: number | undefined;
21
- offset?: number | undefined;
22
- }>;
23
- declare function createMemoryListTool(): Tool<typeof MemoryListInputSchema>;
24
- declare const MemoryGetInputSchema: z.ZodObject<{
25
- id: z.ZodString;
26
- }, "strict", z.ZodTypeAny, {
27
- id: string;
28
- }, {
29
- id: string;
30
- }>;
31
- declare function createMemoryGetTool(): Tool<typeof MemoryGetInputSchema>;
32
- declare const MemoryCreateInputSchema: z.ZodObject<{
33
- content: z.ZodString;
34
- tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
35
- source: z.ZodDefault<z.ZodOptional<z.ZodEnum<["user", "system"]>>>;
36
- pinned: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
37
- }, "strict", z.ZodTypeAny, {
38
- source: "user" | "system";
39
- pinned: boolean;
40
- content: string;
41
- tags?: string[] | undefined;
42
- }, {
43
- content: string;
44
- tags?: string[] | undefined;
45
- source?: "user" | "system" | undefined;
46
- pinned?: boolean | undefined;
47
- }>;
48
- declare function createMemoryCreateTool(): Tool<typeof MemoryCreateInputSchema>;
49
- declare const MemoryUpdateInputSchema: z.ZodObject<{
50
- id: z.ZodString;
51
- content: z.ZodOptional<z.ZodString>;
52
- tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
53
- source: z.ZodOptional<z.ZodEnum<["user", "system"]>>;
54
- pinned: z.ZodOptional<z.ZodBoolean>;
55
- }, "strict", z.ZodTypeAny, {
56
- id: string;
57
- tags?: string[] | undefined;
58
- source?: "user" | "system" | undefined;
59
- pinned?: boolean | undefined;
60
- content?: string | undefined;
61
- }, {
62
- id: string;
63
- tags?: string[] | undefined;
64
- source?: "user" | "system" | undefined;
65
- pinned?: boolean | undefined;
66
- content?: string | undefined;
67
- }>;
68
- declare function createMemoryUpdateTool(): Tool<typeof MemoryUpdateInputSchema>;
69
- declare const MemoryDeleteInputSchema: z.ZodObject<{
70
- id: z.ZodString;
71
- }, "strict", z.ZodTypeAny, {
72
- id: string;
73
- }, {
74
- id: string;
75
- }>;
76
- declare function createMemoryDeleteTool(): Tool<typeof MemoryDeleteInputSchema>;
77
-
78
- export { createMemoryCreateTool, createMemoryDeleteTool, createMemoryGetTool, createMemoryListTool, createMemoryUpdateTool };
@@ -1,34 +0,0 @@
1
- import { z } from 'zod';
2
- import { Tool } from '@dexto/core';
3
-
4
- declare const SearchHistoryInputSchema: z.ZodObject<{
5
- query: z.ZodString;
6
- mode: z.ZodEnum<["messages", "sessions"]>;
7
- sessionId: z.ZodOptional<z.ZodString>;
8
- role: z.ZodOptional<z.ZodEnum<["user", "assistant", "system", "tool"]>>;
9
- limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
10
- offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
11
- }, "strict", z.ZodTypeAny, {
12
- query: string;
13
- limit: number;
14
- offset: number;
15
- mode: "messages" | "sessions";
16
- sessionId?: string | undefined;
17
- role?: "user" | "system" | "assistant" | "tool" | undefined;
18
- }, {
19
- query: string;
20
- mode: "messages" | "sessions";
21
- sessionId?: string | undefined;
22
- limit?: number | undefined;
23
- offset?: number | undefined;
24
- role?: "user" | "system" | "assistant" | "tool" | undefined;
25
- }>;
26
- /**
27
- * Create the `search_history` tool.
28
- *
29
- * Searches message/session history using the configured SearchService.
30
- * Requires `ToolExecutionContext.services.search`.
31
- */
32
- declare function createSearchHistoryTool(): Tool<typeof SearchHistoryInputSchema>;
33
-
34
- export { createSearchHistoryTool };
@@ -1,23 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- declare const LIFECYCLE_TOOL_NAMES: readonly ["view_logs", "search_history", "memory_list", "memory_get", "memory_create", "memory_update", "memory_delete"];
4
- type LifecycleToolName = (typeof LIFECYCLE_TOOL_NAMES)[number];
5
- declare const LifecycleToolsConfigSchema: z.ZodObject<{
6
- type: z.ZodLiteral<"lifecycle-tools">;
7
- enabledTools: z.ZodOptional<z.ZodArray<z.ZodEnum<["view_logs", "search_history", "memory_list", "memory_get", "memory_create", "memory_update", "memory_delete"]>, "many">>;
8
- maxLogLines: z.ZodDefault<z.ZodNumber>;
9
- maxLogBytes: z.ZodDefault<z.ZodNumber>;
10
- }, "strict", z.ZodTypeAny, {
11
- type: "lifecycle-tools";
12
- maxLogLines: number;
13
- maxLogBytes: number;
14
- enabledTools?: ("view_logs" | "search_history" | "memory_list" | "memory_get" | "memory_create" | "memory_update" | "memory_delete")[] | undefined;
15
- }, {
16
- type: "lifecycle-tools";
17
- enabledTools?: ("view_logs" | "search_history" | "memory_list" | "memory_get" | "memory_create" | "memory_update" | "memory_delete")[] | undefined;
18
- maxLogLines?: number | undefined;
19
- maxLogBytes?: number | undefined;
20
- }>;
21
- type LifecycleToolsConfig = z.output<typeof LifecycleToolsConfigSchema>;
22
-
23
- export { LIFECYCLE_TOOL_NAMES, type LifecycleToolName, type LifecycleToolsConfig, LifecycleToolsConfigSchema };
@@ -1,7 +0,0 @@
1
- import { ToolFactory } from '@dexto/agent-config';
2
- import { LifecycleToolsConfig } from './tool-factory-config.cjs';
3
- import 'zod';
4
-
5
- declare const lifecycleToolsFactory: ToolFactory<LifecycleToolsConfig>;
6
-
7
- export { lifecycleToolsFactory };
@@ -1,28 +0,0 @@
1
- import { z } from 'zod';
2
- import { Tool } from '@dexto/core';
3
-
4
- declare const ViewLogsInputSchema: z.ZodObject<{
5
- lines: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
6
- query: z.ZodOptional<z.ZodString>;
7
- level: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["debug", "info", "warn", "error", "silly"]>, z.ZodArray<z.ZodEnum<["debug", "info", "warn", "error", "silly"]>, "many">]>>;
8
- component: z.ZodOptional<z.ZodString>;
9
- includeContext: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
10
- }, "strict", z.ZodTypeAny, {
11
- lines: number;
12
- includeContext: boolean;
13
- query?: string | undefined;
14
- level?: "debug" | "info" | "warn" | "error" | "silly" | ("debug" | "info" | "warn" | "error" | "silly")[] | undefined;
15
- component?: string | undefined;
16
- }, {
17
- lines?: number | undefined;
18
- query?: string | undefined;
19
- level?: "debug" | "info" | "warn" | "error" | "silly" | ("debug" | "info" | "warn" | "error" | "silly")[] | undefined;
20
- component?: string | undefined;
21
- includeContext?: boolean | undefined;
22
- }>;
23
- declare function createViewLogsTool(options: {
24
- maxLogLines: number;
25
- maxLogBytes: number;
26
- }): Tool<typeof ViewLogsInputSchema>;
27
-
28
- export { createViewLogsTool };