@peer-agent/protocol 0.1.0-rc.5 → 0.1.0-rc.51

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.
Files changed (130) hide show
  1. package/dist/acceptance-close-gate.d.ts +10 -1
  2. package/dist/acceptance-close-gate.js +12 -0
  3. package/dist/agent-supervision.d.ts +81 -0
  4. package/dist/agent-supervision.js +1 -0
  5. package/dist/attention.d.ts +44 -0
  6. package/dist/attention.js +1 -0
  7. package/dist/bot-access-policy.d.ts +29 -0
  8. package/dist/bot-access-policy.js +1 -0
  9. package/dist/bot-conversation-read.d.ts +67 -0
  10. package/dist/bot-conversation-read.js +9 -0
  11. package/dist/bot-direct-step.d.ts +11 -0
  12. package/dist/bot-direct-step.js +1 -0
  13. package/dist/bot-git.d.ts +55 -0
  14. package/dist/bot-git.js +1 -0
  15. package/dist/bot-model-selection.d.ts +13 -0
  16. package/dist/bot-model-selection.js +1 -0
  17. package/dist/browser-window.d.ts +48 -0
  18. package/dist/browser-window.js +23 -0
  19. package/dist/capability-admission.d.ts +20 -0
  20. package/dist/capability-admission.js +1 -0
  21. package/dist/compaction-history-selection.d.ts +15 -0
  22. package/dist/compaction-history-selection.js +30 -0
  23. package/dist/compaction.d.ts +5 -0
  24. package/dist/compaction.js +6 -0
  25. package/dist/context-accounting.d.ts +3 -0
  26. package/dist/conversation-execution.d.ts +68 -0
  27. package/dist/conversation-execution.js +222 -0
  28. package/dist/delegation-coordination.d.ts +81 -0
  29. package/dist/delegation-coordination.js +1 -0
  30. package/dist/delegation.d.ts +260 -7
  31. package/dist/delegation.js +97 -39
  32. package/dist/document-reference.d.ts +111 -0
  33. package/dist/document-reference.js +1 -0
  34. package/dist/evidence-inspection.d.ts +84 -0
  35. package/dist/evidence-inspection.js +1 -0
  36. package/dist/gemini-standard-pricing.json +105 -0
  37. package/dist/goal.d.ts +50 -2
  38. package/dist/group-chat.d.ts +87 -0
  39. package/dist/group-chat.js +1 -0
  40. package/dist/hook-observation.d.ts +2 -0
  41. package/dist/hook-observation.js +19 -0
  42. package/dist/index.d.ts +117 -25
  43. package/dist/index.js +41 -0
  44. package/dist/input-prediction.d.ts +86 -0
  45. package/dist/input-prediction.js +48 -0
  46. package/dist/intent-coordination.d.ts +201 -0
  47. package/dist/intent-coordination.js +1 -0
  48. package/dist/interactive-result.d.ts +363 -0
  49. package/dist/interactive-result.js +215 -0
  50. package/dist/interactive-verification.d.ts +41 -0
  51. package/dist/interactive-verification.js +65 -0
  52. package/dist/local-git.d.ts +44 -0
  53. package/dist/local-git.js +3 -0
  54. package/dist/local-image.d.ts +53 -0
  55. package/dist/local-image.js +5 -0
  56. package/dist/local-read.d.ts +9 -0
  57. package/dist/local-read.js +1 -0
  58. package/dist/memory.d.ts +117 -12
  59. package/dist/memory.js +12 -0
  60. package/dist/model-reasoning.d.ts +16 -0
  61. package/dist/model-reasoning.js +25 -0
  62. package/dist/model-routing.d.ts +39 -3
  63. package/dist/model-routing.js +31 -5
  64. package/dist/native-process.d.ts +21 -0
  65. package/dist/native-process.js +51 -0
  66. package/dist/parent-coordination.d.ts +104 -0
  67. package/dist/parent-coordination.js +2 -0
  68. package/dist/persistent-workspace.d.ts +519 -0
  69. package/dist/persistent-workspace.js +1 -0
  70. package/dist/project-agent-failure.d.ts +30 -0
  71. package/dist/project-agent-failure.js +44 -0
  72. package/dist/project-input-recovery.d.ts +83 -0
  73. package/dist/project-input-recovery.js +25 -0
  74. package/dist/project-matter.d.ts +359 -0
  75. package/dist/project-matter.js +1 -0
  76. package/dist/project-recovery.d.ts +43 -0
  77. package/dist/project-recovery.js +1 -0
  78. package/dist/project.d.ts +233 -0
  79. package/dist/project.js +134 -5
  80. package/dist/prompt-skill.d.ts +31 -0
  81. package/dist/prompt-skill.js +1 -0
  82. package/dist/quiet-reply.d.ts +9 -0
  83. package/dist/quiet-reply.js +43 -0
  84. package/dist/remote-access.d.ts +15 -0
  85. package/dist/remote-access.js +1 -1
  86. package/dist/reply-delivery.d.ts +28 -0
  87. package/dist/reply-delivery.js +1 -0
  88. package/dist/resource-edit-execution.d.ts +68 -0
  89. package/dist/resource-edit-execution.js +96 -0
  90. package/dist/resource-edit.d.ts +237 -0
  91. package/dist/resource-edit.js +134 -0
  92. package/dist/resource-feedback-transport.d.ts +26 -0
  93. package/dist/resource-feedback-transport.js +94 -0
  94. package/dist/resource-feedback.d.ts +110 -0
  95. package/dist/resource-feedback.js +168 -0
  96. package/dist/resource-file-replace.d.ts +36 -0
  97. package/dist/resource-file-replace.js +40 -0
  98. package/dist/resource-reference-hints.d.ts +3 -0
  99. package/dist/resource-reference-hints.js +58 -0
  100. package/dist/resource-window.d.ts +222 -0
  101. package/dist/resource-window.js +252 -0
  102. package/dist/routine.d.ts +82 -0
  103. package/dist/routine.js +1 -0
  104. package/dist/runtime-session-facts.d.ts +58 -0
  105. package/dist/runtime-session-facts.js +57 -0
  106. package/dist/session-control.d.ts +211 -0
  107. package/dist/session-control.js +48 -0
  108. package/dist/session-facts.d.ts +29 -0
  109. package/dist/session-facts.js +35 -0
  110. package/dist/skill-marketplace.d.ts +39 -4
  111. package/dist/spend-budget.d.ts +69 -0
  112. package/dist/spend-budget.js +1 -0
  113. package/dist/system-context.d.ts +7 -0
  114. package/dist/task-overview.d.ts +91 -0
  115. package/dist/task-overview.js +325 -17
  116. package/dist/tool-activity-preview.d.ts +4 -0
  117. package/dist/tool-activity-preview.js +72 -0
  118. package/dist/updater.d.ts +13 -3
  119. package/dist/usage-accounting.d.ts +42 -1
  120. package/dist/user-anchor.d.ts +17 -0
  121. package/dist/user-anchor.js +1 -0
  122. package/dist/work-coordination.d.ts +188 -0
  123. package/dist/work-coordination.js +1 -0
  124. package/dist/work-hook.d.ts +3 -0
  125. package/dist/work-hook.js +76 -0
  126. package/dist/working-plan.d.ts +18 -0
  127. package/dist/working-plan.js +1 -0
  128. package/dist/workspace.d.ts +35 -0
  129. package/dist/workspace.js +1 -0
  130. package/package.json +1 -1
