@krak-stack/registry 0.1.11 → 0.1.14

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.
Files changed (51) hide show
  1. package/README.md +31 -2
  2. package/dist/components/ui/app-brand.d.ts +18 -13
  3. package/dist/components/ui/app-brand.js +48 -15
  4. package/dist/components/ui/code-block.js +10 -6
  5. package/dist/components/ui/copy-button.d.ts +1 -1
  6. package/dist/components/ui/copy-button.js +1 -1
  7. package/dist/components/ui/data-table.d.ts +1 -1
  8. package/dist/components/ui/data-table.js +21 -20
  9. package/dist/components/ui/effect-form.js +7 -6
  10. package/dist/components/ui/file-picker.js +2 -1
  11. package/dist/components/ui/form.js +17 -15
  12. package/dist/components/ui/google-map.d.ts +6 -10
  13. package/dist/components/ui/google-map.js +19 -14
  14. package/dist/components/ui/locale-switcher.js +7 -1
  15. package/dist/components/ui/sidebar-layout.js +19 -21
  16. package/dist/components/ui/theme-switcher.js +1 -1
  17. package/dist/lib/docs-core.js +165 -109
  18. package/dist/lib/documentation-toolkit.d.ts +140 -0
  19. package/dist/lib/{docs-ai.js → documentation-toolkit.js} +54 -63
  20. package/dist/lib/httpapi-cli.d.ts +6 -6
  21. package/dist/lib/httpapi-cli.js +75 -48
  22. package/dist/lib/httpapi-client.d.ts +8 -2
  23. package/dist/lib/httpapi-client.js +21 -9
  24. package/dist/lib/httpapi-helpers.d.ts +15 -21
  25. package/dist/lib/httpapi-helpers.js +38 -26
  26. package/dist/lib/httpapi-mcp.js +73 -50
  27. package/dist/lib/httpapi-toolkit.d.ts +20 -0
  28. package/dist/lib/{httpapi-ai.js → httpapi-toolkit.js} +123 -100
  29. package/dist/lib/seo.js +29 -17
  30. package/dist/lib/webfetch-toolkit.d.ts +45 -0
  31. package/dist/lib/webfetch-toolkit.js +276 -0
  32. package/dist/oxlint/anti-slop/index.js +1592 -0
  33. package/dist/services/agent/client/atom.d.ts +7 -7
  34. package/dist/services/agent/client/index.js +55 -54
  35. package/dist/services/agent/index.d.ts +71 -71
  36. package/dist/services/agent/index.js +38 -19
  37. package/dist/services/notification/channels/index.d.ts +11 -9
  38. package/dist/services/notification/channels/ses/index.d.ts +6 -6
  39. package/dist/services/notification/channels/ses/index.js +15 -11
  40. package/dist/services/notification/client/index.js +3 -2
  41. package/dist/services/notification/client/notification-menu.d.ts +9 -9
  42. package/dist/services/notification/index.d.ts +7 -6
  43. package/dist/services/notification/persistence/drizzle.js +214 -0
  44. package/dist/services/notification/persistence/index.js +227 -0
  45. package/dist/services/notification/persistence/schema.js +118 -0
  46. package/dist/services/notification/public.js +3 -2
  47. package/dist/services/s3/index.d.ts +2 -16
  48. package/dist/services/s3/index.js +12 -9
  49. package/package.json +33 -7
  50. package/dist/lib/docs-ai.d.ts +0 -142
  51. package/dist/lib/httpapi-ai.d.ts +0 -54
@@ -1,4 +1,4 @@
1
- import { Effect, Stream } from "effect";
1
+ import { Effect, Option, Stream } from "effect";
2
2
  import { Atom, Reactivity } from "effect/unstable/reactivity";
3
3
  import type { AgentErrorCode, AgentEvent, AgentReference, AgentRequest } from "../schema.js";
4
4
  export type AgentToolStatus = "running" | "approval-required" | "approved" | "denied" | "completed" | "failed";
@@ -37,9 +37,9 @@ export type AgentState<Resource = never> = {
37
37
  };
38
38
  export declare const initialAgentState: AgentState<never>;
39
39
  export declare const reduceAgentEvent: <Resource>(state: AgentState<Resource>, event: AgentEvent) => AgentState<Resource>;
