@peer-agent/protocol 0.1.0-rc.22 → 0.1.0-rc.23

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.
@@ -0,0 +1,44 @@
1
+ /** Read-only presentation facts. Actions remain subject to their original host gates. */
2
+ export interface AttentionCard {
3
+ readonly cardId: string;
4
+ readonly kind: string;
5
+ readonly content: string;
6
+ readonly resolvedState?: 'open' | 'resolved';
7
+ readonly actions?: readonly {
8
+ readonly id: string;
9
+ readonly channel?: string;
10
+ readonly seam?: string;
11
+ readonly payload?: Readonly<Record<string, unknown>>;
12
+ }[];
13
+ readonly refs?: Readonly<Record<string, string>>;
14
+ readonly resolution?: {
15
+ readonly state: string;
16
+ };
17
+ readonly completionReview?: import('./delegation.ts').SessionCompletionReview;
18
+ }
19
+ export interface BotAttentionItem {
20
+ readonly id: string;
21
+ readonly workspaceId: string;
22
+ readonly botName: string;
23
+ readonly kind: 'question' | 'approval' | 'confirmation';
24
+ readonly title: string;
25
+ readonly createdAt?: string;
26
+ readonly expiresAt?: string;
27
+ readonly messageId?: string;
28
+ readonly sessionId?: string;
29
+ readonly card?: AttentionCard;
30
+ }
31
+ export interface BotAttentionRequest {
32
+ readonly workspaceId?: string;
33
+ }
34
+ export type BotAttentionResult = {
35
+ readonly ok: true;
36
+ readonly items: readonly BotAttentionItem[];
37
+ } | {
38
+ readonly ok: false;
39
+ readonly code: string;
40
+ };
41
+ /** Current conversational decision, including when its source lies outside the returned page. */
42
+ export interface BotDecisionSnapshot {
43
+ readonly activeReplyQuestionId: string | null;
44
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -66,6 +66,8 @@ export interface WorkSessionConversationMeta extends SessionQueueFacts {
66
66
  readonly phase?: 'starting' | 'verifying' | 'paused';
67
67
  }
68
68
  export interface WorkSession extends SessionQueueFacts {
69
+ readonly completionReviewRequired?: boolean;
70
+ readonly resultConfirmationRequired?: boolean;
69
71
  readonly coordination?: import('./delegation-coordination.ts').CoordinationSessionFacts;
70
72
  readonly sessionId: string;
71
73
  readonly workspaceId: string;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export type { AttentionCard, BotDecisionSnapshot, BotAttentionItem, BotAttentionRequest, BotAttentionResult } from './attention.ts';
1
2
  export type { ProjectWorkBudgetLimits, ProjectWorkBudgetBoundary, ProjectReplyRecoveryAction, ProjectWorkReceipt, ProjectWorkRecovery, ProjectWorkState, ProjectTurnEnd, ProjectReplyFailureStatus, ProjectAgentSilentWait } from './work-coordination.ts';
2
3
  export type { CoordinationAction, CoordinationLifecycle, CoordinationMandate, CoordinationDecision, TaskTransitionPhase, TaskTransition, CoordinationExecutionBinding, CoordinationSessionFacts } from './delegation-coordination.ts';
3
4
  export { deriveSessionFacts, type SessionFactSnapshot } from './session-facts.ts';
package/dist/project.d.ts CHANGED
@@ -173,6 +173,7 @@ export interface BotProfile {
173
173
  }
174
174
  export interface BotRowState {
175
175
  readonly needsYou: number;
176
+ readonly attentionExpiresAt?: string;
176
177
  readonly unread: number;
177
178
  readonly running: number;
178
179
  /** Ephemeral status of the runner hosted by this desktop process. */
@@ -266,6 +267,9 @@ export declare function projectBotListItem(input: {
266
267
  readonly lastMessage?: BotListMessage | null;
267
268
  readonly sessions?: readonly BotListSession[];
268
269
  readonly approvals?: readonly BotListApproval[];
270
+ readonly attention?: readonly {
271
+ readonly id: string;
272
+ }[];
269
273
  readonly readCursor?: string | null;
270
274
  }): BotListItem;
271
275
  export declare function sortBotList(items: readonly BotListItem[]): BotListItem[];
package/dist/project.js CHANGED
@@ -22,7 +22,6 @@ export const BOT_AVATAR_COLORS = [
22
22
  '#55bac7',
23
23
  '#a8a59f',
24
24
  ];
25
- const NEEDS_YOU_STATUSES = new Set(['waiting_user', 'result_ready']);
26
25
  const RUNNING_STATUSES = new Set(['starting', 'running', 'verifying']);
27
26
  function fnv1a(text) {
28
27
  let hash = 0x811c9dc5;
@@ -51,9 +50,7 @@ function latestIso(values) {
51
50
  }
52
51
  export function projectBotListItem(input) {
53
52
  const sessions = input.sessions ?? [];
54
- const approvals = input.approvals ?? [];
55
- const openApprovals = approvals.filter((item) => item.state === 'open' || item.state === 'stale').length;
56
- const waitingSessions = sessions.filter((item) => NEEDS_YOU_STATUSES.has(item.status)).length;
53
+ const attention = new Set((input.attention ?? []).map(item => item.id));
57
54
  const running = sessions.filter((item) => RUNNING_STATUSES.has(item.status)).length;
58
55
  const lastMessage = input.lastMessage ?? null;
59
56
  const unread = lastMessage
@@ -72,7 +69,7 @@ export function projectBotListItem(input) {
72
69
  ...sessions.map((item) => item.updatedAt),
73
70
  ]),
74
71
  state: {
75
- needsYou: openApprovals + waitingSessions,
72
+ needsYou: attention.size,
76
73
  unread,
77
74
  running,
78
75
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peer-agent/protocol",
3
- "version": "0.1.0-rc.22",
3
+ "version": "0.1.0-rc.23",
4
4
  "description": "Shared host-neutral protocol contracts for Peer Agent runtimes and clients.",
5
5
  "type": "module",
6
6
  "license": "MIT",