@abitat_reece/host-daemon 0.1.20 → 0.1.22
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/local-control/codex-bridge.d.ts.map +1 -1
- package/dist/local-control/codex-bridge.js +177 -18
- package/dist/local-control/codex-bridge.js.map +1 -1
- package/dist/local-control/push-notifications.d.ts +2 -2
- package/dist/local-control/push-notifications.d.ts.map +1 -1
- package/dist/local-control/push-notifications.js +3 -1
- package/dist/local-control/push-notifications.js.map +1 -1
- package/dist/local-control/relay-client.d.ts +10 -3
- package/dist/local-control/relay-client.d.ts.map +1 -1
- package/dist/local-control/relay-client.js.map +1 -1
- package/dist/local-control/remote-control/macos-driver.d.ts +16 -0
- package/dist/local-control/remote-control/macos-driver.d.ts.map +1 -0
- package/dist/local-control/remote-control/macos-driver.js +440 -0
- package/dist/local-control/remote-control/macos-driver.js.map +1 -0
- package/dist/local-control/remote-control/routes.d.ts +20 -0
- package/dist/local-control/remote-control/routes.d.ts.map +1 -0
- package/dist/local-control/remote-control/routes.js +110 -0
- package/dist/local-control/remote-control/routes.js.map +1 -0
- package/dist/local-control/remote-control/session-manager.d.ts +10 -0
- package/dist/local-control/remote-control/session-manager.d.ts.map +1 -0
- package/dist/local-control/remote-control/session-manager.js +259 -0
- package/dist/local-control/remote-control/session-manager.js.map +1 -0
- package/dist/local-control/remote-control/types.d.ts +49 -0
- package/dist/local-control/remote-control/types.d.ts.map +1 -0
- package/dist/local-control/remote-control/types.js +2 -0
- package/dist/local-control/remote-control/types.js.map +1 -0
- package/dist/local-control/server.d.ts +7 -2
- package/dist/local-control/server.d.ts.map +1 -1
- package/dist/local-control/server.js +24 -86
- package/dist/local-control/server.js.map +1 -1
- package/dist/local-control/transport.d.ts +6 -2
- package/dist/local-control/transport.d.ts.map +1 -1
- package/dist/local-control/transport.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex-bridge.d.ts","sourceRoot":"","sources":["../../src/local-control/codex-bridge.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAEV,gBAAgB,
|
|
1
|
+
{"version":3,"file":"codex-bridge.d.ts","sourceRoot":"","sources":["../../src/local-control/codex-bridge.ts"],"names":[],"mappings":"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"}
|
|
@@ -18,7 +18,13 @@ const THREAD_LIST_CACHE_TTL_MS = 2_500;
|
|
|
18
18
|
const LOCAL_STARTED_TURN_MATERIALIZATION_GRACE_MS = 5 * 60_000;
|
|
19
19
|
const MAX_CODEX_MESSAGE_CONTENT_LENGTH = 12_000;
|
|
20
20
|
const MAX_CONTEXT_SYNC_TURNS_WITHOUT_CURSOR = 6;
|
|
21
|
-
const HIDDEN_CODEX_ITEM_TYPES = new Set([
|
|
21
|
+
const HIDDEN_CODEX_ITEM_TYPES = new Set([
|
|
22
|
+
"contextCompaction",
|
|
23
|
+
"enteredReviewMode",
|
|
24
|
+
"exitedReviewMode",
|
|
25
|
+
"reasoning"
|
|
26
|
+
]);
|
|
27
|
+
const MAX_CODEX_ITEM_SUMMARY_LENGTH = 240;
|
|
22
28
|
const PHONE_FULL_ACCESS_TURN_OPTIONS = {
|
|
23
29
|
approvalPolicy: "never",
|
|
24
30
|
sandboxPolicy: { type: "dangerFullAccess" }
|
|
@@ -42,6 +48,7 @@ export function createLocalCodexBridge(options = {}) {
|
|
|
42
48
|
const queuedTurnsByThread = new Map();
|
|
43
49
|
const queueDrainTimers = new Map();
|
|
44
50
|
const threadListCache = new Map();
|
|
51
|
+
const conversationStatusCache = new Map();
|
|
45
52
|
const messageHistoryCache = new Map();
|
|
46
53
|
const modelContextSyncedTurnIds = new Map();
|
|
47
54
|
const locallyStartedTurnsByThread = new Map();
|
|
@@ -67,6 +74,10 @@ export function createLocalCodexBridge(options = {}) {
|
|
|
67
74
|
}
|
|
68
75
|
return tracked;
|
|
69
76
|
}
|
|
77
|
+
if (shouldClearMissingLocalStartedTurn(thread, tracked)) {
|
|
78
|
+
locallyStartedTurnsByThread.delete(thread.id);
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
70
81
|
if (Date.now() - tracked.startedAtMs > LOCAL_STARTED_TURN_MATERIALIZATION_GRACE_MS) {
|
|
71
82
|
locallyStartedTurnsByThread.delete(thread.id);
|
|
72
83
|
return null;
|
|
@@ -263,6 +274,7 @@ export function createLocalCodexBridge(options = {}) {
|
|
|
263
274
|
return true;
|
|
264
275
|
}
|
|
265
276
|
function invalidateMessageHistoryCache(threadId) {
|
|
277
|
+
conversationStatusCache.delete(threadId);
|
|
266
278
|
messageHistoryCache.delete(threadId);
|
|
267
279
|
}
|
|
268
280
|
function scheduleQueueDrain(threadId, delayMs = QUEUED_TURN_POLL_INTERVAL_MS) {
|
|
@@ -403,8 +415,12 @@ export function createLocalCodexBridge(options = {}) {
|
|
|
403
415
|
updated
|
|
404
416
|
};
|
|
405
417
|
},
|
|
406
|
-
async listCompletionStates() {
|
|
407
|
-
const threads = await
|
|
418
|
+
async listCompletionStates(completionOptions = {}) {
|
|
419
|
+
const threads = await hydrateConversationStatusThreads(await loadAllThreads(), {
|
|
420
|
+
hydrateCompletionTransitions: true,
|
|
421
|
+
hydrateIdleSummariesSince: completionOptions.hydrateIdleSummariesSince,
|
|
422
|
+
hydrateIdleSummaries: false
|
|
423
|
+
});
|
|
408
424
|
const states = threads.map((thread) => codexThreadToCompletionState(thread, workspaceId, {
|
|
409
425
|
forceRunning: Boolean(locallyStartedTurnForThread(thread))
|
|
410
426
|
}));
|
|
@@ -453,7 +469,9 @@ export function createLocalCodexBridge(options = {}) {
|
|
|
453
469
|
},
|
|
454
470
|
async listProjectConversations(projectId) {
|
|
455
471
|
const cwd = await resolveProjectCwd(projectId);
|
|
456
|
-
const threads = await hydrateConversationStatusThreads(await listAllThreads({ cwd })
|
|
472
|
+
const threads = await hydrateConversationStatusThreads(await listAllThreads({ cwd }), {
|
|
473
|
+
hydrateIdleSummaries: true
|
|
474
|
+
});
|
|
457
475
|
return threads
|
|
458
476
|
.filter((thread) => externalCodexProjectId(thread.cwd) === projectId)
|
|
459
477
|
.sort((left, right) => right.updatedAt - left.updatedAt)
|
|
@@ -483,19 +501,24 @@ export function createLocalCodexBridge(options = {}) {
|
|
|
483
501
|
};
|
|
484
502
|
}
|
|
485
503
|
};
|
|
486
|
-
async function
|
|
487
|
-
return Promise.all(threads.map(async (thread) => {
|
|
488
|
-
const readThread = await client.readThread(thread.id, true).catch(() => thread);
|
|
489
|
-
return mergeCodexThreadSnapshots(readThread, thread);
|
|
490
|
-
}));
|
|
491
|
-
}
|
|
492
|
-
async function hydrateConversationStatusThreads(threads) {
|
|
504
|
+
async function hydrateConversationStatusThreads(threads, options) {
|
|
493
505
|
return Promise.all(threads.map(async (thread) => {
|
|
494
|
-
|
|
506
|
+
const cached = conversationStatusCache.get(thread.id);
|
|
507
|
+
if (cached && canUseCachedConversationStatusThread(cached, thread)) {
|
|
508
|
+
return mergeCodexThreadSnapshots(cached.thread, thread);
|
|
509
|
+
}
|
|
510
|
+
if (!needsConversationStatusHydration(thread, options) &&
|
|
511
|
+
!needsCompletionTransitionHydration(thread, cached, options)) {
|
|
495
512
|
return thread;
|
|
496
513
|
}
|
|
497
514
|
const readThread = await client.readThread(thread.id, true).catch(() => thread);
|
|
498
|
-
|
|
515
|
+
const mergedThread = mergeCodexThreadSnapshots(readThread, thread);
|
|
516
|
+
conversationStatusCache.set(thread.id, {
|
|
517
|
+
summaryStatusType: threadStatusType(thread.status),
|
|
518
|
+
summaryUpdatedAt: safeSeconds(thread.updatedAt, thread.createdAt),
|
|
519
|
+
thread: mergedThread
|
|
520
|
+
});
|
|
521
|
+
return mergedThread;
|
|
499
522
|
}));
|
|
500
523
|
}
|
|
501
524
|
async function readCachedThreadMessages(threadId, options) {
|
|
@@ -525,6 +548,10 @@ export function createLocalCodexBridge(options = {}) {
|
|
|
525
548
|
cached.statusType === threadStatusType(summary.status) &&
|
|
526
549
|
cached.updatedAt === safeSeconds(summary.updatedAt, summary.createdAt));
|
|
527
550
|
}
|
|
551
|
+
function canUseCachedConversationStatusThread(cached, summary) {
|
|
552
|
+
return (cached.summaryStatusType === threadStatusType(summary.status) &&
|
|
553
|
+
cached.summaryUpdatedAt === safeSeconds(summary.updatedAt, summary.createdAt));
|
|
554
|
+
}
|
|
528
555
|
async function isThreadLoaded(threadId) {
|
|
529
556
|
try {
|
|
530
557
|
return (await client.listLoadedThreads()).includes(threadId);
|
|
@@ -1400,10 +1427,44 @@ function isThreadListActivitySummaryStatus(status) {
|
|
|
1400
1427
|
const statusType = threadStatusType(status);
|
|
1401
1428
|
return statusType === "idle" || statusType === "notLoaded";
|
|
1402
1429
|
}
|
|
1403
|
-
function needsConversationStatusHydration(thread) {
|
|
1430
|
+
function needsConversationStatusHydration(thread, options) {
|
|
1404
1431
|
return (thread.turns.length === 0 &&
|
|
1405
|
-
(
|
|
1406
|
-
|
|
1432
|
+
(threadStatusType(thread.status) === "active" ||
|
|
1433
|
+
thread.abitatLoadedFromAppServer === true ||
|
|
1434
|
+
(options.hydrateIdleSummaries && isThreadListActivitySummaryStatus(thread.status))));
|
|
1435
|
+
}
|
|
1436
|
+
function needsCompletionTransitionHydration(thread, cached, options) {
|
|
1437
|
+
if (!options.hydrateCompletionTransitions ||
|
|
1438
|
+
thread.turns.length > 0 ||
|
|
1439
|
+
!isThreadListActivitySummaryStatus(thread.status)) {
|
|
1440
|
+
return false;
|
|
1441
|
+
}
|
|
1442
|
+
return (Boolean(cached && isCodexThreadBusy(cached.thread)) ||
|
|
1443
|
+
summaryUpdatedAfter(thread, options.hydrateIdleSummariesSince));
|
|
1444
|
+
}
|
|
1445
|
+
function summaryUpdatedAfter(thread, timestampMs) {
|
|
1446
|
+
if (typeof timestampMs !== "number" || !Number.isFinite(timestampMs)) {
|
|
1447
|
+
return false;
|
|
1448
|
+
}
|
|
1449
|
+
return safeSeconds(thread.updatedAt, thread.createdAt) * 1000 >= timestampMs;
|
|
1450
|
+
}
|
|
1451
|
+
function shouldClearMissingLocalStartedTurn(thread, tracked) {
|
|
1452
|
+
const latestTurn = thread.turns.at(-1) ?? null;
|
|
1453
|
+
if (latestTurn &&
|
|
1454
|
+
latestTurn.id !== tracked.turnId &&
|
|
1455
|
+
isTurnTerminal(latestTurn) &&
|
|
1456
|
+
turnEndedAfterLocalStart(thread, latestTurn, tracked)) {
|
|
1457
|
+
return true;
|
|
1458
|
+
}
|
|
1459
|
+
const statusType = threadStatusType(thread.status);
|
|
1460
|
+
return statusType !== "active" && threadUpdatedAfterLocalStart(thread, tracked);
|
|
1461
|
+
}
|
|
1462
|
+
function turnEndedAfterLocalStart(thread, turn, tracked) {
|
|
1463
|
+
return (safeSeconds(turn.completedAt, thread.updatedAt, thread.createdAt) * 1000 >=
|
|
1464
|
+
tracked.startedAtMs);
|
|
1465
|
+
}
|
|
1466
|
+
function threadUpdatedAfterLocalStart(thread, tracked) {
|
|
1467
|
+
return safeSeconds(thread.updatedAt, thread.createdAt) * 1000 >= tracked.startedAtMs;
|
|
1407
1468
|
}
|
|
1408
1469
|
function threadListActivitySeconds(thread) {
|
|
1409
1470
|
const currentActivity = thread.turns.length === 0 &&
|
|
@@ -1474,8 +1535,9 @@ export function flattenThreadMessages(thread, conversationId = externalCodexConv
|
|
|
1474
1535
|
itemTypeCounts.set(item.type, (itemTypeCounts.get(item.type) ?? 0) + 1);
|
|
1475
1536
|
const flattened = threadItemToMessageContent(item);
|
|
1476
1537
|
if (!flattened) {
|
|
1477
|
-
if (!HIDDEN_CODEX_ITEM_TYPES.has(item.type) &&
|
|
1478
|
-
|
|
1538
|
+
if (!HIDDEN_CODEX_ITEM_TYPES.has(item.type) &&
|
|
1539
|
+
!isKnownCodexItemType(item.type) &&
|
|
1540
|
+
!unknownItemTypes.has(item.type)) {
|
|
1479
1541
|
logDiagnostics(diagnostics, "warn", "codex.thread_item.unknown", {
|
|
1480
1542
|
codexItemId: item.id,
|
|
1481
1543
|
codexItemType: item.type,
|
|
@@ -1483,6 +1545,7 @@ export function flattenThreadMessages(thread, conversationId = externalCodexConv
|
|
|
1483
1545
|
threadId: thread.id,
|
|
1484
1546
|
turnId: turn.id
|
|
1485
1547
|
});
|
|
1548
|
+
unknownItemTypes.add(item.type);
|
|
1486
1549
|
}
|
|
1487
1550
|
continue;
|
|
1488
1551
|
}
|
|
@@ -1588,6 +1651,27 @@ function stringField(value, key) {
|
|
|
1588
1651
|
const field = value[key];
|
|
1589
1652
|
return typeof field === "string" && field.trim() ? field.trim() : null;
|
|
1590
1653
|
}
|
|
1654
|
+
function recordField(value, key) {
|
|
1655
|
+
if (!value || typeof value !== "object") {
|
|
1656
|
+
return null;
|
|
1657
|
+
}
|
|
1658
|
+
const field = value[key];
|
|
1659
|
+
return field && typeof field === "object" ? field : null;
|
|
1660
|
+
}
|
|
1661
|
+
function summarizedStringField(value, key) {
|
|
1662
|
+
if (!value || typeof value !== "object") {
|
|
1663
|
+
return null;
|
|
1664
|
+
}
|
|
1665
|
+
const field = stringField(value, key);
|
|
1666
|
+
return field ? summarizeInlineContent(field) : null;
|
|
1667
|
+
}
|
|
1668
|
+
function summarizeInlineContent(content) {
|
|
1669
|
+
const normalized = content.replace(/\s+/gu, " ").trim();
|
|
1670
|
+
if (normalized.length <= MAX_CODEX_ITEM_SUMMARY_LENGTH) {
|
|
1671
|
+
return normalized;
|
|
1672
|
+
}
|
|
1673
|
+
return `${normalized.slice(0, MAX_CODEX_ITEM_SUMMARY_LENGTH)}...`;
|
|
1674
|
+
}
|
|
1591
1675
|
function mimeTypeForPath(path) {
|
|
1592
1676
|
switch (extname(path).toLowerCase()) {
|
|
1593
1677
|
case ".html":
|
|
@@ -1702,6 +1786,36 @@ function threadItemToMessageContent(item) {
|
|
|
1702
1786
|
role: "runtime"
|
|
1703
1787
|
};
|
|
1704
1788
|
}
|
|
1789
|
+
if (item.type === "imageGeneration") {
|
|
1790
|
+
return {
|
|
1791
|
+
content: imageGenerationSummary(item),
|
|
1792
|
+
role: "assistant"
|
|
1793
|
+
};
|
|
1794
|
+
}
|
|
1795
|
+
if (item.type === "webSearch") {
|
|
1796
|
+
return {
|
|
1797
|
+
content: webSearchSummary(item),
|
|
1798
|
+
role: "runtime"
|
|
1799
|
+
};
|
|
1800
|
+
}
|
|
1801
|
+
if (item.type === "imageView") {
|
|
1802
|
+
return {
|
|
1803
|
+
content: "Viewed an image.",
|
|
1804
|
+
role: "runtime"
|
|
1805
|
+
};
|
|
1806
|
+
}
|
|
1807
|
+
if (item.type === "mcpToolCall" || item.type === "dynamicToolCall") {
|
|
1808
|
+
return {
|
|
1809
|
+
content: toolCallSummary(item),
|
|
1810
|
+
role: "runtime"
|
|
1811
|
+
};
|
|
1812
|
+
}
|
|
1813
|
+
if (item.type === "collabAgentToolCall") {
|
|
1814
|
+
return {
|
|
1815
|
+
content: collabAgentToolCallSummary(item),
|
|
1816
|
+
role: "runtime"
|
|
1817
|
+
};
|
|
1818
|
+
}
|
|
1705
1819
|
return null;
|
|
1706
1820
|
}
|
|
1707
1821
|
function isKnownCodexItemType(type) {
|
|
@@ -1710,8 +1824,53 @@ function isKnownCodexItemType(type) {
|
|
|
1710
1824
|
type === "plan" ||
|
|
1711
1825
|
type === "commandExecution" ||
|
|
1712
1826
|
type === "fileChange" ||
|
|
1827
|
+
type === "imageGeneration" ||
|
|
1828
|
+
type === "imageView" ||
|
|
1829
|
+
type === "webSearch" ||
|
|
1830
|
+
type === "mcpToolCall" ||
|
|
1831
|
+
type === "dynamicToolCall" ||
|
|
1832
|
+
type === "collabAgentToolCall" ||
|
|
1713
1833
|
HIDDEN_CODEX_ITEM_TYPES.has(type));
|
|
1714
1834
|
}
|
|
1835
|
+
function imageGenerationSummary(item) {
|
|
1836
|
+
const prompt = summarizedStringField(item, "prompt") ?? summarizedStringField(item, "userPrompt");
|
|
1837
|
+
const savedPath = summarizedStringField(item, "savedPath") ??
|
|
1838
|
+
summarizedStringField(item, "saved_path") ??
|
|
1839
|
+
summarizedStringField(item, "path");
|
|
1840
|
+
if (prompt && savedPath) {
|
|
1841
|
+
return `Generated an image: ${prompt}. Saved to ${savedPath}.`;
|
|
1842
|
+
}
|
|
1843
|
+
if (prompt) {
|
|
1844
|
+
return `Generated an image: ${prompt}.`;
|
|
1845
|
+
}
|
|
1846
|
+
if (savedPath) {
|
|
1847
|
+
return `Generated an image: ${savedPath}.`;
|
|
1848
|
+
}
|
|
1849
|
+
return "Generated an image.";
|
|
1850
|
+
}
|
|
1851
|
+
function webSearchSummary(item) {
|
|
1852
|
+
const action = recordField(item, "action");
|
|
1853
|
+
const query = summarizedStringField(item, "query") ??
|
|
1854
|
+
summarizedStringField(action, "query") ??
|
|
1855
|
+
summarizedStringField(item, "url") ??
|
|
1856
|
+
summarizedStringField(action, "url");
|
|
1857
|
+
return query ? `Searched the web: ${query}.` : "Searched the web.";
|
|
1858
|
+
}
|
|
1859
|
+
function toolCallSummary(item) {
|
|
1860
|
+
const toolName = summarizedStringField(item, "name") ??
|
|
1861
|
+
summarizedStringField(item, "toolName") ??
|
|
1862
|
+
summarizedStringField(item, "tool_name") ??
|
|
1863
|
+
summarizedStringField(item, "serverName") ??
|
|
1864
|
+
summarizedStringField(item, "server_name");
|
|
1865
|
+
return toolName ? `Used tool: ${toolName}.` : "Used a tool.";
|
|
1866
|
+
}
|
|
1867
|
+
function collabAgentToolCallSummary(item) {
|
|
1868
|
+
const name = summarizedStringField(item, "name") ??
|
|
1869
|
+
summarizedStringField(item, "toolName") ??
|
|
1870
|
+
summarizedStringField(item, "agentPath") ??
|
|
1871
|
+
summarizedStringField(item, "agent_path");
|
|
1872
|
+
return name ? `Used collaboration tool: ${name}.` : "Used a collaboration tool.";
|
|
1873
|
+
}
|
|
1715
1874
|
function filterThreadMessages(messages, options) {
|
|
1716
1875
|
const filtered = options.includeRuntime
|
|
1717
1876
|
? messages
|