40
- export type AgentAtomsConfig<Resource> = {
41
- readonly stream: (get: Atom.FnContext, request: AgentRequest<Resource>) => Effect.Effect<Stream.Stream<AgentEvent, unknown, Reactivity.Reactivity>, unknown>;
42
- readonly errorCode?: (error: unknown) => AgentErrorCode;
40
+ export type AgentAtomsConfig<Resource, Failure = ErrorOptions["cause"]> = {
41
+ readonly stream: (get: Atom.FnContext, request: AgentRequest<Resource>) => Effect.Effect<Stream.Stream<AgentEvent, Failure, Reactivity.Reactivity>, Failure>;
42
+ readonly errorCode?: (error: Failure) => AgentErrorCode;
43
43
  readonly reactivityKeys?: ReadonlyArray<unknown>;
44
44
  readonly runtime?: Atom.AtomRuntime<never>;
45
45
  };
@@ -48,9 +48,9 @@ export type AgentSubmitInput<Resource> = {
48
48
  readonly context?: AgentConversationContext<Resource>;
49
49
  readonly scope: string;
50
50
  };
51
- export declare const makeAgentAtoms: <Resource>({ errorCode, reactivityKeys, runtime, stream, }: AgentAtomsConfig<Resource>) => {
52
- readonly removeContext: Atom.Writable<import("effect/Option").Option<void>, string>;
53
- readonly reset: Atom.Writable<import("effect/Option").Option<void>, string>;
51
+ export declare const makeAgentAtoms: <Resource, Failure = unknown>({ errorCode, reactivityKeys, runtime, stream, }: AgentAtomsConfig<Resource, Failure>) => {
52
+ readonly removeContext: Atom.Writable<Option.Option<void>, string>;
53
+ readonly reset: Atom.Writable<Option.Option<void>, string>;
54
54
  readonly state: (arg: string) => Atom.Writable<AgentState<Resource>, AgentState<Resource>>;
55
55
  readonly submit: Atom.AtomResultFn<AgentSubmitInput<Resource>, void, never>;
56
56
  };
@@ -1,5 +1,5 @@
1
1
  // ../../src/services/agent/client/atom.ts
2
- import { Effect, Layer, Stream } from "effect";
2
+ import { Effect, Layer, Option, Schema, Stream } from "effect";
3
3
  import { Atom } from "effect/unstable/reactivity";
4
4
  var initialAgentState = {
5
5
  context: undefined,
@@ -64,12 +64,15 @@ var reduceAgentEvent = (state, event) => {
64
64
  return state;
65
65
  }
66
66
  };
67
+ var AgentError = Schema.Struct({
68
+ code: Schema.Literals(["stream-failed", "unavailable"])
69
+ }).annotate({ identifier: "AgentError" });
67
70
  var defaultErrorCode = (error) => {
68
- if (error && typeof error === "object") {
69
- const code = Reflect.get(error, "code");
70
- if (code === "stream-failed" || code === "unavailable")
71
- return code;
72
- }
71
+ const failure = Schema.decodeUnknownOption(AgentError)(error);
72
+ if (Option.isNone(failure))
73
+ return "unavailable";
74
+ if (failure.value.code === "stream-failed")
75
+ return "stream-failed";
73
76
  return "unavailable";
74
77
  };
75
78
  var makeAgentAtoms = ({
@@ -628,8 +631,9 @@ function InputGroupAddon({
628
631
  "data-align": align,
629
632
  className: cn(inputGroupAddonVariants({ align }), className),
630
633
  onClick: (event) => {
631
- if (event.target.closest("button"))
634
+ if (event.target instanceof HTMLElement && event.target.closest("button")) {
632
635
  return;
636
+ }
633
637
  event.currentTarget.parentElement?.querySelector("input")?.focus();
634
638
  },
635
639
  ...props
@@ -1346,7 +1350,7 @@ function isCustomStrategy(strategy2) {
1346
1350
  }
1347
1351
 
1348
1352
  // ../../src/services/agent/schema.ts
1349
- import { Schema } from "effect";
1353
+ import { Schema as Schema2 } from "effect";
1350
1354
  import {
1351
1355
  HttpApiEndpoint,
1352
1356
  HttpApiError,
@@ -1354,63 +1358,63 @@ import {
1354
1358
  HttpApiSchema,
1355
1359
  OpenApi
1356
1360
  } from "effect/unstable/httpapi";
1357
- var AgentMessageText = Schema.String.check(Schema.isLengthBetween(1, 4000)).annotate({
1361
+ var AgentMessageText = Schema2.String.check(Schema2.isLengthBetween(1, 4000)).annotate({
1358
1362
  identifier: "AgentMessageText",
1359
1363
  title: "Agent message",
1360
1364
  description: "A user message sent to the agent."
1361
1365
  });
1362
- var AgentReferenceLabel = Schema.String.check(Schema.isLengthBetween(1, 500));
1366
+ var AgentReferenceLabel = Schema2.String.check(Schema2.isLengthBetween(1, 500));
1363
1367
  var AGENT_REFERENCE_LIMIT = 20;
1364
- var AgentToolMetadata = Schema.Struct({
1365
- title: Schema.optional(Schema.String),
1366
- description: Schema.optional(Schema.String),
1367
- destructive: Schema.Boolean
1368
+ var AgentToolMetadata = Schema2.Struct({
1369
+ title: Schema2.optional(Schema2.String),
1370
+ description: Schema2.optional(Schema2.String),
1371
+ destructive: Schema2.Boolean
1368
1372
  }).annotate({ identifier: "AgentToolMetadata" });
1369
- var AgentEvent = Schema.Union([
1370
- Schema.Struct({
1371
- type: Schema.Literal("message-start"),
1372
- messageId: Schema.String
1373
+ var AgentEvent = Schema2.Union([
1374
+ Schema2.Struct({
1375
+ type: Schema2.Literal("message-start"),
1376
+ messageId: Schema2.String
1373
1377
  }),
1374
- Schema.Struct({
1375
- type: Schema.Literal("text-delta"),
1376
- messageId: Schema.String,
1377
- delta: Schema.String
1378
+ Schema2.Struct({
1379
+ type: Schema2.Literal("text-delta"),
1380
+ messageId: Schema2.String,
1381
+ delta: Schema2.String
1378
1382
  }),
1379
- Schema.Struct({
1380
- type: Schema.Literal("tool-call"),
1381
- messageId: Schema.String,
1382
- toolCallId: Schema.String,
1383
- name: Schema.String,
1384
- input: Schema.Unknown,
1383
+ Schema2.Struct({
1384
+ type: Schema2.Literal("tool-call"),
1385
+ messageId: Schema2.String,
1386
+ toolCallId: Schema2.String,
1387
+ name: Schema2.String,
1388
+ input: Schema2.Unknown,
1385
1389
  metadata: AgentToolMetadata
1386
1390
  }),
1387
- Schema.Struct({
1388
- type: Schema.Literal("tool-result"),
1389
- toolCallId: Schema.String,
1390
- name: Schema.String,
1391
- isFailure: Schema.Boolean
1391
+ Schema2.Struct({
1392
+ type: Schema2.Literal("tool-result"),
1393
+ toolCallId: Schema2.String,
1394
+ name: Schema2.String,
1395
+ isFailure: Schema2.Boolean
1392
1396
  }),
1393
- Schema.Struct({
1394
- type: Schema.Literal("approval-required"),
1395
- approvalId: Schema.String,
1396
- toolCallId: Schema.String
1397
+ Schema2.Struct({
1398
+ type: Schema2.Literal("approval-required"),
1399
+ approvalId: Schema2.String,
1400
+ toolCallId: Schema2.String
1397
1401
  }),
1398
- Schema.Struct({
1399
- type: Schema.Literal("history"),
1400
- value: Schema.String
1402
+ Schema2.Struct({
1403
+ type: Schema2.Literal("history"),
1404
+ value: Schema2.String
1401
1405
  }),
1402
- Schema.Struct({ type: Schema.Literal("finish") }),
1403
- Schema.Struct({
1404
- type: Schema.Literal("error"),
1405
- code: Schema.Literals(["unavailable", "invalid-request", "stream-failed"])
1406
+ Schema2.Struct({ type: Schema2.Literal("finish") }),
1407
+ Schema2.Struct({
1408
+ type: Schema2.Literal("error"),
1409
+ code: Schema2.Literals(["unavailable", "invalid-request", "stream-failed"])
1406
1410
  })
1407
1411
  ]).annotate({
1408
1412
  identifier: "AgentEvent",
1409
1413
  title: "Agent stream event",
1410
1414
  description: "An event emitted by the agent endpoint."
1411
1415
  });
1412
- var AgentStreamError = Schema.Struct({
1413
- code: Schema.Literals(["unavailable", "stream-failed"])
1416
+ var AgentStreamError = Schema2.Struct({
1417
+ code: Schema2.Literals(["unavailable", "stream-failed"])
1414
1418
  }).annotate({
1415
1419
  identifier: "AgentStreamError",
1416
1420
  title: "Agent stream error",
@@ -1891,16 +1895,13 @@ function AgentWidget({
1891
1895
  setInput("");
1892
1896
  setReferences([]);
1893
1897
  setReferencePickerOpen(false);
1894
- onSubmit({
1898
+ const messageReferences = references.length > 0 ? references.map(({ label, resource }) => ({ label, resource })) : undefined;
1899
+ const action = {
1895
1900
  type: "message",
1896
1901
  text,
1897
- ...references.length > 0 ? {
1898
- references: references.map(({ label, resource }) => ({
1899
- label,
1900
- resource
1901
- }))
1902
- } : {}
1903
- });
1902
+ references: messageReferences
1903
+ };
1904
+ onSubmit(action);
1904
1905
  };
1905
1906
  const respondToApproval = (tool, approved) => {
1906
1907
  if (!tool.approvalId || state.pending)
@@ -1,4 +1,4 @@
1
- import { Context, Effect, Layer, Stream } from "effect";
1
+ import { Context, Effect, Layer, Schema, Stream } from "effect";
2
2
  import { LanguageModel, Tool, Toolkit } from "effect/unstable/ai";
3
3
  import type { AgentAction } from "./schema.js";
4
4
  export type AgentStreamOptions<Tools extends Record<string, Tool.Any>> = {
@@ -13,41 +13,41 @@ declare const AgentHistoryError_base: new <A extends Record<string, any> = {}>(a
13
13
  declare class AgentHistoryError extends AgentHistoryError_base {
14
14
  }
15
15
  declare const AgentService_base: Context.ServiceClass<AgentService, "AgentService", {
16
- stream: <Tools extends Record<string, Tool.Any>>(args_0: AgentStreamOptions<Tools>) => Effect.Effect<Stream.Stream<import("effect/Schema").Struct.ReadonlySide<{
17
- readonly type: import("effect/Schema").Literal<"message-start">;
18
- readonly messageId: import("effect/Schema").String;
19
- }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
20
- readonly type: import("effect/Schema").Literal<"text-delta">;
21
- readonly messageId: import("effect/Schema").String;
22
- readonly delta: import("effect/Schema").String;
23
- }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
24
- readonly type: import("effect/Schema").Literal<"tool-call">;
25
- readonly messageId: import("effect/Schema").String;
26
- readonly toolCallId: import("effect/Schema").String;
27
- readonly name: import("effect/Schema").String;
28
- readonly input: import("effect/Schema").Unknown;
29
- readonly metadata: import("effect/Schema").Struct<{
30
- readonly title: import("effect/Schema").optional<import("effect/Schema").String>;
31
- readonly description: import("effect/Schema").optional<import("effect/Schema").String>;
32
- readonly destructive: import("effect/Schema").Boolean;
16
+ stream: <Tools extends Record<string, Tool.Any>>(args_0: AgentStreamOptions<Tools>) => Effect.Effect<Stream.Stream<Schema.Struct.ReadonlySide<{
17
+ readonly type: Schema.Literal<"message-start">;
18
+ readonly messageId: Schema.String;
19
+ }, "Type"> | Schema.Struct.ReadonlySide<{
20
+ readonly type: Schema.Literal<"text-delta">;
21
+ readonly messageId: Schema.String;
22
+ readonly delta: Schema.String;
23
+ }, "Type"> | Schema.Struct.ReadonlySide<{
24
+ readonly type: Schema.Literal<"tool-call">;
25
+ readonly messageId: Schema.String;
26
+ readonly toolCallId: Schema.String;
27
+ readonly name: Schema.String;
28
+ readonly input: Schema.Unknown;
29
+ readonly metadata: Schema.Struct<{
30
+ readonly title: Schema.optional<Schema.String>;
31
+ readonly description: Schema.optional<Schema.String>;
32
+ readonly destructive: Schema.Boolean;
33
33
  }>;
34
- }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
35
- readonly type: import("effect/Schema").Literal<"tool-result">;
36
- readonly toolCallId: import("effect/Schema").String;
37
- readonly name: import("effect/Schema").String;
38
- readonly isFailure: import("effect/Schema").Boolean;
39
- }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
40
- readonly type: import("effect/Schema").Literal<"approval-required">;
41
- readonly approvalId: import("effect/Schema").String;
42
- readonly toolCallId: import("effect/Schema").String;
43
- }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
44
- readonly type: import("effect/Schema").Literal<"history">;
45
- readonly value: import("effect/Schema").String;
46
- }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
47
- readonly type: import("effect/Schema").Literal<"finish">;
48
- }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
49
- readonly type: import("effect/Schema").Literal<"error">;
50
- readonly code: import("effect/Schema").Literals<readonly ["unavailable", "invalid-request", "stream-failed"]>;
34
+ }, "Type"> | Schema.Struct.ReadonlySide<{
35
+ readonly type: Schema.Literal<"tool-result">;
36
+ readonly toolCallId: Schema.String;
37
+ readonly name: Schema.String;
38
+ readonly isFailure: Schema.Boolean;
39
+ }, "Type"> | Schema.Struct.ReadonlySide<{
40
+ readonly type: Schema.Literal<"approval-required">;
41
+ readonly approvalId: Schema.String;
42
+ readonly toolCallId: Schema.String;
43
+ }, "Type"> | Schema.Struct.ReadonlySide<{
44
+ readonly type: Schema.Literal<"history">;
45
+ readonly value: Schema.String;
46
+ }, "Type"> | Schema.Struct.ReadonlySide<{
47
+ readonly type: Schema.Literal<"finish">;
48
+ }, "Type"> | Schema.Struct.ReadonlySide<{
49
+ readonly type: Schema.Literal<"error">;
50
+ readonly code: Schema.Literals<readonly ["unavailable", "invalid-request", "stream-failed"]>;
51
51
  }, "Type"> | {
52
52
  type: "history";
53
53
  value: string;
@@ -56,44 +56,44 @@ declare const AgentService_base: Context.ServiceClass<AgentService, "AgentServic
56
56
  code: "stream-failed";
57
57
  } | {
58
58
  type: "finish";
59
- }, never, Exclude<Tool.HandlerServices<Tools[keyof Tools]>, LanguageModel.LanguageModel> | Exclude<Tool.ResultDecodingServices<Tools[keyof Tools]>, LanguageModel.LanguageModel>>, AgentHistoryError | import("effect/SchemaError").SchemaError, LanguageModel.LanguageModel>;
59
+ }, never, Exclude<Tool.HandlerServices<Tools[keyof Tools]>, LanguageModel.LanguageModel> | Exclude<Tool.ResultDecodingServices<Tools[keyof Tools]>, LanguageModel.LanguageModel>>, AgentHistoryError | Schema.SchemaError, LanguageModel.LanguageModel>;
60
60
  }> & {
61
61
  readonly make: Effect.Effect<{
62
- stream: <Tools extends Record<string, Tool.Any>>(args_0: AgentStreamOptions<Tools>) => Effect.Effect<Stream.Stream<import("effect/Schema").Struct.ReadonlySide<{
63
- readonly type: import("effect/Schema").Literal<"message-start">;
64
- readonly messageId: import("effect/Schema").String;
65
- }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
66
- readonly type: import("effect/Schema").Literal<"text-delta">;
67
- readonly messageId: import("effect/Schema").String;
68
- readonly delta: import("effect/Schema").String;
69
- }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
70
- readonly type: import("effect/Schema").Literal<"tool-call">;
71
- readonly messageId: import("effect/Schema").String;
72
- readonly toolCallId: import("effect/Schema").String;
73
- readonly name: import("effect/Schema").String;
74
- readonly input: import("effect/Schema").Unknown;
75
- readonly metadata: import("effect/Schema").Struct<{
76
- readonly title: import("effect/Schema").optional<import("effect/Schema").String>;
77
- readonly description: import("effect/Schema").optional<import("effect/Schema").String>;
78
- readonly destructive: import("effect/Schema").Boolean;
62
+ stream: <Tools extends Record<string, Tool.Any>>(args_0: AgentStreamOptions<Tools>) => Effect.Effect<Stream.Stream<Schema.Struct.ReadonlySide<{
63
+ readonly type: Schema.Literal<"message-start">;
64
+ readonly messageId: Schema.String;
65
+ }, "Type"> | Schema.Struct.ReadonlySide<{
66
+ readonly type: Schema.Literal<"text-delta">;
67
+ readonly messageId: Schema.String;
68
+ readonly delta: Schema.String;
69
+ }, "Type"> | Schema.Struct.ReadonlySide<{
70
+ readonly type: Schema.Literal<"tool-call">;
71
+ readonly messageId: Schema.String;
72
+ readonly toolCallId: Schema.String;
73
+ readonly name: Schema.String;
74
+ readonly input: Schema.Unknown;
75
+ readonly metadata: Schema.Struct<{
76
+ readonly title: Schema.optional<Schema.String>;
77
+ readonly description: Schema.optional<Schema.String>;
78
+ readonly destructive: Schema.Boolean;
79
79
  }>;
80
- }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
81
- readonly type: import("effect/Schema").Literal<"tool-result">;
82
- readonly toolCallId: import("effect/Schema").String;
83
- readonly name: import("effect/Schema").String;
84
- readonly isFailure: import("effect/Schema").Boolean;
85
- }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
86
- readonly type: import("effect/Schema").Literal<"approval-required">;
87
- readonly approvalId: import("effect/Schema").String;
88
- readonly toolCallId: import("effect/Schema").String;
89
- }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
90
- readonly type: import("effect/Schema").Literal<"history">;
91
- readonly value: import("effect/Schema").String;
92
- }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
93
- readonly type: import("effect/Schema").Literal<"finish">;
94
- }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
95
- readonly type: import("effect/Schema").Literal<"error">;
96
- readonly code: import("effect/Schema").Literals<readonly ["unavailable", "invalid-request", "stream-failed"]>;
80
+ }, "Type"> | Schema.Struct.ReadonlySide<{
81
+ readonly type: Schema.Literal<"tool-result">;
82
+ readonly toolCallId: Schema.String;
83
+ readonly name: Schema.String;
84
+ readonly isFailure: Schema.Boolean;
85
+ }, "Type"> | Schema.Struct.ReadonlySide<{
86
+ readonly type: Schema.Literal<"approval-required">;
87
+ readonly approvalId: Schema.String;
88
+ readonly toolCallId: Schema.String;
89
+ }, "Type"> | Schema.Struct.ReadonlySide<{
90
+ readonly type: Schema.Literal<"history">;
91
+ readonly value: Schema.String;
92
+ }, "Type"> | Schema.Struct.ReadonlySide<{
93
+ readonly type: Schema.Literal<"finish">;
94
+ }, "Type"> | Schema.Struct.ReadonlySide<{
95
+ readonly type: Schema.Literal<"error">;
96
+ readonly code: Schema.Literals<readonly ["unavailable", "invalid-request", "stream-failed"]>;
97
97
  }, "Type"> | {
98
98
  type: "history";
99
99
  value: string;
@@ -102,7 +102,7 @@ declare const AgentService_base: Context.ServiceClass<AgentService, "AgentServic
102
102
  code: "stream-failed";
103
103
  } | {
104
104
  type: "finish";
105
- }, never, Exclude<Tool.HandlerServices<Tools[keyof Tools]>, LanguageModel.LanguageModel> | Exclude<Tool.ResultDecodingServices<Tools[keyof Tools]>, LanguageModel.LanguageModel>>, AgentHistoryError | import("effect/SchemaError").SchemaError, LanguageModel.LanguageModel>;
105
+ }, never, Exclude<Tool.HandlerServices<Tools[keyof Tools]>, LanguageModel.LanguageModel> | Exclude<Tool.ResultDecodingServices<Tools[keyof Tools]>, LanguageModel.LanguageModel>>, AgentHistoryError | Schema.SchemaError, LanguageModel.LanguageModel>;
106
106
  }, never, never>;
107
107
  };
108
108
  export declare class AgentService extends AgentService_base {
@@ -1,5 +1,14 @@
1
1
  // ../../src/services/agent/index.ts
2
- import { Context, Data, Effect, Layer, Option, Ref, Stream } from "effect";
2
+ import {
3
+ Context,
4
+ Data,
5
+ Effect,
6
+ Layer,
7
+ Option,
8
+ Ref,
9
+ Schema,
10
+ Stream
11
+ } from "effect";
3
12
  import {
4
13
  Chat,
5
14
  LanguageModel,
@@ -9,23 +18,30 @@ import {
9
18
 
10
19
  class AgentHistoryError extends Data.TaggedError("AgentHistoryError") {
11
20
  }
21
+ var AgentStreamErrorDetails = Schema.Struct({
22
+ message: Schema.optional(Schema.String),
23
+ reason: Schema.optional(Schema.String),
24
+ status: Schema.optional(Schema.Number),
25
+ _tag: Schema.optional(Schema.String)
26
+ }).annotate({ identifier: "AgentStreamErrorDetails" });
27
+ var decodeAgentStreamErrorDetails = Schema.decodeUnknownOption(AgentStreamErrorDetails);
12
28
 
13
29
  class AgentService extends Context.Service()("AgentService", {
14
30
  make: Effect.gen(function* () {
15
31
  const streamErrorDetails = (error) => {
16
- if (!error || typeof error !== "object") {
32
+ const details = Option.getOrUndefined(decodeAgentStreamErrorDetails(error));
33
+ if (!details)
17
34
  return { error: String(error) };
18
- }
19
- const message = Reflect.get(error, "message");
20
- const reason = Reflect.get(error, "reason");
21
- const status = Reflect.get(error, "status");
22
- const tag = Reflect.get(error, "_tag");
23
- return {
24
- ...typeof message === "string" ? { message } : {},
25
- ...typeof reason === "string" ? { reason } : {},
26
- ...typeof status === "number" ? { status } : {},
27
- ...typeof tag === "string" ? { tag } : {}
28
- };
35
+ const result = {};
36
+ if (details.message)
37
+ result.message = details.message;
38
+ if (details.reason)
39
+ result.reason = details.reason;
40
+ if (details.status !== undefined)
41
+ result.status = details.status;
42
+ if (details._tag)
43
+ result.tag = details._tag;
44
+ return result;
29
45
  };
30
46
  const eventsForPart = ({
31
47
  messageId,
@@ -45,11 +61,14 @@ class AgentService extends Context.Service()("AgentService", {
45
61
  toolCallId: part.id,
46
62
  name: part.name,
47
63
  input: part.params,
48
- metadata: {
49
- ...title ? { title } : {},
50
- ...tool?.description ? { description: tool.description } : {},
51
- destructive: tool ? Context.get(tool.annotations, Tool.Destructive) : false
52
- }
64
+ metadata: (() => {
65
+ const metadata = {
66
+ destructive: tool ? Context.get(tool.annotations, Tool.Destructive) : false,
67
+ title,
68
+ description: tool?.description
69
+ };
70
+ return metadata;
71
+ })()
53
72
  }
54
73
  ];
55
74
  }
@@ -120,7 +139,7 @@ class AgentService extends Context.Service()("AgentService", {
120
139
  const resolvedToolCallIds = new Set;
121
140
  for (const message of history.content) {
122
141
  for (const part of message.content) {
123
- if (typeof part === "string")
142
+ if (Schema.is(Schema.String)(part))
124
143
  continue;
125
144
  if (part.type === "tool-approval-request" && part.approvalId === action.approvalId) {
126
145
  pendingToolCallId = part.toolCallId;
@@ -1,22 +1,24 @@
1
1
  import { Context, Effect, Layer } from "effect";
2
+ import type { Json } from "effect/Schema";
2
3
  import { NotificationSendError } from "../schema.js";
3
4
  export interface NotificationChannels {
4
5
  }
5
- export type NotificationMessage = keyof NotificationChannels extends never ? Record<string, unknown> : Partial<{
6
+ export type NotificationMessage<FallbackPayload = Json> = keyof NotificationChannels extends never ? Record<string, FallbackPayload> : Partial<{
6
7
  readonly [Key in keyof NotificationChannels]: NotificationChannels[Key];
7
8
  }>;
8
- export interface NotificationChannelShape<Key extends string = string, Payload = unknown> {
9
+ export interface NotificationChannel<Key extends string = string, Payload = Json> {
9
10
  readonly key: Key;
10
- readonly send: (payload: unknown, message: NotificationMessage) => Effect.Effect<void, NotificationSendError>;
11
+ readonly send: (payload: Payload, message: NotificationMessage) => Effect.Effect<void, NotificationSendError>;
11
12
  readonly payload?: Payload;
12
13
  }
13
- export interface NotificationChannelRegistryShape {
14
- readonly channels: ReadonlyArray<NotificationChannelShape>;
14
+ export interface NotificationChannelRegistryService {
15
+ readonly channels: ReadonlyArray<NotificationChannel>;
15
16
  }
16
- declare const NotificationChannelRegistry_base: Context.ServiceClass<NotificationChannelRegistry, "NotificationChannelRegistry", NotificationChannelRegistryShape>;
17
+ /** @deprecated Use the domain-owned names without the Shape suffix. */
18
+ export { type NotificationChannel as NotificationChannelShape, type NotificationChannelRegistryService as NotificationChannelRegistryShape, };
19
+ declare const NotificationChannelRegistry_base: Context.ServiceClass<NotificationChannelRegistry, "NotificationChannelRegistry", NotificationChannelRegistryService>;
17
20
  export declare class NotificationChannelRegistry extends NotificationChannelRegistry_base {
18
- static readonly make: (...channels: ReadonlyArray<NotificationChannelShape>) => NotificationChannelRegistryShape;
19
- static readonly layer: (channels: ReadonlyArray<NotificationChannelShape>) => Layer.Layer<NotificationChannelRegistry, never, never>;
21
+ static readonly make: (...channels: ReadonlyArray<NotificationChannel>) => NotificationChannelRegistryService;
22
+ static readonly layer: (channels: ReadonlyArray<NotificationChannel>) => Layer.Layer<NotificationChannelRegistry, never, never>;
20
23
  static readonly emptyLayer: Layer.Layer<NotificationChannelRegistry, never, never>;
21
24
  }
22
- export {};
@@ -1,5 +1,5 @@
1
1
  import { Config, Context, Effect, Layer, Redacted } from "effect";
2
- import { type NotificationChannelShape } from "..";
2
+ import { type NotificationChannel } from "..";
3
3
  import { SesEmailNotification } from "./schema.js";
4
4
  declare module ".." {
5
5
  interface NotificationChannels {
@@ -14,17 +14,17 @@ interface SesIdentity {
14
14
  readonly region: string;
15
15
  readonly from: string | undefined;
16
16
  }
17
- interface SesNotificationConfigShape {
17
+ interface SesNotificationConfigService {
18
18
  readonly identity: SesIdentity;
19
19
  readonly accessKey: SesAccessKey;
20
20
  }
21
- declare const SesNotificationConfig_base: Context.ServiceClass<SesNotificationConfig, "SesNotificationConfig", SesNotificationConfigShape> & {
22
- readonly make: Effect.Effect<SesNotificationConfigShape, Config.ConfigError, never>;
21
+ declare const SesNotificationConfig_base: Context.ServiceClass<SesNotificationConfig, "SesNotificationConfig", SesNotificationConfigService> & {
22
+ readonly make: Effect.Effect<SesNotificationConfigService, Config.ConfigError, never>;
23
23
  };
24
24
  export declare class SesNotificationConfig extends SesNotificationConfig_base {
25
25
  static readonly layer: Layer.Layer<SesNotificationConfig, Config.ConfigError, never>;
26
26
  }
27
- declare const SesNotificationChannel_base: Context.ServiceClass<SesNotificationChannel, "SesNotificationChannel", NotificationChannelShape<"email", {
27
+ declare const SesNotificationChannel_base: Context.ServiceClass<SesNotificationChannel, "SesNotificationChannel", NotificationChannel<"email", {
28
28
  readonly from?: string | undefined;
29
29
  readonly to: string | readonly [string, ...string[]];
30
30
  readonly cc?: readonly string[] | undefined;
@@ -34,7 +34,7 @@ declare const SesNotificationChannel_base: Context.ServiceClass<SesNotificationC
34
34
  readonly text?: string | undefined;
35
35
  readonly html?: string | undefined;
36
36
  }>> & {
37
- readonly make: Effect.Effect<NotificationChannelShape<"email", {
37
+ readonly make: Effect.Effect<NotificationChannel<"email", {
38
38
  readonly from?: string | undefined;
39
39
  readonly to: string | readonly [string, ...string[]];
40
40
  readonly cc?: readonly string[] | undefined;
@@ -106,7 +106,7 @@ class SesNotificationChannel extends Context.Service()("SesNotificationChannel",
106
106
  FromEmailAddress: from,
107
107
  Destination: buildDestination(email),
108
108
  Content: { Simple: emailMessage },
109
- ...email.replyTo?.length ? { ReplyToAddresses: Array.from(email.replyTo) } : {}
109
+ ReplyToAddresses: email.replyTo?.length ? Array.from(email.replyTo) : undefined
110
110
  })),
111
111
  catch: (error) => notificationSendError("Failed to send SES email", error)
112
112
  });
@@ -119,7 +119,7 @@ class SesNotificationChannel extends Context.Service()("SesNotificationChannel",
119
119
  var notificationSendError = (message, error) => new NotificationSendError({
120
120
  channel: "email",
121
121
  message,
122
- ...error === undefined ? {} : { error }
122
+ error
123
123
  });
124
124
  var decodeEmail = (payload) => Schema3.decodeUnknownEffect(SesEmailNotification)(payload).pipe(Effect.mapError((error) => notificationSendError("Invalid SES email notification payload", error)));
125
125
  var requireBody = (email) => {
@@ -127,18 +127,22 @@ var requireBody = (email) => {
127
127
  if (!html && !text) {
128
128
  return Effect.fail(notificationSendError("SES email notification requires text or html"));
129
129
  }
130
- const body = {
131
- ...text ? { Text: { Data: text, Charset: "UTF-8" } } : {},
132
- ...html ? { Html: { Data: html, Charset: "UTF-8" } } : {}
133
- };
130
+ const body = {};
131
+ if (text)
132
+ body.Text = { Data: text, Charset: "UTF-8" };
133
+ if (html)
134
+ body.Html = { Data: html, Charset: "UTF-8" };
134
135
  return Effect.succeed(body);
135
136
  };
136
137
  var recipients = (to) => Array.isArray(to) ? Array.from(to) : [to];
137
- var buildDestination = (email) => ({
138
- ToAddresses: recipients(email.to),
139
- ...email.cc?.length ? { CcAddresses: Array.from(email.cc) } : {},
140
- ...email.bcc?.length ? { BccAddresses: Array.from(email.bcc) } : {}
141
- });
138
+ var buildDestination = (email) => {
139
+ const destination = { ToAddresses: recipients(email.to) };
140
+ if (email.cc?.length)
141
+ destination.CcAddresses = Array.from(email.cc);
142
+ if (email.bcc?.length)
143
+ destination.BccAddresses = Array.from(email.bcc);
144
+ return destination;
145
+ };
142
146
  export {
143
147
  SesNotificationConfig,
144
148
  SesNotificationChannel
@@ -8,6 +8,7 @@ import {
8
8
  TriangleAlert
9
9
  } from "lucide-react";
10
10
  import { useState } from "react";
11
+ import { Schema } from "effect";
11
12
 
12
13
  // ../../src/components/ui/badge.tsx
13
14
  import { mergeProps } from "@base-ui/react/merge-props";
@@ -974,7 +975,7 @@ function NotificationListItem({
974
975
  onNavigate(notification);
975
976
  return;
976
977
  }
977
- if (notification.href && typeof window !== "undefined") {
978
+ if (notification.href && globalThis.window) {
978
979
  window.location.assign(notification.href);
979
980
  }
980
981
  };
@@ -1112,7 +1113,7 @@ var formatNotificationDate = (value, locale) => {
1112
1113
  timeStyle: "short"
1113
1114
  }).format(date);
1114
1115
  };
1115
- var notificationTitle = (notification) => typeof notification.title === "string" ? notification.title : defaultMessages.en.notifications;
1116
+ var notificationTitle = (notification) => Schema.is(Schema.String)(notification.title) ? notification.title : defaultMessages.en.notifications;
1116
1117
  export {
1117
1118
  notificationMenuMessages,
1118
1119
  NotificationMenuTrigger,