mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
section 12: Phase 12: One shared flattened stream event type; delete the
This commit is contained in:
1 parent
0b2303a870
commit
717536c5a6
15 files changed
+122
-125
No files matched your search
@@ -4,7 +4,6 @@ export * from './repo'
|
||||
export * from './git'
|
||||
export * from './files'
|
||||
export * from './filesystem'
|
||||
export * from './opencode'
|
||||
export * from './auth'
|
||||
export * from './sse'
|
||||
export * from './notifications'
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
export const FileDiffSchema = z.object({
|
||||
file: z.string(),
|
||||
before: z.string(),
|
||||
after: z.string(),
|
||||
additions: z.number(),
|
||||
deletions: z.number(),
|
||||
})
|
||||
|
||||
export const SessionSchema = z.object({
|
||||
id: z.string(),
|
||||
projectID: z.string(),
|
||||
directory: z.string(),
|
||||
parentID: z.string().optional(),
|
||||
summary: z.object({
|
||||
diffs: FileDiffSchema.array(),
|
||||
}).optional(),
|
||||
share: z.object({
|
||||
url: z.string(),
|
||||
}).optional(),
|
||||
title: z.string(),
|
||||
version: z.string(),
|
||||
time: z.object({
|
||||
created: z.number(),
|
||||
updated: z.number(),
|
||||
compacting: z.number().optional(),
|
||||
}),
|
||||
revert: z.object({
|
||||
messageID: z.string(),
|
||||
partID: z.string().optional(),
|
||||
snapshot: z.string().optional(),
|
||||
diff: z.string().optional(),
|
||||
}).optional(),
|
||||
})
|
||||
|
||||
export const MessageSchema = z.object({
|
||||
id: z.string(),
|
||||
sessionID: z.string(),
|
||||
role: z.enum(['user', 'assistant']),
|
||||
time: z.object({
|
||||
created: z.number(),
|
||||
completed: z.number().optional(),
|
||||
}),
|
||||
})
|
||||
|
||||
export type FileDiff = z.infer<typeof FileDiffSchema>
|
||||
@@ -1,5 +1,6 @@
|
||||
import { z } from "zod";
|
||||
import type { V2Event } from "../opencode";
|
||||
import type { SSHHostKeyRequest } from "./ssh";
|
||||
|
||||
export const SSESubscribeSchema = z.object({
|
||||
clientId: z.string().min(1),
|
||||
@@ -16,8 +17,18 @@ export const SSEVisibilitySchema = z.object({
|
||||
export type SSESubscribeRequest = z.infer<typeof SSESubscribeSchema>;
|
||||
export type SSEVisibilityRequest = z.infer<typeof SSEVisibilitySchema>;
|
||||
|
||||
export interface SSHHostKeyRequestEvent {
|
||||
type: "ssh.host-key-request";
|
||||
properties: SSHHostKeyRequest;
|
||||
}
|
||||
|
||||
export interface SSEEventEnvelope {
|
||||
directory?: string | null;
|
||||
serverId?: string;
|
||||
payload: V2Event;
|
||||
payload: V2Event | SSHHostKeyRequestEvent;
|
||||
}
|
||||
|
||||
export type OpenCodeStreamEvent = (V2Event | SSHHostKeyRequestEvent) & {
|
||||
directory?: string;
|
||||
serverId?: string;
|
||||
};
|
||||
@@ -48,10 +48,6 @@ import {
|
||||
PatchOperationSchema,
|
||||
FilePatchRequestSchema,
|
||||
} from '../schemas/files'
|
||||
import {
|
||||
SessionSchema,
|
||||
MessageSchema,
|
||||
} from '../schemas/opencode'
|
||||
import {
|
||||
DirectoryEntrySchema,
|
||||
BrowseDirectoryResponseSchema,
|
||||
@@ -116,9 +112,6 @@ export type FileRangeRequest = z.infer<typeof FileRangeRequestSchema>
|
||||
export type PatchOperation = z.infer<typeof PatchOperationSchema>
|
||||
export type FilePatchRequest = z.infer<typeof FilePatchRequestSchema>
|
||||
|
||||
export type Session = z.infer<typeof SessionSchema>
|
||||
export type Message = z.infer<typeof MessageSchema>
|
||||
|
||||
export type DirectoryEntry = z.infer<typeof DirectoryEntrySchema>
|
||||
export type BrowseDirectoryResponse = z.infer<typeof BrowseDirectoryResponseSchema>
|
||||
export type BrowseDirectoryRequest = z.infer<typeof BrowseDirectoryRequestSchema>
|
||||
|
||||
Reference in new issue
Block a user