@peer-agent/protocol 0.1.0-rc.5 → 0.1.0-rc.50

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 (120) 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 +64 -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/hook-observation.d.ts +2 -0
  39. package/dist/hook-observation.js +19 -0
  40. package/dist/index.d.ts +109 -25
  41. package/dist/index.js +38 -0
  42. package/dist/input-prediction.d.ts +86 -0
  43. package/dist/input-prediction.js +48 -0
  44. package/dist/intent-coordination.d.ts +201 -0
  45. package/dist/intent-coordination.js +1 -0
  46. package/dist/interactive-result.d.ts +363 -0
  47. package/dist/interactive-result.js +215 -0
  48. package/dist/interactive-verification.d.ts +41 -0
  49. package/dist/interactive-verification.js +65 -0
  50. package/dist/local-git.d.ts +44 -0
  51. package/dist/local-git.js +3 -0
  52. package/dist/local-image.d.ts +53 -0
  53. package/dist/local-image.js +5 -0
  54. package/dist/local-read.d.ts +9 -0
  55. package/dist/local-read.js +1 -0
  56. package/dist/memory.d.ts +71 -11
  57. package/dist/memory.js +12 -0
  58. package/dist/model-reasoning.d.ts +16 -0
  59. package/dist/model-reasoning.js +25 -0
  60. package/dist/model-routing.d.ts +39 -3
  61. package/dist/model-routing.js +31 -5
  62. package/dist/native-process.d.ts +21 -0
  63. package/dist/native-process.js +51 -0
  64. package/dist/parent-coordination.d.ts +104 -0
  65. package/dist/parent-coordination.js +2 -0
  66. package/dist/project-agent-failure.d.ts +30 -0
  67. package/dist/project-agent-failure.js +44 -0
  68. package/dist/project-input-recovery.d.ts +83 -0
  69. package/dist/project-input-recovery.js +25 -0
  70. package/dist/project-matter.d.ts +225 -0
  71. package/dist/project-matter.js +1 -0
  72. package/dist/project-recovery.d.ts +43 -0
  73. package/dist/project-recovery.js +1 -0
  74. package/dist/project.d.ts +136 -0
  75. package/dist/project.js +130 -5
  76. package/dist/quiet-reply.d.ts +9 -0
  77. package/dist/quiet-reply.js +43 -0
  78. package/dist/remote-access.d.ts +15 -0
  79. package/dist/remote-access.js +1 -1
  80. package/dist/reply-delivery.d.ts +28 -0
  81. package/dist/reply-delivery.js +1 -0
  82. package/dist/resource-edit-execution.d.ts +68 -0
  83. package/dist/resource-edit-execution.js +96 -0
  84. package/dist/resource-edit.d.ts +237 -0
  85. package/dist/resource-edit.js +134 -0
  86. package/dist/resource-feedback-transport.d.ts +26 -0
  87. package/dist/resource-feedback-transport.js +94 -0
  88. package/dist/resource-feedback.d.ts +98 -0
  89. package/dist/resource-feedback.js +151 -0
  90. package/dist/resource-file-replace.d.ts +36 -0
  91. package/dist/resource-file-replace.js +40 -0
  92. package/dist/resource-reference-hints.d.ts +3 -0
  93. package/dist/resource-reference-hints.js +58 -0
  94. package/dist/resource-window.d.ts +222 -0
  95. package/dist/resource-window.js +252 -0
  96. package/dist/runtime-session-facts.d.ts +58 -0
  97. package/dist/runtime-session-facts.js +57 -0
  98. package/dist/session-control.d.ts +211 -0
  99. package/dist/session-control.js +48 -0
  100. package/dist/session-facts.d.ts +29 -0
  101. package/dist/session-facts.js +35 -0
  102. package/dist/skill-marketplace.d.ts +39 -4
  103. package/dist/spend-budget.d.ts +69 -0
  104. package/dist/spend-budget.js +1 -0
  105. package/dist/system-context.d.ts +7 -0
  106. package/dist/task-overview.d.ts +91 -0
  107. package/dist/task-overview.js +325 -17
  108. package/dist/tool-activity-preview.d.ts +4 -0
  109. package/dist/tool-activity-preview.js +72 -0
  110. package/dist/updater.d.ts +13 -3
  111. package/dist/usage-accounting.d.ts +42 -1
  112. package/dist/user-anchor.d.ts +17 -0
  113. package/dist/user-anchor.js +1 -0
  114. package/dist/work-coordination.d.ts +188 -0
  115. package/dist/work-coordination.js +1 -0
  116. package/dist/work-hook.d.ts +3 -0
  117. package/dist/work-hook.js +76 -0
  118. package/dist/working-plan.d.ts +18 -0
  119. package/dist/working-plan.js +1 -0
  120. package/package.json +1 -1
