oc-tweaks 0.6.0 → 0.7.0
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 +56 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -289,12 +289,50 @@ Only use \`run_in_background=false\` when ALL of these conditions are met:
|
|
|
289
289
|
3. The user is explicitly waiting for that specific result
|
|
290
290
|
|
|
291
291
|
When in doubt → background. Use \`background_output()\` to collect results later.
|
|
292
|
+
|
|
293
|
+
## Description Transparency Rule
|
|
294
|
+
|
|
295
|
+
Every \`task()\` call MUST include an agent label in the \`description\` field so the user can see which mode you used.
|
|
296
|
+
|
|
297
|
+
Required formats:
|
|
298
|
+
- \`[category:xxx]\` when using \`category\`
|
|
299
|
+
- \`[subagent:xxx]\` when using \`subagent_type\`
|
|
300
|
+
|
|
301
|
+
Examples:
|
|
302
|
+
- \`description="[category:quick] Fix typo in config"\`
|
|
303
|
+
- \`description="[subagent:explore] Inspect auth flow"\`
|
|
304
|
+
|
|
305
|
+
Do NOT omit the tag.
|
|
292
306
|
`;
|
|
293
307
|
var VIOLATION_WARNING = `\uD83D\uDCA1 [Reminder] Consider using background mode for better responsiveness.
|
|
294
308
|
You used foreground mode (run_in_background=false). Check the three conditions in the system prompt.
|
|
295
309
|
If not all three are met, consider run_in_background=true + background_output() for next time.`;
|
|
310
|
+
function getMissingTransparencyTags(args) {
|
|
311
|
+
const description = args?.description ?? "";
|
|
312
|
+
const missingTags = [];
|
|
313
|
+
if (args?.category) {
|
|
314
|
+
const tag = `[category:${args.category}]`;
|
|
315
|
+
if (!description.includes(tag))
|
|
316
|
+
missingTags.push(tag);
|
|
317
|
+
}
|
|
318
|
+
if (args?.subagent_type) {
|
|
319
|
+
const tag = `[subagent:${args.subagent_type}]`;
|
|
320
|
+
if (!description.includes(tag))
|
|
321
|
+
missingTags.push(tag);
|
|
322
|
+
}
|
|
323
|
+
return missingTags;
|
|
324
|
+
}
|
|
325
|
+
function buildTransparencyWarning(missingTags) {
|
|
326
|
+
const plural = missingTags.length > 1 ? "s" : "";
|
|
327
|
+
return `⚠️ [Transparency] Your task description is missing the required transparency tag${plural}: ${missingTags.join(", ")}
|
|
328
|
+
Add the tag directly to \`description\` so the user can see which agent mode you used.
|
|
329
|
+
Required formats:
|
|
330
|
+
- \`[category:xxx]\`
|
|
331
|
+
- \`[subagent:xxx]\``;
|
|
332
|
+
}
|
|
296
333
|
var backgroundSubagentPlugin = async () => {
|
|
297
334
|
const foregroundCalls = new Set;
|
|
335
|
+
const transparencyViolations = new Map;
|
|
298
336
|
return {
|
|
299
337
|
"experimental.chat.system.transform": safeHook("background-subagent:system.transform", async (_input, output) => {
|
|
300
338
|
const config = await loadOcTweaksConfig();
|
|
@@ -308,17 +346,32 @@ var backgroundSubagentPlugin = async () => {
|
|
|
308
346
|
return;
|
|
309
347
|
if (input.tool !== "task")
|
|
310
348
|
return;
|
|
349
|
+
const missingTags = getMissingTransparencyTags(output.args);
|
|
350
|
+
if (missingTags.length > 0) {
|
|
351
|
+
transparencyViolations.set(input.callID, missingTags);
|
|
352
|
+
}
|
|
311
353
|
if (!output.args?.run_in_background) {
|
|
312
354
|
foregroundCalls.add(input.callID);
|
|
313
355
|
}
|
|
314
356
|
}),
|
|
315
357
|
"tool.execute.after": safeHook("background-subagent:tool.execute.after", async (input, output) => {
|
|
316
|
-
|
|
358
|
+
const warnings = [];
|
|
359
|
+
if (foregroundCalls.has(input.callID)) {
|
|
360
|
+
foregroundCalls.delete(input.callID);
|
|
361
|
+
warnings.push(VIOLATION_WARNING);
|
|
362
|
+
}
|
|
363
|
+
const missingTags = transparencyViolations.get(input.callID);
|
|
364
|
+
if (missingTags) {
|
|
365
|
+
transparencyViolations.delete(input.callID);
|
|
366
|
+
warnings.push(buildTransparencyWarning(missingTags));
|
|
367
|
+
}
|
|
368
|
+
if (warnings.length === 0)
|
|
317
369
|
return;
|
|
318
|
-
foregroundCalls.delete(input.callID);
|
|
319
370
|
output.output += `
|
|
320
371
|
|
|
321
|
-
${
|
|
372
|
+
${warnings.join(`
|
|
373
|
+
|
|
374
|
+
`)}`;
|
|
322
375
|
})
|
|
323
376
|
};
|
|
324
377
|
};
|