open-agents-ai 0.138.71 → 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 +82 -12
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -54897,19 +54897,45 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
54897
54897
  });
54898
54898
  }
54899
54899
  try {
54900
- const ikFile = join59(repoRoot, ".oa", "identity", "self-state.json");
54900
+ const ikDir = join59(repoRoot, ".oa", "identity");
54901
+ const ikFile = join59(ikDir, "self-state.json");
54902
+ let ikState;
54901
54903
  if (existsSync43(ikFile)) {
54902
- const ikState = JSON.parse(readFileSync32(ikFile, "utf8"));
54903
- const event = `Task completed: ${result.summary.slice(0, 200)}`;
54904
- if (/success|pass|complete|done|fixed/i.test(event)) {
54905
- ikState.homeostasis.uncertainty = Math.max(0, ikState.homeostasis.uncertainty - 0.1);
54906
- ikState.homeostasis.coherence = Math.min(1, ikState.homeostasis.coherence + 0.05);
54907
- }
54908
- ikState.session_count = (ikState.session_count || 0) + 1;
54909
- ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
54910
- writeFileSync18(ikFile, JSON.stringify(ikState, null, 2));
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 {
54911
54938
  }
54912
- } catch {
54913
54939
  }
54914
54940
  if (voice?.enabled && result.summary) {
54915
54941
  const emoFinal = emotionEngine?.getState();
@@ -57819,7 +57845,51 @@ async function runWithTUI(task, config, repoPath) {
57819
57845
  renderUserMessage(task);
57820
57846
  try {
57821
57847
  const handle = startTask(task, config, repoRoot);
57822
- 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
+ }
57823
57893
  } catch (err) {
57824
57894
  renderError(err instanceof Error ? err.message : String(err));
57825
57895
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.138.71",
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",