@hyperdrive.bot/paseo-protocol 0.3.40 → 0.3.42

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.
@@ -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 tasks. When > 0
13
- * the agent is still doing work even if its own lifecycle status has settled
14
- * to "idle", so it must keep surfacing as "running" (kanban, activity dot,
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
- done: 4,
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" || hasActiveChildren(input)) {
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" || hasActiveChildren(input)) {
58
+ if (input.status === "running") {
38
59
  return 2;
39
60
  }
40
61
  if (input.status === "initializing") {
41
62
  return 3;
42
63
  }
43
- return 4;
64
+ if (hasActiveChildren(input)) {
65
+ return 4;
66
+ }
67
+ return 5;
44
68
  }
45
69
  //# sourceMappingURL=agent-state-bucket.js.map
@@ -443,6 +443,16 @@ export interface AgentSessionConfig {
443
443
  claude?: AgentMetadata;
444
444
  };
445
445
  mcpServers?: Record<string, McpServerConfig>;
446
+ /**
447
+ * Per-run tool allowlist in Claude Code permission-rule syntax, e.g.
448
+ * ["Read", "Grep", "Bash(git:*)", "mcp__playwright__browser_navigate"].
449
+ *
450
+ * When present, a tool absent from the list cannot run at all: it is blocked
451
+ * before execution and the model is told why. Undefined or empty means no
452
+ * allowlist is applied. Only the claude provider can enforce this; the others
453
+ * fail the create call rather than accept an unenforceable restriction.
454
+ */
455
+ allowedTools?: string[];
446
456
  /**
447
457
  * Internal agents are hidden from listings and don't trigger notifications.
448
458
  * They are used for ephemeral system tasks like commit/PR generation.