@staff0rd/assist 0.491.1 → 0.493.0
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.md +1 -0
- package/dist/commands/sessions/web/bundle.js +372 -372
- package/dist/index.js +33 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.493.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -581,7 +581,8 @@ var assistConfigShape = {
|
|
|
581
581
|
includeCommittedChanges: z2.boolean().default(true),
|
|
582
582
|
topBar: z2.boolean().default(true),
|
|
583
583
|
floatWaiting: z2.boolean().default(true),
|
|
584
|
-
floatWaitingAfterMs: z2.number().default(5e3)
|
|
584
|
+
floatWaitingAfterMs: z2.number().default(5e3),
|
|
585
|
+
maxLive: z2.number().default(24)
|
|
585
586
|
}).optional(),
|
|
586
587
|
database: z2.strictObject({
|
|
587
588
|
url: z2.string().optional()
|
|
@@ -30256,17 +30257,29 @@ function registerSpawnedSession(session, sessions, clients, onStatusChange, noti
|
|
|
30256
30257
|
return session.id;
|
|
30257
30258
|
}
|
|
30258
30259
|
|
|
30260
|
+
// src/commands/sessions/daemon/maxLiveSessions.ts
|
|
30261
|
+
var DEFAULT_MAX_LIVE = 24;
|
|
30262
|
+
function maxLiveSessions() {
|
|
30263
|
+
return loadConfig().sessions?.maxLive ?? DEFAULT_MAX_LIVE;
|
|
30264
|
+
}
|
|
30265
|
+
|
|
30259
30266
|
// src/commands/sessions/daemon/sessionLimits.ts
|
|
30260
|
-
var MAX_LIVE = 12;
|
|
30261
30267
|
var sessionLimits = {
|
|
30262
|
-
maxRestore
|
|
30268
|
+
maxRestore() {
|
|
30269
|
+
return maxLiveSessions();
|
|
30270
|
+
},
|
|
30263
30271
|
/** Allocate the next session id from counter, refusing past the absolute
|
|
30264
30272
|
* ceiling regardless of caller (restore, web create, retry) so no trigger
|
|
30265
30273
|
* can fan out without bound. The counter advances only when allowed. */
|
|
30266
30274
|
nextId(liveCount, counter) {
|
|
30267
|
-
|
|
30268
|
-
|
|
30269
|
-
|
|
30275
|
+
const ceiling = maxLiveSessions();
|
|
30276
|
+
if (liveCount >= ceiling) {
|
|
30277
|
+
daemonLog(
|
|
30278
|
+
`refusing to spawn: at ceiling of ${ceiling} live sessions (sessions.maxLive)`
|
|
30279
|
+
);
|
|
30280
|
+
throw new Error(
|
|
30281
|
+
`session ceiling of ${ceiling} reached \u2014 raise it with: assist config set sessions.maxLive <n> -g`
|
|
30282
|
+
);
|
|
30270
30283
|
}
|
|
30271
30284
|
return String(counter.next++);
|
|
30272
30285
|
},
|
|
@@ -30787,7 +30800,7 @@ function deferredSession(id, persisted, cap) {
|
|
|
30787
30800
|
function deferralNotice(persisted, cap) {
|
|
30788
30801
|
return [
|
|
30789
30802
|
`\r
|
|
30790
|
-
\x1B[33mNot resumed: restore was already at its cap of ${cap} session(s)\x1B[0m\r
|
|
30803
|
+
\x1B[33mNot resumed: restore was already at its cap of ${cap} session(s) (raise it with: assist config set sessions.maxLive <n> -g)\x1B[0m\r
|
|
30791
30804
|
`,
|
|
30792
30805
|
`This card is the handle for it. Its command, working directory (${persisted.cwd})\r
|
|
30793
30806
|
`,
|
|
@@ -31006,21 +31019,20 @@ function logRestoreError(persisted, error) {
|
|
|
31006
31019
|
// src/commands/sessions/daemon/restoreAll.ts
|
|
31007
31020
|
function restoreAll(spawner, sessions) {
|
|
31008
31021
|
const persisted = loadPersistedSessions();
|
|
31009
|
-
const
|
|
31022
|
+
const cap = sessionLimits.maxRestore();
|
|
31023
|
+
const names = persisted.slice(0, cap).map((entry) => {
|
|
31010
31024
|
restoreOne(entry, spawner, sessions);
|
|
31011
31025
|
return entry.name;
|
|
31012
31026
|
});
|
|
31013
|
-
for (const over of persisted.slice(
|
|
31014
|
-
deferOne(over, spawner.recoveryCard);
|
|
31027
|
+
for (const over of persisted.slice(cap))
|
|
31028
|
+
deferOne(over, spawner.recoveryCard, cap);
|
|
31015
31029
|
return names;
|
|
31016
31030
|
}
|
|
31017
|
-
function deferOne(persisted, spawnRecoveryCard) {
|
|
31031
|
+
function deferOne(persisted, spawnRecoveryCard, cap) {
|
|
31018
31032
|
try {
|
|
31019
|
-
const id = spawnRecoveryCard(
|
|
31020
|
-
(sid) => deferredSession(sid, persisted, sessionLimits.maxRestore)
|
|
31021
|
-
);
|
|
31033
|
+
const id = spawnRecoveryCard((sid) => deferredSession(sid, persisted, cap));
|
|
31022
31034
|
daemonLog(
|
|
31023
|
-
`restore capped at ${
|
|
31035
|
+
`restore capped at ${cap} (sessions.maxLive): ${describePersistedSession(persisted)} deferred to stopped card ${id}`
|
|
31024
31036
|
);
|
|
31025
31037
|
} catch (error) {
|
|
31026
31038
|
logDroppedSession(persisted, error);
|
|
@@ -33126,6 +33138,11 @@ var sessionsConfigHelp = [
|
|
|
33126
33138
|
setter: "assist config set sessions.floatWaitingAfterMs 15000 -g",
|
|
33127
33139
|
note: "how long a session must have been waiting on input before it floats (default: 5000ms)"
|
|
33128
33140
|
},
|
|
33141
|
+
{
|
|
33142
|
+
key: "sessions.maxLive",
|
|
33143
|
+
setter: "assist config set sessions.maxLive 24 -g",
|
|
33144
|
+
note: "ceiling on concurrent live sessions one daemon holds; spawning past it is refused, and restore respawns at most this many persisted sessions (default: 24)"
|
|
33145
|
+
},
|
|
33129
33146
|
{
|
|
33130
33147
|
key: "worktree.enabled",
|
|
33131
33148
|
setter: "assist config set worktree.enabled true -g --repo",
|