@iinm/plain-agent 1.4.0 → 1.4.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iinm/plain-agent",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "A lightweight CLI-based coding agent",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/mcp.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  /**
2
+ * @import { Client } from "@modelcontextprotocol/client";
2
3
  * @import { StructuredToolResultContent, Tool, ToolImplementation } from "./tool";
3
4
  * @import { MCPServerConfig } from "./config";
4
5
  */
5
6
 
6
7
  import { mkdir, open } from "node:fs/promises";
7
8
  import path from "node:path";
8
- import { Client } from "@modelcontextprotocol/client";
9
9
  import { AGENT_PROJECT_METADATA_DIR } from "./env.mjs";
10
10
  import { writeTmpFile } from "./tmpfile.mjs";
11
11
  import { noThrow } from "./utils/noThrow.mjs";
@@ -5,10 +5,6 @@
5
5
  */
6
6
 
7
7
  import { styleText } from "node:util";
8
- import { Sha256 } from "@aws-crypto/sha256-js";
9
- import { fromIni } from "@aws-sdk/credential-providers";
10
- import { HttpRequest } from "@smithy/protocol-http";
11
- import { SignatureV4 } from "@smithy/signature-v4";
12
8
  import { noThrow } from "../utils/noThrow.mjs";
13
9
  import { readBedrockStreamEvents } from "./platform/bedrock.mjs";
14
10
  import { getGoogleCloudAccessToken } from "./platform/googleCloud.mjs";
@@ -112,6 +108,11 @@ export async function callAnthropicModel(
112
108
 
113
109
  // bedrock + sso profile
114
110
  const runFetchForBedrock = async () => {
111
+ const { Sha256 } = await import("@aws-crypto/sha256-js");
112
+ const { fromIni } = await import("@aws-sdk/credential-providers");
113
+ const { HttpRequest } = await import("@smithy/protocol-http");
114
+ const { SignatureV4 } = await import("@smithy/signature-v4");
115
+
115
116
  const region =
116
117
  url.match(/bedrock-runtime\.([\w-]+)\.amazonaws\.com/)?.[1] ?? "";
117
118
  const urlParsed = new URL(url);
@@ -5,10 +5,6 @@
5
5
  */
6
6
 
7
7
  import { styleText } from "node:util";
8
- import { Sha256 } from "@aws-crypto/sha256-js";
9
- import { fromIni } from "@aws-sdk/credential-providers";
10
- import { HttpRequest } from "@smithy/protocol-http";
11
- import { SignatureV4 } from "@smithy/signature-v4";
12
8
  import { noThrow } from "../utils/noThrow.mjs";
13
9
  import { readBedrockStreamEvents } from "./platform/bedrock.mjs";
14
10
 
@@ -25,6 +21,11 @@ export async function callBedrockConverseModel(
25
21
  input,
26
22
  retryCount = 0,
27
23
  ) {
24
+ const { Sha256 } = await import("@aws-crypto/sha256-js");
25
+ const { fromIni } = await import("@aws-sdk/credential-providers");
26
+ const { HttpRequest } = await import("@smithy/protocol-http");
27
+ const { SignatureV4 } = await import("@smithy/signature-v4");
28
+
28
29
  return await noThrow(async () => {
29
30
  const messages = convertGenericMessageToBedrockFormat(input.messages);
30
31
  const cachedMessages = modelConfig.enablePromptCaching
@@ -5,10 +5,6 @@
5
5
  */
6
6
 
7
7
  import { styleText } from "node:util";
8
- import { Sha256 } from "@aws-crypto/sha256-js";
9
- import { fromIni } from "@aws-sdk/credential-providers";
10
- import { HttpRequest } from "@smithy/protocol-http";
11
- import { SignatureV4 } from "@smithy/signature-v4";
12
8
  import { noThrow } from "../utils/noThrow.mjs";
13
9
  import { retryOnError } from "../utils/retryOnError.mjs";
14
10
  import { readBedrockStreamEvents } from "./platform/bedrock.mjs";
@@ -112,6 +108,11 @@ export async function callOpenAICompatibleModel(
112
108
 
113
109
  // bedrock + sso profile
114
110
  const runFetchForBedrock = async () => {
111
+ const { Sha256 } = await import("@aws-crypto/sha256-js");
112
+ const { fromIni } = await import("@aws-sdk/credential-providers");
113
+ const { HttpRequest } = await import("@smithy/protocol-http");
114
+ const { SignatureV4 } = await import("@smithy/signature-v4");
115
+
115
116
  const region =
116
117
  url.match(/bedrock-runtime\.([\w-]+)\.amazonaws\.com/)?.[1] ?? "";
117
118
  const urlParsed = new URL(url);