zenox 1.4.1 → 1.4.3
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.
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export { BackgroundManager } from "./manager";
|
|
7
7
|
export { createBackgroundTools, type BackgroundTools } from "./tools";
|
|
8
|
-
export type { BackgroundTask, TaskStatus, LaunchInput, CompletionNotification, } from "./types";
|
|
8
|
+
export type { BackgroundTask, TaskStatus, LaunchInput, CompletionNotification, ParentModel, } from "./types";
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
* Minimal interfaces for fire-and-forget parallel agent execution
|
|
4
4
|
*/
|
|
5
5
|
export type TaskStatus = "running" | "completed" | "failed" | "cancelled";
|
|
6
|
+
export interface ParentModel {
|
|
7
|
+
providerID: string;
|
|
8
|
+
modelID: string;
|
|
9
|
+
}
|
|
6
10
|
export interface BackgroundTask {
|
|
7
11
|
id: string;
|
|
8
12
|
sessionID: string;
|
|
@@ -14,6 +18,7 @@ export interface BackgroundTask {
|
|
|
14
18
|
completedAt?: Date;
|
|
15
19
|
error?: string;
|
|
16
20
|
parentAgent?: string;
|
|
21
|
+
parentModel?: ParentModel;
|
|
17
22
|
}
|
|
18
23
|
export interface LaunchInput {
|
|
19
24
|
agent: string;
|
|
@@ -21,6 +26,7 @@ export interface LaunchInput {
|
|
|
21
26
|
description: string;
|
|
22
27
|
parentSessionID: string;
|
|
23
28
|
parentAgent?: string;
|
|
29
|
+
parentModel?: ParentModel;
|
|
24
30
|
}
|
|
25
31
|
export interface CompletionNotification {
|
|
26
32
|
allComplete: boolean;
|
|
@@ -28,4 +34,5 @@ export interface CompletionNotification {
|
|
|
28
34
|
completedTasks: BackgroundTask[];
|
|
29
35
|
runningCount: number;
|
|
30
36
|
parentAgent?: string;
|
|
37
|
+
parentModel?: ParentModel;
|
|
31
38
|
}
|
package/dist/index.js
CHANGED
|
@@ -823,6 +823,49 @@ The system automatically reminds you if you go idle with incomplete tasks.
|
|
|
823
823
|
- The session goes idle
|
|
824
824
|
- There's been sufficient time since the last reminder
|
|
825
825
|
`;
|
|
826
|
+
function getOrchestrationPrompt(agent) {
|
|
827
|
+
switch (agent) {
|
|
828
|
+
case "build":
|
|
829
|
+
return ORCHESTRATION_PROMPT;
|
|
830
|
+
case "plan":
|
|
831
|
+
return ORCHESTRATION_PROMPT;
|
|
832
|
+
default:
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
// src/orchestration/session-agent-tracker.ts
|
|
838
|
+
var sessionContextMap = new Map;
|
|
839
|
+
function setSessionContext(sessionID, context) {
|
|
840
|
+
const existing = sessionContextMap.get(sessionID) ?? {};
|
|
841
|
+
sessionContextMap.set(sessionID, {
|
|
842
|
+
agent: context.agent ?? existing.agent,
|
|
843
|
+
model: context.model ?? existing.model
|
|
844
|
+
});
|
|
845
|
+
}
|
|
846
|
+
function getSessionContext(sessionID) {
|
|
847
|
+
return sessionContextMap.get(sessionID);
|
|
848
|
+
}
|
|
849
|
+
function getSessionAgent(sessionID) {
|
|
850
|
+
return sessionContextMap.get(sessionID)?.agent;
|
|
851
|
+
}
|
|
852
|
+
function getSessionModel(sessionID) {
|
|
853
|
+
return sessionContextMap.get(sessionID)?.model;
|
|
854
|
+
}
|
|
855
|
+
function clearSessionAgent(sessionID) {
|
|
856
|
+
if (sessionID) {
|
|
857
|
+
sessionContextMap.delete(sessionID);
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
function getOrchestrationAgentType(agent) {
|
|
861
|
+
if (agent === "build")
|
|
862
|
+
return "build";
|
|
863
|
+
if (agent === "plan")
|
|
864
|
+
return "plan";
|
|
865
|
+
if (agent === undefined)
|
|
866
|
+
return;
|
|
867
|
+
return agent;
|
|
868
|
+
}
|
|
826
869
|
|
|
827
870
|
// node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js
|
|
828
871
|
var exports_external = {};
|
|
@@ -4960,7 +5003,8 @@ class BackgroundManager {
|
|
|
4960
5003
|
prompt: input.prompt,
|
|
4961
5004
|
status: "running",
|
|
4962
5005
|
startedAt: new Date,
|
|
4963
|
-
parentAgent: input.parentAgent
|
|
5006
|
+
parentAgent: input.parentAgent,
|
|
5007
|
+
parentModel: input.parentModel
|
|
4964
5008
|
};
|
|
4965
5009
|
this.tasks.set(task.id, task);
|
|
4966
5010
|
if (this.toastManager) {
|
|
@@ -5099,12 +5143,14 @@ ${runningTasks.length} task(s) still running. Continue working.
|
|
|
5099
5143
|
</system-reminder>`;
|
|
5100
5144
|
}
|
|
5101
5145
|
const parentAgent = completedTasks[0]?.parentAgent;
|
|
5146
|
+
const parentModel = completedTasks[0]?.parentModel;
|
|
5102
5147
|
return {
|
|
5103
5148
|
allComplete,
|
|
5104
5149
|
message,
|
|
5105
5150
|
completedTasks,
|
|
5106
5151
|
runningCount: runningTasks.length,
|
|
5107
|
-
parentAgent
|
|
5152
|
+
parentAgent,
|
|
5153
|
+
parentModel
|
|
5108
5154
|
};
|
|
5109
5155
|
}
|
|
5110
5156
|
listActiveTasks() {
|
|
@@ -17455,12 +17501,14 @@ Use for independent research tasks that benefit from parallelism.`,
|
|
|
17455
17501
|
},
|
|
17456
17502
|
async execute(args, context) {
|
|
17457
17503
|
try {
|
|
17504
|
+
const parentModel = getSessionModel(context.sessionID);
|
|
17458
17505
|
const task = await manager.launch(client, {
|
|
17459
17506
|
agent: args.agent,
|
|
17460
17507
|
description: args.description,
|
|
17461
17508
|
prompt: args.prompt,
|
|
17462
17509
|
parentSessionID: context.sessionID,
|
|
17463
|
-
parentAgent: context.agent
|
|
17510
|
+
parentAgent: context.agent,
|
|
17511
|
+
parentModel
|
|
17464
17512
|
});
|
|
17465
17513
|
const activeTasks = manager.listActiveTasks();
|
|
17466
17514
|
return `Background task launched successfully.
|
|
@@ -17895,12 +17943,15 @@ Current incomplete tasks:
|
|
|
17895
17943
|
${todoList}
|
|
17896
17944
|
|
|
17897
17945
|
${statusLine}`;
|
|
17898
|
-
const
|
|
17946
|
+
const sessionContext = getSessionContext(sessionID);
|
|
17947
|
+
const model = sessionContext?.model;
|
|
17948
|
+
const sendPrompt = async (omitContext = false) => {
|
|
17899
17949
|
await ctx.client.session.prompt({
|
|
17900
17950
|
path: { id: sessionID },
|
|
17901
17951
|
body: {
|
|
17902
17952
|
noReply: false,
|
|
17903
|
-
...
|
|
17953
|
+
...omitContext || !agent ? {} : { agent },
|
|
17954
|
+
...omitContext || !model ? {} : { model },
|
|
17904
17955
|
parts: [{ type: "text", text: prompt }]
|
|
17905
17956
|
}
|
|
17906
17957
|
});
|
|
@@ -17909,7 +17960,7 @@ ${statusLine}`;
|
|
|
17909
17960
|
await sendPrompt();
|
|
17910
17961
|
} catch (err) {
|
|
17911
17962
|
const errorMsg = err instanceof Error ? err.message : String(err);
|
|
17912
|
-
if (errorMsg.includes("agent") || errorMsg.includes("undefined")) {
|
|
17963
|
+
if (errorMsg.includes("agent") || errorMsg.includes("model") || errorMsg.includes("undefined")) {
|
|
17913
17964
|
try {
|
|
17914
17965
|
await sendPrompt(true);
|
|
17915
17966
|
} catch {
|
|
@@ -18314,6 +18365,7 @@ var ZenoxPlugin = async (ctx) => {
|
|
|
18314
18365
|
...codeIntelligenceTools
|
|
18315
18366
|
},
|
|
18316
18367
|
"chat.message": async (input, output) => {
|
|
18368
|
+
setSessionContext(input.sessionID, { agent: input.agent, model: input.model });
|
|
18317
18369
|
const message = output.message;
|
|
18318
18370
|
if (firstMessageVariantGate.shouldOverride(input.sessionID)) {
|
|
18319
18371
|
const variant = resolveAgentVariant(pluginConfig, input.agent);
|
|
@@ -18326,6 +18378,17 @@ var ZenoxPlugin = async (ctx) => {
|
|
|
18326
18378
|
}
|
|
18327
18379
|
await keywordDetectorHook["chat.message"]?.(input, output);
|
|
18328
18380
|
},
|
|
18381
|
+
"experimental.chat.system.transform": async (input, output) => {
|
|
18382
|
+
const { sessionID } = input;
|
|
18383
|
+
if (!sessionID)
|
|
18384
|
+
return;
|
|
18385
|
+
const agent = getSessionAgent(sessionID);
|
|
18386
|
+
const agentType = getOrchestrationAgentType(agent);
|
|
18387
|
+
const prompt = getOrchestrationPrompt(agentType);
|
|
18388
|
+
if (prompt) {
|
|
18389
|
+
output.system.push(prompt);
|
|
18390
|
+
}
|
|
18391
|
+
},
|
|
18329
18392
|
event: async (input) => {
|
|
18330
18393
|
const { event } = input;
|
|
18331
18394
|
await autoUpdateHook.event(input);
|
|
@@ -18341,6 +18404,7 @@ var ZenoxPlugin = async (ctx) => {
|
|
|
18341
18404
|
const props = event.properties;
|
|
18342
18405
|
const sessionID = props?.info?.id;
|
|
18343
18406
|
firstMessageVariantGate.clear(sessionID);
|
|
18407
|
+
clearSessionAgent(sessionID);
|
|
18344
18408
|
if (sessionID && sessionID === backgroundManager.getMainSession()) {
|
|
18345
18409
|
backgroundManager.setMainSession(undefined);
|
|
18346
18410
|
}
|
|
@@ -18354,19 +18418,20 @@ var ZenoxPlugin = async (ctx) => {
|
|
|
18354
18418
|
if (notification) {
|
|
18355
18419
|
const mainSessionID = backgroundManager.getMainSession();
|
|
18356
18420
|
if (mainSessionID) {
|
|
18357
|
-
const sendNotification = async (
|
|
18421
|
+
const sendNotification = async (omitContext = false) => {
|
|
18358
18422
|
try {
|
|
18359
18423
|
await ctx.client.session.prompt({
|
|
18360
18424
|
path: { id: mainSessionID },
|
|
18361
18425
|
body: {
|
|
18362
18426
|
noReply: !notification.allComplete,
|
|
18363
|
-
...
|
|
18427
|
+
...omitContext ? {} : { agent: notification.parentAgent },
|
|
18428
|
+
...omitContext ? {} : { model: notification.parentModel },
|
|
18364
18429
|
parts: [{ type: "text", text: notification.message }]
|
|
18365
18430
|
}
|
|
18366
18431
|
});
|
|
18367
18432
|
} catch (err) {
|
|
18368
18433
|
const errorMsg = err instanceof Error ? err.message : String(err);
|
|
18369
|
-
if (!
|
|
18434
|
+
if (!omitContext && (errorMsg.includes("agent") || errorMsg.includes("model") || errorMsg.includes("undefined"))) {
|
|
18370
18435
|
return sendNotification(true);
|
|
18371
18436
|
}
|
|
18372
18437
|
}
|
|
@@ -18392,14 +18457,6 @@ var ZenoxPlugin = async (ctx) => {
|
|
|
18392
18457
|
if (!disabledAgents.has("ui-planner")) {
|
|
18393
18458
|
config2.agent["ui-planner"] = applyModelOverride("ui-planner", uiPlannerAgent);
|
|
18394
18459
|
}
|
|
18395
|
-
if (config2.agent.build) {
|
|
18396
|
-
const existingPrompt = config2.agent.build.prompt ?? "";
|
|
18397
|
-
config2.agent.build.prompt = existingPrompt + ORCHESTRATION_PROMPT;
|
|
18398
|
-
}
|
|
18399
|
-
if (config2.agent.plan) {
|
|
18400
|
-
const existingPrompt = config2.agent.plan.prompt ?? "";
|
|
18401
|
-
config2.agent.plan.prompt = existingPrompt + ORCHESTRATION_PROMPT;
|
|
18402
|
-
}
|
|
18403
18460
|
const builtinMcps = createBuiltinMcps(disabledMcps);
|
|
18404
18461
|
config2.mcp = {
|
|
18405
18462
|
...config2.mcp,
|
|
@@ -3,3 +3,4 @@
|
|
|
3
3
|
* This teaches the primary agents how to delegate to specialized subagents using the Task tool.
|
|
4
4
|
*/
|
|
5
5
|
export declare const ORCHESTRATION_PROMPT = "\n\n---\n\n## Sub-Agent Delegation\n\nYou have specialized subagents. Use the **Task tool** to delegate work proactively.\n\n### Available Agents\n\n| Agent | Use For | subagent_type |\n|-------|---------|---------------|\n| **Explorer** | Codebase grep - fast pattern matching, \"Where is X?\" | `explorer` |\n| **Librarian** | External grep - docs, GitHub, OSS examples | `librarian` |\n| **Oracle** | Strategic advisor - architecture, debugging, decisions | `oracle` |\n| **UI Planner** | Designer-developer - visual design, CSS, animations | `ui-planner` |\n\n### Quick Rule: Background vs Synchronous\n\n| Agent | Default Execution | Why |\n|-------|-------------------|-----|\n| Explorer | `background_task` | It's codebase grep - fire and continue |\n| Librarian | `background_task` | It's external grep - fire and continue |\n| Oracle | `Task` (sync) | Need strategic answer before proceeding |\n| UI Planner | `Task` (sync) | Implements changes, needs write access |\n\n**Mental Model**: Explorer & Librarian = **grep commands**. You don't wait for grep, you fire it and continue thinking.\n\n### When to Delegate (Fire Immediately)\n\n| Trigger | subagent_type | Why |\n|---------|---------------|-----|\n| \"Where is X?\", \"Find Y\", locate code | `explorer` | Fast codebase search |\n| External library, \"how does X library work?\" | `librarian` | Searches docs, GitHub, OSS |\n| 2+ modules involved, cross-cutting concerns | `explorer` | Multi-file pattern discovery |\n| Architecture decision, \"should I use X or Y?\" | `oracle` | Deep reasoning advisor |\n| Visual/styling, CSS, animations, UI/UX | `ui-planner` | Designer-developer hybrid |\n| After 2+ failed fix attempts | `oracle` | Debugging escalation |\n\n### How to Delegate\n\nUse the Task tool with these parameters:\n\n```\nTask(\n subagent_type: \"explorer\" | \"librarian\" | \"oracle\" | \"ui-planner\",\n description: \"Short 3-5 word task description\",\n prompt: \"Detailed instructions for the agent\"\n)\n```\n\n**Example delegations:**\n\n```\n// Find code in codebase\nTask(\n subagent_type: \"explorer\",\n description: \"Find auth middleware\",\n prompt: \"Find all authentication middleware implementations in this codebase. Return file paths and explain the auth flow.\"\n)\n\n// Research external library\nTask(\n subagent_type: \"librarian\",\n description: \"React Query caching docs\",\n prompt: \"How does React Query handle caching? Find official documentation and real-world examples with GitHub permalinks.\"\n)\n\n// Architecture decision\nTask(\n subagent_type: \"oracle\",\n description: \"Redux vs Zustand analysis\",\n prompt: \"Analyze trade-offs between Redux and Zustand for this project. Consider bundle size, learning curve, and our existing patterns.\"\n)\n\n// UI/Visual work\nTask(\n subagent_type: \"ui-planner\",\n description: \"Redesign dashboard cards\",\n prompt: \"Redesign the dashboard stat cards to be more visually appealing. Use modern aesthetics, subtle animations, and ensure responsive design.\"\n)\n```\n\n### Parallel Execution\n\nTo run multiple agents in parallel, call multiple Task tools in the **same response message**:\n\n```\n// CORRECT: Multiple Task calls in ONE message = parallel execution\nTask(subagent_type: \"explorer\", description: \"Find auth code\", prompt: \"...\")\nTask(subagent_type: \"librarian\", description: \"JWT best practices\", prompt: \"...\")\n// Both run simultaneously\n\n// WRONG: One Task per message = sequential (slow)\nMessage 1: Task(...) \u2192 wait for result\nMessage 2: Task(...) \u2192 wait for result\n```\n\n### Delegation Priority\n\n1. **Explorer FIRST** \u2014 Always locate code before modifying unfamiliar areas\n2. **Librarian** \u2014 When dealing with external libraries/APIs you don't fully understand\n3. **Oracle** \u2014 For complex decisions or after 2+ failed fix attempts\n4. **UI Planner** \u2014 For ANY visual/styling work (never edit CSS/UI yourself)\n\n### Critical Rules\n\n1. **Never touch frontend visual/styling code yourself** \u2014 Always delegate to `ui-planner`\n2. **Fire librarian proactively** when unfamiliar libraries are involved\n3. **Consult oracle BEFORE major architectural decisions**, not after\n4. **Verify delegated work** before marking task complete\n\n### When to Handle Directly (Don't Delegate)\n\n- Single file edits with known location\n- Questions answerable from code already in context\n- Trivial changes requiring no specialist knowledge\n- Tasks you can complete faster than explaining to an agent\n\n---\n\n## Background Tasks (Parallel Research)\n\nFor **independent research tasks** that benefit from parallelism, use background tasks instead of sequential Task calls.\n\n### When to Use Background Tasks\n\n| Scenario | Use Background Tasks |\n|----------|---------------------|\n| User wants \"comprehensive\" / \"thorough\" / \"deep\" exploration | YES - fire 3-4 agents in parallel |\n| Need BOTH codebase search AND external docs | YES - explore + librarian in parallel |\n| Exploring multiple modules/features simultaneously | YES - separate explore for each |\n| Result of Task A needed before Task B | NO - use sequential Task |\n| Single focused lookup | NO - just use Task directly |\n\n### How Background Tasks Work\n\n1. **Fire**: Launch multiple agents with `background_task` - they run in parallel\n2. **Continue**: Keep working while background agents search\n3. **Notify**: You'll be notified when ALL background tasks complete\n4. **Retrieve**: Use `background_output` to get each result\n\n### Usage\n\n```\n// Launch parallel research (all run simultaneously)\nbackground_task(agent=\"explorer\", description=\"Find auth code\", prompt=\"Search for authentication...\")\nbackground_task(agent=\"explorer\", description=\"Find db layer\", prompt=\"Search for database/ORM...\")\nbackground_task(agent=\"librarian\", description=\"Best practices\", prompt=\"Find framework best practices...\")\n\n// Continue working on other things while they run...\n\n// [NOTIFICATION: All background tasks complete!]\n\n// Retrieve results\nbackground_output(task_id=\"bg_abc123\")\nbackground_output(task_id=\"bg_def456\")\nbackground_output(task_id=\"bg_ghi789\")\n```\n\n### Background Tasks vs Task Tool\n\n| Aspect | Task Tool | Background Tasks |\n|--------|-----------|------------------|\n| Execution | Sequential (waits for result) | Parallel (fire-and-forget) |\n| Best for | Dependent tasks, immediate needs | Independent research, breadth |\n| Result | Inline, immediate | Retrieved later via background_output |\n\n### Key Insight\n\n- **Task** = Use when you need the result immediately before proceeding\n- **Background** = Use when researching multiple angles independently\n\n**Both tools coexist - choose based on whether tasks are dependent or independent.**\n\n### The Parallel Research Pattern\n\nFor complex tasks, fire research first, then continue working:\n\n```\n// 1. FIRE parallel research (don't wait!)\nbackground_task(agent=\"explorer\", description=\"Find existing patterns\", prompt=\"...\")\nbackground_task(agent=\"librarian\", description=\"Find best practices\", prompt=\"...\")\n\n// 2. CONTINUE productive work while they run:\n// - Plan your implementation approach\n// - Read files you already know about\n// - Identify edge cases and questions\n\n// 3. When notified \u2192 RETRIEVE and synthesize\nbackground_output(task_id=\"bg_xxx\")\nbackground_output(task_id=\"bg_yyy\")\n```\n\n**Anti-pattern**: Firing background tasks then doing nothing. Always continue productive work!\n\n---\n\n## Keyword Triggers (Power User)\n\nInclude these keywords in your prompt to unlock special modes:\n\n| Keyword | Effect |\n|---------|--------|\n| `ultrawork` or `ulw` | Maximum multi-agent coordination - aggressive parallel research |\n| `deep research` | Comprehensive exploration - fires 3-4 background agents |\n| `explore codebase` | Codebase mapping - multiple explorers in parallel |\n\n---\n\n## Session History Tools\n\nYou have tools to learn from past work sessions:\n\n| Tool | Use For |\n|------|---------|\n| `session_list` | List recent sessions to find relevant past work |\n| `session_search` | Search messages across sessions for how something was done |\n\n### When to Use Session Tools\n\n- **Before implementing unfamiliar features** \u2014 search if done before\n- **When user says \"like before\" or \"last time\"** \u2014 find that session\n- **When debugging** \u2014 check if similar issues were solved previously\n- **For context on ongoing projects** \u2014 understand recent work history\n\n### Example Usage\n\n```\n// Find how authentication was implemented before\nsession_search({ query: \"JWT authentication\" })\n\n// List recent sessions to understand project context\nsession_list({ limit: 5 })\n\n// Find past implementations of a feature\nsession_search({ query: \"rate limiting\" })\n```\n\n---\n\n## Code Intelligence Tools\n\nYou have tools to understand code structure via LSP:\n\n| Tool | Use For |\n|------|---------|\n| `find_symbols` | Search for functions, classes, variables by name |\n| `lsp_status` | Check which language servers are running |\n\n### When to Use Code Intelligence\n\n- **Before editing code** \u2014 find the symbol's definition location\n- **When refactoring** \u2014 search for related symbols\n- **To understand project structure** \u2014 search for key symbols like \"auth\", \"user\", \"api\"\n- **To verify LSP availability** \u2014 check if code intelligence is working\n\n### Example Usage\n\n```\n// Find all auth-related functions/classes\nfind_symbols({ query: \"auth\" })\n\n// Find a specific function\nfind_symbols({ query: \"handleLogin\" })\n\n// Check LSP server status\nlsp_status()\n```\n\n---\n\n## Todo Continuation\n\nThe system automatically reminds you if you go idle with incomplete tasks.\n\n**Best Practices:**\n- Keep your todo list updated with `TodoWrite`\n- Mark tasks complete immediately when finished\n- Use clear, actionable task descriptions\n- The system will prompt you to continue if tasks remain incomplete\n\n**Note:** You don't need to invoke the todo enforcer \u2014 it runs automatically when:\n- You have pending or in-progress todos\n- The session goes idle\n- There's been sufficient time since the last reminder\n";
|
|
6
|
+
export declare function getOrchestrationPrompt(agent: "build" | "plan" | string | undefined): string | undefined;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session Context Tracker
|
|
3
|
+
*
|
|
4
|
+
* Tracks agent and model context for each session, allowing:
|
|
5
|
+
* - System transform hook to inject agent-specific prompts
|
|
6
|
+
* - Todo enforcer and background tasks to preserve model context
|
|
7
|
+
*
|
|
8
|
+
* Flow:
|
|
9
|
+
* 1. chat.message hook fires with { sessionID, agent, model }
|
|
10
|
+
* 2. We store the mapping: sessionID -> { agent, model }
|
|
11
|
+
* 3. experimental.chat.system.transform fires with { sessionID }
|
|
12
|
+
* 4. We look up the context and inject the appropriate prompt
|
|
13
|
+
* 5. Todo enforcer / background tasks use model context when sending prompts
|
|
14
|
+
*/
|
|
15
|
+
export interface SessionModel {
|
|
16
|
+
providerID: string;
|
|
17
|
+
modelID: string;
|
|
18
|
+
}
|
|
19
|
+
export interface SessionContext {
|
|
20
|
+
agent?: string;
|
|
21
|
+
model?: SessionModel;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Record context (agent + model) for a session.
|
|
25
|
+
* Called from chat.message hook.
|
|
26
|
+
*/
|
|
27
|
+
export declare function setSessionContext(sessionID: string, context: {
|
|
28
|
+
agent?: string;
|
|
29
|
+
model?: SessionModel;
|
|
30
|
+
}): void;
|
|
31
|
+
/**
|
|
32
|
+
* Get the full context for a session.
|
|
33
|
+
*/
|
|
34
|
+
export declare function getSessionContext(sessionID: string): SessionContext | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Record which agent is active for a session (legacy helper).
|
|
37
|
+
* Called from chat.message hook.
|
|
38
|
+
*/
|
|
39
|
+
export declare function setSessionAgent(sessionID: string, agent: string | undefined): void;
|
|
40
|
+
/**
|
|
41
|
+
* Get the active agent for a session.
|
|
42
|
+
* Called from experimental.chat.system.transform hook.
|
|
43
|
+
*/
|
|
44
|
+
export declare function getSessionAgent(sessionID: string): string | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Get the active model for a session.
|
|
47
|
+
*/
|
|
48
|
+
export declare function getSessionModel(sessionID: string): SessionModel | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Clear tracking for a session (on deletion).
|
|
51
|
+
*/
|
|
52
|
+
export declare function clearSessionAgent(sessionID: string | undefined): void;
|
|
53
|
+
/**
|
|
54
|
+
* Check if an agent should receive orchestration injection.
|
|
55
|
+
* Only build and plan agents get the orchestration prompt.
|
|
56
|
+
*/
|
|
57
|
+
export declare function shouldInjectOrchestration(agent: string | undefined): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Get the agent type for prompt selection.
|
|
60
|
+
* Returns "build", "plan", or string for other agents.
|
|
61
|
+
*/
|
|
62
|
+
export declare function getOrchestrationAgentType(agent: string | undefined): "build" | "plan" | string | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zenox",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.3",
|
|
4
4
|
"description": "OpenCode plugin with specialized agents (explorer, librarian, oracle, ui-planner), background tasks for parallel execution, and smart orchestration",
|
|
5
5
|
"author": "Ayush",
|
|
6
6
|
"license": "MIT",
|