fix: keep question order and streamline contextual help
GoodBuddy Agents / Validate Agent source (push) Canceled after 0s
GoodBuddy Agents / Build darwin arm64 Agent (push) Canceled after 0s
GoodBuddy Agents / Build linux arm64 Agent (push) Canceled after 0s
GoodBuddy Agents / Build linux x64 Agent (push) Canceled after 0s
Cross-platform packages / Validate source (push) Canceled after 0s
Cross-platform packages / Authorize desktop packaging (push) Canceled after 0s
Cross-platform packages / linux arm64 (push) Canceled after 0s
Cross-platform packages / macos arm64 (push) Canceled after 0s
Cross-platform packages / windows arm64 (push) Canceled after 0s
Cross-platform packages / linux x64 (push) Canceled after 0s
Cross-platform packages / macos x64 (push) Canceled after 0s
Cross-platform packages / windows x64 (push) Canceled after 0s
Cross-platform packages / Publish GitHub and OSS release (push) Canceled after 0s
GoodBuddy Agents / Validate Agent source (push) Canceled after 0s
GoodBuddy Agents / Build darwin arm64 Agent (push) Canceled after 0s
GoodBuddy Agents / Build linux arm64 Agent (push) Canceled after 0s
GoodBuddy Agents / Build linux x64 Agent (push) Canceled after 0s
Cross-platform packages / Validate source (push) Canceled after 0s
Cross-platform packages / Authorize desktop packaging (push) Canceled after 0s
Cross-platform packages / linux arm64 (push) Canceled after 0s
Cross-platform packages / macos arm64 (push) Canceled after 0s
Cross-platform packages / windows arm64 (push) Canceled after 0s
Cross-platform packages / linux x64 (push) Canceled after 0s
Cross-platform packages / macos x64 (push) Canceled after 0s
Cross-platform packages / windows x64 (push) Canceled after 0s
Cross-platform packages / Publish GitHub and OSS release (push) Canceled after 0s
Keep interactive questions and answered cards at their original position in conversation history, including remote reception, recovery, and reopening. Preserve legacy history placement without a database migration. Move supplementary guidance into shared accessible contextual-help popovers across pages and settings. Add keyboard, modal, accessibility, and Electron regressions, plus bounded opt-in live canvas-analysis validation. Remove unused Agent, Runtime, and in-memory graph-search helpers, obsolete mocks and browser copy; reuse the existing package-size formatter. Keep production execution paths, protocol schemas, and released data migrations. Validation: targeted cleanup tests, typecheck, lint, shared Linux Host attach/read/re-attach, and added help/Electron checks passed. Final full-suite verification passed 4,858 tests with 67 skipped and zero failures (412 files passed, 9 skipped). Focused help checks passed 54 tests, including Electron style comparisons and Chromium accessibility descriptions. Details and validation boundaries are recorded in feature docs. Release note: 修复交互式问答在回答后排到后续输出末尾的问题,重新打开会话仍保留提问位置。页面和设置中的补充说明改为标题或字段旁的按需帮助,支持鼠标与键盘操作。
This commit is contained in:
@@ -21,9 +21,3 @@ export function agentTargetKey(target: {
|
||||
)) throw new Error(`Unsupported Agent target: ${target.platform}-${target.architecture}`)
|
||||
return `${target.platform}-${target.architecture}` as AgentTargetKey
|
||||
}
|
||||
|
||||
export function currentAgentPlatform(): AgentPlatform {
|
||||
const platform = agentPlatformSchema.parse(process.platform)
|
||||
agentTargetKey({ platform, architecture: process.arch })
|
||||
return platform
|
||||
}
|
||||
|
||||
@@ -264,6 +264,13 @@ export const conversationMessageBlockSchema = z.discriminatedUnion('type', [
|
||||
type: z.literal('subagent'),
|
||||
childTaskId: assistantIdSchema
|
||||
})
|
||||
.strict(),
|
||||
z
|
||||
.object({
|
||||
id: assistantIdSchema,
|
||||
type: z.literal('question'),
|
||||
questionId: z.string().min(1)
|
||||
})
|
||||
.strict()
|
||||
])
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import { expect, it } from 'vitest'
|
||||
import { conversationMessageBlocksSchema } from './assistant-contracts'
|
||||
import { appendConversationQuestionBlock } from './conversation-question-blocks'
|
||||
|
||||
it('appends one stable question marker without moving earlier content or duplicate questions', () => {
|
||||
const text = { id: crypto.randomUUID(), type: 'text' as const, content: 'Before' }
|
||||
const blocks = appendConversationQuestionBlock([text], 'question-1')!
|
||||
expect(blocks[0]).toBe(text)
|
||||
expect(blocks[1]).toMatchObject({ type: 'question', questionId: 'question-1' })
|
||||
expect(appendConversationQuestionBlock(blocks, 'question-1')).toBe(blocks)
|
||||
expect(conversationMessageBlocksSchema.parse(blocks)).toEqual(blocks)
|
||||
expect(appendConversationQuestionBlock(blocks, 'question-2')?.map(block => block.type)).toEqual([
|
||||
'text', 'question', 'question'
|
||||
])
|
||||
})
|
||||
|
||||
it('does not fabricate positions for legacy messages without blocks', () => {
|
||||
expect(appendConversationQuestionBlock(undefined, 'question-1')).toBeUndefined()
|
||||
})
|
||||
@@ -0,0 +1,11 @@
|
||||
import type { ConversationMessageBlock } from './assistant-contracts'
|
||||
|
||||
export function appendConversationQuestionBlock(
|
||||
blocks: ConversationMessageBlock[] | undefined,
|
||||
questionId: string
|
||||
): ConversationMessageBlock[] | undefined {
|
||||
if (!blocks || blocks.some(block => block.type === 'question' && block.questionId === questionId)) {
|
||||
return blocks
|
||||
}
|
||||
return [...blocks, { id: crypto.randomUUID(), type: 'question', questionId }]
|
||||
}
|
||||
@@ -66,13 +66,6 @@ export const goodbuddyConfigToolCatalog = {
|
||||
GoodBuddyConfigToolDefinition
|
||||
>
|
||||
|
||||
export const goodbuddyConfigToolKeys = [
|
||||
'capabilities',
|
||||
'get',
|
||||
'plan',
|
||||
'apply'
|
||||
] as const
|
||||
|
||||
export const goodbuddyConfigTools = [
|
||||
goodbuddyConfigToolCatalog.capabilities,
|
||||
goodbuddyConfigToolCatalog.get,
|
||||
|
||||
@@ -3,10 +3,6 @@ import { createOperationIdentity } from './agent-protocol/canonical'
|
||||
import {
|
||||
REMOTE_RUNTIME_LAUNCH_LIMITS,
|
||||
assertDetachedRemoteRuntimeBundleDigest,
|
||||
assertRemoteRuntimeOperationDigest,
|
||||
createRemoteRuntimeQueryRequest,
|
||||
createRemoteRuntimeStartRequest,
|
||||
createRemoteRuntimeStopRequest,
|
||||
detachedSignedRemoteRuntimeBundleSchema,
|
||||
digestRemoteRuntimeBundleIdentity,
|
||||
digestRemoteRuntimeBundleManifest,
|
||||
@@ -86,30 +82,6 @@ const signedBundle = {
|
||||
}
|
||||
}
|
||||
|
||||
const commonPreparation = {
|
||||
bindingId: 'binding-1',
|
||||
operationId: 'operation-1',
|
||||
requestId: 'request-1',
|
||||
workMode: 'ask' as const,
|
||||
controllerId: 'controller-1',
|
||||
controllerGeneration: 1,
|
||||
connectionGeneration: 1,
|
||||
channelEpoch: '1',
|
||||
hostId: 'host-1',
|
||||
hostRevision: 1,
|
||||
hostKeyGeneration: 1,
|
||||
workspaceIdentity: 'workspace-1',
|
||||
agentInstallationId: 'installation-1',
|
||||
runtimeId: 'runtime-1',
|
||||
runtimeBundleDigest: digest,
|
||||
runtimeAdapterDigest: digest,
|
||||
deadlineAt,
|
||||
budget: {
|
||||
maximumInputBytes: 10,
|
||||
maximumOutputBytes: 100
|
||||
}
|
||||
}
|
||||
|
||||
const startPayload = {
|
||||
bindingId: 'binding-1',
|
||||
requestId: 'request-1',
|
||||
@@ -119,7 +91,10 @@ const startPayload = {
|
||||
{ name: 'modelProfileId' as const, value: 'model-1' }
|
||||
],
|
||||
deadlineAt,
|
||||
budget: commonPreparation.budget
|
||||
budget: {
|
||||
maximumInputBytes: 10,
|
||||
maximumOutputBytes: 100
|
||||
}
|
||||
}
|
||||
|
||||
async function operationRequest<T>(
|
||||
@@ -278,68 +253,14 @@ describe('remote Runtime launch contracts', () => {
|
||||
).rejects.toThrow(/digest does not match/iu)
|
||||
})
|
||||
|
||||
it('constructs the exact start operation identity and canonical digest', async () => {
|
||||
const request = await createRemoteRuntimeStartRequest({
|
||||
controllerId: 'controller-1',
|
||||
operationId: 'start-operation-1',
|
||||
prompt: commonPreparation,
|
||||
adapterParameters: startPayload.adapterParameters,
|
||||
deadlineAt
|
||||
})
|
||||
expect(request.identity.method).toBe('runtime/startPrompt')
|
||||
expect(request.identity.scope).toEqual({
|
||||
kind: 'run',
|
||||
sessionId: 'binding-1',
|
||||
requestId: 'request-1'
|
||||
})
|
||||
const expected = await createOperationIdentity({
|
||||
controllerId: 'controller-1',
|
||||
operationId: 'start-operation-1',
|
||||
scope: request.identity.scope,
|
||||
method: 'runtime/startPrompt',
|
||||
payload: request.payload
|
||||
})
|
||||
expect(request.identity.payloadDigest).toBe(expected.payloadDigest)
|
||||
expect(request.payload.workMode).toBe('ask')
|
||||
await expect(
|
||||
createRemoteRuntimeStartRequest({
|
||||
controllerId: 'controller-1',
|
||||
operationId: commonPreparation.operationId,
|
||||
prompt: commonPreparation,
|
||||
deadlineAt: '2031-01-01T00:00:00.000Z'
|
||||
})
|
||||
).rejects.toThrow(/prompt deadline/iu)
|
||||
})
|
||||
|
||||
it('rejects caller digest mismatches', async () => {
|
||||
it('validates start requests without adapter flags, paths or process-control fields', async () => {
|
||||
const valid = await operationRequest(
|
||||
'runtime/startPrompt',
|
||||
'start-operation-1',
|
||||
'request-1',
|
||||
startPayload
|
||||
)
|
||||
const changedPayload = {
|
||||
...startPayload,
|
||||
runtimeId: 'runtime-2'
|
||||
}
|
||||
await expect(
|
||||
assertRemoteRuntimeOperationDigest({
|
||||
...valid,
|
||||
payload: changedPayload
|
||||
})
|
||||
).rejects.toThrow(/digest does not match/iu)
|
||||
await expect(
|
||||
assertRemoteRuntimeOperationDigest(valid)
|
||||
).resolves.toBeUndefined()
|
||||
await expect(
|
||||
assertRemoteRuntimeOperationDigest({
|
||||
...valid,
|
||||
identity: { ...valid.identity, payloadDigest: digest }
|
||||
})
|
||||
).rejects.toThrow(/digest does not match/iu)
|
||||
})
|
||||
|
||||
it('rejects adapter flag and path tunneling plus all process-control fields', async () => {
|
||||
expect(remoteRuntimeStartRequestSchema.parse(valid)).toEqual(valid)
|
||||
for (const value of [
|
||||
'--flag',
|
||||
'/tmp/model',
|
||||
@@ -347,24 +268,16 @@ describe('remote Runtime launch contracts', () => {
|
||||
'models\\model',
|
||||
'..'
|
||||
]) {
|
||||
await expect(
|
||||
createRemoteRuntimeStartRequest({
|
||||
controllerId: 'controller-1',
|
||||
operationId: 'start-operation-1',
|
||||
prompt: commonPreparation,
|
||||
adapterParameters: [
|
||||
{ name: 'modelProfileId', value }
|
||||
],
|
||||
deadlineAt
|
||||
expect(() =>
|
||||
remoteRuntimeStartRequestSchema.parse({
|
||||
...valid,
|
||||
payload: {
|
||||
...startPayload,
|
||||
adapterParameters: [{ name: 'modelProfileId', value }]
|
||||
}
|
||||
})
|
||||
).rejects.toThrow()
|
||||
).toThrow()
|
||||
}
|
||||
const valid = await operationRequest(
|
||||
'runtime/startPrompt',
|
||||
'start-operation-1',
|
||||
'request-1',
|
||||
startPayload
|
||||
)
|
||||
for (const forbidden of forbiddenLaunchFields) {
|
||||
expect(() =>
|
||||
remoteRuntimeStartRequestSchema.parse({
|
||||
@@ -398,23 +311,19 @@ describe('remote Runtime launch contracts', () => {
|
||||
reason: 'user-cancelled' as const,
|
||||
deadlineAt
|
||||
}
|
||||
const stop = await createRemoteRuntimeStopRequest({
|
||||
controllerId: 'controller-1',
|
||||
operationId: 'stop-1',
|
||||
payload: stopPayload
|
||||
})
|
||||
const stop = await operationRequest(
|
||||
'runtime/stopPrompt', 'stop-1', stopPayload.requestId, stopPayload
|
||||
)
|
||||
expect(remoteRuntimeStopRequestSchema.parse(stop)).toEqual(stop)
|
||||
const query = await createRemoteRuntimeQueryRequest({
|
||||
controllerId: 'controller-1',
|
||||
operationId: 'query-1',
|
||||
payload: {
|
||||
const query = await operationRequest(
|
||||
'runtime/queryPrompt', 'query-1', 'query-request-1', {
|
||||
launchId: 'launch-1',
|
||||
bindingId: 'binding-1',
|
||||
runtimeId: 'runtime-1',
|
||||
startOperationId: 'start-operation-1',
|
||||
requestId: 'query-request-1'
|
||||
}
|
||||
})
|
||||
)
|
||||
expect(remoteRuntimeQueryRequestSchema.parse(query)).toEqual(query)
|
||||
expect(() =>
|
||||
remoteRuntimeStopRequestSchema.parse({
|
||||
|
||||
@@ -15,14 +15,8 @@ import {
|
||||
utf8StringSchema,
|
||||
type OperationIdentity
|
||||
} from './agent-protocol/contracts'
|
||||
import {
|
||||
createOperationIdentity,
|
||||
digestCanonicalOperation
|
||||
} from './agent-protocol/canonical'
|
||||
import {
|
||||
remotePromptOperationPreparationSchema,
|
||||
type RemotePromptOperationPreparation
|
||||
} from './remote-agent-contracts'
|
||||
import { digestCanonicalOperation } from './agent-protocol/canonical'
|
||||
import { remotePromptOperationPreparationSchema } from './remote-agent-contracts'
|
||||
|
||||
export const REMOTE_RUNTIME_LAUNCH_LIMITS = {
|
||||
maximumFiles: 10_000,
|
||||
@@ -638,96 +632,6 @@ export type RemoteRuntimeQueryResult = z.infer<
|
||||
typeof remoteRuntimeQueryResultSchema
|
||||
>
|
||||
|
||||
export async function digestRemoteRuntimePreparation(
|
||||
preparation: RemotePromptOperationPreparation
|
||||
): Promise<string> {
|
||||
const parsed = remotePromptOperationPreparationSchema.parse(preparation)
|
||||
return digestCanonicalOperation({
|
||||
method: 'runtime/preparePrompt',
|
||||
scope: {
|
||||
kind: 'run',
|
||||
sessionId: parsed.bindingId,
|
||||
requestId: parsed.requestId
|
||||
},
|
||||
payload: parsed
|
||||
})
|
||||
}
|
||||
|
||||
export async function createRemoteRuntimeStartRequest(input: {
|
||||
controllerId: string
|
||||
operationId: string
|
||||
prompt: unknown
|
||||
adapterParameters?: unknown
|
||||
deadlineAt?: string
|
||||
}): Promise<RemoteRuntimeStartRequest> {
|
||||
const prompt = remotePromptOperationPreparationSchema.parse(input.prompt)
|
||||
const deadlineAt = input.deadlineAt ?? prompt.deadlineAt
|
||||
if (Date.parse(deadlineAt) > Date.parse(prompt.deadlineAt)) {
|
||||
throw new Error('Runtime start deadline exceeds the prompt deadline')
|
||||
}
|
||||
const payload = remoteRuntimeStartPayloadSchema.parse({
|
||||
bindingId: prompt.bindingId,
|
||||
requestId: prompt.requestId,
|
||||
workMode: prompt.workMode,
|
||||
runtimeId: prompt.runtimeId,
|
||||
adapterParameters: input.adapterParameters ?? [],
|
||||
deadlineAt,
|
||||
budget: prompt.budget
|
||||
})
|
||||
const identity = await createOperationIdentity({
|
||||
controllerId: agentIdentifierSchema.parse(input.controllerId),
|
||||
operationId: agentIdentifierSchema.parse(input.operationId),
|
||||
scope: {
|
||||
kind: 'run',
|
||||
sessionId: prompt.bindingId,
|
||||
requestId: prompt.requestId
|
||||
},
|
||||
method: 'runtime/startPrompt',
|
||||
payload
|
||||
})
|
||||
return remoteRuntimeStartRequestSchema.parse({ identity, payload })
|
||||
}
|
||||
|
||||
export async function createRemoteRuntimeStopRequest(input: {
|
||||
controllerId: string
|
||||
operationId: string
|
||||
payload: unknown
|
||||
}): Promise<RemoteRuntimeStopRequest> {
|
||||
const payload = remoteRuntimeStopPayloadSchema.parse(input.payload)
|
||||
const identity = await createOperationIdentity({
|
||||
controllerId: input.controllerId,
|
||||
operationId: input.operationId,
|
||||
scope: {
|
||||
kind: 'run',
|
||||
sessionId: payload.bindingId,
|
||||
requestId: payload.requestId
|
||||
},
|
||||
method: 'runtime/stopPrompt',
|
||||
payload
|
||||
})
|
||||
return remoteRuntimeStopRequestSchema.parse({ identity, payload })
|
||||
}
|
||||
|
||||
export async function createRemoteRuntimeQueryRequest(input: {
|
||||
controllerId: string
|
||||
operationId: string
|
||||
payload: unknown
|
||||
}): Promise<RemoteRuntimeQueryRequest> {
|
||||
const payload = remoteRuntimeQueryPayloadSchema.parse(input.payload)
|
||||
const identity = await createOperationIdentity({
|
||||
controllerId: input.controllerId,
|
||||
operationId: input.operationId,
|
||||
scope: {
|
||||
kind: 'run',
|
||||
sessionId: payload.bindingId,
|
||||
requestId: payload.requestId
|
||||
},
|
||||
method: 'runtime/queryPrompt',
|
||||
payload
|
||||
})
|
||||
return remoteRuntimeQueryRequestSchema.parse({ identity, payload })
|
||||
}
|
||||
|
||||
export async function digestRemoteRuntimeBundleManifest(
|
||||
manifest: unknown
|
||||
): Promise<string> {
|
||||
@@ -775,19 +679,6 @@ export async function assertDetachedRemoteRuntimeBundleDigest(
|
||||
return parsed
|
||||
}
|
||||
|
||||
export async function assertRemoteRuntimeOperationDigest(
|
||||
request: RemoteRuntimeStartRequest | RemoteRuntimeStopRequest | RemoteRuntimeQueryRequest
|
||||
): Promise<void> {
|
||||
const expectedDigest = await digestCanonicalOperation({
|
||||
method: request.identity.method,
|
||||
scope: request.identity.scope,
|
||||
payload: request.payload
|
||||
})
|
||||
if (request.identity.payloadDigest !== expectedDigest) {
|
||||
throw new Error('Runtime operation payload digest does not match')
|
||||
}
|
||||
}
|
||||
|
||||
function addOperationBindingIssues(
|
||||
identity: OperationIdentity,
|
||||
method: string,
|
||||
|
||||
Reference in New Issue
Block a user