zeitlich 0.2.12 → 0.2.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zeitlich",
3
- "version": "0.2.12",
3
+ "version": "0.2.13",
4
4
  "description": "[EXPERIMENTAL] An opinionated AI agent implementation for Temporal",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -67,7 +67,7 @@ export interface LangChainAdapter {
67
67
  * ```
68
68
  */
69
69
  export function createLangChainAdapter(
70
- config: LangChainAdapterConfig,
70
+ config: LangChainAdapterConfig
71
71
  ): LangChainAdapter {
72
72
  const { redis } = config;
73
73
 
@@ -79,7 +79,7 @@ export function createLangChainAdapter(
79
79
 
80
80
  async appendHumanMessage(
81
81
  threadId: string,
82
- content: string | MessageContent,
82
+ content: string | MessageContent
83
83
  ): Promise<void> {
84
84
  const thread = createLangChainThreadManager({ redis, threadId });
85
85
  await thread.appendHumanMessage(content);
@@ -87,7 +87,7 @@ export function createLangChainAdapter(
87
87
 
88
88
  async appendSystemMessage(
89
89
  threadId: string,
90
- content: string,
90
+ content: string
91
91
  ): Promise<void> {
92
92
  const thread = createLangChainThreadManager({ redis, threadId });
93
93
  await thread.appendSystemMessage(content);
@@ -105,12 +105,12 @@ export function createLangChainAdapter(
105
105
 
106
106
  const invoker: ModelInvoker<StoredMessage> = config.model
107
107
  ? makeInvoker(config.model)
108
- : (() => {
108
+ : ((() => {
109
109
  throw new Error(
110
110
  "No default model provided to createLangChainAdapter. " +
111
- "Either pass `model` in the config or use `createModelInvoker(model)` instead.",
111
+ "Either pass `model` in the config or use `createModelInvoker(model)` instead."
112
112
  );
113
- }) as unknown as ModelInvoker<StoredMessage>;
113
+ }) as unknown as ModelInvoker<StoredMessage>);
114
114
 
115
115
  return {
116
116
  threadOps,
@@ -942,7 +942,10 @@ export function defineSubagent<
942
942
  config: Omit<SubagentConfig<TResult>, "hooks" | "workflow" | "context"> & {
943
943
  workflow:
944
944
  | string
945
- | ((input: { prompt: string; context: TContext }) => Promise<ToolHandlerResponse<TResult | null>>);
945
+ | ((input: {
946
+ prompt: string;
947
+ context: TContext;
948
+ }) => Promise<ToolHandlerResponse<z.infer<TResult> | null>>);
946
949
  context: TContext;
947
950
  hooks?: SubagentHooks<SubagentArgs, z.infer<TResult>>;
948
951
  }
@@ -950,7 +953,11 @@ export function defineSubagent<
950
953
  // Without context — verifies workflow accepts { prompt }
951
954
  export function defineSubagent<TResult extends z.ZodType = z.ZodType>(
952
955
  config: Omit<SubagentConfig<TResult>, "hooks" | "workflow"> & {
953
- workflow: string | ((input: { prompt: string }) => Promise<ToolHandlerResponse<TResult | null>>);
956
+ workflow:
957
+ | string
958
+ | ((input: {
959
+ prompt: string;
960
+ }) => Promise<ToolHandlerResponse<z.infer<TResult> | null>>);
954
961
  hooks?: SubagentHooks<SubagentArgs, z.infer<TResult>>;
955
962
  }
956
963
  ): SubagentConfig<TResult>;
package/src/lib/types.ts CHANGED
@@ -22,7 +22,7 @@ export type ContentPart = { type: string; [key: string]: unknown };
22
22
  export type MessageContent = string | ContentPart[];
23
23
 
24
24
  /** Content returned by a tool handler */
25
- export type ToolMessageContent = string;
25
+ export type ToolMessageContent = MessageContent;
26
26
 
27
27
  /**
28
28
  * Agent execution status
@@ -196,7 +196,7 @@ export interface ToolResultConfig {
196
196
 
197
197
  export type SubagentWorkflow<TResult extends z.ZodType = z.ZodType> = (
198
198
  input: SubagentInput
199
- ) => Promise<ToolHandlerResponse<TResult | null>>;
199
+ ) => Promise<ToolHandlerResponse<z.infer<TResult> | null>>;
200
200
 
201
201
  /** Infer the z.infer'd result type from a SubagentConfig, or null if no schema */
202
202
  export type InferSubagentResult<T extends SubagentConfig> =