zeitlich 0.2.51 → 0.2.53

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.
Files changed (45) hide show
  1. package/dist/adapters/thread/anthropic/index.d.cts +5 -5
  2. package/dist/adapters/thread/anthropic/index.d.ts +5 -5
  3. package/dist/adapters/thread/anthropic/workflow.d.cts +5 -5
  4. package/dist/adapters/thread/anthropic/workflow.d.ts +5 -5
  5. package/dist/adapters/thread/google-genai/index.d.cts +3 -3
  6. package/dist/adapters/thread/google-genai/index.d.ts +3 -3
  7. package/dist/adapters/thread/google-genai/workflow.d.cts +5 -5
  8. package/dist/adapters/thread/google-genai/workflow.d.ts +5 -5
  9. package/dist/adapters/thread/langchain/index.d.cts +5 -5
  10. package/dist/adapters/thread/langchain/index.d.ts +5 -5
  11. package/dist/adapters/thread/langchain/workflow.d.cts +5 -5
  12. package/dist/adapters/thread/langchain/workflow.d.ts +5 -5
  13. package/dist/{cold-store-DyHodfAB.d.ts → cold-store-BbvJLhXJ.d.ts} +1 -1
  14. package/dist/{cold-store-YOx9nmgR.d.cts → cold-store-Ki_U0jyd.d.cts} +1 -1
  15. package/dist/index.cjs +38 -3
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +8 -8
  18. package/dist/index.d.ts +8 -8
  19. package/dist/index.js +38 -3
  20. package/dist/index.js.map +1 -1
  21. package/dist/{proxy-CmiTP4pp.d.ts → proxy-CwniAm8W.d.ts} +1 -1
  22. package/dist/{proxy-2htgGQrc.d.cts → proxy-wsNrEh2u.d.cts} +1 -1
  23. package/dist/{thread-manager-CcvltOuq.d.ts → thread-manager-D1zfZnxi.d.ts} +2 -2
  24. package/dist/{thread-manager-DHAbncHX.d.ts → thread-manager-DCXkMqHH.d.ts} +2 -2
  25. package/dist/{thread-manager-BQAbrYXH.d.cts → thread-manager-DW7FqMdN.d.cts} +2 -2
  26. package/dist/{thread-manager-BJ5pz5Cx.d.cts → thread-manager-DhvA5oDL.d.cts} +2 -2
  27. package/dist/{types-DiI7mZhI.d.ts → types-DQQKF5FQ.d.ts} +24 -2
  28. package/dist/{types-BjdqxKYp.d.cts → types-DpHBKA8c.d.cts} +24 -2
  29. package/dist/{types-N_LTWe4b.d.cts → types-tJ9Or7u_.d.cts} +1 -1
  30. package/dist/{types-DEbkLA06.d.ts → types-ziu6HZPh.d.ts} +1 -1
  31. package/dist/{workflow-DBjPOKBr.d.ts → workflow-BeMiPEq4.d.ts} +2 -1
  32. package/dist/{workflow-CcgD6EUB.d.cts → workflow-CNTNwEnj.d.cts} +2 -1
  33. package/dist/workflow.cjs +38 -3
  34. package/dist/workflow.cjs.map +1 -1
  35. package/dist/workflow.d.cts +2 -2
  36. package/dist/workflow.d.ts +2 -2
  37. package/dist/workflow.js +38 -3
  38. package/dist/workflow.js.map +1 -1
  39. package/package.json +2 -2
  40. package/src/lib/hooks/index.ts +2 -0
  41. package/src/lib/hooks/types.ts +26 -1
  42. package/src/lib/observability/hooks.ts +17 -2
  43. package/src/lib/session/session.ts +31 -3
  44. package/src/lib/state/types.ts +9 -11
  45. package/src/workflow.ts +2 -0
