You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/junior/src/chat/prompt.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -326,7 +326,7 @@ const TOOL_POLICY_RULES = [
326
326
"- If a sandbox-backed tool reports that sandbox execution is unavailable, treat that as a blocker for local file/shell inspection; do not pretend host files were inspected.",
327
327
"- For user-provided URLs, use `webFetch`; for discovery, use `webSearch` then fetch/read promising sources; for current time/date context, use `systemTime`.",
328
328
"- When a tool result includes a subscribable resource, use resource-event subscriptions for high-signal provider changes that serve the user's current intent; do not create scheduled polling tasks for events the subscription can deliver. Use the suggested events when they fit and write a concise intent summary.",
329
-
"- Use event tasks when the user wants a durable instruction to dispatch whenever registered resource events occur. When the resource and events are known, create a directly requested event task without redundant confirmation.",
329
+
"- Use event tasks only when the user explicitly asks for an event task or durable automated work whenever registered resource events occur. Ordinary requests to watch a resource and report relevant updates use resource-event subscriptions. When an event task's resource and events are known, create it without redundant confirmation.",
330
330
"- Event tasks use system credentials by default. If the user denies creator credential use, use system mode without asking. Conditional or tentative credential language is not authorization; when the task depends on creator credentials, ask before creating or updating it and enable creator mode only after explicit authorization for future use.",
331
331
"- For code changes, debugging or root-cause analysis, broad refactors, and software architecture decisions, use `handoff` before substantive analysis only when it offers a profile that better matches the task. Do not switch merely because the task involves code.",
332
332
"- Run `jr-rpc config get|set|unset|list` for provider defaults and `jr-rpc plugins list` for installed plugin introspection as standalone bash commands; do not chain them with `cd`, `&&`, pipes, or provider commands.",
Copy file name to clipboardExpand all lines: packages/junior/src/chat/tools/event-tasks.ts
+44-25Lines changed: 44 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -3,9 +3,10 @@ import { z } from "zod";
3
3
import{getDb}from"@/chat/db";
4
4
import{
5
5
createEventTask,
6
+
deleteActiveEventTask,
6
7
getEventTask,
7
8
listEventTasksForTeam,
8
-
saveEventTask,
9
+
updateActiveEventTask,
9
10
}from"@/chat/event-tasks/store";
10
11
importtype{
11
12
EventTask,
@@ -22,11 +23,11 @@ const MAX_LISTED_TASKS = 50;
22
23
23
24
consttriggerSchema=z
24
25
.object({
25
-
provider: z.string().min(1),
26
-
resourceRef: z.string().min(1),
27
-
resourceType: z.string().min(1),
28
-
label: z.string().min(1),
29
-
events: z.array(z.string().min(1)).min(1),
26
+
provider: z.string().trim().min(1),
27
+
resourceRef: z.string().trim().min(1),
28
+
resourceType: z.string().trim().min(1),
29
+
label: z.string().trim().min(1),
30
+
events: z.array(z.string().trim().min(1)).min(1),
30
31
})
31
32
.strict();
32
33
@@ -139,6 +140,10 @@ function cleanEvents(events: string[]): string[] {
139
140
returnclean;
140
141
}
141
142
143
+
functionnextUpdatedAtMs(task: EventTask): number{
144
+
returnMath.max(Date.now(),task.updatedAtMs+1);
145
+
}
146
+
142
147
functioncompactTask(task: EventTask){
143
148
return{
144
149
id: task.id,
@@ -174,10 +179,10 @@ export function createEventTaskTool(context: ToolRuntimeContext) {
174
179
},
175
180
executionMode: "sequential",
176
181
description:
177
-
"Create a durable Junior task when the user asks for work on registered events from a subscribable provider resource. Copy the provider, resource ref, type, label, and supported event names from the provider tool result; do not ask for redundant confirmation when those details are known.",
182
+
"Create a durable reactive Junior task only when the user explicitly asks for an event task or automated work whenever registered provider events occur. Ordinary requests to watch a resource and report relevant updates use resource-event subscriptions instead. Copy the provider, resource ref, type, label, and supported event names from the provider tool result; do not ask for redundant confirmation when those details are known.",
178
183
inputSchema: z
179
184
.object({
180
-
task: z.string().min(1).max(4000),
185
+
task: z.string().trim().min(1).max(4000),
181
186
trigger: triggerSchema,
182
187
credentialMode: z
183
188
.enum(["system","creator"])
@@ -221,12 +226,12 @@ export function createEventTaskTool(context: ToolRuntimeContext) {
221
226
destination,
222
227
originalRequest: context.userText,
223
228
status: "active",
224
-
task: {text: input.task.trim()},
229
+
task: {text: input.task},
225
230
trigger: {
226
-
provider: input.trigger.provider.trim(),
227
-
resourceRef: input.trigger.resourceRef.trim(),
228
-
resourceType: input.trigger.resourceType.trim(),
229
-
label: input.trigger.label.trim(),
231
+
provider: input.trigger.provider,
232
+
resourceRef: input.trigger.resourceRef,
233
+
resourceType: input.trigger.resourceType,
234
+
label: input.trigger.label,
230
235
events: cleanEvents(input.trigger.events),
231
236
},
232
237
updatedAtMs: nowMs,
@@ -283,7 +288,7 @@ export function createUpdateEventTaskTool(context: ToolRuntimeContext) {
0 commit comments