@peer-agent/protocol 0.1.0-rc.50 → 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/conversation-execution.js +2 -2
- package/dist/evidence-inspection.d.ts +20 -0
- package/dist/group-chat.d.ts +87 -0
- package/dist/group-chat.js +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +3 -0
- package/dist/memory.d.ts +46 -1
- package/dist/persistent-workspace.d.ts +519 -0
- package/dist/persistent-workspace.js +1 -0
- package/dist/project-matter.d.ts +137 -3
- package/dist/project.d.ts +97 -0
- package/dist/project.js +4 -0
- package/dist/prompt-skill.d.ts +31 -0
- package/dist/prompt-skill.js +1 -0
- package/dist/resource-feedback.d.ts +13 -1
- package/dist/resource-feedback.js +17 -0
- package/dist/routine.d.ts +82 -0
- package/dist/routine.js +1 -0
- package/dist/workspace.d.ts +35 -0
- package/dist/workspace.js +1 -0
- package/package.json +1 -1
package/dist/project-matter.d.ts
CHANGED
|
@@ -17,6 +17,75 @@ export type MatterSource = {
|
|
|
17
17
|
kind: string;
|
|
18
18
|
ref?: string;
|
|
19
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>>;
|
|
20
89
|
export type MatterSummary = {
|
|
21
90
|
matterId: string;
|
|
22
91
|
number: number;
|
|
@@ -36,12 +105,19 @@ export type MatterDecisionDraft = {
|
|
|
36
105
|
options: readonly {
|
|
37
106
|
id: string;
|
|
38
107
|
label: string;
|
|
108
|
+
summary?: string;
|
|
39
109
|
recommended?: boolean;
|
|
40
110
|
}[];
|
|
41
111
|
approveDoneMeans?: MatterBrief['doneMeans'];
|
|
42
112
|
};
|
|
43
113
|
export type MatterDecision = MatterDecisionDraft & {
|
|
44
114
|
requestId: string;
|
|
115
|
+
coordinationRevision?: number;
|
|
116
|
+
allowFreeText?: boolean;
|
|
117
|
+
answerText?: string;
|
|
118
|
+
answerOptionId?: string;
|
|
119
|
+
answerReceiptId?: string;
|
|
120
|
+
backfeedState?: string;
|
|
45
121
|
};
|
|
46
122
|
export type MatterGit = {
|
|
47
123
|
repo: string | null;
|
|
@@ -63,9 +139,17 @@ export type MatterDelivery = {
|
|
|
63
139
|
git?: MatterGit | null;
|
|
64
140
|
evidenceRefs?: readonly string[];
|
|
65
141
|
artifacts?: readonly MatterArtifact[];
|
|
142
|
+
review?: MatterReview;
|
|
143
|
+
deliverables?: readonly MatterDeliverable[];
|
|
66
144
|
};
|
|
67
145
|
export type Matter = MatterBrief & Omit<MatterSummary, 'waitReason'> & {
|
|
68
146
|
origin: MatterSource;
|
|
147
|
+
originChatId?: string;
|
|
148
|
+
originMessageId?: string;
|
|
149
|
+
source?: MatterOrigin | null;
|
|
150
|
+
review?: MatterReview;
|
|
151
|
+
actions?: MatterActions;
|
|
152
|
+
deliverables?: readonly MatterDeliverable[];
|
|
69
153
|
waiting?: {
|
|
70
154
|
reason: string;
|
|
71
155
|
source: MatterSource;
|
|
@@ -86,6 +170,13 @@ export type MatterRun = {
|
|
|
86
170
|
deliveryBinding?: import('./delegation.ts').WorkSessionDeliveryBinding;
|
|
87
171
|
liveIsolationLost?: boolean;
|
|
88
172
|
briefRevision?: number | null;
|
|
173
|
+
resultRevision?: string;
|
|
174
|
+
evidenceRefs?: readonly string[];
|
|
175
|
+
acceptance?: {
|
|
176
|
+
acceptedAt: string;
|
|
177
|
+
acceptedBy: string;
|
|
178
|
+
resultRevision?: string;
|
|
179
|
+
} | null;
|
|
89
180
|
};
|
|
90
181
|
export type MatterActivity = {
|
|
91
182
|
activityId: string;
|
|
@@ -96,6 +187,17 @@ export type MatterActivity = {
|
|
|
96
187
|
payload: Record<string, unknown>;
|
|
97
188
|
createdAt: string;
|
|
98
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
|
+
};
|
|
99
201
|
export type MatterChanged = {
|
|
100
202
|
workspaceId: string;
|
|
101
203
|
matterId: string;
|
|
@@ -106,11 +208,16 @@ export type MatterListPage = {
|
|
|
106
208
|
deliveredLimit?: number;
|
|
107
209
|
} & Partial<Record<`${MatterGroup}Cursor`, string>>;
|
|
108
210
|
export type MatterDetailPage = {
|
|
109
|
-
afterSeq?: number;
|
|
110
211
|
activityLimit?: number;
|
|
111
212
|
runOffset?: number;
|
|
112
213
|
runLimit?: number;
|
|
113
|
-
}
|
|
214
|
+
} & ({
|
|
215
|
+
afterSeq?: number;
|
|
216
|
+
activityCursor?: never;
|
|
217
|
+
} | {
|
|
218
|
+
activityCursor: string;
|
|
219
|
+
afterSeq?: never;
|
|
220
|
+
});
|
|
114
221
|
type Scope = {
|
|
115
222
|
workspaceId: string;
|
|
116
223
|
version?: 1;
|
|
@@ -126,8 +233,14 @@ type CAS = {
|
|
|
126
233
|
briefRevision?: number;
|
|
127
234
|
};
|
|
128
235
|
type Answer = {
|
|
129
|
-
|
|
236
|
+
decisionRevision?: number;
|
|
130
237
|
} & ({
|
|
238
|
+
requestId: string;
|
|
239
|
+
decisionId?: never;
|
|
240
|
+
} | {
|
|
241
|
+
decisionId: string;
|
|
242
|
+
requestId?: never;
|
|
243
|
+
}) & ({
|
|
131
244
|
optionId: string;
|
|
132
245
|
text?: never;
|
|
133
246
|
} | {
|
|
@@ -145,7 +258,15 @@ type Patch = {
|
|
|
145
258
|
};
|
|
146
259
|
decision?: MatterDecisionDraft;
|
|
147
260
|
userReceiptRef?: string;
|
|
261
|
+
review?: MatterReviewRequest;
|
|
262
|
+
linkPr?: {
|
|
263
|
+
reviewId: string;
|
|
264
|
+
evidenceRef: string;
|
|
265
|
+
};
|
|
148
266
|
delivery?: {
|
|
267
|
+
summary: string;
|
|
268
|
+
reviewId: string;
|
|
269
|
+
} | {
|
|
149
270
|
summary: string;
|
|
150
271
|
sessionId?: string;
|
|
151
272
|
followUpEpoch?: number;
|
|
@@ -159,6 +280,8 @@ export type MatterDetail = {
|
|
|
159
280
|
matter: Matter;
|
|
160
281
|
activities: readonly MatterActivity[];
|
|
161
282
|
runs: readonly MatterRun[];
|
|
283
|
+
activityPage: MatterActivityPage;
|
|
284
|
+
lastActivitySeq: number;
|
|
162
285
|
nextActivitySeq: number | null;
|
|
163
286
|
nextRunOffset: number | null;
|
|
164
287
|
};
|
|
@@ -167,6 +290,7 @@ type Receipt = Target & CAS & {
|
|
|
167
290
|
status: MatterStatus;
|
|
168
291
|
seq?: number;
|
|
169
292
|
activityId?: string;
|
|
293
|
+
reviewId?: string | null;
|
|
170
294
|
};
|
|
171
295
|
interface MatterRequests {
|
|
172
296
|
list: Scope & {
|
|
@@ -201,6 +325,9 @@ interface MatterRequests {
|
|
|
201
325
|
} | (Target & Pick<CAS, 'revision'>));
|
|
202
326
|
};
|
|
203
327
|
export_markdown: Scope & Target;
|
|
328
|
+
resolve_deliverable: Scope & Target & {
|
|
329
|
+
deliverableId: string;
|
|
330
|
+
};
|
|
204
331
|
}
|
|
205
332
|
type ReadResults = {
|
|
206
333
|
list: MatterList;
|
|
@@ -208,6 +335,13 @@ type ReadResults = {
|
|
|
208
335
|
export_markdown: Target & {
|
|
209
336
|
markdown: string;
|
|
210
337
|
};
|
|
338
|
+
resolve_deliverable: {
|
|
339
|
+
deliverable: MatterDeliverable;
|
|
340
|
+
path?: string;
|
|
341
|
+
text?: string;
|
|
342
|
+
dataUrl?: string;
|
|
343
|
+
url?: string;
|
|
344
|
+
};
|
|
211
345
|
};
|
|
212
346
|
type MatterFailure = {
|
|
213
347
|
ok: false;
|
package/dist/project.d.ts
CHANGED
|
@@ -180,6 +180,7 @@ export interface BotCapabilityPolicy {
|
|
|
180
180
|
readonly disabledMcpIds?: readonly string[];
|
|
181
181
|
}
|
|
182
182
|
export interface BotProfile {
|
|
183
|
+
readonly kind?: 'project' | 'global';
|
|
183
184
|
readonly workspaceId: string;
|
|
184
185
|
readonly displayName: string;
|
|
185
186
|
readonly avatar: BotAvatar;
|
|
@@ -212,6 +213,69 @@ export interface BotProfile {
|
|
|
212
213
|
readonly capabilityPolicy?: BotCapabilityPolicy | null;
|
|
213
214
|
readonly updatedAt?: string;
|
|
214
215
|
}
|
|
216
|
+
export declare function isGlobalBotProfile(profile: Pick<BotProfile, 'kind'> | null | undefined): boolean;
|
|
217
|
+
export interface GlobalBotPreferences {
|
|
218
|
+
readonly visible: boolean;
|
|
219
|
+
readonly pinned: boolean;
|
|
220
|
+
readonly revision: string;
|
|
221
|
+
}
|
|
222
|
+
export type GlobalBotPreferencesUpdate = {
|
|
223
|
+
readonly expectedRevision: string;
|
|
224
|
+
} & ({
|
|
225
|
+
readonly visible: boolean;
|
|
226
|
+
readonly pinned?: boolean;
|
|
227
|
+
} | {
|
|
228
|
+
readonly visible?: boolean;
|
|
229
|
+
readonly pinned: boolean;
|
|
230
|
+
});
|
|
231
|
+
export type GlobalBotErrorCode = 'BUILTIN_GLOBAL_BOT_PROTECTED' | 'GLOBAL_BOT_IDENTITY_CONFLICT' | 'GLOBAL_BOT_BOOTSTRAP_INCOMPLETE' | 'PROTECTED_PATH' | 'CORRUPT_REGISTRY' | 'CORRUPT_PROFILE' | 'RUNTIME_UNAVAILABLE' | 'POLICY_UNAVAILABLE' | 'POLICY_RESOURCE_LIMIT' | 'STORE_LOCK_BUSY' | 'STORE_LOCK_OWNERSHIP_CHANGED' | 'STORE_COMMIT_UNCERTAIN' | 'BACKGROUND_READ_FAILED' | 'BACKGROUND_VERSION_CHANGED' | 'BACKGROUND_HISTORY_CORRUPT' | 'BACKGROUND_HISTORY_LIMIT' | 'INVALID_INPUT' | 'INVALID_PATH' | 'INVALID_WORKSPACE' | 'INVALID_SETTINGS' | 'SETTINGS_CONFLICT' | 'IO_ERROR' | 'SERIALIZE_ERROR' | 'ARCHIVED' | 'OUT_OF_SCOPE' | 'NOT_FOUND' | 'AVATAR_EXHAUSTED' | 'CANCELLED';
|
|
232
|
+
export type GlobalBotRpcFailure = {
|
|
233
|
+
readonly ok: false;
|
|
234
|
+
readonly code: GlobalBotErrorCode;
|
|
235
|
+
};
|
|
236
|
+
export type GlobalBotPreferencesResult = ({
|
|
237
|
+
readonly ok: true;
|
|
238
|
+
} & GlobalBotPreferences) | GlobalBotRpcFailure;
|
|
239
|
+
export type EnsureGlobalBotResult = {
|
|
240
|
+
readonly ok: true;
|
|
241
|
+
readonly workspaceId: string;
|
|
242
|
+
readonly profile: BotProfile;
|
|
243
|
+
readonly created: boolean;
|
|
244
|
+
} | GlobalBotRpcFailure;
|
|
245
|
+
export declare const BOT_CONTEXT_BOUNDARY_KIND = "context_boundary";
|
|
246
|
+
export type NewBotConversationResult = {
|
|
247
|
+
readonly ok: true;
|
|
248
|
+
readonly created: boolean;
|
|
249
|
+
readonly boundaryId: string | null;
|
|
250
|
+
readonly revision: number;
|
|
251
|
+
readonly timestamp: string | null;
|
|
252
|
+
} | {
|
|
253
|
+
readonly ok: false;
|
|
254
|
+
readonly code: string;
|
|
255
|
+
};
|
|
256
|
+
export interface GlobalBotRpc {
|
|
257
|
+
readonly 'project.bot.newConversation': {
|
|
258
|
+
readonly params: {
|
|
259
|
+
readonly workspaceId: string;
|
|
260
|
+
};
|
|
261
|
+
readonly result: NewBotConversationResult;
|
|
262
|
+
};
|
|
263
|
+
readonly 'project.bot.ensureGlobal': {
|
|
264
|
+
readonly params: Record<string, never>;
|
|
265
|
+
readonly result: EnsureGlobalBotResult;
|
|
266
|
+
};
|
|
267
|
+
readonly 'project.bot.globalPreferences.get': {
|
|
268
|
+
readonly params: Record<string, never>;
|
|
269
|
+
readonly result: GlobalBotPreferencesResult;
|
|
270
|
+
};
|
|
271
|
+
readonly 'project.bot.globalPreferences.update': {
|
|
272
|
+
readonly params: GlobalBotPreferencesUpdate;
|
|
273
|
+
readonly result: GlobalBotPreferencesResult;
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
export interface GlobalBotRpcNotifications {
|
|
277
|
+
readonly 'project.bot.globalPreferences.changed': GlobalBotPreferences;
|
|
278
|
+
}
|
|
215
279
|
export interface BotRowState {
|
|
216
280
|
readonly needsYou: number;
|
|
217
281
|
readonly attentionExpiresAt?: string;
|
|
@@ -240,6 +304,30 @@ export interface ProjectAgentToolPreview {
|
|
|
240
304
|
readonly truncated: boolean;
|
|
241
305
|
readonly redacted: boolean;
|
|
242
306
|
}
|
|
307
|
+
export interface ReplyTraceTool {
|
|
308
|
+
readonly verb: string;
|
|
309
|
+
readonly status?: 'done' | 'failed' | 'cancelled' | 'unknown';
|
|
310
|
+
readonly commandPreview?: string;
|
|
311
|
+
readonly targetSummary?: string;
|
|
312
|
+
readonly errorCode?: string;
|
|
313
|
+
readonly errorSummary?: string;
|
|
314
|
+
readonly matchCount?: number;
|
|
315
|
+
}
|
|
316
|
+
export interface ReplyTraceModelSpan {
|
|
317
|
+
readonly startedAtMs: number;
|
|
318
|
+
readonly endedAtMs: number;
|
|
319
|
+
readonly durationMs: number;
|
|
320
|
+
readonly failed?: boolean;
|
|
321
|
+
/** Public assistant commentary following host admission and redaction. */
|
|
322
|
+
readonly text?: string;
|
|
323
|
+
}
|
|
324
|
+
export interface ReplyTraceSummary {
|
|
325
|
+
readonly steps: number;
|
|
326
|
+
readonly failures: number;
|
|
327
|
+
readonly totalDurationMs?: number;
|
|
328
|
+
readonly modelDurationMs?: number;
|
|
329
|
+
readonly toolDurationMs?: number;
|
|
330
|
+
}
|
|
243
331
|
export interface ProjectAgentToolActivity {
|
|
244
332
|
readonly kind: 'tool';
|
|
245
333
|
readonly id: string;
|
|
@@ -247,6 +335,10 @@ export interface ProjectAgentToolActivity {
|
|
|
247
335
|
readonly status: 'preparing' | 'running' | 'awaiting_permission' | 'done' | 'error' | 'stopped';
|
|
248
336
|
readonly startedAt?: string;
|
|
249
337
|
readonly finishedAt?: string;
|
|
338
|
+
readonly startedAtMs?: number;
|
|
339
|
+
readonly endedAtMs?: number;
|
|
340
|
+
readonly durationMs?: number;
|
|
341
|
+
readonly trace?: ReplyTraceTool;
|
|
250
342
|
readonly summary?: string;
|
|
251
343
|
readonly input?: ProjectAgentToolPreview;
|
|
252
344
|
readonly result?: ProjectAgentToolPreview;
|
|
@@ -285,6 +377,7 @@ export interface ProjectAgentActivity {
|
|
|
285
377
|
readonly finishedAt?: string;
|
|
286
378
|
readonly modelSelection?: Pick<import('./model-routing.ts').RuntimeModelSelection, 'modelProviderId' | 'reasoningEffort'>;
|
|
287
379
|
readonly replyTo: readonly string[];
|
|
380
|
+
readonly modelSpans?: readonly ReplyTraceModelSpan[];
|
|
288
381
|
readonly phase: 'waiting' | 'thinking' | 'responding' | 'tool' | 'awaiting_permission' | 'settling' | 'done' | 'error' | 'stopped' | 'disposed';
|
|
289
382
|
readonly replyText: string;
|
|
290
383
|
/** A factual recovery event, cleared when the next provider event arrives. */
|
|
@@ -304,6 +397,10 @@ export type ProjectAgentStopResponseResult = {
|
|
|
304
397
|
readonly code: 'PROJECT_AGENT_DISABLED' | 'NOT_FOUND' | 'HOST_OFFLINE' | 'STALE_TURN' | 'INVALID_INPUT';
|
|
305
398
|
};
|
|
306
399
|
export interface BotListSession {
|
|
400
|
+
readonly matterId?: string;
|
|
401
|
+
readonly matterNumber?: number;
|
|
402
|
+
readonly followUpEpoch?: number;
|
|
403
|
+
readonly runAvailable?: boolean;
|
|
307
404
|
readonly startedAt?: string;
|
|
308
405
|
readonly endedAt?: string;
|
|
309
406
|
readonly sessionId?: string;
|
package/dist/project.js
CHANGED
|
@@ -21,6 +21,10 @@ export const BOT_AVATAR_NECKS = [
|
|
|
21
21
|
'sailor',
|
|
22
22
|
'cape',
|
|
23
23
|
];
|
|
24
|
+
export function isGlobalBotProfile(profile) {
|
|
25
|
+
return profile?.kind === 'global';
|
|
26
|
+
}
|
|
27
|
+
export const BOT_CONTEXT_BOUNDARY_KIND = 'context_boundary';
|
|
24
28
|
/** Display contract version for persisted agent_turn records (ADR87 D4).
|
|
25
29
|
* Version 2: public text carries role, the canonical agent_reply is the only
|
|
26
30
|
* answer body, and the implicit pure-text fallback reply is closed. Absent
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type PromptSkillScope = {
|
|
2
|
+
readonly scope: 'global';
|
|
3
|
+
} | {
|
|
4
|
+
readonly scope: 'workspace';
|
|
5
|
+
readonly workspaceId: string;
|
|
6
|
+
};
|
|
7
|
+
export interface SavePromptSkill {
|
|
8
|
+
readonly destination: PromptSkillScope;
|
|
9
|
+
readonly operationId: string;
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly description: string;
|
|
12
|
+
readonly prompt: string;
|
|
13
|
+
readonly source: {
|
|
14
|
+
readonly messageId: string;
|
|
15
|
+
} & ({
|
|
16
|
+
readonly conversationId: string;
|
|
17
|
+
readonly groupChatId?: never;
|
|
18
|
+
} | {
|
|
19
|
+
readonly conversationId?: never;
|
|
20
|
+
readonly groupChatId: string;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export type SavePromptSkillResult = {
|
|
24
|
+
readonly ok: true;
|
|
25
|
+
readonly skillId: string;
|
|
26
|
+
readonly destination: PromptSkillScope;
|
|
27
|
+
} | {
|
|
28
|
+
readonly ok: false;
|
|
29
|
+
readonly code: 'INVALID_SKILL' | 'INVALID_SKILL_SOURCE' | 'SKILL_SECRET_REJECTED' | 'NOT_FOUND' | 'SKILL_ALREADY_EXISTS' | 'OPERATION_ID_CONFLICT';
|
|
30
|
+
readonly field?: string;
|
|
31
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -36,6 +36,18 @@ export interface ResourceFeedbackSourceRange {
|
|
|
36
36
|
readonly endLine: number;
|
|
37
37
|
readonly endColumn: number;
|
|
38
38
|
}
|
|
39
|
+
export interface DesignSelection {
|
|
40
|
+
readonly kind: 'design';
|
|
41
|
+
readonly source: 'external_untrusted';
|
|
42
|
+
readonly owner: string;
|
|
43
|
+
readonly sourceConversation: string;
|
|
44
|
+
readonly target: string;
|
|
45
|
+
readonly guestGeneration: string;
|
|
46
|
+
readonly documentId: string;
|
|
47
|
+
readonly role: string;
|
|
48
|
+
readonly rect: readonly number[];
|
|
49
|
+
readonly crop: readonly number[];
|
|
50
|
+
}
|
|
39
51
|
export interface ResourceFeedback {
|
|
40
52
|
readonly id: string;
|
|
41
53
|
readonly recipient: ResourceFeedbackRecipient;
|
|
@@ -43,7 +55,7 @@ export interface ResourceFeedback {
|
|
|
43
55
|
readonly resource: ResourceFeedbackResource;
|
|
44
56
|
readonly version: ResourceFeedbackVersion;
|
|
45
57
|
readonly excerpt: string;
|
|
46
|
-
readonly selection: {
|
|
58
|
+
readonly selection: DesignSelection | {
|
|
47
59
|
readonly kind: 'discussion';
|
|
48
60
|
readonly path?: string;
|
|
49
61
|
} | {
|
|
@@ -99,6 +99,23 @@ export function normalizeResourceFeedback(raw) {
|
|
|
99
99
|
return;
|
|
100
100
|
selection = { kind: 'source', range: { start: Number(s.range.start), end: Number(s.range.end), startLine: Number(s.range.startLine), startColumn: Number(s.range.startColumn), endLine: Number(s.range.endLine), endColumn: Number(s.range.endColumn) } };
|
|
101
101
|
}
|
|
102
|
+
else if (s.kind === 'design') {
|
|
103
|
+
const designToken = (v) => token(v) && v.length <= 200;
|
|
104
|
+
const integers = (v, size, max) => Array.isArray(v) && v.length === size && v.every(n => Number.isInteger(n) && n >= 0 && n <= max);
|
|
105
|
+
if (!keys(s, ['kind', 'source', 'owner', 'sourceConversation', 'target', 'guestGeneration', 'documentId', 'role', 'rect', 'crop'])
|
|
106
|
+
|| resource.kind !== 'web' || version.kind !== 'web-document' || typeof raw.resource.url !== 'string'
|
|
107
|
+
|| raw.resource.url !== new URL(resource.url).origin + '/' || raw.resource.pageUrl !== undefined
|
|
108
|
+
|| s.source !== 'external_untrusted' || !designToken(s.owner) || s.owner !== raw.recipient.workspaceId
|
|
109
|
+
|| !designToken(s.sourceConversation) || s.sourceConversation !== resource.conversationId
|
|
110
|
+
|| !designToken(s.target) || s.target !== resource.browserTabId || !designToken(s.guestGeneration)
|
|
111
|
+
|| !designToken(s.documentId) || s.documentId !== version.documentId || !designToken(raw.id)
|
|
112
|
+
|| !designToken(raw.recipient.conversationId) || s.role !== raw.excerpt
|
|
113
|
+
|| !['button', 'link', 'heading', 'paragraph', 'image', 'region', 'list', 'listitem', 'navigation', 'article', 'table', 'cell', 'label'].includes(raw.excerpt)
|
|
114
|
+
|| !integers(s.rect, 4, 65535) || !s.rect[2] || !s.rect[3] || !integers(s.crop, 12, 3))
|
|
115
|
+
return;
|
|
116
|
+
selection = { kind: 'design', source: 'external_untrusted', owner: s.owner, sourceConversation: s.sourceConversation,
|
|
117
|
+
target: s.target, guestGeneration: s.guestGeneration, documentId: s.documentId, role: raw.excerpt, rect: [...s.rect], crop: [...s.crop] };
|
|
118
|
+
}
|
|
102
119
|
else if (s.kind === 'discussion') {
|
|
103
120
|
if (!keys(s, ['kind', 'path']) || s.path !== undefined && (typeof s.path !== 'string' || s.path.length > 8192 || /[\u0000-\u001f]/.test(s.path)))
|
|
104
121
|
return;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export type RoutineTrigger = {
|
|
2
|
+
readonly kind: 'manual';
|
|
3
|
+
} | {
|
|
4
|
+
readonly kind: 'cron';
|
|
5
|
+
readonly expression: string;
|
|
6
|
+
readonly timezone: string;
|
|
7
|
+
} | {
|
|
8
|
+
readonly kind: 'interval_secs';
|
|
9
|
+
readonly seconds: number;
|
|
10
|
+
readonly anchorAt?: string | null;
|
|
11
|
+
} | {
|
|
12
|
+
readonly kind: 'event';
|
|
13
|
+
};
|
|
14
|
+
export type RoutineTargetKind = 'bot' | 'group_chat';
|
|
15
|
+
export type RoutineRunStatus = 'queued' | 'preparing' | 'running' | 'waiting_permission' | 'waiting_user' | 'succeeded' | 'failed' | 'skipped' | 'cancelled' | 'timed_out' | 'blocked';
|
|
16
|
+
export interface RoutineDefinition {
|
|
17
|
+
readonly name: string;
|
|
18
|
+
readonly prompt: string;
|
|
19
|
+
readonly trigger: RoutineTrigger;
|
|
20
|
+
readonly targetKind: RoutineTargetKind;
|
|
21
|
+
readonly targetId: string;
|
|
22
|
+
readonly outputMode: 'chat_only' | 'update_page' | 'silent_on_no_reply';
|
|
23
|
+
readonly targetPageId?: string | null;
|
|
24
|
+
readonly enabled: boolean;
|
|
25
|
+
readonly misfirePolicy: 'skip_to_next' | 'run_once_coalesced';
|
|
26
|
+
}
|
|
27
|
+
export interface Routine extends RoutineDefinition {
|
|
28
|
+
readonly id: string;
|
|
29
|
+
readonly revision: number;
|
|
30
|
+
readonly nextRunAt: string | null;
|
|
31
|
+
readonly lastRunStatus: RoutineRunStatus | null;
|
|
32
|
+
readonly lastRunSummary: string | null;
|
|
33
|
+
readonly consecutiveFailures: number;
|
|
34
|
+
readonly archived: boolean;
|
|
35
|
+
}
|
|
36
|
+
export type RoutineListItem = (Routine & {
|
|
37
|
+
readonly sourceKind: 'routine' | 'legacy_automation';
|
|
38
|
+
readonly latestRun?: RoutineRun;
|
|
39
|
+
readonly activeRun?: RoutineRun;
|
|
40
|
+
readonly diagnostic?: string;
|
|
41
|
+
}) | {
|
|
42
|
+
readonly id: string;
|
|
43
|
+
readonly name: string;
|
|
44
|
+
readonly sourceKind: 'project_watch';
|
|
45
|
+
readonly readOnly: true;
|
|
46
|
+
readonly enabled: boolean;
|
|
47
|
+
readonly targetKind: 'bot';
|
|
48
|
+
readonly targetId: string;
|
|
49
|
+
readonly managementRef: {
|
|
50
|
+
readonly workspaceId: string;
|
|
51
|
+
readonly objectiveId: string;
|
|
52
|
+
readonly watchId: string;
|
|
53
|
+
};
|
|
54
|
+
} | {
|
|
55
|
+
readonly id: string;
|
|
56
|
+
readonly name: string;
|
|
57
|
+
readonly sourceKind: 'legacy_automation';
|
|
58
|
+
readonly enabled: false;
|
|
59
|
+
readonly revision: number;
|
|
60
|
+
readonly archived: boolean;
|
|
61
|
+
readonly diagnostic: 'LEGACY_WRITER_CUTOVER_REQUIRED';
|
|
62
|
+
};
|
|
63
|
+
export interface RoutineRun {
|
|
64
|
+
readonly id: string;
|
|
65
|
+
readonly routineId: string;
|
|
66
|
+
readonly definitionRevision: number;
|
|
67
|
+
readonly snapshot?: Readonly<Record<string, unknown>>;
|
|
68
|
+
readonly scheduledFor: string;
|
|
69
|
+
readonly status: RoutineRunStatus;
|
|
70
|
+
readonly reason: string | null;
|
|
71
|
+
readonly summary: string | null;
|
|
72
|
+
readonly approvalId: string | null;
|
|
73
|
+
readonly conversationId: string | null;
|
|
74
|
+
readonly messageId: string | null;
|
|
75
|
+
readonly pageId: string | null;
|
|
76
|
+
readonly pageRevision: number | null;
|
|
77
|
+
readonly retryOf: string | null;
|
|
78
|
+
}
|
|
79
|
+
export type RoutineChanged = {
|
|
80
|
+
readonly routineId: string;
|
|
81
|
+
readonly revision: number;
|
|
82
|
+
};
|
package/dist/routine.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface BotTeam {
|
|
2
|
+
readonly id: string;
|
|
3
|
+
readonly title: string;
|
|
4
|
+
readonly collapsed: boolean;
|
|
5
|
+
readonly memberBotIds: readonly string[];
|
|
6
|
+
}
|
|
7
|
+
export interface BotTeams {
|
|
8
|
+
readonly revision: number;
|
|
9
|
+
readonly groups: readonly BotTeam[];
|
|
10
|
+
}
|
|
11
|
+
export interface UpdateBotTeams {
|
|
12
|
+
readonly expectedRevision: number;
|
|
13
|
+
readonly operationId: string;
|
|
14
|
+
readonly groups: readonly BotTeam[];
|
|
15
|
+
}
|
|
16
|
+
export type BotTeamsResult = ({
|
|
17
|
+
readonly ok: true;
|
|
18
|
+
} & BotTeams) | {
|
|
19
|
+
readonly ok: false;
|
|
20
|
+
readonly code: string;
|
|
21
|
+
readonly revision?: number | null;
|
|
22
|
+
};
|
|
23
|
+
export interface BotTeamsRpc {
|
|
24
|
+
readonly 'workspace.botTeams.get': {
|
|
25
|
+
readonly params: Record<string, never>;
|
|
26
|
+
readonly result: BotTeamsResult;
|
|
27
|
+
};
|
|
28
|
+
readonly 'workspace.botTeams.update': {
|
|
29
|
+
readonly params: UpdateBotTeams;
|
|
30
|
+
readonly result: BotTeamsResult;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export interface BotTeamsNotifications {
|
|
34
|
+
readonly 'workspace.botTeams.changed': Pick<BotTeams, 'revision'>;
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|