@krak-stack/registry 0.1.19 → 0.1.21

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 (50) hide show
  1. package/dist/components/ui/code-block.d.ts +1 -3
  2. package/dist/components/ui/code-block.js +32 -60
  3. package/dist/components/ui/data-table.d.ts +211 -273
  4. package/dist/components/ui/data-table.js +1894 -2012
  5. package/dist/components/ui/effect-form.js +169 -170
  6. package/dist/components/ui/form.js +112 -113
  7. package/dist/components/ui/icon-input.js +40 -43
  8. package/dist/components/ui/menubar.d.ts +29 -0
  9. package/dist/components/ui/pagination.js +2 -2
  10. package/dist/components/ui/sidebar-layout.js +67 -72
  11. package/dist/components/ui/theme-switcher.js +3 -3
  12. package/dist/components/ui/virtualized-combobox.js +31 -34
  13. package/dist/lib/{docs-core.d.ts → docs.d.ts} +135 -144
  14. package/dist/lib/{docs-core.js → docs.js} +597 -440
  15. package/dist/lib/documentation-toolkit.d.ts +19 -1
  16. package/dist/lib/documentation-toolkit.js +164 -66
  17. package/dist/lib/httpapi-cli.d.ts +5 -4
  18. package/dist/lib/httpapi-cli.js +256 -34
  19. package/dist/lib/httpapi-client.js +3 -3
  20. package/dist/lib/httpapi-helpers.d.ts +8 -6
  21. package/dist/lib/httpapi-helpers.js +12 -12
  22. package/dist/lib/httpapi-mcp.js +3 -3
  23. package/dist/lib/httpapi-toolkit.js +3 -3
  24. package/dist/lib/markdown/content.d.ts +13 -0
  25. package/dist/lib/markdown/server.d.ts +19 -0
  26. package/dist/lib/query.d.ts +3 -2
  27. package/dist/lib/query.js +10 -8
  28. package/dist/lib/seo.js +2 -2
  29. package/dist/lib/webfetch-toolkit.js +6 -6
  30. package/dist/services/agent/client/atom.d.ts +7 -0
  31. package/dist/services/agent/client/index.js +481 -304
  32. package/dist/services/agent/index.d.ts +16 -0
  33. package/dist/services/agent/index.js +102 -1
  34. package/dist/services/agent/schema.d.ts +28 -0
  35. package/dist/services/agent/schema.js +15 -4
  36. package/dist/services/file-extraction/index.js +4 -4
  37. package/dist/services/file-extraction/schema.js +2 -2
  38. package/dist/services/health/index.js +9 -9
  39. package/dist/services/notification/channels/ses/index.js +2 -2
  40. package/dist/services/notification/channels/ses/schema.js +2 -2
  41. package/dist/services/notification/client/index.js +5 -5
  42. package/dist/services/notification/index.js +2 -2
  43. package/dist/services/notification/persistence/drizzle.js +2 -2
  44. package/dist/services/notification/persistence/index.js +15 -15
  45. package/dist/services/notification/persistence/schema.js +12 -12
  46. package/dist/services/notification/public.js +7 -7
  47. package/dist/services/notification/schema.js +2 -2
  48. package/dist/services/s3/index.js +2 -2
  49. package/dist/services/s3/schema.js +2 -2
  50. package/package.json +6 -38
@@ -7,13 +7,14 @@ import {
7
7
  Exit,
8
8
  FileSystem,
9
9
  Layer as Layer3,
10
+ Option as Option2,
10
11
  Path,
11
12
  Schema as Schema3,
12
13
  Stdio,
13
14
  Stream,
14
15
  Terminal
15
16
  } from "effect";
16
- import { Command, Flag } from "effect/unstable/cli";
17
+ import { Argument, Command, Flag } from "effect/unstable/cli";
17
18
  import { ChildProcessSpawner } from "effect/unstable/process/ChildProcessSpawner";
18
19
 
19
20
  // ../../src/lib/httpapi-client.ts
@@ -386,7 +387,7 @@ class HttpApiSpec extends Context2.Service()("HttpApiSpec", {
386
387
  if (reflected)
387
388
  return reflected;
388
389
  const document = JsonSchema.fromSchemaOpenApi3_1(operationJsonSchema(operation));
389
- return SchemaRepresentation.toSchema(SchemaRepresentation.fromJsonSchemaDocument(document));
390
+ return reflectedSchema2(SchemaRepresentation.toSchema(SchemaRepresentation.fromJsonSchemaDocument(document)));
390
391
  }
391
392
  };
392
393
  },
