import { z } from 'zod'; import type { Payload } from './visualizerModel.js'; export declare const ZTRACK_WORK_ITEM_REFERENCE_VERSION: 1; export declare const ZTRACK_WORK_ITEM_CONTEXT_KIND: "work-item"; export declare const WorkItemReferenceSchema: z.ZodObject<{ version: z.ZodLiteral<1>; provider: z.ZodLiteral<"ztrack">; uri: z.ZodString; label: z.ZodString; }, z.core.$strict>; export type WorkItemReference = z.infer; export declare const WorkAssociationSignalSchema: z.ZodObject<{ source: z.ZodEnum<{ environment: "environment"; branch: "branch"; loop: "loop"; worktree: "worktree"; explicit: "explicit"; }>; issueIds: z.ZodArray; detail: z.ZodString; }, z.core.$strict>; export type WorkAssociationSignal = z.infer; export declare const ExplicitWorkContextSchema: z.ZodObject<{ reference: z.ZodObject<{ version: z.ZodLiteral<1>; provider: z.ZodLiteral<"ztrack">; uri: z.ZodString; label: z.ZodString; }, z.core.$strict>; issueId: z.ZodNullable; state: z.ZodEnum<{ malformed: "malformed"; valid: "valid"; "foreign-project": "foreign-project"; "missing-issue": "missing-issue"; }>; }, z.core.$strict>; export type ExplicitWorkContext = z.infer; export declare const AmbientWorkContextSchema: z.ZodObject<{ issueId: z.ZodString; source: z.ZodEnum<{ environment: "environment"; branch: "branch"; loop: "loop"; worktree: "worktree"; }>; detail: z.ZodString; }, z.core.$strict>; export type AmbientWorkContext = z.infer; /** * The association result is intentionally stronger than a nullable issue id. Conflict and stale * references preserve both pieces of evidence so a host can offer an explicit recovery action * without guessing or rewriting transcript history. */ export declare const WorkContextResolutionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ signals: z.ZodArray; issueIds: z.ZodArray; detail: z.ZodString; }, z.core.$strict>>; reason: z.ZodString; state: z.ZodLiteral<"resolved">; issueId: z.ZodString; source: z.ZodEnum<{ explicit: "explicit"; ambient: "ambient"; }>; explicit: z.ZodNullable; provider: z.ZodLiteral<"ztrack">; uri: z.ZodString; label: z.ZodString; }, z.core.$strict>; issueId: z.ZodNullable; state: z.ZodEnum<{ malformed: "malformed"; valid: "valid"; "foreign-project": "foreign-project"; "missing-issue": "missing-issue"; }>; }, z.core.$strict>>; ambient: z.ZodNullable; detail: z.ZodString; }, z.core.$strict>>; }, z.core.$strict>, z.ZodObject<{ signals: z.ZodArray; issueIds: z.ZodArray; detail: z.ZodString; }, z.core.$strict>>; reason: z.ZodString; state: z.ZodLiteral<"unresolved">; issueId: z.ZodNull; source: z.ZodNull; explicit: z.ZodNull; ambient: z.ZodNull; }, z.core.$strict>, z.ZodObject<{ signals: z.ZodArray; issueIds: z.ZodArray; detail: z.ZodString; }, z.core.$strict>>; reason: z.ZodString; state: z.ZodLiteral<"conflict">; issueId: z.ZodNull; source: z.ZodNull; explicit: z.ZodObject<{ reference: z.ZodObject<{ version: z.ZodLiteral<1>; provider: z.ZodLiteral<"ztrack">; uri: z.ZodString; label: z.ZodString; }, z.core.$strict>; issueId: z.ZodNullable; state: z.ZodEnum<{ malformed: "malformed"; valid: "valid"; "foreign-project": "foreign-project"; "missing-issue": "missing-issue"; }>; }, z.core.$strict>; ambient: z.ZodObject<{ issueId: z.ZodString; source: z.ZodEnum<{ environment: "environment"; branch: "branch"; loop: "loop"; worktree: "worktree"; }>; detail: z.ZodString; }, z.core.$strict>; }, z.core.$strict>, z.ZodObject<{ signals: z.ZodArray; issueIds: z.ZodArray; detail: z.ZodString; }, z.core.$strict>>; reason: z.ZodString; state: z.ZodLiteral<"stale">; issueId: z.ZodNull; source: z.ZodNull; explicit: z.ZodObject<{ reference: z.ZodObject<{ version: z.ZodLiteral<1>; provider: z.ZodLiteral<"ztrack">; uri: z.ZodString; label: z.ZodString; }, z.core.$strict>; issueId: z.ZodNullable; state: z.ZodEnum<{ malformed: "malformed"; valid: "valid"; "foreign-project": "foreign-project"; "missing-issue": "missing-issue"; }>; }, z.core.$strict>; ambient: z.ZodNullable; detail: z.ZodString; }, z.core.$strict>>; }, z.core.$strict>], "state">; export type WorkContextResolution = z.infer; export declare const ExternalWorkTaskSchema: z.ZodObject<{ id: z.ZodString; title: z.ZodString; status: z.ZodEnum<{ unknown: "unknown"; completed: "completed"; cancelled: "cancelled"; pending: "pending"; in_progress: "in_progress"; }>; nativeStatus: z.ZodOptional; blockedBy: z.ZodOptional>; }, z.core.$strict>; export type ExternalWorkTask = z.infer; /** A read-only projection of one Supercode session. It is never persisted as issue data. */ export declare const ExternalWorkActivitySchema: z.ZodObject<{ version: z.ZodLiteral<1>; provider: z.ZodLiteral<"supercode">; sessionIdentity: z.ZodString; sessionLabel: z.ZodNullable; issueId: z.ZodString; freshness: z.ZodEnum<{ live: "live"; "last-observed": "last-observed"; }>; turnState: z.ZodEnum<{ unknown: "unknown"; working: "working"; waiting: "waiting"; idle: "idle"; }>; planSource: z.ZodEnum<{ none: "none"; "codex-update-plan": "codex-update-plan"; "claude-tasks": "claude-tasks"; "opencode-todos": "opencode-todos"; }>; tasks: z.ZodArray; nativeStatus: z.ZodOptional; blockedBy: z.ZodOptional>; }, z.core.$strict>>; residue: z.ZodArray; observedAt: z.ZodNullable; }, z.core.$strict>; export type ExternalWorkActivity = z.infer; export interface PromptContextItem { id?: string; kind?: string; label: string; detail: string; } export interface NormalizedTaskPlanLike { source: ExternalWorkActivity['planSource']; items: ExternalWorkTask[]; residue: unknown[]; observedAt: number | null; } export interface BridgeSession { key: string; identity: string; cwd: string | null; title: string | null; updatedAt: number | null; } export interface BridgeLoadedSession { messages?: unknown[]; [key: string]: unknown; } export interface BridgeConversationEntry { kind: string; role?: string; context?: PromptContextItem[]; } export interface BridgeSupercodeSnapshot { sessions: BridgeSession[]; activeSessionKey: string | null; activeSession: BridgeLoadedSession | null; conversation: BridgeConversationEntry[]; taskPlan: NormalizedTaskPlanLike; turn: { state: 'idle' | 'running' | 'interrupting' | 'reconciling'; }; requests?: unknown[]; } export interface ZtrackBridgeTracker { resolveProjectIdentity(startDir: string): { projectKey: string; projectRoot: string; }; resolveWorkTarget(input: { startDir: string; environmentIssue?: string; }): { effective: { issueId: string; source: 'environment' | 'loop' | 'branch' | 'worktree'; } | null; signals: Array<{ source: 'environment' | 'loop' | 'branch' | 'worktree'; issueIds: string[]; detail: string; }>; reason: string; }; payload(): Payload; subscribe?(listener: () => void): () => void; } export interface ZtrackBridgeSupercode { getSnapshot(): BridgeSupercodeSnapshot; subscribe(listener: () => void): () => void; projectConversation(session: BridgeLoadedSession): BridgeConversationEntry[]; deriveTaskPlan(session: BridgeLoadedSession | null): NormalizedTaskPlanLike; } export interface ZtrackSupercodeBridge { contextForIssue(issueId: string): PromptContextItem; resolveSession(input: { session: BridgeSession; loadedSession?: BridgeLoadedSession | null; }): WorkContextResolution; activitySnapshot(): ExternalWorkActivity[]; subscribe(listener: () => void): () => void; ztrackBindings(): { readonly activity: ExternalWorkActivity[]; contextForIssue(issueId: string): PromptContextItem; }; dispose(): void; } export declare function ztrackWorkItemUri(projectKey: string, issueId: string): string; export declare function parseZtrackWorkItemUri(uri: string): { projectKey: string; issueId: string; } | null; /** Create one host-owned, teardown-safe observational bridge. Neither canonical store is mutated. */ export declare function createZtrackSupercodeBridge(input: { projectRoot: string; tracker: ZtrackBridgeTracker; supercode: ZtrackBridgeSupercode; }): ZtrackSupercodeBridge;