@@ -0,0 +1,64 @@
1
+ import type { BotDocumentReference } from './document-reference.ts';
2
+ import type { InteractiveResultReference } from './interactive-result.ts';
3
+ /** Read-only display facts. A saved operation is not proof that its task completed. */
4
+ export interface EvidenceSourceDescription {
5
+ readonly evidenceRef: string;
6
+ readonly toolName?: string;
7
+ readonly createdAt?: string;
8
+ }
9
+ export interface ProjectAgentEvidenceReadRequest {
10
+ readonly context?: {
11
+ readonly workspaceId: string;
12
+ readonly task?: BotDocumentReference['task'];
13
+ };
14
+ readonly evidenceRef?: string;
15
+ /** Source descriptions only; at most 100 unique references, no body or artifact reads. */
16
+ readonly evidenceRefs?: readonly string[];
17
+ }
18
+ export interface ProjectAgentEvidenceReadResult {
19
+ readonly interactiveAvailability?: 'origin_only';
20
+ readonly deliveryStatus?: 'available' | 'scope_denied' | 'unavailable';
21
+ readonly deliveries?: readonly EvidenceDelivery[];
22
+ readonly ok: boolean;
23
+ readonly code?: string;
24
+ readonly evidenceRef?: string;
25
+ readonly kind?: 'file' | 'command' | 'diff' | 'screenshot' | 'observation';
26
+ readonly summary?: string;
27
+ readonly truncated?: boolean;
28
+ readonly availability?: 'available' | 'metadata_only' | 'not_found' | 'unavailable';
29
+ readonly source?: EvidenceSourceDescription;
30
+ readonly items?: readonly EvidenceSourceDescription[];
31
+ }
32
+ /** Navigation provenance only; revalidated against the canonical index after restore. */
33
+ export interface EvidenceDeliveryBinding {
34
+ readonly evidenceRef: string;
35
+ readonly artifactRef: string;
36
+ }
37
+ export interface EvidenceFileDelivery extends EvidenceDeliveryBinding {
38
+ readonly kind: 'file' | 'code-change' | 'image';
39
+ readonly label: string;
40
+ /** A locator, never a grant or proof of historical bytes. Read through the existing scoped service. */
41
+ readonly reference?: BotDocumentReference;
42
+ readonly savedPreview?: {
43
+ readonly kind: 'diff-summary';
44
+ readonly text: string;
45
+ readonly truncated: true;
46
+ } | {
47
+ readonly kind: 'image';
48
+ readonly dataUrl: string;
49
+ readonly width: number;
50
+ readonly height: number;
51
+ };
52
+ readonly previewUnavailable?: boolean;
53
+ }
54
+ /** A published domain reference. Never a filesystem locator or execution/verification receipt. */
55
+ export interface EvidenceInteractiveDelivery extends EvidenceDeliveryBinding {
56
+ readonly kind: 'interactive';
57
+ readonly label: string;
58
+ readonly interactiveReference: InteractiveResultReference;
59
+ readonly specHash: string;
60
+ readonly reference?: never;
61
+ readonly savedPreview?: never;
62
+ readonly previewUnavailable?: never;
63
+ }
64
+ 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,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
+ }
package/dist/index.d.ts CHANGED
@@ -1,15 +1,28 @@
1
- export type { SelectionRange, SelectionReference, SelectionDraft, SelectionOrigin, SelectionChildSession, SelectionChildSummary, SelectionChildrenPage, SelectionChildRead } from './selection-reference.ts';
1
+ export type { BotDirectAction, BotDirectStep } from './bot-direct-step.ts';
2
+ export { WORK_HOOK_SEMANTIC_FLOOR, nativeWorkHasHookFacts } from './work-hook.ts';
3
+ export type { AttentionCard, BotDecisionSnapshot, BotAttentionItem, BotAttentionRequest, BotAttentionResult } from './attention.ts';
4
+ export type { ProjectWorkBudgetLimits, NativeEpisodeRecorder, ProjectWorkBudgetBoundary, ProjectReplyRecoveryAction, ProjectWorkReceipt, ProjectWorkRecovery, ProjectWorkState, ProjectTurnEnd, ProjectReplyFailureStatus, ProjectAgentSilentWait, } from './work-coordination.ts';
5
+ export type { CoordinationAction, CoordinationLifecycle, CoordinationMandate, CoordinationDecision, TaskTransitionPhase, TaskTransition, CoordinationExecutionBinding, CoordinationSessionFacts, } from './delegation-coordination.ts';
6
+ export { deriveSessionFacts, type SessionFactSnapshot } from './session-facts.ts';
7
+ export { runtimeSessionFacts, runtimeSessionOwnership, hasPendingRuntimeSessions } from './runtime-session-facts.ts';
8
+ export type { RuntimeHandling, RuntimeSessionFacts, RuntimeSessionOwnership, ResourceWaitScope, ResourceWaitReference, ResourceWaitFact, ResourceWaitInspection, ResourceWaitPort } from './runtime-session-facts.ts';
9
+ export { projectAgentFailureKind, classifyProjectAgentFailure, type ProjectRecoveryFailureKind, type ProviderRequestRecovery, type ProjectAgentTurnRecovery, type ReplyAnchorCandidate } from './project-agent-failure.ts';
10
+ export type { EvidenceSourceDescription, EvidenceDeliveryBinding, EvidenceDelivery, ProjectAgentEvidenceReadRequest, ProjectAgentEvidenceReadResult } from './evidence-inspection.ts';
11
+ export { toolActivityPreview, toolActivitySummary } from './tool-activity-preview.ts';
12
+ export { isModelReasoningEffort, modelReasoningLevels, modelDefaultReasoningEffort, type ModelReasoningEffort } from './model-reasoning.ts';
13
+ export type { SelectionRange, SelectionReference, SelectionDraft, SelectionOrigin, SelectionChildSession, SelectionChildSummary, SelectionChildrenPage, SelectionChildRead, } from './selection-reference.ts';
2
14
  export { buildModelMenuGroups, modelMenuChannelName, type ModelMenuRow } from './model-menu.ts';
