mirror of
https://github.com/wu736139669/hapi.git
synced 2026-10-07 19:06:11 +00:00
fix(hub,cli,web): give web-created team sessions their team context at spawn
Root cause of 'lead never answers': sessions created through the web form never received HAPI_TEAM_* env, so their system prompts had no team rules (only spawn_peer-created members did). Now: - /api/machines/:id/spawn accepts a team descriptor; the runner exports the env as before - team mode creates the team first, spawns the lead with the team context, then attaches it as lead; member mode spawns with the team context before joining - OpenCode system prompts (title + native tool instruction) carry the team block too - human ping copy is action-first: reply directly (auto-synced to the group); do not run shell commands or explore the team
This commit is contained in:
@@ -15,6 +15,7 @@ import {
|
||||
} from '@/modules/common/displayImagePrompt';
|
||||
import { SKILL_LOOKUP_INSTRUCTION } from '@/modules/common/skillLookupInstruction';
|
||||
import { withSessionSummaryInstruction } from '@/modules/common/sessionSummaryInstruction';
|
||||
import { withTeamInstruction } from '@/modules/team/teamPrompt';
|
||||
|
||||
/**
|
||||
* Title and display_image / display_video / display_media instructions for OpenCode to call the hapi MCP tools.
|
||||
@@ -30,7 +31,7 @@ export const TITLE_INSTRUCTION = trimIdent(`
|
||||
`);
|
||||
|
||||
export function getTitleInstruction(env: NodeJS.ProcessEnv = process.env): string {
|
||||
return withSessionSummaryInstruction(TITLE_INSTRUCTION, env)
|
||||
return withTeamInstruction(withSessionSummaryInstruction(TITLE_INSTRUCTION, env), 'hapi_', env)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,7 +51,7 @@ export const OPENCODE_NATIVE_TOOL_INSTRUCTION = trimIdent(`
|
||||
`);
|
||||
|
||||
export function getOpencodeNativeToolInstruction(env: NodeJS.ProcessEnv = process.env): string {
|
||||
return withSessionSummaryInstruction(OPENCODE_NATIVE_TOOL_INSTRUCTION, env)
|
||||
return withTeamInstruction(withSessionSummaryInstruction(OPENCODE_NATIVE_TOOL_INSTRUCTION, env), 'hapi_', env)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user