@krak-stack/registry 0.1.18 → 0.1.20
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/README.md +5 -0
- package/dist/components/ui/code-block.d.ts +1 -3
- package/dist/components/ui/code-block.js +32 -60
- package/dist/components/ui/data-table.d.ts +202 -273
- package/dist/components/ui/data-table.js +1810 -2115
- package/dist/components/ui/effect-form.js +169 -170
- package/dist/components/ui/form.js +112 -113
- package/dist/components/ui/icon-input.js +40 -43
- package/dist/components/ui/menubar.d.ts +29 -0
- package/dist/components/ui/pagination.js +2 -2
- package/dist/components/ui/sidebar-layout.js +67 -72
- package/dist/components/ui/theme-switcher.js +3 -3
- package/dist/components/ui/virtualized-combobox.js +31 -34
- package/dist/lib/{docs-core.d.ts → docs.d.ts} +135 -144
- package/dist/lib/{docs-core.js → docs.js} +597 -440
- package/dist/lib/documentation-toolkit.d.ts +19 -1
- package/dist/lib/documentation-toolkit.js +164 -66
- package/dist/lib/httpapi-cli.d.ts +5 -4
- package/dist/lib/httpapi-cli.js +256 -34
- package/dist/lib/httpapi-client.js +3 -3
- package/dist/lib/httpapi-helpers.d.ts +8 -6
- package/dist/lib/httpapi-helpers.js +12 -12
- package/dist/lib/httpapi-mcp.js +3 -3
- package/dist/lib/httpapi-toolkit.js +3 -3
- package/dist/lib/markdown/content.d.ts +13 -0
- package/dist/lib/markdown/server.d.ts +19 -0
- package/dist/lib/query.js +6 -6
- package/dist/lib/seo.js +2 -2
- package/dist/lib/webfetch-toolkit.js +6 -6
- package/dist/services/agent/client/atom.d.ts +7 -0
- package/dist/services/agent/client/index.js +481 -304
- package/dist/services/agent/index.d.ts +16 -0
- package/dist/services/agent/index.js +102 -1
- package/dist/services/agent/schema.d.ts +28 -0
- package/dist/services/agent/schema.js +15 -4
- package/dist/services/file-extraction/index.js +4 -4
- package/dist/services/file-extraction/schema.js +2 -2
- package/dist/services/health/api.builder.d.ts +66 -0
- package/dist/services/health/api.group.d.ts +58 -0
- package/dist/services/health/index.d.ts +253 -0
- package/dist/services/health/index.js +186 -0
- package/dist/services/health/schema.d.ts +50 -0
- package/dist/services/notification/channels/ses/index.js +2 -2
- package/dist/services/notification/channels/ses/schema.js +2 -2
- package/dist/services/notification/client/index.js +5 -5
- package/dist/services/notification/index.js +2 -2
- package/dist/services/notification/persistence/drizzle.js +2 -2
- package/dist/services/notification/persistence/index.js +15 -15
- package/dist/services/notification/persistence/schema.js +12 -12
- package/dist/services/notification/public.js +7 -7
- package/dist/services/notification/schema.js +2 -2
- package/dist/services/s3/index.js +2 -2
- package/dist/services/s3/schema.js +2 -2
- package/package.json +10 -38
|
@@ -20,6 +20,14 @@ declare const AgentService_base: Context.ServiceClass<AgentService, "AgentServic
|
|
|
20
20
|
readonly type: Schema.Literal<"text-delta">;
|
|
21
21
|
readonly messageId: Schema.String;
|
|
22
22
|
readonly delta: Schema.String;
|
|
23
|
+
}, "Type"> | Schema.Struct.ReadonlySide<{
|
|
24
|
+
readonly type: Schema.Literal<"markdown-snapshot">;
|
|
25
|
+
readonly messageId: Schema.String;
|
|
26
|
+
readonly html: Schema.String;
|
|
27
|
+
readonly codeBlocks: Schema.$Array<Schema.Struct<{
|
|
28
|
+
readonly code: Schema.String;
|
|
29
|
+
readonly language: Schema.String;
|
|
30
|
+
}>>;
|
|
23
31
|
}, "Type"> | Schema.Struct.ReadonlySide<{
|
|
24
32
|
readonly type: Schema.Literal<"tool-call">;
|
|
25
33
|
readonly messageId: Schema.String;
|
|
@@ -66,6 +74,14 @@ declare const AgentService_base: Context.ServiceClass<AgentService, "AgentServic
|
|
|
66
74
|
readonly type: Schema.Literal<"text-delta">;
|
|
67
75
|
readonly messageId: Schema.String;
|
|
68
76
|
readonly delta: Schema.String;
|
|
77
|
+
}, "Type"> | Schema.Struct.ReadonlySide<{
|
|
78
|
+
readonly type: Schema.Literal<"markdown-snapshot">;
|
|
79
|
+
readonly messageId: Schema.String;
|
|
80
|
+
readonly html: Schema.String;
|
|
81
|
+
readonly codeBlocks: Schema.$Array<Schema.Struct<{
|
|
82
|
+
readonly code: Schema.String;
|
|
83
|
+
readonly language: Schema.String;
|
|
84
|
+
}>>;
|
|
69
85
|
}, "Type"> | Schema.Struct.ReadonlySide<{
|
|
70
86
|
readonly type: Schema.Literal<"tool-call">;
|
|
71
87
|
readonly messageId: Schema.String;
|
|
@@ -16,6 +16,76 @@ import {
|
|
|
16
16
|
Tool
|
|
17
17
|
} from "effect/unstable/ai";
|
|
18
18
|
|
|
19
|
+
// ../../src/lib/markdown/server.ts
|
|
20
|
+
var escapeHtml = (value) => value.replaceAll("&", "&").replaceAll('"', """).replaceAll("'", "'").replaceAll("<", "<").replaceAll(">", ">");
|
|
21
|
+
var decodeMarkdownCode = (value) => value.replaceAll(""", '"').replaceAll("'", "'").replaceAll("<", "<").replaceAll(">", ">").replaceAll("&", "&");
|
|
22
|
+
var safeUrl = (value, image = false) => {
|
|
23
|
+
if (value.startsWith("/") || value.startsWith("#") || value.startsWith("https://") || value.startsWith("http://") || !image && value.startsWith("mailto:")) {
|
|
24
|
+
return value;
|
|
25
|
+
}
|
|
26
|
+
return image ? "" : "#";
|
|
27
|
+
};
|
|
28
|
+
var markdownOptions = {
|
|
29
|
+
autolinks: true,
|
|
30
|
+
headings: { ids: true },
|
|
31
|
+
noHtmlBlocks: true,
|
|
32
|
+
noHtmlSpans: true,
|
|
33
|
+
tagFilter: true
|
|
34
|
+
};
|
|
35
|
+
var compileMarkdown = (source) => {
|
|
36
|
+
const codeBlocks = [];
|
|
37
|
+
const html = Bun.markdown.render(source, {
|
|
38
|
+
blockquote: (children) => `<blockquote>${children}</blockquote>`,
|
|
39
|
+
code: (children, meta) => {
|
|
40
|
+
const index = codeBlocks.length;
|
|
41
|
+
const code = decodeMarkdownCode(children.replace(/\n$/, ""));
|
|
42
|
+
const language = meta?.language ?? "text";
|
|
43
|
+
codeBlocks.push({ code, language });
|
|
44
|
+
return `<markdown-code-block data-index="${index}"></markdown-code-block>`;
|
|
45
|
+
},
|
|
46
|
+
codespan: (children) => `<code data-inline-code>${escapeHtml(children)}</code>`,
|
|
47
|
+
emphasis: (children) => `<em>${children}</em>`,
|
|
48
|
+
heading: (children, { id, level }) => {
|
|
49
|
+
const headingId = escapeHtml(id ?? "");
|
|
50
|
+
const anchor = level === 2 || level === 3 ? `<a href="#${headingId}" aria-hidden="true">#</a>` : "";
|
|
51
|
+
return `<h${level} id="${headingId}">${children}${anchor}</h${level}>`;
|
|
52
|
+
},
|
|
53
|
+
hr: () => "<hr>",
|
|
54
|
+
html: (children) => escapeHtml(children),
|
|
55
|
+
image: (children, { src, title }) => {
|
|
56
|
+
const resolvedSrc = safeUrl(src, true);
|
|
57
|
+
if (!resolvedSrc)
|
|
58
|
+
return children;
|
|
59
|
+
const titleAttribute = title ? ` title="${escapeHtml(title)}"` : "";
|
|
60
|
+
return `<img src="${escapeHtml(resolvedSrc)}" alt="${escapeHtml(children)}"${titleAttribute}>`;
|
|
61
|
+
},
|
|
62
|
+
link: (children, { href, title }) => {
|
|
63
|
+
const resolvedHref = safeUrl(href);
|
|
64
|
+
const external = /^https?:\/\//.test(resolvedHref);
|
|
65
|
+
const titleAttribute = title ? ` title="${escapeHtml(title)}"` : "";
|
|
66
|
+
const externalAttributes = external ? ' target="_blank" rel="noreferrer"' : "";
|
|
67
|
+
return `<a href="${escapeHtml(resolvedHref)}"${titleAttribute}${externalAttributes}>${children}</a>`;
|
|
68
|
+
},
|
|
69
|
+
list: (children, { ordered, start }) => ordered ? `<ol${start && start !== 1 ? ` start="${start}"` : ""}>${children}</ol>` : `<ul>${children}</ul>`,
|
|
70
|
+
listItem: (children, { checked }) => {
|
|
71
|
+
const checkbox = checked === undefined ? "" : `<input type="checkbox" disabled${checked ? " checked" : ""}>`;
|
|
72
|
+
return `<li>${checkbox}${children}</li>`;
|
|
73
|
+
},
|
|
74
|
+
paragraph: (children) => `<p>${children}</p>`,
|
|
75
|
+
strikethrough: (children) => `<del>${children}</del>`,
|
|
76
|
+
strong: (children) => `<strong>${children}</strong>`,
|
|
77
|
+
table: (children) => `<div data-markdown-table><table>${children}</table></div>`,
|
|
78
|
+
tbody: (children) => `<tbody>${children}</tbody>`,
|
|
79
|
+
td: (children, meta) => `<td${meta?.align ? ` align="${meta.align}"` : ""}>${children}</td>`,
|
|
80
|
+
text: escapeHtml,
|
|
81
|
+
th: (children, meta) => `<th${meta?.align ? ` align="${meta.align}"` : ""}>${children}</th>`,
|
|
82
|
+
thead: (children) => `<thead>${children}</thead>`,
|
|
83
|
+
tr: (children) => `<tr>${children}</tr>`
|
|
84
|
+
}, markdownOptions);
|
|
85
|
+
return { codeBlocks, html, source };
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
// ../../src/services/agent/index.ts
|
|
19
89
|
class AgentHistoryError extends Data.TaggedError("AgentHistoryError") {
|
|
20
90
|
}
|
|
21
91
|
var AgentStreamErrorDetails = Schema.Struct({
|
|
@@ -180,11 +250,42 @@ class AgentService extends Context.Service()("AgentService", {
|
|
|
180
250
|
prompt: action.type === "message" ? action.text : [],
|
|
181
251
|
toolkit
|
|
182
252
|
});
|
|
253
|
+
const renderedRounds = Stream.suspend(() => {
|
|
254
|
+
let source = "";
|
|
255
|
+
return rounds.pipe(Stream.groupedWithin(32, "50 millis"), Stream.flatMap((events) => {
|
|
256
|
+
const output = [];
|
|
257
|
+
let textChanged = false;
|
|
258
|
+
const appendSnapshot = () => {
|
|
259
|
+
if (!textChanged)
|
|
260
|
+
return;
|
|
261
|
+
const compiled = compileMarkdown(source);
|
|
262
|
+
output.push({
|
|
263
|
+
type: "markdown-snapshot",
|
|
264
|
+
messageId,
|
|
265
|
+
html: compiled.html,
|
|
266
|
+
codeBlocks: compiled.codeBlocks
|
|
267
|
+
});
|
|
268
|
+
textChanged = false;
|
|
269
|
+
};
|
|
270
|
+
for (const event of events) {
|
|
271
|
+
if (event.type === "text-delta") {
|
|
272
|
+
source += event.delta;
|
|
273
|
+
textChanged = true;
|
|
274
|
+
output.push(event);
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
appendSnapshot();
|
|
278
|
+
output.push(event);
|
|
279
|
+
}
|
|
280
|
+
appendSnapshot();
|
|
281
|
+
return Stream.fromIterable(output);
|
|
282
|
+
}));
|
|
283
|
+
});
|
|
183
284
|
const complete = Stream.fromEffect(Effect.gen(function* () {
|
|
184
285
|
const history2 = yield* conversation.exportJson;
|
|
185
286
|
return { type: "history", value: history2 };
|
|
186
287
|
})).pipe(Stream.concat(Stream.succeed({ type: "finish" })));
|
|
187
|
-
const response = Stream.concat(
|
|
288
|
+
const response = Stream.concat(renderedRounds, complete).pipe(Stream.provideService(LanguageModel.LanguageModel, model), Stream.catch((error) => Stream.fromEffect(Effect.logError("Agent stream failed", streamErrorDetails(error))).pipe(Stream.drain, Stream.concat(Stream.make({
|
|
188
289
|
type: "error",
|
|
189
290
|
code: "stream-failed"
|
|
190
291
|
}, { type: "finish" })))));
|
|
@@ -23,6 +23,10 @@ export declare const AgentToolMetadata: Schema.Struct<{
|
|
|
23
23
|
readonly description: Schema.optional<Schema.String>;
|
|
24
24
|
readonly destructive: Schema.Boolean;
|
|
25
25
|
}>;
|
|
26
|
+
export declare const AgentMarkdownCodeBlock: Schema.Struct<{
|
|
27
|
+
readonly code: Schema.String;
|
|
28
|
+
readonly language: Schema.String;
|
|
29
|
+
}>;
|
|
26
30
|
export declare const AgentEvent: Schema.Union<readonly [Schema.Struct<{
|
|
27
31
|
readonly type: Schema.Literal<"message-start">;
|
|
28
32
|
readonly messageId: Schema.String;
|
|
@@ -30,6 +34,14 @@ export declare const AgentEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
30
34
|
readonly type: Schema.Literal<"text-delta">;
|
|
31
35
|
readonly messageId: Schema.String;
|
|
32
36
|
readonly delta: Schema.String;
|
|
37
|
+
}>, Schema.Struct<{
|
|
38
|
+
readonly type: Schema.Literal<"markdown-snapshot">;
|
|
39
|
+
readonly messageId: Schema.String;
|
|
40
|
+
readonly html: Schema.String;
|
|
41
|
+
readonly codeBlocks: Schema.$Array<Schema.Struct<{
|
|
42
|
+
readonly code: Schema.String;
|
|
43
|
+
readonly language: Schema.String;
|
|
44
|
+
}>>;
|
|
33
45
|
}>, Schema.Struct<{
|
|
34
46
|
readonly type: Schema.Literal<"tool-call">;
|
|
35
47
|
readonly messageId: Schema.String;
|
|
@@ -93,6 +105,14 @@ export declare const makeAgentApiGroup: <const Resource extends Schema.Top>(reso
|
|
|
93
105
|
readonly type: Schema.Literal<"text-delta">;
|
|
94
106
|
readonly messageId: Schema.String;
|
|
95
107
|
readonly delta: Schema.String;
|
|
108
|
+
}>, Schema.Struct<{
|
|
109
|
+
readonly type: Schema.Literal<"markdown-snapshot">;
|
|
110
|
+
readonly messageId: Schema.String;
|
|
111
|
+
readonly html: Schema.String;
|
|
112
|
+
readonly codeBlocks: Schema.$Array<Schema.Struct<{
|
|
113
|
+
readonly code: Schema.String;
|
|
114
|
+
readonly language: Schema.String;
|
|
115
|
+
}>>;
|
|
96
116
|
}>, Schema.Struct<{
|
|
97
117
|
readonly type: Schema.Literal<"tool-call">;
|
|
98
118
|
readonly messageId: Schema.String;
|
|
@@ -130,6 +150,14 @@ export declare const makeAgentApiGroup: <const Resource extends Schema.Top>(reso
|
|
|
130
150
|
readonly type: Schema.Literal<"text-delta">;
|
|
131
151
|
readonly messageId: Schema.String;
|
|
132
152
|
readonly delta: Schema.String;
|
|
153
|
+
}, "Type"> | Schema.Struct.ReadonlySide<{
|
|
154
|
+
readonly type: Schema.Literal<"markdown-snapshot">;
|
|
155
|
+
readonly messageId: Schema.String;
|
|
156
|
+
readonly html: Schema.String;
|
|
157
|
+
readonly codeBlocks: Schema.$Array<Schema.Struct<{
|
|
158
|
+
readonly code: Schema.String;
|
|
159
|
+
readonly language: Schema.String;
|
|
160
|
+
}>>;
|
|
133
161
|
}, "Type"> | Schema.Struct.ReadonlySide<{
|
|
134
162
|
readonly type: Schema.Literal<"tool-call">;
|
|
135
163
|
readonly messageId: Schema.String;
|
|
@@ -43,6 +43,10 @@ var AgentToolMetadata = Schema.Struct({
|
|
|
43
43
|
description: Schema.optional(Schema.String),
|
|
44
44
|
destructive: Schema.Boolean
|
|
45
45
|
}).annotate({ identifier: "AgentToolMetadata" });
|
|
46
|
+
var AgentMarkdownCodeBlock = Schema.Struct({
|
|
47
|
+
code: Schema.String,
|
|
48
|
+
language: Schema.String
|
|
49
|
+
}).annotate({ identifier: "AgentMarkdownCodeBlock" });
|
|
46
50
|
var AgentEvent = Schema.Union([
|
|
47
51
|
Schema.Struct({
|
|
48
52
|
type: Schema.Literal("message-start"),
|
|
@@ -53,6 +57,12 @@ var AgentEvent = Schema.Union([
|
|
|
53
57
|
messageId: Schema.String,
|
|
54
58
|
delta: Schema.String
|
|
55
59
|
}),
|
|
60
|
+
Schema.Struct({
|
|
61
|
+
type: Schema.Literal("markdown-snapshot"),
|
|
62
|
+
messageId: Schema.String,
|
|
63
|
+
html: Schema.String,
|
|
64
|
+
codeBlocks: Schema.Array(AgentMarkdownCodeBlock)
|
|
65
|
+
}),
|
|
56
66
|
Schema.Struct({
|
|
57
67
|
type: Schema.Literal("tool-call"),
|
|
58
68
|
messageId: Schema.String,
|
|
@@ -122,9 +132,10 @@ var makeAgentApiGroup = (resource) => {
|
|
|
122
132
|
})));
|
|
123
133
|
};
|
|
124
134
|
export {
|
|
125
|
-
|
|
126
|
-
makeAgentApiGroup,
|
|
127
|
-
AgentToolMetadata,
|
|
135
|
+
AGENT_REFERENCE_LIMIT,
|
|
128
136
|
AgentEvent,
|
|
129
|
-
|
|
137
|
+
AgentMarkdownCodeBlock,
|
|
138
|
+
AgentToolMetadata,
|
|
139
|
+
makeAgentApiGroup,
|
|
140
|
+
makeAgentReference
|
|
130
141
|
};
|
|
@@ -111,9 +111,9 @@ class FileExtractionService extends Context.Service()("FileExtractionService", {
|
|
|
111
111
|
static testLayer = (service) => Layer.succeed(this, service);
|
|
112
112
|
}
|
|
113
113
|
export {
|
|
114
|
-
|
|
115
|
-
OutputFormat2 as OutputFormat,
|
|
116
|
-
FileExtractionService,
|
|
114
|
+
FileExtractedTextSchema,
|
|
117
115
|
FileExtractionFailed,
|
|
118
|
-
|
|
116
|
+
FileExtractionService,
|
|
117
|
+
OutputFormat2 as OutputFormat,
|
|
118
|
+
defaultFileExtractionOptions
|
|
119
119
|
};
|
|
@@ -9,6 +9,6 @@ var FileExtractedTextSchema = Schema.Struct({
|
|
|
9
9
|
class FileExtractionFailed extends Schema.TaggedErrorClass()("FileExtractionFailed", { message: Schema.String }) {
|
|
10
10
|
}
|
|
11
11
|
export {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
FileExtractedTextSchema,
|
|
13
|
+
FileExtractionFailed
|
|
14
14
|
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { HttpRouter } from "effect/unstable/http";
|
|
2
|
+
import { HttpApiBuilder, HttpApiGroup } from "effect/unstable/httpapi";
|
|
3
|
+
import { HealthApiGroup } from "./api.group.js";
|
|
4
|
+
import { HealthService } from "./index.js";
|
|
5
|
+
export declare const healthHandler: <const Prefix extends HttpRouter.PathInput>(handlers: HttpApiBuilder.Handlers.FromGroup<HttpApiGroup.AddPrefix<typeof HealthApiGroup, Prefix>>) => HttpApiBuilder.Handlers<HttpRouter.Request<"Requires", HealthService>, {
|
|
6
|
+
readonly getHealth: import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"getHealth", "GET", `${Prefix}/health`, never, never, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
7
|
+
readonly status: import("effect/Schema").Literal<"UP">;
|
|
8
|
+
readonly checks: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
9
|
+
readonly name: import("effect/Schema").NonEmptyString;
|
|
10
|
+
readonly status: import("effect/Schema").Literals<readonly ["UP", "DOWN"]>;
|
|
11
|
+
readonly data: import("effect/Schema").optionalKey<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").Boolean, import("effect/Schema").Number]>>>;
|
|
12
|
+
}>>;
|
|
13
|
+
}>>, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
14
|
+
readonly status: import("effect/Schema").Literal<"DOWN">;
|
|
15
|
+
readonly checks: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
16
|
+
readonly name: import("effect/Schema").NonEmptyString;
|
|
17
|
+
readonly status: import("effect/Schema").Literals<readonly ["UP", "DOWN"]>;
|
|
18
|
+
readonly data: import("effect/Schema").optionalKey<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").Boolean, import("effect/Schema").Number]>>>;
|
|
19
|
+
}>>;
|
|
20
|
+
}> | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never>;
|
|
21
|
+
readonly getLiveness: import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"getLiveness", "GET", `${Prefix}/health/live`, never, never, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
22
|
+
readonly status: import("effect/Schema").Literal<"UP">;
|
|
23
|
+
readonly checks: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
24
|
+
readonly name: import("effect/Schema").NonEmptyString;
|
|
25
|
+
readonly status: import("effect/Schema").Literals<readonly ["UP", "DOWN"]>;
|
|
26
|
+
readonly data: import("effect/Schema").optionalKey<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").Boolean, import("effect/Schema").Number]>>>;
|
|
27
|
+
}>>;
|
|
28
|
+
}>>, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
29
|
+
readonly status: import("effect/Schema").Literal<"DOWN">;
|
|
30
|
+
readonly checks: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
31
|
+
readonly name: import("effect/Schema").NonEmptyString;
|
|
32
|
+
readonly status: import("effect/Schema").Literals<readonly ["UP", "DOWN"]>;
|
|
33
|
+
readonly data: import("effect/Schema").optionalKey<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").Boolean, import("effect/Schema").Number]>>>;
|
|
34
|
+
}>>;
|
|
35
|
+
}> | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never>;
|
|
36
|
+
readonly getReadiness: import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"getReadiness", "GET", `${Prefix}/health/ready`, never, never, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
37
|
+
readonly status: import("effect/Schema").Literal<"UP">;
|
|
38
|
+
readonly checks: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
39
|
+
readonly name: import("effect/Schema").NonEmptyString;
|
|
40
|
+
readonly status: import("effect/Schema").Literals<readonly ["UP", "DOWN"]>;
|
|
41
|
+
readonly data: import("effect/Schema").optionalKey<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").Boolean, import("effect/Schema").Number]>>>;
|
|
42
|
+
}>>;
|
|
43
|
+
}>>, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
44
|
+
readonly status: import("effect/Schema").Literal<"DOWN">;
|
|
45
|
+
readonly checks: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
46
|
+
readonly name: import("effect/Schema").NonEmptyString;
|
|
47
|
+
readonly status: import("effect/Schema").Literals<readonly ["UP", "DOWN"]>;
|
|
48
|
+
readonly data: import("effect/Schema").optionalKey<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").Boolean, import("effect/Schema").Number]>>>;
|
|
49
|
+
}>>;
|
|
50
|
+
}> | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never>;
|
|
51
|
+
readonly getStartup: import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"getStartup", "GET", `${Prefix}/health/started`, never, never, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
52
|
+
readonly status: import("effect/Schema").Literal<"UP">;
|
|
53
|
+
readonly checks: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
54
|
+
readonly name: import("effect/Schema").NonEmptyString;
|
|
55
|
+
readonly status: import("effect/Schema").Literals<readonly ["UP", "DOWN"]>;
|
|
56
|
+
readonly data: import("effect/Schema").optionalKey<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").Boolean, import("effect/Schema").Number]>>>;
|
|
57
|
+
}>>;
|
|
58
|
+
}>>, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
59
|
+
readonly status: import("effect/Schema").Literal<"DOWN">;
|
|
60
|
+
readonly checks: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
61
|
+
readonly name: import("effect/Schema").NonEmptyString;
|
|
62
|
+
readonly status: import("effect/Schema").Literals<readonly ["UP", "DOWN"]>;
|
|
63
|
+
readonly data: import("effect/Schema").optionalKey<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").Boolean, import("effect/Schema").Number]>>>;
|
|
64
|
+
}>>;
|
|
65
|
+
}> | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never>;
|
|
66
|
+
}, "getHealth" | "getLiveness" | "getReadiness" | "getStartup">;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { HttpApiEndpoint, HttpApiError, HttpApiGroup } from "effect/unstable/httpapi";
|
|
2
|
+
export declare const HealthApiGroup: HttpApiGroup.HttpApiGroup<"health", HttpApiEndpoint.HttpApiEndpoint<"getHealth", "GET", "/health", never, never, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
3
|
+
readonly status: import("effect/Schema").Literal<"UP">;
|
|
4
|
+
readonly checks: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
5
|
+
readonly name: import("effect/Schema").NonEmptyString;
|
|
6
|
+
readonly status: import("effect/Schema").Literals<readonly ["UP", "DOWN"]>;
|
|
7
|
+
readonly data: import("effect/Schema").optionalKey<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").Boolean, import("effect/Schema").Number]>>>;
|
|
8
|
+
}>>;
|
|
9
|
+
}>>, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
10
|
+
readonly status: import("effect/Schema").Literal<"DOWN">;
|
|
11
|
+
readonly checks: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
12
|
+
readonly name: import("effect/Schema").NonEmptyString;
|
|
13
|
+
readonly status: import("effect/Schema").Literals<readonly ["UP", "DOWN"]>;
|
|
14
|
+
readonly data: import("effect/Schema").optionalKey<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").Boolean, import("effect/Schema").Number]>>>;
|
|
15
|
+
}>>;
|
|
16
|
+
}> | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getLiveness", "GET", "/health/live", never, never, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
17
|
+
readonly status: import("effect/Schema").Literal<"UP">;
|
|
18
|
+
readonly checks: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
19
|
+
readonly name: import("effect/Schema").NonEmptyString;
|
|
20
|
+
readonly status: import("effect/Schema").Literals<readonly ["UP", "DOWN"]>;
|
|
21
|
+
readonly data: import("effect/Schema").optionalKey<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").Boolean, import("effect/Schema").Number]>>>;
|
|
22
|
+
}>>;
|
|
23
|
+
}>>, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
24
|
+
readonly status: import("effect/Schema").Literal<"DOWN">;
|
|
25
|
+
readonly checks: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
26
|
+
readonly name: import("effect/Schema").NonEmptyString;
|
|
27
|
+
readonly status: import("effect/Schema").Literals<readonly ["UP", "DOWN"]>;
|
|
28
|
+
readonly data: import("effect/Schema").optionalKey<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").Boolean, import("effect/Schema").Number]>>>;
|
|
29
|
+
}>>;
|
|
30
|
+
}> | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getReadiness", "GET", "/health/ready", never, never, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
31
|
+
readonly status: import("effect/Schema").Literal<"UP">;
|
|
32
|
+
readonly checks: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
33
|
+
readonly name: import("effect/Schema").NonEmptyString;
|
|
34
|
+
readonly status: import("effect/Schema").Literals<readonly ["UP", "DOWN"]>;
|
|
35
|
+
readonly data: import("effect/Schema").optionalKey<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").Boolean, import("effect/Schema").Number]>>>;
|
|
36
|
+
}>>;
|
|
37
|
+
}>>, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
38
|
+
readonly status: import("effect/Schema").Literal<"DOWN">;
|
|
39
|
+
readonly checks: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
40
|
+
readonly name: import("effect/Schema").NonEmptyString;
|
|
41
|
+
readonly status: import("effect/Schema").Literals<readonly ["UP", "DOWN"]>;
|
|
42
|
+
readonly data: import("effect/Schema").optionalKey<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").Boolean, import("effect/Schema").Number]>>>;
|
|
43
|
+
}>>;
|
|
44
|
+
}> | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getStartup", "GET", "/health/started", never, never, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
45
|
+
readonly status: import("effect/Schema").Literal<"UP">;
|
|
46
|
+
readonly checks: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
47
|
+
readonly name: import("effect/Schema").NonEmptyString;
|
|
48
|
+
readonly status: import("effect/Schema").Literals<readonly ["UP", "DOWN"]>;
|
|
49
|
+
readonly data: import("effect/Schema").optionalKey<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").Boolean, import("effect/Schema").Number]>>>;
|
|
50
|
+
}>>;
|
|
51
|
+
}>>, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
52
|
+
readonly status: import("effect/Schema").Literal<"DOWN">;
|
|
53
|
+
readonly checks: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
54
|
+
readonly name: import("effect/Schema").NonEmptyString;
|
|
55
|
+
readonly status: import("effect/Schema").Literals<readonly ["UP", "DOWN"]>;
|
|
56
|
+
readonly data: import("effect/Schema").optionalKey<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").Boolean, import("effect/Schema").Number]>>>;
|
|
57
|
+
}>>;
|
|
58
|
+
}> | typeof HttpApiError.InternalServerError>, never, never>, false>;
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { Context, Effect, Layer } from "effect";
|
|
2
|
+
import type { HealthCheckData, HealthCheckOutcome } from "./schema.js";
|
|
3
|
+
export type HealthCheck<Requirements = never> = {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly check: Effect.Effect<HealthCheckOutcome, unknown, Requirements>;
|
|
6
|
+
};
|
|
7
|
+
export type HealthServiceChecks<Requirements = never> = {
|
|
8
|
+
readonly live?: ReadonlyArray<HealthCheck<Requirements>>;
|
|
9
|
+
readonly ready?: ReadonlyArray<HealthCheck<Requirements>>;
|
|
10
|
+
readonly started?: ReadonlyArray<HealthCheck<Requirements>>;
|
|
11
|
+
};
|
|
12
|
+
export type HealthServiceOptions<Requirements = never> = {
|
|
13
|
+
readonly checks?: HealthServiceChecks<Requirements>;
|
|
14
|
+
};
|
|
15
|
+
type RegisteredHealthChecks = {
|
|
16
|
+
readonly live: ReadonlyArray<HealthCheck>;
|
|
17
|
+
readonly ready: ReadonlyArray<HealthCheck>;
|
|
18
|
+
readonly started: ReadonlyArray<HealthCheck>;
|
|
19
|
+
};
|
|
20
|
+
declare const HealthServiceConfig_base: Context.ServiceClass<HealthServiceConfig, "@krak-stack/registry/HealthServiceConfig", RegisteredHealthChecks>;
|
|
21
|
+
declare class HealthServiceConfig extends HealthServiceConfig_base {
|
|
22
|
+
static readonly layerWith: <Requirements = never>({ checks, }?: HealthServiceOptions<Requirements>) => Layer.Layer<HealthServiceConfig, never, Exclude<Requirements, import("effect/Scope").Scope>>;
|
|
23
|
+
}
|
|
24
|
+
declare const HealthService_base: Context.ServiceClass<HealthService, "@krak-stack/registry/HealthService", {
|
|
25
|
+
aggregate: () => Effect.Effect<{
|
|
26
|
+
status: "UP";
|
|
27
|
+
checks: ({
|
|
28
|
+
name: string;
|
|
29
|
+
status: "DOWN" | "UP";
|
|
30
|
+
data?: undefined;
|
|
31
|
+
} | {
|
|
32
|
+
name: string;
|
|
33
|
+
status: "DOWN" | "UP";
|
|
34
|
+
data: {
|
|
35
|
+
readonly [x: string]: string | number | boolean;
|
|
36
|
+
};
|
|
37
|
+
})[];
|
|
38
|
+
} | {
|
|
39
|
+
status: "DOWN";
|
|
40
|
+
checks: ({
|
|
41
|
+
name: string;
|
|
42
|
+
status: "DOWN" | "UP";
|
|
43
|
+
data?: undefined;
|
|
44
|
+
} | {
|
|
45
|
+
name: string;
|
|
46
|
+
status: "DOWN" | "UP";
|
|
47
|
+
data: {
|
|
48
|
+
readonly [x: string]: string | number | boolean;
|
|
49
|
+
};
|
|
50
|
+
})[];
|
|
51
|
+
}, never, never>;
|
|
52
|
+
live: () => Effect.Effect<{
|
|
53
|
+
status: "UP";
|
|
54
|
+
checks: ({
|
|
55
|
+
name: string;
|
|
56
|
+
status: "DOWN" | "UP";
|
|
57
|
+
data?: undefined;
|
|
58
|
+
} | {
|
|
59
|
+
name: string;
|
|
60
|
+
status: "DOWN" | "UP";
|
|
61
|
+
data: {
|
|
62
|
+
readonly [x: string]: string | number | boolean;
|
|
63
|
+
};
|
|
64
|
+
})[];
|
|
65
|
+
} | {
|
|
66
|
+
status: "DOWN";
|
|
67
|
+
checks: ({
|
|
68
|
+
name: string;
|
|
69
|
+
status: "DOWN" | "UP";
|
|
70
|
+
data?: undefined;
|
|
71
|
+
} | {
|
|
72
|
+
name: string;
|
|
73
|
+
status: "DOWN" | "UP";
|
|
74
|
+
data: {
|
|
75
|
+
readonly [x: string]: string | number | boolean;
|
|
76
|
+
};
|
|
77
|
+
})[];
|
|
78
|
+
}, never, never>;
|
|
79
|
+
ready: () => Effect.Effect<{
|
|
80
|
+
status: "UP";
|
|
81
|
+
checks: ({
|
|
82
|
+
name: string;
|
|
83
|
+
status: "DOWN" | "UP";
|
|
84
|
+
data?: undefined;
|
|
85
|
+
} | {
|
|
86
|
+
name: string;
|
|
87
|
+
status: "DOWN" | "UP";
|
|
88
|
+
data: {
|
|
89
|
+
readonly [x: string]: string | number | boolean;
|
|
90
|
+
};
|
|
91
|
+
})[];
|
|
92
|
+
} | {
|
|
93
|
+
status: "DOWN";
|
|
94
|
+
checks: ({
|
|
95
|
+
name: string;
|
|
96
|
+
status: "DOWN" | "UP";
|
|
97
|
+
data?: undefined;
|
|
98
|
+
} | {
|
|
99
|
+
name: string;
|
|
100
|
+
status: "DOWN" | "UP";
|
|
101
|
+
data: {
|
|
102
|
+
readonly [x: string]: string | number | boolean;
|
|
103
|
+
};
|
|
104
|
+
})[];
|
|
105
|
+
}, never, never>;
|
|
106
|
+
started: () => Effect.Effect<{
|
|
107
|
+
status: "UP";
|
|
108
|
+
checks: ({
|
|
109
|
+
name: string;
|
|
110
|
+
status: "DOWN" | "UP";
|
|
111
|
+
data?: undefined;
|
|
112
|
+
} | {
|
|
113
|
+
name: string;
|
|
114
|
+
status: "DOWN" | "UP";
|
|
115
|
+
data: {
|
|
116
|
+
readonly [x: string]: string | number | boolean;
|
|
117
|
+
};
|
|
118
|
+
})[];
|
|
119
|
+
} | {
|
|
120
|
+
status: "DOWN";
|
|
121
|
+
checks: ({
|
|
122
|
+
name: string;
|
|
123
|
+
status: "DOWN" | "UP";
|
|
124
|
+
data?: undefined;
|
|
125
|
+
} | {
|
|
126
|
+
name: string;
|
|
127
|
+
status: "DOWN" | "UP";
|
|
128
|
+
data: {
|
|
129
|
+
readonly [x: string]: string | number | boolean;
|
|
130
|
+
};
|
|
131
|
+
})[];
|
|
132
|
+
}, never, never>;
|
|
133
|
+
}> & {
|
|
134
|
+
readonly make: Effect.Effect<{
|
|
135
|
+
aggregate: () => Effect.Effect<{
|
|
136
|
+
status: "UP";
|
|
137
|
+
checks: ({
|
|
138
|
+
name: string;
|
|
139
|
+
status: "DOWN" | "UP";
|
|
140
|
+
data?: undefined;
|
|
141
|
+
} | {
|
|
142
|
+
name: string;
|
|
143
|
+
status: "DOWN" | "UP";
|
|
144
|
+
data: {
|
|
145
|
+
readonly [x: string]: string | number | boolean;
|
|
146
|
+
};
|
|
147
|
+
})[];
|
|
148
|
+
} | {
|
|
149
|
+
status: "DOWN";
|
|
150
|
+
checks: ({
|
|
151
|
+
name: string;
|
|
152
|
+
status: "DOWN" | "UP";
|
|
153
|
+
data?: undefined;
|
|
154
|
+
} | {
|
|
155
|
+
name: string;
|
|
156
|
+
status: "DOWN" | "UP";
|
|
157
|
+
data: {
|
|
158
|
+
readonly [x: string]: string | number | boolean;
|
|
159
|
+
};
|
|
160
|
+
})[];
|
|
161
|
+
}, never, never>;
|
|
162
|
+
live: () => Effect.Effect<{
|
|
163
|
+
status: "UP";
|
|
164
|
+
checks: ({
|
|
165
|
+
name: string;
|
|
166
|
+
status: "DOWN" | "UP";
|
|
167
|
+
data?: undefined;
|
|
168
|
+
} | {
|
|
169
|
+
name: string;
|
|
170
|
+
status: "DOWN" | "UP";
|
|
171
|
+
data: {
|
|
172
|
+
readonly [x: string]: string | number | boolean;
|
|
173
|
+
};
|
|
174
|
+
})[];
|
|
175
|
+
} | {
|
|
176
|
+
status: "DOWN";
|
|
177
|
+
checks: ({
|
|
178
|
+
name: string;
|
|
179
|
+
status: "DOWN" | "UP";
|
|
180
|
+
data?: undefined;
|
|
181
|
+
} | {
|
|
182
|
+
name: string;
|
|
183
|
+
status: "DOWN" | "UP";
|
|
184
|
+
data: {
|
|
185
|
+
readonly [x: string]: string | number | boolean;
|
|
186
|
+
};
|
|
187
|
+
})[];
|
|
188
|
+
}, never, never>;
|
|
189
|
+
ready: () => Effect.Effect<{
|
|
190
|
+
status: "UP";
|
|
191
|
+
checks: ({
|
|
192
|
+
name: string;
|
|
193
|
+
status: "DOWN" | "UP";
|
|
194
|
+
data?: undefined;
|
|
195
|
+
} | {
|
|
196
|
+
name: string;
|
|
197
|
+
status: "DOWN" | "UP";
|
|
198
|
+
data: {
|
|
199
|
+
readonly [x: string]: string | number | boolean;
|
|
200
|
+
};
|
|
201
|
+
})[];
|
|
202
|
+
} | {
|
|
203
|
+
status: "DOWN";
|
|
204
|
+
checks: ({
|
|
205
|
+
name: string;
|
|
206
|
+
status: "DOWN" | "UP";
|
|
207
|
+
data?: undefined;
|
|
208
|
+
} | {
|
|
209
|
+
name: string;
|
|
210
|
+
status: "DOWN" | "UP";
|
|
211
|
+
data: {
|
|
212
|
+
readonly [x: string]: string | number | boolean;
|
|
213
|
+
};
|
|
214
|
+
})[];
|
|
215
|
+
}, never, never>;
|
|
216
|
+
started: () => Effect.Effect<{
|
|
217
|
+
status: "UP";
|
|
218
|
+
checks: ({
|
|
219
|
+
name: string;
|
|
220
|
+
status: "DOWN" | "UP";
|
|
221
|
+
data?: undefined;
|
|
222
|
+
} | {
|
|
223
|
+
name: string;
|
|
224
|
+
status: "DOWN" | "UP";
|
|
225
|
+
data: {
|
|
226
|
+
readonly [x: string]: string | number | boolean;
|
|
227
|
+
};
|
|
228
|
+
})[];
|
|
229
|
+
} | {
|
|
230
|
+
status: "DOWN";
|
|
231
|
+
checks: ({
|
|
232
|
+
name: string;
|
|
233
|
+
status: "DOWN" | "UP";
|
|
234
|
+
data?: undefined;
|
|
235
|
+
} | {
|
|
236
|
+
name: string;
|
|
237
|
+
status: "DOWN" | "UP";
|
|
238
|
+
data: {
|
|
239
|
+
readonly [x: string]: string | number | boolean;
|
|
240
|
+
};
|
|
241
|
+
})[];
|
|
242
|
+
}, never, never>;
|
|
243
|
+
}, never, HealthServiceConfig>;
|
|
244
|
+
};
|
|
245
|
+
export declare class HealthService extends HealthService_base {
|
|
246
|
+
static readonly up: (data?: HealthCheckData) => HealthCheckOutcome;
|
|
247
|
+
static readonly down: (data?: HealthCheckData) => HealthCheckOutcome;
|
|
248
|
+
static readonly layer: Layer.Layer<HealthService, never, never>;
|
|
249
|
+
static readonly layerWith: <Requirements = never>(options: HealthServiceOptions<Requirements>) => Layer.Layer<HealthService, never, Exclude<Requirements, import("effect/Scope").Scope>>;
|
|
250
|
+
}
|
|
251
|
+
export * from "./api.builder.js";
|
|
252
|
+
export * from "./api.group.js";
|
|
253
|
+
export * from "./schema.js";
|