@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.
- package/dist/acceptance-close-gate.d.ts +10 -1
- package/dist/acceptance-close-gate.js +12 -0
- package/dist/agent-supervision.d.ts +81 -0
- package/dist/agent-supervision.js +1 -0
- package/dist/attention.d.ts +44 -0
- package/dist/attention.js +1 -0
- package/dist/bot-access-policy.d.ts +29 -0
- package/dist/bot-access-policy.js +1 -0
- package/dist/bot-conversation-read.d.ts +67 -0
- package/dist/bot-conversation-read.js +9 -0
- package/dist/bot-direct-step.d.ts +11 -0
- package/dist/bot-direct-step.js +1 -0
- package/dist/bot-git.d.ts +55 -0
- package/dist/bot-git.js +1 -0
- package/dist/bot-model-selection.d.ts +13 -0
- package/dist/bot-model-selection.js +1 -0
- package/dist/browser-window.d.ts +48 -0
- package/dist/browser-window.js +23 -0
- package/dist/capability-admission.d.ts +20 -0
- package/dist/capability-admission.js +1 -0
- package/dist/compaction-history-selection.d.ts +15 -0
- package/dist/compaction-history-selection.js +30 -0
- package/dist/compaction.d.ts +5 -0
- package/dist/compaction.js +6 -0
- package/dist/context-accounting.d.ts +3 -0
- package/dist/conversation-execution.d.ts +68 -0
- package/dist/conversation-execution.js +222 -0
- package/dist/delegation-coordination.d.ts +81 -0
- package/dist/delegation-coordination.js +1 -0
- package/dist/delegation.d.ts +260 -7
- package/dist/delegation.js +97 -39
- package/dist/document-reference.d.ts +111 -0
- package/dist/document-reference.js +1 -0
- package/dist/evidence-inspection.d.ts +84 -0
- package/dist/evidence-inspection.js +1 -0
- package/dist/gemini-standard-pricing.json +105 -0
- package/dist/goal.d.ts +50 -2
- package/dist/group-chat.d.ts +87 -0
- package/dist/group-chat.js +1 -0
- package/dist/hook-observation.d.ts +2 -0
- package/dist/hook-observation.js +19 -0
- package/dist/index.d.ts +117 -25
- package/dist/index.js +41 -0
- package/dist/input-prediction.d.ts +86 -0
- package/dist/input-prediction.js +48 -0
- package/dist/intent-coordination.d.ts +201 -0
- package/dist/intent-coordination.js +1 -0
- package/dist/interactive-result.d.ts +363 -0
- package/dist/interactive-result.js +215 -0
- package/dist/interactive-verification.d.ts +41 -0
- package/dist/interactive-verification.js +65 -0
- package/dist/local-git.d.ts +44 -0
- package/dist/local-git.js +3 -0
- package/dist/local-image.d.ts +53 -0
- package/dist/local-image.js +5 -0
- package/dist/local-read.d.ts +9 -0
- package/dist/local-read.js +1 -0
- package/dist/memory.d.ts +117 -12
- package/dist/memory.js +12 -0
- package/dist/model-reasoning.d.ts +16 -0
- package/dist/model-reasoning.js +25 -0
- package/dist/model-routing.d.ts +39 -3
- package/dist/model-routing.js +31 -5
- package/dist/native-process.d.ts +21 -0
- package/dist/native-process.js +51 -0
- package/dist/parent-coordination.d.ts +104 -0
- package/dist/parent-coordination.js +2 -0
- package/dist/persistent-workspace.d.ts +519 -0
- package/dist/persistent-workspace.js +1 -0
- package/dist/project-agent-failure.d.ts +30 -0
- package/dist/project-agent-failure.js +44 -0
- package/dist/project-input-recovery.d.ts +83 -0
- package/dist/project-input-recovery.js +25 -0
- package/dist/project-matter.d.ts +359 -0
- package/dist/project-matter.js +1 -0
- package/dist/project-recovery.d.ts +43 -0
- package/dist/project-recovery.js +1 -0
- package/dist/project.d.ts +233 -0
- package/dist/project.js +134 -5
- package/dist/prompt-skill.d.ts +31 -0
- package/dist/prompt-skill.js +1 -0
- package/dist/quiet-reply.d.ts +9 -0
- package/dist/quiet-reply.js +43 -0
- package/dist/remote-access.d.ts +15 -0
- package/dist/remote-access.js +1 -1
- package/dist/reply-delivery.d.ts +28 -0
- package/dist/reply-delivery.js +1 -0
- package/dist/resource-edit-execution.d.ts +68 -0
- package/dist/resource-edit-execution.js +96 -0
- package/dist/resource-edit.d.ts +237 -0
- package/dist/resource-edit.js +134 -0
- package/dist/resource-feedback-transport.d.ts +26 -0
- package/dist/resource-feedback-transport.js +94 -0
- package/dist/resource-feedback.d.ts +110 -0
- package/dist/resource-feedback.js +168 -0
- package/dist/resource-file-replace.d.ts +36 -0
- package/dist/resource-file-replace.js +40 -0
- package/dist/resource-reference-hints.d.ts +3 -0
- package/dist/resource-reference-hints.js +58 -0
- package/dist/resource-window.d.ts +222 -0
- package/dist/resource-window.js +252 -0
- package/dist/routine.d.ts +82 -0
- package/dist/routine.js +1 -0
- package/dist/runtime-session-facts.d.ts +58 -0
- package/dist/runtime-session-facts.js +57 -0
- package/dist/session-control.d.ts +211 -0
- package/dist/session-control.js +48 -0
- package/dist/session-facts.d.ts +29 -0
- package/dist/session-facts.js +35 -0
- package/dist/skill-marketplace.d.ts +39 -4
- package/dist/spend-budget.d.ts +69 -0
- package/dist/spend-budget.js +1 -0
- package/dist/system-context.d.ts +7 -0
- package/dist/task-overview.d.ts +91 -0
- package/dist/task-overview.js +325 -17
- package/dist/tool-activity-preview.d.ts +4 -0
- package/dist/tool-activity-preview.js +72 -0
- package/dist/updater.d.ts +13 -3
- package/dist/usage-accounting.d.ts +42 -1
- package/dist/user-anchor.d.ts +17 -0
- package/dist/user-anchor.js +1 -0
- package/dist/work-coordination.d.ts +188 -0
- package/dist/work-coordination.js +1 -0
- package/dist/work-hook.d.ts +3 -0
- package/dist/work-hook.js +76 -0
- package/dist/working-plan.d.ts +18 -0
- package/dist/working-plan.js +1 -0
- package/dist/workspace.d.ts +35 -0
- package/dist/workspace.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,519 @@
|
|
|
1
|
+
import type { GroupChatChanged, GroupChatMeta, GroupChatSend, GroupChatSendReceipt, GroupChatView, GroupChatWindow } from './group-chat.ts';
|
|
2
|
+
import type { Routine, RoutineChanged, RoutineDefinition, RoutineListItem, RoutineRun, RoutineRunStatus, RoutineTargetKind } from './routine.ts';
|
|
3
|
+
import type { MemoryRef } from './memory.ts';
|
|
4
|
+
export interface WorkspaceFailure {
|
|
5
|
+
readonly ok: false;
|
|
6
|
+
readonly code: string;
|
|
7
|
+
readonly revision?: number | string | null;
|
|
8
|
+
readonly policyRevision?: number;
|
|
9
|
+
readonly diagnostic?: {
|
|
10
|
+
readonly field: string;
|
|
11
|
+
readonly line: number;
|
|
12
|
+
readonly kind: string;
|
|
13
|
+
};
|
|
14
|
+
readonly matterRef?: PageMatterRef;
|
|
15
|
+
}
|
|
16
|
+
type Result<T> = ({
|
|
17
|
+
readonly ok: true;
|
|
18
|
+
} & T) | WorkspaceFailure;
|
|
19
|
+
type Wire<P, R> = {
|
|
20
|
+
readonly params: P;
|
|
21
|
+
readonly result: Result<R>;
|
|
22
|
+
};
|
|
23
|
+
type Empty = Record<string, never>;
|
|
24
|
+
export type IndexQuery = {
|
|
25
|
+
readonly cursor?: string;
|
|
26
|
+
readonly limit?: number;
|
|
27
|
+
};
|
|
28
|
+
export type IndexWindow<T> = {
|
|
29
|
+
readonly items: readonly T[];
|
|
30
|
+
readonly nextCursor: string | null;
|
|
31
|
+
readonly snapshotRevision: string;
|
|
32
|
+
};
|
|
33
|
+
export type PresenceEntityKind = 'bot' | 'group';
|
|
34
|
+
export type PresenceState = 'idle' | 'working' | 'needs_you' | 'blocked' | 'done_recent';
|
|
35
|
+
export interface PresenceSnapshot {
|
|
36
|
+
readonly entityId: string;
|
|
37
|
+
readonly entityKind: PresenceEntityKind;
|
|
38
|
+
readonly state: PresenceState;
|
|
39
|
+
readonly activitySummary: string;
|
|
40
|
+
readonly activeMatterCount: number;
|
|
41
|
+
readonly pendingApprovalCount: number;
|
|
42
|
+
readonly activeRunCount: number;
|
|
43
|
+
readonly sourceLabel?: string;
|
|
44
|
+
readonly completionId?: string;
|
|
45
|
+
readonly updatedAt: string;
|
|
46
|
+
readonly revision: number;
|
|
47
|
+
}
|
|
48
|
+
export type PresenceChanged = Pick<PresenceSnapshot, 'entityId' | 'entityKind' | 'state' | 'revision'> & {
|
|
49
|
+
readonly serverGeneration: string;
|
|
50
|
+
};
|
|
51
|
+
export type VaultBotScope = {
|
|
52
|
+
readonly kind: 'global';
|
|
53
|
+
} | {
|
|
54
|
+
readonly kind: 'bot';
|
|
55
|
+
readonly botId: string;
|
|
56
|
+
};
|
|
57
|
+
export interface VaultRepoIdentity {
|
|
58
|
+
readonly path: string;
|
|
59
|
+
readonly repositoryKey: string;
|
|
60
|
+
}
|
|
61
|
+
export type VaultScopeConstraint = {
|
|
62
|
+
readonly kind: 'exact_path' | 'subtree';
|
|
63
|
+
readonly path: string;
|
|
64
|
+
} | {
|
|
65
|
+
readonly kind: 'repo_identity';
|
|
66
|
+
readonly repository: VaultRepoIdentity;
|
|
67
|
+
} | {
|
|
68
|
+
readonly kind: 'page_id';
|
|
69
|
+
readonly pageId: string;
|
|
70
|
+
} | {
|
|
71
|
+
readonly kind: 'structured_command';
|
|
72
|
+
readonly repository: VaultRepoIdentity;
|
|
73
|
+
readonly command: 'git_query';
|
|
74
|
+
readonly argumentPrefix: readonly ('snapshot' | 'status' | 'log')[];
|
|
75
|
+
};
|
|
76
|
+
export type VaultRuleDecision = 'allow_always' | 'ask_first' | 'deny';
|
|
77
|
+
export interface VaultApprovalRule {
|
|
78
|
+
readonly id: string;
|
|
79
|
+
readonly botScope: VaultBotScope;
|
|
80
|
+
readonly capability: string;
|
|
81
|
+
readonly scopeConstraint: VaultScopeConstraint;
|
|
82
|
+
readonly decision: VaultRuleDecision;
|
|
83
|
+
readonly createdAt: string;
|
|
84
|
+
readonly lastMatchedAt?: string;
|
|
85
|
+
readonly matchCount: number;
|
|
86
|
+
readonly revision: number;
|
|
87
|
+
readonly revokedAt?: string;
|
|
88
|
+
readonly source: {
|
|
89
|
+
readonly kind: 'local_user';
|
|
90
|
+
} | {
|
|
91
|
+
readonly kind: 'approval';
|
|
92
|
+
readonly approvalId: string;
|
|
93
|
+
} | {
|
|
94
|
+
readonly kind: 'image_permission';
|
|
95
|
+
readonly conversationId: string;
|
|
96
|
+
readonly expiresAt: number;
|
|
97
|
+
readonly policyRevision?: string;
|
|
98
|
+
readonly fileIdentity: {
|
|
99
|
+
readonly dev: number;
|
|
100
|
+
readonly ino: number;
|
|
101
|
+
readonly size: number;
|
|
102
|
+
readonly mtimeMs: number;
|
|
103
|
+
readonly ctimeMs: number;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
export interface VaultTemplateSummary {
|
|
108
|
+
readonly id: string;
|
|
109
|
+
readonly title: string;
|
|
110
|
+
readonly revision: string;
|
|
111
|
+
readonly archived: boolean;
|
|
112
|
+
}
|
|
113
|
+
export type VaultTemplate = VaultTemplateSummary & {
|
|
114
|
+
readonly content: string;
|
|
115
|
+
};
|
|
116
|
+
export type VaultGlobalRules = {
|
|
117
|
+
readonly revision: string;
|
|
118
|
+
readonly content: string;
|
|
119
|
+
};
|
|
120
|
+
export interface VaultSummary {
|
|
121
|
+
readonly globalRules: {
|
|
122
|
+
readonly revision: string;
|
|
123
|
+
} | WorkspaceFailure;
|
|
124
|
+
readonly templates: readonly VaultTemplateSummary[];
|
|
125
|
+
readonly memoryIndexes: readonly {
|
|
126
|
+
readonly botId: string;
|
|
127
|
+
readonly index: MemoryRef;
|
|
128
|
+
readonly topics: readonly MemoryRef[];
|
|
129
|
+
}[];
|
|
130
|
+
readonly approvalRules: {
|
|
131
|
+
readonly active: number;
|
|
132
|
+
readonly revoked: number;
|
|
133
|
+
} | WorkspaceFailure;
|
|
134
|
+
}
|
|
135
|
+
export type VaultChanged = {
|
|
136
|
+
readonly scope: VaultBotScope;
|
|
137
|
+
} & ({
|
|
138
|
+
readonly type: 'global_rules' | 'template';
|
|
139
|
+
readonly revision: string;
|
|
140
|
+
} | {
|
|
141
|
+
readonly type: 'rule';
|
|
142
|
+
readonly revision: number;
|
|
143
|
+
});
|
|
144
|
+
export type BotApprovalDecision = 'allow_once' | 'allow_always' | 'deny';
|
|
145
|
+
export type WorkerApprovalDecision = 'allow_once' | 'allow_task' | 'deny';
|
|
146
|
+
export type DecideBotApproval = {
|
|
147
|
+
readonly workspaceId: string;
|
|
148
|
+
readonly approvalId: string;
|
|
149
|
+
readonly selectedUploadPath?: string;
|
|
150
|
+
} & ({
|
|
151
|
+
readonly decision: 'approve' | 'reject' | 'deny' | 'cancel';
|
|
152
|
+
readonly duration?: 'once' | 'task' | 'denied';
|
|
153
|
+
} | {
|
|
154
|
+
readonly decision: BotApprovalDecision;
|
|
155
|
+
readonly operationId: string;
|
|
156
|
+
readonly expectedPolicyRevision: number | string;
|
|
157
|
+
readonly ruleScopeOverride?: VaultScopeConstraint;
|
|
158
|
+
});
|
|
159
|
+
export type DecideBotApprovalResult = Result<{
|
|
160
|
+
readonly approval?: unknown;
|
|
161
|
+
readonly ruleId?: string;
|
|
162
|
+
readonly scopeConstraint?: VaultScopeConstraint;
|
|
163
|
+
readonly revision?: number;
|
|
164
|
+
readonly decisionPending?: boolean;
|
|
165
|
+
}>;
|
|
166
|
+
export type PageKind = 'matter_dossier' | 'document';
|
|
167
|
+
export type PageFormat = 'markdown' | 'html_canvas';
|
|
168
|
+
export type PageMatterRef = {
|
|
169
|
+
readonly workspaceId: string;
|
|
170
|
+
readonly matterId: string;
|
|
171
|
+
};
|
|
172
|
+
export type PageOrigin = PageMatterRef & {
|
|
173
|
+
readonly kind: 'matter';
|
|
174
|
+
};
|
|
175
|
+
export interface PageRecord {
|
|
176
|
+
readonly id: string;
|
|
177
|
+
readonly kind: PageKind;
|
|
178
|
+
readonly title: string;
|
|
179
|
+
readonly format?: PageFormat;
|
|
180
|
+
readonly ownerBotId: string;
|
|
181
|
+
readonly groupChatId?: string;
|
|
182
|
+
readonly originRef?: PageOrigin;
|
|
183
|
+
readonly revision: number;
|
|
184
|
+
readonly updatedAt: string;
|
|
185
|
+
readonly pinned: boolean;
|
|
186
|
+
readonly pinRevision: number;
|
|
187
|
+
readonly archived: boolean;
|
|
188
|
+
readonly status?: string;
|
|
189
|
+
readonly verifiedCount?: number;
|
|
190
|
+
readonly checkCount?: number;
|
|
191
|
+
readonly waivedCount?: number;
|
|
192
|
+
readonly deliverableCount?: number;
|
|
193
|
+
}
|
|
194
|
+
export type PageWrite = {
|
|
195
|
+
readonly operationId: string;
|
|
196
|
+
readonly pageId: string;
|
|
197
|
+
readonly expectedRevision: number;
|
|
198
|
+
};
|
|
199
|
+
export type PageContent = {
|
|
200
|
+
readonly title: string;
|
|
201
|
+
readonly format: PageFormat;
|
|
202
|
+
readonly content: string;
|
|
203
|
+
};
|
|
204
|
+
export type PageVersion = {
|
|
205
|
+
readonly revision: number;
|
|
206
|
+
readonly updatedAt: string;
|
|
207
|
+
readonly title: string;
|
|
208
|
+
readonly format: PageFormat;
|
|
209
|
+
readonly sha256: string;
|
|
210
|
+
readonly archived: boolean;
|
|
211
|
+
readonly restoredFrom: number | null;
|
|
212
|
+
};
|
|
213
|
+
export type PageUpdated = {
|
|
214
|
+
readonly pageId: string;
|
|
215
|
+
readonly revision: number;
|
|
216
|
+
readonly reason: 'created' | 'updated' | 'restored' | 'archived' | 'pinned';
|
|
217
|
+
};
|
|
218
|
+
type GroupTarget = {
|
|
219
|
+
readonly groupChatId: string;
|
|
220
|
+
};
|
|
221
|
+
type GroupWrite = GroupTarget & {
|
|
222
|
+
readonly operationId: string;
|
|
223
|
+
readonly expectedRevision: number;
|
|
224
|
+
};
|
|
225
|
+
type GroupDetails = Pick<GroupChatMeta, 'title' | 'memberBotIds'> & Partial<Pick<GroupChatMeta, 'description' | 'coordinatorBotId'>>;
|
|
226
|
+
type RoutineWrite = {
|
|
227
|
+
readonly routineId: string;
|
|
228
|
+
readonly operationId: string;
|
|
229
|
+
readonly expectedRevision: number;
|
|
230
|
+
};
|
|
231
|
+
export interface BrowserProfileView {
|
|
232
|
+
readonly workspaceId: string;
|
|
233
|
+
readonly ownerBotId: string;
|
|
234
|
+
readonly profileId: string;
|
|
235
|
+
readonly name: string;
|
|
236
|
+
}
|
|
237
|
+
export interface BrowserTabChoice {
|
|
238
|
+
readonly targetId: string;
|
|
239
|
+
readonly origin: string;
|
|
240
|
+
}
|
|
241
|
+
export type BrowserControlAction = {
|
|
242
|
+
action: 'status' | 'sessions' | 'profiles';
|
|
243
|
+
} | {
|
|
244
|
+
action: 'create_profile';
|
|
245
|
+
name: string;
|
|
246
|
+
} | {
|
|
247
|
+
action: 'delete_profile' | 'select_profile';
|
|
248
|
+
profileId: string;
|
|
249
|
+
} | {
|
|
250
|
+
action: 'discover';
|
|
251
|
+
endpointFile: string;
|
|
252
|
+
discoveryId?: string;
|
|
253
|
+
} | {
|
|
254
|
+
action: 'attach';
|
|
255
|
+
instanceId: string;
|
|
256
|
+
targetId: string;
|
|
257
|
+
ttlSeconds: number;
|
|
258
|
+
} | {
|
|
259
|
+
action: 'detach' | 'revoke';
|
|
260
|
+
selectionId: string;
|
|
261
|
+
};
|
|
262
|
+
export interface BrowserSelectionView {
|
|
263
|
+
readonly selectionId: string;
|
|
264
|
+
readonly details: {
|
|
265
|
+
readonly targetKind: 'explicit_attach' | 'managed_isolated';
|
|
266
|
+
readonly origin?: string;
|
|
267
|
+
readonly profile?: BrowserProfileView;
|
|
268
|
+
readonly targetId?: string;
|
|
269
|
+
readonly profileCategory?: 'external';
|
|
270
|
+
readonly connectionGeneration?: number;
|
|
271
|
+
readonly ttlSeconds?: number;
|
|
272
|
+
};
|
|
273
|
+
readonly turnId?: string | null;
|
|
274
|
+
readonly expiresInSeconds: number;
|
|
275
|
+
}
|
|
276
|
+
export interface BrowserControlResult {
|
|
277
|
+
readonly defaultTarget?: 'embedded_workbench' | 'managed_isolated';
|
|
278
|
+
readonly takeover?: {
|
|
279
|
+
readonly available: true;
|
|
280
|
+
readonly surface: 'embedded_workbench';
|
|
281
|
+
readonly workspaceId: string;
|
|
282
|
+
readonly conversationId: string;
|
|
283
|
+
} | {
|
|
284
|
+
readonly available: false;
|
|
285
|
+
readonly reason: 'TARGET_NOT_EMBEDDED' | 'NO_FOREGROUND_DESKTOP';
|
|
286
|
+
readonly entry: string | null;
|
|
287
|
+
};
|
|
288
|
+
readonly details?: BrowserSelectionView['details'];
|
|
289
|
+
readonly expiresInSeconds?: number;
|
|
290
|
+
readonly deleted?: boolean;
|
|
291
|
+
readonly disconnected?: boolean;
|
|
292
|
+
readonly profiles?: readonly BrowserProfileView[];
|
|
293
|
+
readonly profile?: BrowserProfileView;
|
|
294
|
+
readonly instanceId?: string;
|
|
295
|
+
readonly tabs?: readonly BrowserTabChoice[];
|
|
296
|
+
readonly selectionId?: string;
|
|
297
|
+
readonly session?: {
|
|
298
|
+
readonly targetKind: string;
|
|
299
|
+
readonly profileId: string;
|
|
300
|
+
readonly headed: boolean;
|
|
301
|
+
} | null;
|
|
302
|
+
readonly selections?: readonly BrowserSelectionView[];
|
|
303
|
+
}
|
|
304
|
+
export interface PersistentWorkspaceRpc {
|
|
305
|
+
readonly 'browser.control': Wire<{
|
|
306
|
+
workspaceId: string;
|
|
307
|
+
conversationId: string;
|
|
308
|
+
} & BrowserControlAction, BrowserControlResult>;
|
|
309
|
+
readonly 'group.chat.list': Wire<IndexQuery & {
|
|
310
|
+
readonly archived?: boolean;
|
|
311
|
+
}, IndexWindow<GroupChatView>>;
|
|
312
|
+
readonly 'group.chat.get': Wire<GroupTarget, GroupChatView>;
|
|
313
|
+
readonly 'group.chat.create': Wire<GroupDetails & {
|
|
314
|
+
readonly operationId: string;
|
|
315
|
+
}, {
|
|
316
|
+
readonly meta: GroupChatMeta;
|
|
317
|
+
}>;
|
|
318
|
+
readonly 'group.chat.update': Wire<GroupWrite & {
|
|
319
|
+
readonly patch: Partial<GroupDetails>;
|
|
320
|
+
}, {
|
|
321
|
+
readonly meta: GroupChatMeta;
|
|
322
|
+
}>;
|
|
323
|
+
readonly 'group.chat.archive': Wire<GroupWrite, {
|
|
324
|
+
readonly meta: GroupChatMeta;
|
|
325
|
+
}>;
|
|
326
|
+
readonly 'group.chat.window': Wire<GroupTarget & {
|
|
327
|
+
readonly limit?: number;
|
|
328
|
+
} & ({
|
|
329
|
+
readonly beforeCursor?: string;
|
|
330
|
+
readonly afterSeq?: never;
|
|
331
|
+
} | {
|
|
332
|
+
readonly beforeCursor?: never;
|
|
333
|
+
readonly afterSeq: number;
|
|
334
|
+
}), GroupChatWindow>;
|
|
335
|
+
readonly 'group.chat.send': Wire<GroupChatSend, GroupChatSendReceipt>;
|
|
336
|
+
readonly 'group.chat.cancel': Wire<GroupTarget & {
|
|
337
|
+
readonly turnId: string;
|
|
338
|
+
readonly scope: 'current_speaker' | 'turn';
|
|
339
|
+
}, {
|
|
340
|
+
readonly turnId: string;
|
|
341
|
+
readonly status: 'cancelling' | 'completed' | 'failed' | 'cancelled' | 'unknown';
|
|
342
|
+
}>;
|
|
343
|
+
readonly 'group.chat.newConversation': Wire<GroupWrite, {
|
|
344
|
+
readonly boundaryId: string;
|
|
345
|
+
readonly seq: number;
|
|
346
|
+
readonly revision: number;
|
|
347
|
+
}>;
|
|
348
|
+
readonly 'routine.list': Wire<IndexQuery & {
|
|
349
|
+
readonly targetKind?: RoutineTargetKind;
|
|
350
|
+
readonly targetId?: string;
|
|
351
|
+
readonly enabled?: boolean;
|
|
352
|
+
readonly archived?: boolean;
|
|
353
|
+
}, IndexWindow<RoutineListItem> & {
|
|
354
|
+
readonly globallyPaused: boolean;
|
|
355
|
+
}>;
|
|
356
|
+
readonly 'routine.create': Wire<{
|
|
357
|
+
readonly definition: RoutineDefinition;
|
|
358
|
+
readonly operationId: string;
|
|
359
|
+
}, {
|
|
360
|
+
readonly routine: Routine;
|
|
361
|
+
}>;
|
|
362
|
+
readonly 'routine.update': Wire<RoutineWrite & {
|
|
363
|
+
readonly patch: Partial<RoutineDefinition>;
|
|
364
|
+
}, {
|
|
365
|
+
readonly routine: Routine;
|
|
366
|
+
}>;
|
|
367
|
+
readonly 'routine.toggle': Wire<RoutineWrite & {
|
|
368
|
+
readonly enabled: boolean;
|
|
369
|
+
}, {
|
|
370
|
+
readonly routine: Routine;
|
|
371
|
+
}>;
|
|
372
|
+
readonly 'routine.run_now': Wire<RoutineWrite & {
|
|
373
|
+
readonly retryOf?: string;
|
|
374
|
+
}, {
|
|
375
|
+
readonly runId: string;
|
|
376
|
+
readonly status: RoutineRunStatus;
|
|
377
|
+
}>;
|
|
378
|
+
readonly 'routine.runs': Wire<IndexQuery & {
|
|
379
|
+
readonly routineId: string;
|
|
380
|
+
}, IndexWindow<RoutineRun>>;
|
|
381
|
+
readonly 'routine.delete': Wire<RoutineWrite & {
|
|
382
|
+
readonly confirmed: true;
|
|
383
|
+
}, {
|
|
384
|
+
readonly routine: Routine;
|
|
385
|
+
}>;
|
|
386
|
+
readonly 'presence.snapshot': Wire<{
|
|
387
|
+
readonly entityIds?: readonly string[];
|
|
388
|
+
readonly entityKind?: PresenceEntityKind;
|
|
389
|
+
}, {
|
|
390
|
+
readonly serverGeneration: string;
|
|
391
|
+
readonly snapshots: readonly PresenceSnapshot[];
|
|
392
|
+
}>;
|
|
393
|
+
readonly 'presence.markRead': Wire<{
|
|
394
|
+
readonly entityId: string;
|
|
395
|
+
readonly entityKind?: PresenceEntityKind;
|
|
396
|
+
readonly completionId: string;
|
|
397
|
+
readonly operationId: string;
|
|
398
|
+
}, {
|
|
399
|
+
readonly completionId: string;
|
|
400
|
+
}>;
|
|
401
|
+
readonly 'vault.summary': Wire<Empty, VaultSummary>;
|
|
402
|
+
readonly 'vault.global_rules.get': Wire<Empty, VaultGlobalRules>;
|
|
403
|
+
readonly 'vault.global_rules.set': Wire<{
|
|
404
|
+
readonly content: string;
|
|
405
|
+
readonly expectedRevision: string;
|
|
406
|
+
readonly operationId: string;
|
|
407
|
+
}, VaultGlobalRules>;
|
|
408
|
+
readonly 'vault.templates.list': Wire<IndexQuery, IndexWindow<VaultTemplateSummary>>;
|
|
409
|
+
readonly 'vault.templates.get': Wire<{
|
|
410
|
+
readonly templateId: string;
|
|
411
|
+
}, {
|
|
412
|
+
readonly template: VaultTemplate;
|
|
413
|
+
}>;
|
|
414
|
+
readonly 'vault.templates.save': Wire<{
|
|
415
|
+
readonly templateId?: string;
|
|
416
|
+
readonly title: string;
|
|
417
|
+
readonly content: string;
|
|
418
|
+
readonly expectedRevision?: string;
|
|
419
|
+
readonly operationId: string;
|
|
420
|
+
}, {
|
|
421
|
+
readonly template: VaultTemplate;
|
|
422
|
+
}>;
|
|
423
|
+
readonly 'vault.templates.delete': Wire<{
|
|
424
|
+
readonly templateId: string;
|
|
425
|
+
readonly expectedRevision: string;
|
|
426
|
+
readonly operationId: string;
|
|
427
|
+
}, {
|
|
428
|
+
readonly template: VaultTemplateSummary;
|
|
429
|
+
}>;
|
|
430
|
+
readonly 'vault.rules.list': Wire<IndexQuery & {
|
|
431
|
+
readonly botScope?: VaultBotScope;
|
|
432
|
+
readonly decision?: VaultRuleDecision;
|
|
433
|
+
readonly includeRevoked?: boolean;
|
|
434
|
+
}, IndexWindow<VaultApprovalRule>>;
|
|
435
|
+
readonly 'vault.rules.upsert': Wire<{
|
|
436
|
+
readonly rule: Pick<VaultApprovalRule, 'botScope' | 'capability' | 'scopeConstraint' | 'decision'> & {
|
|
437
|
+
readonly id?: string;
|
|
438
|
+
};
|
|
439
|
+
readonly expectedRevision?: number;
|
|
440
|
+
readonly operationId: string;
|
|
441
|
+
}, {
|
|
442
|
+
readonly rule: VaultApprovalRule;
|
|
443
|
+
}>;
|
|
444
|
+
readonly 'vault.browserGrants.revoke': Wire<{
|
|
445
|
+
readonly workspaceId: string;
|
|
446
|
+
readonly conversationId: string;
|
|
447
|
+
readonly toolCallId: string;
|
|
448
|
+
readonly operationId: string;
|
|
449
|
+
}, {
|
|
450
|
+
readonly revoked: true;
|
|
451
|
+
readonly toolCallId: string;
|
|
452
|
+
}>;
|
|
453
|
+
readonly 'vault.rules.revoke': Wire<{
|
|
454
|
+
readonly ruleId: string;
|
|
455
|
+
readonly expectedRevision: number;
|
|
456
|
+
readonly operationId: string;
|
|
457
|
+
}, {
|
|
458
|
+
readonly rule: VaultApprovalRule;
|
|
459
|
+
}>;
|
|
460
|
+
readonly 'page.list': Wire<IndexQuery & {
|
|
461
|
+
readonly kind?: PageKind;
|
|
462
|
+
readonly botId?: string;
|
|
463
|
+
readonly groupChatId?: string;
|
|
464
|
+
readonly pinned?: boolean;
|
|
465
|
+
readonly query?: string;
|
|
466
|
+
}, IndexWindow<PageRecord>>;
|
|
467
|
+
readonly 'page.get': Wire<{
|
|
468
|
+
readonly pageId: string;
|
|
469
|
+
readonly revision?: number;
|
|
470
|
+
}, {
|
|
471
|
+
readonly record: PageRecord;
|
|
472
|
+
} & ({
|
|
473
|
+
readonly version: PageVersion;
|
|
474
|
+
readonly content: string;
|
|
475
|
+
} | {
|
|
476
|
+
readonly matterRef: PageMatterRef;
|
|
477
|
+
})>;
|
|
478
|
+
readonly 'page.create': Wire<PageContent & {
|
|
479
|
+
readonly ownerBotId: string;
|
|
480
|
+
readonly groupChatId?: string;
|
|
481
|
+
readonly originRef?: PageOrigin;
|
|
482
|
+
readonly operationId: string;
|
|
483
|
+
}, {
|
|
484
|
+
readonly record: PageRecord;
|
|
485
|
+
readonly hash: string;
|
|
486
|
+
}>;
|
|
487
|
+
readonly 'page.update': Wire<PageWrite & ({
|
|
488
|
+
readonly patch: Partial<PageContent>;
|
|
489
|
+
} | {
|
|
490
|
+
readonly restoreRevision: number;
|
|
491
|
+
}), {
|
|
492
|
+
readonly record: PageRecord;
|
|
493
|
+
readonly hash: string;
|
|
494
|
+
}>;
|
|
495
|
+
readonly 'page.revisions': Wire<IndexQuery & {
|
|
496
|
+
readonly pageId: string;
|
|
497
|
+
}, IndexWindow<PageVersion>>;
|
|
498
|
+
readonly 'page.pin': Wire<PageWrite & {
|
|
499
|
+
readonly pinned: boolean;
|
|
500
|
+
readonly groupChatId?: string;
|
|
501
|
+
}, {
|
|
502
|
+
readonly pin: {
|
|
503
|
+
readonly pinned: boolean;
|
|
504
|
+
readonly revision: number;
|
|
505
|
+
};
|
|
506
|
+
}>;
|
|
507
|
+
readonly 'page.archive': Wire<PageWrite, {
|
|
508
|
+
readonly record: PageRecord;
|
|
509
|
+
readonly hash: string;
|
|
510
|
+
}>;
|
|
511
|
+
}
|
|
512
|
+
export interface PersistentWorkspaceNotifications {
|
|
513
|
+
readonly 'group.chat.changed': GroupChatChanged;
|
|
514
|
+
readonly 'routine.changed': RoutineChanged;
|
|
515
|
+
readonly 'presence.changed': PresenceChanged;
|
|
516
|
+
readonly 'vault.changed': VaultChanged;
|
|
517
|
+
readonly 'page.updated': PageUpdated;
|
|
518
|
+
}
|
|
519
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { DelegationEvent } from './delegation.ts';
|
|
2
|
+
export type ProjectRecoveryFailureKind = 'response_headers_timeout' | 'network' | 'stream_interrupted' | 'provider_transient' | 'rate_limited' | 'authentication' | 'invalid_request' | 'configuration' | 'permission' | 'budget_exhausted' | 'execution_outcome_unknown' | 'cancelled' | 'fatal';
|
|
3
|
+
/** Produced by the host request boundary; never inferred from assistant prose. */
|
|
4
|
+
export interface ProviderRequestRecovery {
|
|
5
|
+
readonly kind: ProjectRecoveryFailureKind;
|
|
6
|
+
readonly phase?: 'response_headers' | 'stream' | 'request';
|
|
7
|
+
readonly requestId?: string;
|
|
8
|
+
readonly attempts?: number;
|
|
9
|
+
readonly maxAttempts?: number;
|
|
10
|
+
readonly exhausted?: boolean;
|
|
11
|
+
readonly replaySafe?: boolean;
|
|
12
|
+
readonly retryable: boolean;
|
|
13
|
+
}
|
|
14
|
+
/** Legacy diagnostics are admitted only at this seam; structured host failure takes precedence. */
|
|
15
|
+
export declare function classifyProjectAgentFailure(reason: unknown, detail?: unknown): {
|
|
16
|
+
kind: ProjectRecoveryFailureKind;
|
|
17
|
+
retryable: boolean;
|
|
18
|
+
};
|
|
19
|
+
/** Host failure classification, including the persisted diagnostic prefix used by older cards. */
|
|
20
|
+
export declare function projectAgentFailureKind(reason: unknown): 'budget_exhausted' | 'unavailable';
|
|
21
|
+
/** Durable host facts for an explicit retry; never a new user authorization. */
|
|
22
|
+
export interface ProjectAgentTurnRecovery {
|
|
23
|
+
readonly events: readonly DelegationEvent[];
|
|
24
|
+
readonly throughSeq: number;
|
|
25
|
+
}
|
|
26
|
+
/** Factual recovery data returned by post_reply after anchor validation fails. */
|
|
27
|
+
export interface ReplyAnchorCandidate {
|
|
28
|
+
readonly messageId: string;
|
|
29
|
+
readonly text: string;
|
|
30
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const RECOVERABLE = new Set(['response_headers_timeout', 'network', 'stream_interrupted', 'provider_transient', 'rate_limited']);
|
|
2
|
+
const FAILURE_KINDS = new Set([...RECOVERABLE, 'authentication', 'invalid_request', 'configuration', 'permission', 'budget_exhausted', 'execution_outcome_unknown', 'cancelled', 'fatal']);
|
|
3
|
+
/** Legacy diagnostics are admitted only at this seam; structured host failure takes precedence. */
|
|
4
|
+
export function classifyProjectAgentFailure(reason, detail) {
|
|
5
|
+
if (detail && typeof detail === 'object' && 'kind' in detail && FAILURE_KINDS.has(detail.kind)) {
|
|
6
|
+
const kind = detail.kind;
|
|
7
|
+
return { kind, retryable: RECOVERABLE.has(kind) && !('retryable' in detail && detail.retryable === false) };
|
|
8
|
+
}
|
|
9
|
+
const code = typeof reason === 'string' ? reason.trim().replace(/^代理暂时不可用:\s*/, '') : '';
|
|
10
|
+
let kind = 'fatal';
|
|
11
|
+
if (/^(agent_tool_budget_exhausted|agent_loop_exhausted|work_budget_limited)(?:\s*:|$)/.test(code))
|
|
12
|
+
kind = 'budget_exhausted';
|
|
13
|
+
else if (/^(execution_outcome_unknown|checkpoint_persistence_failed)(?:\s*:|$)/.test(code))
|
|
14
|
+
kind = 'execution_outcome_unknown';
|
|
15
|
+
else if (/^(work_execution_stopped|aborted|AbortError|user_stopped)(?:\s*:|$)/i.test(code))
|
|
16
|
+
kind = 'cancelled';
|
|
17
|
+
else if (/^(permission_denied|permission_revoked|authorization_denied)(?:\s*:|$)/i.test(code))
|
|
18
|
+
kind = 'permission';
|
|
19
|
+
else if (/^(connect timeout after|response_headers_timeout)|ConnectTimeoutError/.test(code))
|
|
20
|
+
kind = 'response_headers_timeout';
|
|
21
|
+
else if (/^(provider_stream_idle_timeout|provider_stream_interrupted)(?:\s*:|$)/.test(code))
|
|
22
|
+
kind = 'stream_interrupted';
|
|
23
|
+
else if (/^(HTTP\s*)?(401|403)(?:\s|:|$)|^(authentication_error|invalid_api_key|credential_unavailable)(?:\s*:|$)/i.test(code))
|
|
24
|
+
kind = 'authentication';
|
|
25
|
+
else if (/^(HTTP\s*)?429(?:\s|:|$)/i.test(code))
|
|
26
|
+
kind = 'rate_limited';
|
|
27
|
+
else if (/^(HTTP\s*)?(500|502|503|504)(?:\s|:|$)|^(server_error|server_is_overloaded)(?:\s*:|$)/i.test(code))
|
|
28
|
+
kind = 'provider_transient';
|
|
29
|
+
else if (/^(HTTP\s*)?(400|404|422)(?:\s|:|$)|^(invalid_request|provider_checkpoint_mismatch)(?:\s*:|$)/i.test(code))
|
|
30
|
+
kind = 'invalid_request';
|
|
31
|
+
else if (/^(CERT_|ERR_CERT_|UNABLE_TO_VERIFY|SELF_SIGNED|DEPTH_ZERO_SELF_SIGNED_CERT|provider_not_configured|work_budget_host_unavailable)/i.test(code))
|
|
32
|
+
kind = 'configuration';
|
|
33
|
+
else if (/^(fetch failed|network|ECONNRESET|ECONNREFUSED|ENOTFOUND|ETIMEDOUT|EAI_AGAIN|UND_ERR_(SOCKET|CONNECT_TIMEOUT)|(?:net::)?ERR_(CONNECTION|NETWORK|TIMED_OUT|NAME_NOT_RESOLVED|PROXY_CONNECTION_FAILED|TUNNEL_CONNECTION_FAILED|SOCKS_CONNECTION_FAILED|INTERNET_DISCONNECTED))/i.test(code))
|
|
34
|
+
kind = 'network';
|
|
35
|
+
return { kind, retryable: RECOVERABLE.has(kind) };
|
|
36
|
+
}
|
|
37
|
+
/** Host failure classification, including the persisted diagnostic prefix used by older cards. */
|
|
38
|
+
export function projectAgentFailureKind(reason) {
|
|
39
|
+
if (typeof reason !== 'string')
|
|
40
|
+
return 'unavailable';
|
|
41
|
+
const code = reason.trim().replace(/^代理暂时不可用:\s*/, '');
|
|
42
|
+
return /^(agent_tool_budget_exhausted|agent_loop_exhausted|work_budget_limited)(?:\s*:|$)/.test(code)
|
|
43
|
+
? 'budget_exhausted' : 'unavailable';
|
|
44
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { ResourceFeedback } from './resource-feedback.ts';
|
|
2
|
+
import type { ProjectInputAttachment, ProjectAgentSubmitInputResult, WorkSessionStatus } from './delegation.ts';
|
|
3
|
+
export type LocalInputSurface = 'desktop' | 'quick_chat' | 'tui';
|
|
4
|
+
export interface InputDraftQuote {
|
|
5
|
+
readonly messageId: string;
|
|
6
|
+
readonly text: string;
|
|
7
|
+
}
|
|
8
|
+
export interface InputDraftTaskRef {
|
|
9
|
+
readonly sessionId: string;
|
|
10
|
+
readonly title: string;
|
|
11
|
+
readonly status: WorkSessionStatus | string;
|
|
12
|
+
readonly anchorMessageId?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface InputDraftValue {
|
|
15
|
+
readonly text: string;
|
|
16
|
+
readonly quote: InputDraftQuote | null;
|
|
17
|
+
readonly attachments: readonly ProjectInputAttachment[];
|
|
18
|
+
readonly taskRefs?: readonly InputDraftTaskRef[];
|
|
19
|
+
readonly resourceFeedback?: readonly ResourceFeedback[];
|
|
20
|
+
}
|
|
21
|
+
/** User intent only. Presence here never means the input was received or executed. */
|
|
22
|
+
export interface UnconfirmedProjectInput {
|
|
23
|
+
readonly inputId: string;
|
|
24
|
+
readonly text: string;
|
|
25
|
+
readonly quoteRefs: readonly string[];
|
|
26
|
+
readonly taskRefs?: readonly InputDraftTaskRef[];
|
|
27
|
+
readonly answerTo?: string;
|
|
28
|
+
readonly attachments: readonly ProjectInputAttachment[];
|
|
29
|
+
readonly resourceFeedback?: readonly ResourceFeedback[];
|
|
30
|
+
readonly createdAt: string;
|
|
31
|
+
}
|
|
32
|
+
export interface ProjectInputDraftSnapshot {
|
|
33
|
+
readonly revision: number;
|
|
34
|
+
readonly draft: InputDraftValue;
|
|
35
|
+
readonly pending: readonly UnconfirmedProjectInput[];
|
|
36
|
+
}
|
|
37
|
+
export interface ProjectInputDraftReadRequest {
|
|
38
|
+
readonly workspaceId: string;
|
|
39
|
+
readonly surface: LocalInputSurface;
|
|
40
|
+
}
|
|
41
|
+
export type ProjectInputDraftReadResult = {
|
|
42
|
+
readonly ok: true;
|
|
43
|
+
readonly snapshot: ProjectInputDraftSnapshot;
|
|
44
|
+
} | {
|
|
45
|
+
readonly ok: false;
|
|
46
|
+
readonly code: string;
|
|
47
|
+
};
|
|
48
|
+
export interface ProjectInputDraftWriteRequest extends ProjectInputDraftReadRequest {
|
|
49
|
+
readonly revision: number;
|
|
50
|
+
readonly draft: Omit<InputDraftValue, 'attachments'> & {
|
|
51
|
+
readonly attachmentIds: readonly string[];
|
|
52
|
+
};
|
|
53
|
+
readonly pending: readonly (Omit<UnconfirmedProjectInput, 'attachments'> & {
|
|
54
|
+
readonly attachmentIds: readonly string[];
|
|
55
|
+
})[];
|
|
56
|
+
/** Already-stored attachments are referred to by ID; large bytes are sent only once. */
|
|
57
|
+
readonly uploads: readonly ProjectInputAttachment[];
|
|
58
|
+
}
|
|
59
|
+
export type ProjectInputDraftWriteResult = {
|
|
60
|
+
readonly ok: true;
|
|
61
|
+
readonly revision: number;
|
|
62
|
+
} | {
|
|
63
|
+
readonly ok: false;
|
|
64
|
+
readonly code: string;
|
|
65
|
+
};
|
|
66
|
+
export interface ProjectInputRecoveryPort {
|
|
67
|
+
read(request: ProjectInputDraftReadRequest): Promise<ProjectInputDraftReadResult>;
|
|
68
|
+
write(request: ProjectInputDraftWriteRequest): Promise<ProjectInputDraftWriteResult>;
|
|
69
|
+
submit(request: UnconfirmedProjectInput & ProjectInputDraftReadRequest): Promise<ProjectAgentSubmitInputResult>;
|
|
70
|
+
}
|
|
71
|
+
export type ProjectInputMutationResult = {
|
|
72
|
+
readonly ok: true;
|
|
73
|
+
} | {
|
|
74
|
+
readonly ok: false;
|
|
75
|
+
readonly code: string;
|
|
76
|
+
};
|
|
77
|
+
export declare const DEFINITE_PROJECT_INPUT_REJECTION_CODES: ReadonlySet<string>;
|
|
78
|
+
export declare function emptyInputDraft(): InputDraftValue;
|
|
79
|
+
/** A handoff failure may follow a durable receipt. Generic ok alone proves nothing. */
|
|
80
|
+
export declare function projectInputWasReceived(result: ProjectAgentSubmitInputResult | null | undefined, workspaceId: string, inputId: string): boolean;
|
|
81
|
+
export declare function isDefiniteProjectInputRejectionCode(code: string | null | undefined): boolean;
|
|
82
|
+
/** True only when the host rejected the input before enqueuing it (no durable receipt). */
|
|
83
|
+
export declare function isDefiniteProjectInputRejection(result: ProjectAgentSubmitInputResult | null | undefined, workspaceId: string, inputId: string): boolean;
|