Skip to content

Commit f3887e5

Browse files
committed
pre-release: agent mode override, placeholder key cleanup, iOS dev team
- agent-panel: accept overrideMode in sendMessage/buildSilentContext - chat-home: remove unnecessary placeholder key prop - tauri.conf.json: add iOS developmentTeam for signing Made-with: Cursor
1 parent a5f487c commit f3887e5

3 files changed

Lines changed: 32 additions & 18 deletions

File tree

components/agent-panel.tsx

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -998,17 +998,20 @@ export function AgentPanel({ onClose }: { onClose?: () => void } = {}) {
998998
}, [contextAttachments, imageAttachments])
999999

10001000
// Follow-up seam: fallback local agent routing (Cursor Agent / Claude Code CLI) should plug in above sendStructuredGatewayMessage, while keeping local repo/docs as the default context source before any remote fetch.
1001-
const buildSilentContext = useCallback(() => {
1002-
const context = buildContext()
1003-
const attachCtx = buildAttachmentContext()
1004-
const modePrefix =
1005-
agentMode === 'ask'
1006-
? '[Mode: Ask — discuss and answer questions. Do not make code changes unless explicitly asked.]\n'
1007-
: agentMode === 'plan'
1008-
? '[Mode: Plan — You MUST respond with a structured plan before making any changes. Format your response as a numbered list where each step has a **bold title** followed by a description and affected files in backticks. Example:\n1. **Update auth module** — Add token refresh logic\n `lib/auth.ts`, `lib/api.ts`\n2. **Add tests** — Cover the new refresh flow\n `tests/auth.test.ts`\nAfter the user approves, execute each step sequentially. Do NOT make changes until approved.]\n'
1009-
: '[Mode: Agent — You are an autonomous coding agent. Make direct code changes without asking for permission. Read files to understand context, edit them to implement changes, run commands to verify your work. After making changes, briefly summarize what you did and which files were modified. If a change fails, diagnose and fix it automatically.]\n'
1010-
return [modePrefix, context || '', attachCtx].filter(Boolean).join('\n\n')
1011-
}, [agentMode, buildAttachmentContext, buildContext])
1001+
const buildSilentContext = useCallback(
1002+
(mode: AgentMode = agentMode) => {
1003+
const context = buildContext()
1004+
const attachCtx = buildAttachmentContext()
1005+
const modePrefix =
1006+
mode === 'ask'
1007+
? '[Mode: Ask — discuss and answer questions. Do not make code changes unless explicitly asked.]\n'
1008+
: mode === 'plan'
1009+
? '[Mode: Plan — You MUST respond with a structured plan before making any changes. Format your response as a numbered list where each step has a **bold title** followed by a description and affected files in backticks. Example:\n1. **Update auth module** — Add token refresh logic\n `lib/auth.ts`, `lib/api.ts`\n2. **Add tests** — Cover the new refresh flow\n `tests/auth.test.ts`\nAfter the user approves, execute each step sequentially. Do NOT make changes until approved.]\n'
1010+
: '[Mode: Agent — You are an autonomous coding agent. Make direct code changes without asking for permission. Read files to understand context, edit them to implement changes, run commands to verify your work. After making changes, briefly summarize what you did and which files were modified. If a change fails, diagnose and fix it automatically.]\n'
1011+
return [modePrefix, context || '', attachCtx].filter(Boolean).join('\n\n')
1012+
},
1013+
[agentMode, buildAttachmentContext, buildContext],
1014+
)
10121015

