@bifrost-ai/engine-claude-code 0.0.1-build.1778597197821 → 0.0.1-build.1778612529349

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.
@@ -1,7 +1,5 @@
1
1
  import { Engine, EngineContext, EngineResult } from '@bifrost-ai/engine';
2
2
  export declare class ClaudeCodeEngine implements Engine {
3
- private sessionId?;
4
- execute(context: EngineContext): Promise<EngineResult>;
5
- sendFollowUp(message: string): Promise<EngineResult>;
3
+ execute(context: EngineContext, sessionId?: string): Promise<EngineResult>;
6
4
  }
7
5
  //# sourceMappingURL=claude-code-engine.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"claude-code-engine.d.ts","sourceRoot":"","sources":["../src/claude-code-engine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAkB,MAAM,oBAAoB,CAAC;AAoE9F,qBAAa,gBAAiB,YAAW,MAAM;IAC7C,OAAO,CAAC,SAAS,CAAC,CAAS;IAEd,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;IAyDtD,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;CA+ClE"}
1
+ {"version":3,"file":"claude-code-engine.d.ts","sourceRoot":"","sources":["../src/claude-code-engine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAkB,MAAM,oBAAoB,CAAC;AAwE9F,qBAAa,gBAAiB,YAAW,MAAM;IAEhC,OAAO,CAAC,OAAO,EAAE,aAAa,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;CAiExF"}
package/dist/index.js CHANGED
@@ -5,13 +5,13 @@ var t = (e) => e.type === "system" && e.subtype === "init", n = (e) => e.type ==
5
5
  if (!t?.content) return null;
6
6
  let n = t.content.filter((e) => e.type === "text" && e.text);
7
7
  return n.length === 0 ? null : n.map((e) => e.text ?? "").join("\n");
8
- }, i = (e, t, n) => {
9
- let r = [];
10
- if (n.description && r.push(`Task: ${n.description}`), Object.keys(t).length > 0) {
11
- r.push("\nContext:");
12
- for (let [e, n] of Object.entries(t)) r.push(` ${e}: ${JSON.stringify(n)}`);
8
+ }, i = (e) => {
9
+ let { agentName: t, taskState: n, metadata: r, instructions: i } = e, a = [];
10
+ if (r.description && a.push(`Task: ${r.description}`), Object.keys(n).length > 0) {
11
+ a.push("\nContext:");
12
+ for (let [e, t] of Object.entries(n)) a.push(` ${e}: ${JSON.stringify(t)}`);
13
13
  }
14
- return n.instructions && r.push(`\nInstructions: ${n.instructions}`), r.join("\n");
14
+ return i && a.push(`\nInstructions: ${i}`), a.join("\n");
15
15
  }, a = (e) => {
16
16
  let { usage: t, duration_ms: n, total_cost_usd: r, num_turns: i } = e;
17
17
  return {
@@ -24,49 +24,30 @@ var t = (e) => e.type === "system" && e.subtype === "init", n = (e) => e.type ==
24
24
  numTurns: i
25
25
  };
26
26
  }, o = class {
27
- sessionId;
28
- async execute(o) {
29
- let { agentName: s, taskState: c, metadata: l, workingDir: u, verbose: d } = o, f = i(s, c, l), p = {
30
- workingDir: u,
27
+ async execute(o, s) {
28
+ let { agentName: c, taskState: l, metadata: u, instructions: d, workingDir: f, verbose: p } = o, m = i({
29
+ agentName: c,
30
+ taskState: l,
31
+ metadata: u,
32
+ instructions: d
33
+ }), h = s ? {
34
+ workingDir: f,
31
35
  permissionMode: "acceptEdits",
32
- verbose: d
33
- }, m = null, h;
36
+ verbose: p,
37
+ resume: s
38
+ } : {
39
+ workingDir: f,
40
+ permissionMode: "acceptEdits",
41
+ verbose: p
42
+ }, g = null, _, v = s;
34
43
  try {
35
44
  let i = e({
36
- prompt: f,
37
- options: p
38
- });
39
- for await (let e of i) if (d && console.log("[claude-code-engine]", JSON.stringify(e)), t(e) && (this.sessionId = e.session_id), n(e) && (h = e, m = h.result), e.type === "assistant") {
40
- let t = r(e);
41
- t && (m = t);
42
- }
43
- } catch (e) {
44
- return {
45
- success: !1,
46
- skipFulfill: !1,
47
- lastMessage: e instanceof Error ? e.message : String(e),
48
- stats: null
49
- };
50
- }
51
- let g = h ? a(h) : null;
52
- return {
53
- success: !0,
54
- skipFulfill: !1,
55
- lastMessage: m ?? "No response from Claude",
56
- stats: g
57
- };
58
- }
59
- async sendFollowUp(t) {
60
- if (!this.sessionId) throw Error("No active session to follow up on");
61
- let i = null, o;
62
- try {
63
- let a = e({
64
- prompt: t,
65
- options: { resume: this.sessionId }
45
+ prompt: m,
46
+ options: h
66
47
  });
67
- for await (let e of a) if (n(e) && (o = e, i = o.result), e.type === "assistant") {
48
+ for await (let e of i) if (p && console.log("[claude-code-engine]", JSON.stringify(e)), t(e) && (v = e.session_id), n(e) && (_ = e, g = _.result), e.type === "assistant") {
68
49
  let t = r(e);
69
- t && (i = t);
50
+ t && (g = t);
70
51
  }
71
52
  } catch (e) {
72
53
  return {
@@ -76,12 +57,13 @@ var t = (e) => e.type === "system" && e.subtype === "init", n = (e) => e.type ==
76
57
  stats: null
77
58
  };
78
59
  }
79
- let s = o ? a(o) : null;
60
+ let y = _ ? a(_) : null;
80
61
  return {
81
62
  success: !0,
82
63
  skipFulfill: !1,
83
- lastMessage: i ?? "No response from Claude",
84
- stats: s
64
+ lastMessage: g ?? "No response from Claude",
65
+ stats: y,
66
+ sessionId: v
85
67
  };
86
68
  }
87
69
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bifrost-ai/engine-claude-code",
3
- "version": "0.0.1-build.1778597197821",
3
+ "version": "0.0.1-build.1778612529349",
4
4
  "description": "Claude Code Agent SDK engine for Orchestrator Framework",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -19,6 +19,7 @@
19
19
  "build": "vite build"
20
20
  },
21
21
  "dependencies": {
22
- "@anthropic-ai/claude-agent-sdk": "^0.2.138"
22
+ "@anthropic-ai/claude-agent-sdk": "^0.2.139",
23
+ "@bifrost-ai/engine": "0.0.1-build.1778612529349"
23
24
  }
24
25
  }