@hatchet-dev/typescript-sdk 1.22.3 → 1.23.1
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/clients/event/event-client.js +3 -3
- package/clients/hatchet-client/client-config.d.ts +7 -1
- package/clients/hatchet-client/client-config.js +20 -0
- package/opentelemetry/instrumentor.js +78 -17
- package/opentelemetry/types.d.ts +1 -0
- package/opentelemetry/types.js +1 -0
- package/package.json +16 -5
- package/step.js +2 -3
- package/util/config-loader/config-loader.d.ts +1 -0
- package/util/config-loader/config-loader.js +20 -4
- package/util/grpc-helpers.js +16 -11
- package/util/v0-deprecation-warning.d.ts +44 -0
- package/util/v0-deprecation-warning.js +80 -0
- package/v1/client/admin.js +2 -2
- package/v1/client/features/workflows.js +2 -2
- package/v1/examples/affinity/affinity-workers.js +2 -2
- package/v1/examples/agent/agent-claude.js +39 -9
- package/v1/examples/agent/agent-openai.js +1 -5
- package/v1/examples/agent/workflow.d.ts +10 -6
- package/v1/examples/agent/workflow.js +33 -11
- package/v1/examples/aws/s3/worker.d.ts +1 -0
- package/v1/examples/aws/s3/worker.js +177 -0
- package/v1/examples/bulk_operations/workflow.js +3 -3
- package/v1/examples/cancellation/cancellation-workflow.js +3 -3
- package/v1/examples/cancellations/workflow.js +3 -3
- package/v1/examples/conditions/workflow.js +1 -1
- package/v1/examples/dag_match_condition/workflow.js +1 -1
- package/v1/examples/durable/workflow.js +6 -6
- package/v1/examples/durable-event/workflow.js +2 -2
- package/v1/examples/durable-sleep/workflow.js +2 -2
- package/v1/examples/durable_event/workflow.js +3 -3
- package/v1/examples/durable_sleep/workflow.js +2 -2
- package/v1/examples/events/workflow.js +1 -1
- package/v1/examples/middleware/client.js +3 -3
- package/v1/examples/middleware/workflow.js +5 -5
- package/v1/examples/on_event/workflow.js +1 -1
- package/v1/examples/on_failure/workflow.js +2 -2
- package/v1/examples/on_success/workflow.js +1 -1
- package/v1/examples/rate_limit/workflow.js +4 -4
- package/v1/examples/retries/workflow.js +1 -1
- package/v1/examples/support_agent_tools/agent-claude.d.ts +1 -0
- package/v1/examples/support_agent_tools/agent-claude.js +109 -0
- package/v1/examples/support_agent_tools/agent-openai.d.ts +1 -0
- package/v1/examples/support_agent_tools/agent-openai.js +73 -0
- package/v1/examples/support_agent_tools/tools.d.ts +45 -0
- package/v1/examples/support_agent_tools/tools.js +144 -0
- package/v1/examples/support_agent_tools/worker.d.ts +1 -0
- package/v1/examples/support_agent_tools/worker.js +24 -0
- package/v1/examples/webhooks/workflow.js +10 -10
- package/v1/examples/welcome_email/workflow.js +3 -3
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/workflow.js +2 -4
|
@@ -70,7 +70,7 @@ class EventClient {
|
|
|
70
70
|
bulkPush(type, inputs, options = {}) {
|
|
71
71
|
const namespacedType = (0, apply_namespace_1.applyNamespace)(type, this.config.namespace);
|
|
72
72
|
const events = inputs.map((input) => {
|
|
73
|
-
var _a, _b;
|
|
73
|
+
var _a, _b, _c, _d;
|
|
74
74
|
const baseMeta = (_b = (_a = input.additionalMetadata) !== null && _a !== void 0 ? _a : options.additionalMetadata) !== null && _b !== void 0 ? _b : {};
|
|
75
75
|
const enhanced = injectSourceInfo(baseMeta);
|
|
76
76
|
return {
|
|
@@ -78,8 +78,8 @@ class EventClient {
|
|
|
78
78
|
payload: JSON.stringify(input.payload),
|
|
79
79
|
eventTimestamp: new Date(),
|
|
80
80
|
additionalMetadata: Object.keys(enhanced).length > 0 ? JSON.stringify(enhanced) : undefined,
|
|
81
|
-
priority: input.priority,
|
|
82
|
-
scope: input.scope,
|
|
81
|
+
priority: (_c = input.priority) !== null && _c !== void 0 ? _c : options.priority,
|
|
82
|
+
scope: (_d = input.scope) !== null && _d !== void 0 ? _d : options.scope,
|
|
83
83
|
};
|
|
84
84
|
});
|
|
85
85
|
const req = {
|
|
@@ -16,6 +16,7 @@ declare const ClientTLSConfigSchema: z.ZodObject<{
|
|
|
16
16
|
export declare const OpenTelemetryConfigSchema: z.ZodObject<{
|
|
17
17
|
excludedAttributes: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
18
18
|
includeTaskNameInSpanName: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
19
|
+
individualRunSpansForBulkRun: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
19
20
|
}, z.core.$strip>;
|
|
20
21
|
export type OpenTelemetryConfig = z.infer<typeof OpenTelemetryConfigSchema>;
|
|
21
22
|
export declare const ClientConfigSchema: z.ZodObject<{
|
|
@@ -49,6 +50,7 @@ export declare const ClientConfigSchema: z.ZodObject<{
|
|
|
49
50
|
otel: z.ZodOptional<z.ZodObject<{
|
|
50
51
|
excludedAttributes: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
51
52
|
includeTaskNameInSpanName: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
53
|
+
individualRunSpansForBulkRun: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
52
54
|
}, z.core.$strip>>;
|
|
53
55
|
middleware: z.ZodOptional<z.ZodObject<{
|
|
54
56
|
before: z.ZodOptional<z.ZodAny>;
|
|
@@ -56,6 +58,8 @@ export declare const ClientConfigSchema: z.ZodObject<{
|
|
|
56
58
|
}, z.core.$strip>>;
|
|
57
59
|
cancellation_grace_period: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
58
60
|
cancellation_warning_threshold: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
61
|
+
grpc_max_recv_message_length: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
62
|
+
grpc_max_send_message_length: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
59
63
|
}, z.core.$strip>;
|
|
60
64
|
export type LogConstructor = (context: string, logLevel?: LogLevel) => Logger;
|
|
61
65
|
/**
|
|
@@ -98,9 +102,11 @@ export type InferMiddlewareAfter<M> = M extends {
|
|
|
98
102
|
after: infer P;
|
|
99
103
|
} ? P extends (...args: any[]) => any ? NonVoidReturn<P> : P extends readonly any[] ? MergeReturns<P> : {} : {};
|
|
100
104
|
type ClientConfigInferred = z.infer<typeof ClientConfigSchema>;
|
|
101
|
-
export type ClientConfig = Omit<ClientConfigInferred, 'cancellation_grace_period' | 'cancellation_warning_threshold'> & {
|
|
105
|
+
export type ClientConfig = Omit<ClientConfigInferred, 'cancellation_grace_period' | 'cancellation_warning_threshold' | 'grpc_max_recv_message_length' | 'grpc_max_send_message_length'> & {
|
|
102
106
|
cancellation_grace_period?: number;
|
|
103
107
|
cancellation_warning_threshold?: number;
|
|
108
|
+
grpc_max_recv_message_length?: number;
|
|
109
|
+
grpc_max_send_message_length?: number;
|
|
104
110
|
} & {
|
|
105
111
|
credentials?: ChannelCredentials;
|
|
106
112
|
} & {
|
|
@@ -24,6 +24,14 @@ exports.OpenTelemetryConfigSchema = v4_1.z.object({
|
|
|
24
24
|
* e.g., "hatchet.start_step_run.my_task" instead of "hatchet.start_step_run"
|
|
25
25
|
*/
|
|
26
26
|
includeTaskNameInSpanName: v4_1.z.boolean().optional().default(false),
|
|
27
|
+
/**
|
|
28
|
+
* If true, a child `hatchet.run_workflow` span is created for each item in a
|
|
29
|
+
* bulk run (`runWorkflows`), nested under the parent `hatchet.run_workflows`
|
|
30
|
+
* span, and each item's traceparent points at its own span. Defaults to false
|
|
31
|
+
* to preserve the existing span structure for downstream OpenTelemetry
|
|
32
|
+
* collectors.
|
|
33
|
+
*/
|
|
34
|
+
individualRunSpansForBulkRun: v4_1.z.boolean().optional().default(false),
|
|
27
35
|
});
|
|
28
36
|
const TaskMiddlewareSchema = v4_1.z
|
|
29
37
|
.object({
|
|
@@ -45,4 +53,16 @@ exports.ClientConfigSchema = v4_1.z.object({
|
|
|
45
53
|
middleware: TaskMiddlewareSchema,
|
|
46
54
|
cancellation_grace_period: DurationMsSchema.optional().default(1000),
|
|
47
55
|
cancellation_warning_threshold: DurationMsSchema.optional().default(300),
|
|
56
|
+
grpc_max_recv_message_length: v4_1.z
|
|
57
|
+
.number()
|
|
58
|
+
.int()
|
|
59
|
+
.positive()
|
|
60
|
+
.optional()
|
|
61
|
+
.default(4 * 1024 * 1024),
|
|
62
|
+
grpc_max_send_message_length: v4_1.z
|
|
63
|
+
.number()
|
|
64
|
+
.int()
|
|
65
|
+
.positive()
|
|
66
|
+
.optional()
|
|
67
|
+
.default(4 * 1024 * 1024),
|
|
48
68
|
});
|
|
@@ -35,7 +35,7 @@ catch (_a) {
|
|
|
35
35
|
const otelApi = require('@opentelemetry/api');
|
|
36
36
|
const otelInstrumentation = require('@opentelemetry/instrumentation');
|
|
37
37
|
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
38
|
-
const { context, propagation, SpanKind, SpanStatusCode, diag } = otelApi;
|
|
38
|
+
const { context, propagation, SpanKind, SpanStatusCode, diag, trace } = otelApi;
|
|
39
39
|
const { InstrumentationBase, InstrumentationNodeModuleDefinition, InstrumentationNodeModuleFile, isWrapped, } = otelInstrumentation;
|
|
40
40
|
const INSTRUMENTOR_NAME = '@hatchet-dev/typescript-sdk';
|
|
41
41
|
// FIXME: refactor version check to use the new pattern introduced in #2954
|
|
@@ -354,23 +354,84 @@ class HatchetInstrumentor extends InstrumentationBase {
|
|
|
354
354
|
return tracer.startActiveSpan('hatchet.run_workflows', {
|
|
355
355
|
kind: SpanKind.PRODUCER,
|
|
356
356
|
attributes,
|
|
357
|
-
}, (
|
|
358
|
-
const
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
357
|
+
}, (batchSpan) => {
|
|
358
|
+
const individualSpans = getConfig().individualRunSpansForBulkRun;
|
|
359
|
+
const itemSpans = [];
|
|
360
|
+
let enhancedWorkflowRuns;
|
|
361
|
+
try {
|
|
362
|
+
enhancedWorkflowRuns = workflowRuns.map((run) => {
|
|
363
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
364
|
+
const enhancedMetadata = Object.assign({}, ((_b = (_a = run.options) === null || _a === void 0 ? void 0 : _a.additionalMetadata) !== null && _b !== void 0 ? _b : {}));
|
|
365
|
+
if (individualSpans) {
|
|
366
|
+
const itemAttributes = filterAttributes({
|
|
367
|
+
[opentelemetry_1.OTelAttribute.WORKFLOW_NAME]: run.workflowName,
|
|
368
|
+
[opentelemetry_1.OTelAttribute.ACTION_PAYLOAD]: JSON.stringify(run.input),
|
|
369
|
+
[opentelemetry_1.OTelAttribute.PARENT_ID]: (_c = run.options) === null || _c === void 0 ? void 0 : _c.parentId,
|
|
370
|
+
[opentelemetry_1.OTelAttribute.PARENT_STEP_RUN_ID]: (_d = run.options) === null || _d === void 0 ? void 0 : _d.parentStepRunId,
|
|
371
|
+
[opentelemetry_1.OTelAttribute.CHILD_INDEX]: (_e = run.options) === null || _e === void 0 ? void 0 : _e.childIndex,
|
|
372
|
+
[opentelemetry_1.OTelAttribute.CHILD_KEY]: (_f = run.options) === null || _f === void 0 ? void 0 : _f.childKey,
|
|
373
|
+
[opentelemetry_1.OTelAttribute.ADDITIONAL_METADATA]: ((_g = run.options) === null || _g === void 0 ? void 0 : _g.additionalMetadata)
|
|
374
|
+
? JSON.stringify(run.options.additionalMetadata)
|
|
375
|
+
: undefined,
|
|
376
|
+
[opentelemetry_1.OTelAttribute.PRIORITY]: (_h = run.options) === null || _h === void 0 ? void 0 : _h.priority,
|
|
377
|
+
[opentelemetry_1.OTelAttribute.DESIRED_WORKER_ID]: (_j = run.options) === null || _j === void 0 ? void 0 : _j.desiredWorkerId,
|
|
378
|
+
}, getConfig().excludedAttributes);
|
|
379
|
+
const itemSpan = tracer.startSpan('hatchet.run_workflow', {
|
|
380
|
+
kind: SpanKind.PRODUCER,
|
|
381
|
+
attributes: itemAttributes,
|
|
382
|
+
});
|
|
383
|
+
itemSpans.push(itemSpan);
|
|
384
|
+
propagation.inject(trace.setSpan(context.active(), itemSpan), enhancedMetadata);
|
|
385
|
+
}
|
|
386
|
+
else {
|
|
387
|
+
// Legacy behaviour: inject the active (batch) span context so the
|
|
388
|
+
// span structure seen by downstream collectors is unchanged.
|
|
389
|
+
injectContext(enhancedMetadata);
|
|
390
|
+
}
|
|
391
|
+
return Object.assign(Object.assign({}, run), { options: Object.assign(Object.assign({}, run.options), { additionalMetadata: enhancedMetadata }) });
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
catch (error) {
|
|
395
|
+
const err = error;
|
|
396
|
+
batchSpan.recordException(err);
|
|
397
|
+
batchSpan.setStatus({ code: SpanStatusCode.ERROR, message: err === null || err === void 0 ? void 0 : err.message });
|
|
398
|
+
itemSpans.forEach((s) => {
|
|
399
|
+
s.recordException(err);
|
|
400
|
+
s.setStatus({ code: SpanStatusCode.ERROR, message: err === null || err === void 0 ? void 0 : err.message });
|
|
401
|
+
s.end();
|
|
402
|
+
});
|
|
403
|
+
batchSpan.end();
|
|
369
404
|
throw error;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
405
|
+
}
|
|
406
|
+
try {
|
|
407
|
+
return original
|
|
408
|
+
.call(this, enhancedWorkflowRuns, batchSize)
|
|
409
|
+
.catch((error) => {
|
|
410
|
+
batchSpan.recordException(error);
|
|
411
|
+
batchSpan.setStatus({ code: SpanStatusCode.ERROR, message: error === null || error === void 0 ? void 0 : error.message });
|
|
412
|
+
itemSpans.forEach((s) => {
|
|
413
|
+
s.recordException(error);
|
|
414
|
+
s.setStatus({ code: SpanStatusCode.ERROR, message: error === null || error === void 0 ? void 0 : error.message });
|
|
415
|
+
});
|
|
416
|
+
throw error;
|
|
417
|
+
})
|
|
418
|
+
.finally(() => {
|
|
419
|
+
itemSpans.forEach((s) => s.end());
|
|
420
|
+
batchSpan.end();
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
catch (error) {
|
|
424
|
+
const err = error;
|
|
425
|
+
batchSpan.recordException(err);
|
|
426
|
+
batchSpan.setStatus({ code: SpanStatusCode.ERROR, message: err === null || err === void 0 ? void 0 : err.message });
|
|
427
|
+
itemSpans.forEach((s) => {
|
|
428
|
+
s.recordException(err);
|
|
429
|
+
s.setStatus({ code: SpanStatusCode.ERROR, message: err === null || err === void 0 ? void 0 : err.message });
|
|
430
|
+
s.end();
|
|
431
|
+
});
|
|
432
|
+
batchSpan.end();
|
|
433
|
+
throw error;
|
|
434
|
+
}
|
|
374
435
|
});
|
|
375
436
|
});
|
|
376
437
|
};
|
package/opentelemetry/types.d.ts
CHANGED
|
@@ -2,5 +2,6 @@ export type { OpenTelemetryConfig } from '../clients/hatchet-client/client-confi
|
|
|
2
2
|
export declare const DEFAULT_CONFIG: {
|
|
3
3
|
excludedAttributes: string[];
|
|
4
4
|
includeTaskNameInSpanName: boolean;
|
|
5
|
+
individualRunSpansForBulkRun: boolean;
|
|
5
6
|
enableHatchetCollector: boolean;
|
|
6
7
|
};
|
package/opentelemetry/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hatchet-dev/typescript-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.1",
|
|
4
4
|
"description": "Background task orchestration & visibility for developers",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"author": "",
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"devDependencies": {
|
|
22
|
+
"@aws-sdk/client-s3": "^3.1042.0",
|
|
22
23
|
"@eslint/js": "^10.0.1",
|
|
23
24
|
"@types/jest": "^29.5.14",
|
|
24
25
|
"@types/node": "^22.13.14",
|
|
@@ -40,6 +41,16 @@
|
|
|
40
41
|
"ts-proto": "^2.11.4",
|
|
41
42
|
"tsconfig-paths": "^4.2.0",
|
|
42
43
|
"tsx": "^4.21.0",
|
|
44
|
+
"@anthropic-ai/claude-agent-sdk": "^0.3.148",
|
|
45
|
+
"@grpc/grpc-js": "^1.14.3",
|
|
46
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
47
|
+
"@openai/agents": "0.11.6",
|
|
48
|
+
"@opentelemetry/api": "^1.9.0",
|
|
49
|
+
"@opentelemetry/core": "^2.0.0",
|
|
50
|
+
"@opentelemetry/exporter-trace-otlp-grpc": "^0.218.0",
|
|
51
|
+
"@opentelemetry/instrumentation": "^0.218.0",
|
|
52
|
+
"@opentelemetry/sdk-trace-base": "^2.0.0",
|
|
53
|
+
"prom-client": "^15.1.3",
|
|
43
54
|
"typedoc": "^0.28.17",
|
|
44
55
|
"typedoc-plugin-markdown": "^4.10.0",
|
|
45
56
|
"typedoc-plugin-no-inherit": "^1.6.1",
|
|
@@ -62,14 +73,14 @@
|
|
|
62
73
|
},
|
|
63
74
|
"peerDependencies": {
|
|
64
75
|
"zod": "^3.25.0 || ^4.0.0",
|
|
65
|
-
"@anthropic-ai/claude-agent-sdk": "^0.
|
|
76
|
+
"@anthropic-ai/claude-agent-sdk": "^0.3.148",
|
|
66
77
|
"@grpc/grpc-js": "^1.14.3",
|
|
67
78
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
68
|
-
"@openai/agents": "0.
|
|
79
|
+
"@openai/agents": "0.11.6",
|
|
69
80
|
"@opentelemetry/api": "^1.9.0",
|
|
70
81
|
"@opentelemetry/core": "^2.0.0",
|
|
71
|
-
"@opentelemetry/exporter-trace-otlp-grpc": "^0.
|
|
72
|
-
"@opentelemetry/instrumentation": "^0.
|
|
82
|
+
"@opentelemetry/exporter-trace-otlp-grpc": "^0.218.0",
|
|
83
|
+
"@opentelemetry/instrumentation": "^0.218.0",
|
|
73
84
|
"@opentelemetry/sdk-trace-base": "^2.0.0",
|
|
74
85
|
"prom-client": "^15.1.3"
|
|
75
86
|
},
|
package/step.js
CHANGED
|
@@ -14,7 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const v0_deprecation_warning_1 = require("./util/v0-deprecation-warning");
|
|
17
18
|
__exportStar(require("./legacy/step"), exports);
|
|
18
|
-
|
|
19
|
-
console.warn('\x1b[32mPlease migrate to v1 SDK instead: https://docs.hatchet.run/home/v1-sdk-improvements\x1b[0m');
|
|
20
|
-
console.warn('--------------------------------');
|
|
19
|
+
(0, v0_deprecation_warning_1.emitV0RemovedWarning)('step');
|
|
@@ -5,6 +5,7 @@ interface LoadClientConfigOptions {
|
|
|
5
5
|
}
|
|
6
6
|
export declare class ConfigLoader {
|
|
7
7
|
static loadClientConfig(override?: Partial<ClientConfig>, config?: LoadClientConfigOptions): Partial<ClientConfig>;
|
|
8
|
+
private static parseIntEnv;
|
|
8
9
|
private static parseJsonArray;
|
|
9
10
|
static get default_yaml_config_path(): string;
|
|
10
11
|
static createCredentials(config: ClientConfig['tls_config']): ChannelCredentials;
|
|
@@ -44,7 +44,7 @@ const token_1 = require("./token");
|
|
|
44
44
|
const DEFAULT_CONFIG_FILE = '.hatchet.yaml';
|
|
45
45
|
class ConfigLoader {
|
|
46
46
|
static loadClientConfig(override, config) {
|
|
47
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10;
|
|
47
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18;
|
|
48
48
|
const yaml = this.loadYamlConfig(config === null || config === void 0 ? void 0 : config.path);
|
|
49
49
|
const tlsConfig = (_a = override === null || override === void 0 ? void 0 : override.tls_config) !== null && _a !== void 0 ? _a : {
|
|
50
50
|
tls_strategy: (_d = (_c = (_b = yaml === null || yaml === void 0 ? void 0 : yaml.tls_config) === null || _b === void 0 ? void 0 : _b.tls_strategy) !== null && _c !== void 0 ? _c : this.env('HATCHET_CLIENT_TLS_STRATEGY')) !== null && _d !== void 0 ? _d : 'tls',
|
|
@@ -74,7 +74,7 @@ class ConfigLoader {
|
|
|
74
74
|
apiUrl =
|
|
75
75
|
(_x = (_w = (_v = override === null || override === void 0 ? void 0 : override.api_url) !== null && _v !== void 0 ? _v : yaml === null || yaml === void 0 ? void 0 : yaml.api_url) !== null && _w !== void 0 ? _w : this.env('HATCHET_CLIENT_API_URL')) !== null && _x !== void 0 ? _x : addresses.serverUrl;
|
|
76
76
|
}
|
|
77
|
-
catch (
|
|
77
|
+
catch (_19) {
|
|
78
78
|
grpcBroadcastAddress =
|
|
79
79
|
(_z = (_y = override === null || override === void 0 ? void 0 : override.host_port) !== null && _y !== void 0 ? _y : yaml === null || yaml === void 0 ? void 0 : yaml.host_port) !== null && _z !== void 0 ? _z : this.env('HATCHET_CLIENT_HOST_PORT');
|
|
80
80
|
apiUrl = (_1 = (_0 = override === null || override === void 0 ? void 0 : override.api_url) !== null && _0 !== void 0 ? _0 : yaml === null || yaml === void 0 ? void 0 : yaml.api_url) !== null && _1 !== void 0 ? _1 : this.env('HATCHET_CLIENT_API_URL');
|
|
@@ -86,19 +86,35 @@ class ConfigLoader {
|
|
|
86
86
|
const otelConfig = (_5 = (_4 = override === null || override === void 0 ? void 0 : override.otel) !== null && _4 !== void 0 ? _4 : yaml === null || yaml === void 0 ? void 0 : yaml.otel) !== null && _5 !== void 0 ? _5 : {
|
|
87
87
|
excludedAttributes: this.parseJsonArray(this.env('HATCHET_CLIENT_OPENTELEMETRY_EXCLUDED_ATTRIBUTES') || '[]'),
|
|
88
88
|
includeTaskNameInSpanName: this.env('HATCHET_CLIENT_OPENTELEMETRY_INCLUDE_TASK_NAME_IN_SPAN_NAME') === 'true',
|
|
89
|
+
individualRunSpansForBulkRun: this.env('HATCHET_CLIENT_OPENTELEMETRY_INDIVIDUAL_RUN_SPANS_FOR_BULK_RUN') === 'true',
|
|
89
90
|
};
|
|
91
|
+
const grpcMaxRecvMessageLength = (_8 = (_7 = (_6 = override === null || override === void 0 ? void 0 : override.grpc_max_recv_message_length) !== null && _6 !== void 0 ? _6 : yaml === null || yaml === void 0 ? void 0 : yaml.grpc_max_recv_message_length) !== null && _7 !== void 0 ? _7 : this.parseIntEnv('HATCHET_CLIENT_GRPC_MAX_RECV_MESSAGE_LENGTH')) !== null && _8 !== void 0 ? _8 : 4 * 1024 * 1024;
|
|
92
|
+
const grpcMaxSendMessageLength = (_11 = (_10 = (_9 = override === null || override === void 0 ? void 0 : override.grpc_max_send_message_length) !== null && _9 !== void 0 ? _9 : yaml === null || yaml === void 0 ? void 0 : yaml.grpc_max_send_message_length) !== null && _10 !== void 0 ? _10 : this.parseIntEnv('HATCHET_CLIENT_GRPC_MAX_SEND_MESSAGE_LENGTH')) !== null && _11 !== void 0 ? _11 : 4 * 1024 * 1024;
|
|
90
93
|
return {
|
|
91
|
-
token: (
|
|
94
|
+
token: (_13 = (_12 = override === null || override === void 0 ? void 0 : override.token) !== null && _12 !== void 0 ? _12 : yaml === null || yaml === void 0 ? void 0 : yaml.token) !== null && _13 !== void 0 ? _13 : this.env('HATCHET_CLIENT_TOKEN'),
|
|
92
95
|
host_port: grpcBroadcastAddress,
|
|
93
96
|
api_url: apiUrl,
|
|
94
97
|
tls_config: tlsConfig,
|
|
95
98
|
healthcheck: healthCheckConfig,
|
|
96
|
-
log_level: (
|
|
99
|
+
log_level: (_16 = (_15 = (_14 = override === null || override === void 0 ? void 0 : override.log_level) !== null && _14 !== void 0 ? _14 : yaml === null || yaml === void 0 ? void 0 : yaml.log_level) !== null && _15 !== void 0 ? _15 : this.env('HATCHET_CLIENT_LOG_LEVEL')) !== null && _16 !== void 0 ? _16 : 'INFO',
|
|
97
100
|
tenant_id: tenantId,
|
|
98
101
|
namespace: namespace ? `${namespace}`.toLowerCase() : '',
|
|
99
102
|
otel: otelConfig,
|
|
103
|
+
grpc_max_recv_message_length: grpcMaxRecvMessageLength,
|
|
104
|
+
grpc_max_send_message_length: grpcMaxSendMessageLength,
|
|
105
|
+
cancellation_grace_period: (_17 = override === null || override === void 0 ? void 0 : override.cancellation_grace_period) !== null && _17 !== void 0 ? _17 : yaml === null || yaml === void 0 ? void 0 : yaml.cancellation_grace_period,
|
|
106
|
+
cancellation_warning_threshold: (_18 = override === null || override === void 0 ? void 0 : override.cancellation_warning_threshold) !== null && _18 !== void 0 ? _18 : yaml === null || yaml === void 0 ? void 0 : yaml.cancellation_warning_threshold,
|
|
100
107
|
};
|
|
101
108
|
}
|
|
109
|
+
static parseIntEnv(envName) {
|
|
110
|
+
const value = this.env(envName);
|
|
111
|
+
if (value === undefined || value === '')
|
|
112
|
+
return undefined;
|
|
113
|
+
if (!/^\d+$/.test(value.trim())) {
|
|
114
|
+
throw new Error(`Invalid value for ${envName}: "${value}". Expected a positive integer.`);
|
|
115
|
+
}
|
|
116
|
+
return parseInt(value, 10);
|
|
117
|
+
}
|
|
102
118
|
static parseJsonArray(value) {
|
|
103
119
|
try {
|
|
104
120
|
const parsed = JSON.parse(value);
|
package/util/grpc-helpers.js
CHANGED
|
@@ -29,17 +29,22 @@ exports.createGrpcClient = exports.addTokenMiddleware = exports.channelFactory =
|
|
|
29
29
|
const nice_grpc_1 = require("nice-grpc");
|
|
30
30
|
const nice_grpc_common_1 = require("nice-grpc-common");
|
|
31
31
|
const config_loader_1 = require("./config-loader");
|
|
32
|
-
const channelFactory = (config, credentials) =>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
const channelFactory = (config, credentials) => {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
return (0, nice_grpc_1.createChannel)(config.host_port, credentials, {
|
|
35
|
+
'grpc.ssl_target_name_override': config.tls_config.server_name,
|
|
36
|
+
'grpc.keepalive_timeout_ms': 60 * 1000,
|
|
37
|
+
'grpc.client_idle_timeout_ms': 60 * 1000,
|
|
38
|
+
// Send keepalive pings every 10 seconds, default is 2 hours.
|
|
39
|
+
'grpc.keepalive_time_ms': 10 * 1000,
|
|
40
|
+
// Allow keepalive pings when there are no gRPC calls.
|
|
41
|
+
'grpc.keepalive_permit_without_calls': 1,
|
|
42
|
+
// Enable gzip compression for all calls on this channel
|
|
43
|
+
'grpc.default_compression_algorithm': 2, // 2 = Gzip compression
|
|
44
|
+
'grpc.max_send_message_length': (_a = config.grpc_max_send_message_length) !== null && _a !== void 0 ? _a : 4 * 1024 * 1024,
|
|
45
|
+
'grpc.max_receive_message_length': (_b = config.grpc_max_recv_message_length) !== null && _b !== void 0 ? _b : 4 * 1024 * 1024,
|
|
46
|
+
});
|
|
47
|
+
};
|
|
43
48
|
exports.channelFactory = channelFactory;
|
|
44
49
|
const addTokenMiddleware = (token) => function _(call, options) {
|
|
45
50
|
return __asyncGenerator(this, arguments, function* _1() {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v0 SDK root-import deprecation warnings.
|
|
3
|
+
*
|
|
4
|
+
* The legacy `workflow` and `step` re-exports under the root specifier need
|
|
5
|
+
* to keep nagging consumers to migrate to v1, but the original implementation
|
|
6
|
+
* used `console.warn` at module evaluation time, which:
|
|
7
|
+
* - cannot be silenced by Node's standard `--no-deprecation`,
|
|
8
|
+
* `--no-warnings`, or `--no-warnings=DeprecationWarning` flags;
|
|
9
|
+
* - has no stable `code` for `process.on('warning', ...)` handlers; and
|
|
10
|
+
* - is duplicated when both submodules are loaded (which happens for
|
|
11
|
+
* anyone importing from the root, since `index.ts` re-exports both).
|
|
12
|
+
*
|
|
13
|
+
* Switching to `process.emitWarning` with a fixed code makes the warnings
|
|
14
|
+
* filterable, dedupable, and consistent with the rest of Node's deprecation
|
|
15
|
+
* surface, while still being visible by default.
|
|
16
|
+
*/
|
|
17
|
+
export declare const V0_DEPRECATION_CODE = "HATCHET_V0_REMOVED";
|
|
18
|
+
/** Reset hook for tests. Not part of the public API. */
|
|
19
|
+
export declare function _resetEmittedV0Warnings(): void;
|
|
20
|
+
/**
|
|
21
|
+
* Emit a deduplicated v0-removal deprecation warning for a given submodule.
|
|
22
|
+
*
|
|
23
|
+
* Each unique `submodule` is emitted at most once per process. Uses
|
|
24
|
+
* `process.emitWarning` when available so consumers can suppress or filter
|
|
25
|
+
* via standard Node mechanisms.
|
|
26
|
+
*
|
|
27
|
+
* Importing the SDK must never abort module evaluation, since the root
|
|
28
|
+
* specifier still re-exports v0 `workflow` and `step` for transitive
|
|
29
|
+
* consumers who only use v1 APIs. Two cases would otherwise crash them:
|
|
30
|
+
*
|
|
31
|
+
* 1. `process.throwDeprecation` (set by `--throw-deprecation` or directly).
|
|
32
|
+
* Node queues a `throw warning` on the next tick after `emitWarning`
|
|
33
|
+
* returns, so a `try`/`catch` around the call would not catch it. We
|
|
34
|
+
* check the flag up front and route to `console.warn` instead.
|
|
35
|
+
* 2. Runtimes that don't expose `process.emitWarning` at all (older
|
|
36
|
+
* browsers, certain bundler shims). Same fallback applies.
|
|
37
|
+
*
|
|
38
|
+
* The remaining `try`/`catch` is belt-and-suspenders for non-Node hosts
|
|
39
|
+
* where a polyfilled `emitWarning` could throw synchronously.
|
|
40
|
+
*
|
|
41
|
+
* @param submodule - The legacy v0 submodule being imported (e.g. "workflow", "step").
|
|
42
|
+
* @param detail - Optional follow-up sentence appended to the warning detail.
|
|
43
|
+
*/
|
|
44
|
+
export declare function emitV0RemovedWarning(submodule: string, detail?: string): void;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* v0 SDK root-import deprecation warnings.
|
|
4
|
+
*
|
|
5
|
+
* The legacy `workflow` and `step` re-exports under the root specifier need
|
|
6
|
+
* to keep nagging consumers to migrate to v1, but the original implementation
|
|
7
|
+
* used `console.warn` at module evaluation time, which:
|
|
8
|
+
* - cannot be silenced by Node's standard `--no-deprecation`,
|
|
9
|
+
* `--no-warnings`, or `--no-warnings=DeprecationWarning` flags;
|
|
10
|
+
* - has no stable `code` for `process.on('warning', ...)` handlers; and
|
|
11
|
+
* - is duplicated when both submodules are loaded (which happens for
|
|
12
|
+
* anyone importing from the root, since `index.ts` re-exports both).
|
|
13
|
+
*
|
|
14
|
+
* Switching to `process.emitWarning` with a fixed code makes the warnings
|
|
15
|
+
* filterable, dedupable, and consistent with the rest of Node's deprecation
|
|
16
|
+
* surface, while still being visible by default.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.V0_DEPRECATION_CODE = void 0;
|
|
20
|
+
exports._resetEmittedV0Warnings = _resetEmittedV0Warnings;
|
|
21
|
+
exports.emitV0RemovedWarning = emitV0RemovedWarning;
|
|
22
|
+
exports.V0_DEPRECATION_CODE = 'HATCHET_V0_REMOVED';
|
|
23
|
+
const MIGRATION_URL = 'https://docs.hatchet.run/home/v1-sdk-improvements';
|
|
24
|
+
const emittedSubmodules = new Set();
|
|
25
|
+
/** Reset hook for tests. Not part of the public API. */
|
|
26
|
+
function _resetEmittedV0Warnings() {
|
|
27
|
+
emittedSubmodules.clear();
|
|
28
|
+
}
|
|
29
|
+
function fallbackConsoleWarn(message, detail) {
|
|
30
|
+
console.warn(`[${exports.V0_DEPRECATION_CODE}] ${message}${detail ? `\n${detail}` : ''}`);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Emit a deduplicated v0-removal deprecation warning for a given submodule.
|
|
34
|
+
*
|
|
35
|
+
* Each unique `submodule` is emitted at most once per process. Uses
|
|
36
|
+
* `process.emitWarning` when available so consumers can suppress or filter
|
|
37
|
+
* via standard Node mechanisms.
|
|
38
|
+
*
|
|
39
|
+
* Importing the SDK must never abort module evaluation, since the root
|
|
40
|
+
* specifier still re-exports v0 `workflow` and `step` for transitive
|
|
41
|
+
* consumers who only use v1 APIs. Two cases would otherwise crash them:
|
|
42
|
+
*
|
|
43
|
+
* 1. `process.throwDeprecation` (set by `--throw-deprecation` or directly).
|
|
44
|
+
* Node queues a `throw warning` on the next tick after `emitWarning`
|
|
45
|
+
* returns, so a `try`/`catch` around the call would not catch it. We
|
|
46
|
+
* check the flag up front and route to `console.warn` instead.
|
|
47
|
+
* 2. Runtimes that don't expose `process.emitWarning` at all (older
|
|
48
|
+
* browsers, certain bundler shims). Same fallback applies.
|
|
49
|
+
*
|
|
50
|
+
* The remaining `try`/`catch` is belt-and-suspenders for non-Node hosts
|
|
51
|
+
* where a polyfilled `emitWarning` could throw synchronously.
|
|
52
|
+
*
|
|
53
|
+
* @param submodule - The legacy v0 submodule being imported (e.g. "workflow", "step").
|
|
54
|
+
* @param detail - Optional follow-up sentence appended to the warning detail.
|
|
55
|
+
*/
|
|
56
|
+
function emitV0RemovedWarning(submodule, detail) {
|
|
57
|
+
if (emittedSubmodules.has(submodule)) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
emittedSubmodules.add(submodule);
|
|
61
|
+
const message = `The v0 SDK, including the ${submodule} module, has been deprecated and was removed in v1.14.0. ` +
|
|
62
|
+
`Please migrate to the v1 SDK: ${MIGRATION_URL}`;
|
|
63
|
+
const hasProcess = typeof process !== 'undefined';
|
|
64
|
+
const hasEmitWarning = hasProcess && typeof process.emitWarning === 'function';
|
|
65
|
+
const willThrowAsync = hasProcess && process.throwDeprecation === true;
|
|
66
|
+
if (!hasEmitWarning || willThrowAsync) {
|
|
67
|
+
fallbackConsoleWarn(message, detail);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
process.emitWarning(message, {
|
|
72
|
+
type: 'DeprecationWarning',
|
|
73
|
+
code: exports.V0_DEPRECATION_CODE,
|
|
74
|
+
detail,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
catch (_a) {
|
|
78
|
+
fallbackConsoleWarn(message, detail);
|
|
79
|
+
}
|
|
80
|
+
}
|
package/v1/client/admin.js
CHANGED
|
@@ -114,6 +114,7 @@ class AdminClient {
|
|
|
114
114
|
*/
|
|
115
115
|
runWorkflows(workflowRuns_1) {
|
|
116
116
|
return __awaiter(this, arguments, void 0, function* (workflowRuns, batchSize = 500) {
|
|
117
|
+
var _a;
|
|
117
118
|
// Prepare workflows to be triggered in bulk
|
|
118
119
|
const workflowRequests = workflowRuns.map(({ workflowName, input, options }) => {
|
|
119
120
|
const computedName = (0, apply_namespace_1.applyNamespace)(workflowName, this.config.namespace).toLowerCase();
|
|
@@ -126,8 +127,7 @@ class AdminClient {
|
|
|
126
127
|
? convertDesiredWorkerLabels(desiredWorkerLabels)
|
|
127
128
|
: {} });
|
|
128
129
|
});
|
|
129
|
-
const
|
|
130
|
-
const batches = (0, batch_1.batch)(workflowRequests, batchSize, limit);
|
|
130
|
+
const batches = (0, batch_1.batch)(workflowRequests, batchSize, (_a = this.config.grpc_max_send_message_length) !== null && _a !== void 0 ? _a : 4 * 1024 * 1024);
|
|
131
131
|
this.logger.debug(`batching ${batches.length} batches`);
|
|
132
132
|
try {
|
|
133
133
|
const results = [];
|
|
@@ -79,6 +79,7 @@ class WorkflowsClient {
|
|
|
79
79
|
*/
|
|
80
80
|
get(workflow) {
|
|
81
81
|
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
var _a;
|
|
82
83
|
// Get workflow name string
|
|
83
84
|
const name = (0, exports.workflowNameString)(workflow);
|
|
84
85
|
// Check cache first
|
|
@@ -94,8 +95,7 @@ class WorkflowsClient {
|
|
|
94
95
|
name,
|
|
95
96
|
});
|
|
96
97
|
if (data && data.rows && data.rows.length > 0) {
|
|
97
|
-
const
|
|
98
|
-
// Cache the result
|
|
98
|
+
const wf = (_a = data.rows.find((row) => row.name === name)) !== null && _a !== void 0 ? _a : data.rows[0];
|
|
99
99
|
this.workflowCache.set(name, {
|
|
100
100
|
workflow: wf,
|
|
101
101
|
expiry: Date.now() + this.cacheTTL,
|
|
@@ -24,8 +24,8 @@ workflow.task({
|
|
|
24
24
|
const result = yield childWorkflow.run({});
|
|
25
25
|
results.push(result);
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
ctx.logger.info('Spawned 50 child workflows');
|
|
28
|
+
ctx.logger.info('Results', { results });
|
|
29
29
|
return { step1: 'step1 results!' };
|
|
30
30
|
}),
|
|
31
31
|
});
|
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -16,25 +49,22 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
|
16
49
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
17
50
|
};
|
|
18
51
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
// eslint-disable-next-line
|
|
20
52
|
const workflow_1 = require("./workflow");
|
|
21
|
-
const claude_agent_sdk_1 = require("@anthropic-ai/claude-agent-sdk");
|
|
22
|
-
const claude_agent_sdk_2 = require("@anthropic-ai/claude-agent-sdk");
|
|
23
53
|
function main() {
|
|
24
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
// Generate a tool from a standalone task
|
|
26
|
-
// const temperatureTool = getTemperature.mcpTool('claude');
|
|
27
55
|
var _a, e_1, _b, _c;
|
|
28
|
-
|
|
29
|
-
|
|
56
|
+
const temperatureTool = (0, workflow_1.createTemperatureWorkflowToolClaude)();
|
|
57
|
+
// The Claude Agent SDK is ESM-only, so avoid loading it at module import time.
|
|
58
|
+
// Run this example with an ESM-compatible TypeScript runner.
|
|
59
|
+
const { query, createSdkMcpServer } = yield Promise.resolve().then(() => __importStar(require('@anthropic-ai/claude-agent-sdk')));
|
|
30
60
|
// Wrap the tool in an in-process MCP server
|
|
31
|
-
const weatherServer =
|
|
61
|
+
const weatherServer = createSdkMcpServer({
|
|
32
62
|
name: 'weather',
|
|
33
63
|
version: '1.0.0',
|
|
34
64
|
tools: [temperatureTool],
|
|
35
65
|
});
|
|
36
66
|
try {
|
|
37
|
-
for (var _d = true, _e = __asyncValues(
|
|
67
|
+
for (var _d = true, _e = __asyncValues(query({
|
|
38
68
|
prompt: "What's the temperature in San Francisco?",
|
|
39
69
|
options: {
|
|
40
70
|
mcpServers: { weather: weatherServer },
|