@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,84 @@
1
+ import type { BotDocumentReference } from './document-reference.ts';
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
+ }
19
+ /** Read-only display facts. A saved operation is not proof that its task completed. */
20
+ export interface EvidenceSourceDescription {
21
+ readonly browserCapsule?: BrowserEvidenceCapsule;
22
+ readonly evidenceRef: string;
23
+ readonly toolName?: string;
24
+ readonly createdAt?: string;
25
+ }
26
+ export interface ProjectAgentEvidenceReadRequest {
27
+ readonly context?: {
28
+ readonly workspaceId: string;
29
+ readonly turnId?: string;
30
+ readonly matterId?: string;
31
+ readonly task?: BotDocumentReference['task'];
32
+ };
33
+ readonly evidenceRef?: string;
34
+ /** Source descriptions only; at most 100 unique references, no body or artifact reads. */
35
+ readonly evidenceRefs?: readonly string[];
36
+ }
37
+ export interface ProjectAgentEvidenceReadResult {
38
+ readonly browserCapsule?: BrowserEvidenceCapsule;
39
+ readonly interactiveAvailability?: 'origin_only';
40
+ readonly deliveryStatus?: 'available' | 'scope_denied' | 'unavailable';
41
+ readonly deliveries?: readonly EvidenceDelivery[];
42
+ readonly ok: boolean;
43
+ readonly code?: string;
44
+ readonly evidenceRef?: string;
45
+ readonly kind?: 'file' | 'command' | 'diff' | 'screenshot' | 'observation';
46
+ readonly summary?: string;
47
+ readonly truncated?: boolean;
48
+ readonly availability?: 'available' | 'metadata_only' | 'not_found' | 'unavailable';
49
+ readonly source?: EvidenceSourceDescription;
50
+ readonly items?: readonly EvidenceSourceDescription[];
51
+ }
52
+ /** Navigation provenance only; revalidated against the canonical index after restore. */
53
+ export interface EvidenceDeliveryBinding {
54
+ readonly evidenceRef: string;
55
+ readonly artifactRef: string;
56
+ }
57
+ export interface EvidenceFileDelivery extends EvidenceDeliveryBinding {
58
+ readonly kind: 'file' | 'code-change' | 'image';
59
+ readonly label: string;
60
+ /** A locator, never a grant or proof of historical bytes. Read through the existing scoped service. */
61
+ readonly reference?: BotDocumentReference;
62
+ readonly savedPreview?: {
63
+ readonly kind: 'diff-summary';
64
+ readonly text: string;
65
+ readonly truncated: true;
66
+ } | {
67
+ readonly kind: 'image';
68
+ readonly dataUrl: string;
69
+ readonly width: number;
70
+ readonly height: number;
71
+ };
72
+ readonly previewUnavailable?: boolean;
73
+ }
74
+ /** A published domain reference. Never a filesystem locator or execution/verification receipt. */
75
+ export interface EvidenceInteractiveDelivery extends EvidenceDeliveryBinding {
76
+ readonly kind: 'interactive';
77
+ readonly label: string;
78
+ readonly interactiveReference: InteractiveResultReference;
79
+ readonly specHash: string;
80
+ readonly reference?: never;
81
+ readonly savedPreview?: never;
82
+ readonly previewUnavailable?: never;
83
+ }
84
+ export type EvidenceDelivery = EvidenceFileDelivery | EvidenceInteractiveDelivery;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,105 @@
1
+ {
2
+ "gemini-2.5-pro": {
3
+ "standard": {
4
+ "inputPrice": "1.25",
5
+ "outputPrice": "10",
6
+ "cacheReadPrice": "0.125"
7
+ },
8
+ "longContext": {
9
+ "inputPrice": "2.50",
10
+ "outputPrice": "15",
11
+ "cacheReadPrice": "0.25"
12
+ }
13
+ },
14
+ "gemini-2.5-flash": {
15
+ "standard": {
16
+ "inputPrice": "0.30",
17
+ "outputPrice": "2.50",
18
+ "cacheReadPrice": "0.03",
19
+ "audioInputPrice": "1.00",
20
+ "audioCacheReadPrice": "0.10"
21
+ }
22
+ },
23
+ "gemini-2.5-flash-lite": {
24
+ "standard": {
25
+ "inputPrice": "0.10",
26
+ "outputPrice": "0.40",
27
+ "cacheReadPrice": "0.01",
28
+ "audioInputPrice": "0.30",
29
+ "audioCacheReadPrice": "0.03"
30
+ }
31
+ },
32
+ "gemini-3-pro-preview": {
33
+ "standard": {
34
+ "inputPrice": "2",
35
+ "outputPrice": "12",
36
+ "cacheReadPrice": "0.20"
37
+ },
38
+ "longContext": {
39
+ "inputPrice": "4",
40
+ "outputPrice": "18",
41
+ "cacheReadPrice": "0.40"
42
+ }
43
+ },
44
+ "gemini-3.1-pro-preview": {
45
+ "standard": {
46
+ "inputPrice": "2",
47
+ "outputPrice": "12",
48
+ "cacheReadPrice": "0.20"
49
+ },
50
+ "longContext": {
51
+ "inputPrice": "4",
52
+ "outputPrice": "18",
53
+ "cacheReadPrice": "0.40"
54
+ }
55
+ },
56
+ "gemini-3.1-pro-preview-customtools": {
57
+ "standard": {
58
+ "inputPrice": "2",
59
+ "outputPrice": "12",
60
+ "cacheReadPrice": "0.20"
61
+ },
62
+ "longContext": {
63
+ "inputPrice": "4",
64
+ "outputPrice": "18",
65
+ "cacheReadPrice": "0.40"
66
+ }
67
+ },
68
+ "gemini-3-flash-preview": {
69
+ "standard": {
70
+ "inputPrice": "0.50",
71
+ "outputPrice": "3",
72
+ "cacheReadPrice": "0.05",
73
+ "audioInputPrice": "1",
74
+ "audioCacheReadPrice": "0.10"
75
+ }
76
+ },
77
+ "gemini-3.1-flash-lite": {
78
+ "standard": {
79
+ "inputPrice": "0.25",
80
+ "outputPrice": "1.50",
81
+ "cacheReadPrice": "0.025",
82
+ "audioInputPrice": "0.50",
83
+ "audioCacheReadPrice": "0.05"
84
+ }
85
+ },
86
+ "gemini-3.5-flash-lite": {
87
+ "standard": {
88
+ "inputPrice": "0.30",
89
+ "outputPrice": "2.50",
90
+ "cacheReadPrice": "0.03"
91
+ }
92
+ },
93
+ "gemini-3.8-flash": {
94
+ "standard": {
95
+ "inputPrice": "0.75",
96
+ "outputPrice": "3.75",
97
+ "cacheReadPrice": "0.075"
98
+ },
99
+ "afterNewYear": {
100
+ "inputPrice": "1.50",
101
+ "outputPrice": "7.50",
102
+ "cacheReadPrice": "0.15"
103
+ }
104
+ }
105
+ }
package/dist/goal.d.ts CHANGED
@@ -163,10 +163,11 @@ export interface EvidenceIndexRecord {
163
163
  readonly capabilityId?: string;
164
164
  readonly toolName?: string;
165
165
  readonly createdAt: string;
166
+ readonly interactiveInspection?: import('./interactive-verification.ts').InteractiveInspectionReceipt;
166
167
  readonly artifactRefs?: readonly string[];
167
168
  /** Redacted, bounded execution-time snapshot of a successful local Tool Result. */
168
169
  readonly bodyPreview?: {
169
- readonly kind: 'file' | 'command';
170
+ readonly kind: 'file' | 'command' | 'observation';
170
171
  readonly text: string;
171
172
  readonly truncated: boolean;
172
173
  };
@@ -444,14 +445,30 @@ export interface GoalRunTrace {
444
445
  readonly lastCheckpointNodeId?: string;
445
446
  readonly events: readonly GoalRunEvent[];
446
447
  }
447
- export type GoalSuccessCriterionKind = 'command' | 'test' | 'file-contains' | 'file-exists' | 'manual';
448
+ export type GoalSuccessCriterionKind = 'command' | 'test' | 'file-contains' | 'file-exists' | 'model_review' | 'manual';
448
449
  export interface GoalSuccessCriterion {
450
+ readonly requiredCapabilities?: readonly string[];
449
451
  readonly id: string;
450
452
  readonly kind: GoalSuccessCriterionKind;
451
453
  readonly description: string;
452
454
  readonly command?: string;
453
455
  readonly path?: string;
454
456
  readonly expect?: string;
457
+ readonly authority?: {
458
+ readonly source: 'model' | 'user' | 'project_policy' | 'legacy_unknown';
459
+ readonly sourceRef?: string;
460
+ readonly version: number;
461
+ readonly verifier: 'mechanical' | 'host_model' | 'human';
462
+ readonly rationale: string;
463
+ };
464
+ }
465
+ export interface GoalModelReview {
466
+ readonly criterionId: string;
467
+ readonly sourceRevision: string;
468
+ readonly verifierRunId: string;
469
+ readonly passed: boolean;
470
+ readonly evidenceRefs: readonly string[];
471
+ readonly checkedAt: string;
455
472
  }
456
473
  export interface GoalCriterionResult {
457
474
  readonly criterionId: string;
@@ -567,6 +584,33 @@ export interface GoalExecutionCheckpoint {
567
584
  }
568
585
  /** GoalPlan 内嵌的轻量 runner 状态;不代表工具执行事实,任务完成仍必须由 Evidence 回写。 */
569
586
  export interface GoalRunnerState {
587
+ /** Host-owned readonly review continuity. Native messages stay in registered checkpoint storage. */
588
+ readonly verificationContinuation?: {
589
+ readonly schemaVersion: 1;
590
+ readonly policyVersion?: 2;
591
+ readonly planId: string;
592
+ readonly continuationId: string;
593
+ readonly sourceRevision: string;
594
+ readonly modelKey: string;
595
+ readonly workId?: string;
596
+ readonly phase: 'ready' | 'requesting' | 'tools' | 'completed';
597
+ /** Current slice deadline; legacy review-wide deadlines are renewed only on safe admission. */
598
+ readonly deadlineAt: string;
599
+ readonly modelRequests: number;
600
+ readonly toolCalls: number;
601
+ readonly formatAttempt: number;
602
+ readonly previousText?: string;
603
+ readonly checkpointRef?: string;
604
+ readonly evidenceRefs: readonly string[];
605
+ readonly fingerprint?: string;
606
+ readonly repeats?: number;
607
+ readonly progressFacts?: readonly string[];
608
+ readonly startedAt?: string;
609
+ readonly lastProgressAt?: string;
610
+ readonly observationCount?: number;
611
+ readonly observationFacts?: readonly string[];
612
+ readonly formatRequests?: number;
613
+ };
570
614
  readonly enabled: boolean;
571
615
  readonly status: GoalRunnerStatus;
572
616
  readonly intent?: GoalRunnerIntent;
@@ -616,6 +660,7 @@ export interface GoalRunnerState {
616
660
  * 中断在计划状态重派生时被误判为完成。
617
661
  */
618
662
  readonly interruption?: {
663
+ readonly origin?: import('./agent-supervision.ts').InterruptionOrigin;
619
664
  readonly source: string;
620
665
  readonly reason: string;
621
666
  readonly interruptedAt: string;
@@ -678,6 +723,9 @@ export interface GoalPlan {
678
723
  readonly successCriteria: readonly GoalSuccessCriterion[];
679
724
  readonly criterionResults: readonly GoalCriterionResult[];
680
725
  readonly manualConfirmations?: readonly GoalManualConfirmation[];
726
+ readonly modelReviews?: readonly GoalModelReview[];
727
+ /** Host-derived current revision for checking semantic review freshness. */
728
+ readonly modelReviewSourceRevision?: string;
681
729
  readonly boundaries: GoalBoundaries;
682
730
  readonly exceptionPolicies: ExceptionPolicy[];
683
731
  /** 顶层汇总(来源于子任务) */
@@ -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 {};
@@ -0,0 +1,2 @@
1
+ /** The structured observation shared by Conversation and Work. */
2
+ export declare function isHookObservation(input: unknown, event: unknown, ruleDigest: string, handleId: unknown): boolean;
@@ -0,0 +1,19 @@
1
+ /** The structured observation shared by Conversation and Work. */
2
+ export function isHookObservation(input, event, ruleDigest, handleId) {
3
+ const note = (value) => typeof value === 'string'
4
+ && new TextEncoder().encode(value).length <= 1024
5
+ && !/[\u0000-\u001f\u007f-\u009f]/u.test(value);
6
+ if (!input || typeof input !== 'object' || Array.isArray(input))
7
+ return false;
8
+ const value = input;
9
+ return Object.keys(value).length === 10
10
+ && value.event === event && value.ruleDigest === ruleDigest && value.handleId === handleId
11
+ && ['allow', 'ask', 'deny'].some(decision => decision === value.decision)
12
+ && typeof value.outcome === 'string' && value.outcome.length > 0
13
+ && new TextEncoder().encode(value.outcome).length <= 128
14
+ && (value.exitCode === null || typeof value.exitCode === 'number' && Number.isInteger(value.exitCode)
15
+ && value.exitCode >= -2147483648 && value.exitCode <= 2147483647)
16
+ && Number.isSafeInteger(value.durationMs) && value.durationMs >= 0
17
+ && note(value.id) && value.hookId === value.id
18
+ && (value.reason === null || note(value.reason));
19
+ }