open-agents-ai 0.187.441 → 0.187.442

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 CHANGED
@@ -531184,7 +531184,9 @@ var oa_directory_exports = {};
531184
531184
  __export(oa_directory_exports, {
531185
531185
  OA_DIR: () => OA_DIR,
531186
531186
  buildContextRestorePrompt: () => buildContextRestorePrompt,
531187
+ buildHandoffPrompt: () => buildHandoffPrompt,
531187
531188
  cleanPromptForDiary: () => cleanPromptForDiary,
531189
+ clearTaskHandoff: () => clearTaskHandoff,
531188
531190
  deleteSession: () => deleteSession,
531189
531191
  deleteUsageRecord: () => deleteUsageRecord,
531190
531192
  discoverContextFiles: () => discoverContextFiles,
@@ -531202,6 +531204,7 @@ __export(oa_directory_exports, {
531202
531204
  loadUsageHistory: () => loadUsageHistory,
531203
531205
  readIndexData: () => readIndexData,
531204
531206
  readIndexMeta: () => readIndexMeta,
531207
+ readTaskHandoff: () => readTaskHandoff,
531205
531208
  recordUsage: () => recordUsage,
531206
531209
  renderSessionDiary: () => renderSessionDiary,
531207
531210
  resolveSettings: () => resolveSettings,
@@ -531212,7 +531215,8 @@ __export(oa_directory_exports, {
531212
531215
  saveSessionContext: () => saveSessionContext,
531213
531216
  saveSessionHistory: () => saveSessionHistory,
531214
531217
  writeIndexData: () => writeIndexData,
531215
- writeIndexMeta: () => writeIndexMeta
531218
+ writeIndexMeta: () => writeIndexMeta,
531219
+ writeTaskHandoff: () => writeTaskHandoff
531216
531220
  });
531217
531221
  import { existsSync as existsSync59, mkdirSync as mkdirSync34, readFileSync as readFileSync46, writeFileSync as writeFileSync31, readdirSync as readdirSync15, statSync as statSync17, unlinkSync as unlinkSync14, openSync as openSync2, closeSync as closeSync2, renameSync as renameSync3 } from "node:fs";
531218
531222
  import { join as join77, relative as relative6, basename as basename13, dirname as dirname22 } from "node:path";
@@ -531496,6 +531500,91 @@ function loadPendingTask(repoRoot) {
531496
531500
  return null;
531497
531501
  }
531498
531502
  }
531503
+ function writeTaskHandoff(repoRoot, handoff) {
531504
+ const contextDir = join77(repoRoot, OA_DIR, "context");
531505
+ mkdirSync34(contextDir, { recursive: true });
531506
+ const filePath = join77(contextDir, HANDOFF_FILE);
531507
+ const tempPath = filePath + ".tmp";
531508
+ writeFileSync31(tempPath, JSON.stringify(handoff, null, 2) + "\n", "utf-8");
531509
+ try {
531510
+ renameSync3(tempPath, filePath);
531511
+ } catch {
531512
+ writeFileSync31(filePath, JSON.stringify(handoff, null, 2) + "\n", "utf-8");
531513
+ try {
531514
+ unlinkSync14(tempPath);
531515
+ } catch {
531516
+ }
531517
+ }
531518
+ }
531519
+ function readTaskHandoff(repoRoot) {
531520
+ const filePath = join77(repoRoot, OA_DIR, "context", HANDOFF_FILE);
531521
+ try {
531522
+ if (!existsSync59(filePath)) return null;
531523
+ const data = JSON.parse(readFileSync46(filePath, "utf-8"));
531524
+ const handoffTime = new Date(data.handoffAt).getTime();
531525
+ const now = Date.now();
531526
+ const ageMs = now - handoffTime;
531527
+ const maxAgeMs = 24 * 60 * 60 * 1e3;
531528
+ if (ageMs > maxAgeMs) {
531529
+ return null;
531530
+ }
531531
+ return data;
531532
+ } catch {
531533
+ return null;
531534
+ }
531535
+ }
531536
+ function clearTaskHandoff(repoRoot) {
531537
+ const filePath = join77(repoRoot, OA_DIR, "context", HANDOFF_FILE);
531538
+ try {
531539
+ if (existsSync59(filePath)) {
531540
+ unlinkSync14(filePath);
531541
+ }
531542
+ } catch {
531543
+ }
531544
+ }
531545
+ function buildHandoffPrompt(repoRoot) {
531546
+ const handoff = readTaskHandoff(repoRoot);
531547
+ if (!handoff || !handoff.eligible) return null;
531548
+ const lines = ["<task-handoff>", ""];
531549
+ lines.push(`## Previous Task: ${handoff.base.task.slice(0, 100)}...`);
531550
+ lines.push("");
531551
+ if (handoff.accomplishments.length > 0) {
531552
+ lines.push("### Accomplished:");
531553
+ for (const a2 of handoff.accomplishments.slice(0, 5)) {
531554
+ lines.push(`- ${a2}`);
531555
+ }
531556
+ lines.push("");
531557
+ }
531558
+ if (handoff.files.length > 0) {
531559
+ lines.push("### Files Modified:");
531560
+ for (const f2 of handoff.files.slice(0, 5)) {
531561
+ const op = f2.operation;
531562
+ const anchors = f2.anchors?.length ? ` (${f2.anchors.slice(0, 3).join(", ")})` : "";
531563
+ lines.push(`- [${op}] ${f2.path}${anchors}`);
531564
+ }
531565
+ lines.push("");
531566
+ }
531567
+ if (handoff.findings.length > 0) {
531568
+ lines.push("### Critical Findings:");
531569
+ for (const f2 of handoff.findings.slice(0, 5)) {
531570
+ lines.push(`- ${f2}`);
531571
+ }
531572
+ lines.push("");
531573
+ }
531574
+ if (handoff.memories.length > 0) {
531575
+ lines.push("### Memories Used:");
531576
+ for (const m2 of handoff.memories.slice(0, 3)) {
531577
+ lines.push(`- [${m2.topic}/${m2.key}]: ${m2.relevance}`);
531578
+ }
531579
+ lines.push("");
531580
+ }
531581
+ lines.push("### Validation:");
531582
+ lines.push(`- Tests: ${handoff.validation.testsRan ? handoff.validation.testsPassed ? "✓ passed" : "✗ failed" : "not run"}`);
531583
+ lines.push(`- Build: ${handoff.validation.buildSucceeded ? "✓ succeeded" : "✗ failed"}`);
531584
+ lines.push("");
531585
+ lines.push("</task-handoff>");
531586
+ return lines.join("\n");
531587
+ }
531499
531588
  function computeDedupeHash(task, savedAt) {
531500
531589
  return createHash8("sha256").update(`${task}|${savedAt}`).digest("hex").slice(0, 16);
531501
531590
  }
@@ -531782,6 +531871,17 @@ function loadSessionContext(repoRoot) {
531782
531871
  }
531783
531872
  function buildContextRestorePrompt(repoRoot) {
531784
531873
  const ctx3 = loadSessionContext(repoRoot);
531874
+ const handoffPrompt = buildHandoffPrompt(repoRoot);
531875
+ if (handoffPrompt) {
531876
+ const baseCtx = ctx3 && ctx3.entries.length > 0 ? `
531877
+
531878
+ <session-recap>
531879
+ Recent tasks: ${ctx3.entries.slice(-3).map(
531880
+ (e2) => `[${e2.completed ? "done" : "partial"}] ${normalizeSessionText(e2.summary || e2.task, 80)}`
531881
+ ).join(", ")}
531882
+ </session-recap>` : "";
531883
+ return handoffPrompt + baseCtx;
531884
+ }
531785
531885
  if (!ctx3 || ctx3.entries.length === 0) return null;
531786
531886
  const recent = ctx3.entries.slice(-5);
531787
531887
  const chronology = recent.map((e2) => {
@@ -532098,7 +532198,7 @@ function deleteUsageRecord(kind, value2, repoRoot) {
532098
532198
  remove(join77(repoRoot, OA_DIR, USAGE_HISTORY_FILE));
532099
532199
  }
532100
532200
  }
532101
- var OA_DIR, SUBDIRS, CONTEXT_FILES, PENDING_TASK_FILE, CONTEXT_SAVE_FILE, MAX_CONTEXT_ENTRIES, SAME_TASK_REPLACE_WINDOW_MS, LOCK_TIMEOUT_MS, LOCK_RETRY_MS, LOCK_RETRY_MAX, SESSIONS_DIR, SESSIONS_INDEX, SKIP_DIRS2, HOME_SKIP_DIRS, USAGE_HISTORY_FILE, MAX_HISTORY_RECORDS;
532201
+ var OA_DIR, SUBDIRS, CONTEXT_FILES, PENDING_TASK_FILE, HANDOFF_FILE, CONTEXT_SAVE_FILE, MAX_CONTEXT_ENTRIES, SAME_TASK_REPLACE_WINDOW_MS, LOCK_TIMEOUT_MS, LOCK_RETRY_MS, LOCK_RETRY_MAX, SESSIONS_DIR, SESSIONS_INDEX, SKIP_DIRS2, HOME_SKIP_DIRS, USAGE_HISTORY_FILE, MAX_HISTORY_RECORDS;
532102
532202
  var init_oa_directory = __esm({
532103
532203
  "packages/cli/src/tui/oa-directory.ts"() {
532104
532204
  "use strict";
@@ -532115,6 +532215,7 @@ var init_oa_directory = __esm({
532115
532215
  "AGENTS.md"
532116
532216
  ];
532117
532217
  PENDING_TASK_FILE = "pending-task.json";
532218
+ HANDOFF_FILE = "task-handoff.json";
532118
532219
  CONTEXT_SAVE_FILE = "session-context.json";
532119
532220
  MAX_CONTEXT_ENTRIES = 20;
532120
532221
  SAME_TASK_REPLACE_WINDOW_MS = 12 * 60 * 60 * 1e3;
@@ -585177,6 +585278,42 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
585177
585278
  });
585178
585279
  } catch {
585179
585280
  }
585281
+ try {
585282
+ const handoff = {
585283
+ base: {
585284
+ savedAt: (/* @__PURE__ */ new Date()).toISOString(),
585285
+ task: cleanPromptForDiary(task).slice(0, 500),
585286
+ summary: result.summary.slice(0, 500),
585287
+ assistantResponse: cleanForStorage(lastAssistantText || result.summary).slice(0, 1200),
585288
+ filesModified: Array.from(filesTouched).slice(0, 30),
585289
+ toolCalls: result.toolCalls,
585290
+ completed: result.completed,
585291
+ model: config.model,
585292
+ source: "task_complete"
585293
+ },
585294
+ accomplishments: [],
585295
+ // Populated by agent if it provides structured output
585296
+ files: Array.from(filesTouched).slice(0, 20).map((f2) => ({
585297
+ path: f2,
585298
+ operation: "modified"
585299
+ })),
585300
+ memories: [],
585301
+ // Populated from memory recalls during task
585302
+ findings: [],
585303
+ // Populated by agent
585304
+ validation: {
585305
+ testsRan: false,
585306
+ // Would need to track during task
585307
+ testsPassed: false,
585308
+ buildSucceeded: true
585309
+ // Assume success if task completed
585310
+ },
585311
+ eligible: result.completed,
585312
+ handoffAt: (/* @__PURE__ */ new Date()).toISOString()
585313
+ };
585314
+ writeTaskHandoff(repoRoot, handoff);
585315
+ } catch {
585316
+ }
585180
585317
  try {
585181
585318
  const sessionId2 = `session-${Date.now().toString(36)}`;
585182
585319
  const contentLines = statusBar?._contentLines ?? [];
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.187.441",
3
+ "version": "0.187.442",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "open-agents-ai",
9
- "version": "0.187.441",
9
+ "version": "0.187.442",
10
10
  "hasInstallScript": true,
11
11
  "license": "CC-BY-NC-4.0",
12
12
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.187.441",
3
+ "version": "0.187.442",
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",