stitchkit 0.90.2 → 0.90.4

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 (57) hide show
  1. package/CHANGELOG.md +129 -0
  2. package/dist/agent-runtime-coding-tools.js +3 -3
  3. package/dist/agent-runtime-harness.js +4 -4
  4. package/dist/agent-runtime-sandbox.js +3 -3
  5. package/dist/agent-runtime.js +7 -7
  6. package/dist/cli.d.ts +14 -1
  7. package/dist/cli.d.ts.map +1 -1
  8. package/dist/cli.js +359 -11
  9. package/dist/{index-gbqjt8jz.js → index-19ryv24q.js} +3 -3
  10. package/dist/{index-2hrfpw2c.js → index-32vjke6q.js} +2 -2
  11. package/dist/{index-f475yj00.js → index-6atvfjc1.js} +1 -1
  12. package/dist/{index-79hb1wyh.js → index-7t0wq6j5.js} +3 -3
  13. package/dist/{index-j7q0xj6d.js → index-8crm1srv.js} +1 -1
  14. package/dist/{index-kc6h6hg0.js → index-8z9we758.js} +1 -1
  15. package/dist/{index-r159gjwy.js → index-fenaekmk.js} +94 -8
  16. package/dist/{index-wb15909q.js → index-kzxpsf8y.js} +3 -3
  17. package/dist/{index-44ht2790.js → index-vcnfwrtr.js} +1 -1
  18. package/dist/{index-8dph3pw6.js → index-y47z614h.js} +405 -35
  19. package/dist/testing.js +1 -1
  20. package/dist/tool-invoker.js +4 -4
  21. package/dist/tools/cli-args.d.ts +49 -0
  22. package/dist/tools/cli-args.d.ts.map +1 -1
  23. package/dist/tools/cli-command.d.ts +8 -1
  24. package/dist/tools/cli-command.d.ts.map +1 -1
  25. package/dist/tools/cli-installer.d.ts +29 -0
  26. package/dist/tools/cli-installer.d.ts.map +1 -0
  27. package/dist/tools/cli-manifest.d.ts +83 -0
  28. package/dist/tools/cli-manifest.d.ts.map +1 -0
  29. package/dist/tools/cli-policy.d.ts +6 -1
  30. package/dist/tools/cli-policy.d.ts.map +1 -1
  31. package/dist/tools/cli-profile.d.ts +40 -0
  32. package/dist/tools/cli-profile.d.ts.map +1 -0
  33. package/dist/tools/cli-update.d.ts +64 -0
  34. package/dist/tools/cli-update.d.ts.map +1 -0
  35. package/dist/tools/cli-view.d.ts +12 -0
  36. package/dist/tools/cli-view.d.ts.map +1 -0
  37. package/dist/tools/cli.d.ts +20 -5
  38. package/dist/tools/cli.d.ts.map +1 -1
  39. package/dist/tools/connections/index.d.ts +2 -1
  40. package/dist/tools/connections/index.d.ts.map +1 -1
  41. package/dist/tools/connections/index.js +37 -10
  42. package/dist/tools/connections/mcp.d.ts +2 -1
  43. package/dist/tools/connections/mcp.d.ts.map +1 -1
  44. package/dist/tools/connections/mount.d.ts.map +1 -1
  45. package/dist/tools/connections/openapi.d.ts +2 -1
  46. package/dist/tools/connections/openapi.d.ts.map +1 -1
  47. package/dist/tools/connections/runtime.d.ts +17 -0
  48. package/dist/tools/connections/runtime.d.ts.map +1 -1
  49. package/dist/tools/connections/types.d.ts +18 -1
  50. package/dist/tools/connections/types.d.ts.map +1 -1
  51. package/dist/tools/json-schema-dialect.d.ts +17 -0
  52. package/dist/tools/json-schema-dialect.d.ts.map +1 -0
  53. package/dist/tools/presentation.d.ts +8 -1
  54. package/dist/tools/presentation.d.ts.map +1 -1
  55. package/dist/tools.js +8 -8
  56. package/llms-full.txt +293 -7
  57. package/package.json +1 -1
@@ -4,16 +4,16 @@ import {
4
4
  } from "./index-7rkhw9ec.js";
