@x-otto/plugin-feedback 0.1.0-alpha.1 → 0.3.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,4 @@
1
+ {
2
+ "version": 1,
3
+ "revision": "02897eabb1f5e492c39b1189c015c20f"
4
+ }
@@ -0,0 +1,204 @@
1
+ import { S as SessionFacts, _ as OperationLogSnapshot, a as BundleFile, b as PublishOutcome, c as DiagnosticsFacts, d as FeedbackCategory, f as FeedbackConsent, g as OperationKind, h as OperationInput, i as textOf, l as EnvironmentFacts, m as OperationEntry, n as linesOf, o as CONSENT_POLICY_VERSION, p as FeedbackDraft, r as messagesOf, s as ConsentScope, t as FeedbackPorts, u as FeedbackBundle, v as OperationReason, x as SessionEntryView, y as OperationStatus } from "./ports-ogYiAn-s.js";
2
+ import { CommandDeclaration, HostInfoFact, SessionManager, SettingsManager, UiPositionContribution } from "@x-otto/kernel";
3
+ import { Component } from "@x-otto/universal";
4
+
5
+ //#region src/command.d.ts
6
+ interface FeedbackCommandActions {
7
+ status(): unknown;
8
+ build(draft: unknown): Promise<unknown>;
9
+ publish(input: {
10
+ bundle: unknown;
11
+ draft: unknown;
12
+ }): Promise<unknown>;
13
+ discard(bundle: unknown): Promise<void>;
14
+ }
15
+ interface FeedbackCommandDeps {
16
+ actions?: FeedbackCommandActions;
17
+ open(sessionId: string | undefined): void;
18
+ }
19
+ declare function createFeedbackCommand(deps: FeedbackCommandDeps): CommandDeclaration;
20
+ declare function feedbackCommandKey(): string;
21
+ //#endregion
22
+ //#region src/ui/position.d.ts
23
+ declare function feedbackPositionKey(): string;
24
+ declare function feedbackPosition(ports: FeedbackPorts): UiPositionContribution;
25
+ //#endregion
26
+ //#region src/bundle/bundle.d.ts
27
+ interface BundlerDeps {
28
+ readonly home: string;
29
+ readonly cwd: string;
30
+ readonly pluginVersion: string;
31
+ readonly sessions: Pick<SessionManager, 'get' | 'surface' | 'surfaceWindowOf'>;
32
+ readonly processId?: number;
33
+ readonly hostInfo: () => HostInfoFact | undefined;
34
+ readonly operations: () => OperationLogSnapshot;
35
+ readonly model: () => string | undefined;
36
+ readonly provider: () => string | undefined;
37
+ readonly permissionMode: () => string | undefined;
38
+ readonly includeDiagnostics: () => boolean;
39
+ readonly includeWorkspaceName: () => boolean;
40
+ readonly maxBundleBytes?: () => number;
41
+ readonly uiActivity: () => boolean;
42
+ readonly now?: () => number;
43
+ readonly newId?: () => string;
44
+ }
45
+ interface Bundler {
46
+ build(draft: FeedbackDraft, signal: AbortSignal): Promise<FeedbackBundle>;
47
+ discard(bundle: FeedbackBundle): Promise<void>;
48
+ }
49
+ declare function defaultBundleId(at: number, random?: () => string): string;
50
+ declare function createBundler(deps: BundlerDeps): Bundler;
51
+ //#endregion
52
+ //#region src/log/operation-log.d.ts
53
+ interface OperationLogOptions {
54
+ readonly capacity: number;
55
+ readonly mergeWindowMs?: number;
56
+ readonly now?: () => number;
57
+ readonly onEntry?: (entry: OperationEntry) => void;
58
+ }
59
+ interface OperationLog {
60
+ record(input: OperationInput): void;
61
+ setCapacity(capacity: number): void;
62
+ snapshot(): OperationLogSnapshot;
63
+ }
64
+ declare function createOperationLog(options: OperationLogOptions): OperationLog;
65
+ //#endregion
66
+ //#region src/redact/redact.d.ts
67
+ interface RedactContext {
68
+ readonly ottoHome: string;
69
+ readonly cwd: string;
70
+ readonly home: string;
71
+ readonly workspaceName?: string;
72
+ readonly publicHosts?: readonly string[];
73
+ }
74
+ interface RedactResult {
75
+ readonly text: string;
76
+ readonly hits: Readonly<Record<string, number>>;
77
+ }
78
+ interface Redactor {
79
+ redact(text: string): RedactResult;
80
+ totals(): Readonly<Record<string, number>>;
81
+ }
82
+ declare function createRedactor(context: RedactContext): Redactor;
83
+ //#endregion
84
+ //#region src/bundle/zip.d.ts
85
+ interface ZipEntry {
86
+ readonly path: string;
87
+ readonly data: Buffer;
88
+ }
89
+ declare function writeZip(entries: readonly ZipEntry[]): Buffer;
90
+ //#endregion
91
+ //#region src/bundle/report.d.ts
92
+ interface ReportFileView {
93
+ readonly path: string;
94
+ readonly bytes: number;
95
+ }
96
+ interface ReportInput {
97
+ readonly bundleId: string;
98
+ readonly generatedAt: number;
99
+ readonly draft: FeedbackDraft;
100
+ readonly environment: EnvironmentFacts;
101
+ readonly session: SessionFacts;
102
+ readonly operations: OperationLogSnapshot;
103
+ readonly diagnostics: DiagnosticsFacts;
104
+ readonly files: readonly ReportFileView[];
105
+ }
106
+ declare function renderReport(input: ReportInput): string;
107
+ //#endregion
108
+ //#region src/collect/session-types.d.ts
109
+ interface SessionCollectLimits {
110
+ readonly entryLimit: number;
111
+ readonly bytesLimit: number;
112
+ readonly textLimit: number;
113
+ }
114
+ //#endregion
115
+ //#region src/collect/session.d.ts
116
+ interface SessionCollectInput {
117
+ readonly sessions: Pick<SessionManager, 'get' | 'surface' | 'surfaceWindowOf'>;
118
+ readonly sessionId: string | undefined;
119
+ readonly redactor: Redactor;
120
+ readonly limits?: SessionCollectLimits;
121
+ }
122
+ declare function collectSession(input: SessionCollectInput): Promise<SessionFacts>;
123
+ //#endregion
124
+ //#region src/collect/environment.d.ts
125
+ interface EnvironmentInput {
126
+ readonly hostInfo: HostInfoFact | undefined;
127
+ readonly pluginVersion: string;
128
+ readonly model?: string;
129
+ readonly provider?: string;
130
+ readonly permissionMode?: string;
131
+ readonly workspaceName?: string;
132
+ readonly includeWorkspaceName: boolean;
133
+ }
134
+ declare function collectEnvironment(input: EnvironmentInput): EnvironmentFacts;
135
+ //#endregion
136
+ //#region src/collect/diagnostics.d.ts
137
+ interface DiagnosticsCollectInput {
138
+ readonly directory: string;
139
+ readonly runId: string | undefined;
140
+ readonly redactor: Redactor;
141
+ readonly limitBytes?: number;
142
+ }
143
+ declare function collectDiagnostics(input: DiagnosticsCollectInput): Promise<DiagnosticsFacts>;
144
+ //#endregion
145
+ //#region src/publish/publisher.d.ts
146
+ interface FeedbackPublisher {
147
+ readonly id: string;
148
+ publish(bundle: FeedbackBundle, draft: FeedbackDraft, signal?: AbortSignal): Promise<PublishOutcome>;
149
+ }
150
+ //#endregion
151
+ //#region src/publish/outbox.d.ts
152
+ interface OutboxPublisherOptions {
153
+ readonly home: string;
154
+ }
155
+ declare function createOutboxPublisher(options: OutboxPublisherOptions): FeedbackPublisher;
156
+ //#endregion
157
+ //#region src/publish/service.d.ts
158
+ type ServiceUrlCheck = {
159
+ readonly ok: true;
160
+ readonly url: string;
161
+ } | {
162
+ readonly ok: false;
163
+ readonly code: string;
164
+ };
165
+ interface ServicePublisherOptions {
166
+ readonly timeoutMs?: number;
167
+ readonly fetchImpl?: typeof fetch;
168
+ readonly allowHttp?: () => boolean;
169
+ readonly serviceUrl: () => string;
170
+ readonly session: () => Promise<string | undefined>;
171
+ readonly allowedHosts?: () => readonly string[];
172
+ readonly invalidateSession?: () => void;
173
+ readonly readArchive?: (path: string) => Promise<Uint8Array>;
174
+ }
175
+ interface ServicePublisher {
176
+ publish(bundle: FeedbackBundle, draft: FeedbackDraft, signal?: AbortSignal): Promise<PublishOutcome>;
177
+ }
178
+ declare function checkServiceUrl(raw: string, allowedHosts?: readonly string[], allowHttp?: boolean): ServiceUrlCheck;
179
+ declare function createServicePublisher(options: ServicePublisherOptions): ServicePublisher;
180
+ //#endregion
181
+ //#region src/settings.d.ts
182
+ interface FeedbackSettings {
183
+ operationLogSize(): number;
184
+ includeDiagnostics(): boolean;
185
+ includeWorkspaceName(): boolean;
186
+ maxBundleBytes(): number;
187
+ publisher(): string;
188
+ serviceUrl(): string;
189
+ serviceAuthProvider(): string;
190
+ dispose(): void;
191
+ }
192
+ declare function registerFeedbackSettings(settings: SettingsManager): FeedbackSettings;
193
+ //#endregion
194
+ //#region src/index.d.ts
195
+ interface FeedbackOptions {
196
+ readonly home?: string;
197
+ readonly now?: () => number;
198
+ readonly newId?: () => string;
199
+ readonly onOperation?: (entry: OperationEntry) => void;
200
+ }
201
+ declare function createFeedbackComponent(defaults?: FeedbackOptions): Component<FeedbackOptions | undefined>;
202
+ declare const Feedback: Component<FeedbackOptions | undefined>;
203
+ //#endregion
204
+ export { BundleFile, CONSENT_POLICY_VERSION, ConsentScope, DiagnosticsFacts, EnvironmentFacts, Feedback, Feedback as default, FeedbackBundle, FeedbackCategory, FeedbackConsent, FeedbackDraft, FeedbackOptions, type FeedbackPorts, OperationEntry, OperationInput, OperationKind, OperationLogSnapshot, OperationReason, OperationStatus, PublishOutcome, SessionEntryView, SessionFacts, checkServiceUrl, collectDiagnostics, collectEnvironment, collectSession, createBundler, createFeedbackCommand, createFeedbackComponent, createOperationLog, createOutboxPublisher, createRedactor, createServicePublisher, defaultBundleId, feedbackCommandKey, feedbackPosition, feedbackPositionKey, linesOf, messagesOf, registerFeedbackSettings, renderReport, textOf, writeZip };