@@ -397,6 +398,33 @@ class HttpApiSpec extends Context2.Service()("HttpApiSpec", {
397
398
  }
398
399
 
399
400
  // ../../src/lib/httpapi-cli.ts
401
+ var CliJsonSchema = Schema3.Struct({
402
+ type: Schema3.optional(Schema3.Union([Schema3.String, Schema3.Array(Schema3.String)])),
403
+ description: Schema3.optional(Schema3.String),
404
+ enum: Schema3.optional(Schema3.Array(Schema3.Json)),
405
+ items: Schema3.optional(Schema3.Json),
406
+ properties: Schema3.optional(Schema3.Record(Schema3.String, Schema3.Json)),
407
+ required: Schema3.optional(Schema3.Array(Schema3.String)),
408
+ pattern: Schema3.optional(Schema3.String),
409
+ allOf: Schema3.optional(Schema3.Array(Schema3.Json)),
410
+ anyOf: Schema3.optional(Schema3.Array(Schema3.Json)),
411
+ $ref: Schema3.optional(Schema3.String),
412
+ $defs: Schema3.optional(Schema3.Record(Schema3.String, Schema3.Json))
413
+ }).annotate({ identifier: "HttpApiCliJsonSchema" });
414
+ var decodeCliJsonSchema = Schema3.decodeUnknownOption(CliJsonSchema);
415
+ var JsonFromString = Schema3.fromJsonString(Schema3.Json);
416
+ var CliParsedOption = Schema3.declare((value) => Option2.isOption(value) && Option2.match(value, {
417
+ onNone: () => true,
418
+ onSome: Schema3.is(Schema3.Json)
419
+ })).annotate({ identifier: "HttpApiCliParsedOption" });
420
+ var CliParsedConfig = Schema3.Record(Schema3.String, Schema3.Union([Schema3.Json, CliParsedOption])).annotate({ identifier: "HttpApiCliParsedConfig" });
421
+ var DecodedOperationInput = Schema3.Struct({
422
+ body: Schema3.optional(Schema3.Unknown),
423
+ headers: Schema3.optional(Schema3.Record(Schema3.String, Schema3.Unknown)),
424
+ params: Schema3.optional(Schema3.Record(Schema3.String, Schema3.Unknown)),
425
+ query: Schema3.optional(Schema3.Record(Schema3.String, Schema3.Unknown))
426
+ }).annotate({ identifier: "HttpApiCliDecodedOperationInput" });
427
+
400
428
  class HttpApiCli extends Context3.Service()("HttpApiCli", {
401
429
  make: () => Effect3.gen(function* () {
402
430
  const spec = yield* HttpApiSpec;
@@ -409,12 +437,15 @@ class HttpApiCli extends Context3.Service()("HttpApiCli", {
409
437
  }) {
410
438
  static layer = Layer3.effect(this, this.make());
411
439
  }
412
- var fallbackName = (value, fallback) => sanitizeHttpName(value) || fallback;
440
+ var toHttpApiCliName = (value) => value.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2").replace(/[^a-zA-Z0-9]+/g, "-").replace(/^-+|-+$/g, "").toLowerCase();
441
+ var fallbackName = (value, fallback) => toHttpApiCliName(value) || fallback;
413
442
  var operationIdParts = (operation) => operation.operationId?.split(".").filter(Boolean) ?? [];
414
443
  var operationGroupName = (operation) => fallbackName(operationIdParts(operation)[0] ?? operation.tags?.[0] ?? "default", "default");
415
444
  var operationGroupTitle = (operation) => operation.tags?.[0] ?? operationGroupName(operation);
416
445
  var operationName = (method, path, operation) => fallbackName(operationIdParts(operation).at(-1) ?? `${method}_${path.replace(/^\/api\//, "").replace(/[/:{}]/g, "_")}`, `${method}_operation`);
417
446
  var toCliOperation = ({
447
+ inputJsonSchema,
448
+ inputSchema,
418
449
  method,
419
450
  operation,
420
451
  path
@@ -425,13 +456,18 @@ var toCliOperation = ({
425
456
  method,
426
457
  path,
427
458
  summary: operation.summary ?? operation.description ?? "",
428
- operation
459
+ operation,
460
+ inputSchema,
461
+ inputJsonSchema
429
462
  });
430
463
  var httpApiCliOperationGroups = (operations) => {
431
464
  const groups = new Map;
432
465
  for (const operation of operations) {
433
466
  const group = groups.get(operation.groupName);
434
467
  if (group) {
468
+ if (group.operations.some((entry) => entry.name === operation.name)) {
469
+ throw new Error(`Duplicate CLI command ${operation.groupName} ${operation.name}`);
470
+ }
435
471
  group.operations.push(operation);
436
472
  } else {
437
473
  groups.set(operation.groupName, {
@@ -447,9 +483,146 @@ var httpApiCliOperationGroups = (operations) => {
447
483
  })).sort((a, b) => a.name.localeCompare(b.name));
448
484
  };
449
485
  var print = (value) => Console.log(value);
450
- var formatOperations = (operations) => operations.map((operation) => `${operation.groupName} ${operation.name} ${operation.method.toUpperCase()} ${operation.path} ${operation.summary}`).join(`
486
+ var formatOperations = (operations) => [
487
+ "GROUP\tCOMMAND\tMETHOD\tPATH\tSUMMARY",
488
+ ...operations.map((operation) => `${operation.groupName} ${operation.name} ${operation.method.toUpperCase()} ${operation.path} ${operation.summary}`)
489
+ ].join(`
451
490
  `);
452
491
  var listOperations = (operations) => print(formatOperations(operations));
492
+ var cliJsonSchema = (value) => decodeCliJsonSchema(value).pipe(Option2.getOrElse(() => ({})));
493
+ var effectiveSchema = (schema) => {
494
+ const variant = (schema.anyOf ?? []).map(cliJsonSchema).find((candidate) => schemaType(candidate) !== "null");
495
+ return variant ? {
496
+ ...variant,
497
+ description: schema.description ?? variant.description
498
+ } : schema;
499
+ };
500
+ var schemaType = (schema) => {
501
+ const type = Array.isArray(schema.type) ? schema.type[0] : schema.type;
502
+ if (type || !schema.anyOf)
503
+ return type;
504
+ return schemaType(effectiveSchema(schema));
505
+ };
506
+ var schemaEnum = (schema) => Schema3.decodeUnknownOption(Schema3.Array(Schema3.String))(effectiveSchema(schema).enum).pipe(Option2.getOrElse(() => []));
507
+ var hasNumericPattern = (schema) => {
508
+ const effective = effectiveSchema(schema);
509
+ if (effective.pattern?.includes("\\d"))
510
+ return true;
511
+ return (effective.allOf ?? []).some((part) => hasNumericPattern(cliJsonSchema(part)));
512
+ };
513
+ var isBooleanSchema = (schema) => {
514
+ const values = schemaEnum(schema);
515
+ return schemaType(schema) === "boolean" || values.includes("true") && values.includes("false");
516
+ };
517
+ var jsonFlag = (name) => Flag.string(name).pipe(Flag.mapTryCatch((value) => Schema3.decodeUnknownSync(JsonFromString)(value), () => `--${name} must be valid JSON`));
518
+ var primitiveFlag = (name, schema, required) => {
519
+ const type = schemaType(schema);
520
+ const choices = schemaEnum(schema);
521
+ let flag;
522
+ if (isBooleanSchema(schema)) {
523
+ flag = required ? Flag.choice(name, ["true", "false"]).pipe(Flag.map((value) => value === "true")) : Flag.boolean(name);
524
+ } else if (choices.length > 0) {
525
+ flag = Flag.choice(name, choices);
526
+ } else if (type === "integer") {
527
+ flag = Flag.integer(name);
528
+ } else if (type === "number" || hasNumericPattern(schema)) {
529
+ flag = Flag.float(name);
530
+ } else if (type === "object" || type === "array") {
531
+ flag = jsonFlag(name);
532
+ } else {
533
+ flag = Flag.string(name);
534
+ }
535
+ const documented = flag.pipe(Flag.withMetavar(type === "object" || type === "array" ? "JSON" : name.toUpperCase()));
536
+ const described = schema.description ? documented.pipe(Flag.withDescription(schema.description)) : documented;
537
+ return required ? described : described.pipe(Flag.optional);
538
+ };
539
+ var primitiveArgument = (name, schema) => {
540
+ const type = schemaType(schema);
541
+ const choices = schemaEnum(schema);
542
+ let argument;
543
+ if (choices.length > 0) {
544
+ argument = Argument.choice(name, choices);
545
+ } else if (type === "integer") {
546
+ argument = Argument.integer(name);
547
+ } else if (type === "number" || hasNumericPattern(schema)) {
548
+ argument = Argument.float(name);
549
+ } else {
550
+ argument = Argument.string(name);
551
+ }
552
+ const documented = argument.pipe(Argument.withMetavar(name.toUpperCase()));
553
+ return schema.description ? documented.pipe(Argument.withDescription(schema.description)) : documented;
554
+ };
555
+ var operationInputDrafts = (operation) => {
556
+ const document = cliJsonSchema(operation.inputJsonSchema);
557
+ const definitions = document.$defs ?? {};
558
+ const resolveSchema = (value) => {
559
+ const schema = cliJsonSchema(value);
560
+ const name = schema.$ref?.match(/^#\/(?:\$defs|components\/schemas)\/(.+)$/)?.[1];
561
+ return name && definitions[name] ? effectiveSchema(cliJsonSchema(definitions[name])) : effectiveSchema(schema);
562
+ };
563
+ const properties = document.properties ?? {};
564
+ const drafts = (operation.operation.parameters ?? []).flatMap((parameter) => {
565
+ if (parameter.in === "cookie")
566
+ return [];
567
+ const location = parameter.in === "path" ? "params" : parameter.in === "header" ? "headers" : "query";
568
+ return [
569
+ {
570
+ location,
571
+ name: parameter.name,
572
+ preferredName: fallbackName(parameter.name, location),
573
+ required: parameter.required ?? false,
574
+ schema: resolveSchema(properties[parameter.name] ?? parameter.schema)
575
+ }
576
+ ];
577
+ });
578
+ const body = resolveSchema(properties.body ?? operation.operation.requestBody?.content?.["application/json"]?.schema);
579
+ if (schemaType(body) === "object" && body.properties) {
580
+ const required = new Set(body.required ?? []);
581
+ for (const [name, schema] of Object.entries(body.properties)) {
582
+ drafts.push({
583
+ location: "body",
584
+ name,
585
+ preferredName: fallbackName(name, "body"),
586
+ required: required.has(name),
587
+ schema: resolveSchema(schema)
588
+ });
589
+ }
590
+ } else if (operation.operation.requestBody) {
591
+ drafts.push({
592
+ location: "body",
593
+ name: "body",
594
+ preferredName: "body",
595
+ required: operation.operation.requestBody.required ?? false,
596
+ schema: body
597
+ });
598
+ }
599
+ return drafts;
600
+ };
601
+ var operationInputs = (operation) => {
602
+ const drafts = operationInputDrafts(operation);
603
+ const preferredCounts = new Map;
604
+ for (const draft of drafts) {
605
+ if (draft.location === "params")
606
+ continue;
607
+ preferredCounts.set(draft.preferredName, (preferredCounts.get(draft.preferredName) ?? 0) + 1);
608
+ }
609
+ const optionNames = new Set;
610
+ return drafts.map((draft, index) => {
611
+ const optionName = draft.location === "params" || preferredCounts.get(draft.preferredName) === 1 ? draft.preferredName : `${draft.location.replace(/s$/, "")}-${draft.preferredName}`;
612
+ if (draft.location !== "params" && optionNames.has(optionName)) {
613
+ throw new Error(`Duplicate CLI option --${optionName} for ${operation.groupName} ${operation.name}`);
614
+ }
615
+ optionNames.add(optionName);
616
+ return {
617
+ configKey: `input${index}`,
618
+ location: draft.location,
619
+ name: draft.name,
620
+ optionName,
621
+ wireString: draft.location !== "body" && schemaType(draft.schema) === "string",
622
+ param: draft.location === "params" ? primitiveArgument(optionName, draft.schema) : primitiveFlag(optionName, draft.schema, draft.required)
623
+ };
624
+ });
625
+ };
453
626
  var HttpApiCliResultStream = Schema3.declare((value) => Stream.isStream(value)).annotate({ identifier: "HttpApiCliResultStream" });
454
627
  var printHttpApiCliResult = Effect3.fn("HttpApiCli.printResult")(function* (response, operation, client) {
455
628
  const stream = Schema3.decodeUnknownOption(HttpApiCliResultStream)(response);
@@ -459,18 +632,48 @@ var printHttpApiCliResult = Effect3.fn("HttpApiCli.printResult")(function* (resp
459
632
  const encoded = yield* client.encodeResult(response, operation);
460
633
  return yield* print(JSON.stringify(encoded, null, 2) ?? "null");
461
634
  });
462
- var callOperation = (operation, callConfig, client) => Effect3.gen(function* () {
463
- const body = yield* parseJsonValue(callConfig.body, "--body");
464
- const headers = yield* parseJsonObject(callConfig.headers, "--headers");
465
- const params = yield* parseJsonObject(callConfig.params, "--params");
466
- const query = yield* parseJsonObject(callConfig.query, "--query");
635
+ var callOperation = (operation, inputs, callConfig, client) => Effect3.gen(function* () {
636
+ const emptyValues = () => ({});
637
+ const assembled = {
638
+ body: emptyValues(),
639
+ headers: emptyValues(),
640
+ params: emptyValues(),
641
+ query: emptyValues()
642
+ };
643
+ for (const input2 of inputs) {
644
+ const parsed = callConfig[input2.configKey];
645
+ const value = Option2.isOption(parsed) ? Option2.getOrUndefined(parsed) : parsed;
646
+ if (value !== undefined) {
647
+ assembled[input2.location][input2.name] = input2.wireString ? String(value) : value;
648
+ }
649
+ }
650
+ const bodyInput = inputs.some((input2) => input2.location === "body" && input2.name === "body") ? assembled.body.body : Object.keys(assembled.body).length > 0 || operation.operation.requestBody?.required ? assembled.body : undefined;
651
+ const rawInput = {};
652
+ if (inputs.some((input2) => input2.location === "params")) {
653
+ rawInput.params = assembled.params;
654
+ }
655
+ if (inputs.some((input2) => input2.location === "headers")) {
656
+ rawInput.headers = assembled.headers;
657
+ }
658
+ if (inputs.some((input2) => input2.location === "query")) {
659
+ rawInput.query = assembled.query;
660
+ }
661
+ if (bodyInput !== undefined)
662
+ rawInput.body = bodyInput;
663
+ const decoded = yield* Schema3.decodeUnknownEffect(operation.inputSchema)(rawInput).pipe(Effect3.mapError((error) => new Error(`Invalid input for ${operation.groupName} ${operation.name}: ${error.message}`)));
664
+ const input = yield* Schema3.decodeUnknownEffect(DecodedOperationInput)(decoded);
467
665
  const response = yield* client.execute({
468
666
  operation: {
469
667
  method: operation.method,
470
668
  path: operation.path,
471
669
  operation: operation.operation
472
670
  },
473
- input: { body, headers, params, query }
671
+ input: {
672
+ body: input.body,
673
+ headers: input.headers ?? {},
674
+ params: input.params ?? {},
675
+ query: input.query ?? {}
676
+ }
474
677
  });
475
678
  return yield* printHttpApiCliResult(response, {
476
679
  method: operation.method,
@@ -478,28 +681,40 @@ var callOperation = (operation, callConfig, client) => Effect3.gen(function* ()
478
681
  operation: operation.operation
479
682
  }, client);
480
683
  });
481
- var listCommand = (groups) => Command.make("list", {}, () => print(groups.map((group) => `${group.name} ${group.title} ${group.operations.length}`).join(`
684
+ var listCommand = (groups) => Command.make("list", {}, () => print([
685
+ "GROUP\tTITLE\tCOMMANDS",
686
+ ...groups.map((group) => `${group.name} ${group.title} ${group.operations.length}`)
687
+ ].join(`
482
688
  `))).pipe(Command.withDescription("List command groups"));
483
689
  var groupListCommand = (group) => Command.make("list", {}, () => listOperations(group.operations)).pipe(Command.withDescription(`List ${group.title} operations`));
484
- var operationCommand = (operation, client) => Command.make(operation.name, {
485
- body: Flag.string("body").pipe(Flag.withDefault(""), Flag.withDescription("JSON request body")),
486
- headers: Flag.string("headers").pipe(Flag.withDefault("{}"), Flag.withDescription("JSON object for request headers")),
487
- params: Flag.string("params").pipe(Flag.withDefault("{}"), Flag.withDescription("JSON object for path parameters")),
488
- query: Flag.string("query").pipe(Flag.withDefault("{}"), Flag.withDescription("JSON object for query parameters"))
489
- }, (callConfig) => callOperation(operation, callConfig, client)).pipe(Command.withDescription(operation.summary || `${operation.method.toUpperCase()} ${operation.path}`));
490
- var groupCommand = (group, client) => Command.make(group.name).pipe(Command.withDescription(group.title), Command.withSubcommands([
690
+ var operationCommand = (operation, client) => Effect3.sync(() => {
691
+ const inputs = operationInputs(operation);
692
+ const config = Object.fromEntries(inputs.map((input) => [input.configKey, input.param]));
693
+ return Command.make(operation.name, config, (callConfig) => Schema3.decodeUnknownEffect(CliParsedConfig)(callConfig).pipe(Effect3.flatMap((parsed) => callOperation(operation, inputs, parsed, client)))).pipe(Command.withDescription(operation.summary || `${operation.method.toUpperCase()} ${operation.path}`), Command.withExamples([
694
+ {
695
+ command: `${operation.groupName} ${operation.name}`,
696
+ description: `${operation.method.toUpperCase()} ${operation.path}`
697
+ }
698
+ ]));
699
+ });
700
+ var groupCommand = (group, client) => Effect3.all(group.operations.map((operation) => operationCommand(operation, client))).pipe(Effect3.map((operationCommands) => Command.make(group.name).pipe(Command.withDescription(group.title), Command.withSubcommands([
491
701
  groupListCommand(group),
492
- ...group.operations.map((operation) => operationCommand(operation, client))
493
- ]));
702
+ ...operationCommands
703
+ ]))));
494
704
  var makeHttpApiCliCommand = Effect3.fn("HttpApiCli.makeCommand")(function* () {
495
705
  const spec = yield* HttpApiSpec;
496
706
  const client = yield* ApiClient;
497
- const name = sanitizeHttpName(spec.info.title);
498
- const groups = httpApiCliOperationGroups(spec.operations.map(toCliOperation));
499
- return Command.make(name).pipe(Command.withDescription(spec.info.description ?? spec.info.title), Command.withSubcommands([
500
- listCommand(groups),
501
- ...groups.map((group) => groupCommand(group, client))
502
- ]));
707
+ const name = fallbackName(spec.info.title, "api");
708
+ const groups = yield* Effect3.try({
709
+ try: () => httpApiCliOperationGroups(spec.operations.map((operation) => toCliOperation({
710
+ ...operation,
711
+ inputSchema: spec.operationSchema(operation.operation),
712
+ inputJsonSchema: spec.operationJsonSchema(operation.operation)
713
+ }))),
714
+ catch: (error) => error instanceof Error ? error : new Error(String(error))
715
+ });
716
+ const groupCommands = yield* Effect3.all(groups.map((group) => groupCommand(group, client)));
717
+ return Command.make(name).pipe(Command.withDescription(spec.info.description ?? spec.info.title), Command.withSubcommands([listCommand(groups), ...groupCommands]));
503
718
  });
504
719
  var cliEnvironmentLayer = (args) => Layer3.mergeAll(FileSystem.layerNoop({}), Path.layer, Stdio.layerTest({ args: Effect3.succeed(Array.from(args)) }), Layer3.succeed(Terminal.Terminal, Terminal.make({
505
720
  columns: Effect3.sync(() => process.stdout.columns ?? 80),
@@ -520,7 +735,13 @@ var httpApiCli = (args = process.argv.slice(2)) => Effect3.gen(function* () {
520
735
  const cli = yield* HttpApiCli;
521
736
  return yield* cli.run(args);
522
737
  });
523
- var formatHttpApiCliCause = Cause.pretty;
738
+ var formatHttpApiCliCause = (cause) => {
739
+ const errors = Cause.prettyErrors(cause);
740
+ if (errors.length === 0)
741
+ return Cause.pretty(cause);
742
+ return errors.map((error) => error.message ? `${error.name}: ${error.message}` : error.name).join(`
743
+ `);
744
+ };
524
745
  var runHttpApiCli = (layer, args = process.argv.slice(2)) => {
525
746
  Effect3.runPromiseExit(httpApiCli(args).pipe(Effect3.provide(layer), Effect3.provide(httpApiCliEnvironmentLayer(args)))).then(Exit.match({
526
747
  onSuccess: () => {
@@ -533,11 +754,12 @@ var runHttpApiCli = (layer, args = process.argv.slice(2)) => {
533
754
  }));
534
755
  };
535
756
  export {
536
- runHttpApiCli,
537
- printHttpApiCliResult,
538
- makeHttpApiCliCommand,
539
- httpApiCliEnvironmentLayer,
540
- httpApiCli,
757
+ HttpApiCli,
541
758
  formatHttpApiCliCause,
542
- HttpApiCli
759
+ httpApiCli,
760
+ httpApiCliEnvironmentLayer,
761
+ makeHttpApiCliCommand,
762
+ printHttpApiCliResult,
763
+ runHttpApiCli,
764
+ toHttpApiCliName
543
765
  };
@@ -105,8 +105,8 @@ class ApiClient extends Context.Service()("ApiClient") {
105
105
  }));
106
106
  }
107
107
  export {
108
- makeHttpApiOperationResultEncoder,
109
- encodeHttpApiOperationResult,
108
+ ApiClient,
110
109
  HttpApiOperationResult,
111
- ApiClient
110
+ encodeHttpApiOperationResult,
111
+ makeHttpApiOperationResultEncoder
112
112
  };
@@ -32,11 +32,13 @@ export type HttpApiOperationEntry = {
32
32
  readonly path: string;
33
33
  readonly operation: HttpApiOperation;
34
34
  };
35
+ export type HttpApiOperationInputValue = ErrorOptions["cause"];
36
+ export type HttpApiOperationInputValues = Readonly<Record<string, HttpApiOperationInputValue>>;
35
37
  export type HttpApiOperationInput = {
36
- readonly body?: Json;
37
- readonly headers: JsonObject;
38
- readonly params: JsonObject;
39
- readonly query: JsonObject;
38
+ readonly body?: HttpApiOperationInputValue;
39
+ readonly headers: HttpApiOperationInputValues;
40
+ readonly params: HttpApiOperationInputValues;
41
+ readonly query: HttpApiOperationInputValues;
40
42
  };
41
43
  export type HttpApiSpecConfig = {
42
44
  readonly api: HttpApi.Constraint;
@@ -77,7 +79,7 @@ declare const HttpApiSpec_base: Context.ServiceClass<HttpApiSpec, "HttpApiSpec",
77
79
  query: any;
78
80
  }, Error, never>;
79
81
  operationJsonSchema: (operation: HttpApiOperation) => JsonSchema.JsonSchema;
80
- operationSchema: (operation: HttpApiOperation) => Schema.Top;
82
+ operationSchema: (operation: HttpApiOperation) => Schema.Codec<unknown, unknown, never, never>;
81
83
  }> & {
82
84
  readonly make: (config: HttpApiSpecConfig) => Effect.Effect<{
83
85
  info: OpenApi.OpenAPISpecInfo;
@@ -89,7 +91,7 @@ declare const HttpApiSpec_base: Context.ServiceClass<HttpApiSpec, "HttpApiSpec",
89
91
  query: any;
90
92
  }, Error, never>;
91
93
  operationJsonSchema: (operation: HttpApiOperation) => JsonSchema.JsonSchema;
92
- operationSchema: (operation: HttpApiOperation) => Schema.Top;
94
+ operationSchema: (operation: HttpApiOperation) => Schema.Codec<unknown, unknown, never, never>;
93
95
  }, Error, never>;
94
96
  };
95
97
  export declare class HttpApiSpec extends HttpApiSpec_base {
@@ -261,7 +261,7 @@ class HttpApiSpec extends Context.Service()("HttpApiSpec", {
261
261
  if (reflected)
262
262
  return reflected;
263
263
  const document = JsonSchema.fromSchemaOpenApi3_1(operationJsonSchema(operation));
264
- return SchemaRepresentation.toSchema(SchemaRepresentation.fromJsonSchemaDocument(document));
264
+ return reflectedSchema(SchemaRepresentation.toSchema(SchemaRepresentation.fromJsonSchemaDocument(document)));
265
265
  }
266
266
  };
267
267
  },
@@ -271,16 +271,16 @@ class HttpApiSpec extends Context.Service()("HttpApiSpec", {
271
271
  static layer = (config) => Layer.effect(this, this.make(config));
272
272
  }
273
273
  export {
274
- toHttpError,
275
- sanitizeHttpName,
276
- parseJsonValue,
277
- parseJsonObject,
278
- httpApiToolName,
279
- httpApiToolEntries,
280
- httpApiOperations,
281
- httpApiOperationInputSchema,
282
- decodeHttpApiOperationInput,
283
- JsonObjectSchema,
274
+ HttpApiMethods,
284
275
  HttpApiSpec,
285
- HttpApiMethods
276
+ JsonObjectSchema,
277
+ decodeHttpApiOperationInput,
278
+ httpApiOperationInputSchema,
279
+ httpApiOperations,
280
+ httpApiToolEntries,
281
+ httpApiToolName,
282
+ parseJsonObject,
283
+ parseJsonValue,
284
+ sanitizeHttpName,
285
+ toHttpError
286
286
  };
@@ -372,7 +372,7 @@ class HttpApiSpec extends Context2.Service()("HttpApiSpec", {
372
372
  if (reflected)
373
373
  return reflected;
374
374
  const document = JsonSchema.fromSchemaOpenApi3_1(operationJsonSchema(operation));
375
- return SchemaRepresentation.toSchema(SchemaRepresentation.fromJsonSchemaDocument(document));
375
+ return reflectedSchema2(SchemaRepresentation.toSchema(SchemaRepresentation.fromJsonSchemaDocument(document)));
376
376
  }
377
377
  };
378
378
  },
@@ -470,7 +470,7 @@ var httpApiMcpServerLayer = (path) => Layer3.unwrap(Effect3.gen(function* () {
470
470
  });
471
471
  }));
472
472
  export {
473
- httpApiMcpToolsLayer,
473
+ HttpApiMcp,
474
474
  httpApiMcpServerLayer,
475
- HttpApiMcp
475
+ httpApiMcpToolsLayer
476
476
  };
@@ -372,7 +372,7 @@ class HttpApiSpec extends Context2.Service()("HttpApiSpec", {
372
372
  if (reflected)
373
373
  return reflected;
374
374
  const document = JsonSchema.fromSchemaOpenApi3_1(operationJsonSchema(operation));
375
- return SchemaRepresentation.toSchema(SchemaRepresentation.fromJsonSchemaDocument(document));
375
+ return reflectedSchema2(SchemaRepresentation.toSchema(SchemaRepresentation.fromJsonSchemaDocument(document)));
376
376
  }
377
377
  };
378
378
  },
@@ -434,6 +434,6 @@ var HttpApiToolkitLayer = (config) => Layer3.unwrap(buildHttpApiToolkit(config).
434
434
  }).pipe(Effect3.mapError((error) => error instanceof Error ? error.message : String(error)))
435
435
  ])))))));