3
15
  export { evaluateUiDelivery } from './ui-delivery-verification.ts';
4
16
  export { DESKTOP_PREVIEW_PROTOCOL, DESKTOP_PREVIEW_CAPABILITY, DESKTOP_PREVIEW_TOOL } from './desktop-preview.ts';
5
17
  export type { DesktopPreviewRequest, DesktopPreviewReply } from './desktop-preview.ts';
6
- export type { UiDeliveryIdentity, UiDeliveryRequirement, UiDeliveryObservation, UiDeliveryJudgment, UiDeliveryGap } from './ui-delivery-verification.ts';
18
+ export type { UiDeliveryIdentity, UiDeliveryRequirement, UiDeliveryObservation, UiDeliveryJudgment, UiDeliveryGap, } from './ui-delivery-verification.ts';
7
19
  export { REMOTE_PROTOCOL_VERSION, parseRemoteReadRequest, admitRemoteRead } from './remote-access.ts';
8
20
  export type { RemoteReadRequest, RemoteReadContext, RemoteReadRejection, RemoteReadAdmission } from './remote-access.ts';
9
21
  export { REMOTE_PROJECT_LIMITS, parseRemoteProjectRequest, admitRemoteProject, parseRemoteDelegationProjection } from './remote-access.ts';
10
- export type { RemoteProjectGrant, RemoteProjectRequest, RemoteProjectContext, RemoteProjectRejection, RemoteProjectAdmission, RemoteDelegationProjection } from './remote-access.ts';
22
+ export type { RemoteProjectGrant, RemoteProjectRequest, RemoteProjectInteractiveResult, RemoteProjectContext, RemoteProjectRejection, RemoteProjectAdmission, RemoteDelegationProjection, } from './remote-access.ts';
11
23
  export type LocalAccessLevel = 'ask_before_local' | 'session_local' | 'restricted_local' | 'full_local';
12
- export type { ConversationLifetimeUsage, ProviderRequestUsage, RuntimeTurnUsage, UsageAmounts, UsageScope, } from './usage-accounting.ts';
24
+ export type { BotAccessPolicy, BotAccessPolicyReadRequest, BotAccessPolicyUpdateRequest, BotAccessPolicyResult } from './bot-access-policy.ts';
25
+ export type { ConversationLifetimeUsage, ProviderRequestUsage, RuntimeTurnUsage, NativeRuntimeUsageSnapshot, NativeUsageRecoveryProgress, UsageAmounts, UsageScope, } from './usage-accounting.ts';
13
26
  export type CapabilityRiskLevel = 'L0_inert' | 'L1_local_read' | 'L2_local_write' | 'L3_external_write' | 'L4_privileged' | 'L5_destructive';
14
27
  export type DataLevel = 'D0_public' | 'D1_internal' | 'D2_sensitive' | 'D3_private' | 'D4_regulated';
