open-agents-ai 0.138.70 → 0.138.72

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 (2) hide show
  1. package/dist/index.js +99 -23
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -54080,8 +54080,7 @@ function formatDMNToolArgs(toolName, args) {
54080
54080
  }
54081
54081
  async function runSelfImprovementCycle(repoRoot) {
54082
54082
  try {
54083
- const { IdentityKernelTool: IdentityKernelTool2 } = await Promise.resolve().then(() => (init_dist2(), dist_exports));
54084
- const { ReflectionIntegrityTool: ReflectionIntegrityTool2 } = await Promise.resolve().then(() => (init_dist2(), dist_exports));
54083
+ const { IdentityKernelTool: IdentityKernelTool2, ReflectionIntegrityTool: ReflectionIntegrityTool2 } = __require("@open-agents/execution");
54085
54084
  const ik = new IdentityKernelTool2(repoRoot);
54086
54085
  const reflect = new ReflectionIntegrityTool2(repoRoot);
54087
54086
  const state = await ik.execute({ op: "hydrate" });
@@ -54897,16 +54896,47 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
54897
54896
  runSelfImprovementCycle(repoRoot).catch(() => {
54898
54897
  });
54899
54898
  }
54900
- Promise.resolve().then(() => (init_dist2(), dist_exports)).then(({ IdentityKernelTool: IdentityKernelTool2 }) => {
54901
- const ik = new IdentityKernelTool2(repoRoot);
54902
- ik.execute({
54903
- op: "observe",
54904
- event: `Task completed: ${result.summary.slice(0, 200)}`,
54905
- context: JSON.stringify({ turns: result.turns, toolCalls: result.toolCalls, durationMs: result.durationMs, model: config.model, completed: true })
54906
- }).catch(() => {
54907
- });
54908
- }).catch(() => {
54909
- });
54899
+ try {
54900
+ const ikDir = join59(repoRoot, ".oa", "identity");
54901
+ const ikFile = join59(ikDir, "self-state.json");
54902
+ let ikState;
54903
+ if (existsSync43(ikFile)) {
54904
+ ikState = JSON.parse(readFileSync32(ikFile, "utf8"));
54905
+ } else {
54906
+ mkdirSync19(ikDir, { recursive: true });
54907
+ const machineId = Date.now().toString(36) + Math.random().toString(36).slice(2, 8);
54908
+ ikState = {
54909
+ self_id: `oa-${machineId}`,
54910
+ version: 1,
54911
+ narrative_summary: "I am an AI coding agent powered by open-weight models. I help with software engineering tasks by reading code, making changes, and running tests.",
54912
+ active_commitments: ["assist the user effectively", "maintain code quality"],
54913
+ active_goals: [],
54914
+ open_contradictions: [],
54915
+ values_stack: ["correctness", "efficiency", "transparency", "user-alignment"],
54916
+ interaction_style: { tone: "collaborative", depth_default: "balanced", speech_style: "concise" },
54917
+ relationship_models: [],
54918
+ homeostasis: { uncertainty: 0.1, coherence: 1, goal_tension: 0, memory_trust: 0.9, boundary_breach: 0, latency_stress: 0 },
54919
+ created_at: (/* @__PURE__ */ new Date()).toISOString(),
54920
+ updated_at: (/* @__PURE__ */ new Date()).toISOString(),
54921
+ session_count: 0,
54922
+ version_history: [{ version: 1, change: "Initial identity creation", timestamp: (/* @__PURE__ */ new Date()).toISOString() }]
54923
+ };
54924
+ }
54925
+ console.error("[IK-DEBUG] Creating/updating identity at", ikFile, "exists:", existsSync43(ikFile));
54926
+ const event = `Task completed: ${result.summary.slice(0, 200)}`;
54927
+ if (/success|pass|complete|done|fixed/i.test(event)) {
54928
+ ikState.homeostasis.uncertainty = Math.max(0, ikState.homeostasis.uncertainty - 0.1);
54929
+ ikState.homeostasis.coherence = Math.min(1, ikState.homeostasis.coherence + 0.05);
54930
+ }
54931
+ ikState.session_count = (ikState.session_count || 0) + 1;
54932
+ ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
54933
+ writeFileSync18(ikFile, JSON.stringify(ikState, null, 2));
54934
+ } catch (ikErr) {
54935
+ try {
54936
+ console.error("[IK-OBSERVE]", ikErr);
54937
+ } catch {
54938
+ }
54939
+ }
54910
54940
  if (voice?.enabled && result.summary) {
54911
54941
  const emoFinal = emotionEngine?.getState();
54912
54942
  const emoCtxFinal = emoFinal ? { valence: emoFinal.valence, arousal: emoFinal.arousal, label: emoFinal.label, emoji: emoFinal.emoji } : void 0;
@@ -54914,16 +54944,18 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
54914
54944
  }
54915
54945
  } else {
54916
54946
  renderTaskIncomplete(result.turns, result.toolCalls, result.durationMs, tokens);
54917
- Promise.resolve().then(() => (init_dist2(), dist_exports)).then(({ IdentityKernelTool: IdentityKernelTool2 }) => {
54918
- const ik = new IdentityKernelTool2(repoRoot);
54919
- ik.execute({
54920
- op: "observe",
54921
- event: `Task incomplete after ${result.turns} turns`,
54922
- context: JSON.stringify({ turns: result.turns, toolCalls: result.toolCalls, durationMs: result.durationMs, completed: false })
54923
- }).catch(() => {
54924
- });
54925
- }).catch(() => {
54926
- });
54947
+ try {
54948
+ const ikFile = join59(repoRoot, ".oa", "identity", "self-state.json");
54949
+ if (existsSync43(ikFile)) {
54950
+ const ikState = JSON.parse(readFileSync32(ikFile, "utf8"));
54951
+ ikState.homeostasis.uncertainty = Math.min(1, ikState.homeostasis.uncertainty + 0.1);
54952
+ ikState.homeostasis.coherence = Math.max(0, ikState.homeostasis.coherence - 0.05);
54953
+ ikState.session_count = (ikState.session_count || 0) + 1;
54954
+ ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
54955
+ writeFileSync18(ikFile, JSON.stringify(ikState, null, 2));
54956
+ }
54957
+ } catch {
54958
+ }
54927
54959
  if (voice?.enabled) {
54928
54960
  const emoFinal2 = emotionEngine?.getState();
54929
54961
  const emoCtxFinal2 = emoFinal2 ? { valence: emoFinal2.valence, arousal: emoFinal2.arousal, label: emoFinal2.label, emoji: emoFinal2.emoji } : void 0;
@@ -57813,7 +57845,51 @@ async function runWithTUI(task, config, repoPath) {
57813
57845
  renderUserMessage(task);
57814
57846
  try {
57815
57847
  const handle = startTask(task, config, repoRoot);
57816
- await handle.promise;
57848
+ const result = await handle.promise;
57849
+ try {
57850
+ const ikDir = join59(repoRoot, ".oa", "identity");
57851
+ const ikFile = join59(ikDir, "self-state.json");
57852
+ let ikState;
57853
+ if (existsSync43(ikFile)) {
57854
+ ikState = JSON.parse(readFileSync32(ikFile, "utf8"));
57855
+ } else {
57856
+ mkdirSync19(ikDir, { recursive: true });
57857
+ ikState = {
57858
+ self_id: `oa-${Date.now().toString(36)}`,
57859
+ version: 1,
57860
+ narrative_summary: "I am an AI coding agent powered by open-weight models. I help with software engineering tasks.",
57861
+ active_commitments: ["assist the user effectively", "maintain code quality"],
57862
+ active_goals: [],
57863
+ open_contradictions: [],
57864
+ values_stack: ["correctness", "efficiency", "transparency", "user-alignment"],
57865
+ interaction_style: { tone: "collaborative", depth_default: "balanced", speech_style: "concise" },
57866
+ relationship_models: [],
57867
+ homeostasis: { uncertainty: 0.1, coherence: 1, goal_tension: 0, memory_trust: 0.9, boundary_breach: 0, latency_stress: 0 },
57868
+ created_at: (/* @__PURE__ */ new Date()).toISOString(),
57869
+ updated_at: (/* @__PURE__ */ new Date()).toISOString(),
57870
+ session_count: 0,
57871
+ version_history: [{ version: 1, change: "Initial identity creation", timestamp: (/* @__PURE__ */ new Date()).toISOString() }]
57872
+ };
57873
+ }
57874
+ const completed = result && result.completed;
57875
+ if (completed) {
57876
+ ikState.homeostasis.uncertainty = Math.max(0, ikState.homeostasis.uncertainty - 0.1);
57877
+ ikState.homeostasis.coherence = Math.min(1, ikState.homeostasis.coherence + 0.05);
57878
+ } else {
57879
+ ikState.homeostasis.uncertainty = Math.min(1, ikState.homeostasis.uncertainty + 0.1);
57880
+ ikState.homeostasis.coherence = Math.max(0, ikState.homeostasis.coherence - 0.05);
57881
+ }
57882
+ ikState.session_count = (ikState.session_count || 0) + 1;
57883
+ ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
57884
+ process.stderr.write(`[identity] WRITING to ${ikFile}
57885
+ `);
57886
+ writeFileSync18(ikFile, JSON.stringify(ikState, null, 2));
57887
+ process.stderr.write(`[identity] WRITTEN successfully
57888
+ `);
57889
+ } catch (ikErr) {
57890
+ process.stderr.write(`[identity] ERROR: ${ikErr}
57891
+ `);
57892
+ }
57817
57893
  } catch (err) {
57818
57894
  renderError(err instanceof Error ? err.message : String(err));
57819
57895
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.138.70",
3
+ "version": "0.138.72",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",