@springbrand/agent-runtime 0.1.3-alpha.7 → 0.1.3-alpha.8
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
|
@@ -453,6 +453,12 @@ export abstract class RecoverableChatAgent<
|
|
|
453
453
|
connection: Connection,
|
|
454
454
|
probeId?: string,
|
|
455
455
|
): Promise<void> {
|
|
456
|
+
console.info("[DEBUG-ws-old-9f3a] resume-request", {
|
|
457
|
+
connectionId: connection.id,
|
|
458
|
+
probeId,
|
|
459
|
+
activeRequestId: this.resumableStream.activeRequestId,
|
|
460
|
+
pending: [...this.pendingResumeConnections],
|
|
461
|
+
});
|
|
456
462
|
return this.resumeHandshake.handleResumeRequest(connection, probeId);
|
|
457
463
|
}
|
|
458
464
|
|
|
@@ -468,6 +474,12 @@ export abstract class RecoverableChatAgent<
|
|
|
468
474
|
connection: Connection,
|
|
469
475
|
requestId: string,
|
|
470
476
|
): Promise<void> {
|
|
477
|
+
console.info("[DEBUG-ws-old-9f3a] resume-ack", {
|
|
478
|
+
connectionId: connection.id,
|
|
479
|
+
requestId,
|
|
480
|
+
activeRequestId: this.resumableStream.activeRequestId,
|
|
481
|
+
pending: [...this.pendingResumeConnections],
|
|
482
|
+
});
|
|
471
483
|
return this.resumeHandshake.handleResumeAck(connection, requestId);
|
|
472
484
|
}
|
|
473
485
|
|
|
@@ -492,6 +504,13 @@ export abstract class RecoverableChatAgent<
|
|
|
492
504
|
readonly continuation?: boolean;
|
|
493
505
|
} = {},
|
|
494
506
|
): void {
|
|
507
|
+
console.info("[DEBUG-ws-old-9f3a] broadcast", {
|
|
508
|
+
requestId,
|
|
509
|
+
done,
|
|
510
|
+
activeRequestId: this.resumableStream.activeRequestId,
|
|
511
|
+
pending: [...this.pendingResumeConnections],
|
|
512
|
+
connections: Array.from(this.getConnections(), ({ id }) => id),
|
|
513
|
+
});
|
|
495
514
|
this.broadcast(
|
|
496
515
|
json({
|
|
497
516
|
type: MessageType.CF_AGENT_USE_CHAT_RESPONSE,
|
package/src/pi/tool/schedule.ts
CHANGED
|
@@ -94,7 +94,10 @@ function result<T>(details: T): AgentToolResult<T> {
|
|
|
94
94
|
function candidate<T extends TSchema>(
|
|
95
95
|
tool: AgentTool<T>,
|
|
96
96
|
options: Partial<
|
|
97
|
-
Pick<
|
|
97
|
+
Pick<
|
|
98
|
+
PiToolCandidate,
|
|
99
|
+
"alwaysRequiresApproval" | "owner" | "requiredExecutionLevel" | "summary"
|
|
100
|
+
>
|
|
98
101
|
> = {},
|
|
99
102
|
): PiToolCandidate {
|
|
100
103
|
return {
|
|
@@ -102,6 +105,9 @@ function candidate<T extends TSchema>(
|
|
|
102
105
|
requiredExecutionLevel: options.requiredExecutionLevel ?? "safe",
|
|
103
106
|
source: "action",
|
|
104
107
|
tool,
|
|
108
|
+
...(options.alwaysRequiresApproval
|
|
109
|
+
? { alwaysRequiresApproval: true }
|
|
110
|
+
: {}),
|
|
105
111
|
...(options.summary ? { summary: options.summary } : {}),
|
|
106
112
|
};
|
|
107
113
|
}
|
|
@@ -110,24 +116,30 @@ export function schedulePiToolCandidates(
|
|
|
110
116
|
schedule: RuntimeSchedulePort,
|
|
111
117
|
): PiToolCandidate[] {
|
|
112
118
|
return [
|
|
113
|
-
candidate(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
signal
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
119
|
+
candidate(
|
|
120
|
+
{
|
|
121
|
+
name: "schedule",
|
|
122
|
+
label: "Schedule prompt",
|
|
123
|
+
description:
|
|
124
|
+
"Schedule a prompt to run LATER, autonomously. Use when the user asks to be reminded, or to run something after a delay / at a time / on a recurring basis. The user always reviews the proposed schedule before it is created. The scheduled prompt runs in its own dedicated session at each trigger with NO memory of this conversation, so phrase `prompt` as a fully standalone instruction. After scheduling, tell the user what you set.",
|
|
125
|
+
parameters: scheduleParameters,
|
|
126
|
+
async execute(_toolCallId, input, signal) {
|
|
127
|
+
signal?.throwIfAborted();
|
|
128
|
+
const spec: ScheduleSpec = {
|
|
129
|
+
trigger: input.trigger,
|
|
130
|
+
job: { kind: "prompt", prompt: input.prompt },
|
|
131
|
+
label: input.label,
|
|
132
|
+
...(input.timezone ? { tz: input.timezone } : {}),
|
|
133
|
+
};
|
|
134
|
+
const { id } = await schedule.create(spec);
|
|
135
|
+
return result({ scheduled: true, id });
|
|
136
|
+
},
|
|
129
137
|
},
|
|
130
|
-
|
|
138
|
+
{
|
|
139
|
+
alwaysRequiresApproval: true,
|
|
140
|
+
summary: "Create a scheduled task",
|
|
141
|
+
},
|
|
142
|
+
),
|
|
131
143
|
candidate({
|
|
132
144
|
name: "list_schedules",
|
|
133
145
|
label: "List schedules",
|