436
436
  export {
437
- HttpApiToolkitLayer,
438
- HttpApiToolkit
437
+ HttpApiToolkit,
438
+ HttpApiToolkitLayer
439
439
  };
@@ -0,0 +1,13 @@
1
+ export type MarkdownContentProps = {
2
+ readonly className?: string;
3
+ readonly codeBlocks: ReadonlyArray<{
4
+ readonly code: string;
5
+ readonly language: string;
6
+ }>;
7
+ readonly html: string;
8
+ readonly messages?: {
9
+ readonly copied?: string;
10
+ readonly copy?: string;
11
+ };
12
+ };
13
+ export declare const MarkdownContent: ({ className, codeBlocks, html, messages, }: MarkdownContentProps) => import("react").JSX.Element;
@@ -0,0 +1,19 @@
1
+ export type MarkdownCodeBlock = {
2
+ readonly code: string;
3
+ readonly language: string;
4
+ };
5
+ export declare const markdownOptions: {
6
+ autolinks: true;
7
+ headings: {
8
+ ids: true;
9
+ };
10
+ noHtmlBlocks: true;
11
+ noHtmlSpans: true;
12
+ tagFilter: true;
13
+ };
14
+ export declare const markdownPlainText: (source: string, includeCode?: boolean) => string;
15
+ export declare const compileMarkdown: (source: string) => {
16
+ codeBlocks: MarkdownCodeBlock[];
17
+ html: string;
18
+ source: string;
19
+ };
@@ -22,8 +22,8 @@ export declare const SortParamsFromString: Schema.decodeTo<Schema.$Array<Schema.
22
22
  readonly direction: Schema.Union<readonly [Schema.Literal<"asc">, Schema.Literal<"desc">]>;
