1
>
/*---------------------------------------------------------------------------------------------
state.ts
2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
// allow-any-unicode-comment-file
7
>
// DO NOT EDIT -- auto-generated by scripts/sync-agent-host-protocol.ts
8
>
9
>
import type { URI } from '../common/state.js';
10
>
11
>
// ─── Resource Watch Types ────────────────────────────────────────────────────
12
>
13
>
/**
14
>
* Full state for a single resource watch, returned when a client subscribes
15
>
* to an `ahp-resource-watch:` URI.
16
>
*
17
>
* Watches are otherwise stateless: the watcher exists to deliver
18
>
* {@link ResourceWatchChangedAction} events. The state carries only the
19
>
* descriptor of what is being watched so a re-subscribing client can
20
>
* recover the watch configuration after reconnecting.
21
>
*
22
>
* @category Resource Watch Types
23
>
*/
24
>
export interface ResourceWatchState {
25
>
/**
26
>
* The URI being watched. For recursive watches this is the root of the
27
>
* subtree; for non-recursive watches this is the single file or
28
>
* directory.
29
>
*/
30
>
root: URI;
31
>
/**
32
>
* `true` if the watcher reports changes for descendants of `root`;
33
>
* `false` if it only reports changes to `root` itself (and, when
34
>
* `root` is a directory, its direct children).
35
>
*/
36
>
recursive: boolean;
37
>
/**
38
>
* Optional glob patterns or paths relative to `root` to exclude from
39
>
* change reporting.
40
>
*/
41
>
excludes?: { items: string[] };
42
>
/**
43
>
* Optional glob patterns or paths relative to `root` to restrict
44
>
* change reporting to. Omit to report every change under `root`
45
>
* subject to `excludes`.
46
>
*/
47
>
includes?: { items: string[] };
48
>
}
49
>
50
>
// ─── Resource Change ─────────────────────────────────────────────────────────
51
>
52
>
/**
53
>
* Discriminant for {@link ResourceChange.type}.
54
>
*
55
>
* @category Resource Watch Types
56
>
*/
57
>
export const enum ResourceChangeType {
58
>
Added = 'added',
59
>
Updated = 'updated',
60
>
Deleted = 'deleted',
61
>
}
62
>
63
>
/**
64
>
* A single change observed by a resource watcher.
65
>
*
66
>
* @category Resource Watch Types
67
>
*/
68
>
export interface ResourceChange {
69
>
/** The URI of the resource that changed. */
70
>
uri: URI;
71
>
/** The kind of change observed. */
72
>
type: ResourceChangeType;
73
>
}