Skip to repository content

tenant.openagents/omega

No repository description is available.

OpenAgents Git authority 2026-07-28T06:21:04.474Z 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

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