@amalgm/shell 0.1.164-main.41285187871 → 0.1.164-main.41292624675
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 +3 -2
- package/dist/user-ground-host.d.ts +16 -3
- package/dist/user-ground-host.js +29 -3
- package/dist/user-ground-host.js.map +1 -1
- package/dist/watching/host.d.ts +6 -1
- package/dist/watching/host.js +13 -1
- package/dist/watching/host.js.map +1 -1
- package/npm-shrinkwrap.json +6 -6
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -81,8 +81,9 @@ much work it is doing, and every change prints one `AMALGM_ACTIVITY` line. A
|
|
|
81
81
|
stop signal, or staying idle for `--exit-when-idle MINUTES`, takes no new work
|
|
82
82
|
and exits 0 only once nothing runs: no terminal, app, automation run or chat
|
|
83
83
|
turn, and no file change still unsettled or unsent. A brick that has not
|
|
84
|
-
reported counts as busy
|
|
85
|
-
|
|
84
|
+
reported counts as busy, and so does one that cannot tell its count: Files
|
|
85
|
+
while its Outbox cannot be read, or while the home holding its database is
|
|
86
|
+
away. A second signal stops at once, exits 1 and names what still ran.
|
|
86
87
|
|
|
87
88
|
```bash
|
|
88
89
|
npm install
|
|
@@ -124,10 +124,12 @@ export interface UserGroundHostOptions {
|
|
|
124
124
|
readonly onDemand?: ApplyWindowHostOptions["onDemand"];
|
|
125
125
|
/** How much Files work this runtime still holds: records the cloud has not
|
|
126
126
|
* accepted, and disk changes not yet recorded. Each reaches zero only when
|
|
127
|
-
* nothing of its kind could be lost if the disk were destroyed now
|
|
127
|
+
* nothing of its kind could be lost if the disk were destroyed now; the
|
|
128
|
+
* unsent count is null while the Outbox cannot be read, and the unsettled
|
|
129
|
+
* count while the home holding this runtime's database is away. */
|
|
128
130
|
readonly activity?: {
|
|
129
|
-
readonly unsent: (count: number) => void;
|
|
130
|
-
readonly unsettled: (count: number) => void;
|
|
131
|
+
readonly unsent: (count: number | null) => void;
|
|
132
|
+
readonly unsettled: (count: number | null) => void;
|
|
131
133
|
};
|
|
132
134
|
/** A failed background pass (a Send or Receive attempt, an Apply lane, a
|
|
133
135
|
* resumed Add intent, or granted-channel following) remains durable and
|
|
@@ -295,6 +297,10 @@ export declare class UserGroundHost {
|
|
|
295
297
|
/** The directories from the home down to the folder holding this runtime's
|
|
296
298
|
* database, each as the object that stood there when it opened. */
|
|
297
299
|
private databaseGround;
|
|
300
|
+
/** Watch's latest unsettled count and what the activity hook last heard,
|
|
301
|
+
* both unset until Watch first reports. */
|
|
302
|
+
private watchUnsettled;
|
|
303
|
+
private saidUnsettled;
|
|
298
304
|
/** Apply waits on ground without a deadline; shutdown cancels them just
|
|
299
305
|
* before it stops the Apply rail, which resumes from durable intents. */
|
|
300
306
|
private readonly applyWaits;
|
|
@@ -414,6 +420,13 @@ export declare class UserGroundHost {
|
|
|
414
420
|
* unavailable, retried on its timer and heard returning by Watch. One whose
|
|
415
421
|
* home stands is a fault, as is a refusal that races the home's return. */
|
|
416
422
|
private databaseCause;
|
|
423
|
+
/** Every directory from the home down to this database's folder is the
|
|
424
|
+
* object that stood there when the database opened. */
|
|
425
|
+
private databaseStanding;
|
|
426
|
+
/** Tells the activity hook Watch's unsettled count when what it would hear
|
|
427
|
+
* changed. While the home holding this database is away, what that home
|
|
428
|
+
* owes cannot be told, so it hears null. */
|
|
429
|
+
private sayUnsettled;
|
|
417
430
|
/** Prove everything owed now, through its current cutoff. Ground still
|
|
418
431
|
* moving when no retry remains names every root the cutoff left unsettled
|
|
419
432
|
* that no unreadable ground explains. */
|
package/dist/user-ground-host.js
CHANGED
|
@@ -296,6 +296,10 @@ export class UserGroundHost {
|
|
|
296
296
|
/** The directories from the home down to the folder holding this runtime's
|
|
297
297
|
* database, each as the object that stood there when it opened. */
|
|
298
298
|
databaseGround = [];
|
|
299
|
+
/** Watch's latest unsettled count and what the activity hook last heard,
|
|
300
|
+
* both unset until Watch first reports. */
|
|
301
|
+
watchUnsettled;
|
|
302
|
+
saidUnsettled;
|
|
299
303
|
/** Apply waits on ground without a deadline; shutdown cancels them just
|
|
300
304
|
* before it stops the Apply rail, which resumes from durable intents. */
|
|
301
305
|
applyWaits = new AbortController();
|
|
@@ -338,7 +342,10 @@ export class UserGroundHost {
|
|
|
338
342
|
} : {}),
|
|
339
343
|
},
|
|
340
344
|
}) } : {}),
|
|
341
|
-
...(options.activity ? { onUnsettled:
|
|
345
|
+
...(options.activity ? { onUnsettled: (count) => {
|
|
346
|
+
this.watchUnsettled = count;
|
|
347
|
+
this.sayUnsettled();
|
|
348
|
+
} } : {}),
|
|
342
349
|
onHealth: (health) => {
|
|
343
350
|
options.onWatchHealth?.(health);
|
|
344
351
|
this.stage({
|
|
@@ -1317,13 +1324,30 @@ export class UserGroundHost {
|
|
|
1317
1324
|
* unavailable, retried on its timer and heard returning by Watch. One whose
|
|
1318
1325
|
* home stands is a fault, as is a refusal that races the home's return. */
|
|
1319
1326
|
databaseCause(error) {
|
|
1320
|
-
if (!(error instanceof GroundDatabaseAway)
|
|
1321
|
-
|| this.databaseGround.every(({ path, key }) => standingKey(path) === key))
|
|
1327
|
+
if (!(error instanceof GroundDatabaseAway) || this.databaseStanding())
|
|
1322
1328
|
return error;
|
|
1329
|
+
this.sayUnsettled();
|
|
1323
1330
|
const home = this.userRoot();
|
|
1324
1331
|
return new DetectUnavailable([{ directory: home,
|
|
1325
1332
|
reason: `${home}, which holds this runtime's database, is not where it was opened; its ground stays unexamined until it returns` }]);
|
|
1326
1333
|
}
|
|
1334
|
+
/** Every directory from the home down to this database's folder is the
|
|
1335
|
+
* object that stood there when the database opened. */
|
|
1336
|
+
databaseStanding() {
|
|
1337
|
+
return this.databaseGround.every(({ path, key }) => standingKey(path) === key);
|
|
1338
|
+
}
|
|
1339
|
+
/** Tells the activity hook Watch's unsettled count when what it would hear
|
|
1340
|
+
* changed. While the home holding this database is away, what that home
|
|
1341
|
+
* owes cannot be told, so it hears null. */
|
|
1342
|
+
sayUnsettled() {
|
|
1343
|
+
if (!this.options.activity || this.watchUnsettled === undefined)
|
|
1344
|
+
return;
|
|
1345
|
+
const count = this.databaseStanding() ? this.watchUnsettled : null;
|
|
1346
|
+
if (count === this.saidUnsettled)
|
|
1347
|
+
return;
|
|
1348
|
+
this.saidUnsettled = count;
|
|
1349
|
+
this.options.activity.unsettled(count);
|
|
1350
|
+
}
|
|
1327
1351
|
/** Prove everything owed now, through its current cutoff. Ground still
|
|
1328
1352
|
* moving when no retry remains names every root the cutoff left unsettled
|
|
1329
1353
|
* that no unreadable ground explains. */
|
|
@@ -3343,6 +3367,8 @@ export class UserGroundHost {
|
|
|
3343
3367
|
this.detectRingQueued = true;
|
|
3344
3368
|
this.nextTurn(() => {
|
|
3345
3369
|
this.detectRingQueued = false;
|
|
3370
|
+
// A ring may be the home holding this database leaving or returning.
|
|
3371
|
+
this.sayUnsettled();
|
|
3346
3372
|
if (this.activeIdentity)
|
|
3347
3373
|
this.wakeDetect();
|
|
3348
3374
|
});
|