@kana-ai/edgar-contracts 0.0.0-stage → 0.1.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.
- package/LICENSE +202 -0
- package/README.md +86 -2
- package/dist/diagnostic.schema.d.ts +14 -0
- package/dist/limit.schema.d.ts +14 -0
- package/dist/manifest.schema.d.ts +213 -0
- package/dist/outcome.schema.d.ts +107 -0
- package/dist/provider.schema.d.ts +435 -0
- package/dist/rpc.schema.d.ts +711 -0
- package/package.json +41 -3
- package/schemas/json/diagnostic.schema.json +38 -0
- package/schemas/json/limit.schema.json +32 -0
- package/schemas/json/manifest.schema.json +273 -0
- package/schemas/json/outcome.schema.json +210 -0
- package/schemas/json/provider.schema.json +515 -0
- package/schemas/json/rpc.schema.json +1036 -0
- package/schemas/ts/card.ts +36 -0
- package/schemas/ts/end.ts +67 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Kana.ai
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
202
|
+
|
package/README.md
CHANGED
|
@@ -1,3 +1,87 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @kana-ai/edgar-contracts
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
JSON Schemas (2020-12) of what the EDGAR engine and its TypeScript side exchange, and the TypeScript types generated from them.
|
|
4
|
+
|
|
5
|
+
Use this package when you write code that reads or writes one of these messages: the SDK, the extension runtime, a provider runtime, or a program that reads `edgar check --json`. An extension author does not import it directly: the SDK gives the same types. For how the processes talk, see [architecture](/docs/concepts/architecture.md#the-processes).
|
|
6
|
+
|
|
7
|
+
> `schemas/json/diagnostic.schema.json` and `schemas/json/limit.schema.json` come from the Rust types `Diagnostic` and `Limit`. After you change one of these types, run `edgar contracts emit` from the repository root, and commit the files. A unit test in `edgar-core` fails when a committed file differs. The other four schemas are written by hand until their types derive `JsonSchema`. For them, the files in `schemas/` are the source, and the engine's Rust types in `edgar-core` must match them. See [logs, spans and contracts](/docs/reference/observability.md#make-the-contracts-from-the-rust-types).
|
|
8
|
+
|
|
9
|
+
## Schemas
|
|
10
|
+
|
|
11
|
+
The package has two folders: `schemas/json/` holds the JSON Schema files, and `schemas/ts/` holds the Zod schemas that the TypeScript side imports.
|
|
12
|
+
|
|
13
|
+
| Schema | What it describes |
|
|
14
|
+
| ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
15
|
+
| `schemas/json/outcome.schema.json` | The outcome union, the temporary and the permanent kinds; `retry_after` is in seconds and `timeout_at` in Unix milliseconds; `done` and both failures take an optional `limit` |
|
|
16
|
+
| `schemas/json/limit.schema.json` | One rate or usage limit, `{source, remaining?, limit?, resets_at?, window?}`, made from the Rust `Limit` type by `edgar contracts emit`; `resets_at` is in Unix milliseconds |
|
|
17
|
+
| `schemas/json/rpc.schema.json` | The JSON-RPC 2.0 lines between the engine and `edgar-runtime`, their params and results, and the 4 MiB line limit (`MaxMessageBytes`) |
|
|
18
|
+
| `schemas/json/provider.schema.json` | The JSON-RPC 2.0 lines between the engine and a provider runtime such as `edgar-provider-claude`: `hello`, `session.*`, `tool.request` and the `session.event` notifications, with the `limit` event |
|
|
19
|
+
| `schemas/json/manifest.schema.json` | `edgar-extension.json`, which the SDK build writes |
|
|
20
|
+
| `schemas/json/diagnostic.schema.json` | One record of `edgar check --json` |
|
|
21
|
+
|
|
22
|
+
`schemas/ts/` holds the Zod schemas. `end.ts` has `runEnded`, the part of a `run_outcome` event that a note at the end of a run reads. `card.ts` has `cardBlock` and `cardSpec`, whose output types are the `CardBlock` and `CardSpec` of `rpc.schema.json`. The tracker extensions import them from `@kana-ai/edgar-contracts/card`, so their `create_card` schemas stay the same. A card's block has a `kind` (`defect`, `request`, `question` or `investigation`) and optional facts such as `service`, `fingerprint` (16 lower-case hex characters) and `severity`. The intake refuses a card whose block does not match, and says why on the card.
|
|
23
|
+
|
|
24
|
+
## Imports
|
|
25
|
+
|
|
26
|
+
| Import | What you get |
|
|
27
|
+
| ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
28
|
+
| `@kana-ai/edgar-contracts/<name>` | The generated types of `schemas/json/<name>.schema.json`, such as `import type { Outcome } from "@kana-ai/edgar-contracts/outcome"`. The default export is the schema file. |
|
|
29
|
+
| `@kana-ai/edgar-contracts/schemas/json/<file>` | A schema file by path, such as `@kana-ai/edgar-contracts/schemas/json/outcome.schema.json`. |
|
|
30
|
+
| `@kana-ai/edgar-contracts/card` | `cardBlock` and `cardSpec`. |
|
|
31
|
+
| `@kana-ai/edgar-contracts/end` | `runEnded`, the Zod schema of the part of a `run_outcome` payload that a note at the end of a run reads. |
|
|
32
|
+
|
|
33
|
+
This program type-checks an outcome and parses a card block:
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import type { Outcome } from "@kana-ai/edgar-contracts/outcome";
|
|
37
|
+
import { cardBlock } from "@kana-ai/edgar-contracts/card";
|
|
38
|
+
|
|
39
|
+
const outcome: Outcome = {
|
|
40
|
+
outcome: "permanent_failure",
|
|
41
|
+
kind: "invalid_input",
|
|
42
|
+
message: "no such card",
|
|
43
|
+
};
|
|
44
|
+
const block = cardBlock.safeParse({ kind: "defect", service: "notes" });
|
|
45
|
+
console.log(JSON.stringify(outcome), block.success);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```text
|
|
49
|
+
{"outcome":"permanent_failure","kind":"invalid_input","message":"no such card"} true
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Build
|
|
53
|
+
|
|
54
|
+
`pnpm build` writes the types to `dist/` with `json-schema-to-typescript`. `dist/` is not committed. `check-types` runs the build first, so a type that the schemas no longer give fails the check.
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pnpm --filter @kana-ai/edgar-contracts run build
|
|
58
|
+
pnpm --filter @kana-ai/edgar-contracts run test
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Change a schema
|
|
62
|
+
|
|
63
|
+
1. Change the schema in `schemas/json/`, and the Rust type of the same message in `edgar-core` (`model::outcome`, `model::rpc`, `project::manifest` or `project::diagnostic`).
|
|
64
|
+
1. Run `pnpm --filter @kana-ai/edgar-contracts run check-types`, and fix each type that changed.
|
|
65
|
+
1. Add a test in `tests/schemas.test.ts` with a message that the schema must accept, and one that it must refuse.
|
|
66
|
+
1. Run the Rust tests: the engine's own tests read and write the same JSON.
|
|
67
|
+
|
|
68
|
+
A schema and its Rust type that do not match is a defect: the engine refuses a message that the TypeScript side sends, or the other way.
|
|
69
|
+
|
|
70
|
+
## Tests
|
|
71
|
+
|
|
72
|
+
`tests/schemas.test.ts` checks the schemas with `ajv`: a full manifest is accepted, and an unknown capability or a half undo pair is refused; `executables` takes a program name and a path inside the extension, and refuses a path as a name, a missing reason and a path with `..`; each outcome word is accepted, and an unknown kind is refused; each failure takes only its own kinds; the JSON-RPC lines, a diagnostic and the provider lines match their schemas.
|
|
73
|
+
|
|
74
|
+
## Validation
|
|
75
|
+
|
|
76
|
+
These commands were run on 2026-11-10 on macOS with Node 26:
|
|
77
|
+
|
|
78
|
+
| Command | Exit code |
|
|
79
|
+
| --------------------------------------------------------------------------------- | ------------------- |
|
|
80
|
+
| `pnpm --filter @kana-ai/edgar-contracts run test` | 0, `pass 11` |
|
|
81
|
+
| `tsc --noEmit` on the program above, in a scratch package that links this package | 0 |
|
|
82
|
+
| `node` on the program above | 0, the output above |
|
|
83
|
+
|
|
84
|
+
## Where to read next
|
|
85
|
+
|
|
86
|
+
- [The SDK](/packages/sdk/README.md): the types that an extension author uses.
|
|
87
|
+
- [Events and outcomes](/docs/concepts/events-and-outcomes.md#outcomes): what each outcome and kind means.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Generated by json-schema-to-typescript from the schema of the same name. */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* One problem `edgar check` reports.
|
|
5
|
+
*/
|
|
6
|
+
export interface Diagnostic {
|
|
7
|
+
code: string;
|
|
8
|
+
column: number;
|
|
9
|
+
file: string;
|
|
10
|
+
help: string;
|
|
11
|
+
line: number;
|
|
12
|
+
message: string;
|
|
13
|
+
severity: "info" | "warning" | "error";
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Generated by json-schema-to-typescript from the schema of the same name. */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* What a vendor or a provider said about one rate or usage limit of `source`, a host such as
|
|
5
|
+
* `api.github.com` or a provider name such as `claude`. It rides beside an outcome on the wire
|
|
6
|
+
* and is split off at the boundary, so stored outcomes never hold it.
|
|
7
|
+
*/
|
|
8
|
+
export interface Limit {
|
|
9
|
+
limit?: number | null;
|
|
10
|
+
remaining?: number | null;
|
|
11
|
+
resets_at?: number | null;
|
|
12
|
+
source: string;
|
|
13
|
+
window?: string | null;
|
|
14
|
+
}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/** Generated by json-schema-to-typescript from the schema of the same name. */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This interface was referenced by `Manifest`'s JSON-Schema
|
|
5
|
+
* via the `definition` "Name".
|
|
6
|
+
*/
|
|
7
|
+
export type Name = string;
|
|
8
|
+
/**
|
|
9
|
+
* This interface was referenced by `Manifest`'s JSON-Schema
|
|
10
|
+
* via the `definition` "SecretName".
|
|
11
|
+
*/
|
|
12
|
+
export type SecretName = string;
|
|
13
|
+
/**
|
|
14
|
+
* The closed set of capabilities an extension may declare.
|
|
15
|
+
*
|
|
16
|
+
* This interface was referenced by `Manifest`'s JSON-Schema
|
|
17
|
+
* via the `definition` "Capability".
|
|
18
|
+
*/
|
|
19
|
+
export type Capability =
|
|
20
|
+
| ("sandbox:read" | "sandbox:write" | "git:push" | "tracker:read" | "tracker:write" | "runs:read" | "complete")
|
|
21
|
+
| string;
|
|
22
|
+
/**
|
|
23
|
+
* This interface was referenced by `Manifest`'s JSON-Schema
|
|
24
|
+
* via the `definition` "TrackerMethod".
|
|
25
|
+
*/
|
|
26
|
+
export type TrackerMethod =
|
|
27
|
+
| "list_cards"
|
|
28
|
+
| "card"
|
|
29
|
+
| "comments"
|
|
30
|
+
| "attachments"
|
|
31
|
+
| "comment"
|
|
32
|
+
| "move"
|
|
33
|
+
| "set_labels"
|
|
34
|
+
| "create_card"
|
|
35
|
+
| "close"
|
|
36
|
+
| "whoami"
|
|
37
|
+
| "person";
|
|
38
|
+
/**
|
|
39
|
+
* A program by the name that `PATH` finds it under, never a path.
|
|
40
|
+
*
|
|
41
|
+
* This interface was referenced by `Manifest`'s JSON-Schema
|
|
42
|
+
* via the `definition` "Program".
|
|
43
|
+
*/
|
|
44
|
+
export type Program = string;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* `edgar-extension.json`, written by the SDK build and read by discovery.
|
|
48
|
+
*/
|
|
49
|
+
export interface Manifest {
|
|
50
|
+
contract: number;
|
|
51
|
+
name: Name;
|
|
52
|
+
version: string;
|
|
53
|
+
config_schema: string | null;
|
|
54
|
+
secrets: Secret[];
|
|
55
|
+
capabilities: Capability[];
|
|
56
|
+
tools: Tool[];
|
|
57
|
+
webhooks: Webhook[];
|
|
58
|
+
workflows: string[];
|
|
59
|
+
roles: string[];
|
|
60
|
+
skills: string[];
|
|
61
|
+
tracker: Tracker | null;
|
|
62
|
+
environments: Environment[];
|
|
63
|
+
hooks: Hook[];
|
|
64
|
+
service?: Service;
|
|
65
|
+
executables?: Executables;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* This interface was referenced by `Manifest`'s JSON-Schema
|
|
69
|
+
* via the `definition` "Secret".
|
|
70
|
+
*/
|
|
71
|
+
export interface Secret {
|
|
72
|
+
name: SecretName;
|
|
73
|
+
hosts: string[];
|
|
74
|
+
/**
|
|
75
|
+
* How a person gets the value; `edgar check` prints it with X004.
|
|
76
|
+
*/
|
|
77
|
+
help?: string;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* This interface was referenced by `Manifest`'s JSON-Schema
|
|
81
|
+
* via the `definition` "Tool".
|
|
82
|
+
*/
|
|
83
|
+
export interface Tool {
|
|
84
|
+
name: Name;
|
|
85
|
+
description: string;
|
|
86
|
+
input_schema: string;
|
|
87
|
+
output_schema: string;
|
|
88
|
+
side_effect: boolean;
|
|
89
|
+
compensate?: Name;
|
|
90
|
+
lookup?: Name;
|
|
91
|
+
undo?: "none";
|
|
92
|
+
undo_reason?: string;
|
|
93
|
+
approval: "never" | "once" | "always" | "auto";
|
|
94
|
+
/**
|
|
95
|
+
* Off unless the project enables it.
|
|
96
|
+
*/
|
|
97
|
+
disabled: boolean;
|
|
98
|
+
secrets: SecretName[];
|
|
99
|
+
capabilities: Capability[];
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* This interface was referenced by `Manifest`'s JSON-Schema
|
|
103
|
+
* via the `definition` "Webhook".
|
|
104
|
+
*/
|
|
105
|
+
export interface Webhook {
|
|
106
|
+
route: Name;
|
|
107
|
+
signature: "hmac-sha256" | "ed25519" | "none";
|
|
108
|
+
secret: SecretName | null;
|
|
109
|
+
delivery_id_header: string | null;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* The tracker port; the engine calls `tracker.<method>` through `tool.call`.
|
|
113
|
+
*
|
|
114
|
+
* This interface was referenced by `Manifest`'s JSON-Schema
|
|
115
|
+
* via the `definition` "Tracker".
|
|
116
|
+
*/
|
|
117
|
+
export interface Tracker {
|
|
118
|
+
/**
|
|
119
|
+
* @minItems 11
|
|
120
|
+
*/
|
|
121
|
+
methods: [
|
|
122
|
+
TrackerMethod,
|
|
123
|
+
TrackerMethod,
|
|
124
|
+
TrackerMethod,
|
|
125
|
+
TrackerMethod,
|
|
126
|
+
TrackerMethod,
|
|
127
|
+
TrackerMethod,
|
|
128
|
+
TrackerMethod,
|
|
129
|
+
TrackerMethod,
|
|
130
|
+
TrackerMethod,
|
|
131
|
+
TrackerMethod,
|
|
132
|
+
TrackerMethod,
|
|
133
|
+
...TrackerMethod[]
|
|
134
|
+
];
|
|
135
|
+
secrets: SecretName[];
|
|
136
|
+
capabilities: Capability[];
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* An environment provider; the engine calls `environment.<name>.<step>` through `tool.call`.
|
|
140
|
+
*
|
|
141
|
+
* This interface was referenced by `Manifest`'s JSON-Schema
|
|
142
|
+
* via the `definition` "Environment".
|
|
143
|
+
*/
|
|
144
|
+
export interface Environment {
|
|
145
|
+
name: Name;
|
|
146
|
+
prepare: Step;
|
|
147
|
+
start: Step;
|
|
148
|
+
health: Step;
|
|
149
|
+
stop: Step;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* What the engine needs to call one function of the extension through `tool.call`.
|
|
153
|
+
*
|
|
154
|
+
* This interface was referenced by `Manifest`'s JSON-Schema
|
|
155
|
+
* via the `definition` "Step".
|
|
156
|
+
*/
|
|
157
|
+
export interface Step {
|
|
158
|
+
description: string;
|
|
159
|
+
input_schema: string;
|
|
160
|
+
output_schema: string;
|
|
161
|
+
secrets: SecretName[];
|
|
162
|
+
capabilities: Capability[];
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* A guardrail hook, or with `on = "event"` a feed of run events of the kinds in `events`; the engine calls `hook.<name>` through `tool.call`.
|
|
166
|
+
*
|
|
167
|
+
* This interface was referenced by `Manifest`'s JSON-Schema
|
|
168
|
+
* via the `definition` "Hook".
|
|
169
|
+
*/
|
|
170
|
+
export interface Hook {
|
|
171
|
+
name: Name;
|
|
172
|
+
on: "before_tool" | "after_tool" | "event";
|
|
173
|
+
/**
|
|
174
|
+
* @minItems 1
|
|
175
|
+
*/
|
|
176
|
+
events?: [string, ...string[]];
|
|
177
|
+
secrets: SecretName[];
|
|
178
|
+
capabilities: Capability[];
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* A long-lived function `edgar start` runs as `tool.call` of `service` once the manifest is approved; never idle-stopped, restarted with a backoff until its breaker opens.
|
|
182
|
+
*
|
|
183
|
+
* This interface was referenced by `Manifest`'s JSON-Schema
|
|
184
|
+
* via the `definition` "Service".
|
|
185
|
+
*/
|
|
186
|
+
export interface Service {
|
|
187
|
+
secrets: SecretName[];
|
|
188
|
+
capabilities: Capability[];
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* The programs the extension runs: `requires` must be on the machine, and `provides` are files the extension ships. `edgar check` refuses a project that lacks one.
|
|
192
|
+
*
|
|
193
|
+
* This interface was referenced by `Manifest`'s JSON-Schema
|
|
194
|
+
* via the `definition` "Executables".
|
|
195
|
+
*/
|
|
196
|
+
export interface Executables {
|
|
197
|
+
requires: RequiredProgram[];
|
|
198
|
+
provides: ProvidedExecutable[];
|
|
199
|
+
}
|
|
200
|
+
export interface RequiredProgram {
|
|
201
|
+
name: Program;
|
|
202
|
+
/**
|
|
203
|
+
* One sentence a person reads when the program is missing.
|
|
204
|
+
*/
|
|
205
|
+
reason: string;
|
|
206
|
+
}
|
|
207
|
+
export interface ProvidedExecutable {
|
|
208
|
+
name: Program;
|
|
209
|
+
/**
|
|
210
|
+
* The file, relative to the extension folder and inside it.
|
|
211
|
+
*/
|
|
212
|
+
path: string;
|
|
213
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/** Generated by json-schema-to-typescript from the schema of the same name. */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The one result of a stage or a tool call.
|
|
5
|
+
*/
|
|
6
|
+
export type Outcome = Done | Skipped | TemporaryFailure | PermanentFailure | Waiting;
|
|
7
|
+
/**
|
|
8
|
+
* A kind that may lead to another attempt.
|
|
9
|
+
*/
|
|
10
|
+
export type TemporaryKind =
|
|
11
|
+
| "provider_unavailable"
|
|
12
|
+
| "rate_limited"
|
|
13
|
+
| "network"
|
|
14
|
+
| "timeout"
|
|
15
|
+
| "silence"
|
|
16
|
+
| "lost_lease"
|
|
17
|
+
| "runtime_crashed"
|
|
18
|
+
| "disk_full"
|
|
19
|
+
| "interrupted"
|
|
20
|
+
| "not_performed";
|
|
21
|
+
/**
|
|
22
|
+
* A kind that trying again cannot help.
|
|
23
|
+
*/
|
|
24
|
+
export type PermanentKind =
|
|
25
|
+
| "invalid_input"
|
|
26
|
+
| "invalid"
|
|
27
|
+
| "tool_error"
|
|
28
|
+
| "refused"
|
|
29
|
+
| "attempts_exhausted"
|
|
30
|
+
| "denied_by_hook"
|
|
31
|
+
| "denied_by_person"
|
|
32
|
+
| "exposed"
|
|
33
|
+
| "stale_base"
|
|
34
|
+
| "manifest_drift"
|
|
35
|
+
| "context_exhausted"
|
|
36
|
+
| "token_budget"
|
|
37
|
+
| "unauthenticated"
|
|
38
|
+
| "forbidden"
|
|
39
|
+
| "not_found"
|
|
40
|
+
| "cancelled"
|
|
41
|
+
| "runtime_payload_too_large";
|
|
42
|
+
|
|
43
|
+
export interface Done {
|
|
44
|
+
outcome: "done";
|
|
45
|
+
output: unknown;
|
|
46
|
+
limit?: Limit;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* What a vendor or a provider said about one rate or usage limit: how much is left of `limit`, and when it resets. The engine keeps the newest one per `source` and does not start a stage on a used-up source before `resets_at`.
|
|
50
|
+
*/
|
|
51
|
+
export interface Limit {
|
|
52
|
+
/**
|
|
53
|
+
* The host of the API, such as `api.github.com`, or the provider name, such as `claude`.
|
|
54
|
+
*/
|
|
55
|
+
source: string;
|
|
56
|
+
/**
|
|
57
|
+
* The requests, tokens or credits left in the window.
|
|
58
|
+
*/
|
|
59
|
+
remaining?: number;
|
|
60
|
+
/**
|
|
61
|
+
* The size of the window.
|
|
62
|
+
*/
|
|
63
|
+
limit?: number;
|
|
64
|
+
/**
|
|
65
|
+
* When the window resets, in Unix milliseconds.
|
|
66
|
+
*/
|
|
67
|
+
resets_at?: number;
|
|
68
|
+
/**
|
|
69
|
+
* The vendor's name of the limit, such as `core`, `requests`, `tokens` or `five_hour`.
|
|
70
|
+
*/
|
|
71
|
+
window?: string;
|
|
72
|
+
}
|
|
73
|
+
export interface Skipped {
|
|
74
|
+
outcome: "skipped";
|
|
75
|
+
}
|
|
76
|
+
export interface TemporaryFailure {
|
|
77
|
+
outcome: "temporary_failure";
|
|
78
|
+
kind: TemporaryKind;
|
|
79
|
+
message: string;
|
|
80
|
+
/**
|
|
81
|
+
* Whole seconds to wait before the next attempt.
|
|
82
|
+
*/
|
|
83
|
+
retry_after?: number;
|
|
84
|
+
/**
|
|
85
|
+
* The raw vendor or provider code.
|
|
86
|
+
*/
|
|
87
|
+
cause?: string;
|
|
88
|
+
limit?: Limit;
|
|
89
|
+
}
|
|
90
|
+
export interface PermanentFailure {
|
|
91
|
+
outcome: "permanent_failure";
|
|
92
|
+
kind: PermanentKind;
|
|
93
|
+
message: string;
|
|
94
|
+
/**
|
|
95
|
+
* The raw vendor or provider code.
|
|
96
|
+
*/
|
|
97
|
+
cause?: string;
|
|
98
|
+
limit?: Limit;
|
|
99
|
+
}
|
|
100
|
+
export interface Waiting {
|
|
101
|
+
outcome: "waiting";
|
|
102
|
+
key: string;
|
|
103
|
+
/**
|
|
104
|
+
* Unix time in milliseconds.
|
|
105
|
+
*/
|
|
106
|
+
timeout_at: number;
|
|
107
|
+
}
|