@xmoon76/dsh-pi-tui 0.5.7 → 0.5.9
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/README.en.md +64 -26
- package/README.md +64 -26
- package/cordis.patch.yml +13 -0
- package/dist/acp-stdio.mjs +151 -0
- package/dist/{bootstrap-C9nl6e13.mjs → bootstrap-CVyHGQDX.mjs} +22330 -6888
- package/dist/browser-CDUSHIIr.mjs +76 -0
- package/dist/builtins.mjs +2 -2
- package/dist/{client-bootstrap-CGezi85O.mjs → client-bootstrap-4UoeVIHE.mjs} +2407 -1830
- package/dist/client-runtime-BHBlVUf5.mjs +1376 -0
- package/dist/{daemon-launcher-H_1r5Cqs.mjs → daemon-launcher-DxIgjBHW.mjs} +1551 -57
- package/dist/daemon-launcher.d.mts +85 -14
- package/dist/daemon-launcher.mjs +2 -2
- package/dist/diagnostics-Db5iVcuJ.mjs +123 -0
- package/dist/{entry-control-jBfKn1qO.mjs → entry-control-BDLZgg4m.mjs} +1 -1
- package/dist/{extensions-6a5vvJUT.mjs → extensions-Dx7ncPNA.mjs} +1 -4
- package/dist/extensions.mjs +1 -1
- package/dist/handoff-BjoEy3f8.mjs +106 -0
- package/dist/history-search-limits-Cx2UvRC2.mjs +16 -0
- package/dist/history-search-remote-BHuoellG.mjs +113 -0
- package/dist/history-search-remote-BzXdvrxk.mjs +26 -0
- package/dist/history-search-seat-BcHJTpeB.mjs +639 -0
- package/dist/history-search-seat-rZcq0XV6.mjs +639 -0
- package/dist/{host-bootstrap-MVxks641.mjs → host-bootstrap-BfnufpnW.mjs} +37 -72
- package/dist/{host-foundation-probe-DK7n5jDu.mjs → host-foundation-probe-DlD8-N_Q.mjs} +2 -2
- package/dist/host-runtime.mjs +5611 -290
- package/dist/index.d.mts +13 -6
- package/dist/index.mjs +22766 -6893
- package/dist/installed-dsh-BjUiJSwR.mjs +142 -0
- package/dist/interaction-port-D1Yv9zgu.mjs +45 -0
- package/dist/local-acp-control-CC5z4Xbq.mjs +304 -0
- package/dist/local-acp-endpoint-D1jYdJdv.mjs +41 -0
- package/dist/local-acp-listener-Cmgb5M0H.mjs +9493 -0
- package/dist/local-acp-status-B_25Q6kU.mjs +101 -0
- package/dist/local-client.mjs +719 -93
- package/dist/local-daemon-control-BFJAC8Kg.mjs +2199 -0
- package/dist/local-daemon-control-Bm3imctD.mjs +2101 -0
- package/dist/{local-discovery-BPZw1wEd.mjs → local-discovery-BMhaGIiJ.mjs} +254 -544
- package/dist/{local-discovery-BMoNXZjJ.mjs → local-discovery-Ba7_-NNC.mjs} +1 -1
- package/dist/{local-discovery-Bq3jLAn1.mjs → local-discovery-QSbFpjK2.mjs} +301 -544
- package/dist/local-host.mjs +970 -501
- package/dist/local-profile-daemon-admin-otpm69R6.mjs +469 -0
- package/dist/{local-scope-DEuGAy8l.mjs → local-scope-5DEKA_lW.mjs} +1075 -31
- package/dist/{local-transport-X4ZCe2uE.mjs → local-transport-DeWmdZ5E.mjs} +14 -3
- package/dist/{local-web-control-DKWtXIkr.mjs → local-web-control-Dny93N-r.mjs} +10 -7
- package/dist/{local-workspace-object-D06GL0UO.mjs → local-workspace-object-D0RVQt8U.mjs} +33 -9
- package/dist/model-selection-CYlqg2DV.mjs +83 -0
- package/dist/native-client-domains-Dg4srzYt.mjs +2 -0
- package/dist/native-client.d.mts +735 -0
- package/dist/native-client.mjs +3534 -0
- package/dist/{open-CmOBxSjN.mjs → open-QQva8-ar.mjs} +24 -20
- package/dist/{pi-tui-remote-contribution-Do8ECrUy.mjs → pi-tui-remote-contribution-565wiLWp.mjs} +741 -150
- package/dist/preferences.mjs +1 -1
- package/dist/{profile-preferences-migration-CThz4rHH.mjs → profile-preferences-migration-CNOWIdnr.mjs} +1 -1
- package/dist/{profile-preferences-migration-BfUGdPZx.mjs → profile-preferences-migration-IrnXcJWK.mjs} +10 -8
- package/dist/{prompt-sections-DXmjB58H.mjs → prompt-sections-Bi-9_Gr_.mjs} +28 -10
- package/dist/{prompt-sections-DUKmWb8g.mjs → prompt-sections-DFS1dqsY.mjs} +342 -56
- package/dist/{dist-BFgC-5tL.mjs → recall-scope-9Nuoto_i.mjs} +353 -1
- package/dist/rolldown-runtime-8H4AJuhK.mjs +14 -0
- package/dist/schema-CCLvDa7Q.mjs +177 -0
- package/dist/{schema-qE_P09zJ.mjs → schema-t97l3aK8.mjs} +56 -3
- package/dist/{session-DC0XQr5O.mjs → session-Cs8iLCEx.mjs} +784 -342
- package/dist/{session-Cihe8PPS.mjs → session-EBRZF6Ow.mjs} +783 -341
- package/dist/session-create-facts-CkfG5DpQ.mjs +20 -0
- package/dist/{startup-CarQxWwi.d.mts → startup-Dti3Udne.d.mts} +30 -3
- package/dist/{startup-CARqn3kV.mjs → startup-UtFQSDe_.mjs} +90 -15
- package/dist/startup.d.mts +2 -2
- package/dist/startup.mjs +1 -1
- package/dist/task-read-remote-DRtkXDrZ.mjs +1083 -0
- package/dist/{terminal-progress-source-D4DHyXDo.mjs → terminal-progress-source-VsczdXA-.mjs} +610 -335
- package/dist/{transcript-view-a7cROAaI.mjs → transcript-view-B6vCnukn.mjs} +2284 -1166
- package/dist/{transcript-view-hvNVkPtv.mjs → transcript-view-DSSdE2vK.mjs} +2191 -765
- package/dist/write-failure-xNKczXH7.mjs +189 -0
- package/package.json +25 -8
- package/dist/local-acp-listener-CNkguN5-.mjs +0 -2566
- package/dist/local-daemon-control-Bg9s2aYi.mjs +0 -1424
- package/dist/local-daemon-control-Cu_4FIdd.mjs +0 -1585
- package/dist/local-profile-daemon-admin-AXgVH-6y.mjs +0 -91
- package/dist/preset-BcWqOtY7.mjs +0 -46
|
@@ -16164,5 +16164,357 @@ var TuiMainScreen = class extends TuiBase {
|
|
|
16164
16164
|
else this.terminal.hideCursor();
|
|
16165
16165
|
}
|
|
16166
16166
|
};
|
|
16167
|
+
/** Create ONE recall kernel (TSP I-A). */
|
|
16168
|
+
function createHistoryRecallScope() {
|
|
16169
|
+
/** The recall projection, newest first — what ↑/↓ can recall and what
|
|
16170
|
+
* {@link HistoryRecallScope.snapshot} reports. */
|
|
16171
|
+
const snapshot = [];
|
|
16172
|
+
/**
|
|
16173
|
+
* The SCOPE-BOUND TEMPORARY SUBMISSIONS of the OPEN scope, in submission
|
|
16174
|
+
* order (newest first): one entry per input accepted by
|
|
16175
|
+
* {@link HistoryRecallScope.rememberAccepted} for the scope's owner, each
|
|
16176
|
+
* carrying its own OCCURRENCE token. A Session's hydration reseeds recall
|
|
16177
|
+
* from the session-scoped JSONL rows, while a submission's own append is
|
|
16178
|
+
* ordered behind the session transition (the submit FIFO turn and
|
|
16179
|
+
* `ensureSession()`), so a submission accepted inside the
|
|
16180
|
+
* publication→hydration window is absent from the snapshot and would be
|
|
16181
|
+
* wiped by the reseed.
|
|
16182
|
+
*
|
|
16183
|
+
* The list is the scope's TRUE submission sequence and is never re-ordered
|
|
16184
|
+
* or shrunk; the write owner settles OCCURRENCES into
|
|
16185
|
+
* {@link scopeSettlements}, never into this list. The whole list is dropped
|
|
16186
|
+
* only when the scope is replaced (or consumed by its owner's reseed / the
|
|
16187
|
+
* pool's adoption).
|
|
16188
|
+
*/
|
|
16189
|
+
const scopeInputs = [];
|
|
16190
|
+
/**
|
|
16191
|
+
* The ordered settlements of the OPEN scope (oldest first): one report per
|
|
16192
|
+
* settled submission, produced by the session-history owner from the SAME
|
|
16193
|
+
* synchronous stack as its append (or from its policy skip). The order is
|
|
16194
|
+
* the APPEND order, which is the file's row order — the authoritative order
|
|
16195
|
+
* of the rows the reseed snapshot carries. This queue is bounded, so it is
|
|
16196
|
+
* NOT the authority for "was this occurrence settled"; that fact lives in
|
|
16197
|
+
* {@link scopeSettled}.
|
|
16198
|
+
*/
|
|
16199
|
+
const scopeSettlements = [];
|
|
16200
|
+
/**
|
|
16201
|
+
* The DURABLE per-occurrence settlement fact of the OPEN scope, keyed by the
|
|
16202
|
+
* occurrence token: which outcome settled it and the session id its row
|
|
16203
|
+
* carried. Bounded by the scope's own occurrences (never by the queue), so a
|
|
16204
|
+
* settlement the queue evicted can neither resurrect the occurrence nor lose
|
|
16205
|
+
* it.
|
|
16206
|
+
*/
|
|
16207
|
+
const scopeSettled = /* @__PURE__ */ new Map();
|
|
16208
|
+
/** The LIVE occurrence tokens of the open scope: the durable facts above are
|
|
16209
|
+
* kept for exactly these (bounded by the scope cap, never by the queue). */
|
|
16210
|
+
const scopeOccurrences = /* @__PURE__ */ new Set();
|
|
16211
|
+
/** The number of APPENDS this scope's settlements reported per row owner —
|
|
16212
|
+
* the exact watermark of how many of the snapshot's newest rows the window
|
|
16213
|
+
* owns, even for settlements the bounded queue evicted. */
|
|
16214
|
+
const scopeAppends = /* @__PURE__ */ new Map();
|
|
16215
|
+
/**
|
|
16216
|
+
* The recent successful WRITTEN settlements of the OPEN scope, per row
|
|
16217
|
+
* owner, in the writer's true synchronous append order (oldest first). This
|
|
16218
|
+
* is the only authority for the cold-seed prefix: `ts` can never reproduce
|
|
16219
|
+
* this order. Bounded to {@link INPUT_RECALL_LIMIT} per owner; skips and
|
|
16220
|
+
* tokenless writers are included because they are real appends.
|
|
16221
|
+
*/
|
|
16222
|
+
const scopeWritten = /* @__PURE__ */ new Map();
|
|
16223
|
+
/**
|
|
16224
|
+
* The number of positions the last recall reconcile visited — a
|
|
16225
|
+
* HEADLESS-TEST HOOK pinning the frozen plan's O(100) bound (never read by
|
|
16226
|
+
* production code).
|
|
16227
|
+
*/
|
|
16228
|
+
let reconcileSteps = 0;
|
|
16229
|
+
/** The next occurrence token (monotonic per process/mount; only equality
|
|
16230
|
+
* matters). */
|
|
16231
|
+
let scopeTokenSeq = 0;
|
|
16232
|
+
/**
|
|
16233
|
+
* The owner the OPEN scope's entries were accepted for (`undefined` = the
|
|
16234
|
+
* sessionless pool). The pool is a real scope: a deferred start and the
|
|
16235
|
+
* Remote startup resume both accept input before any hydration reseeds the
|
|
16236
|
+
* recall, and the first published owner ADOPTS the pool's entries (that
|
|
16237
|
+
* submission is persisted under the new Session, so the snapshot cannot
|
|
16238
|
+
* carry it yet).
|
|
16239
|
+
*/
|
|
16240
|
+
let scopeOwner = void 0;
|
|
16241
|
+
/** Whether a recall scope is open. Open at construction (the sessionless
|
|
16242
|
+
* pool); closed by the owning owner's hydration reseed commit. */
|
|
16243
|
+
let scopeOpen = true;
|
|
16244
|
+
/** Drop every durable trace of one occurrence the scope no longer holds. */
|
|
16245
|
+
const forgetScopeInput = (entry) => {
|
|
16246
|
+
scopeOccurrences.delete(entry.token);
|
|
16247
|
+
scopeSettled.delete(entry.token);
|
|
16248
|
+
};
|
|
16249
|
+
/** The number of runs of consecutive identical text in the scope. */
|
|
16250
|
+
const countScopeRuns = () => {
|
|
16251
|
+
let runs = 0;
|
|
16252
|
+
let previous;
|
|
16253
|
+
for (const entry of scopeInputs) if (entry.text !== previous) {
|
|
16254
|
+
runs += 1;
|
|
16255
|
+
previous = entry.text;
|
|
16256
|
+
}
|
|
16257
|
+
return runs;
|
|
16258
|
+
};
|
|
16259
|
+
/**
|
|
16260
|
+
* APPEND entries (newest first) into the recall snapshot with the SAME
|
|
16261
|
+
* semantics the PiTui editor + mirror always used: only CONSECUTIVE
|
|
16262
|
+
* duplicates collapse, the cap keeps the newest 100. Non-consecutive
|
|
16263
|
+
* repeats like `['a', 'b', 'a']` are legal history and survive.
|
|
16264
|
+
*/
|
|
16265
|
+
const appendSnapshot = (entries) => {
|
|
16266
|
+
let last;
|
|
16267
|
+
for (const entry of entries) {
|
|
16268
|
+
const trimmed = entry.trim();
|
|
16269
|
+
if (trimmed === "" || trimmed === last) continue;
|
|
16270
|
+
last = trimmed;
|
|
16271
|
+
snapshot.push(trimmed);
|
|
16272
|
+
}
|
|
16273
|
+
if (snapshot.length > 100) snapshot.length = 100;
|
|
16274
|
+
};
|
|
16275
|
+
const snapshotOf = () => [...snapshot];
|
|
16276
|
+
const rememberAccepted = (text) => {
|
|
16277
|
+
const trimmed = text.trim();
|
|
16278
|
+
if (trimmed === "") return void 0;
|
|
16279
|
+
if (snapshot[0] !== trimmed) {
|
|
16280
|
+
snapshot.unshift(trimmed);
|
|
16281
|
+
if (snapshot.length > 100) snapshot.pop();
|
|
16282
|
+
}
|
|
16283
|
+
if (!scopeOpen) return void 0;
|
|
16284
|
+
scopeTokenSeq += 1;
|
|
16285
|
+
const token = scopeTokenSeq;
|
|
16286
|
+
const entry = {
|
|
16287
|
+
owner: scopeOwner,
|
|
16288
|
+
token,
|
|
16289
|
+
text: trimmed
|
|
16290
|
+
};
|
|
16291
|
+
const head = scopeInputs[0];
|
|
16292
|
+
if (head !== void 0 && head.text === trimmed) {
|
|
16293
|
+
let runStart = scopeInputs.length;
|
|
16294
|
+
for (let index = 0; index < scopeInputs.length; index += 1) if (scopeInputs[index].text !== trimmed) {
|
|
16295
|
+
runStart = index;
|
|
16296
|
+
break;
|
|
16297
|
+
}
|
|
16298
|
+
const first = scopeInputs[runStart - 1];
|
|
16299
|
+
const older = scopeInputs.slice(runStart);
|
|
16300
|
+
for (let index = 0; index < runStart - 1; index += 1) forgetScopeInput(scopeInputs[index]);
|
|
16301
|
+
scopeInputs.length = 0;
|
|
16302
|
+
scopeInputs.push(entry, first, ...older);
|
|
16303
|
+
scopeOccurrences.add(token);
|
|
16304
|
+
return token;
|
|
16305
|
+
}
|
|
16306
|
+
scopeInputs.unshift(entry);
|
|
16307
|
+
scopeOccurrences.add(token);
|
|
16308
|
+
if (countScopeRuns() > 100) {
|
|
16309
|
+
const oldest = scopeInputs[scopeInputs.length - 1];
|
|
16310
|
+
let runStart = scopeInputs.length - 1;
|
|
16311
|
+
while (runStart > 0 && scopeInputs[runStart - 1].text === oldest.text) runStart -= 1;
|
|
16312
|
+
for (let index = scopeInputs.length - 1; index >= runStart; index -= 1) forgetScopeInput(scopeInputs[index]);
|
|
16313
|
+
scopeInputs.length = runStart;
|
|
16314
|
+
}
|
|
16315
|
+
return token;
|
|
16316
|
+
};
|
|
16317
|
+
const seed = (entries) => {
|
|
16318
|
+
appendSnapshot(entries);
|
|
16319
|
+
};
|
|
16320
|
+
/**
|
|
16321
|
+
* Record ONE settlement of the OPEN scope, in append order. The input-history
|
|
16322
|
+
* owner calls this from the SAME synchronous stack as its append (the detached
|
|
16323
|
+
* task's factory is invoked synchronously) and ALSO when its write policy
|
|
16324
|
+
* skips a submission, and it carries the submission's occurrence token
|
|
16325
|
+
* whenever the settled submission was a scope Enter. That token — not the
|
|
16326
|
+
* text — is what attributes the settlement to exactly one occurrence, so
|
|
16327
|
+
* repeated identical submissions stay distinguishable, and the ordering of
|
|
16328
|
+
* the settled submissions is what places them against every other
|
|
16329
|
+
* session-history writer (a steer, a shell line, a sessionless command).
|
|
16330
|
+
*/
|
|
16331
|
+
const settle = (settlement) => {
|
|
16332
|
+
if (!scopeOpen) return;
|
|
16333
|
+
const appendsBefore = scopeAppends.get(settlement.owner) ?? 0;
|
|
16334
|
+
if (settlement.outcome === "written") {
|
|
16335
|
+
scopeAppends.set(settlement.owner, appendsBefore + 1);
|
|
16336
|
+
const written = scopeWritten.get(settlement.owner) ?? [];
|
|
16337
|
+
written.push({
|
|
16338
|
+
writeId: settlement.writeId,
|
|
16339
|
+
text: settlement.text
|
|
16340
|
+
});
|
|
16341
|
+
if (written.length > 100) written.shift();
|
|
16342
|
+
scopeWritten.set(settlement.owner, written);
|
|
16343
|
+
}
|
|
16344
|
+
if (settlement.token !== void 0 && scopeOccurrences.has(settlement.token)) scopeSettled.set(settlement.token, {
|
|
16345
|
+
owner: settlement.owner,
|
|
16346
|
+
outcome: settlement.outcome,
|
|
16347
|
+
appendsBefore
|
|
16348
|
+
});
|
|
16349
|
+
scopeSettlements.push(settlement);
|
|
16350
|
+
if (scopeSettlements.length > 100) scopeSettlements.shift();
|
|
16351
|
+
};
|
|
16352
|
+
/**
|
|
16353
|
+
* REPLACE the whole recall projection with the entries of the CURRENT
|
|
16354
|
+
* workspace. Session switches must not recall the previous workspace's
|
|
16355
|
+
* inputs nor pollute the new workspace's persisted history, so the host
|
|
16356
|
+
* resets on every session change. The OPEN scope's occurrences ride along:
|
|
16357
|
+
* every successful write keeps its own row once, a policy-skipped occurrence
|
|
16358
|
+
* is inserted where its settlement placed it, and a still-unsettled
|
|
16359
|
+
* occurrence keeps its rank in the scope's submission order. The commit
|
|
16360
|
+
* closes the scope, so ordinary submissions use the plain
|
|
16361
|
+
* {@link rememberAccepted} path again.
|
|
16362
|
+
* @param entries - the new workspace's persisted entries, newest first.
|
|
16363
|
+
* @param owner - the owner whose hydration committed this reseed. The
|
|
16364
|
+
* sessionless boot seed passes no owner: it only seeds the recall pool and
|
|
16365
|
+
* leaves the scope open (boot is not a published Session).
|
|
16366
|
+
*/
|
|
16367
|
+
const reset = (entries, owner, writeIds) => {
|
|
16368
|
+
if (writeIds !== void 0 && writeIds.length !== entries.length) throw new Error("history recall reset: writeIds must stay positionally aligned with entries");
|
|
16369
|
+
let seedEntries = entries;
|
|
16370
|
+
if (owner !== void 0 && writeIds !== void 0) {
|
|
16371
|
+
const written = scopeWritten.get(owner) ?? [];
|
|
16372
|
+
const writtenText = /* @__PURE__ */ new Map();
|
|
16373
|
+
for (const item of written) {
|
|
16374
|
+
if (item.writeId === void 0) throw new Error("history recall reset: a written settlement of the open scope carries no writeId");
|
|
16375
|
+
writtenText.set(item.writeId, item.text);
|
|
16376
|
+
}
|
|
16377
|
+
const baseline = [];
|
|
16378
|
+
for (let index = 0; index < entries.length; index += 1) {
|
|
16379
|
+
const writeId = writeIds[index];
|
|
16380
|
+
if (writeId !== void 0 && writtenText.get(writeId) === entries[index]) continue;
|
|
16381
|
+
baseline.push(entries[index]);
|
|
16382
|
+
}
|
|
16383
|
+
const normalized = [...written].reverse().map((item) => item.text);
|
|
16384
|
+
normalized.push(...baseline);
|
|
16385
|
+
seedEntries = normalized.slice(0, 100);
|
|
16386
|
+
}
|
|
16387
|
+
snapshot.length = 0;
|
|
16388
|
+
if (owner === void 0) {
|
|
16389
|
+
appendSnapshot(seedEntries);
|
|
16390
|
+
return;
|
|
16391
|
+
}
|
|
16392
|
+
const settlements = scopeSettlements.filter((settlement) => settlement.owner === owner);
|
|
16393
|
+
const retainedTokens = /* @__PURE__ */ new Set();
|
|
16394
|
+
let retainedWrites = 0;
|
|
16395
|
+
for (const settlement of settlements) {
|
|
16396
|
+
if (settlement.outcome === "written") retainedWrites += 1;
|
|
16397
|
+
if (settlement.token !== void 0) retainedTokens.add(settlement.token);
|
|
16398
|
+
}
|
|
16399
|
+
const covered = Math.min(scopeAppends.get(owner) ?? 0, seedEntries.length);
|
|
16400
|
+
const ranks = /* @__PURE__ */ new Map();
|
|
16401
|
+
for (let index = 0; index < scopeInputs.length; index += 1) ranks.set(scopeInputs[index].token, index);
|
|
16402
|
+
const windowTexts = [];
|
|
16403
|
+
const windowRanks = [];
|
|
16404
|
+
const windowRows = [];
|
|
16405
|
+
let writeSeen = 0;
|
|
16406
|
+
for (let index = settlements.length - 1; index >= 0; index -= 1) {
|
|
16407
|
+
const settlement = settlements[index];
|
|
16408
|
+
const rank = settlement.token === void 0 ? void 0 : ranks.get(settlement.token);
|
|
16409
|
+
if (settlement.outcome === "written") {
|
|
16410
|
+
writeSeen += 1;
|
|
16411
|
+
if (writeSeen > covered) continue;
|
|
16412
|
+
windowTexts.push(seedEntries[writeSeen - 1]);
|
|
16413
|
+
} else {
|
|
16414
|
+
if (rank === void 0) continue;
|
|
16415
|
+
windowTexts.push(scopeInputs[rank].text);
|
|
16416
|
+
}
|
|
16417
|
+
windowRanks.push(rank);
|
|
16418
|
+
windowRows.push(settlement.outcome === "written");
|
|
16419
|
+
}
|
|
16420
|
+
for (let row = retainedWrites; row < covered; row += 1) {
|
|
16421
|
+
windowTexts.push(seedEntries[row]);
|
|
16422
|
+
windowRanks.push(void 0);
|
|
16423
|
+
windowRows.push(true);
|
|
16424
|
+
}
|
|
16425
|
+
const before = [];
|
|
16426
|
+
const after = [];
|
|
16427
|
+
for (let index = 0; index < scopeInputs.length; index += 1) {
|
|
16428
|
+
const token = scopeInputs[index].token;
|
|
16429
|
+
if (retainedTokens.has(token)) continue;
|
|
16430
|
+
const settled = scopeSettled.get(token);
|
|
16431
|
+
if (settled === void 0) before.push(index);
|
|
16432
|
+
else if (settled.outcome === "skipped" && settled.owner === owner) after.push({
|
|
16433
|
+
rank: index,
|
|
16434
|
+
newerRows: covered - settled.appendsBefore
|
|
16435
|
+
});
|
|
16436
|
+
}
|
|
16437
|
+
after.sort((left, right) => left.newerRows - right.newerRows || left.rank - right.rank);
|
|
16438
|
+
reconcileSteps = 0;
|
|
16439
|
+
const merged = [];
|
|
16440
|
+
let next = 0;
|
|
16441
|
+
let rowsSeen = 0;
|
|
16442
|
+
let skipped = 0;
|
|
16443
|
+
const emitEvictedSkips = (upTo) => {
|
|
16444
|
+
while (skipped < after.length && after[skipped].newerRows <= upTo) {
|
|
16445
|
+
merged.push(scopeInputs[after[skipped].rank].text);
|
|
16446
|
+
skipped += 1;
|
|
16447
|
+
}
|
|
16448
|
+
};
|
|
16449
|
+
for (let index = 0; index < windowTexts.length; index += 1) {
|
|
16450
|
+
reconcileSteps += 1;
|
|
16451
|
+
const windowRank = windowRanks[index];
|
|
16452
|
+
while (next < before.length && (windowRank === void 0 || before[next] < windowRank)) {
|
|
16453
|
+
reconcileSteps += 1;
|
|
16454
|
+
merged.push(scopeInputs[before[next]].text);
|
|
16455
|
+
next += 1;
|
|
16456
|
+
}
|
|
16457
|
+
emitEvictedSkips(rowsSeen);
|
|
16458
|
+
merged.push(windowTexts[index]);
|
|
16459
|
+
if (windowRows[index] === true) {
|
|
16460
|
+
rowsSeen += 1;
|
|
16461
|
+
emitEvictedSkips(rowsSeen);
|
|
16462
|
+
}
|
|
16463
|
+
}
|
|
16464
|
+
while (next < before.length) {
|
|
16465
|
+
reconcileSteps += 1;
|
|
16466
|
+
merged.push(scopeInputs[before[next]].text);
|
|
16467
|
+
next += 1;
|
|
16468
|
+
}
|
|
16469
|
+
emitEvictedSkips(covered);
|
|
16470
|
+
appendSnapshot([...merged, ...seedEntries.slice(covered)]);
|
|
16471
|
+
scopeInputs.length = 0;
|
|
16472
|
+
scopeSettlements.length = 0;
|
|
16473
|
+
scopeSettled.clear();
|
|
16474
|
+
scopeOccurrences.clear();
|
|
16475
|
+
scopeAppends.clear();
|
|
16476
|
+
scopeWritten.clear();
|
|
16477
|
+
scopeOpen = false;
|
|
16478
|
+
scopeOwner = owner;
|
|
16479
|
+
};
|
|
16480
|
+
/**
|
|
16481
|
+
* Open the RECALL SCOPE of the owner a commit section is publishing (ordinary
|
|
16482
|
+
* transition, fork adoption) or creating (the first Session). The owner's
|
|
16483
|
+
* hydration reseeds recall from its disk rows afterwards, so inputs accepted
|
|
16484
|
+
* in that gap belong to the new owner and must survive the reseed.
|
|
16485
|
+
* A REPLACED owner's pending submissions are dropped with the scope — that is
|
|
16486
|
+
* what keeps Session A's input out of Session B's recall — while the
|
|
16487
|
+
* SESSIONLESS pool's entries are ADOPTED by the first published owner (that
|
|
16488
|
+
* submission is persisted under the new Session; there is no outgoing owner
|
|
16489
|
+
* to fence).
|
|
16490
|
+
*/
|
|
16491
|
+
const begin = (owner) => {
|
|
16492
|
+
if (scopeOwner !== void 0) {
|
|
16493
|
+
scopeInputs.length = 0;
|
|
16494
|
+
scopeSettlements.length = 0;
|
|
16495
|
+
scopeSettled.clear();
|
|
16496
|
+
scopeOccurrences.clear();
|
|
16497
|
+
scopeAppends.clear();
|
|
16498
|
+
scopeWritten.clear();
|
|
16499
|
+
}
|
|
16500
|
+
snapshot.length = 0;
|
|
16501
|
+
appendSnapshot(scopeInputs.filter((entry) => {
|
|
16502
|
+
const settled = scopeSettled.get(entry.token);
|
|
16503
|
+
return settled === void 0 || settled.owner === owner;
|
|
16504
|
+
}).map((entry) => entry.text));
|
|
16505
|
+
scopeOwner = owner;
|
|
16506
|
+
scopeOpen = true;
|
|
16507
|
+
};
|
|
16508
|
+
return {
|
|
16509
|
+
snapshot: snapshotOf,
|
|
16510
|
+
rememberAccepted,
|
|
16511
|
+
seed,
|
|
16512
|
+
begin,
|
|
16513
|
+
reset,
|
|
16514
|
+
settle,
|
|
16515
|
+
reconcileStepsForTest: () => reconcileSteps,
|
|
16516
|
+
scopeFactCountForTest: () => scopeSettled.size
|
|
16517
|
+
};
|
|
16518
|
+
}
|
|
16167
16519
|
//#endregion
|
|
16168
|
-
export {
|
|
16520
|
+
export { parseFooterCustomItem as $, getOsc8LinkAtColumn as A, stripTerminalSequences as B, dispatchMouseEvent as C, getCellDimensions as D, getCapabilities as E, matchesKey as F, DEFAULT_CUSTOM_COMMAND_REFRESH_MS as G, visibleWidth as H, parseKey as I, customItemId as J, activeFooterItemIds as K, registerKittyImageMetadata as L, isFocusable as M, isKeyRelease as N, getGraphemeSegmenter as O, isKeyRepeat as P, executableCommandItemIds as Q, renderFakeCursor as R, decodePrintableKey as S, fuzzyFilter as T, wrapTextWithAnsi as U, truncateToWidth as V, CUSTOM_FOOTER_ITEM_PREFIX as W, effectiveCustomCommandRefreshMs as X, customItemName as Y, effectiveCustomCommandTimeoutMs as Z, Text as _, Container as a, VStack as b, Image as c, Markdown as d, parseFooterCustomItems as et, MouseRegion as f, Spacer as g, SettingsList as h, CombinedAutocompleteProvider as i, imageFallback as j, getKeybindings as k, Input as l, ScrollView as m, AltScreenSearchIndex as n, Editor as o, ProcessTerminal as p, customCommandConfigOf as q, CURSOR_MARKER as r, HStack as s, createHistoryRecallScope as t, Key as u, TuiAltScreen as v, findAltScreenSearchMatches as w, decodeKittyPrintable as x, TuiMainScreen as y, sliceByColumn as z };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __exportAll = (all, no_symbols) => {
|
|
5
|
+
let target = {};
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
11
|
+
return target;
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
export { __exportAll as t };
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import z from "@deepseek-ai/schemastery";
|
|
2
|
+
//#region src/domain/display/preset.ts
|
|
3
|
+
/** The default when no display preference has been configured. */
|
|
4
|
+
const DEFAULT_DISPLAY_PRESET = "compact";
|
|
5
|
+
/** Whether a value is one of the complete display preset names. */
|
|
6
|
+
function isDisplayPreset(value) {
|
|
7
|
+
return value === "focus" || value === "compact" || value === "full";
|
|
8
|
+
}
|
|
9
|
+
/** Every preset whose projection exists in this build ships as available. */
|
|
10
|
+
function isDisplayPresetAvailable(preset) {
|
|
11
|
+
return preset === "focus" || preset === "compact" || preset === "full";
|
|
12
|
+
}
|
|
13
|
+
/** Whether a preset enables the model-facing Focus behavioral policy. The
|
|
14
|
+
* neutral behavioral answer is exactly the preset identity — it must never
|
|
15
|
+
* depend on the terminal disclosure policy. */
|
|
16
|
+
function isFocusDisplayPreset(preset) {
|
|
17
|
+
return preset === "focus";
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Resolve the canonical field before the legacy Focus field. Every recognized
|
|
21
|
+
* preset is canonical and is never rewritten; an unrecognized canonical value
|
|
22
|
+
* falls back to Full. An absent preference uses the product default, while a
|
|
23
|
+
* supplied legacy Focus value retains its historical mapping.
|
|
24
|
+
*/
|
|
25
|
+
function resolveDisplayPreset(input) {
|
|
26
|
+
if (input.displayPreset !== void 0) {
|
|
27
|
+
if (isDisplayPreset(input.displayPreset)) return {
|
|
28
|
+
preset: input.displayPreset,
|
|
29
|
+
canonicalize: false,
|
|
30
|
+
source: "canonical"
|
|
31
|
+
};
|
|
32
|
+
return {
|
|
33
|
+
preset: "full",
|
|
34
|
+
canonicalize: true,
|
|
35
|
+
source: "invalid-canonical"
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
if (input.focusMode === "on") return {
|
|
39
|
+
preset: "focus",
|
|
40
|
+
canonicalize: true,
|
|
41
|
+
source: "legacy-focus"
|
|
42
|
+
};
|
|
43
|
+
if (input.focusMode !== void 0) return {
|
|
44
|
+
preset: "full",
|
|
45
|
+
canonicalize: true,
|
|
46
|
+
source: "legacy-full"
|
|
47
|
+
};
|
|
48
|
+
return {
|
|
49
|
+
preset: DEFAULT_DISPLAY_PRESET,
|
|
50
|
+
canonicalize: true,
|
|
51
|
+
source: "default"
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/app/config/schema.ts
|
|
56
|
+
/**
|
|
57
|
+
* The TUI plugin's Cordis config contract: the resumed session id plus the
|
|
58
|
+
* DSH 0.1.7 profile-owned live TUI preferences. Every preference field is a
|
|
59
|
+
* schemastery `.volatile()` reference.
|
|
60
|
+
*
|
|
61
|
+
* `PREFERENCE_FIELDS` is the ONE field table: the published `Config` (Direct's
|
|
62
|
+
* `tui-app` row, kept for compatibility and as a legacy migration source) and
|
|
63
|
+
* the canonical `PreferencesConfig` (`pi-tui-preferences`) are both derived
|
|
64
|
+
* from it, so the two rows can never drift apart.
|
|
65
|
+
*
|
|
66
|
+
* Authority note: the `tui-app` row is no longer the runtime preference
|
|
67
|
+
* authority; the canonical `pi-tui-preferences` row and its `piTuiPreferences`
|
|
68
|
+
* service are. `tui-app` keeps its schema (and the `sessionId` launch input)
|
|
69
|
+
* only so installed profiles and the published API keep working, and so the
|
|
70
|
+
* Host-owned migration can read the old USER values once.
|
|
71
|
+
*
|
|
72
|
+
* @module @xmoon76/dsh-pi-tui/app/config/schema
|
|
73
|
+
*/
|
|
74
|
+
/** The 20 durable TUI preferences every backend shares. The names are the
|
|
75
|
+
* persisted profile keys; the schema defines the defaults, validators
|
|
76
|
+
* and shapes. */
|
|
77
|
+
const PREFERENCE_FIELDS = {
|
|
78
|
+
/** Theme values: auto | dark | light | custom:<name>. */
|
|
79
|
+
theme: z.string().default("auto").volatile(),
|
|
80
|
+
iconStyle: z.string().default("emoji").volatile(),
|
|
81
|
+
footer: z.string().default("full").volatile(),
|
|
82
|
+
/** The user's LAST NATIVE footer mode ('default' | 'compact' | 'custom'):
|
|
83
|
+
* persisted separately because `footer` itself is overwritten by
|
|
84
|
+
* 'command' when the command surface arms — the command surface's failure
|
|
85
|
+
* fallback resolves from THIS, so a compact user's fallback survives a
|
|
86
|
+
* restart. */
|
|
87
|
+
footerFallbackMode: z.string().default("default").volatile(),
|
|
88
|
+
/** The M2 versioned custom footer layout (a nested object, never a JSON
|
|
89
|
+
* string). No schema default: parseFooterLayout is the authority on the
|
|
90
|
+
* persisted value and resolves absence to the builtin default layout. */
|
|
91
|
+
footerLayout: z.object({
|
|
92
|
+
schemaVersion: z.const(1),
|
|
93
|
+
rows: z.array(z.object({
|
|
94
|
+
left: z.array(z.object({
|
|
95
|
+
id: z.string(),
|
|
96
|
+
format: z.string(),
|
|
97
|
+
tone: z.string(),
|
|
98
|
+
prefix: z.string(),
|
|
99
|
+
suffix: z.string(),
|
|
100
|
+
importance: z.number(),
|
|
101
|
+
hideInTsp: z.boolean()
|
|
102
|
+
})),
|
|
103
|
+
right: z.array(z.object({
|
|
104
|
+
id: z.string(),
|
|
105
|
+
format: z.string(),
|
|
106
|
+
tone: z.string(),
|
|
107
|
+
prefix: z.string(),
|
|
108
|
+
suffix: z.string(),
|
|
109
|
+
importance: z.number(),
|
|
110
|
+
hideInTsp: z.boolean()
|
|
111
|
+
})),
|
|
112
|
+
separator: z.object({
|
|
113
|
+
text: z.string(),
|
|
114
|
+
tone: z.string()
|
|
115
|
+
})
|
|
116
|
+
}))
|
|
117
|
+
}).volatile(),
|
|
118
|
+
/** PR C: the Custom Text/Command definition collection, retained as raw
|
|
119
|
+
* data — the fail-soft parser (footer/custom-items.ts) owns validation. */
|
|
120
|
+
footerCustomItems: z.any().volatile(),
|
|
121
|
+
/** M5: the trusted command status-line config (armed ONLY while the USER
|
|
122
|
+
* profile layer owns it — see resolveTrustedFooterCommand). */
|
|
123
|
+
footerCommand: z.object({
|
|
124
|
+
schemaVersion: z.const(1),
|
|
125
|
+
command: z.string(),
|
|
126
|
+
timeoutMs: z.number(),
|
|
127
|
+
refreshIntervalMs: z.number(),
|
|
128
|
+
maxRows: z.number()
|
|
129
|
+
}).volatile(),
|
|
130
|
+
fullscreen: z.string().default("on").volatile(),
|
|
131
|
+
/** Busy-Enter delivery for plain Enter while the agent runs: 'queue'
|
|
132
|
+
* (default) or 'steer'. */
|
|
133
|
+
busyEnter: z.string().default("queue").volatile(),
|
|
134
|
+
/** User-shell sandbox policy for user-typed `!`/`!!` commands: 'bypass'
|
|
135
|
+
* (default) runs them outside the dsh sandbox, 'sandbox' routes them
|
|
136
|
+
* through the dsh shell capability's policy. */
|
|
137
|
+
localShellSandbox: z.string().default("bypass").volatile(),
|
|
138
|
+
/** Home/End navigation behavior (issue #9): 'input' (default) moves
|
|
139
|
+
* within the input, 'viewport' keeps Home/End scrolling. */
|
|
140
|
+
homeEndKeys: z.string().default("input").volatile(),
|
|
141
|
+
/** Canonical transcript display preset (focus | compact | full). */
|
|
142
|
+
displayPreset: z.string().default(DEFAULT_DISPLAY_PRESET).volatile(),
|
|
143
|
+
/** Mid-turn progress-update cadence (off | milestones | frequent). */
|
|
144
|
+
progressUpdates: z.string().default("milestones").volatile(),
|
|
145
|
+
/** Git attribution guidance mode (off | product | product-model). */
|
|
146
|
+
gitAttribution: z.string().default("off").volatile(),
|
|
147
|
+
/** Visible-answer density guidance (default | concise | explanatory). */
|
|
148
|
+
responseStyle: z.string().default("default").volatile(),
|
|
149
|
+
/** Completion-notification mode ('unfocused' | 'always' | 'off'). */
|
|
150
|
+
notificationMode: z.string().default("unfocused").volatile(),
|
|
151
|
+
/** Completion-notification method ('auto' | 'osc9' | 'osc777' | 'bell'). */
|
|
152
|
+
notificationMethod: z.string().default("auto").volatile(),
|
|
153
|
+
/** Terminal-progress protocol selection ('off' | '9;4' | '7501' |
|
|
154
|
+
* '9;4+7501'): which native terminal status protocols the TUI reports.
|
|
155
|
+
* Defaults to the dual protocol. */
|
|
156
|
+
terminalProgress: z.string().default("9;4+7501").volatile(),
|
|
157
|
+
/** Fullscreen mouse-wheel step ('1' | '2' | '3' | '5' | '8'). */
|
|
158
|
+
wheelScrollLines: z.string().default("1").volatile(),
|
|
159
|
+
/** The user keybinding overrides as a whole-value RAW field. The
|
|
160
|
+
* keybindings parser (src/tui/keybindings/config.ts) is the only
|
|
161
|
+
* validation/parsing authority — the keybinding business schema
|
|
162
|
+
* deliberately stays out of the plugin Config. */
|
|
163
|
+
keybindings: z.any().volatile()
|
|
164
|
+
};
|
|
165
|
+
/** The 20 persisted preference field names, in schema order. */
|
|
166
|
+
const PREFERENCE_FIELD_NAMES = Object.keys(PREFERENCE_FIELDS);
|
|
167
|
+
const PreferencesConfig = z.object({
|
|
168
|
+
...PREFERENCE_FIELDS,
|
|
169
|
+
legacySettingsMigrationVersion: z.number().default(0).volatile()
|
|
170
|
+
});
|
|
171
|
+
const Config = z.object({
|
|
172
|
+
sessionId: z.string(),
|
|
173
|
+
...PREFERENCE_FIELDS,
|
|
174
|
+
legacySettingsMigrationVersion: z.number().default(0).volatile()
|
|
175
|
+
});
|
|
176
|
+
//#endregion
|
|
177
|
+
export { isDisplayPreset as a, resolveDisplayPreset as c, DEFAULT_DISPLAY_PRESET as i, PREFERENCE_FIELD_NAMES as n, isDisplayPresetAvailable as o, PreferencesConfig as r, isFocusDisplayPreset as s, Config as t };
|
|
@@ -1,4 +1,57 @@
|
|
|
1
1
|
import z from "@deepseek-ai/schemastery";
|
|
2
|
+
//#region src/domain/display/preset.ts
|
|
3
|
+
/** The default when no display preference has been configured. */
|
|
4
|
+
const DEFAULT_DISPLAY_PRESET = "compact";
|
|
5
|
+
/** Whether a value is one of the complete display preset names. */
|
|
6
|
+
function isDisplayPreset(value) {
|
|
7
|
+
return value === "focus" || value === "compact" || value === "full";
|
|
8
|
+
}
|
|
9
|
+
/** Every preset whose projection exists in this build ships as available. */
|
|
10
|
+
function isDisplayPresetAvailable(preset) {
|
|
11
|
+
return preset === "focus" || preset === "compact" || preset === "full";
|
|
12
|
+
}
|
|
13
|
+
/** Whether a preset enables the model-facing Focus behavioral policy. The
|
|
14
|
+
* neutral behavioral answer is exactly the preset identity — it must never
|
|
15
|
+
* depend on the terminal disclosure policy. */
|
|
16
|
+
function isFocusDisplayPreset(preset) {
|
|
17
|
+
return preset === "focus";
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Resolve the canonical field before the legacy Focus field. Every recognized
|
|
21
|
+
* preset is canonical and is never rewritten; an unrecognized canonical value
|
|
22
|
+
* falls back to Full. An absent preference uses the product default, while a
|
|
23
|
+
* supplied legacy Focus value retains its historical mapping.
|
|
24
|
+
*/
|
|
25
|
+
function resolveDisplayPreset(input) {
|
|
26
|
+
if (input.displayPreset !== void 0) {
|
|
27
|
+
if (isDisplayPreset(input.displayPreset)) return {
|
|
28
|
+
preset: input.displayPreset,
|
|
29
|
+
canonicalize: false,
|
|
30
|
+
source: "canonical"
|
|
31
|
+
};
|
|
32
|
+
return {
|
|
33
|
+
preset: "full",
|
|
34
|
+
canonicalize: true,
|
|
35
|
+
source: "invalid-canonical"
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
if (input.focusMode === "on") return {
|
|
39
|
+
preset: "focus",
|
|
40
|
+
canonicalize: true,
|
|
41
|
+
source: "legacy-focus"
|
|
42
|
+
};
|
|
43
|
+
if (input.focusMode !== void 0) return {
|
|
44
|
+
preset: "full",
|
|
45
|
+
canonicalize: true,
|
|
46
|
+
source: "legacy-full"
|
|
47
|
+
};
|
|
48
|
+
return {
|
|
49
|
+
preset: DEFAULT_DISPLAY_PRESET,
|
|
50
|
+
canonicalize: true,
|
|
51
|
+
source: "default"
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
2
55
|
//#region src/app/config/schema.ts
|
|
3
56
|
/**
|
|
4
57
|
* The TUI plugin's Cordis config contract: the resumed session id plus the
|
|
@@ -19,7 +72,7 @@ import z from "@deepseek-ai/schemastery";
|
|
|
19
72
|
* @module @xmoon76/dsh-pi-tui/app/config/schema
|
|
20
73
|
*/
|
|
21
74
|
/** The 20 durable TUI preferences every backend shares. The names are the
|
|
22
|
-
* persisted profile keys; the schema
|
|
75
|
+
* persisted profile keys; the schema defines the defaults, validators
|
|
23
76
|
* and shapes. */
|
|
24
77
|
const PREFERENCE_FIELDS = {
|
|
25
78
|
/** Theme values: auto | dark | light | custom:<name>. */
|
|
@@ -86,7 +139,7 @@ const PREFERENCE_FIELDS = {
|
|
|
86
139
|
* within the input, 'viewport' keeps Home/End scrolling. */
|
|
87
140
|
homeEndKeys: z.string().default("input").volatile(),
|
|
88
141
|
/** Canonical transcript display preset (focus | compact | full). */
|
|
89
|
-
displayPreset: z.string().default(
|
|
142
|
+
displayPreset: z.string().default(DEFAULT_DISPLAY_PRESET).volatile(),
|
|
90
143
|
/** Mid-turn progress-update cadence (off | milestones | frequent). */
|
|
91
144
|
progressUpdates: z.string().default("milestones").volatile(),
|
|
92
145
|
/** Git attribution guidance mode (off | product | product-model). */
|
|
@@ -121,4 +174,4 @@ const Config = z.object({
|
|
|
121
174
|
legacySettingsMigrationVersion: z.number().default(0).volatile()
|
|
122
175
|
});
|
|
123
176
|
//#endregion
|
|
124
|
-
export { PREFERENCE_FIELD_NAMES as n, PreferencesConfig as r, Config as t };
|
|
177
|
+
export { isDisplayPresetAvailable as a, isDisplayPreset as i, PREFERENCE_FIELD_NAMES as n, isFocusDisplayPreset as o, PreferencesConfig as r, resolveDisplayPreset as s, Config as t };
|