zeitlich 0.2.8 → 0.2.9

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.cjs CHANGED
@@ -14,18 +14,18 @@ var z13__default = /*#__PURE__*/_interopDefault(z13);
14
14
  var crypto__default = /*#__PURE__*/_interopDefault(crypto);
15
15
 
16
16
  // src/lib/session.ts
17
- var SUBAGENT_TOOL = "Subagent";
17
+ var SUBAGENT_TOOL_NAME = "Subagent";
18
18
  function buildSubagentDescription(subagents) {
19
19
  const subagentList = subagents.map((s) => `- **${s.agentName}**: ${s.description}`).join("\n");
20
20
  return `Launch a new agent to handle complex tasks autonomously.
21
21
 
22
- The ${SUBAGENT_TOOL} tool launches specialized agents (subprocesses) that autonomously handle complex tasks. Each agent type has specific capabilities and tools available to it.
22
+ The ${SUBAGENT_TOOL_NAME} tool launches specialized agents (subprocesses) that autonomously handle complex tasks. Each agent type has specific capabilities and tools available to it.
23
23
 
24
24
  Available agent types:
25
25
 
26
26
  ${subagentList}
27
27
 
28
- When using the ${SUBAGENT_TOOL} tool, you must specify a subagent parameter to select which agent type to use.
28
+ When using the ${SUBAGENT_TOOL_NAME} tool, you must specify a subagent parameter to select which agent type to use.
29
29
 
30
30
  Usage notes:
31
31
 
@@ -44,7 +44,7 @@ function createSubagentTool(subagents) {
44
44
  }
45
45
  const names = subagents.map((s) => s.agentName);
46
46
  return {
47
- name: SUBAGENT_TOOL,
47
+ name: SUBAGENT_TOOL_NAME,
48
48
  description: buildSubagentDescription(subagents),
49
49
  schema: z13__default.default.object({
50
50
  subagent: z13__default.default.enum(names).describe("The type of subagent to launch"),
@@ -97,7 +97,7 @@ function createToolRouter(options) {
97
97
  if (s.hooks) subagentHooksMap.set(s.agentName, s.hooks);
98
98
  }
99
99
  const resolveSubagentName = (args) => args.subagent;
100
- toolMap.set("Subagent", {
100
+ toolMap.set(SUBAGENT_TOOL_NAME, {
101
101
  ...createSubagentTool(options.subagents),
102
102
  handler: createSubagentHandler(options.subagents),
103
103
  ...subagentHooksMap.size > 0 && {
@@ -290,13 +290,19 @@ function createToolRouter(options) {
290
290
  return Array.from(toolMap.entries()).filter(([, tool]) => isEnabled(tool)).map(([name]) => name);
291
291
  },
292
292
  getToolDefinitions() {
293
- return Array.from(toolMap).filter(([, tool]) => isEnabled(tool)).map(([name, tool]) => ({
294
- name,
295
- description: tool.description,
296
- schema: tool.schema,
297
- strict: tool.strict,
298
- max_uses: tool.max_uses
299
- }));
293
+ const activeSubagents = options.subagents?.filter((subagent) => isEnabled(subagent)) ?? [];
294
+ return [
295
+ ...Array.from(toolMap).filter(
296
+ ([, tool]) => isEnabled(tool) && tool.name !== SUBAGENT_TOOL_NAME
297
+ ).map(([name, tool]) => ({
298
+ name,
299
+ description: tool.description,
300
+ schema: tool.schema,
301
+ strict: tool.strict,
302
+ max_uses: tool.max_uses
303
+ })),
304
+ ...activeSubagents.length > 0 ? [createSubagentTool(activeSubagents)] : []
305
+ ];
300
306
  },
301
307
  // --- Methods for processing tool calls ---
302
308
  async processToolCalls(toolCalls, context) {
@@ -784,7 +790,7 @@ Examples:
784
790
  }),
785
791
  strict: true
786
792
  };
787
- var readTool = {
793
+ var readFileTool = {
788
794
  name: "FileRead",
789
795
  description: `Read file contents with optional pagination.
790
796
 
@@ -807,22 +813,21 @@ The tool returns the file content in an appropriate format:
807
813
  }),
808
814
  strict: true
809
815
  };
810
- var writeTool = {
816
+ var writeFileTool = {
811
817
  name: "FileWrite",
812
818
  description: `Create or overwrite a file with new content.
813
819
 
814
820
  Usage:
815
- - Provide the absolute path to the file
816
821
  - The file will be created if it doesn't exist
817
822
  - If the file exists, it will be completely overwritten
818
823
 
819
824
  IMPORTANT:
820
825
  - You must read the file first (in this session) before writing to it
821
826
  - This is an atomic write operation - the entire file is replaced
822
- - Path must be absolute (e.g., "/docs/readme.md", not "docs/readme.md")
827
+ - Path must be relative to the root of the file system (e.g., "docs/readme.md", not "/docs/readme.md")
823
828
  `,
824
829
  schema: z13.z.object({
825
- file_path: z13.z.string().describe("The absolute path to the file to write"),
830
+ file_path: z13.z.string().describe("The path to the file to write"),
826
831
  content: z13.z.string().describe("The content to write to the file")
827
832
  }),
828
833
  strict: true
@@ -1084,7 +1089,7 @@ Usage notes:
1084
1089
  };
1085
1090
 
1086
1091
  // src/tools/ask-user-question/handler.ts
1087
- var createAskUserQuestionHandler = () => (args) => {
1092
+ var createAskUserQuestionHandler = () => async (args) => {
1088
1093
  return {
1089
1094
  toolResponse: "Question submitted",
1090
1095
  data: { questions: args.questions }
@@ -1488,13 +1493,13 @@ exports.hasNoOtherToolCalls = hasNoOtherToolCalls;
1488
1493
  exports.invokeModel = invokeModel;
1489
1494
  exports.isTerminalStatus = isTerminalStatus;
1490
1495
  exports.proxyDefaultThreadOps = proxyDefaultThreadOps;
1491
- exports.readTool = readTool;
1496
+ exports.readFileTool = readFileTool;
1492
1497
  exports.taskCreateTool = taskCreateTool;
1493
1498
  exports.taskGetTool = taskGetTool;
1494
1499
  exports.taskListTool = taskListTool;
1495
1500
  exports.taskUpdateTool = taskUpdateTool;
1496
1501
  exports.toTree = toTree;
1497
1502
  exports.withAutoAppend = withAutoAppend;
1498
- exports.writeTool = writeTool;
1503
+ exports.writeFileTool = writeFileTool;
1499
1504
  //# sourceMappingURL=index.cjs.map
1500
1505
  //# sourceMappingURL=index.cjs.map