10131016
// ─── Message helpers ──────────────────────────────────────────
10141017
// parsePlanSteps moved to components/chat/message-list.tsx
@@ -1318,8 +1321,9 @@ export function AgentPanel({ onClose }: { onClose?: () => void } = {}) {
13181321

13191322
// ─── Send message ─────────────────────────────────────────────
13201323
const sendMessage = useCallback(
1321-
async (overrideText?: string) => {
1324+
async (overrideText?: string, overrideMode?: AgentMode) => {
13221325
const text = (overrideText ?? input).trim()
1326+
const effectiveMode = overrideMode ?? agentMode
13231327
if (!text || sending) return
13241328

13251329
// Handle slash commands locally
@@ -1352,7 +1356,7 @@ export function AgentPanel({ onClose }: { onClose?: () => void } = {}) {
13521356

13531357
logChatDebug('send attempt', {
13541358
textLength: text.length,
1355-
mode: agentMode,
1359+
mode: effectiveMode,
13561360
connected: isConnected,
13571361
gatewayStatus: status,
13581362
sessionKey,
@@ -1677,7 +1681,10 @@ export function AgentPanel({ onClose }: { onClose?: () => void } = {}) {
16771681
attachLabels.length > 0
16781682
? `[${attachLabels.join(' · ')}]\n/skill use ${skill.slug} ${request}`
16791683
: `/skill use ${skill.slug} ${request}`
1680-
const outboundMessage = buildGatewayMessage(envelope.prompt, buildSilentContext())
1684+
const outboundMessage = buildGatewayMessage(
1685+
envelope.prompt,
1686+
buildSilentContext(effectiveMode),
1687+
)
16811688
const messageImages =
16821689
imageAttachments.length > 0
16831690
? imageAttachments.map((img) => ({ name: img.name, dataUrl: img.dataUrl }))
@@ -1773,7 +1780,7 @@ export function AgentPanel({ onClose }: { onClose?: () => void } = {}) {
17731780
? imageAttachments.map((img) => ({ name: img.name, dataUrl: img.dataUrl }))
17741781
: undefined
17751782
try {
1776-
const outboundMessage = buildGatewayMessage(text, buildSilentContext())
1783+
const outboundMessage = buildGatewayMessage(text, buildSilentContext(effectiveMode))
17771784
await sendStructuredGatewayMessage({
17781785
displayText,
17791786
outboundMessage,
@@ -1828,6 +1835,13 @@ export function AgentPanel({ onClose }: { onClose?: () => void } = {}) {
18281835
],
18291836
)
18301837

1838+
useEffect(() => {
1839+
return on('agent-send', (detail) => {
1840+
if (detail.mode) setAgentMode(detail.mode)
1841+
void sendMessage(detail.text, detail.mode)
1842+
})
1843+
}, [sendMessage])
1844+
18311845
// ─── Handle ⌘K inline edit requests ────────────────────────────
18321846
useEffect(() => {
18331847
const handler = (detail: {
@@ -2608,7 +2622,7 @@ export function AgentPanel({ onClose }: { onClose?: () => void } = {}) {
26082622
<ChatHome
26092623
onSend={(text, mode) => {
26102624
setAgentMode(mode)
2611-
sendMessage(text)
2625+
sendMessage(text, mode)
26122626
}}
26132627
onSelectFolder={() => emit('open-folder')}
26142628
onCloneRepo={() => emit('open-folder')}

components/chat-home.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,6 @@ export const ChatHome = memo(function ChatHome({
644644
}
645645
aria-label="Chat input"
646646
className="min-h-[48px] max-h-[200px] w-full resize-none overflow-y-auto bg-transparent px-4 pb-2 pt-3.5 text-[14px] leading-[1.65] text-[var(--text-primary)] placeholder:text-[var(--text-disabled)] outline-none placeholder:transition-opacity placeholder:duration-500"
647-
key={placeholderIndex}
648647
/>
649648

650649
{/* Image previews */}

src-tauri/tauri.conf.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
],
4242
"iOS": {
4343
"minimumSystemVersion": "17.0",
44-
"infoPlist": "Info.ios.plist"
44+
"infoPlist": "Info.ios.plist",
45+
"developmentTeam": "9LR8Z8UQ9X"
4546
}
4647
},
4748
"plugins": {}

0 commit comments

Comments
 (0)