23
23
  }>>, Schema.String, never, never>;
24
24
  export declare const Query: Schema.Struct<{
25
- readonly page: Schema.Int;
26
- readonly pageSize: Schema.Int;
25
+ readonly page: Schema.withDecodingDefaultKey<Schema.Int, never>;
26
+ readonly pageSize: Schema.withDecodingDefaultKey<Schema.Int, never>;
27
27
  readonly globalFilter: Schema.optional<Schema.String>;
28
28
  readonly sort: Schema.optional<Schema.decodeTo<Schema.String, Schema.decodeTo<Schema.$Array<Schema.Struct<{
29
29
  readonly id: Schema.NonEmptyString;
@@ -31,6 +31,7 @@ export declare const Query: Schema.Struct<{
31
31
  }>>, Schema.String, never, never>, never, never>>;
32
32
  }>;
33
33
  export type QueryType = typeof Query.Type;
34
+ export declare const QueryStandard: ReturnType<typeof Schema.toStandardSchemaV1<typeof Query>>;
34
35
  export declare const PaginationMeta: Schema.Struct<{
35
36
  readonly page: Schema.Int;
36
37
  readonly pageSize: Schema.Int;
package/dist/lib/query.js CHANGED
@@ -85,8 +85,8 @@ var SortParamSearch = SortParamsFromString.pipe(Schema.decodeTo(Schema.String, S
85
85
  examples: ["-name,age"]
86
86
  }));
87
87
  var Query = Schema.Struct({
88
- page: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
89
- pageSize: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 100 })),
88
+ page: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)).pipe(Schema.withDecodingDefaultKey(Effect.succeed(0))),
89
+ pageSize: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 100 })).pipe(Schema.withDecodingDefaultKey(Effect.succeed(10))),
90
90
  globalFilter: Schema.optional(Schema.String),
