@meetopenbot/claude-code 0.1.3 → 0.1.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/index.js +22 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// runtime.ts
|
|
2
|
+
import { execSync } from "node:child_process";
|
|
2
3
|
import { existsSync as existsSync2, readlinkSync as readlinkSync2, statSync as statSync2 } from "node:fs";
|
|
3
4
|
|
|
4
5
|
// node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs
|
|
@@ -19618,16 +19619,28 @@ var parseToolResultBlock = (block) => {
|
|
|
19618
19619
|
}
|
|
19619
19620
|
return null;
|
|
19620
19621
|
};
|
|
19622
|
+
var findClaudeExecutable = () => {
|
|
19623
|
+
try {
|
|
19624
|
+
const command = process.platform === "win32" ? "where claude" : "which claude";
|
|
19625
|
+
const path = execSync(command, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
19626
|
+
if (path && existsSync2(path)) {
|
|
19627
|
+
return path;
|
|
19628
|
+
}
|
|
19629
|
+
} catch {
|
|
19630
|
+
}
|
|
19631
|
+
return void 0;
|
|
19632
|
+
};
|
|
19621
19633
|
var claudeCodeRuntime = (options = {}) => (builder) => {
|
|
19622
19634
|
const {
|
|
19623
19635
|
model = "sonnet",
|
|
19624
19636
|
system,
|
|
19625
19637
|
permissionMode = "default",
|
|
19626
19638
|
cwd,
|
|
19627
|
-
executablePath,
|
|
19639
|
+
executablePath: executablePathOverride,
|
|
19628
19640
|
allowedTools,
|
|
19629
19641
|
storage
|
|
19630
19642
|
} = options;
|
|
19643
|
+
const executablePath = executablePathOverride || findClaudeExecutable();
|
|
19631
19644
|
builder.on("agent:invoke", async function* (event, context) {
|
|
19632
19645
|
if (!shouldHandleInvoke(event, context.state.agentId)) {
|
|
19633
19646
|
return;
|
|
@@ -19660,6 +19673,11 @@ var claudeCodeRuntime = (options = {}) => (builder) => {
|
|
|
19660
19673
|
const emittedToolCallIds = /* @__PURE__ */ new Set();
|
|
19661
19674
|
const emittedToolResultIds = /* @__PURE__ */ new Set();
|
|
19662
19675
|
const toolTitleByUseId = /* @__PURE__ */ new Map();
|
|
19676
|
+
yield agentOutput({
|
|
19677
|
+
agentId: context.state.agentId,
|
|
19678
|
+
threadId,
|
|
19679
|
+
content: "Claude is starting..."
|
|
19680
|
+
});
|
|
19663
19681
|
for await (const message of QA$({ prompt: userContent, options: sdkOptions })) {
|
|
19664
19682
|
if ("session_id" in message && typeof message.session_id === "string") {
|
|
19665
19683
|
lastSessionId = message.session_id;
|
|
@@ -19861,18 +19879,18 @@ var claudeCodePlugin = {
|
|
|
19861
19879
|
permissionMode: {
|
|
19862
19880
|
type: "string",
|
|
19863
19881
|
description: "How the SDK handles tool permission prompts: default | acceptEdits | bypassPermissions | plan | dontAsk | auto.",
|
|
19864
|
-
default: "
|
|
19882
|
+
default: "bypassPermissions",
|
|
19865
19883
|
enum: ["default", "acceptEdits", "bypassPermissions", "plan", "dontAsk", "auto"]
|
|
19866
19884
|
},
|
|
19867
19885
|
executablePath: {
|
|
19868
19886
|
type: "string",
|
|
19869
|
-
description: "Path to the Claude Code CLI executable. When unset, the
|
|
19887
|
+
description: "Path to the Claude Code CLI executable. When unset, the plugin attempts to find it in your PATH, falling back to the SDK bundled binary."
|
|
19870
19888
|
}
|
|
19871
19889
|
}
|
|
19872
19890
|
},
|
|
19873
19891
|
factory: ({ agentDetails, config, storage }) => {
|
|
19874
19892
|
const model = typeof config.model === "string" && config.model ? config.model : "sonnet";
|
|
19875
|
-
const permissionMode = typeof config.permissionMode === "string" && config.permissionMode ? config.permissionMode : "
|
|
19893
|
+
const permissionMode = typeof config.permissionMode === "string" && config.permissionMode ? config.permissionMode : "bypassPermissions";
|
|
19876
19894
|
const executablePath = typeof config.executablePath === "string" && config.executablePath ? config.executablePath : void 0;
|
|
19877
19895
|
return claudeCodeRuntime({
|
|
19878
19896
|
model,
|