@@ -2,17 +2,17 @@ import { A as ADAPTER_ID } from '../../../adapter-id-CMwVrVqv.cjs';
2
2
  export { a as AdapterId } from '../../../adapter-id-CMwVrVqv.cjs';
3
3
  import { RedisClientType } from 'redis';
4
4
  import Anthropic from '@anthropic-ai/sdk';
5
- import { M as ModelInvoker, a as PrefixedThreadOps, S as ScopedPrefix, R as RouterContext, b as ToolHandlerResponse, A as ActivityToolHandler, c as ModelInvokerConfig, d as AgentResponse } from '../../../types-BjdqxKYp.cjs';
6
- import { C as ColdThreadStore } from '../../../cold-store-YOx9nmgR.cjs';
7
- import { A as AnthropicContent, a as AnthropicThreadManagerHooks } from '../../../thread-manager-BQAbrYXH.cjs';
8
- export { b as AnthropicInvocationPayload, c as AnthropicThreadManager, d as AnthropicThreadManagerConfig, S as StoredMessage, e as createAnthropicThreadManager } from '../../../thread-manager-BQAbrYXH.cjs';
5
+ import { M as ModelInvoker, a as PrefixedThreadOps, S as ScopedPrefix, R as RouterContext, b as ToolHandlerResponse, A as ActivityToolHandler, c as ModelInvokerConfig, d as AgentResponse } from '../../../types-DpHBKA8c.cjs';
6
+ import { C as ColdThreadStore } from '../../../cold-store-Ki_U0jyd.cjs';
7
+ import { A as AnthropicContent, a as AnthropicThreadManagerHooks } from '../../../thread-manager-DW7FqMdN.cjs';
8
+ export { b as AnthropicInvocationPayload, c as AnthropicThreadManager, d as AnthropicThreadManagerConfig, S as StoredMessage, e as createAnthropicThreadManager } from '../../../thread-manager-DW7FqMdN.cjs';
9
9
  import '@temporalio/workflow';
10
10
  import '@temporalio/common/lib/interfaces';
11
11
  import 'zod';
12
12
  import '../../../types-D8W5TnSa.cjs';
13
13
  import '@temporalio/common';
14
14
  import '@aws-sdk/client-s3';
15
- import '../../../types-N_LTWe4b.cjs';
15
+ import '../../../types-tJ9Or7u_.cjs';
16
16
 
