zeitlich 0.2.32 → 0.2.33
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 +11 -10
- package/dist/{activities-FIXVz7DT.d.ts → activities-YBD5BaHh.d.ts} +4 -3
- package/dist/{activities-DA-bQM12.d.cts → activities-fnX8-vhR.d.cts} +4 -3
- package/dist/adapters/thread/anthropic/index.cjs +18 -2
- package/dist/adapters/thread/anthropic/index.cjs.map +1 -1
- package/dist/adapters/thread/anthropic/index.d.cts +7 -6
- package/dist/adapters/thread/anthropic/index.d.ts +7 -6
- package/dist/adapters/thread/anthropic/index.js +18 -2
- package/dist/adapters/thread/anthropic/index.js.map +1 -1
- package/dist/adapters/thread/google-genai/index.cjs +29 -8
- package/dist/adapters/thread/google-genai/index.cjs.map +1 -1
- 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/index.js +29 -8
- package/dist/adapters/thread/google-genai/index.js.map +1 -1
- package/dist/adapters/thread/google-genai/workflow.d.cts +1 -1
- package/dist/adapters/thread/google-genai/workflow.d.ts +1 -1
- package/dist/adapters/thread/langchain/index.cjs +42 -23
- package/dist/adapters/thread/langchain/index.cjs.map +1 -1
- package/dist/adapters/thread/langchain/index.d.cts +8 -6
- package/dist/adapters/thread/langchain/index.d.ts +8 -6
- package/dist/adapters/thread/langchain/index.js +42 -23
- package/dist/adapters/thread/langchain/index.js.map +1 -1
- package/dist/index.cjs +34 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -9
- package/dist/index.d.ts +24 -9
- package/dist/index.js +33 -5
- package/dist/index.js.map +1 -1
- package/dist/{workflow-D8wK7TJY.d.ts → workflow-D9nNERvs.d.ts} +30 -2
- package/dist/{workflow-BWKQcz9d.d.cts → workflow-Od9vx5Jk.d.cts} +30 -2
- package/dist/workflow.cjs +18 -0
- package/dist/workflow.cjs.map +1 -1
- package/dist/workflow.d.cts +1 -1
- package/dist/workflow.d.ts +1 -1
- package/dist/workflow.js +18 -1
- package/dist/workflow.js.map +1 -1
- package/package.json +1 -1
- package/src/adapters/thread/anthropic/activities.ts +4 -3
- package/src/adapters/thread/anthropic/model-invoker.ts +15 -5
- package/src/adapters/thread/google-genai/activities.ts +4 -3
- package/src/adapters/thread/google-genai/model-invoker.ts +24 -11
- package/src/adapters/thread/langchain/activities.ts +3 -3
- package/src/adapters/thread/langchain/model-invoker.ts +63 -34
- package/src/index.ts +1 -0
- package/src/lib/activity.ts +36 -9
- package/src/lib/model/helpers.ts +1 -0
- package/src/lib/model/index.ts +1 -0
- package/src/lib/model/proxy.ts +50 -0
- package/src/workflow.ts +3 -0
- package/src/lib/.env +0 -1
- package/src/tools/bash/.env +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ao as ToolMap, _ as SessionConfig, az as ZeitlichSession, Y as SandboxShutdown, ag as ThreadInit, X as SandboxInit, t as JsonSerializable, B as BaseAgentState, o as AgentStateManager, aB as ToolRouterOptions, ar as ToolRouter, R as RouterContext, J as JsonValue, at as ToolWithHandler, v as ParsedToolCallUnion, ap as ToolNames, a6 as SubagentDefinition, a9 as SubagentHooks, aa as SubagentSandboxConfig, a5 as SubagentConfig, ab as SubagentSandboxShutdown, ac as SubagentSessionInput, a7 as SubagentFnResult, a3 as SessionStartHook, $ as SessionEndHook, D as PostToolUseHook, y as PostToolUseFailureHook, a1 as SessionExitReason, ah as TokenUsage, F as FileEntryMetadata, av as VirtualFileTree, j as TreeMutation, r as FileEntry, aw as VirtualFsOps, g as SkillMetadata, h as Skill, b as ToolHandlerResponse, am as ToolHandler, ay as WorkflowTask, c as ActivityToolHandler } from './types-CheCTLeV.js';
|
|
1
|
+
import { ao as ToolMap, _ as SessionConfig, az as ZeitlichSession, Y as SandboxShutdown, ag as ThreadInit, X as SandboxInit, t as JsonSerializable, B as BaseAgentState, o as AgentStateManager, aB as ToolRouterOptions, ar as ToolRouter, R as RouterContext, J as JsonValue, at as ToolWithHandler, v as ParsedToolCallUnion, ap as ToolNames, a6 as SubagentDefinition, a9 as SubagentHooks, aa as SubagentSandboxConfig, a5 as SubagentConfig, ab as SubagentSandboxShutdown, ac as SubagentSessionInput, a7 as SubagentFnResult, a3 as SessionStartHook, $ as SessionEndHook, D as PostToolUseHook, y as PostToolUseFailureHook, a1 as SessionExitReason, ah as TokenUsage, e as RunAgentConfig, A as AgentResponse, F as FileEntryMetadata, av as VirtualFileTree, j as TreeMutation, r as FileEntry, aw as VirtualFsOps, g as SkillMetadata, h as Skill, b as ToolHandlerResponse, am as ToolHandler, ay as WorkflowTask, c as ActivityToolHandler } from './types-CheCTLeV.js';
|
|
2
2
|
import { g as SandboxOps } from './types-AujBIMMn.js';
|
|
3
3
|
import z$1, { z } from 'zod';
|
|
4
4
|
import { Sinks, proxyActivities } from '@temporalio/workflow';
|
|
@@ -405,6 +405,34 @@ interface ZeitlichObservabilitySinks extends Sinks {
|
|
|
405
405
|
};
|
|
406
406
|
}
|
|
407
407
|
|
|
408
|
+
/**
|
|
409
|
+
* Workflow-safe proxy for runAgent activities with LLM-optimised defaults.
|
|
410
|
+
*
|
|
411
|
+
* Resolves the activity name from the scope using the same convention as
|
|
412
|
+
* {@link createRunAgentActivity}: `run<Scope>`.
|
|
413
|
+
* When no scope is provided, defaults to `workflowInfo().workflowType`.
|
|
414
|
+
*
|
|
415
|
+
* Import this from `zeitlich/workflow` in your Temporal workflow files.
|
|
416
|
+
*
|
|
417
|
+
* @typeParam M - SDK-native message type (e.g. `StoredMessage` for LangChain,
|
|
418
|
+
* `Anthropic.Messages.Message` for Anthropic, `Content` for Google GenAI).
|
|
419
|
+
* Must be provided for `SessionResult.finalMessage` to be correctly typed.
|
|
420
|
+
*
|
|
421
|
+
* @example
|
|
422
|
+
* ```typescript
|
|
423
|
+
* import { proxyRunAgent } from 'zeitlich/workflow';
|
|
424
|
+
* import type { StoredMessage } from '@langchain/core/messages';
|
|
425
|
+
*
|
|
426
|
+
* // Auto-scoped to the current workflow name
|
|
427
|
+
* const runAgent = proxyRunAgent<StoredMessage>();
|
|
428
|
+
*
|
|
429
|
+
* // Explicit scope for subagents
|
|
430
|
+
* const runResearcher = proxyRunAgent<StoredMessage>("Researcher");
|
|
431
|
+
* ```
|
|
432
|
+
*/
|
|
433
|
+
|
|
434
|
+
declare function proxyRunAgent<M = unknown>(scope?: string, options?: Parameters<typeof proxyActivities>[0]): (config: RunAgentConfig) => Promise<AgentResponse<M>>;
|
|
435
|
+
|
|
408
436
|
/**
|
|
409
437
|
* Apply a list of {@link TreeMutation}s to the `fileTree` stored in a state
|
|
410
438
|
* manager instance, updating it in place and returning the new tree.
|
|
@@ -747,4 +775,4 @@ declare const createAskUserQuestionHandler: () => ActivityToolHandler<AskUserQue
|
|
|
747
775
|
}[];
|
|
748
776
|
}>;
|
|
749
777
|
|
|
750
|
-
export {
|
|
778
|
+
export { proxyRunAgent as $, type AskUserQuestionArgs as A, type BashArgs as B, createTaskListHandler as C, createTaskUpdateHandler as D, createToolRouter as E, type FileEditArgs as F, type GlobArgs as G, defineSubagent as H, defineSubagentWorkflow as I, defineTool as J, defineWorkflow as K, editTool as L, filesWithMimeType as M, formatVirtualFileTree as N, type ObservabilityHooks as O, getShortId as P, globTool as Q, type ReadSkillArgs as R, type SessionEndedEvent as S, type TaskCreateArgs as T, grepTool as U, hasDirectory as V, type WorkflowConfig as W, hasFileWithMimeType as X, hasNoOtherToolCalls as Y, type ZeitlichObservabilitySinks as Z, parseSkillFile as _, type FileReadArgs as a, proxyVirtualFsOps as a0, readFileTool as a1, taskCreateTool as a2, taskGetTool as a3, taskListTool as a4, taskUpdateTool as a5, writeFileTool as a6, type FileWriteArgs as b, type FileTreeAccessor as c, type GrepArgs as d, type SessionStartedEvent as e, type SubagentArgs as f, type TaskGetArgs as g, type TaskListArgs as h, type TaskUpdateArgs as i, type ToolExecutedEvent as j, type TurnCompletedEvent as k, type WorkflowInput as l, type WorkflowSessionInput as m, applyVirtualTreeMutations as n, askUserQuestionTool as o, bashTool as p, composeHooks as q, createAgentStateManager as r, createAskUserQuestionHandler as s, createBashToolDescription as t, createObservabilityHooks as u, createReadSkillHandler as v, createReadSkillTool as w, createSession as x, createTaskCreateHandler as y, createTaskGetHandler as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ao as ToolMap, _ as SessionConfig, az as ZeitlichSession, Y as SandboxShutdown, ag as ThreadInit, X as SandboxInit, t as JsonSerializable, B as BaseAgentState, o as AgentStateManager, aB as ToolRouterOptions, ar as ToolRouter, R as RouterContext, J as JsonValue, at as ToolWithHandler, v as ParsedToolCallUnion, ap as ToolNames, a6 as SubagentDefinition, a9 as SubagentHooks, aa as SubagentSandboxConfig, a5 as SubagentConfig, ab as SubagentSandboxShutdown, ac as SubagentSessionInput, a7 as SubagentFnResult, a3 as SessionStartHook, $ as SessionEndHook, D as PostToolUseHook, y as PostToolUseFailureHook, a1 as SessionExitReason, ah as TokenUsage, F as FileEntryMetadata, av as VirtualFileTree, j as TreeMutation, r as FileEntry, aw as VirtualFsOps, g as SkillMetadata, h as Skill, b as ToolHandlerResponse, am as ToolHandler, ay as WorkflowTask, c as ActivityToolHandler } from './types-Bpq5fDI5.cjs';
|
|
1
|
+
import { ao as ToolMap, _ as SessionConfig, az as ZeitlichSession, Y as SandboxShutdown, ag as ThreadInit, X as SandboxInit, t as JsonSerializable, B as BaseAgentState, o as AgentStateManager, aB as ToolRouterOptions, ar as ToolRouter, R as RouterContext, J as JsonValue, at as ToolWithHandler, v as ParsedToolCallUnion, ap as ToolNames, a6 as SubagentDefinition, a9 as SubagentHooks, aa as SubagentSandboxConfig, a5 as SubagentConfig, ab as SubagentSandboxShutdown, ac as SubagentSessionInput, a7 as SubagentFnResult, a3 as SessionStartHook, $ as SessionEndHook, D as PostToolUseHook, y as PostToolUseFailureHook, a1 as SessionExitReason, ah as TokenUsage, e as RunAgentConfig, A as AgentResponse, F as FileEntryMetadata, av as VirtualFileTree, j as TreeMutation, r as FileEntry, aw as VirtualFsOps, g as SkillMetadata, h as Skill, b as ToolHandlerResponse, am as ToolHandler, ay as WorkflowTask, c as ActivityToolHandler } from './types-Bpq5fDI5.cjs';
|
|
2
2
|
import { g as SandboxOps } from './types-AujBIMMn.cjs';
|
|
3
3
|
import z$1, { z } from 'zod';
|
|
4
4
|
import { Sinks, proxyActivities } from '@temporalio/workflow';
|
|
@@ -405,6 +405,34 @@ interface ZeitlichObservabilitySinks extends Sinks {
|
|
|
405
405
|
};
|
|
406
406
|
}
|
|
407
407
|
|
|
408
|
+
/**
|
|
409
|
+
* Workflow-safe proxy for runAgent activities with LLM-optimised defaults.
|
|
410
|
+
*
|
|
411
|
+
* Resolves the activity name from the scope using the same convention as
|
|
412
|
+
* {@link createRunAgentActivity}: `run<Scope>`.
|
|
413
|
+
* When no scope is provided, defaults to `workflowInfo().workflowType`.
|
|
414
|
+
*
|
|
415
|
+
* Import this from `zeitlich/workflow` in your Temporal workflow files.
|
|
416
|
+
*
|
|
417
|
+
* @typeParam M - SDK-native message type (e.g. `StoredMessage` for LangChain,
|
|
418
|
+
* `Anthropic.Messages.Message` for Anthropic, `Content` for Google GenAI).
|
|
419
|
+
* Must be provided for `SessionResult.finalMessage` to be correctly typed.
|
|
420
|
+
*
|
|
421
|
+
* @example
|
|
422
|
+
* ```typescript
|
|
423
|
+
* import { proxyRunAgent } from 'zeitlich/workflow';
|
|
424
|
+
* import type { StoredMessage } from '@langchain/core/messages';
|
|
425
|
+
*
|
|
426
|
+
* // Auto-scoped to the current workflow name
|
|
427
|
+
* const runAgent = proxyRunAgent<StoredMessage>();
|
|
428
|
+
*
|
|
429
|
+
* // Explicit scope for subagents
|
|
430
|
+
* const runResearcher = proxyRunAgent<StoredMessage>("Researcher");
|
|
431
|
+
* ```
|
|
432
|
+
*/
|
|
433
|
+
|
|
434
|
+
declare function proxyRunAgent<M = unknown>(scope?: string, options?: Parameters<typeof proxyActivities>[0]): (config: RunAgentConfig) => Promise<AgentResponse<M>>;
|
|
435
|
+
|
|
408
436
|
/**
|
|
409
437
|
* Apply a list of {@link TreeMutation}s to the `fileTree` stored in a state
|
|
410
438
|
* manager instance, updating it in place and returning the new tree.
|
|
@@ -747,4 +775,4 @@ declare const createAskUserQuestionHandler: () => ActivityToolHandler<AskUserQue
|
|
|
747
775
|
}[];
|
|
748
776
|
}>;
|
|
749
777
|
|
|
750
|
-
export {
|
|
778
|
+
export { proxyRunAgent as $, type AskUserQuestionArgs as A, type BashArgs as B, createTaskListHandler as C, createTaskUpdateHandler as D, createToolRouter as E, type FileEditArgs as F, type GlobArgs as G, defineSubagent as H, defineSubagentWorkflow as I, defineTool as J, defineWorkflow as K, editTool as L, filesWithMimeType as M, formatVirtualFileTree as N, type ObservabilityHooks as O, getShortId as P, globTool as Q, type ReadSkillArgs as R, type SessionEndedEvent as S, type TaskCreateArgs as T, grepTool as U, hasDirectory as V, type WorkflowConfig as W, hasFileWithMimeType as X, hasNoOtherToolCalls as Y, type ZeitlichObservabilitySinks as Z, parseSkillFile as _, type FileReadArgs as a, proxyVirtualFsOps as a0, readFileTool as a1, taskCreateTool as a2, taskGetTool as a3, taskListTool as a4, taskUpdateTool as a5, writeFileTool as a6, type FileWriteArgs as b, type FileTreeAccessor as c, type GrepArgs as d, type SessionStartedEvent as e, type SubagentArgs as f, type TaskGetArgs as g, type TaskListArgs as h, type TaskUpdateArgs as i, type ToolExecutedEvent as j, type TurnCompletedEvent as k, type WorkflowInput as l, type WorkflowSessionInput as m, applyVirtualTreeMutations as n, askUserQuestionTool as o, bashTool as p, composeHooks as q, createAgentStateManager as r, createAskUserQuestionHandler as s, createBashToolDescription as t, createObservabilityHooks as u, createReadSkillHandler as v, createReadSkillTool as w, createSession as x, createTaskCreateHandler as y, createTaskGetHandler as z };
|
package/dist/workflow.cjs
CHANGED
|
@@ -1334,6 +1334,23 @@ function composeHooks(...fns) {
|
|
|
1334
1334
|
return lastResult;
|
|
1335
1335
|
};
|
|
1336
1336
|
}
|
|
1337
|
+
function proxyRunAgent(scope, options) {
|
|
1338
|
+
const resolvedScope = scope ?? workflow.workflowInfo().workflowType;
|
|
1339
|
+
const name = `run${resolvedScope.charAt(0).toUpperCase()}${resolvedScope.slice(1)}`;
|
|
1340
|
+
const acts = workflow.proxyActivities(
|
|
1341
|
+
options ?? {
|
|
1342
|
+
startToCloseTimeout: "10m",
|
|
1343
|
+
heartbeatTimeout: "1m",
|
|
1344
|
+
retry: {
|
|
1345
|
+
maximumAttempts: 3,
|
|
1346
|
+
initialInterval: "10s",
|
|
1347
|
+
maximumInterval: "2m",
|
|
1348
|
+
backoffCoefficient: 3
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
);
|
|
1352
|
+
return acts[name];
|
|
1353
|
+
}
|
|
1337
1354
|
var SandboxNotSupportedError = class extends common.ApplicationFailure {
|
|
1338
1355
|
constructor(operation) {
|
|
1339
1356
|
super(
|
|
@@ -1937,6 +1954,7 @@ exports.hasFileWithMimeType = hasFileWithMimeType;
|
|
|
1937
1954
|
exports.hasNoOtherToolCalls = hasNoOtherToolCalls;
|
|
1938
1955
|
exports.isTerminalStatus = isTerminalStatus;
|
|
1939
1956
|
exports.parseSkillFile = parseSkillFile;
|
|
1957
|
+
exports.proxyRunAgent = proxyRunAgent;
|
|
1940
1958
|
exports.proxyVirtualFsOps = proxyVirtualFsOps;
|
|
1941
1959
|
exports.readFileTool = readFileTool;
|
|
1942
1960
|
exports.taskCreateTool = taskCreateTool;
|