5
5
  import {
6
6
  collectToolSurface
7
- } from "./index-wb15909q.js";
7
+ } from "./index-kzxpsf8y.js";
8
8
  import {
9
9
  createToolRunner,
10
10
  formatToolError
11
- } from "./index-2hrfpw2c.js";
11
+ } from "./index-32vjke6q.js";
12
12
  import {
13
13
  isToolExecutionControlError,
14
14
  toolCauseFromResult,
15
15
  toolResultFromError
16
- } from "./index-44ht2790.js";
16
+ } from "./index-vcnfwrtr.js";
17
17
  import {
18
18
  isRecord
19
19
  } from "./index-77fekveh.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  executeToolMethod
3
- } from "./index-44ht2790.js";
3
+ } from "./index-vcnfwrtr.js";
4
4
  import {
5
5
  assertToolExtensionCompatible,
6
6
  mergeSchemas,
7
7
  projectToolSurface,
8
8
  rebuildObject
9
- } from "./index-r159gjwy.js";
9
+ } from "./index-fenaekmk.js";
10
10
 
11
11
  // src/tools/mount.ts
12
12
  import { z } from "zod";
@@ -36,7 +36,7 @@ import {
36
36
  import {
37
37
  ToolExecutionControlError,
38
38
  isToolExecutionControlError
39
- } from "./index-44ht2790.js";
39
+ } from "./index-vcnfwrtr.js";
40
40
  import {
41
41
  isRecord,
42
42
  transportResult
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  collectTools,
3
3
  createToolRunner
4
- } from "./index-2hrfpw2c.js";
4
+ } from "./index-32vjke6q.js";
5
5
  import {
6
6
  toolErrorFromResult
7
- } from "./index-44ht2790.js";
7
+ } from "./index-vcnfwrtr.js";
8
8
  import {
9
9
  AppError
10
10
  } from "./index-scs3f1eg.js";
11
11
  import {
12
12
  assertUniqueToolName
13
- } from "./index-r159gjwy.js";
13
+ } from "./index-fenaekmk.js";
14
14
 
15
15
  // src/tools/invoker.ts
16
16
  function createToolInvoker(services, config) {
@@ -24,7 +24,7 @@ import {
24
24
  } from "./index-scs3f1eg.js";
25
25
  import {
26
26
  defineRuntimeTool
27
- } from "./index-kc6h6hg0.js";
27
+ } from "./index-8z9we758.js";
28
28
 
29
29
  // src/agent-runtime/coding-tool-contract.ts
30
30
  import { z } from "zod";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  projectRuntimeTool
3
- } from "./index-r159gjwy.js";
3
+ } from "./index-fenaekmk.js";
4
4
 
5
5
  // src/tools/runtime-tool.ts