@@ -0,0 +1,25 @@
1
+ export const DEFINITE_PROJECT_INPUT_REJECTION_CODES = new Set([
2
+ 'QUESTION_CLOSED',
3
+ 'INVALID_INPUT',
4
+ 'INVALID_INPUT_ID',
5
+ 'INVALID_RESOURCE_FEEDBACK',
6
+ 'RESOURCE_FEEDBACK_RECIPIENT_CHANGED',
7
+ 'RESOURCE_FEEDBACK_ATTACHMENT_LIMIT',
8
+ 'INTERACTIVE_FEEDBACK_UNAVAILABLE',
9
+ 'NOT_FOUND',
10
+ 'WORKSPACE_NOT_FOUND',
11
+ ]);
12
+ export function emptyInputDraft() { return { text: '', quote: null, attachments: [] }; }
13
+ /** A handoff failure may follow a durable receipt. Generic ok alone proves nothing. */
14
+ export function projectInputWasReceived(result, workspaceId, inputId) {
15
+ return result?.input?.workspaceId === workspaceId && result.input.inputId === inputId;
16
+ }
17
+ export function isDefiniteProjectInputRejectionCode(code) {
18
+ return typeof code === 'string' && DEFINITE_PROJECT_INPUT_REJECTION_CODES.has(code);
19
+ }
20
+ /** True only when the host rejected the input before enqueuing it (no durable receipt). */
21
+ export function isDefiniteProjectInputRejection(result, workspaceId, inputId) {
22
+ if (!result || result.ok || projectInputWasReceived(result, workspaceId, inputId))
23
+ return false;
24
+ return isDefiniteProjectInputRejectionCode(result.code);
25
+ }
@@ -0,0 +1,359 @@
1
+ /** Rust Core project.matter.* v1, used by the trusted Desktop bridge. */
2
+ export type MatterStatus = 'pending' | 'in_progress' | 'waiting' | 'delivered' | 'cancelled';
3
+ export type MatterGroup = 'needsYou' | 'active' | 'delivered' | 'cancelled';
4
+ export type MatterCriterion = {
5
+ id: string;
6
+ text: string;
7
+ status?: 'open' | 'met' | 'waived';
8
+ waiverReceiptRef?: string;
9
+ };
10
+ export type MatterBrief = {
11
+ title: string;
12
+ goal: string;
13
+ constraints?: readonly string[];
14
+ doneMeans: string | readonly MatterCriterion[];
15
+ };
16
+ export type MatterSource = {
17
+ kind: string;
18
+ ref?: string;
19
+ };
20
+ export type MatterOrigin = {
21
+ originKind?: 'bot_chat';
22
+ chatId?: string;
23
+ messageId?: string;
24
+ validity: 'available' | 'unavailable';
25
+ reasonCode?: string;
26
+ } | {
27
+ originKind: 'group_chat';
28
+ originGroupChatId: string;
29
+ originMessageId: string;
30
+ workspaceId: string;
31
+ validity: 'available';
32
+ } | {
33
+ originKind: 'group_chat';
34
+ validity: 'unavailable';
35
+ reasonCode: string;
36
+ };
37
+ export type MatterRunRef = {
38
+ matterId: string;
39
+ sessionId: string;
40
+ followUpEpoch: number;
41
+ };
42
+ export type MatterOwner = {
43
+ matterId: string;
44
+ matterNumber?: number;
45
+ followUpEpoch: number;
46
+ runAvailable: boolean;
47
+ };
48
+ export type MatterResultVersion = Omit<MatterRunRef, 'matterId'> & {
49
+ resultRevision: string;
50
+ };
51
+ export type MatterReviewCandidate = MatterResultVersion | {
52
+ kind: 'direct';
53
+ evidenceRefs: readonly string[];
54
+ } | {
55
+ kind: 'waivers';
56
+ };
57
+ export type MatterCriterionReview = {
58
+ criterionId: string;
59
+ status: 'met' | 'open' | 'waived';
60
+ evidenceRefs: readonly string[];
61
+ summary: string;
62
+ waiverReceiptRef?: string;
63
+ };
64
+ export type MatterReviewRequest = {
65
+ candidate: MatterReviewCandidate;
66
+ criteria: readonly MatterCriterionReview[];
67
+ };
68
+ export type MatterReview = MatterReviewRequest & {
69
+ reviewId: string;
70
+ briefRevision: number;
71
+ candidateVersion: unknown;
72
+ reviewedAt: string;
73
+ reviewedBy: string;
74
+ remainingCriteria?: number;
75
+ candidateAvailable?: boolean;
76
+ };
77
+ export type MatterDeliverableKind = 'worktree' | 'branch' | 'commit' | 'diff' | 'pr' | 'file' | 'screenshot' | 'evidence';
78
+ export type MatterDeliverable = {
79
+ deliverableId: string;
80
+ kind: MatterDeliverableKind;
81
+ label: string;
82
+ sourceRef: Readonly<Record<string, unknown>>;
83
+ candidateVersion: string | number | null;
84
+ runRef: MatterRunRef | null;
85
+ validity: 'available' | 'unavailable' | 'changed' | 'restricted' | 'pending';
86
+ reasonCode?: string | null;
87
+ };
88
+ export type MatterActions = Readonly<Record<'send' | 'comment' | 'answer' | 'export' | 'cancel' | 'reopen', boolean>>;
89
+ export type MatterSummary = {
90
+ matterId: string;
91
+ number: number;
92
+ title: string;
93
+ status: MatterStatus;
94
+ needsYou: boolean;
95
+ revision: number;
96
+ briefRevision: number;
97
+ waitReason: string | null;
98
+ cancelReason: string | null;
99
+ cancelSettling: boolean;
100
+ lastEffectiveChangeAt: string;
101
+ };
102
+ export type MatterDecisionDraft = {
103
+ context: string;
104
+ question: string;
105
+ options: readonly {
106
+ id: string;
107
+ label: string;
108
+ summary?: string;
109
+ recommended?: boolean;
110
+ }[];
111
+ approveDoneMeans?: MatterBrief['doneMeans'];
112
+ };
113
+ export type MatterDecision = MatterDecisionDraft & {
114
+ requestId: string;
115
+ coordinationRevision?: number;
116
+ allowFreeText?: boolean;
117
+ answerText?: string;
118
+ answerOptionId?: string;
119
+ answerReceiptId?: string;
120
+ backfeedState?: string;
121
+ };
122
+ export type MatterGit = {
123
+ repo: string | null;
124
+ baseBranch: string | null;
125
+ baseSha: string | null;
126
+ taskBranch: string | null;
127
+ isolation: string | null;
128
+ };
129
+ export type MatterArtifact = {
130
+ kind?: string;
131
+ ref?: string;
132
+ path?: string;
133
+ title?: string;
134
+ label?: string;
135
+ };
136
+ export type MatterDelivery = {
137
+ summary: string;
138
+ deliveredAt: string;
139
+ git?: MatterGit | null;
140
+ evidenceRefs?: readonly string[];
141
+ artifacts?: readonly MatterArtifact[];
142
+ review?: MatterReview;
143
+ deliverables?: readonly MatterDeliverable[];
144
+ };
145
+ export type Matter = MatterBrief & Omit<MatterSummary, 'waitReason'> & {
146
+ origin: MatterSource;
147
+ originChatId?: string;
148
+ originMessageId?: string;
149
+ source?: MatterOrigin | null;
150
+ review?: MatterReview;
151
+ actions?: MatterActions;
152
+ deliverables?: readonly MatterDeliverable[];
153
+ waiting?: {
154
+ reason: string;
155
+ source: MatterSource;
156
+ } | null;
157
+ needsYouDecision?: MatterDecision | null;
158
+ delivery?: MatterDelivery | null;
159
+ deliveryHistory: readonly MatterDelivery[];
160
+ historyWithheld?: boolean;
161
+ };
162
+ export type MatterRun = {
163
+ sessionId: string;
164
+ followUpEpoch: number;
165
+ role: string;
166
+ state: string;
167
+ hostStatus?: string;
168
+ executionMode?: string;
169
+ git?: MatterGit | null;
170
+ deliveryBinding?: import('./delegation.ts').WorkSessionDeliveryBinding;
171
+ liveIsolationLost?: boolean;
172
+ briefRevision?: number | null;
173
+ resultRevision?: string;
174
+ evidenceRefs?: readonly string[];
175
+ acceptance?: {
176
+ acceptedAt: string;
177
+ acceptedBy: string;
178
+ resultRevision?: string;
179
+ } | null;
180
+ };
181
+ export type MatterActivity = {
182
+ activityId: string;
183
+ seq: number;
184
+ kind: string;
185
+ actorKind: string;
186
+ body: string;
187
+ payload: Record<string, unknown>;
188
+ createdAt: string;
189
+ };
190
+ export type MatterActivityPage = {
191
+ items: readonly MatterActivity[];
192
+ snapshotSeq: number;
193
+ throughSeq: number;
194
+ nextCursor: string | null;
195
+ hasMore: boolean;
196
+ watermarks: {
197
+ thread: number;
198
+ coordination: number;
199
+ };
200
+ };
201
+ export type MatterChanged = {
202
+ workspaceId: string;
203
+ matterId: string;
204
+ revision: number;
205
+ };
206
+ export type MatterListPage = {
207
+ limit?: number;
208
+ deliveredLimit?: number;
209
+ } & Partial<Record<`${MatterGroup}Cursor`, string>>;
210
+ export type MatterDetailPage = {
211
+ activityLimit?: number;
212
+ runOffset?: number;
213
+ runLimit?: number;
214
+ } & ({
215
+ afterSeq?: number;
216
+ activityCursor?: never;
217
+ } | {
218
+ activityCursor: string;
219
+ afterSeq?: never;
220
+ });
221
+ type Scope = {
222
+ workspaceId: string;
223
+ version?: 1;
224
+ };
225
+ type Write = Scope & {
226
+ operationId: string;
227
+ };
228
+ type Target = {
229
+ matterId: string;
230
+ };
231
+ type CAS = {
232
+ revision: number;
233
+ briefRevision?: number;
234
+ };
235
+ type Answer = {
236
+ decisionRevision?: number;
237
+ } & ({
238
+ requestId: string;
239
+ decisionId?: never;
240
+ } | {
241
+ decisionId: string;
242
+ requestId?: never;
243
+ }) & ({
244
+ optionId: string;
245
+ text?: never;
246
+ } | {
247
+ text: string;
248
+ optionId?: never;
249
+ });
250
+ type Patch = {
251
+ brief?: MatterBrief;
252
+ status?: MatterStatus;
253
+ waiting?: {
254
+ reason: string;
255
+ source: MatterSource & {
256
+ ref: string;
257
+ };
258
+ };
259
+ decision?: MatterDecisionDraft;
260
+ userReceiptRef?: string;
261
+ review?: MatterReviewRequest;
262
+ linkPr?: {
263
+ reviewId: string;
264
+ evidenceRef: string;
265
+ };
266
+ delivery?: {
267
+ summary: string;
268
+ reviewId: string;
269
+ } | {
270
+ summary: string;
271
+ sessionId?: string;
272
+ followUpEpoch?: number;
273
+ };
274
+ };
275
+ export type MatterList = Record<MatterGroup, readonly MatterSummary[]> & Record<`${MatterGroup}Cursor`, string | null> & {
276
+ activeCount: number;
277
+ cancelledCount: number;
278
+ };
279
+ export type MatterDetail = {
280
+ matter: Matter;
281
+ activities: readonly MatterActivity[];
282
+ runs: readonly MatterRun[];
283
+ activityPage: MatterActivityPage;
284
+ lastActivitySeq: number;
285
+ nextActivitySeq: number | null;
286
+ nextRunOffset: number | null;
287
+ };
288
+ type Receipt = Target & CAS & {
289
+ number: number;
290
+ status: MatterStatus;
291
+ seq?: number;
292
+ activityId?: string;
293
+ reviewId?: string | null;
294
+ };
295
+ interface MatterRequests {
296
+ list: Scope & {
297
+ page?: MatterListPage;
298
+ };
299
+ get: Scope & Target & {
300
+ page?: MatterDetailPage;
301
+ };
302
+ create: Write & {
303
+ brief: MatterBrief;
304
+ };
305
+ update: Write & Target & CAS & {
306
+ patch: Patch;
307
+ };
308
+ comment: Write & Target & {
309
+ body: string;
310
+ };
311
+ answer_decision: Write & Target & CAS & {
312
+ answer: Answer;
313
+ };
314
+ reopen: Write & Target & CAS & {
315
+ reason: string;
316
+ };
317
+ cancel: Write & Target & CAS & {
318
+ reason: string;
319
+ };
320
+ claim_session: Write & {
321
+ claim: {
322
+ sessionId: string;
323
+ } & ({
324
+ brief: MatterBrief;
325
+ } | (Target & Pick<CAS, 'revision'>));
326
+ };
327
+ export_markdown: Scope & Target;
328
+ resolve_deliverable: Scope & Target & {
329
+ deliverableId: string;
330
+ };
331
+ }
332
+ type ReadResults = {
333
+ list: MatterList;
334
+ get: MatterDetail;
335
+ export_markdown: Target & {
336
+ markdown: string;
337
+ };
338
+ resolve_deliverable: {
339
+ deliverable: MatterDeliverable;
340
+ path?: string;
341
+ text?: string;
342
+ dataUrl?: string;
343
+ url?: string;
344
+ };
345
+ };
346
+ type MatterFailure = {
347
+ ok: false;
348
+ code: string;
349
+ revision?: number;
350
+ briefRevision?: number;
351
+ };
352
+ export type MatterResult<K extends keyof MatterRequests> = MatterFailure | ({
353
+ ok: true;
354
+ version: 1;
355
+ } & (K extends keyof ReadResults ? ReadResults[K] : Receipt));
356
+ export type ProjectMatterRpc = <K extends keyof MatterRequests>(request: MatterRequests[K] & {
357
+ method: K;
358
+ }) => Promise<MatterResult<K>>;
359
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,43 @@
1
+ /** Local maintenance controls. These commands never accept an execution verdict or a filesystem path. */
2
+ export interface ProjectRecoveryRequest {
3
+ readonly workspaceId: string;
4
+ /** `retain_all` ends every held work and child task in the plan bound by `planToken`; it never accepts ids. */
5
+ readonly action: 'inspect' | 'restore' | 'retain' | 'retain_all';
6
+ readonly planToken?: string;
7
+ readonly workId?: string;
8
+ readonly sessionId?: string;
9
+ }
10
+ export interface ProjectRecoveryWork {
11
+ readonly workId: string;
12
+ readonly title: string;
13
+ readonly disposition: 'held' | 'resume';
14
+ readonly reason: string;
15
+ }
16
+ export interface ProjectRecoveryView {
17
+ readonly phase: 'occupied' | 'inspection' | 'stopping' | 'backing_up' | 'restoring' | 'reconciling' | 'ready' | 'failed';
18
+ readonly planToken?: string;
19
+ readonly restored: boolean;
20
+ readonly canContinue: boolean;
21
+ readonly runtimeReady: boolean;
22
+ readonly completedCount: number;
23
+ readonly works: readonly ProjectRecoveryWork[];
24
+ readonly sessions: readonly {
25
+ readonly sessionId: string;
26
+ readonly title: string;
27
+ }[];
28
+ readonly holder?: {
29
+ readonly surface: 'desktop' | 'tui';
30
+ readonly version: string;
31
+ };
32
+ readonly backupAvailable: boolean;
33
+ readonly backupLocation?: string;
34
+ readonly code?: string;
35
+ }
36
+ export type ProjectRecoveryResult = {
37
+ readonly ok: true;
38
+ readonly view: ProjectRecoveryView;
39
+ } | {
40
+ readonly ok: false;
41
+ readonly code: string;
42
+ readonly view?: ProjectRecoveryView;
43
+ };
@@ -0,0 +1 @@
1
+ export {};