@peer-agent/protocol 0.1.0-rc.22 → 0.1.0-rc.24
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/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/delegation.d.ts +14 -2
- package/dist/goal.d.ts +5 -0
- package/dist/index.d.ts +4 -0
- package/dist/local-image.d.ts +1 -0
- package/dist/project.d.ts +4 -0
- package/dist/project.js +2 -5
- package/package.json +1 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/** Read-only presentation facts. Actions remain subject to their original host gates. */
|
|
2
|
+
export interface AttentionCard {
|
|
3
|
+
readonly cardId: string;
|
|
4
|
+
readonly kind: string;
|
|
5
|
+
readonly content: string;
|
|
6
|
+
readonly resolvedState?: 'open' | 'resolved';
|
|
7
|
+
readonly actions?: readonly {
|
|
8
|
+
readonly id: string;
|
|
9
|
+
readonly channel?: string;
|
|
10
|
+
readonly seam?: string;
|
|
11
|
+
readonly payload?: Readonly<Record<string, unknown>>;
|
|
12
|
+
}[];
|
|
13
|
+
readonly refs?: Readonly<Record<string, string>>;
|
|
14
|
+
readonly resolution?: {
|
|
15
|
+
readonly state: string;
|
|
16
|
+
};
|
|
17
|
+
readonly completionReview?: import('./delegation.ts').SessionCompletionReview;
|
|
18
|
+
}
|
|
19
|
+
export interface BotAttentionItem {
|
|
20
|
+
readonly id: string;
|
|
21
|
+
readonly workspaceId: string;
|
|
22
|
+
readonly botName: string;
|
|
23
|
+
readonly kind: 'question' | 'approval' | 'confirmation';
|
|
24
|
+
readonly title: string;
|
|
25
|
+
readonly createdAt?: string;
|
|
26
|
+
readonly expiresAt?: string;
|
|
27
|
+
readonly messageId?: string;
|
|
28
|
+
readonly sessionId?: string;
|
|
29
|
+
readonly card?: AttentionCard;
|
|
30
|
+
}
|
|
31
|
+
export interface BotAttentionRequest {
|
|
32
|
+
readonly workspaceId?: string;
|
|
33
|
+
}
|
|
34
|
+
export type BotAttentionResult = {
|
|
35
|
+
readonly ok: true;
|
|
36
|
+
readonly items: readonly BotAttentionItem[];
|
|
37
|
+
} | {
|
|
38
|
+
readonly ok: false;
|
|
39
|
+
readonly code: string;
|
|
40
|
+
};
|
|
41
|
+
/** Current conversational decision, including when its source lies outside the returned page. */
|
|
42
|
+
export interface BotDecisionSnapshot {
|
|
43
|
+
readonly activeReplyQuestionId: string | null;
|
|
44
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { LocalAccessLevel } from './index.ts';
|
|
2
|
+
/** Device-local user authority. Never supplied by a model or copied into a worker profile. */
|
|
3
|
+
export interface BotAccessPolicy {
|
|
4
|
+
readonly workspaceId: string;
|
|
5
|
+
readonly conversationId: string;
|
|
6
|
+
readonly accessLevel: LocalAccessLevel;
|
|
7
|
+
readonly revision: number;
|
|
8
|
+
readonly updatedAt: string;
|
|
9
|
+
readonly source: 'legacy_migration' | 'new_bot' | 'local_ui';
|
|
10
|
+
}
|
|
11
|
+
export interface BotAccessPolicyReadRequest {
|
|
12
|
+
readonly workspaceId?: string;
|
|
13
|
+
readonly conversationId?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface BotAccessPolicyUpdateRequest {
|
|
16
|
+
readonly workspaceId: string;
|
|
17
|
+
readonly expectedRevision: number;
|
|
18
|
+
readonly accessLevel: LocalAccessLevel;
|
|
19
|
+
}
|
|
20
|
+
export type BotAccessPolicyResult = {
|
|
21
|
+
readonly ok: true;
|
|
22
|
+
readonly policy: BotAccessPolicy | null;
|
|
23
|
+
readonly inherited: boolean;
|
|
24
|
+
readonly botName?: string;
|
|
25
|
+
} | {
|
|
26
|
+
readonly ok: false;
|
|
27
|
+
readonly code: 'INVALID_INPUT' | 'NOT_FOUND' | 'OUT_OF_SCOPE' | 'POLICY_CONFLICT' | 'POLICY_UNAVAILABLE' | 'PROJECT_AGENT_DISABLED';
|
|
28
|
+
readonly policy?: BotAccessPolicy;
|
|
29
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/delegation.d.ts
CHANGED
|
@@ -66,6 +66,9 @@ export interface WorkSessionConversationMeta extends SessionQueueFacts {
|
|
|
66
66
|
readonly phase?: 'starting' | 'verifying' | 'paused';
|
|
67
67
|
}
|
|
68
68
|
export interface WorkSession extends SessionQueueFacts {
|
|
69
|
+
readonly verificationProgress?: VerificationProgress;
|
|
70
|
+
readonly completionReviewRequired?: boolean;
|
|
71
|
+
readonly resultConfirmationRequired?: boolean;
|
|
69
72
|
readonly coordination?: import('./delegation-coordination.ts').CoordinationSessionFacts;
|
|
70
73
|
readonly sessionId: string;
|
|
71
74
|
readonly workspaceId: string;
|
|
@@ -115,11 +118,19 @@ export interface AgentMessage {
|
|
|
115
118
|
readonly text: string;
|
|
116
119
|
readonly at: string;
|
|
117
120
|
}
|
|
121
|
+
export interface VerificationProgress {
|
|
122
|
+
readonly continuationId: string;
|
|
123
|
+
readonly startedAt: string;
|
|
124
|
+
readonly lastProgressAt: string;
|
|
125
|
+
readonly observationCount: number;
|
|
126
|
+
readonly phase: 'ready' | 'requesting' | 'tools' | 'completed';
|
|
127
|
+
}
|
|
118
128
|
export interface AgentActivity {
|
|
129
|
+
readonly verificationProgress?: VerificationProgress;
|
|
119
130
|
readonly eventId: string;
|
|
120
131
|
readonly sessionId: string;
|
|
121
132
|
readonly name: string;
|
|
122
|
-
readonly state: 'queued' | 'started' | 'update' | 'question' | 'answer' | 'reported' | 'verified' | 'ended' | 'cancelled' | 'blocked';
|
|
133
|
+
readonly state: 'queued' | 'started' | 'update' | 'question' | 'answer' | 'reported' | 'verified' | 'verifying' | 'ended' | 'cancelled' | 'blocked';
|
|
123
134
|
}
|
|
124
135
|
export type JsonValue = null | string | number | boolean | readonly JsonValue[] | {
|
|
125
136
|
readonly [key: string]: JsonValue;
|
|
@@ -322,6 +333,7 @@ export interface ProjectInput {
|
|
|
322
333
|
}
|
|
323
334
|
export type PendingApprovalState = 'open' | 'approved' | 'denied' | 'expired' | 'stale' | 'cancelled';
|
|
324
335
|
export interface PendingApproval {
|
|
336
|
+
readonly policyRevision?: string;
|
|
325
337
|
readonly imageReadScope?: import('./local-image.ts').LocalImagePermissionScope;
|
|
326
338
|
readonly imageReadGrant?: import('./local-image.ts').ImageReadGrant;
|
|
327
339
|
readonly approvalId: string;
|
|
@@ -338,7 +350,7 @@ export interface PendingApproval {
|
|
|
338
350
|
readonly createdAt: string;
|
|
339
351
|
readonly state: PendingApprovalState;
|
|
340
352
|
readonly deadlineAt?: string;
|
|
341
|
-
readonly decisionReason?: 'permission_cancelled' | 'permission_timeout' | 'permission_unavailable' | 'local_user_denied';
|
|
353
|
+
readonly decisionReason?: 'permission_cancelled' | 'permission_timeout' | 'permission_unavailable' | 'local_user_denied' | 'permission_policy_changed';
|
|
342
354
|
readonly decidedAt?: string;
|
|
343
355
|
readonly decidedBy?: 'local_ui' | 'policy';
|
|
344
356
|
}
|
package/dist/goal.d.ts
CHANGED
|
@@ -603,6 +603,11 @@ export interface GoalRunnerState {
|
|
|
603
603
|
readonly fingerprint?: string;
|
|
604
604
|
readonly repeats?: number;
|
|
605
605
|
readonly progressFacts?: readonly string[];
|
|
606
|
+
readonly startedAt?: string;
|
|
607
|
+
readonly lastProgressAt?: string;
|
|
608
|
+
readonly observationCount?: number;
|
|
609
|
+
readonly observationFacts?: readonly string[];
|
|
610
|
+
readonly formatRequests?: number;
|
|
606
611
|
};
|
|
607
612
|
readonly enabled: boolean;
|
|
608
613
|
readonly status: GoalRunnerStatus;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export type { AttentionCard, BotDecisionSnapshot, BotAttentionItem, BotAttentionRequest, BotAttentionResult } from './attention.ts';
|
|
1
2
|
export type { ProjectWorkBudgetLimits, ProjectWorkBudgetBoundary, ProjectReplyRecoveryAction, ProjectWorkReceipt, ProjectWorkRecovery, ProjectWorkState, ProjectTurnEnd, ProjectReplyFailureStatus, ProjectAgentSilentWait } from './work-coordination.ts';
|
|
2
3
|
export type { CoordinationAction, CoordinationLifecycle, CoordinationMandate, CoordinationDecision, TaskTransitionPhase, TaskTransition, CoordinationExecutionBinding, CoordinationSessionFacts } from './delegation-coordination.ts';
|
|
3
4
|
export { deriveSessionFacts, type SessionFactSnapshot } from './session-facts.ts';
|
|
@@ -16,6 +17,7 @@ export type { RemoteReadRequest, RemoteReadContext, RemoteReadRejection, RemoteR
|
|
|
16
17
|
export { REMOTE_PROJECT_LIMITS, parseRemoteProjectRequest, admitRemoteProject, parseRemoteDelegationProjection } from './remote-access.ts';
|
|
17
18
|
export type { RemoteProjectGrant, RemoteProjectRequest, RemoteProjectContext, RemoteProjectRejection, RemoteProjectAdmission, RemoteDelegationProjection } from './remote-access.ts';
|
|
18
19
|
export type LocalAccessLevel = 'ask_before_local' | 'session_local' | 'restricted_local' | 'full_local';
|
|
20
|
+
export type { BotAccessPolicy, BotAccessPolicyReadRequest, BotAccessPolicyUpdateRequest, BotAccessPolicyResult } from './bot-access-policy.ts';
|
|
19
21
|
export type { ConversationLifetimeUsage, ProviderRequestUsage, RuntimeTurnUsage, UsageAmounts, UsageScope, } from './usage-accounting.ts';
|
|
20
22
|
export type CapabilityRiskLevel = 'L0_inert' | 'L1_local_read' | 'L2_local_write' | 'L3_external_write' | 'L4_privileged' | 'L5_destructive';
|
|
21
23
|
export type DataLevel = 'D0_public' | 'D1_internal' | 'D2_sensitive' | 'D3_private' | 'D4_regulated';
|
|
@@ -752,6 +754,8 @@ export interface ClientToolCallPollResult {
|
|
|
752
754
|
}
|
|
753
755
|
export type PermissionDuration = 'once' | 'task' | 'session' | 'scope' | 'persistent' | 'denied';
|
|
754
756
|
export interface PermissionGrant {
|
|
757
|
+
/** Host-issued policy version; audit provenance, never a client authority token. */
|
|
758
|
+
readonly policyRevision?: string;
|
|
755
759
|
readonly grantId: string;
|
|
756
760
|
readonly toolCallId: string;
|
|
757
761
|
readonly granted: boolean;
|
package/dist/local-image.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export interface LocalImagePermissionScope {
|
|
|
34
34
|
}
|
|
35
35
|
/** Local host-issued exact-image read authority; no pixels are persisted. */
|
|
36
36
|
export interface ImageReadGrant {
|
|
37
|
+
policyRevision?: string;
|
|
37
38
|
schemaVersion: 1;
|
|
38
39
|
grantId: string;
|
|
39
40
|
workspaceId: string | null;
|
package/dist/project.d.ts
CHANGED
|
@@ -173,6 +173,7 @@ export interface BotProfile {
|
|
|
173
173
|
}
|
|
174
174
|
export interface BotRowState {
|
|
175
175
|
readonly needsYou: number;
|
|
176
|
+
readonly attentionExpiresAt?: string;
|
|
176
177
|
readonly unread: number;
|
|
177
178
|
readonly running: number;
|
|
178
179
|
/** Ephemeral status of the runner hosted by this desktop process. */
|
|
@@ -266,6 +267,9 @@ export declare function projectBotListItem(input: {
|
|
|
266
267
|
readonly lastMessage?: BotListMessage | null;
|
|
267
268
|
readonly sessions?: readonly BotListSession[];
|
|
268
269
|
readonly approvals?: readonly BotListApproval[];
|
|
270
|
+
readonly attention?: readonly {
|
|
271
|
+
readonly id: string;
|
|
272
|
+
}[];
|
|
269
273
|
readonly readCursor?: string | null;
|
|
270
274
|
}): BotListItem;
|
|
271
275
|
export declare function sortBotList(items: readonly BotListItem[]): BotListItem[];
|
package/dist/project.js
CHANGED
|
@@ -22,7 +22,6 @@ export const BOT_AVATAR_COLORS = [
|
|
|
22
22
|
'#55bac7',
|
|
23
23
|
'#a8a59f',
|
|
24
24
|
];
|
|
25
|
-
const NEEDS_YOU_STATUSES = new Set(['waiting_user', 'result_ready']);
|
|
26
25
|
const RUNNING_STATUSES = new Set(['starting', 'running', 'verifying']);
|
|
27
26
|
function fnv1a(text) {
|
|
28
27
|
let hash = 0x811c9dc5;
|
|
@@ -51,9 +50,7 @@ function latestIso(values) {
|
|
|
51
50
|
}
|
|
52
51
|
export function projectBotListItem(input) {
|
|
53
52
|
const sessions = input.sessions ?? [];
|
|
54
|
-
const
|
|
55
|
-
const openApprovals = approvals.filter((item) => item.state === 'open' || item.state === 'stale').length;
|
|
56
|
-
const waitingSessions = sessions.filter((item) => NEEDS_YOU_STATUSES.has(item.status)).length;
|
|
53
|
+
const attention = new Set((input.attention ?? []).map(item => item.id));
|
|
57
54
|
const running = sessions.filter((item) => RUNNING_STATUSES.has(item.status)).length;
|
|
58
55
|
const lastMessage = input.lastMessage ?? null;
|
|
59
56
|
const unread = lastMessage
|
|
@@ -72,7 +69,7 @@ export function projectBotListItem(input) {
|
|
|
72
69
|
...sessions.map((item) => item.updatedAt),
|
|
73
70
|
]),
|
|
74
71
|
state: {
|
|
75
|
-
needsYou:
|
|
72
|
+
needsYou: attention.size,
|
|
76
73
|
unread,
|
|
77
74
|
running,
|
|
78
75
|
},
|