6
6
  function defineRuntimeTool(definition) {
@@ -667,6 +667,40 @@ function assertUniqueToolName(name, taken, surface) {
667
667
 
668
668
  // src/tools/presentation.ts
669
669
  import { z as z2 } from "zod";
670
+
671
+ // src/tools/json-schema-dialect.ts
672
+ var DRAFT_07_MARKER = "draft-07";
673
+ var DRAFT_07_KEYWORD = "definitions";
674
+ var DEFS_KEYWORD = "$defs";
675
+ function declaresDraft07(dialect) {
676
+ return typeof dialect === "string" && dialect.includes(DRAFT_07_MARKER);
677
+ }
678
+ function rewriteDefinitionPointers(value) {
679
+ if (Array.isArray(value))
680
+ return value.map(rewriteDefinitionPointers);
681
+ if (!isRecord(value))
682
+ return value;
683
+ const rewritten = {};
684
+ for (const [key, child] of Object.entries(value)) {
685
+ rewritten[key] = key === "$ref" && typeof child === "string" && child.startsWith(`#/${DRAFT_07_KEYWORD}/`) ? `#/${DEFS_KEYWORD}/${child.slice(`#/${DRAFT_07_KEYWORD}/`.length)}` : rewriteDefinitionPointers(child);
686
+ }
687
+ return rewritten;
688
+ }
689
+ function withDefsDialect(schema) {
690
+ const definitions = schema[DRAFT_07_KEYWORD];
691
+ if (!isRecord(definitions) || DEFS_KEYWORD in schema)
692
+ return schema;
693
+ const rewritten = {};
694
+ for (const [key, value] of Object.entries(schema)) {
695
+ if (key === DRAFT_07_KEYWORD)
696
+ continue;
697
+ rewritten[key] = rewriteDefinitionPointers(value);
698
+ }
699
+ rewritten[DEFS_KEYWORD] = rewriteDefinitionPointers(definitions);
700
+ return rewritten;
701
+ }
702
+
703
+ // src/tools/presentation.ts
670
704
  function withoutDialect(schema) {
671
705
  const result = {};
672
706
  for (const [key, value] of Object.entries(schema)) {
@@ -684,25 +718,59 @@ function hasLocalReference(value) {
684
718
  return true;
685
719
  return Object.values(value).some(hasLocalReference);
686
720
  }
687
- function rewriteLocalReferences(value, namespace) {
721
+ var NAMESPACE_SEPARATOR = "__";
722
+ var DEFINITION_KEYWORDS = ["definitions", "$defs"];
723
+ function rewriteReference(reference, namespace, targets) {
724
+ if (reference === "#" || reference === "#/") {
725
+ targets.rootReferenced = true;
726
+ return `#/definitions/${namespace}`;
727
+ }
728
+ const segments = reference.slice(2).split("/");
729
+ const [keyword, name, ...rest] = segments;
730
+ if (keyword !== undefined && name !== undefined && DEFINITION_KEYWORDS.includes(keyword)) {
731
+ const renamed = `${namespace}${NAMESPACE_SEPARATOR}${name}`;
732
+ return ["#", "definitions", renamed, ...rest].join("/");
733
+ }
734
+ targets.rootReferenced = true;
735
+ return `#/definitions/${namespace}/${segments.join("/")}`;
736
+ }
737
+ function rewriteLocalReferences(value, namespace, targets) {
688
738
  if (Array.isArray(value)) {
689
- return value.map((child) => rewriteLocalReferences(child, namespace));
739
+ return value.map((child) => rewriteLocalReferences(child, namespace, targets));
690
740
  }
691
741
  if (!isRecord(value))
692
742
  return value;
693
743
  const rewritten = {};
694
744
  for (const [key, child] of Object.entries(value)) {
695
- rewritten[key] = key === "$ref" && typeof child === "string" && child.startsWith("#") ? `#/definitions/${namespace}${child.slice(1)}` : rewriteLocalReferences(child, namespace);
745
+ rewritten[key] = key === "$ref" && typeof child === "string" && child.startsWith("#") ? rewriteReference(child, namespace, targets) : rewriteLocalReferences(child, namespace, targets);
696
746
  }
697
747
  return rewritten;
698
748
  }
699
749
  function namespaceLocalReferences(schema, namespace) {
700
750
  if (!schema || !hasLocalReference(schema))
701
751
  return schema;
702
- const rewritten = rewriteLocalReferences(schema, namespace);
752
+ const targets = { rootReferenced: false };
753
+ const rewritten = rewriteLocalReferences(schema, namespace, targets);
703
754
  if (!isRecord(rewritten))
704
755
  return schema;
705
- return { ...rewritten, definitions: { [namespace]: rewritten } };
756
+ const definitions = {};
757
+ const body = {};
758
+ for (const [key, value] of Object.entries(rewritten)) {
759
+ if (DEFINITION_KEYWORDS.includes(key)) {
760
+ if (isRecord(value)) {
761
+ for (const [name, definition] of Object.entries(value)) {
762
+ definitions[`${namespace}${NAMESPACE_SEPARATOR}${name}`] = definition;
763
+ }
764
+ }
765
+ continue;
766
+ }
767
+ body[key] = value;
768
+ }
769
+ if (targets.rootReferenced)
770
+ definitions[namespace] = withoutDialect(body);
771
+ if (Object.keys(definitions).length === 0)
772
+ return body;
773
+ return { ...body, definitions };
706
774
  }
707
775
  function objectProperties(schema) {
708
776
  return schema.type === "object" && isRecord(schema.properties) ? schema.properties : null;
@@ -710,11 +778,29 @@ function objectProperties(schema) {
710
778
  function requiredKeys2(schema) {
711
779
  return Array.isArray(schema.required) ? schema.required.filter((key) => typeof key === "string") : [];
712
780
  }
781
+ function hoistDefinitions(schema) {
782
+ const branches = Array.isArray(schema.allOf) ? schema.allOf : [];
783
+ const definitions = {};
784
+ const lifted = branches.map((branch) => {
785
+ if (!isRecord(branch) || !isRecord(branch.definitions))
786
+ return branch;
787
+ Object.assign(definitions, branch.definitions);
788
+ const rest = {};
789
+ for (const [key, value] of Object.entries(branch)) {
790
+ if (key !== "definitions")
791
+ rest[key] = value;
792
+ }
793
+ return rest;
794
+ });
795
+ if (Object.keys(definitions).length === 0)
796
+ return schema;
797
+ return { ...schema, allOf: lifted, definitions };
798
+ }
713
799
  function mergeObjectSchemas(left, right, rightOwnsUnknownKeys) {
714
800
  const leftProperties = objectProperties(left);
715
801
  const rightProperties = objectProperties(right);
716
802
  if (!leftProperties || !rightProperties)
717
- return { allOf: [left, right] };
803
+ return hoistDefinitions({ allOf: [left, right] });
718
804
  const conflicts = Object.keys(leftProperties).filter((key) => (key in rightProperties));
719
805
  if (conflicts.length > 0) {
720
806
  throw new Error(`Schema merge conflict: ${conflicts.join(", ")} appear in both params and input`);
@@ -777,7 +863,7 @@ function isObjectPresentationSchema(schema) {
777
863
  return schema.type === "object" && isRecord(schema.properties);
778
864
  }
779
865
  function presentationMetadata(schema) {
780
- return withoutDialect(schema);
866
+ return withDefsDialect(withoutDialect(schema));
781
867
  }
782
868
 
783
869
  // src/tools/internal/surface-projector.ts
@@ -1027,4 +1113,4 @@ function prepareProjectedMcpTools(tools, config = {}) {
1027
1113
  return prepared;
1028
1114
  }
1029
1115
 
1030
- export { objectShapeKeys, rebuildObject, mergeSchemas, validateMcpRoundPolicy, assertToolName, assertUniqueToolName, PORTABLE_JSON_SCHEMA_FORMATS, findNonPortableFormats, flattenToolJsonSchema, buildToolPresentationSchema, presentationMetadata, findUntypedProperties, assertToolExtensionCompatible, projectRuntimeTool, projectToolSurface, mcpProjectionCandidate, prepareProjectedMcpTools };
1116
+ export { objectShapeKeys, rebuildObject, mergeSchemas, validateMcpRoundPolicy, assertToolName, assertUniqueToolName, PORTABLE_JSON_SCHEMA_FORMATS, findNonPortableFormats, flattenToolJsonSchema, declaresDraft07, withDefsDialect, buildToolPresentationSchema, presentationMetadata, findUntypedProperties, assertToolExtensionCompatible, projectRuntimeTool, projectToolSurface, mcpProjectionCandidate, prepareProjectedMcpTools };
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  contractToolMountable
3
- } from "./index-2hrfpw2c.js";
3
+ } from "./index-32vjke6q.js";
4
4
  import {
5
5
  runtimeToolMountable
6
- } from "./index-kc6h6hg0.js";
6
+ } from "./index-8z9we758.js";
7
7
  import {
8
8
  projectToolSurface
9
- } from "./index-r159gjwy.js";
9
+ } from "./index-fenaekmk.js";
10
10
 
11
11
  // src/tools/surface.ts
12
12
  function collectToolSurface({
@@ -20,7 +20,7 @@ import {
20
20
  } from "./index-kzfs85xp.js";
21
21
  import {
22
22
  objectShapeKeys
23
- } from "./index-r159gjwy.js";
23
+ } from "./index-fenaekmk.js";
24
24
  import {
25
25
  isRecord
26
26
  } from "./index-77fekveh.js";