@gakim-digital/dexter-bridge 0.5.12 → 0.5.14
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/package.json
CHANGED
package/src/agent.js
CHANGED
|
@@ -338,12 +338,66 @@ function argsWithoutVariadicFlag(args, flag) {
|
|
|
338
338
|
return filtered;
|
|
339
339
|
}
|
|
340
340
|
|
|
341
|
-
function
|
|
341
|
+
function compactClaudeOutputSchema(outputSchema) {
|
|
342
|
+
const toolCalls = outputSchema?.properties?.toolCalls;
|
|
343
|
+
const itemSchema = toolCalls?.items;
|
|
344
|
+
const variants = Array.isArray(itemSchema?.anyOf)
|
|
345
|
+
? itemSchema.anyOf
|
|
346
|
+
: itemSchema
|
|
347
|
+
? [itemSchema]
|
|
348
|
+
: [];
|
|
349
|
+
const toolNames = Array.from(new Set(
|
|
350
|
+
variants.flatMap((variant) => (
|
|
351
|
+
Array.isArray(variant?.properties?.name?.enum)
|
|
352
|
+
? variant.properties.name.enum.filter((name) => typeof name === 'string' && name)
|
|
353
|
+
: []
|
|
354
|
+
)),
|
|
355
|
+
));
|
|
356
|
+
return {
|
|
357
|
+
type: 'object',
|
|
358
|
+
properties: {
|
|
359
|
+
text: { type: 'string' },
|
|
360
|
+
toolCalls: {
|
|
361
|
+
type: 'array',
|
|
362
|
+
...(Number.isFinite(Number(toolCalls?.minItems))
|
|
363
|
+
? { minItems: Number(toolCalls.minItems) }
|
|
364
|
+
: {}),
|
|
365
|
+
...(Number.isFinite(Number(toolCalls?.maxItems))
|
|
366
|
+
? { maxItems: Number(toolCalls.maxItems) }
|
|
367
|
+
: {}),
|
|
368
|
+
items: {
|
|
369
|
+
type: 'object',
|
|
370
|
+
properties: {
|
|
371
|
+
id: { type: 'string' },
|
|
372
|
+
name: {
|
|
373
|
+
type: 'string',
|
|
374
|
+
...(toolNames.length ? { enum: toolNames } : {}),
|
|
375
|
+
},
|
|
376
|
+
arguments: { type: 'object' },
|
|
377
|
+
},
|
|
378
|
+
required: ['id', 'name', 'arguments'],
|
|
379
|
+
additionalProperties: false,
|
|
380
|
+
},
|
|
381
|
+
},
|
|
382
|
+
finishReason: outputSchema?.properties?.finishReason || {
|
|
383
|
+
type: 'string',
|
|
384
|
+
enum: ['tool_calls', 'stop', 'length'],
|
|
385
|
+
},
|
|
386
|
+
},
|
|
387
|
+
required: ['text', 'toolCalls', 'finishReason'],
|
|
388
|
+
additionalProperties: false,
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
function argsWithOutputSchema(args, definition, outputSchema, platform = process.platform) {
|
|
342
393
|
if (definition.id !== 'claude-code' || !outputSchema) return args;
|
|
394
|
+
const launchSchema = platform === 'win32'
|
|
395
|
+
? compactClaudeOutputSchema(outputSchema)
|
|
396
|
+
: outputSchema;
|
|
343
397
|
return [
|
|
344
398
|
...argsWithoutFlagValue(args, '--json-schema'),
|
|
345
399
|
'--json-schema',
|
|
346
|
-
JSON.stringify(
|
|
400
|
+
JSON.stringify(launchSchema),
|
|
347
401
|
];
|
|
348
402
|
}
|
|
349
403
|
|
|
@@ -413,7 +467,12 @@ export function buildAgentArgs(definition, modelDefinition, env = process.env, o
|
|
|
413
467
|
const structuredArgs = argsWithStructuredOutput(modelArgs, definition, env);
|
|
414
468
|
const isolatedArgs = argsWithClaudeIsolation(structuredArgs, definition);
|
|
415
469
|
const modelEngineArgs = argsWithClaudeModelEngine(isolatedArgs, definition, options, env);
|
|
416
|
-
const schemaArgs = argsWithOutputSchema(
|
|
470
|
+
const schemaArgs = argsWithOutputSchema(
|
|
471
|
+
modelEngineArgs,
|
|
472
|
+
definition,
|
|
473
|
+
options.outputSchema,
|
|
474
|
+
options.platform,
|
|
475
|
+
);
|
|
417
476
|
const resumedArgs = argsWithResumedSession(schemaArgs, definition, options.resumeSessionId);
|
|
418
477
|
return argsWithPromptInput(resumedArgs, definition);
|
|
419
478
|
}
|
|
@@ -286,7 +286,7 @@ export function createClaudeAgentSdkAdapter({
|
|
|
286
286
|
return {
|
|
287
287
|
...inherited,
|
|
288
288
|
CLAUDE_CONFIG_DIR: configDir,
|
|
289
|
-
CLAUDE_AGENT_SDK_CLIENT_APP: 'dexter-hosted-worker/0.2.
|
|
289
|
+
CLAUDE_AGENT_SDK_CLIENT_APP: 'dexter-hosted-worker/0.2.2',
|
|
290
290
|
};
|
|
291
291
|
}
|
|
292
292
|
|