91
91
  sort: Schema.optional(SortParamSearch)
92
92
  }).annotate({
@@ -102,6 +102,7 @@ var Query = Schema.Struct({
102
102
  }
103
103
  ]
104
104
  });
105
+ var QueryStandard = Schema.toStandardSchemaV1(Query);
105
106
  var PaginationMeta = Schema.Struct({
106
107
  page: Schema.Int,
107
108
  pageSize: Schema.Int,
@@ -118,11 +119,12 @@ var PaginatedResponse = (items) => Schema.Struct({
118
119
  meta: PaginationMeta
119
120
  });
120
121
  export {
121
- SortParamsFromString,
122
- SortParamFromString,
123
- SortParam,
124
- SortDirection,
125
- Query,
122
+ PaginatedResponse,
126
123
  PaginationMeta,
127
- PaginatedResponse
124
+ Query,
125
+ QueryStandard,
126
+ SortDirection,
127
+ SortParam,
128
+ SortParamFromString,
129
+ SortParamsFromString
128
130
  };
package/dist/lib/seo.js CHANGED
@@ -111,6 +111,6 @@ var createSeo = (defaults) => (options) => seo({
111
111
  ...options
112
112
  });
113
113
  export {
114
- seo,
115
- createSeo
114
+ createSeo,
115
+ seo
116
116
  };
@@ -266,11 +266,11 @@ var WebFetchToolkitLayer = (options = {}) => {
266
266
  }));
267
267
  };
268
268
  export {
269
- defaultWebFetchToolkitOptions,
270
- WebFetchToolkitOptions,
271
- WebFetchToolkitLayer,
272
- WebFetchToolkit,
273
- WebFetchResponse,
269
+ WebFetchFailure,
274
270
  WebFetchRequest,
275
- WebFetchFailure
271
+ WebFetchResponse,
272
+ WebFetchToolkit,
273
+ WebFetchToolkitLayer,
274
+ WebFetchToolkitOptions,
275
+ defaultWebFetchToolkitOptions
276
276
  };
@@ -10,6 +10,13 @@ export type AgentToolActivity = Extract<AgentEvent, {
10
10
  };
11
11
  export type AgentMessage = {
12
12
  readonly id: string;
13
+ readonly markdown?: {
14
+ readonly codeBlocks: ReadonlyArray<{
15
+ readonly code: string;
16
+ readonly language: string;
17
+ }>;
18
+ readonly html: string;
19
+ };
13
20
  readonly role: "user" | "assistant";
14
21
  readonly text: string;
15
22
  readonly tools: ReadonlyArray<AgentToolActivity>;