@iqai/adk 0.3.4 → 0.3.6
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/CHANGELOG.md +12 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +23 -9
- package/dist/index.mjs +23 -9
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -4038,6 +4038,7 @@ interface EnhancedRunner<T = string, M extends boolean = false> {
|
|
|
4038
4038
|
userId: string;
|
|
4039
4039
|
sessionId: string;
|
|
4040
4040
|
newMessage: FullMessage;
|
|
4041
|
+
runConfig?: RunConfig;
|
|
4041
4042
|
}): AsyncIterable<Event>;
|
|
4042
4043
|
__outputSchema?: ZodSchema;
|
|
4043
4044
|
}
|
|
@@ -4117,6 +4118,7 @@ declare class AgentBuilder<TOut = string, TMulti extends boolean = false> {
|
|
|
4117
4118
|
private existingAgent?;
|
|
4118
4119
|
private definitionLocked;
|
|
4119
4120
|
private logger;
|
|
4121
|
+
private runConfig?;
|
|
4120
4122
|
/**
|
|
4121
4123
|
* Warn (once per method) if the definition has been locked by withAgent().
|
|
4122
4124
|
*/
|
|
@@ -4256,6 +4258,10 @@ declare class AgentBuilder<TOut = string, TMulti extends boolean = false> {
|
|
|
4256
4258
|
* @returns This builder instance for chaining
|
|
4257
4259
|
*/
|
|
4258
4260
|
withArtifactService(artifactService: BaseArtifactService): this;
|
|
4261
|
+
/**
|
|
4262
|
+
* Configure runtime behavior for runs
|
|
4263
|
+
*/
|
|
4264
|
+
withRunConfig(config: RunConfig | Partial<RunConfig>): this;
|
|
4259
4265
|
/**
|
|
4260
4266
|
* Configure with an in-memory session with custom IDs
|
|
4261
4267
|
* Note: In-memory sessions are created automatically by default, use this only if you need custom appName/userId
|
package/dist/index.d.ts
CHANGED
|
@@ -4038,6 +4038,7 @@ interface EnhancedRunner<T = string, M extends boolean = false> {
|
|
|
4038
4038
|
userId: string;
|
|
4039
4039
|
sessionId: string;
|
|
4040
4040
|
newMessage: FullMessage;
|
|
4041
|
+
runConfig?: RunConfig;
|
|
4041
4042
|
}): AsyncIterable<Event>;
|
|
4042
4043
|
__outputSchema?: ZodSchema;
|
|
4043
4044
|
}
|
|
@@ -4117,6 +4118,7 @@ declare class AgentBuilder<TOut = string, TMulti extends boolean = false> {
|
|
|
4117
4118
|
private existingAgent?;
|
|
4118
4119
|
private definitionLocked;
|
|
4119
4120
|
private logger;
|
|
4121
|
+
private runConfig?;
|
|
4120
4122
|
/**
|
|
4121
4123
|
* Warn (once per method) if the definition has been locked by withAgent().
|
|
4122
4124
|
*/
|
|
@@ -4256,6 +4258,10 @@ declare class AgentBuilder<TOut = string, TMulti extends boolean = false> {
|
|
|
4256
4258
|
* @returns This builder instance for chaining
|
|
4257
4259
|
*/
|
|
4258
4260
|
withArtifactService(artifactService: BaseArtifactService): this;
|
|
4261
|
+
/**
|
|
4262
|
+
* Configure runtime behavior for runs
|
|
4263
|
+
*/
|
|
4264
|
+
withRunConfig(config: RunConfig | Partial<RunConfig>): this;
|
|
4259
4265
|
/**
|
|
4260
4266
|
* Configure with an in-memory session with custom IDs
|
|
4261
4267
|
* Note: In-memory sessions are created automatically by default, use this only if you need custom appName/userId
|
package/dist/index.js
CHANGED
|
@@ -1774,13 +1774,14 @@ var AiSdkLlm = (_class6 = class extends BaseLlm {
|
|
|
1774
1774
|
(part) => part.functionResponse
|
|
1775
1775
|
);
|
|
1776
1776
|
const contentParts2 = functionResponses.map((part) => {
|
|
1777
|
-
let output
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1777
|
+
let output;
|
|
1778
|
+
const response = part.functionResponse.response;
|
|
1779
|
+
if (response === void 0 || response === null) {
|
|
1780
|
+
output = { type: "json", value: null };
|
|
1781
|
+
} else if (typeof response === "string") {
|
|
1782
|
+
output = { type: "text", value: response };
|
|
1783
|
+
} else {
|
|
1784
|
+
output = { type: "json", value: response };
|
|
1784
1785
|
}
|
|
1785
1786
|
return {
|
|
1786
1787
|
type: "tool-result",
|
|
@@ -10664,6 +10665,7 @@ var AgentBuilder = (_class33 = class _AgentBuilder {
|
|
|
10664
10665
|
__init57() {this.definitionLocked = false}
|
|
10665
10666
|
// Lock further definition mutation after withAgent
|
|
10666
10667
|
__init58() {this.logger = new Logger({ name: "AgentBuilder" })}
|
|
10668
|
+
|
|
10667
10669
|
/**
|
|
10668
10670
|
* Warn (once per method) if the definition has been locked by withAgent().
|
|
10669
10671
|
*/
|
|
@@ -11003,6 +11005,13 @@ var AgentBuilder = (_class33 = class _AgentBuilder {
|
|
|
11003
11005
|
this.artifactService = artifactService;
|
|
11004
11006
|
return this;
|
|
11005
11007
|
}
|
|
11008
|
+
/**
|
|
11009
|
+
* Configure runtime behavior for runs
|
|
11010
|
+
*/
|
|
11011
|
+
withRunConfig(config) {
|
|
11012
|
+
this.runConfig = config instanceof RunConfig ? config : new RunConfig({ ...this.runConfig || {}, ...config });
|
|
11013
|
+
return this;
|
|
11014
|
+
}
|
|
11006
11015
|
/**
|
|
11007
11016
|
* Configure with an in-memory session with custom IDs
|
|
11008
11017
|
* Note: In-memory sessions are created automatically by default, use this only if you need custom appName/userId
|
|
@@ -11186,6 +11195,7 @@ var AgentBuilder = (_class33 = class _AgentBuilder {
|
|
|
11186
11195
|
const agentType = this.agentType;
|
|
11187
11196
|
const isMulti = agentType === "parallel" || agentType === "sequential";
|
|
11188
11197
|
const subAgentNames = _optionalChain([this, 'access', _285 => _285.config, 'access', _286 => _286.subAgents, 'optionalAccess', _287 => _287.map, 'call', _288 => _288((a) => a.name)]) || [];
|
|
11198
|
+
const runConfig = this.runConfig;
|
|
11189
11199
|
return {
|
|
11190
11200
|
__outputSchema: outputSchema,
|
|
11191
11201
|
async ask(message) {
|
|
@@ -11199,7 +11209,8 @@ var AgentBuilder = (_class33 = class _AgentBuilder {
|
|
|
11199
11209
|
for await (const event of baseRunner.runAsync({
|
|
11200
11210
|
userId: sessionOptions.userId,
|
|
11201
11211
|
sessionId: session.id,
|
|
11202
|
-
newMessage
|
|
11212
|
+
newMessage,
|
|
11213
|
+
runConfig
|
|
11203
11214
|
})) {
|
|
11204
11215
|
if (_optionalChain([event, 'access', _290 => _290.content, 'optionalAccess', _291 => _291.parts]) && Array.isArray(event.content.parts)) {
|
|
11205
11216
|
const content = event.content.parts.map(
|
|
@@ -11243,7 +11254,10 @@ var AgentBuilder = (_class33 = class _AgentBuilder {
|
|
|
11243
11254
|
return combinedResponse.trim();
|
|
11244
11255
|
},
|
|
11245
11256
|
runAsync(params) {
|
|
11246
|
-
return baseRunner.runAsync(
|
|
11257
|
+
return baseRunner.runAsync({
|
|
11258
|
+
...params,
|
|
11259
|
+
runConfig: _nullishCoalesce(params.runConfig, () => ( runConfig))
|
|
11260
|
+
});
|
|
11247
11261
|
}
|
|
11248
11262
|
};
|
|
11249
11263
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1774,13 +1774,14 @@ var AiSdkLlm = class extends BaseLlm {
|
|
|
1774
1774
|
(part) => part.functionResponse
|
|
1775
1775
|
);
|
|
1776
1776
|
const contentParts2 = functionResponses.map((part) => {
|
|
1777
|
-
let output
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1777
|
+
let output;
|
|
1778
|
+
const response = part.functionResponse.response;
|
|
1779
|
+
if (response === void 0 || response === null) {
|
|
1780
|
+
output = { type: "json", value: null };
|
|
1781
|
+
} else if (typeof response === "string") {
|
|
1782
|
+
output = { type: "text", value: response };
|
|
1783
|
+
} else {
|
|
1784
|
+
output = { type: "json", value: response };
|
|
1784
1785
|
}
|
|
1785
1786
|
return {
|
|
1786
1787
|
type: "tool-result",
|
|
@@ -10664,6 +10665,7 @@ var AgentBuilder = class _AgentBuilder {
|
|
|
10664
10665
|
definitionLocked = false;
|
|
10665
10666
|
// Lock further definition mutation after withAgent
|
|
10666
10667
|
logger = new Logger({ name: "AgentBuilder" });
|
|
10668
|
+
runConfig;
|
|
10667
10669
|
/**
|
|
10668
10670
|
* Warn (once per method) if the definition has been locked by withAgent().
|
|
10669
10671
|
*/
|
|
@@ -11003,6 +11005,13 @@ var AgentBuilder = class _AgentBuilder {
|
|
|
11003
11005
|
this.artifactService = artifactService;
|
|
11004
11006
|
return this;
|
|
11005
11007
|
}
|
|
11008
|
+
/**
|
|
11009
|
+
* Configure runtime behavior for runs
|
|
11010
|
+
*/
|
|
11011
|
+
withRunConfig(config) {
|
|
11012
|
+
this.runConfig = config instanceof RunConfig ? config : new RunConfig({ ...this.runConfig || {}, ...config });
|
|
11013
|
+
return this;
|
|
11014
|
+
}
|
|
11006
11015
|
/**
|
|
11007
11016
|
* Configure with an in-memory session with custom IDs
|
|
11008
11017
|
* Note: In-memory sessions are created automatically by default, use this only if you need custom appName/userId
|
|
@@ -11186,6 +11195,7 @@ var AgentBuilder = class _AgentBuilder {
|
|
|
11186
11195
|
const agentType = this.agentType;
|
|
11187
11196
|
const isMulti = agentType === "parallel" || agentType === "sequential";
|
|
11188
11197
|
const subAgentNames = this.config.subAgents?.map((a) => a.name) || [];
|
|
11198
|
+
const runConfig = this.runConfig;
|
|
11189
11199
|
return {
|
|
11190
11200
|
__outputSchema: outputSchema,
|
|
11191
11201
|
async ask(message) {
|
|
@@ -11199,7 +11209,8 @@ var AgentBuilder = class _AgentBuilder {
|
|
|
11199
11209
|
for await (const event of baseRunner.runAsync({
|
|
11200
11210
|
userId: sessionOptions.userId,
|
|
11201
11211
|
sessionId: session.id,
|
|
11202
|
-
newMessage
|
|
11212
|
+
newMessage,
|
|
11213
|
+
runConfig
|
|
11203
11214
|
})) {
|
|
11204
11215
|
if (event.content?.parts && Array.isArray(event.content.parts)) {
|
|
11205
11216
|
const content = event.content.parts.map(
|
|
@@ -11243,7 +11254,10 @@ var AgentBuilder = class _AgentBuilder {
|
|
|
11243
11254
|
return combinedResponse.trim();
|
|
11244
11255
|
},
|
|
11245
11256
|
runAsync(params) {
|
|
11246
|
-
return baseRunner.runAsync(
|
|
11257
|
+
return baseRunner.runAsync({
|
|
11258
|
+
...params,
|
|
11259
|
+
runConfig: params.runConfig ?? runConfig
|
|
11260
|
+
});
|
|
11247
11261
|
}
|
|
11248
11262
|
};
|
|
11249
11263
|
}
|