@awak-app/simy-cli 0.7.43 → 0.7.44
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/package.json
CHANGED
package/src/cli-contract.js
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "./durable-local-task-steps-contract.js";
|
|
15
15
|
import { buildExecutionCapabilityContract } from "./execution-capability-contract.js";
|
|
16
16
|
|
|
17
|
-
export const CLI_VERSION = "0.7.
|
|
17
|
+
export const CLI_VERSION = "0.7.44";
|
|
18
18
|
export const CLI_API_CONTRACT_VERSION = 10;
|
|
19
19
|
|
|
20
20
|
export function narrativeImageCapabilityMetadata() {
|
package/src/desktop-host.js
CHANGED
|
@@ -2,7 +2,7 @@ import { createDesktopFrameWriter } from './desktop-frame-writer.js';
|
|
|
2
2
|
import { createDesktopCatalogEncoder, createDesktopStatusSnapshot, copyOwnedDesktopStatus } from './desktop-catalog-frames.js';
|
|
3
3
|
import { boundedDiscovery } from './session-supervision/progressive-discovery.js';
|
|
4
4
|
import { createCatalogRefreshPolicy } from './session-supervision/catalog-refresh.js';
|
|
5
|
-
import { supervisedSession } from './session-supervision/discovery-window.js';
|
|
5
|
+
import { liveSessionWindow, supervisedSession } from './session-supervision/discovery-window.js';
|
|
6
6
|
import { createClaudeDesktopArchiveController } from './session-supervision/claude-desktop-archive.js';
|
|
7
7
|
import { createClaudeDesktopNativeAdapter } from './session-supervision/claude-desktop-native.js';
|
|
8
8
|
import { applyControllerExecutionContext } from './session-supervision/execution-context.js';
|
|
@@ -723,6 +723,7 @@ export async function startDesktopHost({ input = process.stdin, output = process
|
|
|
723
723
|
const historyTimeoutMs = dependencies.historyDiscoveryTimeoutMs ?? dependencies.discoveryTimeoutMs ?? 300_000;
|
|
724
724
|
sessionRefresh = boundedDiscovery((signal, startHistory) => (dependencies.discoverSessions || discoverSessions)({
|
|
725
725
|
root: deliveryRoot, signal, onDrain: trackDiscoveryDrain, includeArchived: true, includeSelectionCandidates: true, recentOnly: refresh.recentOnly,
|
|
726
|
+
recentArchiveCandidates: liveSessionWindow(sessionStatus.sessions.filter(item => item.provider === 'codex' && item.archived !== true && item.delegated !== true)),
|
|
726
727
|
readRecords: () => recordReader.list(),
|
|
727
728
|
connectedProviders: PROVIDER_LINKS.filter(provider => providerLinks[provider].connected),
|
|
728
729
|
timeoutMs: firstPageTimeoutMs, historyTimeoutMs,
|
|
@@ -329,8 +329,13 @@ export async function listCodexSessions({ client, all = false, signal, onPage, m
|
|
|
329
329
|
// Absence from the recent active window does not mean archived. Only the
|
|
330
330
|
// provider's archived list or its exact archived rollout path proves it.
|
|
331
331
|
const archiveProbeOffsets = new Map();
|
|
332
|
+
// Navigation eligibility is distinct from positive archive fencing: excluded
|
|
333
|
+
// worker sources may still revoke consent without replacing delegated rows.
|
|
334
|
+
export function archivedCodexMetadata(metadata) {
|
|
335
|
+
return metadata && SOURCE_KINDS.includes(metadata.source) ? { ...metadata, archived: true } : null;
|
|
336
|
+
}
|
|
332
337
|
export async function readCodexArchiveStates(client, candidates, { budgetMs = 3000,
|
|
333
|
-
codexHome = process.env.CODEX_HOME || join(homedir(), '.codex') } = {}) {
|
|
338
|
+
codexHome = process.env.CODEX_HOME || join(homedir(), '.codex'), observedArchived } = {}) {
|
|
334
339
|
const states = new Map();
|
|
335
340
|
if (!candidates.length) return states;
|
|
336
341
|
const deadline = Date.now() + budgetMs;
|
|
@@ -343,7 +348,13 @@ export async function readCodexArchiveStates(client, candidates, { budgetMs = 30
|
|
|
343
348
|
if (method === 'thread/list' && params.archived === true && Array.isArray(response?.data)) {
|
|
344
349
|
for (const thread of response.data.slice(0, params.limit)) {
|
|
345
350
|
const metadata = codexThreadMetadata(thread);
|
|
346
|
-
if (metadata && eligible.has(metadata.session))
|
|
351
|
+
if (metadata && eligible.has(metadata.session)) {
|
|
352
|
+
states.set(metadata.session, true);
|
|
353
|
+
if (observedArchived) {
|
|
354
|
+
const archived = archivedCodexMetadata(metadata);
|
|
355
|
+
if (archived) observedArchived.set(metadata.session, archived);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
347
358
|
}
|
|
348
359
|
}
|
|
349
360
|
return response;
|
|
@@ -363,6 +374,12 @@ export async function readCodexArchiveStates(client, candidates, { budgetMs = 30
|
|
|
363
374
|
if (thread?.id !== candidate.session || typeof thread.path !== 'string' || !isAbsolute(thread.path)) continue;
|
|
364
375
|
const state = codexArchivePathState(thread.path, candidate.session, codexHome);
|
|
365
376
|
if (state !== undefined) states.set(candidate.session, state);
|
|
377
|
+
if (state === false) observedArchived?.delete(candidate.session);
|
|
378
|
+
if (state === true && observedArchived) {
|
|
379
|
+
const metadata = codexThreadMetadata(thread);
|
|
380
|
+
const archived = archivedCodexMetadata(metadata);
|
|
381
|
+
if (archived) observedArchived.set(metadata.session, archived);
|
|
382
|
+
}
|
|
366
383
|
} catch { /* Unknown or missing sessions remain visible. */ }
|
|
367
384
|
}
|
|
368
385
|
}));
|
|
@@ -10,7 +10,7 @@ import { realpath } from 'node:fs/promises';
|
|
|
10
10
|
import { randomUUID } from 'node:crypto';
|
|
11
11
|
import { isAbsolute } from 'node:path';
|
|
12
12
|
import { TERMINAL as TERMINAL_RUNS, advanceDeliveryControlRevision, deliveryDecisionRevision, associationBlocksFollowup, canUpgradeDelivery, canExplicitlyResumeStopped, enablePurposeDelivery, claudeHookChannel, controlDelivery, listRecords, readRecord, processIdentity, startDelivery, updateRecord, recordProviderArchive, ownerRenewalPending } from '../codex-plugins/simy/hooks/delivery-loop.mjs';
|
|
13
|
-
import { listCodexSessions, codexThreadMetadata, openCodexAppServer, readCodexSession, readCodexObservation, readCodexArchiveStates, CodexAppServerError } from './codex-app-server.js';
|
|
13
|
+
import { listCodexSessions, codexThreadMetadata, openCodexAppServer, readCodexSession, readCodexObservation, readCodexArchiveStates, archivedCodexMetadata, CodexAppServerError } from './codex-app-server.js';
|
|
14
14
|
import { listClaudeSessions, readClaudeSession } from './claude-sessions.js';
|
|
15
15
|
import { loadPurposeRuleSet } from './purpose-instruction.js';
|
|
16
16
|
import { originalSessionTarget } from './original-session-target.js';
|
|
@@ -165,7 +165,7 @@ export async function discoverSessions(options = {}) {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
async function discoverSessionCatalog({ root, openClient = openCodexAppServer, listClaude = listClaudeSessions,
|
|
168
|
-
inspectProcess = processIdentity, now: requestedNow, signal, listCodexTitles = readCodexTitles, listCodexChildren = readCodexChildSessions, codexHome, connectedProviders = ['codex', 'claude'], includeArchived = false, includeSelectionCandidates = false, recentOnly = false, catalogSnapshot, recordSnapshot, archiveReconciliations = new Map(), readRecords = listRecords, onProgress } = {}) {
|
|
168
|
+
inspectProcess = processIdentity, now: requestedNow, signal, listCodexTitles = readCodexTitles, listCodexChildren = readCodexChildSessions, codexHome, connectedProviders = ['codex', 'claude'], includeArchived = false, includeSelectionCandidates = false, recentOnly = false, recentArchiveCandidates = [], catalogSnapshot, recordSnapshot, archiveReconciliations = new Map(), readRecords = listRecords, onProgress } = {}) {
|
|
169
169
|
const now = requestedNow ?? Date.now();
|
|
170
170
|
const assertActive = () => { if (signal?.aborted) throw new CodexAppServerError('cancelled', 'Conversation discovery was cancelled.'); };
|
|
171
171
|
assertActive();
|
|
@@ -195,19 +195,22 @@ async function discoverSessionCatalog({ root, openClient = openCodexAppServer, l
|
|
|
195
195
|
const active = await listCodexSessions({ client, all: !recentOnly, signal, inspectState: true, codexHome,
|
|
196
196
|
onPage: async items => { discovered = [...items]; await progress({ discovered, archivedCodex }); },
|
|
197
197
|
prioritySessions: priorities.filter(record => record.provider === 'codex').map(record => record.session) });
|
|
198
|
-
|
|
199
|
-
|
|
198
|
+
const observedArchives = new Map();
|
|
199
|
+
// Archived navigation belongs to the full/history refresh. A recent
|
|
200
|
+
// poll still observes missing supervised sessions below, so archival
|
|
201
|
+
// revokes their consent immediately without rewriting cold fences.
|
|
202
|
+
if (includeArchived && !recentOnly) {
|
|
200
203
|
const archiveClient = { request: async (method, params) => {
|
|
201
204
|
const response = await client.request(method, params);
|
|
202
205
|
if (method === 'thread/list' && params.archived === true) {
|
|
203
206
|
for (const thread of (response?.data || []).slice(0, params.limit)) {
|
|
204
|
-
const item = codexThreadMetadata(thread);
|
|
205
|
-
if (item
|
|
207
|
+
const item = archivedCodexMetadata(codexThreadMetadata(thread));
|
|
208
|
+
if (item) observedArchives.set(item.session, item);
|
|
206
209
|
}
|
|
207
210
|
}
|
|
208
211
|
return response;
|
|
209
212
|
} };
|
|
210
|
-
try { await listCodexSessions({ client: archiveClient, all:
|
|
213
|
+
try { await listCodexSessions({ client: archiveClient, all: true, signal, archived: true,
|
|
211
214
|
onPage: async () => { archivedCodex = [...observedArchives.values()]; await progress({ discovered, archivedCodex }); } }); }
|
|
212
215
|
catch (error) {
|
|
213
216
|
codexError = 'Codex archive discovery incomplete. Refresh to retry.';
|
|
@@ -216,7 +219,21 @@ async function discoverSessionCatalog({ root, openClient = openCodexAppServer, l
|
|
|
216
219
|
archivedCodex = [...observedArchives.values()];
|
|
217
220
|
}
|
|
218
221
|
const ids = new Set(active.map(item => item.session));
|
|
219
|
-
|
|
222
|
+
const archiveCandidates = new Map(records.filter(record => record.provider === 'codex' && !ids.has(record.session) && (!recentOnly || supervisedSession(record)))
|
|
223
|
+
.map(record => [record.session, record]));
|
|
224
|
+
// A recent, untracked conversation can be archived in Codex itself.
|
|
225
|
+
// Observe omissions from the previous bounded live window too; pins
|
|
226
|
+
// and historical navigation never expand this into an unbounded set.
|
|
227
|
+
if (recentOnly) for (const item of recentArchiveCandidates.slice(0, RECENT_SESSION_LIMIT)) {
|
|
228
|
+
if (item.provider === 'codex' && item.archived !== true && item.delegated !== true && !ids.has(item.session) && !archiveCandidates.has(item.session)) archiveCandidates.set(item.session, item);
|
|
229
|
+
}
|
|
230
|
+
const exactArchiveObservations = new Map();
|
|
231
|
+
archiveStates = await readCodexArchiveStates(client, [...archiveCandidates.values()],
|
|
232
|
+
{ codexHome, ...(includeArchived ? { observedArchived: exactArchiveObservations } : {}) });
|
|
233
|
+
// Preserve current titles/ancestry from the already-required archive
|
|
234
|
+
// observations, including exact-read recovery during listing outages.
|
|
235
|
+
for (const [session, item] of exactArchiveObservations) if (!observedArchives.has(session)) observedArchives.set(session, item);
|
|
236
|
+
archivedCodex = [...observedArchives.values()];
|
|
220
237
|
for (const item of archivedCodex) archiveStates.set(item.session, true);
|
|
221
238
|
return active;
|
|
222
239
|
}, signal); }
|