zeitlich 0.2.33 → 0.2.34
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/README.md +17 -6
- package/dist/{activities-fnX8-vhR.d.cts → activities-JOqPfKP0.d.cts} +2 -2
- package/dist/{activities-YBD5BaHh.d.ts → activities-WwMsjRwm.d.ts} +2 -2
- package/dist/adapters/sandbox/bedrock/index.cjs +2 -0
- package/dist/adapters/sandbox/bedrock/index.cjs.map +1 -1
- package/dist/adapters/sandbox/bedrock/index.d.cts +4 -3
- package/dist/adapters/sandbox/bedrock/index.d.ts +4 -3
- package/dist/adapters/sandbox/bedrock/index.js +2 -0
- package/dist/adapters/sandbox/bedrock/index.js.map +1 -1
- package/dist/adapters/sandbox/bedrock/workflow.cjs +1 -0
- package/dist/adapters/sandbox/bedrock/workflow.cjs.map +1 -1
- package/dist/adapters/sandbox/bedrock/workflow.d.cts +2 -2
- package/dist/adapters/sandbox/bedrock/workflow.d.ts +2 -2
- package/dist/adapters/sandbox/bedrock/workflow.js +1 -0
- package/dist/adapters/sandbox/bedrock/workflow.js.map +1 -1
- package/dist/adapters/sandbox/daytona/index.cjs +2 -0
- package/dist/adapters/sandbox/daytona/index.cjs.map +1 -1
- package/dist/adapters/sandbox/daytona/index.d.cts +2 -1
- package/dist/adapters/sandbox/daytona/index.d.ts +2 -1
- package/dist/adapters/sandbox/daytona/index.js +2 -0
- package/dist/adapters/sandbox/daytona/index.js.map +1 -1
- package/dist/adapters/sandbox/daytona/workflow.cjs +1 -0
- package/dist/adapters/sandbox/daytona/workflow.cjs.map +1 -1
- package/dist/adapters/sandbox/daytona/workflow.d.cts +1 -1
- package/dist/adapters/sandbox/daytona/workflow.d.ts +1 -1
- package/dist/adapters/sandbox/daytona/workflow.js +1 -0
- package/dist/adapters/sandbox/daytona/workflow.js.map +1 -1
- package/dist/adapters/sandbox/e2b/index.cjs +3 -0
- package/dist/adapters/sandbox/e2b/index.cjs.map +1 -1
- package/dist/adapters/sandbox/e2b/index.d.cts +2 -1
- package/dist/adapters/sandbox/e2b/index.d.ts +2 -1
- package/dist/adapters/sandbox/e2b/index.js +3 -0
- package/dist/adapters/sandbox/e2b/index.js.map +1 -1
- package/dist/adapters/sandbox/e2b/workflow.cjs +1 -0
- package/dist/adapters/sandbox/e2b/workflow.cjs.map +1 -1
- package/dist/adapters/sandbox/e2b/workflow.d.cts +1 -1
- package/dist/adapters/sandbox/e2b/workflow.d.ts +1 -1
- package/dist/adapters/sandbox/e2b/workflow.js +1 -0
- package/dist/adapters/sandbox/e2b/workflow.js.map +1 -1
- package/dist/adapters/sandbox/inmemory/index.cjs +2 -0
- package/dist/adapters/sandbox/inmemory/index.cjs.map +1 -1
- package/dist/adapters/sandbox/inmemory/index.d.cts +2 -1
- package/dist/adapters/sandbox/inmemory/index.d.ts +2 -1
- package/dist/adapters/sandbox/inmemory/index.js +2 -0
- package/dist/adapters/sandbox/inmemory/index.js.map +1 -1
- package/dist/adapters/sandbox/inmemory/workflow.cjs +1 -0
- package/dist/adapters/sandbox/inmemory/workflow.cjs.map +1 -1
- package/dist/adapters/sandbox/inmemory/workflow.d.cts +1 -1
- package/dist/adapters/sandbox/inmemory/workflow.d.ts +1 -1
- package/dist/adapters/sandbox/inmemory/workflow.js +1 -0
- package/dist/adapters/sandbox/inmemory/workflow.js.map +1 -1
- package/dist/adapters/thread/anthropic/index.d.cts +5 -5
- package/dist/adapters/thread/anthropic/index.d.ts +5 -5
- package/dist/adapters/thread/anthropic/workflow.d.cts +5 -5
- package/dist/adapters/thread/anthropic/workflow.d.ts +5 -5
- package/dist/adapters/thread/google-genai/index.d.cts +5 -5
- package/dist/adapters/thread/google-genai/index.d.ts +5 -5
- package/dist/adapters/thread/google-genai/workflow.d.cts +5 -5
- package/dist/adapters/thread/google-genai/workflow.d.ts +5 -5
- package/dist/adapters/thread/langchain/index.d.cts +5 -5
- package/dist/adapters/thread/langchain/index.d.ts +5 -5
- package/dist/adapters/thread/langchain/workflow.d.cts +5 -5
- package/dist/adapters/thread/langchain/workflow.d.ts +5 -5
- package/dist/index.cjs +114 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -9
- package/dist/index.d.ts +10 -9
- package/dist/index.js +114 -30
- package/dist/index.js.map +1 -1
- package/dist/{proxy-CTCYWjkr.d.cts → proxy-BesT2ioL.d.cts} +1 -1
- package/dist/{proxy-Br4unLTC.d.ts → proxy-Bz6wXYW-.d.ts} +1 -1
- package/dist/{thread-manager-Cv_BR28i.d.cts → thread-manager-CCVAOK8g.d.cts} +1 -1
- package/dist/{thread-manager-CUubPYPH.d.cts → thread-manager-Cf_34H8w.d.cts} +1 -1
- package/dist/{thread-manager-YJLoc1vH.d.ts → thread-manager-ClKAQx78.d.ts} +1 -1
- package/dist/{thread-manager-DKWxHUzD.d.ts → thread-manager-DarJIK_b.d.ts} +1 -1
- package/dist/{types-Bpq5fDI5.d.cts → types-BGLW5Zyj.d.ts} +35 -20
- package/dist/{types-BxiT8w9d.d.ts → types-BVUmLYpj.d.ts} +1 -1
- package/dist/{types-DUvEZSDe.d.cts → types-CBH54cwr.d.cts} +1 -1
- package/dist/{types-NJDyMyUx.d.cts → types-DPAZ3KCs.d.cts} +1 -1
- package/dist/{types-CheCTLeV.d.ts → types-DlLajQcu.d.cts} +35 -20
- package/dist/{types-AujBIMMn.d.cts → types-DxCpFNv_.d.cts} +4 -0
- package/dist/{types-AujBIMMn.d.ts → types-DxCpFNv_.d.ts} +4 -0
- package/dist/{types-DBk-C8zM.d.ts → types-wiGLvxWf.d.ts} +1 -1
- package/dist/{workflow-D9nNERvs.d.ts → workflow-_ZGcacCK.d.ts} +3 -3
- package/dist/{workflow-Od9vx5Jk.d.cts → workflow-hocXpLwg.d.cts} +3 -3
- package/dist/workflow.cjs +108 -30
- package/dist/workflow.cjs.map +1 -1
- package/dist/workflow.d.cts +3 -3
- package/dist/workflow.d.ts +3 -3
- package/dist/workflow.js +108 -30
- package/dist/workflow.js.map +1 -1
- package/package.json +1 -1
- package/src/adapters/sandbox/bedrock/index.ts +4 -0
- package/src/adapters/sandbox/bedrock/proxy.ts +1 -0
- package/src/adapters/sandbox/daytona/index.ts +4 -0
- package/src/adapters/sandbox/daytona/proxy.ts +1 -0
- package/src/adapters/sandbox/e2b/index.ts +4 -0
- package/src/adapters/sandbox/e2b/proxy.ts +1 -0
- package/src/adapters/sandbox/inmemory/index.ts +4 -0
- package/src/adapters/sandbox/inmemory/proxy.ts +1 -0
- package/src/lib/lifecycle.ts +7 -3
- package/src/lib/sandbox/manager.ts +7 -0
- package/src/lib/sandbox/types.ts +4 -0
- package/src/lib/session/session-edge-cases.integration.test.ts +194 -0
- package/src/lib/session/session.integration.test.ts +5 -0
- package/src/lib/session/session.ts +9 -0
- package/src/lib/session/types.ts +5 -0
- package/src/lib/subagent/define.ts +1 -1
- package/src/lib/subagent/handler.ts +142 -32
- package/src/lib/subagent/index.ts +5 -1
- package/src/lib/subagent/signals.ts +8 -1
- package/src/lib/subagent/subagent.integration.test.ts +532 -25
- package/src/lib/subagent/types.ts +32 -15
- package/src/lib/subagent/workflow.ts +26 -13
- package/src/lib/virtual-fs/manager.ts +1 -1
- package/src/lib/virtual-fs/types.ts +2 -2
- package/src/lib/virtual-fs/virtual-fs.test.ts +2 -2
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { ActivityInterfaceFor } from '@temporalio/workflow';
|
|
2
|
-
import { T as ThreadOps } from '../../../types-
|
|
3
|
-
import { A as AnthropicContent } from '../../../thread-manager-
|
|
4
|
-
import { c as createThreadOpsProxy } from '../../../proxy-
|
|
2
|
+
import { T as ThreadOps } from '../../../types-DlLajQcu.cjs';
|
|
3
|
+
import { A as AnthropicContent } from '../../../thread-manager-Cf_34H8w.cjs';
|
|
4
|
+
import { c as createThreadOpsProxy } from '../../../proxy-BesT2ioL.cjs';
|
|
5
5
|
import '@temporalio/common';
|
|
6
6
|
import '@temporalio/common/lib/interfaces';
|
|
7
7
|
import 'zod';
|
|
8
|
-
import '../../../types-
|
|
8
|
+
import '../../../types-DxCpFNv_.cjs';
|
|
9
9
|
import 'ioredis';
|
|
10
10
|
import '@anthropic-ai/sdk';
|
|
11
|
-
import '../../../types-
|
|
11
|
+
import '../../../types-DPAZ3KCs.cjs';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Workflow-safe proxy for Anthropic thread operations.
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { ActivityInterfaceFor } from '@temporalio/workflow';
|
|
2
|
-
import { T as ThreadOps } from '../../../types-
|
|
3
|
-
import { A as AnthropicContent } from '../../../thread-manager-
|
|
4
|
-
import { c as createThreadOpsProxy } from '../../../proxy-
|
|
2
|
+
import { T as ThreadOps } from '../../../types-BGLW5Zyj.js';
|
|
3
|
+
import { A as AnthropicContent } from '../../../thread-manager-ClKAQx78.js';
|
|
4
|
+
import { c as createThreadOpsProxy } from '../../../proxy-Bz6wXYW-.js';
|
|
5
5
|
import '@temporalio/common';
|
|
6
6
|
import '@temporalio/common/lib/interfaces';
|
|
7
7
|
import 'zod';
|
|
8
|
-
import '../../../types-
|
|
8
|
+
import '../../../types-DxCpFNv_.js';
|
|
9
9
|
import 'ioredis';
|
|
10
10
|
import '@anthropic-ai/sdk';
|
|
11
|
-
import '../../../types-
|
|
11
|
+
import '../../../types-BVUmLYpj.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Workflow-safe proxy for Anthropic thread operations.
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { G as GoogleGenAIThreadManagerHooks } from '../../../activities-
|
|
2
|
-
export { a as GoogleGenAIAdapter, b as GoogleGenAIAdapterConfig, c as GoogleGenAIContent, d as GoogleGenAIInvocationPayload, e as GoogleGenAIThreadManager, f as GoogleGenAIThreadManagerConfig, g as GoogleGenAIThreadOps, h as GoogleGenAIToolResponse, S as StoredContent, i as createGoogleGenAIAdapter, j as createGoogleGenAIThreadManager } from '../../../activities-
|
|
1
|
+
import { G as GoogleGenAIThreadManagerHooks } from '../../../activities-JOqPfKP0.cjs';
|
|
2
|
+
export { a as GoogleGenAIAdapter, b as GoogleGenAIAdapterConfig, c as GoogleGenAIContent, d as GoogleGenAIInvocationPayload, e as GoogleGenAIThreadManager, f as GoogleGenAIThreadManagerConfig, g as GoogleGenAIThreadOps, h as GoogleGenAIToolResponse, S as StoredContent, i as createGoogleGenAIAdapter, j as createGoogleGenAIThreadManager } from '../../../activities-JOqPfKP0.cjs';
|
|
3
3
|
import Redis from 'ioredis';
|
|
4
4
|
import { GoogleGenAI, Content } from '@google/genai';
|
|
5
|
-
import { M as ModelInvokerConfig, A as AgentResponse } from '../../../types-
|
|
6
|
-
import '../../../types-
|
|
5
|
+
import { M as ModelInvokerConfig, A as AgentResponse } from '../../../types-DlLajQcu.cjs';
|
|
6
|
+
import '../../../types-DPAZ3KCs.cjs';
|
|
7
7
|
import '@temporalio/common';
|
|
8
8
|
import '@temporalio/workflow';
|
|
9
9
|
import '@temporalio/common/lib/interfaces';
|
|
10
10
|
import 'zod';
|
|
11
|
-
import '../../../types-
|
|
11
|
+
import '../../../types-DxCpFNv_.cjs';
|
|
12
12
|
|
|
13
13
|
interface GoogleGenAIModelInvokerConfig {
|
|
14
14
|
redis: Redis;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { G as GoogleGenAIThreadManagerHooks } from '../../../activities-
|
|
2
|
-
export { a as GoogleGenAIAdapter, b as GoogleGenAIAdapterConfig, c as GoogleGenAIContent, d as GoogleGenAIInvocationPayload, e as GoogleGenAIThreadManager, f as GoogleGenAIThreadManagerConfig, g as GoogleGenAIThreadOps, h as GoogleGenAIToolResponse, S as StoredContent, i as createGoogleGenAIAdapter, j as createGoogleGenAIThreadManager } from '../../../activities-
|
|
1
|
+
import { G as GoogleGenAIThreadManagerHooks } from '../../../activities-WwMsjRwm.js';
|
|
2
|
+
export { a as GoogleGenAIAdapter, b as GoogleGenAIAdapterConfig, c as GoogleGenAIContent, d as GoogleGenAIInvocationPayload, e as GoogleGenAIThreadManager, f as GoogleGenAIThreadManagerConfig, g as GoogleGenAIThreadOps, h as GoogleGenAIToolResponse, S as StoredContent, i as createGoogleGenAIAdapter, j as createGoogleGenAIThreadManager } from '../../../activities-WwMsjRwm.js';
|
|
3
3
|
import Redis from 'ioredis';
|
|
4
4
|
import { GoogleGenAI, Content } from '@google/genai';
|
|
5
|
-
import { M as ModelInvokerConfig, A as AgentResponse } from '../../../types-
|
|
6
|
-
import '../../../types-
|
|
5
|
+
import { M as ModelInvokerConfig, A as AgentResponse } from '../../../types-BGLW5Zyj.js';
|
|
6
|
+
import '../../../types-BVUmLYpj.js';
|
|
7
7
|
import '@temporalio/common';
|
|
8
8
|
import '@temporalio/workflow';
|
|
9
9
|
import '@temporalio/common/lib/interfaces';
|
|
10
10
|
import 'zod';
|
|
11
|
-
import '../../../types-
|
|
11
|
+
import '../../../types-DxCpFNv_.js';
|
|
12
12
|
|
|
13
13
|
interface GoogleGenAIModelInvokerConfig {
|
|
14
14
|
redis: Redis;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { ActivityInterfaceFor } from '@temporalio/workflow';
|
|
2
|
-
import { T as ThreadOps } from '../../../types-
|
|
3
|
-
import { c as GoogleGenAIContent } from '../../../activities-
|
|
4
|
-
import { c as createThreadOpsProxy } from '../../../proxy-
|
|
2
|
+
import { T as ThreadOps } from '../../../types-DlLajQcu.cjs';
|
|
3
|
+
import { c as GoogleGenAIContent } from '../../../activities-JOqPfKP0.cjs';
|
|
4
|
+
import { c as createThreadOpsProxy } from '../../../proxy-BesT2ioL.cjs';
|
|
5
5
|
import '@temporalio/common';
|
|
6
6
|
import '@temporalio/common/lib/interfaces';
|
|
7
7
|
import 'zod';
|
|
8
|
-
import '../../../types-
|
|
8
|
+
import '../../../types-DxCpFNv_.cjs';
|
|
9
9
|
import 'ioredis';
|
|
10
10
|
import '@google/genai';
|
|
11
|
-
import '../../../types-
|
|
11
|
+
import '../../../types-DPAZ3KCs.cjs';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Workflow-safe proxy for Google GenAI thread operations.
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { ActivityInterfaceFor } from '@temporalio/workflow';
|
|
2
|
-
import { T as ThreadOps } from '../../../types-
|
|
3
|
-
import { c as GoogleGenAIContent } from '../../../activities-
|
|
4
|
-
import { c as createThreadOpsProxy } from '../../../proxy-
|
|
2
|
+
import { T as ThreadOps } from '../../../types-BGLW5Zyj.js';
|
|
3
|
+
import { c as GoogleGenAIContent } from '../../../activities-WwMsjRwm.js';
|
|
4
|
+
import { c as createThreadOpsProxy } from '../../../proxy-Bz6wXYW-.js';
|
|
5
5
|
import '@temporalio/common';
|
|
6
6
|
import '@temporalio/common/lib/interfaces';
|
|
7
7
|
import 'zod';
|
|
8
|
-
import '../../../types-
|
|
8
|
+
import '../../../types-DxCpFNv_.js';
|
|
9
9
|
import 'ioredis';
|
|
10
10
|
import '@google/genai';
|
|
11
|
-
import '../../../types-
|
|
11
|
+
import '../../../types-BVUmLYpj.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Workflow-safe proxy for Google GenAI thread operations.
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import Redis from 'ioredis';
|
|
2
2
|
import { StoredMessage, MessageContent, BaseMessage } from '@langchain/core/messages';
|
|
3
|
-
import { a as ModelInvoker, P as PrefixedThreadOps, S as ScopedPrefix, R as RouterContext, b as ToolHandlerResponse, c as ActivityToolHandler, M as ModelInvokerConfig, A as AgentResponse } from '../../../types-
|
|
3
|
+
import { a as ModelInvoker, P as PrefixedThreadOps, S as ScopedPrefix, R as RouterContext, b as ToolHandlerResponse, c as ActivityToolHandler, M as ModelInvokerConfig, A as AgentResponse } from '../../../types-DlLajQcu.cjs';
|
|
4
4
|
import { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
5
|
-
import { L as LangChainContent, a as LangChainThreadManagerHooks } from '../../../thread-manager-
|
|
6
|
-
export { b as LangChainInvocationPayload, c as LangChainThreadManager, d as LangChainThreadManagerConfig, e as createLangChainThreadManager } from '../../../thread-manager-
|
|
5
|
+
import { L as LangChainContent, a as LangChainThreadManagerHooks } from '../../../thread-manager-CCVAOK8g.cjs';
|
|
6
|
+
export { b as LangChainInvocationPayload, c as LangChainThreadManager, d as LangChainThreadManagerConfig, e as createLangChainThreadManager } from '../../../thread-manager-CCVAOK8g.cjs';
|
|
7
7
|
import '@temporalio/common';
|
|
8
8
|
import '@temporalio/workflow';
|
|
9
9
|
import '@temporalio/common/lib/interfaces';
|
|
10
10
|
import 'zod';
|
|
11
|
-
import '../../../types-
|
|
12
|
-
import '../../../types-
|
|
11
|
+
import '../../../types-DxCpFNv_.cjs';
|
|
12
|
+
import '../../../types-DPAZ3KCs.cjs';
|
|
13
13
|
|
|
14
14
|
declare const ADAPTER_PREFIX: "langChain";
|
|
15
15
|
type LangChainThreadOps<TScope extends string = ""> = PrefixedThreadOps<ScopedPrefix<TScope, typeof ADAPTER_PREFIX>, LangChainContent>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import Redis from 'ioredis';
|
|
2
2
|
import { StoredMessage, MessageContent, BaseMessage } from '@langchain/core/messages';
|
|
3
|
-
import { a as ModelInvoker, P as PrefixedThreadOps, S as ScopedPrefix, R as RouterContext, b as ToolHandlerResponse, c as ActivityToolHandler, M as ModelInvokerConfig, A as AgentResponse } from '../../../types-
|
|
3
|
+
import { a as ModelInvoker, P as PrefixedThreadOps, S as ScopedPrefix, R as RouterContext, b as ToolHandlerResponse, c as ActivityToolHandler, M as ModelInvokerConfig, A as AgentResponse } from '../../../types-BGLW5Zyj.js';
|
|
4
4
|
import { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
5
|
-
import { L as LangChainContent, a as LangChainThreadManagerHooks } from '../../../thread-manager-
|
|
6
|
-
export { b as LangChainInvocationPayload, c as LangChainThreadManager, d as LangChainThreadManagerConfig, e as createLangChainThreadManager } from '../../../thread-manager-
|
|
5
|
+
import { L as LangChainContent, a as LangChainThreadManagerHooks } from '../../../thread-manager-DarJIK_b.js';
|
|
6
|
+
export { b as LangChainInvocationPayload, c as LangChainThreadManager, d as LangChainThreadManagerConfig, e as createLangChainThreadManager } from '../../../thread-manager-DarJIK_b.js';
|
|
7
7
|
import '@temporalio/common';
|
|
8
8
|
import '@temporalio/workflow';
|
|
9
9
|
import '@temporalio/common/lib/interfaces';
|
|
10
10
|
import 'zod';
|
|
11
|
-
import '../../../types-
|
|
12
|
-
import '../../../types-
|
|
11
|
+
import '../../../types-DxCpFNv_.js';
|
|
12
|
+
import '../../../types-BVUmLYpj.js';
|
|
13
13
|
|
|
14
14
|
declare const ADAPTER_PREFIX: "langChain";
|
|
15
15
|
type LangChainThreadOps<TScope extends string = ""> = PrefixedThreadOps<ScopedPrefix<TScope, typeof ADAPTER_PREFIX>, LangChainContent>;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { ActivityInterfaceFor } from '@temporalio/workflow';
|
|
2
|
-
import { T as ThreadOps } from '../../../types-
|
|
3
|
-
import { L as LangChainContent } from '../../../thread-manager-
|
|
4
|
-
import { c as createThreadOpsProxy } from '../../../proxy-
|
|
2
|
+
import { T as ThreadOps } from '../../../types-DlLajQcu.cjs';
|
|
3
|
+
import { L as LangChainContent } from '../../../thread-manager-CCVAOK8g.cjs';
|
|
4
|
+
import { c as createThreadOpsProxy } from '../../../proxy-BesT2ioL.cjs';
|
|
5
5
|
import '@temporalio/common';
|
|
6
6
|
import '@temporalio/common/lib/interfaces';
|
|
7
7
|
import 'zod';
|
|
8
|
-
import '../../../types-
|
|
8
|
+
import '../../../types-DxCpFNv_.cjs';
|
|
9
9
|
import 'ioredis';
|
|
10
10
|
import '@langchain/core/messages';
|
|
11
|
-
import '../../../types-
|
|
11
|
+
import '../../../types-DPAZ3KCs.cjs';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Workflow-safe proxy for LangChain thread operations.
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { ActivityInterfaceFor } from '@temporalio/workflow';
|
|
2
|
-
import { T as ThreadOps } from '../../../types-
|
|
3
|
-
import { L as LangChainContent } from '../../../thread-manager-
|
|
4
|
-
import { c as createThreadOpsProxy } from '../../../proxy-
|
|
2
|
+
import { T as ThreadOps } from '../../../types-BGLW5Zyj.js';
|
|
3
|
+
import { L as LangChainContent } from '../../../thread-manager-DarJIK_b.js';
|
|
4
|
+
import { c as createThreadOpsProxy } from '../../../proxy-Bz6wXYW-.js';
|
|
5
5
|
import '@temporalio/common';
|
|
6
6
|
import '@temporalio/common/lib/interfaces';
|
|
7
7
|
import 'zod';
|
|
8
|
-
import '../../../types-
|
|
8
|
+
import '../../../types-DxCpFNv_.js';
|
|
9
9
|
import 'ioredis';
|
|
10
10
|
import '@langchain/core/messages';
|
|
11
|
-
import '../../../types-
|
|
11
|
+
import '../../../types-BVUmLYpj.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Workflow-safe proxy for LangChain thread operations.
|
package/dist/index.cjs
CHANGED
|
@@ -396,23 +396,50 @@ function createSubagentTool(subagents) {
|
|
|
396
396
|
};
|
|
397
397
|
}
|
|
398
398
|
var childResultSignal = workflow.defineSignal("childResult");
|
|
399
|
+
var childSandboxReadySignal = workflow.defineSignal("childSandboxReady");
|
|
399
400
|
var destroySandboxSignal = workflow.defineSignal("destroySandbox");
|
|
400
401
|
|
|
401
402
|
// src/lib/subagent/handler.ts
|
|
402
403
|
function resolveSandboxConfig(config) {
|
|
403
|
-
if (!config || config === "none")
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
404
|
+
if (!config || config === "none") {
|
|
405
|
+
return { source: "none", init: "per-call", continuation: "fork" };
|
|
406
|
+
}
|
|
407
|
+
if (config.source === "inherit") {
|
|
408
|
+
return {
|
|
409
|
+
source: "inherit",
|
|
410
|
+
init: "per-call",
|
|
411
|
+
continuation: config.continuation,
|
|
412
|
+
shutdown: config.shutdown
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
return {
|
|
416
|
+
source: "own",
|
|
417
|
+
init: config.init ?? "per-call",
|
|
418
|
+
continuation: config.continuation,
|
|
419
|
+
shutdown: config.shutdown
|
|
420
|
+
};
|
|
407
421
|
}
|
|
408
422
|
function createSubagentHandler(subagents) {
|
|
409
423
|
const { taskQueue: parentTaskQueue } = workflow.workflowInfo();
|
|
410
424
|
const childResults = /* @__PURE__ */ new Map();
|
|
411
425
|
const pendingDestroys = /* @__PURE__ */ new Map();
|
|
412
426
|
const threadSandboxes = /* @__PURE__ */ new Map();
|
|
427
|
+
const persistentSandboxes = /* @__PURE__ */ new Map();
|
|
428
|
+
const persistentSandboxCreating = /* @__PURE__ */ new Set();
|
|
429
|
+
const lazyCreatorAgent = /* @__PURE__ */ new Map();
|
|
413
430
|
workflow.setHandler(childResultSignal, ({ childWorkflowId, result }) => {
|
|
414
431
|
childResults.set(childWorkflowId, result);
|
|
415
432
|
});
|
|
433
|
+
workflow.setHandler(
|
|
434
|
+
childSandboxReadySignal,
|
|
435
|
+
({ childWorkflowId, sandboxId }) => {
|
|
436
|
+
const agentName = lazyCreatorAgent.get(childWorkflowId);
|
|
437
|
+
if (agentName && !persistentSandboxes.has(agentName)) {
|
|
438
|
+
persistentSandboxes.set(agentName, sandboxId);
|
|
439
|
+
lazyCreatorAgent.delete(childWorkflowId);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
);
|
|
416
443
|
const handler = async (args, context) => {
|
|
417
444
|
const config = subagents.find((s) => s.agentName === args.subagent);
|
|
418
445
|
if (!config) {
|
|
@@ -439,21 +466,48 @@ function createSubagentHandler(subagents) {
|
|
|
439
466
|
};
|
|
440
467
|
}
|
|
441
468
|
let sandbox;
|
|
469
|
+
let sandboxShutdownOverride;
|
|
470
|
+
let isLazyCreator = false;
|
|
442
471
|
if (sandboxCfg.source === "inherit" && parentSandboxId) {
|
|
443
|
-
|
|
444
|
-
mode: "
|
|
445
|
-
|
|
446
|
-
|
|
472
|
+
if (sandboxCfg.continuation === "fork") {
|
|
473
|
+
sandbox = { mode: "fork", sandboxId: parentSandboxId };
|
|
474
|
+
} else {
|
|
475
|
+
sandbox = { mode: "inherit", sandboxId: parentSandboxId };
|
|
476
|
+
}
|
|
447
477
|
} else if (sandboxCfg.source === "own") {
|
|
448
|
-
const
|
|
449
|
-
|
|
450
|
-
|
|
478
|
+
const isLazy = sandboxCfg.init === "once";
|
|
479
|
+
let baseSandboxId;
|
|
480
|
+
if (isLazy) {
|
|
481
|
+
baseSandboxId = persistentSandboxes.get(config.agentName);
|
|
482
|
+
if (!baseSandboxId) {
|
|
483
|
+
if (persistentSandboxCreating.has(config.agentName)) {
|
|
484
|
+
await workflow.condition(() => persistentSandboxes.has(config.agentName));
|
|
485
|
+
baseSandboxId = persistentSandboxes.get(config.agentName);
|
|
486
|
+
} else {
|
|
487
|
+
persistentSandboxCreating.add(config.agentName);
|
|
488
|
+
isLazyCreator = true;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
} else if (continuationThreadId) {
|
|
492
|
+
baseSandboxId = threadSandboxes.get(continuationThreadId);
|
|
493
|
+
}
|
|
494
|
+
if (baseSandboxId) {
|
|
495
|
+
sandbox = {
|
|
496
|
+
mode: sandboxCfg.continuation === "continue" ? "continue" : "fork",
|
|
497
|
+
sandboxId: baseSandboxId
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
const userShutdown = sandboxCfg.shutdown;
|
|
501
|
+
const alreadySurvives = userShutdown === "pause-until-parent-close" || userShutdown === "keep-until-parent-close" || userShutdown === "pause" || userShutdown === "keep";
|
|
502
|
+
const mustSurvive = isLazyCreator || sandboxCfg.continuation === "continue" || isLazy && sandboxCfg.continuation === "fork";
|
|
503
|
+
if (mustSurvive && !alreadySurvives) {
|
|
504
|
+
sandboxShutdownOverride = isLazyCreator ? "pause-until-parent-close" : "pause";
|
|
451
505
|
}
|
|
452
506
|
}
|
|
453
507
|
const workflowInput = {
|
|
454
508
|
...thread && { thread },
|
|
455
509
|
...sandbox && { sandbox },
|
|
456
|
-
|
|
510
|
+
sandboxShutdown: sandboxShutdownOverride ?? sandboxCfg.shutdown ?? void 0
|
|
457
511
|
};
|
|
458
512
|
const resolvedContext = config.context === void 0 ? void 0 : typeof config.context === "function" ? config.context() : config.context;
|
|
459
513
|
const childOpts = {
|
|
@@ -461,6 +515,9 @@ function createSubagentHandler(subagents) {
|
|
|
461
515
|
args: resolvedContext === void 0 ? [args.prompt, workflowInput] : [args.prompt, workflowInput, resolvedContext],
|
|
462
516
|
taskQueue: config.taskQueue ?? parentTaskQueue
|
|
463
517
|
};
|
|
518
|
+
if (isLazyCreator) {
|
|
519
|
+
lazyCreatorAgent.set(childWorkflowId, config.agentName);
|
|
520
|
+
}
|
|
464
521
|
workflow.log.info("subagent spawned", {
|
|
465
522
|
subagent: config.agentName,
|
|
466
523
|
childWorkflowId,
|
|
@@ -468,10 +525,10 @@ function createSubagentHandler(subagents) {
|
|
|
468
525
|
sandboxSource: sandboxCfg.source
|
|
469
526
|
});
|
|
470
527
|
const childHandle = await workflow.startChild(config.workflow, childOpts);
|
|
471
|
-
const effectiveShutdown = sandboxCfg.shutdown ?? "destroy";
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
pendingDestroys.set(
|
|
528
|
+
const effectiveShutdown = sandboxShutdownOverride ?? sandboxCfg.shutdown ?? "destroy";
|
|
529
|
+
if (effectiveShutdown === "pause-until-parent-close" || effectiveShutdown === "keep-until-parent-close") {
|
|
530
|
+
const key = isLazyCreator ? `persistent:${config.agentName}` : childWorkflowId;
|
|
531
|
+
pendingDestroys.set(key, childHandle);
|
|
475
532
|
}
|
|
476
533
|
await Promise.race([
|
|
477
534
|
workflow.condition(() => childResults.has(childWorkflowId)),
|
|
@@ -505,8 +562,16 @@ function createSubagentHandler(subagents) {
|
|
|
505
562
|
sandboxId: childSandboxId,
|
|
506
563
|
metadata
|
|
507
564
|
} = childResult;
|
|
508
|
-
if (
|
|
509
|
-
|
|
565
|
+
if (childSandboxId) {
|
|
566
|
+
if (sandboxCfg.source === "own" && sandboxCfg.init === "once" && !persistentSandboxes.has(config.agentName)) {
|
|
567
|
+
persistentSandboxes.set(config.agentName, childSandboxId);
|
|
568
|
+
} else if (allowsContinuation && childThreadId) {
|
|
569
|
+
threadSandboxes.set(childThreadId, childSandboxId);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
if (isLazyCreator) {
|
|
573
|
+
persistentSandboxCreating.delete(config.agentName);
|
|
574
|
+
lazyCreatorAgent.delete(childWorkflowId);
|
|
510
575
|
}
|
|
511
576
|
if (!toolResponse) {
|
|
512
577
|
return {
|
|
@@ -712,6 +777,7 @@ async function createSession({
|
|
|
712
777
|
thread: threadInit,
|
|
713
778
|
sandbox: sandboxInit,
|
|
714
779
|
sandboxShutdown = "destroy",
|
|
780
|
+
onSandboxReady,
|
|
715
781
|
virtualFs: virtualFsConfig,
|
|
716
782
|
virtualFsOps
|
|
717
783
|
}) {
|
|
@@ -814,6 +880,9 @@ async function createSession({
|
|
|
814
880
|
});
|
|
815
881
|
}
|
|
816
882
|
sandboxId = sandboxInit.sandboxId;
|
|
883
|
+
if (sandboxShutdown === "pause-until-parent-close") {
|
|
884
|
+
await sandboxOps.resumeSandbox(sandboxId);
|
|
885
|
+
}
|
|
817
886
|
sandboxOwned = true;
|
|
818
887
|
} else if (sandboxMode === "fork") {
|
|
819
888
|
if (!sandboxOps) {
|
|
@@ -836,6 +905,9 @@ async function createSession({
|
|
|
836
905
|
sandboxOwned = true;
|
|
837
906
|
}
|
|
838
907
|
}
|
|
908
|
+
if (sandboxId && onSandboxReady) {
|
|
909
|
+
onSandboxReady(sandboxId);
|
|
910
|
+
}
|
|
839
911
|
if (virtualFsConfig) {
|
|
840
912
|
if (!virtualFsOps) {
|
|
841
913
|
throw workflow.ApplicationFailure.create({
|
|
@@ -1305,39 +1377,45 @@ function defineSubagent(definition, overrides) {
|
|
|
1305
1377
|
function defineSubagentWorkflow(config, fn) {
|
|
1306
1378
|
const workflow$1 = async (prompt, workflowInput, context) => {
|
|
1307
1379
|
const effectiveShutdown = workflowInput.sandboxShutdown ?? config.sandboxShutdown ?? "destroy";
|
|
1380
|
+
const { parent } = workflow.workflowInfo();
|
|
1381
|
+
if (!parent) {
|
|
1382
|
+
throw workflow.ApplicationFailure.create({
|
|
1383
|
+
message: "Subagent workflow called without a parent workflow",
|
|
1384
|
+
nonRetryable: true
|
|
1385
|
+
});
|
|
1386
|
+
}
|
|
1387
|
+
const parentHandle = workflow.getExternalWorkflowHandle(parent.workflowId);
|
|
1308
1388
|
const sessionInput = {
|
|
1309
1389
|
agentName: config.name,
|
|
1310
1390
|
sandboxShutdown: effectiveShutdown,
|
|
1311
1391
|
...workflowInput.thread && { thread: workflowInput.thread },
|
|
1312
|
-
...workflowInput.sandbox && { sandbox: workflowInput.sandbox }
|
|
1392
|
+
...workflowInput.sandbox && { sandbox: workflowInput.sandbox },
|
|
1393
|
+
onSandboxReady: (sandboxId) => {
|
|
1394
|
+
void parentHandle.signal(childSandboxReadySignal, {
|
|
1395
|
+
childWorkflowId: workflow.workflowInfo().workflowId,
|
|
1396
|
+
sandboxId
|
|
1397
|
+
});
|
|
1398
|
+
}
|
|
1313
1399
|
};
|
|
1314
1400
|
const { destroySandbox, ...result } = await fn(
|
|
1315
1401
|
prompt,
|
|
1316
1402
|
sessionInput,
|
|
1317
1403
|
context ?? {}
|
|
1318
1404
|
);
|
|
1319
|
-
if (effectiveShutdown === "pause-until-parent-close") {
|
|
1405
|
+
if (effectiveShutdown === "pause-until-parent-close" || effectiveShutdown === "keep-until-parent-close") {
|
|
1320
1406
|
if (!destroySandbox) {
|
|
1321
1407
|
throw workflow.ApplicationFailure.create({
|
|
1322
|
-
message: `Subagent "${config.name}" has sandboxShutdown="
|
|
1408
|
+
message: `Subagent "${config.name}" has sandboxShutdown="${effectiveShutdown}" but fn did not return a destroySandbox callback`,
|
|
1323
1409
|
nonRetryable: true
|
|
1324
1410
|
});
|
|
1325
1411
|
}
|
|
1326
1412
|
if (!result.sandboxId) {
|
|
1327
1413
|
throw workflow.ApplicationFailure.create({
|
|
1328
|
-
message: `Subagent "${config.name}" has sandboxShutdown="
|
|
1414
|
+
message: `Subagent "${config.name}" has sandboxShutdown="${effectiveShutdown}" but fn did not return a sandboxId`,
|
|
1329
1415
|
nonRetryable: true
|
|
1330
1416
|
});
|
|
1331
1417
|
}
|
|
1332
1418
|
}
|
|
1333
|
-
const { parent } = workflow.workflowInfo();
|
|
1334
|
-
if (!parent) {
|
|
1335
|
-
throw workflow.ApplicationFailure.create({
|
|
1336
|
-
message: "Subagent workflow called without a parent workflow",
|
|
1337
|
-
nonRetryable: true
|
|
1338
|
-
});
|
|
1339
|
-
}
|
|
1340
|
-
const parentHandle = workflow.getExternalWorkflowHandle(parent.workflowId);
|
|
1341
1419
|
await parentHandle.signal(childResultSignal, {
|
|
1342
1420
|
childWorkflowId: workflow.workflowInfo().workflowId,
|
|
1343
1421
|
result
|
|
@@ -2268,6 +2346,9 @@ var SandboxManager = class {
|
|
|
2268
2346
|
async pause(id, ttlSeconds) {
|
|
2269
2347
|
await this.provider.pause(id, ttlSeconds);
|
|
2270
2348
|
}
|
|
2349
|
+
async resume(id) {
|
|
2350
|
+
await this.provider.resume(id);
|
|
2351
|
+
}
|
|
2271
2352
|
async snapshot(id) {
|
|
2272
2353
|
return this.provider.snapshot(id);
|
|
2273
2354
|
}
|
|
@@ -2311,6 +2392,9 @@ var SandboxManager = class {
|
|
|
2311
2392
|
pauseSandbox: async (sandboxId, ttlSeconds) => {
|
|
2312
2393
|
await this.pause(sandboxId, ttlSeconds);
|
|
2313
2394
|
},
|
|
2395
|
+
resumeSandbox: async (sandboxId) => {
|
|
2396
|
+
await this.resume(sandboxId);
|
|
2397
|
+
},
|
|
2314
2398
|
snapshotSandbox: async (sandboxId) => {
|
|
2315
2399
|
return this.snapshot(sandboxId);
|
|
2316
2400
|
},
|