17
17
  interface AnthropicPromptCacheOptions {
18
18
  /** TTL for the cache checkpoint. Defaults to 5m. */
@@ -2,17 +2,17 @@ import { A as ADAPTER_ID } from '../../../adapter-id-CMwVrVqv.js';
2
2
  export { a as AdapterId } from '../../../adapter-id-CMwVrVqv.js';
3
3
  import { RedisClientType } from 'redis';
4
4
  import Anthropic from '@anthropic-ai/sdk';
5
- import { M as ModelInvoker, a as PrefixedThreadOps, S as ScopedPrefix, R as RouterContext, b as ToolHandlerResponse, A as ActivityToolHandler, c as ModelInvokerConfig, d as AgentResponse } from '../../../types-DiI7mZhI.js';
6
- import { C as ColdThreadStore } from '../../../cold-store-DyHodfAB.js';
7
- import { A as AnthropicContent, a as AnthropicThreadManagerHooks } from '../../../thread-manager-DHAbncHX.js';
8
- export { b as AnthropicInvocationPayload, c as AnthropicThreadManager, d as AnthropicThreadManagerConfig, S as StoredMessage, e as createAnthropicThreadManager } from '../../../thread-manager-DHAbncHX.js';
5
+ import { M as ModelInvoker, a as PrefixedThreadOps, S as ScopedPrefix, R as RouterContext, b as ToolHandlerResponse, A as ActivityToolHandler, c as ModelInvokerConfig, d as AgentResponse } from '../../../types-DQQKF5FQ.js';
6
+ import { C as ColdThreadStore } from '../../../cold-store-BbvJLhXJ.js';
7
+ import { A as AnthropicContent, a as AnthropicThreadManagerHooks } from '../../../thread-manager-DCXkMqHH.js';
8
+ export { b as AnthropicInvocationPayload, c as AnthropicThreadManager, d as AnthropicThreadManagerConfig, S as StoredMessage, e as createAnthropicThreadManager } from '../../../thread-manager-DCXkMqHH.js';
9
9
  import '@temporalio/workflow';
10
10
  import '@temporalio/common/lib/interfaces';
11
11
  import 'zod';
12
12
  import '../../../types-D8W5TnSa.js';
13
13
  import '@temporalio/common';
14
14
  import '@aws-sdk/client-s3';
15
- import '../../../types-DEbkLA06.js';
15
+ import '../../../types-ziu6HZPh.js';
16
16
 
17
17
  interface AnthropicPromptCacheOptions {
18
18
  /** TTL for the cache checkpoint. Defaults to 5m. */
@@ -1,8 +1,8 @@
1
1
  import { ActivityInterfaceFor } from '@temporalio/workflow';
2
- import { T as ThreadOps } from '../../../types-BjdqxKYp.cjs';
3
- import { A as AnthropicContent } from '../../../thread-manager-BQAbrYXH.cjs';
4
- import { c as createThreadOpsProxy } from '../../../proxy-2htgGQrc.cjs';
5
- export { T as ThreadOpsProxyOptions } from '../../../proxy-2htgGQrc.cjs';
2
+ import { T as ThreadOps } from '../../../types-DpHBKA8c.cjs';
3
+ import { A as AnthropicContent } from '../../../thread-manager-DW7FqMdN.cjs';
4
+ import { c as createThreadOpsProxy } from '../../../proxy-wsNrEh2u.cjs';
5
+ export { T as ThreadOpsProxyOptions } from '../../../proxy-wsNrEh2u.cjs';
6
6
  export { A as ADAPTER_ID, a as AdapterId } from '../../../adapter-id-CMwVrVqv.cjs';
7
7
  import '@temporalio/common/lib/interfaces';
8
8
  import 'zod';
@@ -10,7 +10,7 @@ import '../../../types-D8W5TnSa.cjs';
10
10
  import '@temporalio/common';
11
11
  import 'redis';
12
12
  import '@anthropic-ai/sdk';
13
- import '../../../types-N_LTWe4b.cjs';
13
+ import '../../../types-tJ9Or7u_.cjs';
14
14
 
15
15
  /**
16
16
  * Workflow-safe proxy for Anthropic thread operations.
@@ -1,8 +1,8 @@
1
1
  import { ActivityInterfaceFor } from '@temporalio/workflow';
2
- import { T as ThreadOps } from '../../../types-DiI7mZhI.js';
3
- import { A as AnthropicContent } from '../../../thread-manager-DHAbncHX.js';
4
- import { c as createThreadOpsProxy } from '../../../proxy-CmiTP4pp.js';
5
- export { T as ThreadOpsProxyOptions } from '../../../proxy-CmiTP4pp.js';
2
+ import { T as ThreadOps } from '../../../types-DQQKF5FQ.js';
3
+ import { A as AnthropicContent } from '../../../thread-manager-DCXkMqHH.js';
4
+ import { c as createThreadOpsProxy } from '../../../proxy-CwniAm8W.js';
5
+ export { T as ThreadOpsProxyOptions } from '../../../proxy-CwniAm8W.js';
6
6
  export { A as ADAPTER_ID, a as AdapterId } from '../../../adapter-id-CMwVrVqv.js';
7
7
  import '@temporalio/common/lib/interfaces';
8
8
  import 'zod';
@@ -10,7 +10,7 @@ import '../../../types-D8W5TnSa.js';
10
10
  import '@temporalio/common';
11
11
  import 'redis';
12
12
  import '@anthropic-ai/sdk';
13
- import '../../../types-DEbkLA06.js';
13
+ import '../../../types-ziu6HZPh.js';
14
14
 
15
15
  /**
16
16
  * Workflow-safe proxy for Anthropic thread operations.
@@ -2,9 +2,9 @@ import { A as ADAPTER_ID } from '../../../adapter-id-BB-mmrts.cjs';
2
2
  export { a as AdapterId } from '../../../adapter-id-BB-mmrts.cjs';
3
3
  import { RedisClientType } from 'redis';
4
4
  import { Part, Content, GoogleGenAI, GenerateContentConfig } from '@google/genai';
5
- import { c as ModelInvokerConfig, d as AgentResponse, M as ModelInvoker, a as PrefixedThreadOps, S as ScopedPrefix, R as RouterContext, b as ToolHandlerResponse, A as ActivityToolHandler } from '../../../types-BjdqxKYp.cjs';
6
- import { C as ColdThreadStore } from '../../../cold-store-YOx9nmgR.cjs';
7
- import { T as ThreadManagerHooks, P as ProviderThreadManager } from '../../../types-N_LTWe4b.cjs';
5
+ import { c as ModelInvokerConfig, d as AgentResponse, M as ModelInvoker, a as PrefixedThreadOps, S as ScopedPrefix, R as RouterContext, b as ToolHandlerResponse, A as ActivityToolHandler } from '../../../types-DpHBKA8c.cjs';
6
+ import { C as ColdThreadStore } from '../../../cold-store-Ki_U0jyd.cjs';
7
+ import { T as ThreadManagerHooks, P as ProviderThreadManager } from '../../../types-tJ9Or7u_.cjs';
8
8
  import '@temporalio/workflow';
9
9
  import '@temporalio/common/lib/interfaces';
10
10
  import 'zod';
@@ -2,9 +2,9 @@ import { A as ADAPTER_ID } from '../../../adapter-id-BB-mmrts.js';
2
2
  export { a as AdapterId } from '../../../adapter-id-BB-mmrts.js';
3
3
  import { RedisClientType } from 'redis';
4
4
  import { Part, Content, GoogleGenAI, GenerateContentConfig } from '@google/genai';
5
- import { c as ModelInvokerConfig, d as AgentResponse, M as ModelInvoker, a as PrefixedThreadOps, S as ScopedPrefix, R as RouterContext, b as ToolHandlerResponse, A as ActivityToolHandler } from '../../../types-DiI7mZhI.js';
6
- import { C as ColdThreadStore } from '../../../cold-store-DyHodfAB.js';
7
- import { T as ThreadManagerHooks, P as ProviderThreadManager } from '../../../types-DEbkLA06.js';
5
+ import { c as ModelInvokerConfig, d as AgentResponse, M as ModelInvoker, a as PrefixedThreadOps, S as ScopedPrefix, R as RouterContext, b as ToolHandlerResponse, A as ActivityToolHandler } from '../../../types-DQQKF5FQ.js';
6
+ import { C as ColdThreadStore } from '../../../cold-store-BbvJLhXJ.js';
7
+ import { T as ThreadManagerHooks, P as ProviderThreadManager } from '../../../types-ziu6HZPh.js';
8
8
  import '@temporalio/workflow';
9
9
  import '@temporalio/common/lib/interfaces';
10
10
  import 'zod';
@@ -1,8 +1,8 @@
1
1
  import { ActivityInterfaceFor } from '@temporalio/workflow';
2
- import { T as ThreadOps } from '../../../types-BjdqxKYp.cjs';
2
+ import { T as ThreadOps } from '../../../types-DpHBKA8c.cjs';
3
3
  import { GoogleGenAIContent } from './index.cjs';
4
- import { c as createThreadOpsProxy } from '../../../proxy-2htgGQrc.cjs';
5
- export { T as ThreadOpsProxyOptions } from '../../../proxy-2htgGQrc.cjs';
4
+ import { c as createThreadOpsProxy } from '../../../proxy-wsNrEh2u.cjs';
5
+ export { T as ThreadOpsProxyOptions } from '../../../proxy-wsNrEh2u.cjs';
6
6
  export { A as ADAPTER_ID, a as AdapterId } from '../../../adapter-id-BB-mmrts.cjs';
7
7
  import '@temporalio/common/lib/interfaces';
8
8
  import 'zod';
@@ -10,9 +10,9 @@ import '../../../types-D8W5TnSa.cjs';
10
10
  import '@temporalio/common';
11
11
  import 'redis';
12
12
  import '@google/genai';
13
- import '../../../cold-store-YOx9nmgR.cjs';
13
+ import '../../../cold-store-Ki_U0jyd.cjs';
14
14
  import '@aws-sdk/client-s3';
15
- import '../../../types-N_LTWe4b.cjs';
15
+ import '../../../types-tJ9Or7u_.cjs';
16
16
 
17
17
  /**
18
18
  * Workflow-safe proxy for Google GenAI thread operations.
@@ -1,8 +1,8 @@
1
1
  import { ActivityInterfaceFor } from '@temporalio/workflow';
2
- import { T as ThreadOps } from '../../../types-DiI7mZhI.js';
2
+ import { T as ThreadOps } from '../../../types-DQQKF5FQ.js';
3
3
  import { GoogleGenAIContent } from './index.js';
4
- import { c as createThreadOpsProxy } from '../../../proxy-CmiTP4pp.js';
5
- export { T as ThreadOpsProxyOptions } from '../../../proxy-CmiTP4pp.js';
4
+ import { c as createThreadOpsProxy } from '../../../proxy-CwniAm8W.js';
5
+ export { T as ThreadOpsProxyOptions } from '../../../proxy-CwniAm8W.js';
6
6
  export { A as ADAPTER_ID, a as AdapterId } from '../../../adapter-id-BB-mmrts.js';
7
7
  import '@temporalio/common/lib/interfaces';
8
8
  import 'zod';
@@ -10,9 +10,9 @@ import '../../../types-D8W5TnSa.js';
10
10
  import '@temporalio/common';
11
11
  import 'redis';
12
12
  import '@google/genai';
13
- import '../../../cold-store-DyHodfAB.js';
13
+ import '../../../cold-store-BbvJLhXJ.js';
14
14
  import '@aws-sdk/client-s3';
15
- import '../../../types-DEbkLA06.js';
15
+ import '../../../types-ziu6HZPh.js';
16
16
 
17
17
  /**
18
18
  * Workflow-safe proxy for Google GenAI thread operations.
@@ -2,18 +2,18 @@ import { A as ADAPTER_ID } from '../../../adapter-id-CbY2zeSt.cjs';
2
2
  export { a as AdapterId } from '../../../adapter-id-CbY2zeSt.cjs';
3
3
  import { RedisClientType } from 'redis';
4
4
  import { StoredMessage, MessageContent, BaseMessage } from '@langchain/core/messages';
5
- import { M as ModelInvoker, a as PrefixedThreadOps, S as ScopedPrefix, R as RouterContext, b as ToolHandlerResponse, A as ActivityToolHandler, c as ModelInvokerConfig, d as AgentResponse } from '../../../types-BjdqxKYp.cjs';
6
- import { C as ColdThreadStore } from '../../../cold-store-YOx9nmgR.cjs';
5
+ import { M as ModelInvoker, a as PrefixedThreadOps, S as ScopedPrefix, R as RouterContext, b as ToolHandlerResponse, A as ActivityToolHandler, c as ModelInvokerConfig, d as AgentResponse } from '../../../types-DpHBKA8c.cjs';
6
+ import { C as ColdThreadStore } from '../../../cold-store-Ki_U0jyd.cjs';
7
7
  import { BaseChatModel } from '@langchain/core/language_models/chat_models';
8
- import { L as LangChainContent, a as LangChainThreadManagerHooks } from '../../../thread-manager-BJ5pz5Cx.cjs';
9
- export { b as LangChainInvocationPayload, c as LangChainThreadManager, d as LangChainThreadManagerConfig, e as createLangChainThreadManager } from '../../../thread-manager-BJ5pz5Cx.cjs';
8
+ import { L as LangChainContent, a as LangChainThreadManagerHooks } from '../../../thread-manager-DhvA5oDL.cjs';
9
+ export { b as LangChainInvocationPayload, c as LangChainThreadManager, d as LangChainThreadManagerConfig, e as createLangChainThreadManager } from '../../../thread-manager-DhvA5oDL.cjs';
10
10
  import '@temporalio/workflow';
11
11
  import '@temporalio/common/lib/interfaces';
12
12
  import 'zod';
13
13
  import '../../../types-D8W5TnSa.cjs';
14
14
  import '@temporalio/common';
15
15
  import '@aws-sdk/client-s3';
16
- import '../../../types-N_LTWe4b.cjs';
16
+ import '../../../types-tJ9Or7u_.cjs';
17
17
 
18
18
  type LangChainThreadOps<TScope extends string = ""> = PrefixedThreadOps<ScopedPrefix<TScope, typeof ADAPTER_ID>, LangChainContent>;
19
19
  interface LangChainAdapterConfig {
@@ -2,18 +2,18 @@ import { A as ADAPTER_ID } from '../../../adapter-id-CbY2zeSt.js';
2
2
  export { a as AdapterId } from '../../../adapter-id-CbY2zeSt.js';
3
3
  import { RedisClientType } from 'redis';
4
4
  import { StoredMessage, MessageContent, BaseMessage } from '@langchain/core/messages';
5
- import { M as ModelInvoker, a as PrefixedThreadOps, S as ScopedPrefix, R as RouterContext, b as ToolHandlerResponse, A as ActivityToolHandler, c as ModelInvokerConfig, d as AgentResponse } from '../../../types-DiI7mZhI.js';
6
- import { C as ColdThreadStore } from '../../../cold-store-DyHodfAB.js';
5
+ import { M as ModelInvoker, a as PrefixedThreadOps, S as ScopedPrefix, R as RouterContext, b as ToolHandlerResponse, A as ActivityToolHandler, c as ModelInvokerConfig, d as AgentResponse } from '../../../types-DQQKF5FQ.js';
6
+ import { C as ColdThreadStore } from '../../../cold-store-BbvJLhXJ.js';
7
7
  import { BaseChatModel } from '@langchain/core/language_models/chat_models';
8
- import { L as LangChainContent, a as LangChainThreadManagerHooks } from '../../../thread-manager-CcvltOuq.js';
9
- export { b as LangChainInvocationPayload, c as LangChainThreadManager, d as LangChainThreadManagerConfig, e as createLangChainThreadManager } from '../../../thread-manager-CcvltOuq.js';
8
+ import { L as LangChainContent, a as LangChainThreadManagerHooks } from '../../../thread-manager-D1zfZnxi.js';
9
+ export { b as LangChainInvocationPayload, c as LangChainThreadManager, d as LangChainThreadManagerConfig, e as createLangChainThreadManager } from '../../../thread-manager-D1zfZnxi.js';
10
10
  import '@temporalio/workflow';
11
11
  import '@temporalio/common/lib/interfaces';
12
12
  import 'zod';
13
13
  import '../../../types-D8W5TnSa.js';
14
14
  import '@temporalio/common';
15
15
  import '@aws-sdk/client-s3';
16
- import '../../../types-DEbkLA06.js';
16
+ import '../../../types-ziu6HZPh.js';
17
17
 
18
18
  type LangChainThreadOps<TScope extends string = ""> = PrefixedThreadOps<ScopedPrefix<TScope, typeof ADAPTER_ID>, LangChainContent>;
19
19
  interface LangChainAdapterConfig {
@@ -1,8 +1,8 @@
1
1
  import { ActivityInterfaceFor } from '@temporalio/workflow';
2
- import { T as ThreadOps } from '../../../types-BjdqxKYp.cjs';
3
- import { L as LangChainContent } from '../../../thread-manager-BJ5pz5Cx.cjs';
4
- import { c as createThreadOpsProxy } from '../../../proxy-2htgGQrc.cjs';
5
- export { T as ThreadOpsProxyOptions } from '../../../proxy-2htgGQrc.cjs';
2
+ import { T as ThreadOps } from '../../../types-DpHBKA8c.cjs';
3
+ import { L as LangChainContent } from '../../../thread-manager-DhvA5oDL.cjs';
4
+ import { c as createThreadOpsProxy } from '../../../proxy-wsNrEh2u.cjs';
5
+ export { T as ThreadOpsProxyOptions } from '../../../proxy-wsNrEh2u.cjs';
6
6
  export { A as ADAPTER_ID, a as AdapterId } from '../../../adapter-id-CbY2zeSt.cjs';
7
7
  import '@temporalio/common/lib/interfaces';
8
8
  import 'zod';
@@ -10,7 +10,7 @@ import '../../../types-D8W5TnSa.cjs';
10
10
  import '@temporalio/common';
11
11
  import 'redis';
12
12
  import '@langchain/core/messages';
13
- import '../../../types-N_LTWe4b.cjs';
13
+ import '../../../types-tJ9Or7u_.cjs';
14
14
 
15
15
  /**
16
16
  * Workflow-safe proxy for LangChain thread operations.
@@ -1,8 +1,8 @@
1
1
  import { ActivityInterfaceFor } from '@temporalio/workflow';
2
- import { T as ThreadOps } from '../../../types-DiI7mZhI.js';
3
- import { L as LangChainContent } from '../../../thread-manager-CcvltOuq.js';
4
- import { c as createThreadOpsProxy } from '../../../proxy-CmiTP4pp.js';
5
- export { T as ThreadOpsProxyOptions } from '../../../proxy-CmiTP4pp.js';
2
+ import { T as ThreadOps } from '../../../types-DQQKF5FQ.js';
3
+ import { L as LangChainContent } from '../../../thread-manager-D1zfZnxi.js';
4
+ import { c as createThreadOpsProxy } from '../../../proxy-CwniAm8W.js';
5
+ export { T as ThreadOpsProxyOptions } from '../../../proxy-CwniAm8W.js';
6
6
  export { A as ADAPTER_ID, a as AdapterId } from '../../../adapter-id-CbY2zeSt.js';
7
7
  import '@temporalio/common/lib/interfaces';
8
8
  import 'zod';
@@ -10,7 +10,7 @@ import '../../../types-D8W5TnSa.js';
10
10
  import '@temporalio/common';
11
11
  import 'redis';
12
12
  import '@langchain/core/messages';
13
- import '../../../types-DEbkLA06.js';
13
+ import '../../../types-ziu6HZPh.js';
14
14
 
15
15
  /**
16
16
  * Workflow-safe proxy for LangChain thread operations.
@@ -1,4 +1,4 @@
1
- import { P as PersistedThreadState } from './types-DiI7mZhI.js';
1
+ import { P as PersistedThreadState } from './types-DQQKF5FQ.js';
2
2
  import { S3Client } from '@aws-sdk/client-s3';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { P as PersistedThreadState } from './types-BjdqxKYp.cjs';
1
+ import { P as PersistedThreadState } from './types-DpHBKA8c.cjs';
2
2
  import { S3Client } from '@aws-sdk/client-s3';
3
3
 
4
4
  /**
package/dist/index.cjs CHANGED
@@ -15711,13 +15711,14 @@ async function createSession(config2) {
15711
15711
  plugins,
15712
15712
  parallel: processToolsInParallel
15713
15713
  });
15714
- const callSessionEnd = async (exitReason, turns) => {
15714
+ const callSessionEnd = async (exitReason, turns, usage) => {
15715
15715
  if (hooks.onSessionEnd) {
15716
15716
  await hooks.onSessionEnd({
15717
15717
  threadId,
15718
15718
  agentName,
15719
15719
  exitReason,
15720
15720
  turns,
15721
+ usage,
15721
15722
  metadata
15722
15723
  });
15723
15724
  }
@@ -15939,6 +15940,15 @@ async function createSession(config2) {
15939
15940
  ...usage && { usage }
15940
15941
  });
15941
15942
  if (!toolRouter.hasTools() || rawToolCalls.length === 0) {
15943
+ if (hooks.onTurnComplete) {
15944
+ await hooks.onTurnComplete({
15945
+ threadId,
15946
+ agentName,
15947
+ turn: currentTurn,
15948
+ toolCallCount: rawToolCalls.length,
15949
+ ...usage && { usage }
15950
+ });
15951
+ }
15942
15952
  stateManager.complete();
15943
15953
  exitReason = "completed";
15944
15954
  finalMessage = message;
@@ -15997,6 +16007,15 @@ async function createSession(config2) {
15997
16007
  continue;
15998
16008
  }
15999
16009
  assistantId = void 0;
16010
+ if (hooks.onTurnComplete) {
16011
+ await hooks.onTurnComplete({
16012
+ threadId,
16013
+ agentName,
16014
+ turn: currentTurn,
16015
+ toolCallCount: rawToolCalls.length,
16016
+ ...usage && { usage }
16017
+ });
16018
+ }
16000
16019
  }
16001
16020
  if (stateManager.getTurns() >= maxTurns && stateManager.isRunning()) {
16002
16021
  exitReason = "max_turns";
@@ -16042,7 +16061,14 @@ async function createSession(config2) {
16042
16061
  error: flushError instanceof Error ? flushError.message : String(flushError)
16043
16062
  });
16044
16063
  }
16045
- await callSessionEnd(exitReason, stateManager.getTurns());
16064
+ const totals = stateManager.getTotalUsage();
16065
+ await callSessionEnd(exitReason, totals.turns, {
16066
+ inputTokens: totals.totalInputTokens,
16067
+ outputTokens: totals.totalOutputTokens,
16068
+ cachedWriteTokens: totals.totalCachedWriteTokens,
16069
+ cachedReadTokens: totals.totalCachedReadTokens,
16070
+ reasonTokens: totals.totalReasonTokens
16071
+ });
16046
16072
  if (sandboxOwned && sandboxId && sandboxOps) {
16047
16073
  switch (resolvedShutdown) {
16048
16074
  case "destroy":
@@ -16553,10 +16579,19 @@ function createObservabilityHooks(agentName) {
16553
16579
  threadId: ctx.threadId,
16554
16580
  exitReason: ctx.exitReason,
16555
16581
  turns: ctx.turns,
16556
- usage: {},
16582
+ usage: ctx.usage,
16557
16583
  durationMs: Date.now() - sessionStartMs
16558
16584
  });
16559
16585
  },
16586
+ onTurnComplete: (ctx) => {
16587
+ zeitlichMetrics.turnCompleted({
16588
+ agentName,
16589
+ threadId: ctx.threadId,
16590
+ turn: ctx.turn,
16591
+ toolCallCount: ctx.toolCallCount,
16592
+ ...ctx.usage && { usage: ctx.usage }
16593
+ });
16594
+ },
16560
16595
  onPostToolUse: (ctx) => {
16561
16596
  zeitlichMetrics.toolExecuted({
16562
16597
  agentName,