15
28
  export type CapabilitySource = 'native' | 'shell' | 'plugin' | 'mcp' | 'page_bridge' | 'private' | 'web';
@@ -151,7 +164,7 @@ export interface McpCredentialMetadataView {
151
164
  readonly createdAt: string;
152
165
  readonly updatedAt: string;
153
166
  readonly lastFour?: string;
154
- readonly storage?: 'safeStorage' | 'file-fallback';
167
+ readonly storage?: 'safeStorage' | 'file-fallback' | 'vault';
155
168
  }
156
169
  export interface McpCredentialPutRequest {
157
170
  readonly credentialRef?: string;
@@ -222,6 +235,12 @@ export interface LocalMcpServerView {
222
235
  readonly resources: readonly McpResourceSummary[];
223
236
  readonly prompts: readonly McpPromptSummary[];
224
237
  readonly health: McpHealthView;
238
+ readonly policy?: {
239
+ readonly trusted?: boolean;
240
+ readonly requirePermission?: boolean;
241
+ readonly visibleByDefault?: boolean;
242
+ readonly maxRiskLevel?: string;
243
+ };
225
244
  readonly manifestUpdatedAt?: string | null;
226
245
  readonly lastError?: string | null;
227
246
  readonly createdAt?: string;
@@ -325,7 +344,7 @@ export interface WorkspaceProject {
325
344
  readonly updatedAt: string;
326
345
  }
327
346
  export type LlmProviderType = 'openai' | 'anthropic';
328
- export type LlmWireProtocol = 'openai-chat' | 'openai-responses' | 'anthropic-messages' | 'gemini' | 'qoder-private';
347
+ export type LlmWireProtocol = 'openai-chat' | 'openai-responses' | 'anthropic-messages' | 'gemini';
329
348
  export type LlmChannelId = string;
330
349
  export type LlmReasoningParamStyle = 'openai-effort' | 'anthropic-enabled-budget' | 'anthropic-adaptive-effort' | 'anthropic-output-effort' | 'qwen-enable' | 'none';
331
350
  export type LlmReasoningEffortMap = Readonly<Record<string, string | number>>;
@@ -349,7 +368,7 @@ export type LlmDiagnosticStageStatus = 'passed' | 'failed' | 'skipped' | 'pendin
349
368
  * 面向用户的错误分类(诊断 / 聊天修复共用)。
350
369
  * 技术错误码可进入 sanitizedDetail,不应直接作为主文案。
351
370
  */
352
- export type LlmDiagnosticErrorCategory = 'credential_missing' | 'credential_invalid' | 'auth_expired' | 'endpoint_unreachable' | 'rate_limited' | 'quota_exhausted' | 'permission_denied' | 'model_not_found' | 'protocol_mismatch' | 'capability_mismatch' | 'local_runtime_stopped' | 'timeout' | 'unknown';
371
+ export type LlmDiagnosticErrorCategory = 'credential_missing' | 'credential_invalid' | 'auth_expired' | 'endpoint_unreachable' | 'gemini_rate_limited' | 'gemini_spend_or_quota_exhausted' | 'gemini_usage_limit_unknown' | 'rate_limited' | 'quota_exhausted' | 'permission_denied' | 'model_not_found' | 'protocol_mismatch' | 'capability_mismatch' | 'local_runtime_stopped' | 'timeout' | 'unknown';
353
372
  export interface LlmDiagnosticStage {
354
373
  readonly id: LlmDiagnosticStageId;
355
374
  readonly status: LlmDiagnosticStageStatus;
@@ -423,14 +442,14 @@ export interface LlmChannelDescriptor {
423
442
  /** 可选:将该 channel 映射到一个或多个服务模板(添加服务目录)。 */
424
443
  readonly serviceTemplates?: readonly LlmServiceTemplateDescriptor[];
425
444
  }
426
- export type LlmAuthMethod = 'api_key' | 'oauth_chatgpt' | 'oauth_google' | 'oauth_grok' | 'qoder_local_auth' | 'local_cli';
445
+ export type LlmAuthMethod = 'api_key' | 'oauth_chatgpt' | 'oauth_grok';
427
446
  export type LlmOAuthConnectionStatus = 'connected' | 'expired' | 'disconnected';
428
447
  export interface LlmOAuthStatus {
429
448
  readonly status: LlmOAuthConnectionStatus;
430
449
  readonly accountId?: string;
431
450
  readonly expiresAt?: string;
432
451
  }
433
- export type { AccountUsageSource, AccountUsageScope, AccountUsageBalance, AccountUsageSpend, AccountUsageUnavailable, AccountUsageLocal } from './account-usage.js';
452
+ export type { AccountUsageSource, AccountUsageScope, AccountUsageBalance, AccountUsageSpend, AccountUsageUnavailable, AccountUsageLocal, } from './account-usage.js';
434
453
  /** 订阅额度窗口(session / weekly / model 等)。 */
435
454
  export interface LlmSubscriptionQuotaWindow {
436
455
  readonly id: string;
@@ -446,10 +465,12 @@ export interface LlmSubscriptionQuotaWindow {
446
465
  readonly scope?: import('./account-usage.js').AccountUsageScope;
447
466
  }
448
467
  /**
449
- * GPT / Gemini / Grok / Qoder 订阅额度快照。
450
468
  * success=false 时用 status/error 表达未登录、过期或拉取失败,UI 应降级展示。
451
469
  */
470
+ export * from "./spend-budget.js";
471
+ export { default as geminiStandardPricing } from "./gemini-standard-pricing.json";
452
472
  export interface LlmSubscriptionQuota {
473
+ readonly localBudget?: import("./spend-budget.js").ChannelLocalBudgetSnapshot;
453
474
  readonly accountUsageRevision?: string;
454
475
  /** Remote query outcome; localUsage can remain available on failure. */
455
476
  readonly success: boolean;
@@ -463,22 +484,16 @@ export interface LlmSubscriptionQuota {
463
484
  readonly status?: string;
464
485
  readonly providerId?: string;
465
486
  readonly authMethod?: LlmAuthMethod;
466
- readonly provider?: 'chatgpt' | 'gemini' | 'grok' | 'qoder' | string;
487
+ readonly provider?: 'chatgpt' | 'grok';
467
488
  readonly planLabel?: string;
468
489
  readonly remainingPercent?: number;
469
490
  readonly usedPercent?: number;
470
491
  readonly resetsAt?: string;
471
492
  readonly windows?: readonly LlmSubscriptionQuotaWindow[];
472
493
  readonly accountId?: string;
473
- readonly projectId?: string;
474
494
  readonly fetchedAt?: string;
475
495
  readonly cached?: boolean;
476
496
  readonly error?: string;
477
- readonly availableCredits?: number;
478
- readonly planCreditsUsed?: number;
479
- readonly planCreditsTotal?: number;
480
- readonly orgPackageUsed?: number;
481
- readonly orgPackageCap?: number;
482
497
  }
483
498
  export interface LlmProviderConfig {
484
499
  readonly id: string;
@@ -493,7 +508,7 @@ export interface LlmProviderConfig {
493
508
  readonly model: string;
494
509
  readonly modelLabel?: string;
495
510
  readonly metadataSource?: 'remote' | 'models.dev' | 'builtin' | 'local' | 'manual';
496
- readonly pricingSource?: 'provider' | 'models.dev-reference';
511
+ readonly pricingSource?: 'manual' | 'provider' | 'models.dev-reference' | 'gemini-official-reference';
497
512
  readonly metadataSyncedAt?: string;
498
513
  readonly enabled: boolean;
499
514
  readonly isDefault: boolean;
@@ -518,7 +533,6 @@ export interface LlmProviderConfig {
518
533
  readonly reasoningEffortLevels?: readonly string[];
519
534
  /** 渠道默认思考强度(如 Grok 为 high)。UI 切模型时用于落到正确默认档。 */
520
535
  readonly reasoningDefaultEffort?: string;
521
- readonly oauthProjectId?: string;
522
536
  readonly customHeaders?: Readonly<Record<string, string>>;
523
537
  readonly customHeadersInvalid?: boolean;
524
538
  /**
@@ -536,6 +550,7 @@ export interface LlmProviderConfig {
536
550
  readonly lastErrorCategory?: LlmDiagnosticErrorCategory;
537
551
  }
538
552
  export interface LlmProviderConfigView extends LlmProviderConfig {
553
+ readonly spendBudget?: import("./spend-budget.js").ChannelSpendBudgetConfig;
539
554
  /** Ephemeral main-owned identity for account observations; contains no credential material. */
540
555
  readonly accountUsageRevision?: string;
541
556
  readonly apiKeyMasked: string;
@@ -575,6 +590,7 @@ export interface LlmModelConfig {
575
590
  readonly customHeadersInvalid?: boolean;
576
591
  }
577
592
  export interface LlmProviderGroupConfig {
593
+ readonly spendBudget?: import("./spend-budget.js").ChannelSpendBudgetConfig;
578
594
  readonly id: string;
579
595
  readonly provider: LlmProviderType;
580
596
  readonly channelId?: LlmChannelId;
@@ -582,7 +598,6 @@ export interface LlmProviderGroupConfig {
582
598
  readonly name: string;
583
599
  readonly baseUrl: string;
584
600
  readonly createdAt: string;
585
- readonly oauthProjectId?: string;
586
601
  readonly models: readonly LlmModelConfig[];
587
602
  }
588
603
  export interface LlmProviderGroupConfigView extends LlmProviderGroupConfig {
@@ -623,7 +638,7 @@ export interface LlmModelInfo {
623
638
  readonly supportsReasoning?: boolean;
624
639
  readonly reasoningEffortValues?: readonly string[];
625
640
  readonly metadataSource?: 'provider' | 'models.dev';
626
- readonly pricingSource?: 'provider' | 'models.dev-reference';
641
+ readonly pricingSource?: 'manual' | 'provider' | 'models.dev-reference' | 'gemini-official-reference';
627
642
  readonly inputPrice?: number;
628
643
  readonly outputPrice?: number;
629
644
  readonly cacheReadPrice?: number;
@@ -632,8 +647,6 @@ export interface LlmModelInfo {
632
647
  readonly longContextInputPrice?: number;
633
648
  readonly longContextCacheReadPrice?: number;
634
649
  readonly longContextOutputPrice?: number;
635
- readonly priceFactor?: number;
636
- readonly originalPriceFactor?: number;
637
650
  }
638
651
  export interface LlmModelListResult {
639
652
  readonly success: boolean;
@@ -644,7 +657,6 @@ export interface LlmModelListResult {
644
657
  export interface LlmModelFetchRequest {
645
658
  readonly channelId?: string;
646
659
  readonly wireOverride?: string;
647
- /** Qoder 私有接口等本机鉴权渠道需要显式传入,避免 fetch 路径被默认当成 api_key。 */
648
660
  readonly authMethod?: LlmAuthMethod;
649
661
  readonly baseUrl?: string;
650
662
  readonly apiKey?: string;
@@ -691,6 +703,7 @@ export interface RuntimeToolCall {
691
703
  readonly argumentsPreview?: unknown;
692
704
  readonly [key: string]: unknown;
693
705
  }
706
+ export type { UserAnchorResolution, UserAnchorCandidate, UserAnchorDiagnostic } from './user-anchor.ts';
694
707
  export interface RuntimeToolResult {
695
708
  readonly toolCallId?: string;
696
709
  readonly status?: string;
@@ -718,6 +731,18 @@ export interface ClientToolCall extends RuntimeToolCall {
718
731
  readonly dataLevel: DataLevel;
719
732
  readonly requestedAt: string;
720
733
  }
734
+ /** Host permission wait events. Requests are presentation, never permission truth. */
735
+ export interface ChatPermissionRequest {
736
+ readonly streamId: string;
737
+ readonly call: ClientToolCall;
738
+ readonly deadlineAt?: string;
739
+ }
740
+ export interface ChatPermissionSettled {
741
+ readonly streamId: string;
742
+ readonly toolCallIds: readonly string[];
743
+ readonly granted?: boolean;
744
+ readonly reason?: string;
745
+ }
721
746
  export interface ClientToolCallPollRequest {
722
747
  readonly sessionId: string;
723
748
  readonly projectionId?: string;
@@ -732,12 +757,20 @@ export interface ClientToolCallPollResult {
732
757
  readonly idleUntil?: string;
733
758
  }
734
759
  export type PermissionDuration = 'once' | 'task' | 'session' | 'scope' | 'persistent' | 'denied';
760
+ export interface LocalWritePermissionScope {
761
+ readonly kind: 'local_write';
762
+ readonly executionRoot: string;
763
+ readonly temporaryRoot: string;
764
+ readonly enforcement: 'provider_path_checks' | 'approval_required_no_os_sandbox';
765
+ }
735
766
  export interface PermissionGrant {
767
+ /** Host-issued policy version; audit provenance, never a client authority token. */
768
+ readonly policyRevision?: string;
736
769
  readonly grantId: string;
737
770
  readonly toolCallId: string;
738
771
  readonly granted: boolean;
739
772
  readonly duration: PermissionDuration;
740
- readonly scope?: string;
773
+ readonly scope?: string | import('./local-image.ts').LocalImagePermissionScope | import('./local-read.ts').LocalReadPermissionScope | LocalWritePermissionScope;
741
774
  readonly decidedAt: string;
742
775
  }
743
776
  /** Application-owned shell process snapshot. Source conversation is provenance, not ownership. */
@@ -827,6 +860,23 @@ export interface Evidence {
827
860
  readonly dataLevel: DataLevel;
828
861
  readonly redactions: readonly string[];
829
862
  readonly artifactRefs: readonly string[];
863
+ /** Host/Provider observation before tools/call; never read from server output. */
864
+ readonly dispatchOutcome?: 'not_dispatched';
865
+ /** Durable native recovery proof for an unstarted dispatch of a logical call. */
866
+ readonly retiredDispatchId?: string;
867
+ }
868
+ /** Native MCP attempt metadata, including denials and failed initialization. */
869
+ export interface NativeMcpToolEvidenceMetadata {
870
+ readonly evidenceKind: 'local_mcp_tool_call';
871
+ readonly serverId: string;
872
+ readonly providerId: string;
873
+ readonly transport: 'stdio' | 'streamable_http' | 'sse';
874
+ readonly toolName: string;
875
+ readonly projectionId: string;
876
+ readonly permissionGrantId: string;
877
+ readonly status: 'success' | 'denied' | 'failed' | 'cancelled';
878
+ readonly startedAt: string;
879
+ readonly endedAt: string;
830
880
  }
831
881
  export interface ClientToolResult {
832
882
  readonly toolCallId: string;
@@ -866,7 +916,41 @@ export * from './automation.ts';
866
916
  export * from './task-overview.ts';
867
917
  export * from './skill-marketplace.ts';
868
918
  export * from './delegation.ts';
919
+ export * from './bot-git.ts';
869
920
  export * from './model-routing.ts';
921
+ export * from './document-reference.ts';
870
922
  export * from './project.ts';
871
923
  export * from './objectives.ts';
872
924
  export * from './remote-access-settings.ts';
925
+ export type { BotModelSelectionUpdateRequest, BotModelSelectionUpdateResult } from './bot-model-selection.ts';
926
+ export * from './local-image.ts';
927
+ export * from './local-read.ts';
928
+ export * from './native-process.ts';
929
+ export * from './bot-conversation-read.ts';
930
+ export * from './project-recovery.ts';
931
+ export * from './local-git.ts';
932
+ export * from './agent-supervision.ts';
933
+ export type { CapabilityBlocker, DelegationCapabilityAdmission } from './capability-admission.ts';
934
+ export * from './project-input-recovery.ts';
935
+ export { botResourceReferences } from './resource-reference-hints.ts';
936
+ export type { ResourceWindowCheckpointRequest, ResourceWindowCheckpointAck, ResourceWindowCloseBlocked, ResourceWindowReturnRequest, ResourceWindowReturnAck, ResourceWindowHistoryEntry, ResourceWindowHistoryResult, ResourceWindowReadRequest, ResourceWindowReadResult, ResourceWindowResource, ResourceWindowNavigation, ResourceWindowOpenRequest, ResourceWindowOwner, ResourceWindowIdentity, ResourceWindowContext, ResourceWindowStatus, ResourceWindowResult } from './resource-window.ts';
937
+ export { normalizeResourceWindowRequest, normalizeResourceWindowOwner, normalizeResourceWindowNavigation, resourceWindowWorkspaceId, resourceWindowTask, normalizeResourceLayout, normalizeResourceLayoutSnapshot, normalizeResourceInteractiveSession, normalizeResourceRecentReference, interactiveReferenceKey } from './resource-window.ts';
938
+ export type { ResourceLayoutSnapshot, ResourcePresentationApi, ResourceInteractiveTab, ResourceInteractiveSession, ResourceRecentReference } from './resource-window.ts';
939
+ export * from './browser-window.js';
940
+ export * from './resource-feedback.js';
941
+ export * from './resource-feedback-transport.js';
942
+ export * from './resource-edit.ts';
943
+ export * from './resource-file-replace.ts';
944
+ export * from './resource-edit-execution.ts';
945
+ export { decideFollowUp, type FollowUpOwner, type FollowUpReason, type FollowUpProjection } from './task-overview.ts';
946
+ export type { SessionExecutionIdentity, StopBarrierReceipt, SessionControlOperation, ExecutionResourceBlocker, ExecutionClaimClosure, ExecutionResourceClaim, ExecutionResourceScope, UnknownOutcomePolicy, UnknownOutcomePolicyTier, UnknownOutcomeResolution, UnknownOutcomeResolutionTier, ReconciliationEvidence, ReconciliationProbe, ReconciliationProbeKind, ReconciliationVerdict } from './session-control.ts';
947
+ export { controlPhasesForOrigin, normalizeSessionExecutionIdentity, normalizeExecutionResourceScope } from './session-control.ts';
948
+ export * from './input-prediction.ts';
949
+ export * from './interactive-result.ts';
950
+ export * from './interactive-verification.ts';
951
+ export { normalizeConversationExecution, conversationExecutionPermitsNewRun, validConversationSpend } from './conversation-execution.ts';
952
+ export type { ConversationExecutionIdentity, ConversationExecution } from './conversation-execution.ts';
953
+ export * from './quiet-reply.js';
954
+ export type { WorkingPlanStepStatus, WorkingPlanStepView, WorkingPlanView } from './working-plan.ts';
955
+ export * from "./parent-coordination.js";
956
+ export * from "./project-matter.ts";
package/dist/index.js CHANGED
@@ -1,8 +1,19 @@
1
+ export { WORK_HOOK_SEMANTIC_FLOOR, nativeWorkHasHookFacts } from "./work-hook.js";
2
+ export { deriveSessionFacts } from "./session-facts.js";
3
+ export { runtimeSessionFacts, runtimeSessionOwnership, hasPendingRuntimeSessions } from "./runtime-session-facts.js";
4
+ export { projectAgentFailureKind, classifyProjectAgentFailure } from "./project-agent-failure.js";
5
+ export { toolActivityPreview, toolActivitySummary } from "./tool-activity-preview.js";
6
+ export { isModelReasoningEffort, modelReasoningLevels, modelDefaultReasoningEffort } from "./model-reasoning.js";
1
7
  export { buildModelMenuGroups, modelMenuChannelName } from "./model-menu.js";
2
8
  export { evaluateUiDelivery } from "./ui-delivery-verification.js";
3
9
  export { DESKTOP_PREVIEW_PROTOCOL, DESKTOP_PREVIEW_CAPABILITY, DESKTOP_PREVIEW_TOOL } from "./desktop-preview.js";
4
10
  export { REMOTE_PROTOCOL_VERSION, parseRemoteReadRequest, admitRemoteRead } from "./remote-access.js";
5
11
  export { REMOTE_PROJECT_LIMITS, parseRemoteProjectRequest, admitRemoteProject, parseRemoteDelegationProjection } from "./remote-access.js";
12
+ /**
13
+ * success=false 时用 status/error 表达未登录、过期或拉取失败,UI 应降级展示。
14
+ */
15
+ export * from "./spend-budget.js";
16
+ export { default as geminiStandardPricing } from "./gemini-standard-pricing.json" with { type: "json" };
6
17
  export function resolveLlmModelOptionValues(definitions, values) {
7
18
  if (!definitions?.length)
8
19
  return {};
@@ -33,7 +44,34 @@ export * from "./automation.js";
33
44
  export * from "./task-overview.js";
34
45
  export * from "./skill-marketplace.js";
35
46
  export * from "./delegation.js";
47
+ export * from "./bot-git.js";
36
48
  export * from "./model-routing.js";
49
+ export * from "./document-reference.js";
37
50
  export * from "./project.js";
38
51
  export * from "./objectives.js";
39
52
  export * from "./remote-access-settings.js";
53
+ export * from "./local-image.js";
54
+ export * from "./local-read.js";
55
+ export * from "./native-process.js";
56
+ export * from "./bot-conversation-read.js";
57
+ export * from "./project-recovery.js";
58
+ export * from "./local-git.js";
59
+ export * from "./agent-supervision.js";
60
+ export * from "./project-input-recovery.js";
61
+ export { botResourceReferences } from "./resource-reference-hints.js";
62
+ export { normalizeResourceWindowRequest, normalizeResourceWindowOwner, normalizeResourceWindowNavigation, resourceWindowWorkspaceId, resourceWindowTask, normalizeResourceLayout, normalizeResourceLayoutSnapshot, normalizeResourceInteractiveSession, normalizeResourceRecentReference, interactiveReferenceKey } from "./resource-window.js";
63
+ export * from './browser-window.js';
64
+ export * from './resource-feedback.js';
65
+ export * from './resource-feedback-transport.js';
66
+ export * from "./resource-edit.js";
67
+ export * from "./resource-file-replace.js";
68
+ export * from "./resource-edit-execution.js";
69
+ export { decideFollowUp } from "./task-overview.js";
70
+ export { controlPhasesForOrigin, normalizeSessionExecutionIdentity, normalizeExecutionResourceScope } from "./session-control.js";
71
+ export * from "./input-prediction.js";
72
+ export * from "./interactive-result.js";
73
+ export * from "./interactive-verification.js";
74
+ export { normalizeConversationExecution, conversationExecutionPermitsNewRun, validConversationSpend } from "./conversation-execution.js";
75
+ export * from './quiet-reply.js';
76
+ export * from "./parent-coordination.js";
77
+ export * from "./project-matter.js";