Skip to repository content

tenant.openagents/omega

No repository description is available.

OpenAgents Git authority 2026-07-28T05:20:47.443Z Public web read
NIP-34 coordinate30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omega
MaintainersHidden in public view
References2 branches · 1 tag
Read-only clonegit clone https://openagents.com/git/tenant.openagents/omega.git
Browse files

extension.wit

131 lines · 4.8 KB · text
1package zed:extension;
2
3world extension {
4    import github;
5    import platform;
6    import nodejs;
7
8    use lsp.{completion, symbol};
9
10    /// Initializes the extension.
11    export init-extension: func();
12
13    /// The type of a downloaded file.
14    enum downloaded-file-type {
15        /// A gzipped file (`.gz`).
16        gzip,
17        /// A gzipped tar archive (`.tar.gz`).
18        gzip-tar,
19        /// A ZIP file (`.zip`).
20        zip,
21        /// An uncompressed file.
22        uncompressed,
23    }
24
25    /// The installation status for a language server.
26    variant language-server-installation-status {
27        /// The language server has no installation status.
28        none,
29        /// The language server is being downloaded.
30        downloading,
31        /// The language server is checking for updates.
32        checking-for-update,
33        /// The language server installation failed for specified reason.
34        failed(string),
35    }
36
37    record settings-location {
38        worktree-id: u64,
39        path: string,
40    }
41
42    import get-settings: func(path: option<settings-location>, category: string, key: option<string>) -> result<string, string>;
43
44    /// Downloads a file from the given URL and saves it to the given path within the extension's
45    /// working directory.
46    ///
47    /// The file will be extracted according to the given file type.
48    import download-file: func(url: string, file-path: string, file-type: downloaded-file-type) -> result<_, string>;
49
50    /// Makes the file at the given path executable.
51    import make-file-executable: func(filepath: string) -> result<_, string>;
52
53    /// Updates the installation status for the given language server.
54    import set-language-server-installation-status: func(language-server-name: string, status: language-server-installation-status);
55
56    /// A list of environment variables.
57    type env-vars = list<tuple<string, string>>;
58
59    /// A command.
60    record command {
61        /// The command to execute.
62        command: string,
63        /// The arguments to pass to the command.
64        args: list<string>,
65        /// The environment variables to set for the command.
66        env: env-vars,
67    }
68
69    /// A Zed worktree.
70    resource worktree {
71        /// Returns the ID of the worktree.
72        id: func() -> u64;
73        /// Returns the root path of the worktree.
74        root-path: func() -> string;
75        /// Returns the textual contents of the specified file in the worktree.
76        read-text-file: func(path: string) -> result<string, string>;
77        /// Returns the path to the given binary name, if one is present on the `$PATH`.
78        which: func(binary-name: string) -> option<string>;
79        /// Returns the current shell environment.
80        shell-env: func() -> env-vars;
81    }
82
83    /// Returns the command used to start up the language server.
84    export language-server-command: func(language-server-id: string, worktree: borrow<worktree>) -> result<command, string>;
85
86    /// Returns the initialization options to pass to the language server on startup.
87    ///
88    /// The initialization options are represented as a JSON string.
89    export language-server-initialization-options: func(language-server-id: string, worktree: borrow<worktree>) -> result<option<string>, string>;
90
91    /// Returns the workspace configuration options to pass to the language server.
92    export language-server-workspace-configuration: func(language-server-id: string, worktree: borrow<worktree>) -> result<option<string>, string>;
93
94    /// A label containing some code.
95    record code-label {
96        /// The source code to parse with Tree-sitter.
97        code: string,
98        /// The spans to display in the label.
99        spans: list<code-label-span>,
100        /// The range of the displayed label to include when filtering.
101        filter-range: range,
102    }
103
104    /// A span within a code label.
105    variant code-label-span {
106        /// A range into the parsed code.
107        code-range(range),
108        /// A span containing a code literal.
109        literal(code-label-span-literal),
110    }
111
112    /// A span containing a code literal.
113    record code-label-span-literal {
114        /// The literal text.
115        text: string,
116        /// The name of the highlight to use for this literal.
117        highlight-name: option<string>,
118    }
119
120    /// A (half-open) range (`[start, end)`).
121    record range {
122        /// The start of the range (inclusive).
123        start: u32,
124        /// The end of the range (exclusive).
125        end: u32,
126    }
127
128    export labels-for-completions: func(language-server-id: string, completions: list<completion>) -> result<list<option<code-label>>, string>;
129    export labels-for-symbols: func(language-server-id: string, symbols: list<symbol>) -> result<list<option<code-label>>, string>;
130}
131
Served at tenant.openagents/omega Member data and write actions are omitted.