@sweny-ai/core 0.1.61 → 0.1.62
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/claude.d.ts +1 -0
- package/dist/claude.js +2 -2
- package/dist/executor.js +1 -0
- package/dist/schema.d.ts +14 -0
- package/dist/schema.js +6 -0
- package/dist/types.d.ts +4 -0
- package/package.json +1 -1
package/dist/claude.d.ts
CHANGED
package/dist/claude.js
CHANGED
|
@@ -40,7 +40,7 @@ export class ClaudeClient {
|
|
|
40
40
|
return env;
|
|
41
41
|
}
|
|
42
42
|
async run(opts) {
|
|
43
|
-
const { instruction, context, tools, outputSchema, onProgress } = opts;
|
|
43
|
+
const { instruction, context, tools, outputSchema, onProgress, maxTurns } = opts;
|
|
44
44
|
const toolCalls = [];
|
|
45
45
|
// Convert core tools to SDK MCP tools
|
|
46
46
|
const sdkTools = tools.map((t) => coreToolToSdkTool(t, this.defaultContext, toolCalls));
|
|
@@ -68,7 +68,7 @@ export class ClaudeClient {
|
|
|
68
68
|
const stream = query({
|
|
69
69
|
prompt,
|
|
70
70
|
options: {
|
|
71
|
-
maxTurns: this.maxTurns,
|
|
71
|
+
maxTurns: maxTurns ?? this.maxTurns,
|
|
72
72
|
systemPrompt: SYSTEM_PROMPT,
|
|
73
73
|
cwd: this.cwd,
|
|
74
74
|
env,
|
package/dist/executor.js
CHANGED
|
@@ -97,6 +97,7 @@ export async function execute(workflow, input, options) {
|
|
|
97
97
|
context,
|
|
98
98
|
tools: trackedTools,
|
|
99
99
|
outputSchema: node.output,
|
|
100
|
+
maxTurns: node.max_turns,
|
|
100
101
|
onProgress: (message) => {
|
|
101
102
|
safeObserve(observer, { type: "node:progress", node: currentId, message }, logger);
|
|
102
103
|
},
|
package/dist/schema.d.ts
CHANGED
|
@@ -359,6 +359,7 @@ export declare const nodeZ: z.ZodObject<{
|
|
|
359
359
|
}>]>;
|
|
360
360
|
skills: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
361
361
|
output: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
362
|
+
max_turns: z.ZodOptional<z.ZodNumber>;
|
|
362
363
|
}, "strip", z.ZodTypeAny, {
|
|
363
364
|
instruction: string | {
|
|
364
365
|
inline: string;
|
|
@@ -371,6 +372,7 @@ export declare const nodeZ: z.ZodObject<{
|
|
|
371
372
|
name: string;
|
|
372
373
|
skills: string[];
|
|
373
374
|
output?: Record<string, unknown> | undefined;
|
|
375
|
+
max_turns?: number | undefined;
|
|
374
376
|
}, {
|
|
375
377
|
instruction: string | {
|
|
376
378
|
inline: string;
|
|
@@ -383,6 +385,7 @@ export declare const nodeZ: z.ZodObject<{
|
|
|
383
385
|
name: string;
|
|
384
386
|
output?: Record<string, unknown> | undefined;
|
|
385
387
|
skills?: string[] | undefined;
|
|
388
|
+
max_turns?: number | undefined;
|
|
386
389
|
}>;
|
|
387
390
|
export declare const edgeZ: z.ZodObject<{
|
|
388
391
|
from: z.ZodString;
|
|
@@ -430,6 +433,7 @@ export declare const workflowZ: z.ZodObject<{
|
|
|
430
433
|
}>]>;
|
|
431
434
|
skills: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
432
435
|
output: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
436
|
+
max_turns: z.ZodOptional<z.ZodNumber>;
|
|
433
437
|
}, "strip", z.ZodTypeAny, {
|
|
434
438
|
instruction: string | {
|
|
435
439
|
inline: string;
|
|
@@ -442,6 +446,7 @@ export declare const workflowZ: z.ZodObject<{
|
|
|
442
446
|
name: string;
|
|
443
447
|
skills: string[];
|
|
444
448
|
output?: Record<string, unknown> | undefined;
|
|
449
|
+
max_turns?: number | undefined;
|
|
445
450
|
}, {
|
|
446
451
|
instruction: string | {
|
|
447
452
|
inline: string;
|
|
@@ -454,6 +459,7 @@ export declare const workflowZ: z.ZodObject<{
|
|
|
454
459
|
name: string;
|
|
455
460
|
output?: Record<string, unknown> | undefined;
|
|
456
461
|
skills?: string[] | undefined;
|
|
462
|
+
max_turns?: number | undefined;
|
|
457
463
|
}>>;
|
|
458
464
|
edges: z.ZodArray<z.ZodObject<{
|
|
459
465
|
from: z.ZodString;
|
|
@@ -590,6 +596,7 @@ export declare const workflowZ: z.ZodObject<{
|
|
|
590
596
|
name: string;
|
|
591
597
|
skills: string[];
|
|
592
598
|
output?: Record<string, unknown> | undefined;
|
|
599
|
+
max_turns?: number | undefined;
|
|
593
600
|
}>;
|
|
594
601
|
edges: {
|
|
595
602
|
to: string;
|
|
@@ -613,6 +620,7 @@ export declare const workflowZ: z.ZodObject<{
|
|
|
613
620
|
name: string;
|
|
614
621
|
output?: Record<string, unknown> | undefined;
|
|
615
622
|
skills?: string[] | undefined;
|
|
623
|
+
max_turns?: number | undefined;
|
|
616
624
|
}>;
|
|
617
625
|
edges: {
|
|
618
626
|
to: string;
|
|
@@ -666,6 +674,7 @@ export declare function parseWorkflow(raw: unknown): {
|
|
|
666
674
|
name: string;
|
|
667
675
|
skills: string[];
|
|
668
676
|
output?: Record<string, unknown> | undefined;
|
|
677
|
+
max_turns?: number | undefined;
|
|
669
678
|
}>;
|
|
670
679
|
edges: {
|
|
671
680
|
to: string;
|
|
@@ -787,6 +796,11 @@ export declare const workflowJsonSchema: {
|
|
|
787
796
|
readonly type: "object";
|
|
788
797
|
readonly description: "Optional JSON Schema for structured output";
|
|
789
798
|
};
|
|
799
|
+
readonly max_turns: {
|
|
800
|
+
readonly type: "integer";
|
|
801
|
+
readonly minimum: 1;
|
|
802
|
+
readonly description: "Max AI model turns for this node. When absent, the executor's default applies.";
|
|
803
|
+
};
|
|
790
804
|
};
|
|
791
805
|
};
|
|
792
806
|
};
|
package/dist/schema.js
CHANGED
|
@@ -68,6 +68,7 @@ export const nodeZ = z.object({
|
|
|
68
68
|
instruction: sourceZ,
|
|
69
69
|
skills: z.array(z.string()).default([]),
|
|
70
70
|
output: jsonSchemaZ.optional(),
|
|
71
|
+
max_turns: z.number().int().min(1).optional(),
|
|
71
72
|
});
|
|
72
73
|
export const edgeZ = z.object({
|
|
73
74
|
from: z.string().min(1),
|
|
@@ -292,6 +293,11 @@ export const workflowJsonSchema = {
|
|
|
292
293
|
type: "object",
|
|
293
294
|
description: "Optional JSON Schema for structured output",
|
|
294
295
|
},
|
|
296
|
+
max_turns: {
|
|
297
|
+
type: "integer",
|
|
298
|
+
minimum: 1,
|
|
299
|
+
description: "Max AI model turns for this node. When absent, the executor's default applies.",
|
|
300
|
+
},
|
|
295
301
|
},
|
|
296
302
|
},
|
|
297
303
|
},
|
package/dist/types.d.ts
CHANGED
|
@@ -47,6 +47,8 @@ export interface Node {
|
|
|
47
47
|
skills: string[];
|
|
48
48
|
/** Optional structured output schema */
|
|
49
49
|
output?: JSONSchema;
|
|
50
|
+
/** Max AI model turns for this node. When absent, the executor's default applies. */
|
|
51
|
+
max_turns?: number;
|
|
50
52
|
}
|
|
51
53
|
/** An edge connecting two nodes */
|
|
52
54
|
export interface Edge {
|
|
@@ -170,6 +172,8 @@ export interface Claude {
|
|
|
170
172
|
outputSchema?: JSONSchema;
|
|
171
173
|
/** Called with status messages while Claude is working (tool name, etc.) */
|
|
172
174
|
onProgress?: (message: string) => void;
|
|
175
|
+
/** Per-node turn limit. Overrides the client default when set. */
|
|
176
|
+
maxTurns?: number;
|
|
173
177
|
}): Promise<NodeResult>;
|
|
174
178
|
/** Evaluate a routing condition — pick one of N choices */
|
|
175
179
|
evaluate(opts: {
|