@cjhyy/code-shell-pet 0.8.3 → 0.8.4
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/long-task.d.ts +11 -0
- package/dist/long-task.js +43 -0
- package/package.json +2 -2
package/dist/long-task.d.ts
CHANGED
|
@@ -145,6 +145,11 @@ export type PetLongTaskTransition = {
|
|
|
145
145
|
at: number;
|
|
146
146
|
waitingFor: string;
|
|
147
147
|
message?: string;
|
|
148
|
+
} | {
|
|
149
|
+
kind: "waiting-worker";
|
|
150
|
+
at: number;
|
|
151
|
+
waitingFor: string;
|
|
152
|
+
message?: string;
|
|
148
153
|
} | {
|
|
149
154
|
kind: "paused";
|
|
150
155
|
at: number;
|
|
@@ -171,6 +176,12 @@ export type PetLongTaskTransition = {
|
|
|
171
176
|
kind: "verification-changed";
|
|
172
177
|
at: number;
|
|
173
178
|
mode: PetLongTaskVerificationMode;
|
|
179
|
+
} | {
|
|
180
|
+
/** Repairs rows written by hosts that closed a foreground background_wait yield. */
|
|
181
|
+
kind: "background-wait-recovered";
|
|
182
|
+
at: number;
|
|
183
|
+
attemptStartedAt: number;
|
|
184
|
+
reason: string;
|
|
174
185
|
} | {
|
|
175
186
|
kind: "interrupted";
|
|
176
187
|
at: number;
|
package/dist/long-task.js
CHANGED
|
@@ -189,6 +189,7 @@ export function transitionPetLongTask(current, transition) {
|
|
|
189
189
|
(transition.kind === "started" ||
|
|
190
190
|
transition.kind === "progress" ||
|
|
191
191
|
transition.kind === "waiting" ||
|
|
192
|
+
transition.kind === "waiting-worker" ||
|
|
192
193
|
transition.kind === "resumed" ||
|
|
193
194
|
transition.kind === "checkpoint" ||
|
|
194
195
|
transition.kind === "interrupted" ||
|
|
@@ -200,6 +201,7 @@ export function transitionPetLongTask(current, transition) {
|
|
|
200
201
|
if (TERMINAL.has(current.status) &&
|
|
201
202
|
transition.kind !== "retrying" &&
|
|
202
203
|
transition.kind !== "cancelled" &&
|
|
204
|
+
transition.kind !== "background-wait-recovered" &&
|
|
203
205
|
transition.kind !== "closure-decided" &&
|
|
204
206
|
transition.kind !== "continuation-started" &&
|
|
205
207
|
transition.kind !== "closure-recorded") {
|
|
@@ -269,6 +271,24 @@ export function transitionPetLongTask(current, transition) {
|
|
|
269
271
|
nextAction: next.nextAction,
|
|
270
272
|
};
|
|
271
273
|
break;
|
|
274
|
+
case "waiting-worker":
|
|
275
|
+
Object.assign(next, {
|
|
276
|
+
status: "waiting",
|
|
277
|
+
phase: "waiting-worker",
|
|
278
|
+
waitingFor: bounded(transition.waitingFor, 500),
|
|
279
|
+
nextAction: "Wait for the background result notification",
|
|
280
|
+
});
|
|
281
|
+
event = {
|
|
282
|
+
// The public event vocabulary intentionally keeps one waiting kind;
|
|
283
|
+
// phase distinguishes a worker wait from a user decision.
|
|
284
|
+
kind: "waiting",
|
|
285
|
+
at: transition.at,
|
|
286
|
+
phase: "waiting-worker",
|
|
287
|
+
message: transition.message ?? next.waitingFor,
|
|
288
|
+
waitingFor: next.waitingFor,
|
|
289
|
+
nextAction: next.nextAction,
|
|
290
|
+
};
|
|
291
|
+
break;
|
|
272
292
|
case "paused":
|
|
273
293
|
Object.assign(next, {
|
|
274
294
|
status: "paused",
|
|
@@ -363,6 +383,29 @@ export function transitionPetLongTask(current, transition) {
|
|
|
363
383
|
: "Completion now follows the ordinary Work Session result",
|
|
364
384
|
};
|
|
365
385
|
break;
|
|
386
|
+
case "background-wait-recovered":
|
|
387
|
+
Object.assign(next, {
|
|
388
|
+
status: "interrupted",
|
|
389
|
+
phase: "waiting-worker",
|
|
390
|
+
// Fence the generic terminal that caused the bad closure while still
|
|
391
|
+
// accepting a later background-notification run from the same Session.
|
|
392
|
+
startedAt: Math.max(current.createdAt, transition.attemptStartedAt),
|
|
393
|
+
completedAt: undefined,
|
|
394
|
+
closureRecordedAt: undefined,
|
|
395
|
+
closureDecision: undefined,
|
|
396
|
+
waitingFor: bounded(transition.reason, 500),
|
|
397
|
+
nextAction: "Resume from the durable work session",
|
|
398
|
+
lastError: undefined,
|
|
399
|
+
artifacts: current.artifacts.filter((artifact) => artifact.kind !== "result"),
|
|
400
|
+
});
|
|
401
|
+
event = {
|
|
402
|
+
kind: "interrupted",
|
|
403
|
+
at: transition.at,
|
|
404
|
+
phase: "waiting-worker",
|
|
405
|
+
message: next.waitingFor,
|
|
406
|
+
nextAction: next.nextAction,
|
|
407
|
+
};
|
|
408
|
+
break;
|
|
366
409
|
case "interrupted":
|
|
367
410
|
Object.assign(next, {
|
|
368
411
|
status: "interrupted",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cjhyy/code-shell-pet",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"description": "Pet (top-level personal assistant) capability for CodeShell — projection state machine, DelegateWork contract, Mimi behavior profile.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\""
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@cjhyy/code-shell-core": "0.8.
|
|
38
|
+
"@cjhyy/code-shell-core": "0.8.4"
|
|
39
39
|
},
|
|
40
40
|
"engines": {
|
|
41
41
|
"node": ">=20.10"
|