@x-otto/plugin-feedback 0.1.0-alpha.1 → 0.4.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,157 @@
1
+ //#region src/types.d.ts
2
+ type OperationKind = 'command' | 'panel' | 'prompt' | 'tool' | 'settings' | 'model' | 'session' | 'subagent' | 'job' | 'error' | 'focus';
3
+ type OperationStatus = 'ok' | 'failed' | 'denied' | 'cancelled';
4
+ type OperationReason = 'turn-end' | 'stream-retry' | 'model-fallback' | 'settings-changed' | 'session-attached' | 'session-detached' | 'job-settled' | 'subagent-start' | 'subagent-end' | 'install-failed' | 'cancelled' | 'failed';
5
+ interface OperationInput {
6
+ readonly kind: OperationKind;
7
+ readonly name: string;
8
+ readonly at: number;
9
+ readonly status?: OperationStatus;
10
+ readonly reason?: OperationReason;
11
+ readonly code?: string;
12
+ readonly count?: number;
13
+ readonly characters?: number;
14
+ readonly durationMs?: number;
15
+ readonly sessionId?: string;
16
+ }
17
+ interface OperationEntry extends OperationInput {
18
+ readonly seq: number;
19
+ }
20
+ interface OperationLogSnapshot {
21
+ readonly entries: readonly OperationEntry[];
22
+ readonly dropped: number;
23
+ readonly skipped: number;
24
+ readonly capacity: number;
25
+ }
26
+ type ConsentScope = 'session' | 'operations' | 'environment' | 'diagnostics' | 'workspace-name';
27
+ declare const CONSENT_POLICY_VERSION = "feedback-consent-v1";
28
+ type FeedbackConsent = {
29
+ readonly accepted: false;
30
+ } | {
31
+ readonly accepted: true;
32
+ readonly policy: typeof CONSENT_POLICY_VERSION;
33
+ readonly acceptedAt: number;
34
+ readonly scope: readonly ConsentScope[];
35
+ };
36
+ type FeedbackCategory = 'bug' | 'idea' | 'question';
37
+ interface FeedbackDraft {
38
+ readonly openId: string;
39
+ readonly openedAt: number;
40
+ readonly category: FeedbackCategory;
41
+ readonly title: string;
42
+ readonly description: string;
43
+ readonly consent: FeedbackConsent;
44
+ readonly includeWorkspaceName: boolean;
45
+ readonly sessionId?: string;
46
+ }
47
+ interface BundleFile {
48
+ readonly path: string;
49
+ readonly bytes: number;
50
+ readonly sha256: string;
51
+ readonly text?: string;
52
+ }
53
+ interface FeedbackBundle {
54
+ readonly id: string;
55
+ readonly title: string;
56
+ readonly category: FeedbackCategory;
57
+ readonly directory: string;
58
+ readonly archivePath: string;
59
+ readonly bytes: number;
60
+ readonly files: readonly BundleFile[];
61
+ readonly redactions: Readonly<Record<string, number>>;
62
+ readonly counts: {
63
+ readonly operations: number;
64
+ readonly operationsDropped: number;
65
+ readonly operationsSkipped: number;
66
+ readonly sessionEntries: number;
67
+ readonly diagnostics: number;
68
+ readonly skipped: number;
69
+ };
70
+ readonly missing: readonly string[];
71
+ readonly report: string;
72
+ }
73
+ type PublishOutcome = {
74
+ readonly kind: 'stored';
75
+ readonly path: string;
76
+ } | {
77
+ readonly kind: 'issue';
78
+ readonly url: string;
79
+ readonly iid?: number;
80
+ } | {
81
+ readonly kind: 'failed';
82
+ readonly code: string;
83
+ readonly message: string;
84
+ } | {
85
+ readonly kind: 'unknown';
86
+ readonly code: string;
87
+ readonly message: string;
88
+ readonly branch?: string;
89
+ };
90
+ interface SessionEntryView {
91
+ readonly kind: 'user' | 'assistant' | 'tool-call' | 'tool-result';
92
+ readonly ordinal: number;
93
+ readonly at?: number;
94
+ readonly text?: string;
95
+ readonly tool?: string;
96
+ readonly argumentKeys?: readonly string[];
97
+ readonly isError?: boolean;
98
+ readonly bytes?: number;
99
+ readonly imageBytes?: number;
100
+ }
101
+ interface SessionFacts {
102
+ readonly state: 'present' | 'absent';
103
+ readonly reason?: string;
104
+ readonly meta?: Readonly<Record<string, unknown>>;
105
+ readonly window?: {
106
+ readonly loaded: number;
107
+ readonly total: number;
108
+ };
109
+ readonly entries: readonly SessionEntryView[];
110
+ readonly skipped: number;
111
+ }
112
+ interface DiagnosticsFacts {
113
+ readonly state: 'present' | 'absent';
114
+ readonly reason?: string;
115
+ readonly files: readonly string[];
116
+ readonly text: string;
117
+ readonly bytes: number;
118
+ readonly badLines: number;
119
+ }
120
+ interface EnvironmentFacts {
121
+ readonly plugin: {
122
+ readonly id: string;
123
+ readonly version: string;
124
+ };
125
+ readonly host: Readonly<Record<string, string | number>>;
126
+ readonly model?: string;
127
+ readonly provider?: string;
128
+ readonly permissionMode?: string;
129
+ readonly workspace?: {
130
+ readonly name: string;
131
+ };
132
+ readonly missing: readonly string[];
133
+ }
134
+ //#endregion
135
+ //#region src/locales/index.d.ts
136
+ type FeedbackLocale = 'en' | 'zh';
137
+ type FeedbackMessages = Readonly<Record<string, string | readonly string[]>>;
138
+ declare function messagesOf(locale: FeedbackLocale): FeedbackMessages;
139
+ declare function textOf(key: string): string;
140
+ declare function linesOf(messages: FeedbackMessages, key: string): readonly string[];
141
+ //#endregion
142
+ //#region src/ports.d.ts
143
+ type PublisherMode = 'outbox' | 'service';
144
+ interface FeedbackPorts {
145
+ locale(): FeedbackLocale;
146
+ messages(): FeedbackMessages;
147
+ sessionId(): string | undefined;
148
+ operations(): OperationLogSnapshot;
149
+ includeDiagnostics(): boolean;
150
+ includeWorkspaceName(): boolean;
151
+ publisherMode(): PublisherMode;
152
+ build(draft: FeedbackDraft, signal: AbortSignal): Promise<FeedbackBundle>;
153
+ publish(bundle: FeedbackBundle, draft: FeedbackDraft, signal?: AbortSignal): Promise<PublishOutcome>;
154
+ discard(bundle: FeedbackBundle): Promise<void>;
155
+ }
156
+ //#endregion
157
+ export { SessionFacts as S, OperationLogSnapshot as _, BundleFile as a, PublishOutcome as b, DiagnosticsFacts as c, FeedbackCategory as d, FeedbackConsent as f, OperationKind as g, OperationInput as h, textOf as i, EnvironmentFacts as l, OperationEntry as m, linesOf as n, CONSENT_POLICY_VERSION as o, FeedbackDraft as p, messagesOf as r, ConsentScope as s, FeedbackPorts as t, FeedbackBundle as u, OperationReason as v, SessionEntryView as x, OperationStatus as y };