@punica/editor 1.6.19 → 1.6.21
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.
package/package.json
CHANGED
|
@@ -159,6 +159,44 @@ declare module 'punica' {
|
|
|
159
159
|
status: number;
|
|
160
160
|
/** Parsed JSON body (or null when the body was empty/non-JSON). */
|
|
161
161
|
json: unknown;
|
|
162
|
+
/** Lower-cased response headers (e.g. `retry-after`). */
|
|
163
|
+
headers?: Record<string, string>;
|
|
164
|
+
/** Raw body text — the only way to see a non-JSON error page. */
|
|
165
|
+
text?: string;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/** A streamed file download executed in the host (main) process. */
|
|
169
|
+
export interface HostHttpDownloadRequest {
|
|
170
|
+
/** Absolute source URL. */
|
|
171
|
+
url: string;
|
|
172
|
+
/** Absolute destination path; parent directories are created. */
|
|
173
|
+
dest: string;
|
|
174
|
+
/** Extra request headers (e.g. an Authorization bearer). */
|
|
175
|
+
headers?: Record<string, string>;
|
|
176
|
+
/** Correlation id echoed back on progress events. */
|
|
177
|
+
id?: string;
|
|
178
|
+
/** Idle timeout in ms (default host-defined). */
|
|
179
|
+
timeoutMs?: number;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/** Result of a `download` call. Non-2xx leaves no file on disk. */
|
|
183
|
+
export interface HostHttpDownloadResult {
|
|
184
|
+
/** Final HTTP status code (after redirects). */
|
|
185
|
+
status: number;
|
|
186
|
+
/** Destination path, when the download completed. */
|
|
187
|
+
filePath?: string;
|
|
188
|
+
/** Bytes written. */
|
|
189
|
+
bytes: number;
|
|
190
|
+
/** Error body text captured for a non-2xx response. */
|
|
191
|
+
error?: string;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/** Progress tick for an in-flight `download`. */
|
|
195
|
+
export interface HostHttpDownloadProgress {
|
|
196
|
+
id: string;
|
|
197
|
+
received: number;
|
|
198
|
+
/** Total bytes from `Content-Length`, or 0 when the server omits it. */
|
|
199
|
+
total: number;
|
|
162
200
|
}
|
|
163
201
|
|
|
164
202
|
/**
|
|
@@ -173,6 +211,22 @@ declare module 'punica' {
|
|
|
173
211
|
*/
|
|
174
212
|
export interface HostHttpApi {
|
|
175
213
|
requestJson(req: HostHttpJsonRequest): Promise<HostHttpJsonResponse>;
|
|
214
|
+
/**
|
|
215
|
+
* Stream a URL to a file in the host process. Optional: a host without
|
|
216
|
+
* filesystem-backed downloads omits it, and callers must feature-detect.
|
|
217
|
+
* Unlike a `curl` shell-out this reports the real HTTP status (so a
|
|
218
|
+
* gated 403 is distinguishable from a rate-limited 429) and keeps
|
|
219
|
+
* credentials out of any process argument list. Redirects are followed;
|
|
220
|
+
* an `Authorization` header is dropped when the redirect target changes
|
|
221
|
+
* origin, since the redirect URL is typically already pre-signed.
|
|
222
|
+
*/
|
|
223
|
+
download?(
|
|
224
|
+
req: HostHttpDownloadRequest
|
|
225
|
+
): Promise<HostHttpDownloadResult>;
|
|
226
|
+
/** Subscribe to progress ticks for `download`. Returns an unsubscribe. */
|
|
227
|
+
onDownloadProgress?(
|
|
228
|
+
listener: (progress: HostHttpDownloadProgress) => void
|
|
229
|
+
): () => void;
|
|
176
230
|
}
|
|
177
231
|
|
|
178
232
|
/** Options for starting the inbound MCP server listener. */
|