@peer-agent/protocol 0.1.0-rc.27 → 0.1.0-rc.28

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.
@@ -14,3 +14,12 @@ export interface CoordinationUsageObservation {
14
14
  readonly tokens: number | null;
15
15
  readonly costUsd: number | null;
16
16
  }
17
+ /** A durable input receipt is independent of this execution/recovery barrier. */
18
+ export interface BotRecoveryStatus {
19
+ readonly state: 'blocked';
20
+ readonly reason: 'history_conflict' | 'reconciliation_required' | 'recovery_failed';
21
+ readonly code: string;
22
+ readonly phase: string;
23
+ readonly retryable: boolean;
24
+ }
25
+ export declare function projectBotRecoveryStatus(error: unknown, phase?: string): BotRecoveryStatus;
@@ -1 +1,9 @@
1
- export {};
1
+ export function projectBotRecoveryStatus(error, phase = 'unknown') {
2
+ const code = typeof error === 'string' && /^[a-zA-Z0-9_:-]{1,120}$/.test(error) ? error : 'RECOVERY_FAILED';
3
+ const conflict = ['coordination_legacy_changed', 'coordination_hash_mismatch', 'coordination_journal_missing',
4
+ 'coordination_legacy_seal_invalid', 'coordination_repair_incomplete', 'coordination_fence_incomplete', 'coordination_fence_invalid', 'coordination_writer_fence_missing',
5
+ 'coordination_writer_upgrade_required', 'coordination_schema_unsupported'].includes(code);
6
+ const held = code === 'coordination_reconciliation_required';
7
+ return { state: 'blocked', reason: held ? 'reconciliation_required' : conflict ? 'history_conflict' : 'recovery_failed', code,
8
+ phase: /^[a-z_]{1,40}$/.test(phase) ? phase : 'unknown', retryable: !conflict && !held };
9
+ }
@@ -25,7 +25,9 @@ export interface DelegationOrigin {
25
25
  readonly requestedAt: string;
26
26
  readonly completedAt?: string;
27
27
  readonly evidenceCalls?: readonly string[];
28
+ readonly preserveArtifacts?: boolean;
28
29
  };
30
+ readonly retainedForRecovery?: boolean;
29
31
  readonly workId?: string;
30
32
  readonly anchorMessageId: string;
31
33
  readonly inputId: string;
package/dist/index.d.ts CHANGED
@@ -897,6 +897,7 @@ export * from './remote-access-settings.ts';
897
897
  export type { BotModelSelectionUpdateRequest, BotModelSelectionUpdateResult } from './bot-model-selection.ts';
898
898
  export * from './local-image.ts';
899
899
  export * from './bot-conversation-read.ts';
900
+ export * from './project-recovery.ts';
900
901
  export * from './local-git.ts';
901
902
  export type { CapabilityBlocker, DelegationCapabilityAdmission } from './capability-admission.ts';
902
903
  export * from './project-input-recovery.ts';
package/dist/index.js CHANGED
@@ -44,6 +44,7 @@ export * from "./objectives.js";
44
44
  export * from "./remote-access-settings.js";
45
45
  export * from "./local-image.js";
46
46
  export * from "./bot-conversation-read.js";
47
+ export * from "./project-recovery.js";
47
48
  export * from "./local-git.js";
48
49
  export * from "./project-input-recovery.js";
49
50
  export { botResourceReferences } from "./resource-reference-hints.js";
@@ -0,0 +1,42 @@
1
+ /** Local maintenance controls. These commands never accept an execution verdict or a filesystem path. */
2
+ export interface ProjectRecoveryRequest {
3
+ readonly workspaceId: string;
4
+ readonly action: 'inspect' | 'restore' | 'retain';
5
+ readonly planToken?: string;
6
+ readonly workId?: string;
7
+ readonly sessionId?: string;
8
+ }
9
+ export interface ProjectRecoveryWork {
10
+ readonly workId: string;
11
+ readonly title: string;
12
+ readonly disposition: 'held' | 'resume';
13
+ readonly reason: string;
14
+ }
15
+ export interface ProjectRecoveryView {
16
+ readonly phase: 'occupied' | 'inspection' | 'stopping' | 'backing_up' | 'restoring' | 'reconciling' | 'ready' | 'failed';
17
+ readonly planToken?: string;
18
+ readonly restored: boolean;
19
+ readonly canContinue: boolean;
20
+ readonly runtimeReady: boolean;
21
+ readonly completedCount: number;
22
+ readonly works: readonly ProjectRecoveryWork[];
23
+ readonly sessions: readonly {
24
+ readonly sessionId: string;
25
+ readonly title: string;
26
+ }[];
27
+ readonly holder?: {
28
+ readonly surface: 'desktop' | 'tui';
29
+ readonly version: string;
30
+ };
31
+ readonly backupAvailable: boolean;
32
+ readonly backupLocation?: string;
33
+ readonly code?: string;
34
+ }
35
+ export type ProjectRecoveryResult = {
36
+ readonly ok: true;
37
+ readonly view: ProjectRecoveryView;
38
+ } | {
39
+ readonly ok: false;
40
+ readonly code: string;
41
+ readonly view?: ProjectRecoveryView;
42
+ };
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peer-agent/protocol",
3
- "version": "0.1.0-rc.27",
3
+ "version": "0.1.0-rc.28",
4
4
  "description": "Shared host-neutral protocol contracts for Peer Agent runtimes and clients.",
5
5
  "type": "module",
6
6
  "license": "MIT",