@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.
- package/dist/acceptance-close-gate.d.ts +10 -1
- package/dist/acceptance-close-gate.js +12 -0
- package/dist/agent-supervision.d.ts +81 -0
- package/dist/agent-supervision.js +1 -0
- 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/bot-conversation-read.d.ts +67 -0
- package/dist/bot-conversation-read.js +9 -0
- package/dist/bot-direct-step.d.ts +11 -0
- package/dist/bot-direct-step.js +1 -0
- package/dist/bot-git.d.ts +55 -0
- package/dist/bot-git.js +1 -0
- package/dist/bot-model-selection.d.ts +13 -0
- package/dist/bot-model-selection.js +1 -0
- package/dist/browser-window.d.ts +48 -0
- package/dist/browser-window.js +23 -0
- package/dist/capability-admission.d.ts +20 -0
- package/dist/capability-admission.js +1 -0
- package/dist/compaction-history-selection.d.ts +15 -0
- package/dist/compaction-history-selection.js +30 -0
- package/dist/compaction.d.ts +5 -0
- package/dist/compaction.js +6 -0
- package/dist/context-accounting.d.ts +3 -0
- package/dist/conversation-execution.d.ts +68 -0
- package/dist/conversation-execution.js +222 -0
- package/dist/delegation-coordination.d.ts +81 -0
- package/dist/delegation-coordination.js +1 -0
- package/dist/delegation.d.ts +260 -7
- package/dist/delegation.js +97 -39
- package/dist/document-reference.d.ts +111 -0
- package/dist/document-reference.js +1 -0
- package/dist/evidence-inspection.d.ts +84 -0
- package/dist/evidence-inspection.js +1 -0
- package/dist/gemini-standard-pricing.json +105 -0
- package/dist/goal.d.ts +50 -2
- package/dist/group-chat.d.ts +87 -0
- package/dist/group-chat.js +1 -0
- package/dist/hook-observation.d.ts +2 -0
- package/dist/hook-observation.js +19 -0
- package/dist/index.d.ts +117 -25
- package/dist/index.js +41 -0
- package/dist/input-prediction.d.ts +86 -0
- package/dist/input-prediction.js +48 -0
- package/dist/intent-coordination.d.ts +201 -0
- package/dist/intent-coordination.js +1 -0
- package/dist/interactive-result.d.ts +363 -0
- package/dist/interactive-result.js +215 -0
- package/dist/interactive-verification.d.ts +41 -0
- package/dist/interactive-verification.js +65 -0
- package/dist/local-git.d.ts +44 -0
- package/dist/local-git.js +3 -0
- package/dist/local-image.d.ts +53 -0
- package/dist/local-image.js +5 -0
- package/dist/local-read.d.ts +9 -0
- package/dist/local-read.js +1 -0
- package/dist/memory.d.ts +117 -12
- package/dist/memory.js +12 -0
- package/dist/model-reasoning.d.ts +16 -0
- package/dist/model-reasoning.js +25 -0
- package/dist/model-routing.d.ts +39 -3
- package/dist/model-routing.js +31 -5
- package/dist/native-process.d.ts +21 -0
- package/dist/native-process.js +51 -0
- package/dist/parent-coordination.d.ts +104 -0
- package/dist/parent-coordination.js +2 -0
- package/dist/persistent-workspace.d.ts +519 -0
- package/dist/persistent-workspace.js +1 -0
- package/dist/project-agent-failure.d.ts +30 -0
- package/dist/project-agent-failure.js +44 -0
- package/dist/project-input-recovery.d.ts +83 -0
- package/dist/project-input-recovery.js +25 -0
- package/dist/project-matter.d.ts +359 -0
- package/dist/project-matter.js +1 -0
- package/dist/project-recovery.d.ts +43 -0
- package/dist/project-recovery.js +1 -0
- package/dist/project.d.ts +233 -0
- package/dist/project.js +134 -5
- package/dist/prompt-skill.d.ts +31 -0
- package/dist/prompt-skill.js +1 -0
- package/dist/quiet-reply.d.ts +9 -0
- package/dist/quiet-reply.js +43 -0
- package/dist/remote-access.d.ts +15 -0
- package/dist/remote-access.js +1 -1
- package/dist/reply-delivery.d.ts +28 -0
- package/dist/reply-delivery.js +1 -0
- package/dist/resource-edit-execution.d.ts +68 -0
- package/dist/resource-edit-execution.js +96 -0
- package/dist/resource-edit.d.ts +237 -0
- package/dist/resource-edit.js +134 -0
- package/dist/resource-feedback-transport.d.ts +26 -0
- package/dist/resource-feedback-transport.js +94 -0
- package/dist/resource-feedback.d.ts +110 -0
- package/dist/resource-feedback.js +168 -0
- package/dist/resource-file-replace.d.ts +36 -0
- package/dist/resource-file-replace.js +40 -0
- package/dist/resource-reference-hints.d.ts +3 -0
- package/dist/resource-reference-hints.js +58 -0
- package/dist/resource-window.d.ts +222 -0
- package/dist/resource-window.js +252 -0
- package/dist/routine.d.ts +82 -0
- package/dist/routine.js +1 -0
- package/dist/runtime-session-facts.d.ts +58 -0
- package/dist/runtime-session-facts.js +57 -0
- package/dist/session-control.d.ts +211 -0
- package/dist/session-control.js +48 -0
- package/dist/session-facts.d.ts +29 -0
- package/dist/session-facts.js +35 -0
- package/dist/skill-marketplace.d.ts +39 -4
- package/dist/spend-budget.d.ts +69 -0
- package/dist/spend-budget.js +1 -0
- package/dist/system-context.d.ts +7 -0
- package/dist/task-overview.d.ts +91 -0
- package/dist/task-overview.js +325 -17
- package/dist/tool-activity-preview.d.ts +4 -0
- package/dist/tool-activity-preview.js +72 -0
- package/dist/updater.d.ts +13 -3
- package/dist/usage-accounting.d.ts +42 -1
- package/dist/user-anchor.d.ts +17 -0
- package/dist/user-anchor.js +1 -0
- package/dist/work-coordination.d.ts +188 -0
- package/dist/work-coordination.js +1 -0
- package/dist/work-hook.d.ts +3 -0
- package/dist/work-hook.js +76 -0
- package/dist/working-plan.d.ts +18 -0
- package/dist/working-plan.js +1 -0
- package/dist/workspace.d.ts +35 -0
- package/dist/workspace.js +1 -0
- package/package.json +1 -1
package/dist/delegation.d.ts
CHANGED
|
@@ -1,13 +1,53 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Project-agent delegation contracts. Pure projections only; nothing here runs a tool.
|
|
3
|
-
* The user-visible conclusion of a work session is
|
|
3
|
+
* The user-visible conclusion of a work session is `decideLifecycle`'s conclusion.
|
|
4
4
|
*/
|
|
5
|
+
import type { GoalDeliveryBinding } from './goal.ts';
|
|
5
6
|
import type { ModelSelectionSnapshot } from './model-routing.ts';
|
|
6
|
-
import { type GoalPlanProjectionSnapshot, type TaskOverviewItem } from './task-overview.ts';
|
|
7
|
-
export type WorkSessionStatus = 'paused' | 'queued' | 'starting' | 'running' | 'waiting_user' | 'verifying' | 'result_ready' | 'accepted' | 'failed' | 'cancelled' | 'superseded';
|
|
8
|
-
export declare const WORK_SESSION_STATUSES: readonly ["paused", "queued", "starting", "running", "waiting_user", "verifying", "result_ready", "accepted", "failed", "cancelled", "superseded"];
|
|
7
|
+
import { type ExecutionOwnership, type GoalPlanProjectionSnapshot, type TaskOverviewItem } from './task-overview.ts';
|
|
8
|
+
export type WorkSessionStatus = 'paused' | 'blocked' | 'queued' | 'starting' | 'running' | 'waiting_user' | 'waiting_agent' | 'stopping' | 'awaiting_outcome' | 'verifying' | 'result_ready' | 'accepted' | 'failed' | 'cancelled' | 'superseded';
|
|
9
|
+
export declare const WORK_SESSION_STATUSES: readonly ["paused", "blocked", "queued", "starting", "running", "waiting_user", "waiting_agent", "stopping", "awaiting_outcome", "verifying", "result_ready", "accepted", "failed", "cancelled", "superseded"];
|
|
9
10
|
export type InputSurface = 'desktop' | 'quick_chat' | 'tui' | 'remote';
|
|
10
11
|
export interface DelegationOrigin {
|
|
12
|
+
readonly capabilityAdmission?: import('./capability-admission.ts').DelegationCapabilityAdmission;
|
|
13
|
+
readonly executionGeneration?: string;
|
|
14
|
+
readonly executionControl?: import('./session-control.ts').SessionControlOperation;
|
|
15
|
+
/** Host receipt for a user-authorized claim closure. It is not a stop receipt. */
|
|
16
|
+
readonly executionClaimClosure?: import('./session-control.ts').ExecutionClaimClosure;
|
|
17
|
+
/** Host receipt for an unknown-outcome resolution (ADR 127). It ends occupancy only; not a stop receipt or a tool result. */
|
|
18
|
+
readonly unknownOutcomeResolution?: import('./session-control.ts').UnknownOutcomeResolution;
|
|
19
|
+
readonly takeover?: {
|
|
20
|
+
operationId: string;
|
|
21
|
+
phase: 'stopping' | 'completed' | 'superseded' | 'rejected';
|
|
22
|
+
supersededBy?: string;
|
|
23
|
+
text: string;
|
|
24
|
+
binding: import('./delegation-coordination.ts').CoordinationExecutionBinding;
|
|
25
|
+
requestedAt: string;
|
|
26
|
+
completedAt?: string;
|
|
27
|
+
repair?: boolean;
|
|
28
|
+
};
|
|
29
|
+
readonly coordinationBinding?: import('./delegation-coordination.ts').CoordinationExecutionBinding;
|
|
30
|
+
readonly cancellation?: {
|
|
31
|
+
readonly operationId: string;
|
|
32
|
+
readonly reason: string;
|
|
33
|
+
readonly phase: 'stopping' | 'awaiting_outcome' | 'completed';
|
|
34
|
+
readonly requestedAt: string;
|
|
35
|
+
readonly completedAt?: string;
|
|
36
|
+
readonly evidenceCalls?: readonly string[];
|
|
37
|
+
readonly preserveArtifacts?: boolean;
|
|
38
|
+
readonly disposition?: 'user_withdrawn';
|
|
39
|
+
readonly withdrawal?: {
|
|
40
|
+
readonly workspaceId: string;
|
|
41
|
+
readonly parentConversationId: string;
|
|
42
|
+
readonly sessionId: string;
|
|
43
|
+
readonly planId: string;
|
|
44
|
+
readonly anchorMessageId: string;
|
|
45
|
+
readonly inputId: string;
|
|
46
|
+
readonly admittedAt: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
readonly retainedForRecovery?: boolean;
|
|
50
|
+
readonly workId?: string;
|
|
11
51
|
readonly anchorMessageId: string;
|
|
12
52
|
readonly inputId: string;
|
|
13
53
|
readonly surface: InputSurface;
|
|
@@ -28,25 +68,79 @@ export interface DelegationOrigin {
|
|
|
28
68
|
readonly depth: number;
|
|
29
69
|
}
|
|
30
70
|
export interface SessionQueueFacts {
|
|
71
|
+
readonly resourceBlocker?: import('./session-control.ts').ExecutionResourceBlocker;
|
|
72
|
+
readonly executionClaimClosure?: import('./session-control.ts').ExecutionClaimClosure;
|
|
73
|
+
readonly unknownOutcomePolicy?: import('./session-control.ts').UnknownOutcomePolicyTier;
|
|
74
|
+
readonly unknownOutcomeResolution?: import('./session-control.ts').UnknownOutcomeResolution;
|
|
75
|
+
readonly retainedUnknowns?: readonly {
|
|
76
|
+
readonly closureId: string;
|
|
77
|
+
readonly unknownCalls: readonly string[];
|
|
78
|
+
readonly at: string;
|
|
79
|
+
readonly proof: 'verified_dead' | 'legacy_user_confirmed';
|
|
80
|
+
}[];
|
|
31
81
|
readonly queuedBehind?: readonly {
|
|
32
82
|
readonly sessionId: string;
|
|
33
83
|
readonly title: string;
|
|
34
84
|
}[];
|
|
35
|
-
readonly queueReason?: 'dependencies' | 'dependency_missing' | 'dependency_failed' | 'read_slot' | 'write_slot' | 'disk_space' | 'isolation_failed' | null;
|
|
85
|
+
readonly queueReason?: 'dependencies' | 'dependency_missing' | 'dependency_failed' | 'read_slot' | 'write_slot' | 'disk_space' | 'isolation_failed' | 'resource_protection' | 'resource_recovery' | null;
|
|
86
|
+
}
|
|
87
|
+
export interface WorkSessionIsolationDiagnostic {
|
|
88
|
+
readonly stage: string;
|
|
89
|
+
readonly reasonCode: string;
|
|
90
|
+
readonly repoInput?: string;
|
|
91
|
+
readonly dirtyNotice?: boolean;
|
|
92
|
+
readonly candidates?: readonly {
|
|
93
|
+
readonly repoKey: string;
|
|
94
|
+
}[];
|
|
36
95
|
}
|
|
96
|
+
/** Persisted delivery facts displayed by the work session. Legacy records may have only a commit. */
|
|
97
|
+
declare const bindingTextFields: readonly ["baseCommit", "taskBranch", "worktreePath", "targetWorkspacePath", "repoKey", "repoCommonDir", "repoRoot", "baseRef", "baseSha", "executionRoot", "expectedTargetTip"];
|
|
98
|
+
export type WorkSessionDeliveryBinding = Partial<Pick<GoalDeliveryBinding, 'executionIsolation'>> & Partial<Record<typeof bindingTextFields[number], string>> & {
|
|
99
|
+
readonly targetBranch?: string | null;
|
|
100
|
+
readonly requestedIsolation?: 'auto' | 'none' | 'worktree';
|
|
101
|
+
readonly effectiveIsolation?: 'none' | 'worktree';
|
|
102
|
+
readonly mainTreeDirty?: boolean | null;
|
|
103
|
+
readonly isolationDiagnostic?: WorkSessionIsolationDiagnostic;
|
|
104
|
+
readonly worktreeCleanup?: {
|
|
105
|
+
readonly status: 'cleaned' | 'reconciling';
|
|
106
|
+
readonly reason?: string;
|
|
107
|
+
};
|
|
108
|
+
readonly deliveryHandoff?: {
|
|
109
|
+
readonly status: 'delivered' | 'nothing_to_merge' | 'stopped' | 'reconciling';
|
|
110
|
+
readonly reason?: string;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
export declare function projectWorkSessionDeliveryBinding(value: unknown): WorkSessionDeliveryBinding | undefined;
|
|
37
114
|
export interface WorkSessionConversationMeta extends SessionQueueFacts {
|
|
115
|
+
readonly deliveryBinding?: WorkSessionDeliveryBinding;
|
|
116
|
+
readonly coordination?: import('./delegation-coordination.ts').CoordinationSessionFacts;
|
|
38
117
|
readonly sessionId?: string;
|
|
39
118
|
readonly conversationId?: string;
|
|
40
119
|
readonly workspaceId: string;
|
|
41
120
|
readonly spawnedAt?: string;
|
|
121
|
+
readonly startedAt?: string;
|
|
122
|
+
readonly endedAt?: string;
|
|
42
123
|
readonly origin: DelegationOrigin;
|
|
43
124
|
readonly supersededBy?: string;
|
|
44
125
|
readonly acceptance?: 'auto' | 'confirm';
|
|
126
|
+
readonly resultConfirmationRequired?: boolean;
|
|
45
127
|
readonly accepted?: boolean;
|
|
46
128
|
readonly verifying?: boolean;
|
|
129
|
+
readonly verificationFailed?: boolean;
|
|
47
130
|
readonly phase?: 'starting' | 'verifying' | 'paused';
|
|
131
|
+
/** 进程内执行所有权(runtime 采集);缺省表示该入口尚未接入所有权事实。 */
|
|
132
|
+
readonly executionOwnership?: ExecutionOwnership;
|
|
133
|
+
readonly obligationDisposition?: 'indexed' | 'suspended' | 'current';
|
|
48
134
|
}
|
|
49
135
|
export interface WorkSession extends SessionQueueFacts {
|
|
136
|
+
readonly deliveryBinding?: WorkSessionDeliveryBinding;
|
|
137
|
+
readonly followUpEpoch?: number;
|
|
138
|
+
readonly executionOwnership?: ExecutionOwnership;
|
|
139
|
+
readonly followUp?: import('./task-overview.ts').FollowUpProjection;
|
|
140
|
+
readonly verificationProgress?: VerificationProgress;
|
|
141
|
+
readonly completionReviewRequired?: boolean;
|
|
142
|
+
readonly resultConfirmationRequired?: boolean;
|
|
143
|
+
readonly coordination?: import('./delegation-coordination.ts').CoordinationSessionFacts;
|
|
50
144
|
readonly sessionId: string;
|
|
51
145
|
readonly workspaceId: string;
|
|
52
146
|
readonly title: string;
|
|
@@ -55,25 +149,77 @@ export interface WorkSession extends SessionQueueFacts {
|
|
|
55
149
|
readonly actionRight: TaskOverviewItem['actionRight'];
|
|
56
150
|
readonly nextAction: TaskOverviewItem['nextAction'];
|
|
57
151
|
readonly statusLabel: string;
|
|
152
|
+
/** 是否可取消;由生命周期决策统一给出,renderer 不再自行推断。 */
|
|
153
|
+
readonly cancelable?: boolean;
|
|
58
154
|
readonly needsYouReason?: TaskOverviewItem['needsYouReason'];
|
|
59
155
|
readonly spawnedAt: string;
|
|
156
|
+
readonly startedAt?: string;
|
|
157
|
+
readonly endedAt?: string;
|
|
60
158
|
readonly conversationId?: string;
|
|
61
159
|
readonly origin: DelegationOrigin;
|
|
62
160
|
readonly supersededBy?: string;
|
|
63
161
|
}
|
|
64
162
|
export interface SessionReport {
|
|
163
|
+
readonly agentSupervision?: import('./agent-supervision.ts').AgentSupervisionReport;
|
|
164
|
+
/** Current host verification, loaded with task details; never assistant prose. */
|
|
165
|
+
readonly verification?: SessionVerificationDetail;
|
|
65
166
|
readonly sessionId: string;
|
|
66
167
|
readonly planId: string | null;
|
|
67
168
|
readonly status: WorkSessionStatus;
|
|
68
169
|
readonly summary: string;
|
|
170
|
+
readonly taskBrief?: string;
|
|
69
171
|
readonly keyFindings: readonly string[];
|
|
70
172
|
readonly changedFiles: readonly {
|
|
71
173
|
readonly path: string;
|
|
72
174
|
readonly summary: string;
|
|
73
175
|
}[];
|
|
74
176
|
readonly evidenceRefs: readonly string[];
|
|
177
|
+
readonly failure?: {
|
|
178
|
+
readonly code: string;
|
|
179
|
+
readonly message?: string;
|
|
180
|
+
readonly at?: string;
|
|
181
|
+
};
|
|
182
|
+
/** Persisted worker output is a claim; verification still comes from host Evidence. */
|
|
183
|
+
readonly contentSource?: {
|
|
184
|
+
readonly kind: 'worker_message' | 'task_results';
|
|
185
|
+
readonly conversationId?: string;
|
|
186
|
+
readonly messageId?: string;
|
|
187
|
+
readonly verification: 'unverified';
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
export type DelegationEventKind = 'agent_message' | 'session_running' | 'session_spawned' | 'session_progress' | 'session_needs_user' | 'report_available' | 'session_verified' | 'session_ended' | 'user_intervened' | 'objective_signal' | 'digest_due';
|
|
191
|
+
/** Local orchestration facts; never a human authorization or a verified result. */
|
|
192
|
+
export interface AgentMessage {
|
|
193
|
+
readonly deliveryIntent?: import('./agent-supervision.ts').AgentDeliveryIntent;
|
|
194
|
+
readonly decisionRequest?: import('./agent-supervision.ts').AgentDecisionRequest;
|
|
195
|
+
readonly decisionAnswer?: import('./agent-supervision.ts').AgentDecisionAnswer;
|
|
196
|
+
readonly goalRevision?: number;
|
|
197
|
+
readonly executionEpoch?: string;
|
|
198
|
+
readonly replyTo?: string;
|
|
199
|
+
readonly messageId: string;
|
|
200
|
+
readonly workspaceId: string;
|
|
201
|
+
readonly sessionId: string;
|
|
202
|
+
readonly senderConversationId: string;
|
|
203
|
+
readonly recipientConversationId: string;
|
|
204
|
+
readonly direction: 'parent_to_child' | 'child_to_parent';
|
|
205
|
+
readonly purpose: 'update' | 'question' | 'answer';
|
|
206
|
+
readonly text: string;
|
|
207
|
+
readonly at: string;
|
|
208
|
+
}
|
|
209
|
+
export interface VerificationProgress {
|
|
210
|
+
readonly continuationId: string;
|
|
211
|
+
readonly startedAt: string;
|
|
212
|
+
readonly lastProgressAt: string;
|
|
213
|
+
readonly observationCount: number;
|
|
214
|
+
readonly phase: 'ready' | 'requesting' | 'tools' | 'completed';
|
|
215
|
+
}
|
|
216
|
+
export interface AgentActivity {
|
|
217
|
+
readonly verificationProgress?: VerificationProgress;
|
|
218
|
+
readonly eventId: string;
|
|
219
|
+
readonly sessionId: string;
|
|
220
|
+
readonly name: string;
|
|
221
|
+
readonly state: 'queued' | 'started' | 'update' | 'question' | 'answer' | 'reported' | 'verified' | 'verifying' | 'ended' | 'cancelled' | 'blocked';
|
|
75
222
|
}
|
|
76
|
-
export type DelegationEventKind = 'session_spawned' | 'session_progress' | 'session_needs_user' | 'session_verified' | 'session_ended' | 'user_intervened' | 'objective_signal' | 'digest_due';
|
|
77
223
|
export type JsonValue = null | string | number | boolean | readonly JsonValue[] | {
|
|
78
224
|
readonly [key: string]: JsonValue;
|
|
79
225
|
};
|
|
@@ -101,6 +247,9 @@ export interface AgentReplyMeta {
|
|
|
101
247
|
readonly surfacing: 'interrupt' | 'message' | 'digest' | 'silent';
|
|
102
248
|
}
|
|
103
249
|
export interface ReplySessionState {
|
|
250
|
+
readonly sourceRevision?: string;
|
|
251
|
+
/** Stable reporting facts, including a changed verifier failure; not acceptance authority. */
|
|
252
|
+
readonly observationRevision?: string;
|
|
104
253
|
readonly sessionId: string;
|
|
105
254
|
readonly status: WorkSessionStatus;
|
|
106
255
|
}
|
|
@@ -155,6 +304,26 @@ export interface DispositionEvent {
|
|
|
155
304
|
readonly replyMessageId?: string;
|
|
156
305
|
}
|
|
157
306
|
export type VerificationOutcome = 'passed' | 'failed' | 'partial' | 'unverifiable';
|
|
307
|
+
/** Host-bound manual completion review; distinct from acceptance of a completed result. */
|
|
308
|
+
export interface SessionCompletionReview {
|
|
309
|
+
readonly sessionId: string;
|
|
310
|
+
readonly reviewToken: string;
|
|
311
|
+
readonly criteria: readonly {
|
|
312
|
+
readonly id: string;
|
|
313
|
+
readonly description: string;
|
|
314
|
+
}[];
|
|
315
|
+
readonly report: string;
|
|
316
|
+
readonly confirmed?: boolean;
|
|
317
|
+
}
|
|
318
|
+
export type SessionConfirmationInput = {
|
|
319
|
+
readonly workspaceId: string;
|
|
320
|
+
readonly sessionId: string;
|
|
321
|
+
} & ({
|
|
322
|
+
readonly stage?: 'result_acceptance';
|
|
323
|
+
} | {
|
|
324
|
+
readonly stage: 'manual_completion';
|
|
325
|
+
readonly reviewToken: string;
|
|
326
|
+
});
|
|
158
327
|
export type IndependentVerifierState = 'passed' | 'failed' | 'not_required' | 'missing';
|
|
159
328
|
export interface VerificationCheck {
|
|
160
329
|
readonly name: string;
|
|
@@ -169,6 +338,58 @@ export interface VerificationVerdict {
|
|
|
169
338
|
readonly checks: readonly VerificationCheck[];
|
|
170
339
|
readonly evidenceRefs: readonly string[];
|
|
171
340
|
}
|
|
341
|
+
export interface SessionVerificationDetail {
|
|
342
|
+
readonly sessionId: string;
|
|
343
|
+
readonly outcome: VerificationOutcome;
|
|
344
|
+
/** A host review is active. The outcome describes evidence already recorded. */
|
|
345
|
+
readonly verificationInProgress?: true;
|
|
346
|
+
/** A persisted explicit review of the current task and report. */
|
|
347
|
+
readonly explicitVerification?: {
|
|
348
|
+
readonly verdictRef: string;
|
|
349
|
+
readonly outcome: VerificationOutcome;
|
|
350
|
+
};
|
|
351
|
+
readonly checks: readonly {
|
|
352
|
+
readonly name: string;
|
|
353
|
+
readonly result: 'passed' | 'failed';
|
|
354
|
+
readonly evidenceRefs: readonly string[];
|
|
355
|
+
readonly reason?: string;
|
|
356
|
+
}[];
|
|
357
|
+
readonly workerModel: string | null;
|
|
358
|
+
readonly verifierModel: string | null;
|
|
359
|
+
readonly sameSource: boolean;
|
|
360
|
+
readonly summary?: string;
|
|
361
|
+
readonly error?: string;
|
|
362
|
+
readonly reviewAttempts: readonly VerificationAttemptDiagnostic[];
|
|
363
|
+
readonly outputs: readonly {
|
|
364
|
+
readonly name: string;
|
|
365
|
+
readonly evidenceRef: string;
|
|
366
|
+
readonly summary: string;
|
|
367
|
+
readonly truncated: boolean;
|
|
368
|
+
}[];
|
|
369
|
+
}
|
|
370
|
+
/** Bounded persisted diagnostics, never an input to acceptance or Evidence authority. */
|
|
371
|
+
export interface VerificationAttemptDiagnostic {
|
|
372
|
+
readonly verifierRunId: string;
|
|
373
|
+
readonly status: 'passed' | 'failed';
|
|
374
|
+
readonly diagnosticOnly: true;
|
|
375
|
+
/** null means this historical run has no source-version binding. */
|
|
376
|
+
readonly matchesCurrentSource: boolean | null;
|
|
377
|
+
readonly completedAt: string;
|
|
378
|
+
readonly failureReason: string;
|
|
379
|
+
readonly failedCriteria: readonly {
|
|
380
|
+
readonly criterionId: string;
|
|
381
|
+
readonly reason: string;
|
|
382
|
+
readonly evidenceRefs: readonly string[];
|
|
383
|
+
}[];
|
|
384
|
+
readonly missingEvidence: readonly {
|
|
385
|
+
readonly taskId: string;
|
|
386
|
+
readonly reason: string;
|
|
387
|
+
readonly evidenceRefs: readonly string[];
|
|
388
|
+
}[];
|
|
389
|
+
readonly risks: readonly string[];
|
|
390
|
+
readonly recommendedNextAction: string;
|
|
391
|
+
readonly evidenceRefs: readonly string[];
|
|
392
|
+
}
|
|
172
393
|
export type AcceptancePolicy = 'auto' | 'confirm';
|
|
173
394
|
export type AcceptanceReason = 'verdict_not_passed' | 'manual_criteria_pending' | 'external_side_effects' | 'destructive_operation' | 'out_of_scope_write' | 'project_requires_confirm' | 'user_requested_review' | 'verification_below_floor';
|
|
174
395
|
export interface AcceptanceDecision {
|
|
@@ -200,6 +421,22 @@ export interface SurfacingEvent {
|
|
|
200
421
|
readonly severity: 'info' | 'notable' | 'urgent';
|
|
201
422
|
readonly deadlineImminent?: boolean;
|
|
202
423
|
}
|
|
424
|
+
/** Explicit user uploads are factual user context, never execution authority. */
|
|
425
|
+
export type ProjectInputAttachment = {
|
|
426
|
+
readonly id: string;
|
|
427
|
+
readonly name: string;
|
|
428
|
+
readonly mimeType: string;
|
|
429
|
+
readonly size: number;
|
|
430
|
+
readonly sourceKind: 'user_upload';
|
|
431
|
+
} & ({
|
|
432
|
+
readonly kind: 'image';
|
|
433
|
+
readonly dataUrl: string;
|
|
434
|
+
} | {
|
|
435
|
+
readonly kind: 'text';
|
|
436
|
+
readonly text: string;
|
|
437
|
+
} | {
|
|
438
|
+
readonly kind: 'unsupported';
|
|
439
|
+
});
|
|
203
440
|
export interface ProjectInput {
|
|
204
441
|
readonly inputId: string;
|
|
205
442
|
readonly workspaceId: string;
|
|
@@ -208,10 +445,23 @@ export interface ProjectInput {
|
|
|
208
445
|
readonly anchorRefs: readonly string[];
|
|
209
446
|
readonly quoteRefs: readonly string[];
|
|
210
447
|
readonly attachmentRefs: readonly string[];
|
|
448
|
+
readonly attachments?: readonly ProjectInputAttachment[];
|
|
449
|
+
readonly resourceFeedback?: readonly import('./resource-feedback.ts').ResourceFeedback[];
|
|
211
450
|
readonly createdAt: string;
|
|
212
451
|
}
|
|
213
|
-
|
|
452
|
+
/** Existing durable input receipt. A later handoff can fail after input was saved. */
|
|
453
|
+
export interface ProjectAgentSubmitInputResult {
|
|
454
|
+
readonly ok: boolean;
|
|
455
|
+
readonly code?: string;
|
|
456
|
+
readonly message?: string;
|
|
457
|
+
readonly input?: ProjectInput;
|
|
458
|
+
readonly delivery?: 'queued' | 'user_intervened';
|
|
459
|
+
}
|
|
460
|
+
export type PendingApprovalState = 'open' | 'approved' | 'denied' | 'expired' | 'stale' | 'cancelled';
|
|
214
461
|
export interface PendingApproval {
|
|
462
|
+
readonly policyRevision?: string;
|
|
463
|
+
readonly imageReadScope?: import('./local-image.ts').LocalImagePermissionScope;
|
|
464
|
+
readonly imageReadGrant?: import('./local-image.ts').ImageReadGrant;
|
|
215
465
|
readonly approvalId: string;
|
|
216
466
|
readonly workspaceId: string | null;
|
|
217
467
|
readonly sessionId?: string | null;
|
|
@@ -225,6 +475,8 @@ export interface PendingApproval {
|
|
|
225
475
|
readonly argsDigest: string;
|
|
226
476
|
readonly createdAt: string;
|
|
227
477
|
readonly state: PendingApprovalState;
|
|
478
|
+
readonly deadlineAt?: string;
|
|
479
|
+
readonly decisionReason?: 'permission_cancelled' | 'permission_timeout' | 'permission_unavailable' | 'local_user_denied' | 'permission_policy_changed';
|
|
228
480
|
readonly decidedAt?: string;
|
|
229
481
|
readonly decidedBy?: 'local_ui' | 'policy';
|
|
230
482
|
}
|
|
@@ -295,3 +547,4 @@ export declare function decideAcceptance(input: {
|
|
|
295
547
|
readonly accept: boolean;
|
|
296
548
|
} | null;
|
|
297
549
|
}): AcceptanceDecision;
|
|
550
|
+
export {};
|
package/dist/delegation.js
CHANGED
|
@@ -1,10 +1,61 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Project-agent delegation contracts. Pure projections only; nothing here runs a tool.
|
|
3
|
-
* The user-visible conclusion of a work session is
|
|
3
|
+
* The user-visible conclusion of a work session is `decideLifecycle`'s conclusion.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
|
|
5
|
+
import { controlPhasesForOrigin } from "./session-control.js";
|
|
6
|
+
import { decideLifecycle, } from "./task-overview.js";
|
|
7
|
+
export const WORK_SESSION_STATUSES = ['paused', 'blocked', 'queued', 'starting', 'running', 'waiting_user', 'waiting_agent', 'stopping', 'awaiting_outcome', 'verifying',
|
|
7
8
|
'result_ready', 'accepted', 'failed', 'cancelled', 'superseded'];
|
|
9
|
+
/** Persisted delivery facts displayed by the work session. Legacy records may have only a commit. */
|
|
10
|
+
const bindingTextFields = ['baseCommit', 'taskBranch', 'worktreePath', 'targetWorkspacePath',
|
|
11
|
+
'repoKey', 'repoCommonDir', 'repoRoot', 'baseRef', 'baseSha', 'executionRoot', 'expectedTargetTip'];
|
|
12
|
+
function projectWorktreeReceipt(value, allowed) {
|
|
13
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
14
|
+
return undefined;
|
|
15
|
+
const { status, reason } = value;
|
|
16
|
+
const match = allowed.find(candidate => candidate === status);
|
|
17
|
+
if (match)
|
|
18
|
+
return { status: match, ...(typeof reason === 'string' && reason ? { reason } : {}) };
|
|
19
|
+
}
|
|
20
|
+
export function projectWorkSessionDeliveryBinding(value) {
|
|
21
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
22
|
+
return undefined;
|
|
23
|
+
const raw = value;
|
|
24
|
+
const facts = {};
|
|
25
|
+
for (const key of bindingTextFields) {
|
|
26
|
+
const field = raw[key];
|
|
27
|
+
if (typeof field === 'string' && field.trim())
|
|
28
|
+
facts[key] = field;
|
|
29
|
+
}
|
|
30
|
+
const { executionIsolation, effectiveIsolation, requestedIsolation, targetBranch, mainTreeDirty } = raw;
|
|
31
|
+
const diagnostic = raw.isolationDiagnostic;
|
|
32
|
+
let isolationDiagnostic;
|
|
33
|
+
if (diagnostic && typeof diagnostic === 'object' && !Array.isArray(diagnostic)) {
|
|
34
|
+
const { stage, reasonCode, repoInput, dirtyNotice, candidates } = diagnostic;
|
|
35
|
+
if (typeof stage === 'string' && typeof reasonCode === 'string') {
|
|
36
|
+
isolationDiagnostic = {
|
|
37
|
+
stage, reasonCode,
|
|
38
|
+
...(typeof repoInput === 'string' ? { repoInput } : {}),
|
|
39
|
+
...(typeof dirtyNotice === 'boolean' ? { dirtyNotice } : {}),
|
|
40
|
+
...(Array.isArray(candidates) ? { candidates: candidates.flatMap(item => item && typeof item.repoKey === 'string' ? [{ repoKey: item.repoKey }] : []) } : {}),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const worktreeCleanup = projectWorktreeReceipt(raw.worktreeCleanup, ['cleaned', 'reconciling']);
|
|
45
|
+
const deliveryHandoff = projectWorktreeReceipt(raw.deliveryHandoff, ['delivered', 'nothing_to_merge', 'stopped', 'reconciling']);
|
|
46
|
+
const projected = {
|
|
47
|
+
...facts,
|
|
48
|
+
...((typeof targetBranch === 'string' && targetBranch.trim()) || (targetBranch === null && typeof requestedIsolation === 'string') ? { targetBranch } : {}),
|
|
49
|
+
...(executionIsolation === 'worktree' || executionIsolation === 'none' ? { executionIsolation } : {}),
|
|
50
|
+
...(effectiveIsolation === 'worktree' || effectiveIsolation === 'none' ? { effectiveIsolation } : {}),
|
|
51
|
+
...(requestedIsolation === 'auto' || requestedIsolation === 'worktree' || requestedIsolation === 'none' ? { requestedIsolation } : {}),
|
|
52
|
+
...(typeof mainTreeDirty === 'boolean' || mainTreeDirty === null ? { mainTreeDirty } : {}),
|
|
53
|
+
...(isolationDiagnostic ? { isolationDiagnostic } : {}),
|
|
54
|
+
...(worktreeCleanup ? { worktreeCleanup } : {}),
|
|
55
|
+
...(deliveryHandoff ? { deliveryHandoff } : {}),
|
|
56
|
+
};
|
|
57
|
+
return Object.keys(projected).length ? projected : undefined;
|
|
58
|
+
}
|
|
8
59
|
function fnv1a(text) {
|
|
9
60
|
let hash = 0x811c9dc5;
|
|
10
61
|
for (let index = 0; index < text.length; index += 1) {
|
|
@@ -43,60 +94,67 @@ export function createDelegationEvent(input) {
|
|
|
43
94
|
payload,
|
|
44
95
|
};
|
|
45
96
|
}
|
|
46
|
-
function delegationStatus(snapshot, meta, projected) {
|
|
47
|
-
if (snapshot.status === 'failed')
|
|
48
|
-
return 'failed';
|
|
49
|
-
if (snapshot.status === 'cancelled')
|
|
50
|
-
return 'cancelled';
|
|
51
|
-
if (snapshot.status === 'completed') {
|
|
52
|
-
if (meta.verifying || meta.phase === 'verifying')
|
|
53
|
-
return 'verifying';
|
|
54
|
-
if (meta.acceptance === 'confirm' && meta.accepted !== true)
|
|
55
|
-
return 'result_ready';
|
|
56
|
-
return 'accepted';
|
|
57
|
-
}
|
|
58
|
-
if (meta.supersededBy)
|
|
59
|
-
return 'superseded';
|
|
60
|
-
if (meta.phase === 'paused')
|
|
61
|
-
return 'paused';
|
|
62
|
-
// 复核进行中盖过「需要你」。草稿、待批准、等回答的计划在独立复核时都显示 verifying。
|
|
63
|
-
if (meta.verifying || meta.phase === 'verifying')
|
|
64
|
-
return 'verifying';
|
|
65
|
-
if (projected.actionRight === 'needs_you')
|
|
66
|
-
return 'waiting_user';
|
|
67
|
-
if (snapshot.runnerStatus === 'exploring')
|
|
68
|
-
return 'verifying';
|
|
69
|
-
if (meta.phase === 'starting')
|
|
70
|
-
return 'starting';
|
|
71
|
-
if (snapshot.status === 'approved'
|
|
72
|
-
|| snapshot.status === 'accepted'
|
|
73
|
-
|| snapshot.status === 'paused'
|
|
74
|
-
|| snapshot.status === 'interrupted'
|
|
75
|
-
|| projected.actionRight === 'paused') {
|
|
76
|
-
return 'queued';
|
|
77
|
-
}
|
|
78
|
-
return 'running';
|
|
79
|
-
}
|
|
80
97
|
/**
|
|
81
98
|
* Project a GoalPlan snapshot into a work session.
|
|
82
99
|
* actionRight / nextAction / statusLabel come from projectGoalPlan, so the two projections cannot disagree.
|
|
83
100
|
* A paused plan has no delegation status of its own; it is queued, and the visible conclusion stays paused.
|
|
84
101
|
*/
|
|
85
102
|
export function projectWorkSession(plan, conversationMeta) {
|
|
86
|
-
const projected =
|
|
103
|
+
const projected = decideLifecycle(plan, {
|
|
104
|
+
...(conversationMeta.executionOwnership ? { executionOwnership: conversationMeta.executionOwnership } : {}),
|
|
105
|
+
// `delegated` 必须是真实事实;不能用"这是工作会话"反推,否则会改写非委派历史语义。
|
|
106
|
+
...(plan.delegated === true ? { delegated: true } : {}),
|
|
107
|
+
...(conversationMeta.acceptance ? { acceptance: conversationMeta.acceptance } : {}),
|
|
108
|
+
humanGate: conversationMeta.resultConfirmationRequired === true,
|
|
109
|
+
accepted: conversationMeta.accepted === true ||
|
|
110
|
+
(plan.delegated !== true &&
|
|
111
|
+
plan.status === 'completed' &&
|
|
112
|
+
conversationMeta.acceptance !== 'confirm' &&
|
|
113
|
+
conversationMeta.accepted === undefined &&
|
|
114
|
+
!conversationMeta.verifying &&
|
|
115
|
+
!plan.runnerStatus),
|
|
116
|
+
superseded: Boolean(conversationMeta.supersededBy),
|
|
117
|
+
needsUser: plan.status === 'awaiting_approval' || plan.needsUser === true,
|
|
118
|
+
verificationActive: conversationMeta.verifying === true,
|
|
119
|
+
...(conversationMeta.verificationFailed === true ? { verificationFailed: true } : {}),
|
|
120
|
+
...(conversationMeta.phase ? { phase: conversationMeta.phase } : {}),
|
|
121
|
+
blockedReason: plan.agentWaiting ? 'waiting_parent_agent' : plan.blockedReason,
|
|
122
|
+
interrupted: plan.interrupted,
|
|
123
|
+
interruptionOrigin: plan.interruptionOrigin,
|
|
124
|
+
...controlPhasesForOrigin(conversationMeta.origin),
|
|
125
|
+
...(conversationMeta.obligationDisposition ? { obligationDisposition: conversationMeta.obligationDisposition } : {}),
|
|
126
|
+
...(conversationMeta.origin.cancellation?.disposition ? { cancellationDisposition: conversationMeta.origin.cancellation.disposition } : {}),
|
|
127
|
+
...(!conversationMeta.origin.executionControl && conversationMeta.coordination?.phase === 'awaiting_outcome'
|
|
128
|
+
? { takeoverPhase: 'awaiting_outcome' }
|
|
129
|
+
: {}),
|
|
130
|
+
});
|
|
131
|
+
const status = projected.status;
|
|
87
132
|
return {
|
|
88
133
|
sessionId: conversationMeta.sessionId ?? plan.conversationId ?? plan.planId,
|
|
89
134
|
workspaceId: conversationMeta.workspaceId,
|
|
90
135
|
title: plan.title,
|
|
91
136
|
planId: plan.planId,
|
|
92
|
-
status
|
|
137
|
+
status,
|
|
138
|
+
// 直接消费同一份决策;这里再改写就等于第二套状态机。
|
|
93
139
|
actionRight: projected.actionRight,
|
|
94
140
|
nextAction: projected.nextAction,
|
|
95
141
|
statusLabel: projected.statusLabel,
|
|
142
|
+
cancelable: projected.cancelable,
|
|
143
|
+
followUp: projected.followUp,
|
|
144
|
+
...(conversationMeta.executionOwnership ? { executionOwnership: conversationMeta.executionOwnership } : {}),
|
|
96
145
|
...(projected.needsYouReason ? { needsYouReason: projected.needsYouReason } : {}),
|
|
146
|
+
...(conversationMeta.coordination ? { coordination: conversationMeta.coordination } : {}),
|
|
97
147
|
spawnedAt: conversationMeta.spawnedAt ?? plan.updatedAt ?? '',
|
|
148
|
+
...(conversationMeta.startedAt ? { startedAt: conversationMeta.startedAt } : {}),
|
|
149
|
+
...(conversationMeta.endedAt ? { endedAt: conversationMeta.endedAt } : {}),
|
|
98
150
|
...(conversationMeta.conversationId ? { conversationId: conversationMeta.conversationId } : {}),
|
|
99
151
|
origin: conversationMeta.origin,
|
|
152
|
+
...(conversationMeta.deliveryBinding ? { deliveryBinding: conversationMeta.deliveryBinding } : {}),
|
|
153
|
+
...(conversationMeta.resourceBlocker ? { resourceBlocker: conversationMeta.resourceBlocker } : {}),
|
|
154
|
+
...(conversationMeta.executionClaimClosure ? { executionClaimClosure: conversationMeta.executionClaimClosure } : {}),
|
|
155
|
+
...(conversationMeta.unknownOutcomePolicy ? { unknownOutcomePolicy: conversationMeta.unknownOutcomePolicy } : {}),
|
|
156
|
+
...(conversationMeta.unknownOutcomeResolution ? { unknownOutcomeResolution: conversationMeta.unknownOutcomeResolution } : {}),
|
|
157
|
+
...(conversationMeta.retainedUnknowns?.length ? { retainedUnknowns: conversationMeta.retainedUnknowns } : {}),
|
|
100
158
|
...(conversationMeta.queuedBehind ? { queuedBehind: conversationMeta.queuedBehind.map(item => ({ ...item })) } : {}),
|
|
101
159
|
...(conversationMeta.queueReason ? { queueReason: conversationMeta.queueReason } : {}),
|
|
102
160
|
...(conversationMeta.supersededBy ? { supersededBy: conversationMeta.supersededBy } : {}),
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
export interface GitDocumentRevision {
|
|
2
|
+
readonly kind: 'git';
|
|
3
|
+
/** Complete immutable commit SHA only; never a branch or Git expression. */
|
|
4
|
+
readonly commit: string;
|
|
5
|
+
/** Host-confirmed device-local repository binding, not an authorization ticket. */
|
|
6
|
+
readonly repositoryId?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ConfirmedGitDocumentRevision extends GitDocumentRevision {
|
|
9
|
+
readonly repositoryId: string;
|
|
10
|
+
readonly path: string;
|
|
11
|
+
}
|
|
12
|
+
/** Human-initiated preview only. This reference never grants model/tool access. */
|
|
13
|
+
export interface BotDocumentReference {
|
|
14
|
+
readonly workspaceId: string;
|
|
15
|
+
readonly path: string;
|
|
16
|
+
readonly relativeTo?: string;
|
|
17
|
+
/** Host revalidates Session/GoalPlan ownership on every read; never a root or grant. */
|
|
18
|
+
readonly task?: {
|
|
19
|
+
readonly sessionId: string;
|
|
20
|
+
readonly planId: string;
|
|
21
|
+
};
|
|
22
|
+
/** Explicit UI navigation intent; never an authorization root. */
|
|
23
|
+
readonly kind?: 'file' | 'directory';
|
|
24
|
+
/** Resolve/stat only; never returns file contents. */
|
|
25
|
+
readonly metadataOnly?: boolean;
|
|
26
|
+
/** Conditional text/image read only; an observation never grants access. */
|
|
27
|
+
readonly expectedObservation?: {
|
|
28
|
+
readonly resourceId: string;
|
|
29
|
+
readonly contentVersion?: string;
|
|
30
|
+
};
|
|
31
|
+
readonly revision?: GitDocumentRevision;
|
|
32
|
+
}
|
|
33
|
+
/** Device-local locator identity, revalidated by the host on every access. */
|
|
34
|
+
export interface LocalDocumentIdentity {
|
|
35
|
+
readonly sourceId: string;
|
|
36
|
+
readonly resourceId: string;
|
|
37
|
+
readonly relativePath: string;
|
|
38
|
+
}
|
|
39
|
+
/** Version of the actual bytes returned by a successful read; not a saved snapshot. */
|
|
40
|
+
export interface LocalDocumentObservation extends LocalDocumentIdentity {
|
|
41
|
+
readonly contentVersion: string;
|
|
42
|
+
}
|
|
43
|
+
export interface LocalDocumentReadResult {
|
|
44
|
+
readonly metadataOnly?: boolean;
|
|
45
|
+
readonly ok: boolean;
|
|
46
|
+
readonly status: 'ok' | 'not_found' | 'not_file' | 'too_large' | 'binary' | 'invalid_path' | 'error' | 'permission_denied' | 'sensitive_path' | 'scope_denied' | 'ambiguous_path' | 'workspace_unavailable' | 'relative_base_required' | 'version_changed' | 'source_changed' | 'version_unavailable' | 'not_git_repo' | 'invalid_ref' | 'revision_unavailable' | 'unsupported_entry';
|
|
47
|
+
readonly content: string;
|
|
48
|
+
readonly size?: number;
|
|
49
|
+
readonly resolvedFrom?: string;
|
|
50
|
+
readonly resolvedPath?: string;
|
|
51
|
+
readonly identity?: LocalDocumentIdentity;
|
|
52
|
+
readonly observation?: LocalDocumentObservation;
|
|
53
|
+
readonly revision?: ConfirmedGitDocumentRevision;
|
|
54
|
+
/** Confirmed locations for an explicit human choice; never an authorization ticket. */
|
|
55
|
+
readonly candidates?: readonly {
|
|
56
|
+
readonly path: string;
|
|
57
|
+
readonly root: string;
|
|
58
|
+
}[];
|
|
59
|
+
/** Bot project root used when a file citation was not found. Not an authorization root. */
|
|
60
|
+
readonly attemptedRoot?: string;
|
|
61
|
+
readonly error?: string;
|
|
62
|
+
}
|
|
63
|
+
/** Bounded presentation metadata from a known local file Tool Result in the same turn.
|
|
64
|
+
* A restored hint must be re-resolved under the current Bot scope before reading. */
|
|
65
|
+
export interface BotResourceReferenceHint {
|
|
66
|
+
readonly path: string;
|
|
67
|
+
readonly tool: 'read_file' | 'write_file' | 'edit_file';
|
|
68
|
+
}
|
|
69
|
+
/** Human-initiated, bounded filename discovery; every selected hit is re-authorized on read. */
|
|
70
|
+
export interface BotResourceSearchResult {
|
|
71
|
+
readonly ok: boolean;
|
|
72
|
+
readonly status: LocalDocumentReadResult['status'] | 'not_dir';
|
|
73
|
+
readonly scoped?: boolean;
|
|
74
|
+
readonly workspacePath?: string;
|
|
75
|
+
readonly files: readonly {
|
|
76
|
+
readonly relPath: string;
|
|
77
|
+
readonly name: string;
|
|
78
|
+
readonly kind: 'file' | 'directory';
|
|
79
|
+
}[];
|
|
80
|
+
readonly truncated?: boolean;
|
|
81
|
+
readonly visited?: number;
|
|
82
|
+
readonly error?: string;
|
|
83
|
+
}
|
|
84
|
+
/** Renderer click context is a lookup hint. The Desktop host owns the authorization. */
|
|
85
|
+
export interface DocumentPreviewRequest {
|
|
86
|
+
readonly reference: BotDocumentReference;
|
|
87
|
+
readonly conversationId: string;
|
|
88
|
+
readonly messageId?: string;
|
|
89
|
+
readonly evidenceRef?: string;
|
|
90
|
+
readonly challenge?: string;
|
|
91
|
+
}
|
|
92
|
+
export type DocumentPreviewAccessResult = {
|
|
93
|
+
readonly ok: true;
|
|
94
|
+
readonly status: 'scoped';
|
|
95
|
+
} | {
|
|
96
|
+
readonly ok: true;
|
|
97
|
+
readonly status: 'allowed';
|
|
98
|
+
readonly token: string;
|
|
99
|
+
readonly path: string;
|
|
100
|
+
readonly source: 'external' | 'conversation' | 'worktree';
|
|
101
|
+
} | {
|
|
102
|
+
readonly ok: false;
|
|
103
|
+
readonly status: 'scope_denied';
|
|
104
|
+
readonly canRequestSingleFilePreview: true;
|
|
105
|
+
readonly path: string;
|
|
106
|
+
readonly challenge: string;
|
|
107
|
+
} | {
|
|
108
|
+
readonly ok: false;
|
|
109
|
+
readonly status: LocalDocumentReadResult['status'];
|
|
110
|
+
readonly canRequestSingleFilePreview?: never;
|
|
111
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|