@peer-agent/protocol 0.1.0-rc.36 → 0.1.0-rc.38

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/index.d.ts CHANGED
@@ -702,6 +702,7 @@ export interface RuntimeToolCall {
702
702
  readonly argumentsPreview?: unknown;
703
703
  readonly [key: string]: unknown;
704
704
  }
705
+ export type { UserAnchorResolution, UserAnchorCandidate, UserAnchorDiagnostic } from './user-anchor.ts';
705
706
  export interface RuntimeToolResult {
706
707
  readonly toolCallId?: string;
707
708
  readonly status?: string;
@@ -6,9 +6,9 @@ const statuses = new Set(WORK_SESSION_STATUSES);
6
6
  const ownerships = new Set(['live', 'ended', 'unknown']);
7
7
  const owners = new Set(['bot', 'user', 'none']);
8
8
  const reasons = new Set(['settled', 'superseded', 'stop_confirmed', 'user_withdrawn',
9
- 'stop_unconfirmed', 'human_request', 'awaiting_human_gate', 'technical_block', 'awaiting_acceptance_technical',
9
+ 'stop_unconfirmed', 'human_request', 'awaiting_human_gate', 'technical_block', 'local_persistence_failed', 'awaiting_acceptance_technical',
10
10
  'verification_failed', 'live_execution', 'paused', 'unknown_facts']);
11
- const hostReasons = new Set(['live_execution', 'stop_unconfirmed', 'unknown_facts']);
11
+ const hostReasons = new Set(['live_execution', 'stop_unconfirmed', 'unknown_facts', 'local_persistence_failed']);
12
12
  export function runtimeSessionFacts(value) {
13
13
  const row = record(value), origin = record(row.origin), cancellation = record(origin.cancellation);
14
14
  const sessionId = text(row.sessionId), rawStatus = text(row.status);
@@ -426,7 +426,7 @@ export interface LifecycleCoreDecision extends ProjectionDecision {
426
426
  * `inCurrentList` 是派生事实,不允许消费端各自按 status 再判一次。
427
427
  */
428
428
  export type FollowUpOwner = 'bot' | 'user' | 'none';
429
- export type FollowUpReason = 'settled' | 'superseded' | 'stop_confirmed' | 'user_withdrawn' | 'stop_unconfirmed' | 'human_request' | 'awaiting_human_gate' | 'technical_block' | 'awaiting_acceptance_technical' | 'verification_failed' | 'live_execution' | 'paused' | 'unknown_facts';
429
+ export type FollowUpReason = 'settled' | 'superseded' | 'stop_confirmed' | 'user_withdrawn' | 'stop_unconfirmed' | 'human_request' | 'awaiting_human_gate' | 'technical_block' | 'local_persistence_failed' | 'awaiting_acceptance_technical' | 'verification_failed' | 'live_execution' | 'paused' | 'unknown_facts';
430
430
  export interface FollowUpProjection {
431
431
  readonly owner: FollowUpOwner;
432
432
  readonly inCurrentList: boolean;
@@ -34,6 +34,8 @@ export function decideFollowUp(decision, facts = {}, ownership = 'unknown') {
34
34
  if (facts.superseded === true || status === 'superseded')
35
35
  return followUpOf('none', 'superseded');
36
36
  // 3) 核验失败/缺证据:即使存在历史 accepted 事实也不能静默(那次验收是旧结论)。
37
+ if (['failed', 'waiting_agent'].includes(status) && facts.blockedReason === 'conversation_persistence_failed')
38
+ return followUpOf('bot', 'local_persistence_failed');
37
39
  if (status === 'failed')
38
40
  return followUpOf('bot', 'verification_failed');
39
41
  if (facts.accepted === true)
@@ -0,0 +1,17 @@
1
+ /** Local identity provenance, never permission, Evidence identity or task completion. */
2
+ export interface UserAnchorResolution {
3
+ readonly field: 'anchorMessageIds' | 'task.anchorMessageIds' | 'replyTo';
4
+ readonly suppliedId: string;
5
+ readonly messageId: string;
6
+ readonly source: 'message_id' | 'input_id';
7
+ }
8
+ export interface UserAnchorCandidate {
9
+ readonly messageId: string;
10
+ /** At most 120 characters; no attachment payloads. */
11
+ readonly text: string;
12
+ }
13
+ export interface UserAnchorDiagnostic {
14
+ readonly anchorResolutions?: readonly UserAnchorResolution[];
15
+ readonly availableAnchors?: readonly UserAnchorCandidate[];
16
+ readonly availableReplyAnchors?: readonly UserAnchorCandidate[];
17
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -79,6 +79,21 @@ export interface ProjectWorkReceipt {
79
79
  readonly sessionIds: readonly string[];
80
80
  /** Current owned technical blockers; a public progress update does not discharge them. */
81
81
  readonly repairSessionIds?: readonly string[];
82
+ /** Unresolved dispatch receipts, not execution grants or permission truth. */
83
+ readonly delegationFollowUp?: {
84
+ readonly blockers: readonly {
85
+ readonly taskKey: string;
86
+ /** Task body without the anchor ids being repaired. A corrected retry clears that obligation. */
87
+ readonly recoveryKey?: string;
88
+ readonly sourceTurnId: string;
89
+ readonly toolCallId: string;
90
+ readonly action: 'parallel' | 'replace';
91
+ readonly error: string;
92
+ readonly retryable: boolean;
93
+ readonly operationId?: string;
94
+ readonly sessionId?: string;
95
+ }[];
96
+ };
82
97
  readonly progressFacts?: readonly string[];
83
98
  readonly state: ProjectWorkState;
84
99
  readonly revision: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peer-agent/protocol",
3
- "version": "0.1.0-rc.36",
3
+ "version": "0.1.0-rc.38",
4
4
  "description": "Shared host-neutral protocol contracts for Peer Agent runtimes and clients.",
5
5
  "type": "module",
6
6
  "license": "MIT",