@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
|
@@ -143,7 +143,7 @@ export function normalizeConversationExecution(raw) {
|
|
|
143
143
|
? typeof v !== 'number' || !Number.isFinite(v) || v < 0 : !text(v, 200)))
|
|
144
144
|
|| Object.hasOwn(at, 'streamId') && at.streamId !== raw.identity.streamId
|
|
145
145
|
|| at.role != null && at.role !== 'chat' && !(raw.engine === 'peer-native'
|
|
146
|
-
&& (at.role === 'project_agent' || at.role === 'matter_thread') && typeof at.workspaceId === 'string'))
|
|
146
|
+
&& (at.role === 'project_agent' || at.role === 'matter_thread' || at.role === 'group_speaker' || at.role === 'routine_run') && typeof at.workspaceId === 'string'))
|
|
147
147
|
return invalid();
|
|
148
148
|
if (raw.usage !== null) {
|
|
149
149
|
const u = raw.usage;
|
|
@@ -178,7 +178,7 @@ export function normalizeConversationExecution(raw) {
|
|
|
178
178
|
const fields = ['workspaceId', 'botConversationId', 'hostEpoch', 'policyRevision', 'projectionId', 'credentialRevision'];
|
|
179
179
|
if (!object(a) || !keys(a, fields) || !fields.every(k => text(a[k], 8192))
|
|
180
180
|
|| a.hostEpoch !== raw.owner.hostId
|
|
181
|
-
|| (at.role === 'project_agent' || at.role === 'matter_thread') && a.workspaceId !== at.workspaceId)
|
|
181
|
+
|| (at.role === 'project_agent' || at.role === 'matter_thread' || at.role === 'group_speaker' || at.role === 'routine_run') && a.workspaceId !== at.workspaceId)
|
|
182
182
|
return invalid();
|
|
183
183
|
}
|
|
184
184
|
for (const [i, k] of ['toolCallId', 'dispatchId', 'messageId'].entries()) {
|
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
import type { BotDocumentReference } from './document-reference.ts';
|
|
2
2
|
import type { InteractiveResultReference } from './interactive-result.ts';
|
|
3
|
+
export interface BrowserEvidenceCapsule {
|
|
4
|
+
readonly targetKind: 'embedded_workbench' | 'managed_isolated';
|
|
5
|
+
readonly sensitivityClass: 'D1' | 'D2' | 'D3';
|
|
6
|
+
readonly documentEpoch: number;
|
|
7
|
+
readonly capturedAt: string;
|
|
8
|
+
readonly origin?: {
|
|
9
|
+
readonly scheme: string;
|
|
10
|
+
readonly host: string;
|
|
11
|
+
readonly port: number;
|
|
12
|
+
};
|
|
13
|
+
readonly preview?: {
|
|
14
|
+
readonly dataUrl: string;
|
|
15
|
+
readonly width: number;
|
|
16
|
+
readonly height: number;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
3
19
|
/** Read-only display facts. A saved operation is not proof that its task completed. */
|
|
4
20
|
export interface EvidenceSourceDescription {
|
|
21
|
+
readonly browserCapsule?: BrowserEvidenceCapsule;
|
|
5
22
|
readonly evidenceRef: string;
|
|
6
23
|
readonly toolName?: string;
|
|
7
24
|
readonly createdAt?: string;
|
|
@@ -9,6 +26,8 @@ export interface EvidenceSourceDescription {
|
|
|
9
26
|
export interface ProjectAgentEvidenceReadRequest {
|
|
10
27
|
readonly context?: {
|
|
11
28
|
readonly workspaceId: string;
|
|
29
|
+
readonly turnId?: string;
|
|
30
|
+
readonly matterId?: string;
|
|
12
31
|
readonly task?: BotDocumentReference['task'];
|
|
13
32
|
};
|
|
14
33
|
readonly evidenceRef?: string;
|
|
@@ -16,6 +35,7 @@ export interface ProjectAgentEvidenceReadRequest {
|
|
|
16
35
|
readonly evidenceRefs?: readonly string[];
|
|
17
36
|
}
|
|
18
37
|
export interface ProjectAgentEvidenceReadResult {
|
|
38
|
+
readonly browserCapsule?: BrowserEvidenceCapsule;
|
|
19
39
|
readonly interactiveAvailability?: 'origin_only';
|
|
20
40
|
readonly deliveryStatus?: 'available' | 'scope_denied' | 'unavailable';
|
|
21
41
|
readonly deliveries?: readonly EvidenceDelivery[];
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
export interface GroupChatMeta {
|
|
2
|
+
readonly id: string;
|
|
3
|
+
readonly title: string;
|
|
4
|
+
readonly description: string;
|
|
5
|
+
readonly memberBotIds: readonly string[];
|
|
6
|
+
readonly coordinatorBotId: string;
|
|
7
|
+
readonly pinnedPageIds: readonly string[];
|
|
8
|
+
readonly createdAt: string;
|
|
9
|
+
readonly updatedAt: string;
|
|
10
|
+
readonly archived: boolean;
|
|
11
|
+
readonly revision: number;
|
|
12
|
+
}
|
|
13
|
+
export interface GroupChatView {
|
|
14
|
+
readonly meta: GroupChatMeta;
|
|
15
|
+
readonly effectiveMembers: readonly {
|
|
16
|
+
readonly botId: string;
|
|
17
|
+
readonly name: string;
|
|
18
|
+
readonly role: 'peer' | 'project_agent';
|
|
19
|
+
readonly workspaceId: string | null;
|
|
20
|
+
}[];
|
|
21
|
+
readonly latestSeq: number;
|
|
22
|
+
readonly turnId: string | null;
|
|
23
|
+
readonly turnState: string | null;
|
|
24
|
+
readonly queuedInputId: string | null;
|
|
25
|
+
}
|
|
26
|
+
export interface GroupChatEvent {
|
|
27
|
+
readonly groupId: string;
|
|
28
|
+
readonly seq: number;
|
|
29
|
+
readonly eventId: string;
|
|
30
|
+
readonly turnId?: string;
|
|
31
|
+
readonly authorKind: 'user' | 'bot' | 'system';
|
|
32
|
+
readonly authorBotId?: string;
|
|
33
|
+
readonly messageId?: string;
|
|
34
|
+
readonly at: string;
|
|
35
|
+
readonly type: 'member_changed' | 'context_boundary' | 'user_input' | 'bot_message' | 'handoff' | 'approval_ref' | 'matter_ref' | 'page_ref' | 'turn_state';
|
|
36
|
+
readonly payload: Readonly<Record<string, unknown>>;
|
|
37
|
+
}
|
|
38
|
+
export type GroupChatWindow = {
|
|
39
|
+
readonly events: readonly GroupChatEvent[];
|
|
40
|
+
readonly snapshotSeq: number;
|
|
41
|
+
readonly latestSeq: number;
|
|
42
|
+
readonly nextBeforeCursor: string | null;
|
|
43
|
+
};
|
|
44
|
+
export interface GroupChatMention {
|
|
45
|
+
readonly botId: string;
|
|
46
|
+
/** Half-open UTF-16 offsets into the submitted text. */
|
|
47
|
+
readonly start: number;
|
|
48
|
+
readonly end: number;
|
|
49
|
+
}
|
|
50
|
+
export interface GroupChatSend {
|
|
51
|
+
readonly groupChatId: string;
|
|
52
|
+
readonly inputId: string;
|
|
53
|
+
readonly operationId: string;
|
|
54
|
+
readonly text: string;
|
|
55
|
+
readonly mentions?: readonly GroupChatMention[];
|
|
56
|
+
readonly attachments?: readonly {
|
|
57
|
+
readonly workspaceId: string;
|
|
58
|
+
readonly messageId: string;
|
|
59
|
+
readonly attachmentId: string;
|
|
60
|
+
}[];
|
|
61
|
+
readonly onBusy?: 'reject' | 'queue';
|
|
62
|
+
readonly correction?: {
|
|
63
|
+
readonly turnId: string;
|
|
64
|
+
readonly approvalId: string;
|
|
65
|
+
readonly cancelPending?: boolean;
|
|
66
|
+
};
|
|
67
|
+
readonly answerTo?: {
|
|
68
|
+
readonly turnId: string;
|
|
69
|
+
readonly questionId: string;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export type GroupChatSendReceipt = {
|
|
73
|
+
readonly seq: number;
|
|
74
|
+
readonly inputId: string;
|
|
75
|
+
readonly messageId: string;
|
|
76
|
+
} & ({
|
|
77
|
+
readonly status: 'accepted';
|
|
78
|
+
readonly turnId: string;
|
|
79
|
+
} | {
|
|
80
|
+
readonly status: 'queued';
|
|
81
|
+
readonly turnId: null;
|
|
82
|
+
});
|
|
83
|
+
export type GroupChatChanged = {
|
|
84
|
+
readonly groupChatId: string;
|
|
85
|
+
readonly revision: number;
|
|
86
|
+
readonly latestSeq: number;
|
|
87
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
export type * from './group-chat.ts';
|
|
2
|
+
export type * from './routine.ts';
|
|
3
|
+
export type * from './persistent-workspace.ts';
|
|
4
|
+
export { isGlobalBotProfile } from './project.ts';
|
|
5
|
+
export { BOT_CONTEXT_BOUNDARY_KIND } from './project.ts';
|
|
6
|
+
export type { NewBotConversationResult, EnsureGlobalBotResult, GlobalBotErrorCode, GlobalBotPreferences, GlobalBotPreferencesResult, GlobalBotPreferencesUpdate, GlobalBotRpc, GlobalBotRpcFailure, GlobalBotRpcNotifications } from './project.ts';
|
|
7
|
+
export type { BotTeam, BotTeams, BotTeamsResult, UpdateBotTeams, BotTeamsRpc, BotTeamsNotifications } from './workspace.ts';
|
|
1
8
|
export type { BotDirectAction, BotDirectStep } from './bot-direct-step.ts';
|
|
2
9
|
export { WORK_HOOK_SEMANTIC_FLOOR, nativeWorkHasHookFacts } from './work-hook.ts';
|
|
3
10
|
export type { AttentionCard, BotDecisionSnapshot, BotAttentionItem, BotAttentionRequest, BotAttentionResult } from './attention.ts';
|
|
@@ -915,6 +922,7 @@ export * from './appshot.ts';
|
|
|
915
922
|
export * from './automation.ts';
|
|
916
923
|
export * from './task-overview.ts';
|
|
917
924
|
export * from './skill-marketplace.ts';
|
|
925
|
+
export * from './prompt-skill.ts';
|
|
918
926
|
export * from './delegation.ts';
|
|
919
927
|
export * from './bot-git.ts';
|
|
920
928
|
export * from './model-routing.ts';
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { isGlobalBotProfile } from "./project.js";
|
|
2
|
+
export { BOT_CONTEXT_BOUNDARY_KIND } from "./project.js";
|
|
1
3
|
export { WORK_HOOK_SEMANTIC_FLOOR, nativeWorkHasHookFacts } from "./work-hook.js";
|
|
2
4
|
export { deriveSessionFacts } from "./session-facts.js";
|
|
3
5
|
export { runtimeSessionFacts, runtimeSessionOwnership, hasPendingRuntimeSessions } from "./runtime-session-facts.js";
|
|
@@ -43,6 +45,7 @@ export * from "./appshot.js";
|
|
|
43
45
|
export * from "./automation.js";
|
|
44
46
|
export * from "./task-overview.js";
|
|
45
47
|
export * from "./skill-marketplace.js";
|
|
48
|
+
export * from "./prompt-skill.js";
|
|
46
49
|
export * from "./delegation.js";
|
|
47
50
|
export * from "./bot-git.js";
|
|
48
51
|
export * from "./model-routing.js";
|
package/dist/memory.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Project memory contracts. Entries are facts for continuity, not instructions.
|
|
3
3
|
*/
|
|
4
4
|
import type { MessageDisposition } from './delegation.ts';
|
|
5
|
-
export type MemoryKind = 'fact' | 'preference' | 'decision' | 'procedure' | 'responsibility';
|
|
5
|
+
export type MemoryKind = 'fact' | 'preference' | 'decision' | 'procedure' | 'responsibility' | 'project_preference' | 'user_preference' | 'user_profile' | 'cross_project_rule';
|
|
6
6
|
export type MemoryTrust = 'verified' | 'stated' | 'inferred';
|
|
7
7
|
export type MemoryStatus = 'active' | 'needs_reverify' | 'conflicted' | 'quarantined' | 'archived';
|
|
8
8
|
export type LegacyMemoryStatus = Extract<MemoryStatus, 'active' | 'conflicted'> | 'forgotten' | 'expired';
|
|
@@ -87,7 +87,22 @@ export interface MemorySnapshot {
|
|
|
87
87
|
readonly createdAt: string;
|
|
88
88
|
}
|
|
89
89
|
/** 记忆页跨进程载荷。渲染层不读存储。 */
|
|
90
|
+
export type MemorySourceOrigin = 'direct_user_chat' | 'group_chat' | 'daemon_routine' | 'matter_delivery' | 'external_tool_output' | 'unknown';
|
|
90
91
|
export interface ProjectMemoryRecord extends MemoryValidityFields {
|
|
92
|
+
readonly revision?: MemoryRevision;
|
|
93
|
+
readonly importance?: 1 | 2 | 3 | 4 | 5;
|
|
94
|
+
readonly applicability?: {
|
|
95
|
+
readonly condition?: string;
|
|
96
|
+
readonly paths?: readonly string[];
|
|
97
|
+
};
|
|
98
|
+
readonly supersedes?: readonly string[];
|
|
99
|
+
readonly sources?: readonly {
|
|
100
|
+
readonly kind: string;
|
|
101
|
+
readonly ref: string;
|
|
102
|
+
readonly quote: string;
|
|
103
|
+
}[];
|
|
104
|
+
readonly useCount?: number;
|
|
105
|
+
readonly correctionCount?: number;
|
|
91
106
|
readonly id: string;
|
|
92
107
|
readonly scope: 'project' | 'user';
|
|
93
108
|
readonly workspaceId?: string;
|
|
@@ -129,13 +144,16 @@ export interface ProjectMemoryPolicyResult {
|
|
|
129
144
|
readonly policy?: EffectiveMemoryPolicy;
|
|
130
145
|
}
|
|
131
146
|
export interface ProjectMemoryListRequest {
|
|
147
|
+
readonly includeInactive?: boolean;
|
|
132
148
|
readonly workspaceId: string;
|
|
133
149
|
readonly kind?: MemoryKind;
|
|
134
150
|
readonly trust?: MemoryTrust;
|
|
135
151
|
readonly status?: LegacyMemoryStatus;
|
|
136
152
|
readonly ids?: readonly string[];
|
|
153
|
+
readonly references?: readonly MemoryRef[];
|
|
137
154
|
}
|
|
138
155
|
export interface ProjectMemoryListResult {
|
|
156
|
+
readonly managedTopics?: boolean;
|
|
139
157
|
readonly ok: boolean;
|
|
140
158
|
readonly code?: string;
|
|
141
159
|
readonly items?: readonly ProjectMemoryRecord[];
|
|
@@ -146,6 +164,20 @@ export interface ProjectMemoryPinRequest {
|
|
|
146
164
|
readonly id: string;
|
|
147
165
|
readonly pinned: boolean;
|
|
148
166
|
}
|
|
167
|
+
export interface ProjectMemoryPurgeRequest {
|
|
168
|
+
readonly workspaceId: string;
|
|
169
|
+
readonly id: string;
|
|
170
|
+
readonly expectedRevision: string;
|
|
171
|
+
readonly confirmed: true;
|
|
172
|
+
}
|
|
173
|
+
export interface MemoryGovernanceResult {
|
|
174
|
+
readonly ok: boolean;
|
|
175
|
+
readonly code?: string;
|
|
176
|
+
readonly status?: 'purged';
|
|
177
|
+
readonly batchId?: string;
|
|
178
|
+
readonly expired?: number;
|
|
179
|
+
readonly proposed?: number;
|
|
180
|
+
}
|
|
149
181
|
export interface ProjectMemoryForgetRequest {
|
|
150
182
|
readonly workspaceId: string;
|
|
151
183
|
readonly id: string;
|
|
@@ -157,6 +189,7 @@ export interface ProjectMemoryRestoreRequest {
|
|
|
157
189
|
readonly resolveConflict?: boolean;
|
|
158
190
|
}
|
|
159
191
|
export interface ProjectMemoryEditRequest {
|
|
192
|
+
readonly expectedRevision?: string;
|
|
160
193
|
readonly workspaceId: string;
|
|
161
194
|
readonly id: string;
|
|
162
195
|
readonly text: string;
|
|
@@ -207,3 +240,15 @@ export type MemoryAdmission = {
|
|
|
207
240
|
export declare function assessMemoryCandidate(item: MemoryItem, options?: {
|
|
208
241
|
readonly resolvableRefs?: readonly string[];
|
|
209
242
|
}): MemoryAdmission;
|
|
243
|
+
export interface MemoryReviewCandidate {
|
|
244
|
+
readonly action?: 'stale' | 'merge';
|
|
245
|
+
readonly id: string;
|
|
246
|
+
readonly revision: number;
|
|
247
|
+
readonly text: string;
|
|
248
|
+
}
|
|
249
|
+
export type MemoryCandidateChoice = 'project' | 'global' | 'ignore';
|
|
250
|
+
export interface MemoryLearnedRequest {
|
|
251
|
+
readonly workspaceId: string;
|
|
252
|
+
readonly turnId: string;
|
|
253
|
+
readonly reference: MemoryRef;
|
|
254
|
+
}
|