Expose saved decisions, timelines and source evidence through read-only Story Graph tools across Model, Harness and local/remote OpenCode and Continue. Supervisor enablement and runtime assignments govern discovery and calls; reads do not invoke models or modify stored evidence. Remote use requires matching Desktop and Agent changes. Make Continue discussion show the complete editable message with a separated destination and shared action layout. Sending uses the visible draft without reattaching removed context. Validation: existing focused MCP, runtime, controlled Linux Host, discussion component and Electron layout checks plus typechecks; staged diff check passed. Cross-scope fact reuse, historical reconstruction and full package acceptance remain deferred. Release note: Agents can consult saved supervisor decisions and their sources when continuing work. Continue discussion now lets you review and edit the complete message before sending.
41 lines
1.7 KiB
TypeScript
41 lines
1.7 KiB
TypeScript
import { z } from 'zod'
|
|
import { agentIdentifierSchema, positiveAgentSequenceSchema } from './agent-protocol/contracts'
|
|
import { imageOperationSchema, imageToolDescriptionLimit, imageToolInputSchema } from './image-generation-contracts'
|
|
|
|
export const remoteImageToolSchema = z.object({
|
|
channelId: agentIdentifierSchema,
|
|
channelEpoch: positiveAgentSequenceSchema,
|
|
description: z.string().min(1).max(imageToolDescriptionLimit).optional(),
|
|
storyGraph: z.boolean().optional()
|
|
}).strict()
|
|
|
|
export const remoteImageToolCallSchema = z.union([z.object({
|
|
callId: z.string().uuid(),
|
|
input: imageToolInputSchema
|
|
}).strict(), z.object({
|
|
callId: z.string().uuid(),
|
|
name: z.enum(['story_graph_list', 'story_graph_search', 'story_graph_get_context', 'story_graph_read_source']),
|
|
input: z.record(z.string(), z.unknown())
|
|
}).strict()])
|
|
|
|
export const remoteImageToolReplySchema = z.object({
|
|
callId: z.string().uuid(),
|
|
result: imageOperationSchema.optional(),
|
|
storyGraphResult: z.record(z.string(), z.unknown()).optional(),
|
|
error: z.string().max(4_000).optional()
|
|
}).strict()
|
|
|
|
// Bounded graph evidence or image-operation metadata. Image bytes never cross this channel.
|
|
export const remoteImageToolMaximumBytes = 256 * 1024
|
|
|
|
export function encodeRemoteImageToolMessage(value: unknown): Uint8Array {
|
|
const bytes = new TextEncoder().encode(JSON.stringify(value))
|
|
if (bytes.byteLength > remoteImageToolMaximumBytes) throw new Error('Image tool message is too large')
|
|
return bytes
|
|
}
|
|
|
|
export function decodeRemoteImageToolMessage(bytes: Uint8Array): unknown {
|
|
if (bytes.byteLength > remoteImageToolMaximumBytes) throw new Error('Image tool message is too large')
|
|
return JSON.parse(new TextDecoder().decode(bytes)) as unknown
|
|
}
|