@rowan-agent/agent 0.5.1 → 0.5.2
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/index.js +12 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -94,6 +94,9 @@ var createOutcome = {
|
|
|
94
94
|
id: createId("out"),
|
|
95
95
|
message
|
|
96
96
|
};
|
|
97
|
+
if (output.payload !== void 0) {
|
|
98
|
+
outcome.payload = output.payload;
|
|
99
|
+
}
|
|
97
100
|
if (toolResults.length > 0) {
|
|
98
101
|
outcome.toolResults = toolResults;
|
|
99
102
|
}
|
|
@@ -3426,14 +3429,14 @@ var Agent = class {
|
|
|
3426
3429
|
return loadExtensionsFromPath(targetPath);
|
|
3427
3430
|
}
|
|
3428
3431
|
constructor(options) {
|
|
3429
|
-
const context =
|
|
3432
|
+
const context = prepareAgentContext(options.context);
|
|
3430
3433
|
this.options = {
|
|
3431
3434
|
...options,
|
|
3432
3435
|
context
|
|
3433
3436
|
};
|
|
3434
3437
|
this.state = {
|
|
3435
3438
|
...this.options.sessionId ? { sessionId: this.options.sessionId } : {},
|
|
3436
|
-
context:
|
|
3439
|
+
context: prepareAgentContext(context),
|
|
3437
3440
|
model: this.options.model,
|
|
3438
3441
|
tools: this.options.context.tools ?? [],
|
|
3439
3442
|
isRunning: false
|
|
@@ -3590,7 +3593,7 @@ var Agent = class {
|
|
|
3590
3593
|
const resolved = this.resolveRunConfig(config);
|
|
3591
3594
|
const extensions = resolved.extensions ?? [];
|
|
3592
3595
|
await this.loadExtensions(extensions, resolved.cwd);
|
|
3593
|
-
const runContext =
|
|
3596
|
+
const runContext = prepareAgentContext(resolved.context, this.extensionRunner);
|
|
3594
3597
|
const sessionId = resolved.sessionId ?? this.state.sessionId;
|
|
3595
3598
|
this.options = resolved;
|
|
3596
3599
|
if (sessionId) {
|
|
@@ -3641,11 +3644,11 @@ var Agent = class {
|
|
|
3641
3644
|
onModelTranscript: resolved.onModelTranscript
|
|
3642
3645
|
});
|
|
3643
3646
|
const nextContext = {
|
|
3644
|
-
...
|
|
3647
|
+
...prepareAgentContext(resolved.context),
|
|
3645
3648
|
messages: snapshotMessages(result.messages)
|
|
3646
3649
|
};
|
|
3647
3650
|
this.state.sessionId = result.sessionId;
|
|
3648
|
-
this.state.context =
|
|
3651
|
+
this.state.context = prepareAgentContext(nextContext, this.extensionRunner);
|
|
3649
3652
|
this.state.currentResult = result;
|
|
3650
3653
|
this.options = {
|
|
3651
3654
|
...resolved,
|
|
@@ -3689,7 +3692,7 @@ ${additionalInstructions}` : content;
|
|
|
3689
3692
|
*/
|
|
3690
3693
|
async phase(name) {
|
|
3691
3694
|
await this.loadExtensions(this.options.extensions ?? [], this.options.cwd);
|
|
3692
|
-
const registry =
|
|
3695
|
+
const registry = prepareAgentContext(this.options.context, this.extensionRunner).phases?.phases;
|
|
3693
3696
|
const phase = registry?.get(name) ?? [...registry?.values() ?? []].find((candidate) => candidate.name === name);
|
|
3694
3697
|
return phase ? readPhaseContent(phase) : "";
|
|
3695
3698
|
}
|
|
@@ -3705,7 +3708,7 @@ ${additionalInstructions}` : content;
|
|
|
3705
3708
|
...this.options,
|
|
3706
3709
|
...config
|
|
3707
3710
|
};
|
|
3708
|
-
const context =
|
|
3711
|
+
const context = prepareAgentContext(config?.context ?? this.createContextSnapshot());
|
|
3709
3712
|
return {
|
|
3710
3713
|
...merged,
|
|
3711
3714
|
context,
|
|
@@ -3713,10 +3716,10 @@ ${additionalInstructions}` : content;
|
|
|
3713
3716
|
};
|
|
3714
3717
|
}
|
|
3715
3718
|
createContextSnapshot() {
|
|
3716
|
-
return
|
|
3719
|
+
return prepareAgentContext(this.options.context);
|
|
3717
3720
|
}
|
|
3718
3721
|
};
|
|
3719
|
-
function
|
|
3722
|
+
function prepareAgentContext(context, extensionRunner) {
|
|
3720
3723
|
const phases = /* @__PURE__ */ new Map();
|
|
3721
3724
|
phases.set(DEFAULT_PHASE_ID, createDefaultPhase());
|
|
3722
3725
|
for (const [id, phase] of context.phases?.phases ?? []) {
|