zeitlich 0.2.50 → 0.2.51
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/dist/adapters/thread/anthropic/index.cjs +15 -13
- package/dist/adapters/thread/anthropic/index.cjs.map +1 -1
- package/dist/adapters/thread/anthropic/index.d.cts +15 -10
- package/dist/adapters/thread/anthropic/index.d.ts +15 -10
- package/dist/adapters/thread/anthropic/index.js +15 -13
- package/dist/adapters/thread/anthropic/index.js.map +1 -1
- 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.cjs +18 -12
- package/dist/adapters/thread/google-genai/index.cjs.map +1 -1
- package/dist/adapters/thread/google-genai/index.d.cts +181 -11
- package/dist/adapters/thread/google-genai/index.d.ts +181 -11
- package/dist/adapters/thread/google-genai/index.js +18 -12
- package/dist/adapters/thread/google-genai/index.js.map +1 -1
- package/dist/adapters/thread/google-genai/workflow.d.cts +6 -6
- package/dist/adapters/thread/google-genai/workflow.d.ts +6 -6
- package/dist/adapters/thread/langchain/index.cjs +22 -13
- package/dist/adapters/thread/langchain/index.cjs.map +1 -1
- package/dist/adapters/thread/langchain/index.d.cts +15 -10
- package/dist/adapters/thread/langchain/index.d.ts +15 -10
- package/dist/adapters/thread/langchain/index.js +22 -13
- package/dist/adapters/thread/langchain/index.js.map +1 -1
- package/dist/adapters/thread/langchain/workflow.d.cts +5 -5
- package/dist/adapters/thread/langchain/workflow.d.ts +5 -5
- package/dist/{cold-store-CCnZYWjx.d.ts → cold-store-DyHodfAB.d.ts} +1 -1
- package/dist/{cold-store-C0uvYTSi.d.cts → cold-store-YOx9nmgR.d.cts} +1 -1
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/{proxy-BVznA2_p.d.cts → proxy-2htgGQrc.d.cts} +1 -1
- package/dist/{proxy-C4J1pNUk.d.ts → proxy-CmiTP4pp.d.ts} +1 -1
- package/dist/{thread-manager-BqjzWsP7.d.ts → thread-manager-BJ5pz5Cx.d.cts} +4 -5
- package/dist/{thread-manager-SkSWRPRc.d.ts → thread-manager-BQAbrYXH.d.cts} +4 -5
- package/dist/{thread-manager-Dzl1fHhV.d.cts → thread-manager-CcvltOuq.d.ts} +4 -5
- package/dist/{thread-manager-CzIs47uG.d.cts → thread-manager-DHAbncHX.d.ts} +4 -5
- package/dist/{types-DZnUqCAP.d.cts → types-BjdqxKYp.d.cts} +1 -1
- package/dist/{types-CbPnU4RM.d.ts → types-DEbkLA06.d.ts} +1 -1
- package/dist/{types-YNesmGKV.d.ts → types-DiI7mZhI.d.ts} +1 -1
- package/dist/{types-d2RvEP6v.d.cts → types-N_LTWe4b.d.cts} +1 -1
- package/dist/{workflow-B3oTe2_D.d.cts → workflow-CcgD6EUB.d.cts} +1 -1
- package/dist/{workflow-Bkzg0cjB.d.ts → workflow-DBjPOKBr.d.ts} +1 -1
- package/dist/workflow.d.cts +2 -2
- package/dist/workflow.d.ts +2 -2
- package/package.json +1 -1
- package/src/adapters/thread/anthropic/activities.test.ts +115 -0
- package/src/adapters/thread/anthropic/activities.ts +10 -18
- package/src/adapters/thread/anthropic/model-invoker.test.ts +50 -0
- package/src/adapters/thread/anthropic/model-invoker.ts +10 -0
- package/src/adapters/thread/anthropic/thread-manager.ts +2 -3
- package/src/adapters/thread/google-genai/activities.test.ts +162 -0
- package/src/adapters/thread/google-genai/activities.ts +37 -14
- package/src/adapters/thread/google-genai/model-invoker.test.ts +53 -4
- package/src/adapters/thread/google-genai/model-invoker.ts +11 -0
- package/src/adapters/thread/google-genai/thread-manager.ts +2 -3
- package/src/adapters/thread/langchain/activities.test.ts +88 -0
- package/src/adapters/thread/langchain/activities.ts +14 -11
- package/src/adapters/thread/langchain/model-invoker.test.ts +74 -0
- package/src/adapters/thread/langchain/model-invoker.ts +15 -2
- package/src/adapters/thread/langchain/thread-manager.ts +2 -3
- package/dist/activities-IuOIvPHO.d.ts +0 -162
- package/dist/activities-cIlq1y1y.d.cts +0 -162
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import { RedisClientType } from 'redis';
|
|
2
|
-
import { Part, Content, GoogleGenAI } from '@google/genai';
|
|
3
|
-
import { a as ModelInvoker, b as PrefixedThreadOps, S as ScopedPrefix, R as RouterContext, c as ToolHandlerResponse, d as ActivityToolHandler } from './types-YNesmGKV.js';
|
|
4
|
-
import { C as ColdThreadStore } from './cold-store-CCnZYWjx.js';
|
|
5
|
-
import { T as ThreadManagerHooks, P as ProviderThreadManager } from './types-CbPnU4RM.js';
|
|
6
|
-
import { A as ADAPTER_ID } from './adapter-id-BB-mmrts.js';
|
|
7
|
-
|
|
8
|
-
/** SDK-native content type for Google GenAI human messages */
|
|
9
|
-
type GoogleGenAIContent = string | Part[];
|
|
10
|
-
/** SDK-native content type for Google GenAI system instructions */
|
|
11
|
-
type GoogleGenAISystemContent = string | Part[];
|
|
12
|
-
/** A Content with a unique ID for idempotent Redis storage */
|
|
13
|
-
interface StoredContent {
|
|
14
|
-
id: string;
|
|
15
|
-
content: Content;
|
|
16
|
-
}
|
|
17
|
-
type GoogleGenAIThreadManagerHooks = ThreadManagerHooks<StoredContent, Content>;
|
|
18
|
-
interface GoogleGenAIThreadManagerConfig {
|
|
19
|
-
redis: RedisClientType;
|
|
20
|
-
threadId: string;
|
|
21
|
-
/** Thread key, defaults to 'messages' */
|
|
22
|
-
key?: string;
|
|
23
|
-
hooks?: GoogleGenAIThreadManagerHooks;
|
|
24
|
-
/**
|
|
25
|
-
* Override the default thread TTL (90 days). When pairing the
|
|
26
|
-
* adapter with a durable cold tier, a shorter TTL (hours) is
|
|
27
|
-
* typically more appropriate.
|
|
28
|
-
*/
|
|
29
|
-
ttlSeconds?: number;
|
|
30
|
-
}
|
|
31
|
-
/** Prepared payload ready to send to the Google GenAI API */
|
|
32
|
-
interface GoogleGenAIInvocationPayload {
|
|
33
|
-
contents: Content[];
|
|
34
|
-
systemInstruction?: Part[];
|
|
35
|
-
}
|
|
36
|
-
/** Thread manager with Google GenAI Content convenience helpers */
|
|
37
|
-
interface GoogleGenAIThreadManager extends ProviderThreadManager<StoredContent, GoogleGenAIContent, GoogleGenAIToolResponse, GoogleGenAISystemContent> {
|
|
38
|
-
appendModelContent(id: string, parts: Part[]): Promise<void>;
|
|
39
|
-
prepareForInvocation(): Promise<GoogleGenAIInvocationPayload>;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Creates a Google GenAI-specific thread manager that stores StoredContent
|
|
43
|
-
* instances in Redis and provides convenience helpers for creating and
|
|
44
|
-
* appending typed Content messages.
|
|
45
|
-
*/
|
|
46
|
-
declare function createGoogleGenAIThreadManager(config: GoogleGenAIThreadManagerConfig): GoogleGenAIThreadManager;
|
|
47
|
-
|
|
48
|
-
type GoogleGenAIThreadOps<TScope extends string = ""> = PrefixedThreadOps<ScopedPrefix<TScope, typeof ADAPTER_ID>, GoogleGenAIContent>;
|
|
49
|
-
interface GoogleGenAIAdapterConfig {
|
|
50
|
-
redis: RedisClientType;
|
|
51
|
-
client?: GoogleGenAI;
|
|
52
|
-
/** Default model name (e.g. 'gemini-2.5-flash'). If omitted, use `createModelInvoker()` */
|
|
53
|
-
model?: string;
|
|
54
|
-
hooks?: GoogleGenAIThreadManagerHooks;
|
|
55
|
-
/**
|
|
56
|
-
* Optional durable cold tier (e.g. S3, R2, GCS). When provided,
|
|
57
|
-
* the session hydrates the thread on entry (`continue`/`fork`) and
|
|
58
|
-
* flushes it on every exit path. When omitted, the adapter is
|
|
59
|
-
* Redis-only and `hydrateThread`/`flushThread` activities are no-ops.
|
|
60
|
-
*/
|
|
61
|
-
coldStore?: ColdThreadStore;
|
|
62
|
-
/**
|
|
63
|
-
* Override the default Redis TTL (90 days). When pairing the
|
|
64
|
-
* adapter with a `coldStore`, a shorter TTL (hours) is typically
|
|
65
|
-
* more appropriate.
|
|
66
|
-
*/
|
|
67
|
-
ttlSeconds?: number;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Tool response type accepted by the Google GenAI adapter.
|
|
71
|
-
*
|
|
72
|
-
* Handlers can return:
|
|
73
|
-
* - **`string`** — plain text, wrapped in a `functionResponse` part.
|
|
74
|
-
* - **`Record<string, unknown>`** — structured object used as `functionResponse.response`.
|
|
75
|
-
* - **`Part[]`** — pre-built parts used directly as `Content.parts`.
|
|
76
|
-
* The handler is responsible for building correct Part objects (e.g. `functionResponse`,
|
|
77
|
-
* `inlineData`, `text`). Use `context.toolCallId` and `context.toolName` to construct
|
|
78
|
-
* `functionResponse` parts.
|
|
79
|
-
*
|
|
80
|
-
* @example
|
|
81
|
-
* ```typescript
|
|
82
|
-
* adapter.wrapHandler(async (args, ctx) => ({
|
|
83
|
-
* toolResponse: [
|
|
84
|
-
* { functionResponse: { id: ctx.toolCallId, name: ctx.toolName, response: { result: "done" } } },
|
|
85
|
-
* { inlineData: { data: base64, mimeType: "image/png" } },
|
|
86
|
-
* ],
|
|
87
|
-
* data: null,
|
|
88
|
-
* }));
|
|
89
|
-
* ```
|
|
90
|
-
*/
|
|
91
|
-
type GoogleGenAIToolResponse = string | Record<string, unknown> | Part[];
|
|
92
|
-
interface GoogleGenAIAdapter {
|
|
93
|
-
/** Model invoker using the default model (only available when `model` was provided) */
|
|
94
|
-
invoker: ModelInvoker<Content>;
|
|
95
|
-
/** Create an invoker for a specific model name (for multi-model setups) */
|
|
96
|
-
createModelInvoker(model: string, client: GoogleGenAI): ModelInvoker<Content>;
|
|
97
|
-
/**
|
|
98
|
-
* Create prefixed thread activities for registration on the worker.
|
|
99
|
-
*
|
|
100
|
-
* @param scope - Workflow name appended to the adapter prefix.
|
|
101
|
-
* Use different scopes for the main agent vs subagents to avoid collisions.
|
|
102
|
-
*
|
|
103
|
-
* @example
|
|
104
|
-
* ```typescript
|
|
105
|
-
* adapter.createActivities("codingAgent")
|
|
106
|
-
* // → { googleGenAICodingAgentInitializeThread, googleGenAICodingAgentAppendHumanMessage, … }
|
|
107
|
-
*
|
|
108
|
-
* adapter.createActivities("researchAgent")
|
|
109
|
-
* // → { googleGenAIResearchAgentInitializeThread, … }
|
|
110
|
-
* ```
|
|
111
|
-
*/
|
|
112
|
-
createActivities<S extends string = "">(scope?: S): GoogleGenAIThreadOps<S>;
|
|
113
|
-
/**
|
|
114
|
-
* Identity wrapper that types a tool handler for this adapter.
|
|
115
|
-
* Constrains `toolResponse` to {@link GoogleGenAIToolResponse}.
|
|
116
|
-
*/
|
|
117
|
-
wrapHandler<TArgs, TResult, TContext extends RouterContext = RouterContext>(handler: (args: TArgs, context: TContext) => Promise<ToolHandlerResponse<TResult, GoogleGenAIToolResponse>>): ActivityToolHandler<TArgs, TResult, TContext, GoogleGenAIToolResponse>;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Creates a Google GenAI adapter that bundles thread operations and model
|
|
121
|
-
* invocation using the `@google/genai` SDK.
|
|
122
|
-
*
|
|
123
|
-
* Use `createActivities(scope)` to register scoped thread operations as
|
|
124
|
-
* Temporal activities on the worker. The `invoker` (or invokers created via
|
|
125
|
-
* `createModelInvoker`) should be wrapped with `createRunAgentActivity`.
|
|
126
|
-
*
|
|
127
|
-
* @example
|
|
128
|
-
* ```typescript
|
|
129
|
-
* import { createGoogleGenAIAdapter } from 'zeitlich/adapters/thread/google-genai';
|
|
130
|
-
* import { createRunAgentActivity } from 'zeitlich';
|
|
131
|
-
* import { GoogleGenAI } from '@google/genai';
|
|
132
|
-
*
|
|
133
|
-
* const client = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });
|
|
134
|
-
* const adapter = createGoogleGenAIAdapter({ redis, client, model: 'gemini-2.5-flash' });
|
|
135
|
-
*
|
|
136
|
-
* export function createActivities(temporalClient: WorkflowClient) {
|
|
137
|
-
* return {
|
|
138
|
-
* ...adapter.createActivities("codingAgent"),
|
|
139
|
-
* ...createRunAgentActivity(temporalClient, adapter.invoker, "codingAgent"),
|
|
140
|
-
* };
|
|
141
|
-
* }
|
|
142
|
-
* ```
|
|
143
|
-
*
|
|
144
|
-
* @example Multi-agent worker (main + subagent share the adapter)
|
|
145
|
-
* ```typescript
|
|
146
|
-
* export function createActivities(temporalClient: WorkflowClient) {
|
|
147
|
-
* return {
|
|
148
|
-
* ...adapter.createActivities("codingAgent"),
|
|
149
|
-
* ...adapter.createActivities("researchAgent"),
|
|
150
|
-
* ...createRunAgentActivity(temporalClient, adapter.invoker, "codingAgent"),
|
|
151
|
-
* ...createRunAgentActivity(
|
|
152
|
-
* temporalClient,
|
|
153
|
-
* adapter.createModelInvoker('gemini-2.5-pro'),
|
|
154
|
-
* "researchAgent",
|
|
155
|
-
* ),
|
|
156
|
-
* };
|
|
157
|
-
* }
|
|
158
|
-
* ```
|
|
159
|
-
*/
|
|
160
|
-
declare function createGoogleGenAIAdapter(config: GoogleGenAIAdapterConfig): GoogleGenAIAdapter;
|
|
161
|
-
|
|
162
|
-
export { type GoogleGenAIThreadManagerHooks as G, type StoredContent as S, type GoogleGenAIAdapter as a, type GoogleGenAIAdapterConfig as b, type GoogleGenAIContent as c, type GoogleGenAIInvocationPayload as d, type GoogleGenAIThreadManager as e, type GoogleGenAIThreadManagerConfig as f, type GoogleGenAIThreadOps as g, type GoogleGenAIToolResponse as h, createGoogleGenAIAdapter as i, createGoogleGenAIThreadManager as j };
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import { RedisClientType } from 'redis';
|
|
2
|
-
import { Part, Content, GoogleGenAI } from '@google/genai';
|
|
3
|
-
import { a as ModelInvoker, b as PrefixedThreadOps, S as ScopedPrefix, R as RouterContext, c as ToolHandlerResponse, d as ActivityToolHandler } from './types-DZnUqCAP.cjs';
|
|
4
|
-
import { C as ColdThreadStore } from './cold-store-C0uvYTSi.cjs';
|
|
5
|
-
import { T as ThreadManagerHooks, P as ProviderThreadManager } from './types-d2RvEP6v.cjs';
|
|
6
|
-
import { A as ADAPTER_ID } from './adapter-id-BB-mmrts.cjs';
|
|
7
|
-
|
|
8
|
-
/** SDK-native content type for Google GenAI human messages */
|
|
9
|
-
type GoogleGenAIContent = string | Part[];
|
|
10
|
-
/** SDK-native content type for Google GenAI system instructions */
|
|
11
|
-
type GoogleGenAISystemContent = string | Part[];
|
|
12
|
-
/** A Content with a unique ID for idempotent Redis storage */
|
|
13
|
-
interface StoredContent {
|
|
14
|
-
id: string;
|
|
15
|
-
content: Content;
|
|
16
|
-
}
|
|
17
|
-
type GoogleGenAIThreadManagerHooks = ThreadManagerHooks<StoredContent, Content>;
|
|
18
|
-
interface GoogleGenAIThreadManagerConfig {
|
|
19
|
-
redis: RedisClientType;
|
|
20
|
-
threadId: string;
|
|
21
|
-
/** Thread key, defaults to 'messages' */
|
|
22
|
-
key?: string;
|
|
23
|
-
hooks?: GoogleGenAIThreadManagerHooks;
|
|
24
|
-
/**
|
|
25
|
-
* Override the default thread TTL (90 days). When pairing the
|
|
26
|
-
* adapter with a durable cold tier, a shorter TTL (hours) is
|
|
27
|
-
* typically more appropriate.
|
|
28
|
-
*/
|
|
29
|
-
ttlSeconds?: number;
|
|
30
|
-
}
|
|
31
|
-
/** Prepared payload ready to send to the Google GenAI API */
|
|
32
|
-
interface GoogleGenAIInvocationPayload {
|
|
33
|
-
contents: Content[];
|
|
34
|
-
systemInstruction?: Part[];
|
|
35
|
-
}
|
|
36
|
-
/** Thread manager with Google GenAI Content convenience helpers */
|
|
37
|
-
interface GoogleGenAIThreadManager extends ProviderThreadManager<StoredContent, GoogleGenAIContent, GoogleGenAIToolResponse, GoogleGenAISystemContent> {
|
|
38
|
-
appendModelContent(id: string, parts: Part[]): Promise<void>;
|
|
39
|
-
prepareForInvocation(): Promise<GoogleGenAIInvocationPayload>;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Creates a Google GenAI-specific thread manager that stores StoredContent
|
|
43
|
-
* instances in Redis and provides convenience helpers for creating and
|
|
44
|
-
* appending typed Content messages.
|
|
45
|
-
*/
|
|
46
|
-
declare function createGoogleGenAIThreadManager(config: GoogleGenAIThreadManagerConfig): GoogleGenAIThreadManager;
|
|
47
|
-
|
|
48
|
-
type GoogleGenAIThreadOps<TScope extends string = ""> = PrefixedThreadOps<ScopedPrefix<TScope, typeof ADAPTER_ID>, GoogleGenAIContent>;
|
|
49
|
-
interface GoogleGenAIAdapterConfig {
|
|
50
|
-
redis: RedisClientType;
|
|
51
|
-
client?: GoogleGenAI;
|
|
52
|
-
/** Default model name (e.g. 'gemini-2.5-flash'). If omitted, use `createModelInvoker()` */
|
|
53
|
-
model?: string;
|
|
54
|
-
hooks?: GoogleGenAIThreadManagerHooks;
|
|
55
|
-
/**
|
|
56
|
-
* Optional durable cold tier (e.g. S3, R2, GCS). When provided,
|
|
57
|
-
* the session hydrates the thread on entry (`continue`/`fork`) and
|
|
58
|
-
* flushes it on every exit path. When omitted, the adapter is
|
|
59
|
-
* Redis-only and `hydrateThread`/`flushThread` activities are no-ops.
|
|
60
|
-
*/
|
|
61
|
-
coldStore?: ColdThreadStore;
|
|
62
|
-
/**
|
|
63
|
-
* Override the default Redis TTL (90 days). When pairing the
|
|
64
|
-
* adapter with a `coldStore`, a shorter TTL (hours) is typically
|
|
65
|
-
* more appropriate.
|
|
66
|
-
*/
|
|
67
|
-
ttlSeconds?: number;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Tool response type accepted by the Google GenAI adapter.
|
|
71
|
-
*
|
|
72
|
-
* Handlers can return:
|
|
73
|
-
* - **`string`** — plain text, wrapped in a `functionResponse` part.
|
|
74
|
-
* - **`Record<string, unknown>`** — structured object used as `functionResponse.response`.
|
|
75
|
-
* - **`Part[]`** — pre-built parts used directly as `Content.parts`.
|
|
76
|
-
* The handler is responsible for building correct Part objects (e.g. `functionResponse`,
|
|
77
|
-
* `inlineData`, `text`). Use `context.toolCallId` and `context.toolName` to construct
|
|
78
|
-
* `functionResponse` parts.
|
|
79
|
-
*
|
|
80
|
-
* @example
|
|
81
|
-
* ```typescript
|
|
82
|
-
* adapter.wrapHandler(async (args, ctx) => ({
|
|
83
|
-
* toolResponse: [
|
|
84
|
-
* { functionResponse: { id: ctx.toolCallId, name: ctx.toolName, response: { result: "done" } } },
|
|
85
|
-
* { inlineData: { data: base64, mimeType: "image/png" } },
|
|
86
|
-
* ],
|
|
87
|
-
* data: null,
|
|
88
|
-
* }));
|
|
89
|
-
* ```
|
|
90
|
-
*/
|
|
91
|
-
type GoogleGenAIToolResponse = string | Record<string, unknown> | Part[];
|
|
92
|
-
interface GoogleGenAIAdapter {
|
|
93
|
-
/** Model invoker using the default model (only available when `model` was provided) */
|
|
94
|
-
invoker: ModelInvoker<Content>;
|
|
95
|
-
/** Create an invoker for a specific model name (for multi-model setups) */
|
|
96
|
-
createModelInvoker(model: string, client: GoogleGenAI): ModelInvoker<Content>;
|
|
97
|
-
/**
|
|
98
|
-
* Create prefixed thread activities for registration on the worker.
|
|
99
|
-
*
|
|
100
|
-
* @param scope - Workflow name appended to the adapter prefix.
|
|
101
|
-
* Use different scopes for the main agent vs subagents to avoid collisions.
|
|
102
|
-
*
|
|
103
|
-
* @example
|
|
104
|
-
* ```typescript
|
|
105
|
-
* adapter.createActivities("codingAgent")
|
|
106
|
-
* // → { googleGenAICodingAgentInitializeThread, googleGenAICodingAgentAppendHumanMessage, … }
|
|
107
|
-
*
|
|
108
|
-
* adapter.createActivities("researchAgent")
|
|
109
|
-
* // → { googleGenAIResearchAgentInitializeThread, … }
|
|
110
|
-
* ```
|
|
111
|
-
*/
|
|
112
|
-
createActivities<S extends string = "">(scope?: S): GoogleGenAIThreadOps<S>;
|
|
113
|
-
/**
|
|
114
|
-
* Identity wrapper that types a tool handler for this adapter.
|
|
115
|
-
* Constrains `toolResponse` to {@link GoogleGenAIToolResponse}.
|
|
116
|
-
*/
|
|
117
|
-
wrapHandler<TArgs, TResult, TContext extends RouterContext = RouterContext>(handler: (args: TArgs, context: TContext) => Promise<ToolHandlerResponse<TResult, GoogleGenAIToolResponse>>): ActivityToolHandler<TArgs, TResult, TContext, GoogleGenAIToolResponse>;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Creates a Google GenAI adapter that bundles thread operations and model
|
|
121
|
-
* invocation using the `@google/genai` SDK.
|
|
122
|
-
*
|
|
123
|
-
* Use `createActivities(scope)` to register scoped thread operations as
|
|
124
|
-
* Temporal activities on the worker. The `invoker` (or invokers created via
|
|
125
|
-
* `createModelInvoker`) should be wrapped with `createRunAgentActivity`.
|
|
126
|
-
*
|
|
127
|
-
* @example
|
|
128
|
-
* ```typescript
|
|
129
|
-
* import { createGoogleGenAIAdapter } from 'zeitlich/adapters/thread/google-genai';
|
|
130
|
-
* import { createRunAgentActivity } from 'zeitlich';
|
|
131
|
-
* import { GoogleGenAI } from '@google/genai';
|
|
132
|
-
*
|
|
133
|
-
* const client = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });
|
|
134
|
-
* const adapter = createGoogleGenAIAdapter({ redis, client, model: 'gemini-2.5-flash' });
|
|
135
|
-
*
|
|
136
|
-
* export function createActivities(temporalClient: WorkflowClient) {
|
|
137
|
-
* return {
|
|
138
|
-
* ...adapter.createActivities("codingAgent"),
|
|
139
|
-
* ...createRunAgentActivity(temporalClient, adapter.invoker, "codingAgent"),
|
|
140
|
-
* };
|
|
141
|
-
* }
|
|
142
|
-
* ```
|
|
143
|
-
*
|
|
144
|
-
* @example Multi-agent worker (main + subagent share the adapter)
|
|
145
|
-
* ```typescript
|
|
146
|
-
* export function createActivities(temporalClient: WorkflowClient) {
|
|
147
|
-
* return {
|
|
148
|
-
* ...adapter.createActivities("codingAgent"),
|
|
149
|
-
* ...adapter.createActivities("researchAgent"),
|
|
150
|
-
* ...createRunAgentActivity(temporalClient, adapter.invoker, "codingAgent"),
|
|
151
|
-
* ...createRunAgentActivity(
|
|
152
|
-
* temporalClient,
|
|
153
|
-
* adapter.createModelInvoker('gemini-2.5-pro'),
|
|
154
|
-
* "researchAgent",
|
|
155
|
-
* ),
|
|
156
|
-
* };
|
|
157
|
-
* }
|
|
158
|
-
* ```
|
|
159
|
-
*/
|
|
160
|
-
declare function createGoogleGenAIAdapter(config: GoogleGenAIAdapterConfig): GoogleGenAIAdapter;
|
|
161
|
-
|
|
162
|
-
export { type GoogleGenAIThreadManagerHooks as G, type StoredContent as S, type GoogleGenAIAdapter as a, type GoogleGenAIAdapterConfig as b, type GoogleGenAIContent as c, type GoogleGenAIInvocationPayload as d, type GoogleGenAIThreadManager as e, type GoogleGenAIThreadManagerConfig as f, type GoogleGenAIThreadOps as g, type GoogleGenAIToolResponse as h, createGoogleGenAIAdapter as i, createGoogleGenAIThreadManager as j };
|