@hyperdrive.bot/paseo-protocol 0.3.41 → 0.3.43
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/agent-state-bucket.d.ts +28 -4
- package/dist/agent-state-bucket.js +28 -4
- package/dist/generated/validation/ws-outbound.aot.js +26832 -26599
- package/dist/messages.d.ts +401 -84
- package/dist/messages.js +65 -2
- package/dist/validation/ws-outbound-schema-metadata.d.ts +58 -20
- package/dist/workflow/compile.d.ts +33 -0
- package/dist/workflow/compile.js +172 -0
- package/dist/workflow/definition.d.ts +134 -0
- package/dist/workflow/definition.js +362 -0
- package/package.json +1 -1
|
@@ -9,15 +9,39 @@ export interface AgentStateBucketInput {
|
|
|
9
9
|
attentionReason?: AgentAttentionReason;
|
|
10
10
|
/**
|
|
11
11
|
* Number of still-alive child activities owned by this agent — running
|
|
12
|
-
* subagents, open shell terminals, and in-flight background
|
|
13
|
-
* the agent is still doing work even if its own lifecycle
|
|
14
|
-
* to "idle", so it must keep surfacing as
|
|
15
|
-
* background tray) until those children finish or are dismissed.
|
|
12
|
+
* subagents, open shell terminals, monitors, crons, and in-flight background
|
|
13
|
+
* tasks. When > 0 the agent is still doing work even if its own lifecycle
|
|
14
|
+
* status has settled to "idle", so it must keep surfacing as *alive* (kanban,
|
|
15
|
+
* activity dot, background tray) until those children finish or are dismissed.
|
|
16
|
+
*
|
|
17
|
+
* It surfaces as "pending", NOT "running". The distinction is about who
|
|
18
|
+
* initiates the next contact: "running" means this agent's own turn is in
|
|
19
|
+
* flight and output is moving right now (a user may want to watch it);
|
|
20
|
+
* "pending" means the turn has settled but something armed will come back on
|
|
21
|
+
* its own. Collapsing the two made an armed session indistinguishable from a
|
|
22
|
+
* live one, and routing armed work through "done" made it invisible.
|
|
16
23
|
*/
|
|
17
24
|
activeChildCount?: number;
|
|
18
25
|
}
|
|
19
26
|
/** True when an agent has live children (subagents / shells / background tasks). */
|
|
20
27
|
export declare function hasActiveChildren(input: Pick<AgentStateBucketInput, "activeChildCount">): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Map an agent's raw state onto the bucket the UI groups and filters by.
|
|
30
|
+
*
|
|
31
|
+
* ORDER IS THE CONTRACT, and the branch order encodes an urgency ladder:
|
|
32
|
+
* blocked-on-you first, then broken, then live, then armed, then unread, then
|
|
33
|
+
* finished. In particular `pending` is checked BEFORE `requiresAttention`, so a
|
|
34
|
+
* session whose turn ended only because a monitor tick woke it does not land in
|
|
35
|
+
* the unread chip on every tick — see `checkAndSetAttention`, which suppresses
|
|
36
|
+
* the attention record at source for the same reason.
|
|
37
|
+
*
|
|
38
|
+
* ⚠️ `done` is a FALLTHROUGH. Anything this function has not been taught about
|
|
39
|
+
* becomes "done" — i.e. invisible — by construction rather than by decision.
|
|
40
|
+
* That is how armed background work stayed hidden for the life of the feature.
|
|
41
|
+
* When you add a new kind of background activity, it must either be counted in
|
|
42
|
+
* `activeChildCount` or be named explicitly in the exhaustiveness test
|
|
43
|
+
* (`agent-state-bucket.exhaustive.test.ts`), which fails the build otherwise.
|
|
44
|
+
*/
|
|
21
45
|
export declare function deriveAgentStateBucket(input: AgentStateBucketInput): WorkspaceStateBucket;
|
|
22
46
|
export declare function getWorkspaceStateBucketPriority(bucket: WorkspaceStateBucket): number;
|
|
23
47
|
export declare function getAgentStatusPriority(input: AgentStateBucketInput): number;
|
|
@@ -7,8 +7,26 @@ const WORKSPACE_STATE_BUCKET_PRIORITY = {
|
|
|
7
7
|
failed: 1,
|
|
8
8
|
running: 2,
|
|
9
9
|
attention: 3,
|
|
10
|
-
|
|
10
|
+
pending: 4,
|
|
11
|
+
done: 5,
|
|
11
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* Map an agent's raw state onto the bucket the UI groups and filters by.
|
|
15
|
+
*
|
|
16
|
+
* ORDER IS THE CONTRACT, and the branch order encodes an urgency ladder:
|
|
17
|
+
* blocked-on-you first, then broken, then live, then armed, then unread, then
|
|
18
|
+
* finished. In particular `pending` is checked BEFORE `requiresAttention`, so a
|
|
19
|
+
* session whose turn ended only because a monitor tick woke it does not land in
|
|
20
|
+
* the unread chip on every tick — see `checkAndSetAttention`, which suppresses
|
|
21
|
+
* the attention record at source for the same reason.
|
|
22
|
+
*
|
|
23
|
+
* ⚠️ `done` is a FALLTHROUGH. Anything this function has not been taught about
|
|
24
|
+
* becomes "done" — i.e. invisible — by construction rather than by decision.
|
|
25
|
+
* That is how armed background work stayed hidden for the life of the feature.
|
|
26
|
+
* When you add a new kind of background activity, it must either be counted in
|
|
27
|
+
* `activeChildCount` or be named explicitly in the exhaustiveness test
|
|
28
|
+
* (`agent-state-bucket.exhaustive.test.ts`), which fails the build otherwise.
|
|
29
|
+
*/
|
|
12
30
|
export function deriveAgentStateBucket(input) {
|
|
13
31
|
if ((input.pendingPermissionCount ?? 0) > 0 || input.attentionReason === "permission") {
|
|
14
32
|
return "needs_input";
|
|
@@ -16,9 +34,12 @@ export function deriveAgentStateBucket(input) {
|
|
|
16
34
|
if (input.status === "error" || input.attentionReason === "error") {
|
|
17
35
|
return "failed";
|
|
18
36
|
}
|
|
19
|
-
if (input.status === "running"
|
|
37
|
+
if (input.status === "running") {
|
|
20
38
|
return "running";
|
|
21
39
|
}
|
|
40
|
+
if (hasActiveChildren(input)) {
|
|
41
|
+
return "pending";
|
|
42
|
+
}
|
|
22
43
|
if (input.requiresAttention) {
|
|
23
44
|
return "attention";
|
|
24
45
|
}
|
|
@@ -34,12 +55,15 @@ export function getAgentStatusPriority(input) {
|
|
|
34
55
|
if (input.status === "error" || input.attentionReason === "error") {
|
|
35
56
|
return 1;
|
|
36
57
|
}
|
|
37
|
-
if (input.status === "running"
|
|
58
|
+
if (input.status === "running") {
|
|
38
59
|
return 2;
|
|
39
60
|
}
|
|
40
61
|
if (input.status === "initializing") {
|
|
41
62
|
return 3;
|
|
42
63
|
}
|
|
43
|
-
|
|
64
|
+
if (hasActiveChildren(input)) {
|
|
65
|
+
return 4;
|
|
66
|
+
}
|
|
67
|
+
return 5;
|
|
44
68
|
}
|
|
45
69
|
//# sourceMappingURL=agent-state-bucket.js.map
|