@yaklabs-ai/plugin-sdk 0.13.3 → 0.13.5

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/dist/kay-agent.js CHANGED
@@ -32,6 +32,8 @@ var UriProviderError = class extends UriError {
32
32
  retryable;
33
33
  /** Provider-directed delay before retrying, in milliseconds. */
34
34
  retryAfterMs;
35
+ /** See {@link UriProviderErrorOptions.effect}. */
36
+ effect;
35
37
  constructor(options) {
36
38
  super(options.message);
37
39
  this.name = "UriProviderError";
@@ -50,6 +52,8 @@ var UriProviderError = class extends UriError {
50
52
  }
51
53
  this.retryAfterMs = options.retryAfterMs;
52
54
  }
55
+ if (options.effect !== void 0)
56
+ this.effect = options.effect;
53
57
  }
54
58
  };
55
59
  var UriNotFoundError = class extends UriError {
@@ -784,7 +788,79 @@ function observationFromResource(resource) {
784
788
  return value;
785
789
  }
786
790
 
787
- // packages/herd-agent/dist/core/extensions/auth/scheme.js
791
+ // packages/plugin-primitives/dist/results.js
792
+ function textResult(text, details) {
793
+ const content = [{ type: "text", text }];
794
+ return { content, details };
795
+ }
796
+ function contentResult(content, details) {
797
+ return { content: [...content], details };
798
+ }
799
+
800
+ // packages/plugin-primitives/dist/transfer.js
801
+ var MAX_BYTES2 = 50 * 1024 * 1024;
802
+ async function readBodyWithByteCap(response, maxBytes) {
803
+ const reader = response.body?.getReader();
804
+ if (!reader)
805
+ return void 0;
806
+ const chunks = [];
807
+ let totalSize = 0;
808
+ let capped = false;
809
+ while (true) {
810
+ const { done, value } = await reader.read();
811
+ if (done)
812
+ break;
813
+ if (value) {
814
+ chunks.push(value);
815
+ totalSize += value.length;
816
+ if (totalSize > maxBytes) {
817
+ capped = true;
818
+ await reader.cancel();
819
+ break;
820
+ }
821
+ }
822
+ }
823
+ const bodyBuffer = Buffer.concat(chunks);
824
+ const bytes = new Uint8Array(bodyBuffer.buffer, bodyBuffer.byteOffset, bodyBuffer.byteLength);
825
+ return { bytes, capped };
826
+ }
827
+
828
+ // packages/plugin-primitives/dist/tool-parameters.js
829
+ import { z as z5 } from "zod";
830
+ var URI_PAYLOAD_MARKER = "x-kay-uri-payload";
831
+ var URI_PAYLOAD_WIRE_TYPES = [
832
+ "string",
833
+ "object",
834
+ "array",
835
+ "number",
836
+ "boolean",
837
+ "null"
838
+ ];
839
+ var uriPayloadSchema = z5.union([
840
+ z5.string(),
841
+ z5.record(z5.string(), z5.unknown()),
842
+ z5.array(z5.unknown()),
843
+ z5.number(),
844
+ z5.boolean(),
845
+ z5.null()
846
+ ]).meta({ [URI_PAYLOAD_MARKER]: true });
847
+ function toToolParameters(schema) {
848
+ const jsonSchema = z5.toJSONSchema(schema, {
849
+ io: "input",
850
+ override(ctx) {
851
+ const node = ctx.jsonSchema;
852
+ if (node[URI_PAYLOAD_MARKER] === true) {
853
+ delete node[URI_PAYLOAD_MARKER];
854
+ delete node["anyOf"];
855
+ node["type"] = [...URI_PAYLOAD_WIRE_TYPES];
856
+ }
857
+ }
858
+ });
859
+ const { $schema: _schema, $id: _id, ...rest } = jsonSchema;
860
+ return rest;
861
+ }
862
+
863
+ // packages/plugin-primitives/dist/auth-scheme.js
788
864
  var ACCOUNT_ID_PARAM = "accountId";
789
865
  function authContextOf(ctx) {
790
866
  return ctx.auth;
@@ -845,7 +921,7 @@ function withResolvedAuth(definition, binding, body) {
845
921
  };
846
922
  }
847
923
 
848
- // packages/herd-agent/dist/core/web/search/types.js
924
+ // packages/plugin-primitives/dist/search-provider.js
849
925
  var SearchProviderError = class extends Error {
850
926
  provider;
851
927
  status;
@@ -856,8 +932,6 @@ var SearchProviderError = class extends Error {
856
932
  this.name = "SearchProviderError";
857
933
  }
858
934
  };
859
-
860
- // packages/herd-agent/dist/core/web/search/with-resolved-search-provider.js
861
935
  function withResolvedSearchProvider(definition, binding, body) {
862
936
  return {
863
937
  id: definition.id,
@@ -885,47 +959,12 @@ function withResolvedSearchProvider(definition, binding, body) {
885
959
  };
886
960
  }
887
961
 
888
- // packages/herd-agent/dist/core/tools/tool-parameters.js
889
- import { z as z5 } from "zod";
890
- var URI_PAYLOAD_MARKER = "x-kay-uri-payload";
891
- var URI_PAYLOAD_WIRE_TYPES = [
892
- "string",
893
- "object",
894
- "array",
895
- "number",
896
- "boolean",
897
- "null"
898
- ];
899
- var uriPayloadSchema = z5.union([
900
- z5.string(),
901
- z5.record(z5.string(), z5.unknown()),
902
- z5.array(z5.unknown()),
903
- z5.number(),
904
- z5.boolean(),
905
- z5.null()
906
- ]).meta({ [URI_PAYLOAD_MARKER]: true });
907
- function toToolParameters(schema) {
908
- const jsonSchema = z5.toJSONSchema(schema, {
909
- io: "input",
910
- override(ctx) {
911
- const node = ctx.jsonSchema;
912
- if (node[URI_PAYLOAD_MARKER] === true) {
913
- delete node[URI_PAYLOAD_MARKER];
914
- delete node["anyOf"];
915
- node["type"] = [...URI_PAYLOAD_WIRE_TYPES];
916
- }
917
- }
918
- });
919
- const { $schema: _schema, $id: _id, ...rest } = jsonSchema;
920
- return rest;
921
- }
922
-
923
- // packages/herd-agent/dist/core/is-object.js
962
+ // packages/plugin-primitives/dist/is-object.js
924
963
  function isObject(value) {
925
964
  return typeof value === "object" && value !== null && !Array.isArray(value);
926
965
  }
927
966
 
928
- // packages/herd-agent/dist/core/tools/produced-resources.js
967
+ // packages/plugin-primitives/dist/produced-resources.js
929
968
  var DECLARATIONS = Symbol.for("herd.producedResources.declarations");
930
969
  function declareProducedResources(result, declarations) {
931
970
  const details = declarableDetails(result.details);
@@ -973,43 +1012,6 @@ function jsonValue(value) {
973
1012
  return `<${Array.isArray(value) ? "array" : typeof value}>`;
974
1013
  }
975
1014
 
976
- // packages/plugin-primitives/dist/results.js
977
- function textResult(text, details) {
978
- const content = [{ type: "text", text }];
979
- return { content, details };
980
- }
981
- function contentResult(content, details) {
982
- return { content: [...content], details };
983
- }
984
-
985
- // packages/plugin-primitives/dist/transfer.js
986
- var MAX_BYTES2 = 50 * 1024 * 1024;
987
- async function readBodyWithByteCap(response, maxBytes) {
988
- const reader = response.body?.getReader();
989
- if (!reader)
990
- return void 0;
991
- const chunks = [];
992
- let totalSize = 0;
993
- let capped = false;
994
- while (true) {
995
- const { done, value } = await reader.read();
996
- if (done)
997
- break;
998
- if (value) {
999
- chunks.push(value);
1000
- totalSize += value.length;
1001
- if (totalSize > maxBytes) {
1002
- capped = true;
1003
- await reader.cancel();
1004
- break;
1005
- }
1006
- }
1007
- }
1008
- const bodyBuffer = Buffer.concat(chunks);
1009
- const bytes = new Uint8Array(bodyBuffer.buffer, bodyBuffer.byteOffset, bodyBuffer.byteLength);
1010
- return { bytes, capped };
1011
- }
1012
-
1013
1015
  // packages/plugin-sdk/dist/kay-agent/index.js
1014
1016
  import { z as z7 } from "zod";
1015
1017