@kana-ai/edgar-contracts 0.1.0 → 0.1.1
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.
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** The `edgar:v0` block of a card; its output type is the contract's `CardBlock`. */
|
|
3
|
+
export declare const cardBlock: z.ZodObject<{
|
|
4
|
+
kind: z.ZodEnum<{
|
|
5
|
+
defect: "defect";
|
|
6
|
+
investigation: "investigation";
|
|
7
|
+
question: "question";
|
|
8
|
+
request: "request";
|
|
9
|
+
}>;
|
|
10
|
+
service: z.ZodExactOptional<z.ZodString>;
|
|
11
|
+
environment: z.ZodExactOptional<z.ZodString>;
|
|
12
|
+
fingerprint: z.ZodExactOptional<z.ZodString>;
|
|
13
|
+
first_seen: z.ZodExactOptional<z.ZodISODateTime>;
|
|
14
|
+
last_seen: z.ZodExactOptional<z.ZodISODateTime>;
|
|
15
|
+
occurrences: z.ZodExactOptional<z.ZodNumber>;
|
|
16
|
+
severity: z.ZodExactOptional<z.ZodString>;
|
|
17
|
+
window: z.ZodExactOptional<z.ZodString>;
|
|
18
|
+
waits_for: z.ZodExactOptional<z.ZodString>;
|
|
19
|
+
decided: z.ZodExactOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
20
|
+
origin: z.ZodExactOptional<z.ZodObject<{
|
|
21
|
+
extension: z.ZodString;
|
|
22
|
+
channel: z.ZodString;
|
|
23
|
+
thread: z.ZodString;
|
|
24
|
+
}, z.core.$strict>>;
|
|
25
|
+
}, z.core.$strict>;
|
|
26
|
+
/** The card a tool files; its output type is the contract's `CardSpec`. */
|
|
27
|
+
export declare const cardSpec: z.ZodObject<{
|
|
28
|
+
title: z.ZodString;
|
|
29
|
+
description: z.ZodString;
|
|
30
|
+
column: z.ZodExactOptional<z.ZodString>;
|
|
31
|
+
labels: z.ZodExactOptional<z.ZodArray<z.ZodString>>;
|
|
32
|
+
block: z.ZodObject<{
|
|
33
|
+
kind: z.ZodEnum<{
|
|
34
|
+
defect: "defect";
|
|
35
|
+
investigation: "investigation";
|
|
36
|
+
question: "question";
|
|
37
|
+
request: "request";
|
|
38
|
+
}>;
|
|
39
|
+
service: z.ZodExactOptional<z.ZodString>;
|
|
40
|
+
environment: z.ZodExactOptional<z.ZodString>;
|
|
41
|
+
fingerprint: z.ZodExactOptional<z.ZodString>;
|
|
42
|
+
first_seen: z.ZodExactOptional<z.ZodISODateTime>;
|
|
43
|
+
last_seen: z.ZodExactOptional<z.ZodISODateTime>;
|
|
44
|
+
occurrences: z.ZodExactOptional<z.ZodNumber>;
|
|
45
|
+
severity: z.ZodExactOptional<z.ZodString>;
|
|
46
|
+
window: z.ZodExactOptional<z.ZodString>;
|
|
47
|
+
waits_for: z.ZodExactOptional<z.ZodString>;
|
|
48
|
+
decided: z.ZodExactOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
49
|
+
origin: z.ZodExactOptional<z.ZodObject<{
|
|
50
|
+
extension: z.ZodString;
|
|
51
|
+
channel: z.ZodString;
|
|
52
|
+
thread: z.ZodString;
|
|
53
|
+
}, z.core.$strict>>;
|
|
54
|
+
}, z.core.$strict>;
|
|
55
|
+
}, z.core.$strict>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** The `edgar:v0` block of a card; its output type is the contract's `CardBlock`. */
|
|
3
|
+
export const cardBlock = z.strictObject({
|
|
4
|
+
kind: z.enum(["defect", "request", "question", "investigation"]),
|
|
5
|
+
service: z.string().exactOptional(),
|
|
6
|
+
environment: z.string().exactOptional(),
|
|
7
|
+
fingerprint: z
|
|
8
|
+
.string()
|
|
9
|
+
.regex(/^[0-9a-f]{16}$/)
|
|
10
|
+
.exactOptional(),
|
|
11
|
+
first_seen: z.iso.datetime({ offset: true }).exactOptional(),
|
|
12
|
+
last_seen: z.iso.datetime({ offset: true }).exactOptional(),
|
|
13
|
+
occurrences: z.number().int().min(0).exactOptional(),
|
|
14
|
+
severity: z.string().exactOptional(),
|
|
15
|
+
window: z.string().exactOptional(),
|
|
16
|
+
waits_for: z.string().min(1).exactOptional(),
|
|
17
|
+
decided: z.record(z.string(), z.string()).exactOptional(),
|
|
18
|
+
origin: z
|
|
19
|
+
.strictObject({
|
|
20
|
+
extension: z.string().regex(/^[a-z][a-z0-9_]{0,63}$/),
|
|
21
|
+
channel: z.string().min(1),
|
|
22
|
+
thread: z.string().min(1),
|
|
23
|
+
})
|
|
24
|
+
.exactOptional(),
|
|
25
|
+
});
|
|
26
|
+
/** The card a tool files; its output type is the contract's `CardSpec`. */
|
|
27
|
+
export const cardSpec = z.strictObject({
|
|
28
|
+
title: z.string().min(1),
|
|
29
|
+
description: z.string(),
|
|
30
|
+
column: z.string().exactOptional(),
|
|
31
|
+
labels: z.array(z.string()).exactOptional(),
|
|
32
|
+
block: cardBlock,
|
|
33
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** The card of a run, as its `run_created` payload and the `end` of its `run_outcome` name it. In `run_created`, `event` is the card event that started the run, such as `created` or `comment`, and `tracker` is the extension of the tracker that holds the card. */
|
|
3
|
+
export declare const runCard: z.ZodObject<{
|
|
4
|
+
event: z.ZodOptional<z.ZodString>;
|
|
5
|
+
card: z.ZodOptional<z.ZodString>;
|
|
6
|
+
tracker: z.ZodOptional<z.ZodString>;
|
|
7
|
+
title: z.ZodOptional<z.ZodString>;
|
|
8
|
+
service: z.ZodOptional<z.ZodString>;
|
|
9
|
+
card_url: z.ZodOptional<z.ZodString>;
|
|
10
|
+
}, z.core.$loose>;
|
|
11
|
+
export type RunCard = z.infer<typeof runCard>;
|
|
12
|
+
/** The part of a `run_outcome` payload a note at the end of a run reads. */
|
|
13
|
+
export declare const runEnded: z.ZodObject<{
|
|
14
|
+
outcome: z.ZodObject<{
|
|
15
|
+
outcome: z.ZodString;
|
|
16
|
+
kind: z.ZodOptional<z.ZodString>;
|
|
17
|
+
message: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}, z.core.$loose>;
|
|
19
|
+
totals: z.ZodOptional<z.ZodObject<{
|
|
20
|
+
input_tokens: z.ZodNumber;
|
|
21
|
+
output_tokens: z.ZodNumber;
|
|
22
|
+
cost: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
}, z.core.$loose>>;
|
|
24
|
+
end: z.ZodOptional<z.ZodObject<{
|
|
25
|
+
event: z.ZodOptional<z.ZodString>;
|
|
26
|
+
card: z.ZodOptional<z.ZodString>;
|
|
27
|
+
tracker: z.ZodOptional<z.ZodString>;
|
|
28
|
+
title: z.ZodOptional<z.ZodString>;
|
|
29
|
+
service: z.ZodOptional<z.ZodString>;
|
|
30
|
+
card_url: z.ZodOptional<z.ZodString>;
|
|
31
|
+
assignee: z.ZodOptional<z.ZodString>;
|
|
32
|
+
started: z.ZodNumber;
|
|
33
|
+
workflow: z.ZodOptional<z.ZodString>;
|
|
34
|
+
failed_before: z.ZodDefault<z.ZodNumber>;
|
|
35
|
+
repeat: z.ZodDefault<z.ZodBoolean>;
|
|
36
|
+
pull_requests: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
37
|
+
url: z.ZodString;
|
|
38
|
+
number: z.ZodNumber;
|
|
39
|
+
referenced: z.ZodOptional<z.ZodLiteral<true>>;
|
|
40
|
+
}, z.core.$loose>>>;
|
|
41
|
+
reviewed: z.ZodOptional<z.ZodObject<{
|
|
42
|
+
state: z.ZodString;
|
|
43
|
+
review_state: z.ZodString;
|
|
44
|
+
approved_by: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
45
|
+
commit: z.ZodOptional<z.ZodString>;
|
|
46
|
+
}, z.core.$loose>>;
|
|
47
|
+
decision: z.ZodOptional<z.ZodString>;
|
|
48
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
49
|
+
options: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
50
|
+
question: z.ZodOptional<z.ZodString>;
|
|
51
|
+
risk: z.ZodOptional<z.ZodString>;
|
|
52
|
+
risk_reason: z.ZodOptional<z.ZodString>;
|
|
53
|
+
failed_stage: z.ZodOptional<z.ZodString>;
|
|
54
|
+
failure: z.ZodOptional<z.ZodString>;
|
|
55
|
+
}, z.core.$loose>>;
|
|
56
|
+
}, z.core.$loose>;
|
|
57
|
+
export type RunEnded = z.infer<typeof runEnded>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** A pull request of a run: one that it opened, a stage output that has a `url` and a `number`, or with `referenced` one that it only worked on or found, such as the pull request that a revise pushed to. The store takes any text as the `url`, so a reader checks it. */
|
|
3
|
+
const pullRequest = z.looseObject({
|
|
4
|
+
url: z.string(),
|
|
5
|
+
number: z.number().int(),
|
|
6
|
+
referenced: z.literal(true).optional(),
|
|
7
|
+
});
|
|
8
|
+
/** What people decided on a run's pull request: its `state` (`open`, `merged` or `closed`), its `review_state` (`pending`, `approved` or `changes_requested`), the logins that approved, and the merge commit of a merged pull request, else the commit that was reviewed. */
|
|
9
|
+
const reviewed = z.looseObject({
|
|
10
|
+
state: z.string(),
|
|
11
|
+
review_state: z.string(),
|
|
12
|
+
approved_by: z.array(z.string()).default([]),
|
|
13
|
+
commit: z.string().optional(),
|
|
14
|
+
});
|
|
15
|
+
/** What a run used; `cost` is in USD, when a model call reported one. */
|
|
16
|
+
const totals = z.looseObject({
|
|
17
|
+
input_tokens: z.number(),
|
|
18
|
+
output_tokens: z.number(),
|
|
19
|
+
cost: z.number().optional(),
|
|
20
|
+
});
|
|
21
|
+
/** The card of a run, as its `run_created` payload and the `end` of its `run_outcome` name it. In `run_created`, `event` is the card event that started the run, such as `created` or `comment`, and `tracker` is the extension of the tracker that holds the card. */
|
|
22
|
+
export const runCard = z.looseObject({
|
|
23
|
+
event: z.string().min(1).optional(),
|
|
24
|
+
card: z.string().min(1).optional(),
|
|
25
|
+
tracker: z.string().min(1).optional(),
|
|
26
|
+
title: z.string().optional(),
|
|
27
|
+
service: z.string().min(1).optional(),
|
|
28
|
+
card_url: z.string().min(1).optional(),
|
|
29
|
+
});
|
|
30
|
+
/** The `end` of a `run_outcome` payload: the run's card, when the run began in Unix milliseconds, its workflow, each pull request that it or its sub-runs opened or worked on, what people decided on it (`reviewed`), the `decision`, `summary` and `options` of its newest proposal, the `question` of its newest stage output that asks one, and the stage and message of its newest attempt that failed for good. `risk` is how likely the review thinks it that the change is not what its developers want, such as `low`, `moderate` or `high`, and `risk_reason` says why. For a run that a schedule started, `failed_before` counts the runs of that schedule that failed in a row just before it, and `repeat` says that the run just before it failed with the same failure kind. */
|
|
31
|
+
const runEnd = runCard.extend({
|
|
32
|
+
assignee: z.string().min(1).optional(),
|
|
33
|
+
started: z.number(),
|
|
34
|
+
workflow: z.string().min(1).optional(),
|
|
35
|
+
failed_before: z.number().int().nonnegative().default(0),
|
|
36
|
+
repeat: z.boolean().default(false),
|
|
37
|
+
pull_requests: z.array(pullRequest).default([]),
|
|
38
|
+
reviewed: reviewed.optional(),
|
|
39
|
+
decision: z.string().optional(),
|
|
40
|
+
summary: z.string().optional(),
|
|
41
|
+
options: z.array(z.string()).default([]),
|
|
42
|
+
question: z.string().optional(),
|
|
43
|
+
risk: z.string().optional(),
|
|
44
|
+
risk_reason: z.string().optional(),
|
|
45
|
+
failed_stage: z.string().optional(),
|
|
46
|
+
failure: z.string().optional(),
|
|
47
|
+
});
|
|
48
|
+
/** The part of a `run_outcome` payload a note at the end of a run reads. */
|
|
49
|
+
export const runEnded = z.looseObject({
|
|
50
|
+
outcome: z.looseObject({
|
|
51
|
+
outcome: z.string(),
|
|
52
|
+
kind: z.string().optional(),
|
|
53
|
+
message: z.string().optional(),
|
|
54
|
+
}),
|
|
55
|
+
totals: totals.optional(),
|
|
56
|
+
end: runEnd.optional(),
|
|
57
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kana-ai/edgar-contracts",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "JSON Schemas of the messages between the EDGAR engine and its TypeScript runtime, with generated types.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -10,13 +10,20 @@
|
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"schemas",
|
|
13
|
-
"dist"
|
|
13
|
+
"dist/*.d.ts",
|
|
14
|
+
"dist/js/schemas/ts"
|
|
14
15
|
],
|
|
15
16
|
"type": "module",
|
|
16
17
|
"exports": {
|
|
17
18
|
"./schemas/*": "./schemas/*",
|
|
18
|
-
"./card":
|
|
19
|
-
|
|
19
|
+
"./card": {
|
|
20
|
+
"types": "./dist/js/schemas/ts/card.d.ts",
|
|
21
|
+
"default": "./dist/js/schemas/ts/card.js"
|
|
22
|
+
},
|
|
23
|
+
"./end": {
|
|
24
|
+
"types": "./dist/js/schemas/ts/end.d.ts",
|
|
25
|
+
"default": "./dist/js/schemas/ts/end.js"
|
|
26
|
+
},
|
|
20
27
|
"./*": {
|
|
21
28
|
"types": "./dist/*.schema.d.ts",
|
|
22
29
|
"default": "./schemas/json/*.schema.json"
|