zeitlich 0.2.17 → 0.2.18

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.
@@ -1,5 +1,5 @@
1
1
  import { a as SandboxFileSystem, F as FileStat, D as DirentEntry, S as Sandbox, d as SandboxCreateOptions } from './types-BMRzfELQ.cjs';
2
- import { R as RouterContext } from './types-BMXzv7TN.cjs';
2
+ import { R as RouterContext } from './types-CmOSypVk.cjs';
3
3
 
4
4
  /**
5
5
  * Ephemeral {@link SandboxFileSystem} backed by a {@link FileResolver}.
@@ -1,5 +1,5 @@
1
1
  import { a as SandboxFileSystem, F as FileStat, D as DirentEntry, S as Sandbox, d as SandboxCreateOptions } from './types-BMRzfELQ.js';
2
- import { R as RouterContext } from './types-BMXzv7TN.js';
2
+ import { R as RouterContext } from './types-CmOSypVk.js';
3
3
 
4
4
  /**
5
5
  * Ephemeral {@link SandboxFileSystem} backed by a {@link FileResolver}.
@@ -1,5 +1,5 @@
1
1
  import { Duration } from '@temporalio/common';
2
- import { a as ToolMap, b as ToolRouterHooks, M as MessageContent, S as SessionExitReason, c as ToolHandlerResponse, P as PreToolUseHookResult, d as PostToolUseFailureHookResult, e as RawToolCall, f as TokenUsage, B as BaseAgentState, g as RunAgentConfig, h as AgentStatus, W as WorkflowTask, i as ToolDefinition, j as ToolResultConfig, k as ToolCallResultUnion, I as InferToolResults } from './types-BMXzv7TN.js';
2
+ import { a as ToolMap, b as ToolRouterHooks, M as MessageContent, S as SessionExitReason, c as ToolHandlerResponse, P as PreToolUseHookResult, d as PostToolUseFailureHookResult, e as RawToolCall, f as TokenUsage, B as BaseAgentState, g as RunAgentConfig, h as AgentStatus, W as WorkflowTask, i as ToolDefinition, j as ToolResultConfig, k as ToolCallResultUnion, I as InferToolResults } from './types-CmOSypVk.js';
3
3
  import { z } from 'zod';
4
4
  import { g as SandboxOps } from './types-BMRzfELQ.js';
5
5
  import { QueryDefinition } from '@temporalio/workflow';
@@ -104,7 +104,7 @@ interface SubagentConfig<TResult extends z.ZodType = z.ZodType> {
104
104
  /** Description shown to the parent agent explaining what this subagent does */
105
105
  description: string;
106
106
  /** Whether this subagent is available (default: true). Disabled subagents are excluded from the Subagent tool. */
107
- enabled?: boolean;
107
+ enabled?: boolean | (() => boolean);
108
108
  /** Temporal workflow function or type name (used with executeChild) */
109
109
  workflow: string | SubagentWorkflow<TResult>;
110
110
  /** Optional task queue - defaults to parent's queue if not specified */
@@ -148,7 +148,7 @@ interface ToolWithHandler<TName extends string = string, TSchema extends z.ZodTy
148
148
  strict?: boolean;
149
149
  max_uses?: number;
150
150
  /** Whether this tool is available to the agent (default: true). Disabled tools are excluded from definitions and rejected at parse time. */
151
- enabled?: boolean;
151
+ enabled?: boolean | (() => boolean);
152
152
  /** Per-tool lifecycle hooks (run in addition to global hooks) */
153
153
  hooks?: ToolHooks<z.infer<TSchema>, TResult>;
154
154
  }
@@ -167,7 +167,7 @@ type ToolMap = Record<string, {
167
167
  handler: ToolHandler<any, any, any>;
168
168
  strict?: boolean;
169
169
  max_uses?: number;
170
- enabled?: boolean;
170
+ enabled?: boolean | (() => boolean);
171
171
  hooks?: ToolHooks<any, any>;
172
172
  }>;
