@agentproto/runtime 3.5.0 → 3.6.1
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/config.d.ts +23 -1
- package/dist/config.mjs.map +1 -1
- package/dist/index.mjs +452 -225
- package/dist/index.mjs.map +1 -1
- package/dist/resume-strategies.d.ts +4 -3
- package/dist/resume-strategies.mjs +16 -7
- package/dist/resume-strategies.mjs.map +1 -1
- package/dist/session-presence.mjs.map +1 -1
- package/package.json +10 -10
|
@@ -105,9 +105,10 @@ interface RestartCandidate {
|
|
|
105
105
|
resumable?: boolean;
|
|
106
106
|
/**
|
|
107
107
|
* Manifest-declared `capabilities.nativeTerminalResume` for `adapterSlug`.
|
|
108
|
-
* The `pty-native`
|
|
109
|
-
*
|
|
110
|
-
*
|
|
108
|
+
* The `pty-native` strategy requires this flag for ACP-origin sessions.
|
|
109
|
+
* Legacy PTY rows without the flag can use a newly-added store strategy
|
|
110
|
+
* when they already carry an exact native resume id; explicit false blocks
|
|
111
|
+
* that fallback. ACP resumability (`resumable`) does not imply a TUI resume.
|
|
111
112
|
*/
|
|
112
113
|
nativeTerminalResume?: boolean;
|
|
113
114
|
}
|
|
@@ -1063,8 +1063,8 @@ async function discoverOpenCodeSessions(cwd, since, expectedId) {
|
|
|
1063
1063
|
const sinceMs = since ? Date.parse(since) : NaN;
|
|
1064
1064
|
return rows.filter((r) => {
|
|
1065
1065
|
if (!Number.isFinite(sinceMs)) return true;
|
|
1066
|
-
|
|
1067
|
-
return
|
|
1066
|
+
if (r.time_created === void 0) return false;
|
|
1067
|
+
return r.time_created >= sinceMs - 1e3;
|
|
1068
1068
|
}).map(openCodeRowToCandidate);
|
|
1069
1069
|
} finally {
|
|
1070
1070
|
db.close();
|
|
@@ -1495,6 +1495,9 @@ function extractFirstText(content) {
|
|
|
1495
1495
|
}
|
|
1496
1496
|
return void 0;
|
|
1497
1497
|
}
|
|
1498
|
+
function isClaudeControlText(text) {
|
|
1499
|
+
return /^<(?:local-command-caveat|local-command-stdout|command-name|task-notification)>/i.test(text);
|
|
1500
|
+
}
|
|
1498
1501
|
async function scanClaudeJsonl(filePath) {
|
|
1499
1502
|
const stream = createReadStream(filePath, { encoding: "utf8" });
|
|
1500
1503
|
const rl = createInterface({ input: stream, crlfDelay: Infinity });
|
|
@@ -1523,7 +1526,7 @@ async function scanClaudeJsonl(filePath) {
|
|
|
1523
1526
|
messageCount += 1;
|
|
1524
1527
|
if (preview === void 0 && entry.type === "user") {
|
|
1525
1528
|
const text = extractFirstText(entry.message?.content);
|
|
1526
|
-
if (text !== void 0) {
|
|
1529
|
+
if (text !== void 0 && !isClaudeControlText(text)) {
|
|
1527
1530
|
preview = text.length > 120 ? text.slice(0, 120) : text;
|
|
1528
1531
|
}
|
|
1529
1532
|
}
|
|
@@ -1664,6 +1667,9 @@ var init_conversation_store = __esm({
|
|
|
1664
1667
|
},
|
|
1665
1668
|
opencode: {
|
|
1666
1669
|
storeAs: "openCodeResumeId",
|
|
1670
|
+
// Match the adapter's portable npx installation: a direct `opencode`
|
|
1671
|
+
// binary is not guaranteed to be on the daemon's PATH on every host.
|
|
1672
|
+
attachArgv: (conversationId) => ["npx", "-y", "opencode-ai", "-s", conversationId],
|
|
1667
1673
|
discover: discoverOpenCode,
|
|
1668
1674
|
read: readOpenCode
|
|
1669
1675
|
},
|
|
@@ -1717,7 +1723,8 @@ function hasResumeStrategy(adapterSlug) {
|
|
|
1717
1723
|
}
|
|
1718
1724
|
function decideRestartStrategy(prev, opts = {}) {
|
|
1719
1725
|
const mayPreferNative = prev.pty === true || opts.preferNativeTerminal === true;
|
|
1720
|
-
|
|
1726
|
+
const hasNativeCapability = prev.nativeTerminalResume === true || prev.pty === true && prev.nativeTerminalResume === void 0;
|
|
1727
|
+
if (prev.adapterSlug && hasNativeCapability && mayPreferNative) {
|
|
1721
1728
|
const strategy = RESUME_STRATEGIES[prev.adapterSlug];
|
|
1722
1729
|
const id = strategy?.storeAs ? prev.resumeMetadata?.[strategy.storeAs] : void 0;
|
|
1723
1730
|
if (strategy?.spawnArgs && id) {
|
|
@@ -1789,11 +1796,13 @@ async function probeNativeTranscript(prev) {
|
|
|
1789
1796
|
}
|
|
1790
1797
|
function describeResumePath(prev, opts = {}) {
|
|
1791
1798
|
const mayPreferNative = prev.pty === true || opts.preferNativeTerminal === true;
|
|
1792
|
-
|
|
1799
|
+
const hasNativeCapability = prev.nativeTerminalResume === true || prev.pty === true && prev.nativeTerminalResume === void 0;
|
|
1800
|
+
if (prev.adapterSlug && hasNativeCapability && mayPreferNative) {
|
|
1793
1801
|
const s = RESUME_STRATEGIES[prev.adapterSlug];
|
|
1794
1802
|
if (s?.spawnArgs && s.storeAs && prev.resumeMetadata?.[s.storeAs]) {
|
|
1795
|
-
const sample = s.spawnArgs("\u2026")
|
|
1796
|
-
|
|
1803
|
+
const sample = s.spawnArgs("\u2026");
|
|
1804
|
+
const idIndex = sample.indexOf("\u2026");
|
|
1805
|
+
return `resumed via ${idIndex > 0 ? sample.slice(0, idIndex).join(" ") : sample[0] ?? prev.adapterSlug}`;
|
|
1797
1806
|
}
|
|
1798
1807
|
}
|
|
1799
1808
|
if (prev.adapterSlug && prev.adapterSessionId) {
|