173
173
  /**
@@ -148,7 +148,7 @@ interface ToolWithHandler<TName extends string = string, TSchema extends z.ZodTy
148
148
  strict?: boolean;
149
149
  max_uses?: number;
150
150
  /** Whether this tool is available to the agent (default: true). Disabled tools are excluded from definitions and rejected at parse time. */
151
- enabled?: boolean;
151
+ enabled?: boolean | (() => boolean);
152
152
  /** Per-tool lifecycle hooks (run in addition to global hooks) */
153
153
  hooks?: ToolHooks<z.infer<TSchema>, TResult>;
154
154
  }
@@ -167,7 +167,7 @@ type ToolMap = Record<string, {
167
167
  handler: ToolHandler<any, any, any>;
168
168
  strict?: boolean;
169
169
  max_uses?: number;
170
- enabled?: boolean;
170
+ enabled?: boolean | (() => boolean);
171
171
  hooks?: ToolHooks<any, any>;
172
172
  }>;
173
173
  /**
@@ -1,5 +1,5 @@
1
1
  import { Duration } from '@temporalio/common';
2
- import { a as ToolMap, b as ToolRouterHooks, M as MessageContent, S as SessionExitReason, c as ToolHandlerResponse, P as PreToolUseHookResult, d as PostToolUseFailureHookResult, e as RawToolCall, f as TokenUsage, B as BaseAgentState, g as RunAgentConfig, h as AgentStatus, W as WorkflowTask, i as ToolDefinition, j as ToolResultConfig, k as ToolCallResultUnion, I as InferToolResults } from './types-BMXzv7TN.cjs';
2
+ import { a as ToolMap, b as ToolRouterHooks, M as MessageContent, S as SessionExitReason, c as ToolHandlerResponse, P as PreToolUseHookResult, d as PostToolUseFailureHookResult, e as RawToolCall, f as TokenUsage, B as BaseAgentState, g as RunAgentConfig, h as AgentStatus, W as WorkflowTask, i as ToolDefinition, j as ToolResultConfig, k as ToolCallResultUnion, I as InferToolResults } from './types-CmOSypVk.cjs';
3
3
  import { z } from 'zod';
4
4
  import { g as SandboxOps } from './types-BMRzfELQ.cjs';
5
5
  import { QueryDefinition } from '@temporalio/workflow';
@@ -104,7 +104,7 @@ interface SubagentConfig<TResult extends z.ZodType = z.ZodType> {
104
104
  /** Description shown to the parent agent explaining what this subagent does */
105
105
  description: string;
106
106
  /** Whether this subagent is available (default: true). Disabled subagents are excluded from the Subagent tool. */
107
- enabled?: boolean;
107
+ enabled?: boolean | (() => boolean);
108
108
  /** Temporal workflow function or type name (used with executeChild) */
109
109
  workflow: string | SubagentWorkflow<TResult>;
110
110
  /** Optional task queue - defaults to parent's queue if not specified */
package/dist/workflow.cjs CHANGED
@@ -15,7 +15,7 @@ function createToolRouter(options) {
15
15
  for (const [_key, tool] of Object.entries(options.tools)) {
16
16
  toolMap.set(tool.name, tool);
17
17
  }
18
- const isEnabled = (tool) => tool.enabled ?? true;
18
+ const isEnabled = (tool) => typeof tool.enabled === "function" ? tool.enabled() : tool.enabled ?? true;
19
19
  if (options.plugins) {
20
20
  for (const plugin of options.plugins) {
21
21
  toolMap.set(plugin.name, plugin);
@@ -385,7 +385,9 @@ function createSubagentHandler(subagents) {
385
385
  // src/lib/subagent/register.ts
386
386
  function buildSubagentRegistration(subagents) {
387
387
  if (subagents.length === 0) return null;
388
- const getEnabled = () => subagents.filter((s) => s.enabled ?? true);
388
+ const getEnabled = () => subagents.filter(
389
+ (s) => typeof s.enabled === "function" ? s.enabled() : s.enabled ?? true
390
+ );
389
391
  const subagentHooksMap = /* @__PURE__ */ new Map();
390
392
  for (const s of subagents) {
391
393
  if (s.hooks) subagentHooksMap.set(s.agentName, s.hooks);