@peer-agent/protocol 0.1.0-rc.25 → 0.1.0-rc.27
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/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/delegation-coordination.d.ts +1 -0
- package/dist/delegation.d.ts +32 -0
- package/dist/document-reference.d.ts +81 -0
- package/dist/document-reference.js +1 -0
- package/dist/evidence-inspection.d.ts +29 -0
- package/dist/goal.d.ts +2 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +10 -0
- package/dist/local-git.d.ts +44 -0
- package/dist/local-git.js +3 -0
- package/dist/model-routing.d.ts +20 -3
- package/dist/model-routing.js +22 -2
- package/dist/project-input-recovery.d.ts +65 -0
- package/dist/project-input-recovery.js +5 -0
- package/dist/project.d.ts +6 -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.d.ts +91 -0
- package/dist/resource-feedback.js +120 -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 +138 -0
- package/dist/resource-window.js +116 -0
- package/package.json +1 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/** Native address copies have independent instance identities; never a migrated webview. */
|
|
2
|
+
export interface BrowserWindowIdentity {
|
|
3
|
+
readonly viewId: string;
|
|
4
|
+
readonly windowId: string;
|
|
5
|
+
readonly generation: string;
|
|
6
|
+
}
|
|
7
|
+
export interface BrowserWindowCopyRequest {
|
|
8
|
+
readonly conversationId: string;
|
|
9
|
+
readonly browserTabId: string;
|
|
10
|
+
readonly webContentsId: number;
|
|
11
|
+
}
|
|
12
|
+
export type BrowserWindowAction = 'navigate' | 'back' | 'forward' | 'reload' | 'stop' | 'return' | 'close';
|
|
13
|
+
export interface BrowserWindowState {
|
|
14
|
+
readonly identity: BrowserWindowIdentity;
|
|
15
|
+
readonly conversationId: string;
|
|
16
|
+
readonly browserTabId: string;
|
|
17
|
+
readonly url: string;
|
|
18
|
+
readonly title: string;
|
|
19
|
+
readonly loading: boolean;
|
|
20
|
+
readonly canBack: boolean;
|
|
21
|
+
readonly canForward: boolean;
|
|
22
|
+
readonly failure: string | null;
|
|
23
|
+
readonly sequence: number;
|
|
24
|
+
readonly copy: true;
|
|
25
|
+
}
|
|
26
|
+
export type BrowserWindowResult = {
|
|
27
|
+
readonly ok: true;
|
|
28
|
+
readonly state: BrowserWindowState;
|
|
29
|
+
readonly returnStatus?: 'returned' | 'source_tab_closed';
|
|
30
|
+
} | {
|
|
31
|
+
readonly ok: false;
|
|
32
|
+
readonly status: 'invalid_request' | 'scope_denied' | 'source_unavailable' | 'limit_reached' | 'stale_view' | 'cancelled';
|
|
33
|
+
};
|
|
34
|
+
export interface BrowserWindowReturnRequest {
|
|
35
|
+
readonly requestId: string;
|
|
36
|
+
readonly identity: BrowserWindowIdentity;
|
|
37
|
+
readonly conversationId: string;
|
|
38
|
+
readonly workspaceId?: string;
|
|
39
|
+
readonly browserTabId: string;
|
|
40
|
+
readonly expiresAt: number;
|
|
41
|
+
}
|
|
42
|
+
export interface BrowserWindowReturnAck {
|
|
43
|
+
readonly requestId: string;
|
|
44
|
+
readonly identity: BrowserWindowIdentity;
|
|
45
|
+
readonly status: 'returned' | 'source_tab_closed' | 'cancelled';
|
|
46
|
+
}
|
|
47
|
+
export declare function normalizeBrowserWindowUrl(raw: unknown): string | null;
|
|
48
|
+
export declare function normalizeBrowserWindowCopyRequest(raw: unknown): BrowserWindowCopyRequest | null;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export function normalizeBrowserWindowUrl(raw) {
|
|
2
|
+
if (typeof raw !== 'string' || raw.length > 8192)
|
|
3
|
+
return null;
|
|
4
|
+
try {
|
|
5
|
+
const url = new URL(raw);
|
|
6
|
+
return ['http:', 'https:'].includes(url.protocol) && !url.username && !url.password ? url.href : null;
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export function normalizeBrowserWindowCopyRequest(raw) {
|
|
13
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw))
|
|
14
|
+
return null;
|
|
15
|
+
const v = raw;
|
|
16
|
+
if (Object.keys(v).some(k => !['conversationId', 'browserTabId', 'webContentsId'].includes(k)))
|
|
17
|
+
return null;
|
|
18
|
+
if (![v.conversationId, v.browserTabId].every(x => typeof x === 'string' && x.length > 0 && x.length <= 256))
|
|
19
|
+
return null;
|
|
20
|
+
if (!Number.isSafeInteger(v.webContentsId) || v.webContentsId <= 0)
|
|
21
|
+
return null;
|
|
22
|
+
return { conversationId: v.conversationId, browserTabId: v.browserTabId, webContentsId: v.webContentsId };
|
|
23
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** A factual refusal layer; it never grants permission or changes acceptance. */
|
|
2
|
+
export interface CapabilityBlocker {
|
|
3
|
+
readonly stage: 'projection' | 'role' | 'delegation_admission' | 'permission' | 'execution';
|
|
4
|
+
readonly reason: string;
|
|
5
|
+
readonly capabilityId?: string;
|
|
6
|
+
readonly required?: readonly string[];
|
|
7
|
+
readonly available?: readonly string[];
|
|
8
|
+
readonly missing?: readonly string[];
|
|
9
|
+
readonly criterionIds?: readonly string[];
|
|
10
|
+
readonly alternatives?: readonly string[];
|
|
11
|
+
readonly retryable: boolean;
|
|
12
|
+
readonly userActionRequired: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface DelegationCapabilityAdmission {
|
|
15
|
+
readonly required: readonly string[];
|
|
16
|
+
readonly inventoryHash: string | null;
|
|
17
|
+
readonly inventoryKnown: boolean;
|
|
18
|
+
readonly requirementsDeclared: boolean;
|
|
19
|
+
readonly checkedAt: string;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -31,6 +31,7 @@ export interface CoordinationDecision {
|
|
|
31
31
|
}
|
|
32
32
|
export type TaskTransitionPhase = 'recorded' | 'stopping' | 'awaiting_outcome' | 'ready' | 'started' | 'completed' | 'blocked';
|
|
33
33
|
export interface TaskTransition {
|
|
34
|
+
diagnostic?: import('./capability-admission.ts').CapabilityBlocker;
|
|
34
35
|
schemaVersion: 1;
|
|
35
36
|
operationId: string;
|
|
36
37
|
workId: string;
|
package/dist/delegation.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export type WorkSessionStatus = 'paused' | 'queued' | 'starting' | 'running' | '
|
|
|
8
8
|
export declare const WORK_SESSION_STATUSES: readonly ["paused", "queued", "starting", "running", "waiting_user", "waiting_agent", "stopping", "awaiting_outcome", "verifying", "result_ready", "accepted", "failed", "cancelled", "superseded"];
|
|
9
9
|
export type InputSurface = 'desktop' | 'quick_chat' | 'tui' | 'remote';
|
|
10
10
|
export interface DelegationOrigin {
|
|
11
|
+
readonly capabilityAdmission?: import('./capability-admission.ts').DelegationCapabilityAdmission;
|
|
11
12
|
readonly takeover?: {
|
|
12
13
|
operationId: string;
|
|
13
14
|
phase: 'stopping' | 'completed';
|
|
@@ -89,6 +90,8 @@ export interface WorkSession extends SessionQueueFacts {
|
|
|
89
90
|
readonly supersededBy?: string;
|
|
90
91
|
}
|
|
91
92
|
export interface SessionReport {
|
|
93
|
+
/** Current host verification, loaded with task details; never assistant prose. */
|
|
94
|
+
readonly verification?: SessionVerificationDetail;
|
|
92
95
|
readonly sessionId: string;
|
|
93
96
|
readonly planId: string | null;
|
|
94
97
|
readonly status: WorkSessionStatus;
|
|
@@ -254,6 +257,26 @@ export interface VerificationVerdict {
|
|
|
254
257
|
readonly checks: readonly VerificationCheck[];
|
|
255
258
|
readonly evidenceRefs: readonly string[];
|
|
256
259
|
}
|
|
260
|
+
export interface SessionVerificationDetail {
|
|
261
|
+
readonly sessionId: string;
|
|
262
|
+
readonly outcome: VerificationOutcome;
|
|
263
|
+
readonly checks: readonly {
|
|
264
|
+
readonly name: string;
|
|
265
|
+
readonly result: 'passed' | 'failed';
|
|
266
|
+
readonly evidenceRefs: readonly string[];
|
|
267
|
+
readonly reason?: string;
|
|
268
|
+
}[];
|
|
269
|
+
readonly workerModel: string | null;
|
|
270
|
+
readonly verifierModel: string | null;
|
|
271
|
+
readonly sameSource: boolean;
|
|
272
|
+
readonly reviewAttempts: readonly VerificationAttemptDiagnostic[];
|
|
273
|
+
readonly outputs: readonly {
|
|
274
|
+
readonly name: string;
|
|
275
|
+
readonly evidenceRef: string;
|
|
276
|
+
readonly summary: string;
|
|
277
|
+
readonly truncated: boolean;
|
|
278
|
+
}[];
|
|
279
|
+
}
|
|
257
280
|
/** Bounded persisted diagnostics, never an input to acceptance or Evidence authority. */
|
|
258
281
|
export interface VerificationAttemptDiagnostic {
|
|
259
282
|
readonly verifierRunId: string;
|
|
@@ -333,8 +356,17 @@ export interface ProjectInput {
|
|
|
333
356
|
readonly quoteRefs: readonly string[];
|
|
334
357
|
readonly attachmentRefs: readonly string[];
|
|
335
358
|
readonly attachments?: readonly ProjectInputAttachment[];
|
|
359
|
+
readonly resourceFeedback?: readonly import('./resource-feedback.ts').ResourceFeedback[];
|
|
336
360
|
readonly createdAt: string;
|
|
337
361
|
}
|
|
362
|
+
/** Existing durable input receipt. A later handoff can fail after input was saved. */
|
|
363
|
+
export interface ProjectAgentSubmitInputResult {
|
|
364
|
+
readonly ok: boolean;
|
|
365
|
+
readonly code?: string;
|
|
366
|
+
readonly message?: string;
|
|
367
|
+
readonly input?: ProjectInput;
|
|
368
|
+
readonly delivery?: 'queued' | 'user_intervened';
|
|
369
|
+
}
|
|
338
370
|
export type PendingApprovalState = 'open' | 'approved' | 'denied' | 'expired' | 'stale' | 'cancelled';
|
|
339
371
|
export interface PendingApproval {
|
|
340
372
|
readonly policyRevision?: string;
|
|
@@ -0,0 +1,81 @@
|
|
|
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' | '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
|
+
readonly error?: string;
|
|
60
|
+
}
|
|
61
|
+
/** Bounded presentation metadata from a known local file Tool Result in the same turn.
|
|
62
|
+
* A restored hint must be re-resolved under the current Bot scope before reading. */
|
|
63
|
+
export interface BotResourceReferenceHint {
|
|
64
|
+
readonly path: string;
|
|
65
|
+
readonly tool: 'read_file' | 'write_file' | 'edit_file';
|
|
66
|
+
}
|
|
67
|
+
/** Human-initiated, bounded filename discovery; every selected hit is re-authorized on read. */
|
|
68
|
+
export interface BotResourceSearchResult {
|
|
69
|
+
readonly ok: boolean;
|
|
70
|
+
readonly status: LocalDocumentReadResult['status'] | 'not_dir';
|
|
71
|
+
readonly scoped?: boolean;
|
|
72
|
+
readonly workspacePath?: string;
|
|
73
|
+
readonly files: readonly {
|
|
74
|
+
readonly relPath: string;
|
|
75
|
+
readonly name: string;
|
|
76
|
+
readonly kind: 'file' | 'directory';
|
|
77
|
+
}[];
|
|
78
|
+
readonly truncated?: boolean;
|
|
79
|
+
readonly visited?: number;
|
|
80
|
+
readonly error?: string;
|
|
81
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BotDocumentReference } from './document-reference.ts';
|
|
1
2
|
/** Read-only display facts. A saved operation is not proof that its task completed. */
|
|
2
3
|
export interface EvidenceSourceDescription {
|
|
3
4
|
readonly evidenceRef: string;
|
|
@@ -5,11 +6,17 @@ export interface EvidenceSourceDescription {
|
|
|
5
6
|
readonly createdAt?: string;
|
|
6
7
|
}
|
|
7
8
|
export interface ProjectAgentEvidenceReadRequest {
|
|
9
|
+
readonly context?: {
|
|
10
|
+
readonly workspaceId: string;
|
|
11
|
+
readonly task?: BotDocumentReference['task'];
|
|
12
|
+
};
|
|
8
13
|
readonly evidenceRef?: string;
|
|
9
14
|
/** Source descriptions only; at most 100 unique references, no body or artifact reads. */
|
|
10
15
|
readonly evidenceRefs?: readonly string[];
|
|
11
16
|
}
|
|
12
17
|
export interface ProjectAgentEvidenceReadResult {
|
|
18
|
+
readonly deliveryStatus?: 'available' | 'scope_denied' | 'unavailable';
|
|
19
|
+
readonly deliveries?: readonly EvidenceDelivery[];
|
|
13
20
|
readonly ok: boolean;
|
|
14
21
|
readonly code?: string;
|
|
15
22
|
readonly evidenceRef?: string;
|
|
@@ -20,3 +27,25 @@ export interface ProjectAgentEvidenceReadResult {
|
|
|
20
27
|
readonly source?: EvidenceSourceDescription;
|
|
21
28
|
readonly items?: readonly EvidenceSourceDescription[];
|
|
22
29
|
}
|
|
30
|
+
/** Navigation provenance only; revalidated against the canonical index after restore. */
|
|
31
|
+
export interface EvidenceDeliveryBinding {
|
|
32
|
+
readonly evidenceRef: string;
|
|
33
|
+
readonly artifactRef: string;
|
|
34
|
+
}
|
|
35
|
+
export interface EvidenceDelivery extends EvidenceDeliveryBinding {
|
|
36
|
+
readonly kind: 'file' | 'code-change' | 'image';
|
|
37
|
+
readonly label: string;
|
|
38
|
+
/** A locator, never a grant or proof of historical bytes. Read through the existing scoped service. */
|
|
39
|
+
readonly reference?: BotDocumentReference;
|
|
40
|
+
readonly savedPreview?: {
|
|
41
|
+
readonly kind: 'diff-summary';
|
|
42
|
+
readonly text: string;
|
|
43
|
+
readonly truncated: true;
|
|
44
|
+
} | {
|
|
45
|
+
readonly kind: 'image';
|
|
46
|
+
readonly dataUrl: string;
|
|
47
|
+
readonly width: number;
|
|
48
|
+
readonly height: number;
|
|
49
|
+
};
|
|
50
|
+
readonly previewUnavailable?: boolean;
|
|
51
|
+
}
|
package/dist/goal.d.ts
CHANGED
|
@@ -166,7 +166,7 @@ export interface EvidenceIndexRecord {
|
|
|
166
166
|
readonly artifactRefs?: readonly string[];
|
|
167
167
|
/** Redacted, bounded execution-time snapshot of a successful local Tool Result. */
|
|
168
168
|
readonly bodyPreview?: {
|
|
169
|
-
readonly kind: 'file' | 'command';
|
|
169
|
+
readonly kind: 'file' | 'command' | 'observation';
|
|
170
170
|
readonly text: string;
|
|
171
171
|
readonly truncated: boolean;
|
|
172
172
|
};
|
|
@@ -446,6 +446,7 @@ export interface GoalRunTrace {
|
|
|
446
446
|
}
|
|
447
447
|
export type GoalSuccessCriterionKind = 'command' | 'test' | 'file-contains' | 'file-exists' | 'model_review' | 'manual';
|
|
448
448
|
export interface GoalSuccessCriterion {
|
|
449
|
+
readonly requiredCapabilities?: readonly string[];
|
|
449
450
|
readonly id: string;
|
|
450
451
|
readonly kind: GoalSuccessCriterionKind;
|
|
451
452
|
readonly description: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export type { ProjectWorkBudgetLimits, ProjectWorkBudgetBoundary, ProjectReplyRe
|
|
|
3
3
|
export type { CoordinationAction, CoordinationLifecycle, CoordinationMandate, CoordinationDecision, TaskTransitionPhase, TaskTransition, CoordinationExecutionBinding, CoordinationSessionFacts } from './delegation-coordination.ts';
|
|
4
4
|
export { deriveSessionFacts, type SessionFactSnapshot } from './session-facts.ts';
|
|
5
5
|
export { projectAgentFailureKind, classifyProjectAgentFailure, type ProjectRecoveryFailureKind, type ProviderRequestRecovery, type ProjectAgentTurnRecovery, type ReplyAnchorCandidate } from './project-agent-failure.ts';
|
|
6
|
-
export type { EvidenceSourceDescription, ProjectAgentEvidenceReadRequest, ProjectAgentEvidenceReadResult } from './evidence-inspection.ts';
|
|
6
|
+
export type { EvidenceSourceDescription, EvidenceDeliveryBinding, EvidenceDelivery, ProjectAgentEvidenceReadRequest, ProjectAgentEvidenceReadResult } from './evidence-inspection.ts';
|
|
7
7
|
export { toolActivityPreview, toolActivitySummary } from './tool-activity-preview.ts';
|
|
8
8
|
export { isModelReasoningEffort, modelReasoningLevels, modelDefaultReasoningEffort, type ModelReasoningEffort } from './model-reasoning.ts';
|
|
9
9
|
export type { SelectionRange, SelectionReference, SelectionDraft, SelectionOrigin, SelectionChildSession, SelectionChildSummary, SelectionChildrenPage, SelectionChildRead } from './selection-reference.ts';
|
|
@@ -890,9 +890,21 @@ export * from './task-overview.ts';
|
|
|
890
890
|
export * from './skill-marketplace.ts';
|
|
891
891
|
export * from './delegation.ts';
|
|
892
892
|
export * from './model-routing.ts';
|
|
893
|
+
export * from './document-reference.ts';
|
|
893
894
|
export * from './project.ts';
|
|
894
895
|
export * from './objectives.ts';
|
|
895
896
|
export * from './remote-access-settings.ts';
|
|
896
897
|
export type { BotModelSelectionUpdateRequest, BotModelSelectionUpdateResult } from './bot-model-selection.ts';
|
|
897
898
|
export * from './local-image.ts';
|
|
898
899
|
export * from './bot-conversation-read.ts';
|
|
900
|
+
export * from './local-git.ts';
|
|
901
|
+
export type { CapabilityBlocker, DelegationCapabilityAdmission } from './capability-admission.ts';
|
|
902
|
+
export * from './project-input-recovery.ts';
|
|
903
|
+
export { botResourceReferences } from './resource-reference-hints.ts';
|
|
904
|
+
export type { ResourceWindowCheckpointRequest, ResourceWindowCheckpointAck, ResourceWindowCloseBlocked, ResourceWindowReturnRequest, ResourceWindowReturnAck, ResourceWindowHistoryEntry, ResourceWindowHistoryResult, ResourceWindowReadRequest, ResourceWindowReadResult, ResourceWindowResource, ResourceWindowNavigation, ResourceWindowOpenRequest, ResourceWindowOwner, ResourceWindowIdentity, ResourceWindowContext, ResourceWindowStatus, ResourceWindowResult } from './resource-window.ts';
|
|
905
|
+
export { normalizeResourceWindowRequest, normalizeResourceWindowOwner, normalizeResourceWindowNavigation } from './resource-window.ts';
|
|
906
|
+
export * from './browser-window.js';
|
|
907
|
+
export * from './resource-feedback.js';
|
|
908
|
+
export * from './resource-edit.ts';
|
|
909
|
+
export * from './resource-file-replace.ts';
|
|
910
|
+
export * from './resource-edit-execution.ts';
|
package/dist/index.js
CHANGED
|
@@ -38,8 +38,18 @@ export * from "./task-overview.js";
|
|
|
38
38
|
export * from "./skill-marketplace.js";
|
|
39
39
|
export * from "./delegation.js";
|
|
40
40
|
export * from "./model-routing.js";
|
|
41
|
+
export * from "./document-reference.js";
|
|
41
42
|
export * from "./project.js";
|
|
42
43
|
export * from "./objectives.js";
|
|
43
44
|
export * from "./remote-access-settings.js";
|
|
44
45
|
export * from "./local-image.js";
|
|
45
46
|
export * from "./bot-conversation-read.js";
|
|
47
|
+
export * from "./local-git.js";
|
|
48
|
+
export * from "./project-input-recovery.js";
|
|
49
|
+
export { botResourceReferences } from "./resource-reference-hints.js";
|
|
50
|
+
export { normalizeResourceWindowRequest, normalizeResourceWindowOwner, normalizeResourceWindowNavigation } from "./resource-window.js";
|
|
51
|
+
export * from './browser-window.js';
|
|
52
|
+
export * from './resource-feedback.js';
|
|
53
|
+
export * from "./resource-edit.js";
|
|
54
|
+
export * from "./resource-file-replace.js";
|
|
55
|
+
export * from "./resource-edit-execution.js";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/** ADR106: bounded repository observations; never arbitrary commands. */
|
|
2
|
+
export declare const LOCAL_GIT_CAPABILITY: "local.git.query";
|
|
3
|
+
export declare const LOCAL_GIT_TOOL: "git_query";
|
|
4
|
+
export type GitReadOperation = 'snapshot' | 'status' | 'log';
|
|
5
|
+
export interface GitReadQuery {
|
|
6
|
+
readonly path: string;
|
|
7
|
+
readonly operation?: GitReadOperation;
|
|
8
|
+
readonly limit?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface GitReadObservation {
|
|
11
|
+
readonly repositoryPath: string;
|
|
12
|
+
readonly gitDirectory: string;
|
|
13
|
+
readonly commonDirectory: string;
|
|
14
|
+
readonly configurationSources: readonly string[];
|
|
15
|
+
readonly operation: GitReadOperation;
|
|
16
|
+
readonly startedAt: string;
|
|
17
|
+
readonly finishedAt: string;
|
|
18
|
+
readonly head: string | null;
|
|
19
|
+
readonly branch: string | null;
|
|
20
|
+
readonly unborn: boolean;
|
|
21
|
+
readonly origin: readonly string[];
|
|
22
|
+
readonly consistent: boolean;
|
|
23
|
+
readonly atomic: false;
|
|
24
|
+
readonly status?: {
|
|
25
|
+
readonly clean: boolean | null;
|
|
26
|
+
readonly submoduleCount: number;
|
|
27
|
+
readonly submodulesInspected: false;
|
|
28
|
+
readonly filtersDisabled: boolean;
|
|
29
|
+
readonly changed: number;
|
|
30
|
+
readonly untracked: number;
|
|
31
|
+
readonly entries: readonly {
|
|
32
|
+
readonly index: string;
|
|
33
|
+
readonly worktree: string;
|
|
34
|
+
readonly path: string;
|
|
35
|
+
readonly from?: string;
|
|
36
|
+
}[];
|
|
37
|
+
readonly truncated: boolean;
|
|
38
|
+
};
|
|
39
|
+
readonly commits: readonly {
|
|
40
|
+
readonly hash: string;
|
|
41
|
+
readonly committedAt: string;
|
|
42
|
+
readonly subject: string;
|
|
43
|
+
}[];
|
|
44
|
+
}
|
package/dist/model-routing.d.ts
CHANGED
|
@@ -5,21 +5,35 @@ import { type ModelReasoningEffort } from './model-reasoning.ts';
|
|
|
5
5
|
*/
|
|
6
6
|
export type ModelTier = 'strong' | 'fast' | 'economy' | 'vision';
|
|
7
7
|
export type ModelRole = 'project_agent' | 'session_worker' | 'explorer' | 'verifier' | 'visual_verifier' | 'memory_curator' | 'objective_probe' | 'compactor';
|
|
8
|
-
export type RoleSetting = {
|
|
8
|
+
export type RoleSetting = ({
|
|
9
9
|
readonly mode: 'tier';
|
|
10
10
|
readonly tier: ModelTier;
|
|
11
11
|
} | {
|
|
12
12
|
readonly mode: 'fixed';
|
|
13
13
|
readonly modelProviderId: string;
|
|
14
|
-
readonly reasoningEffort?: ModelReasoningEffort;
|
|
15
14
|
} | {
|
|
16
15
|
readonly mode: 'auto';
|
|
17
16
|
readonly pool: readonly string[];
|
|
17
|
+
}) & {
|
|
18
|
+
/** Undefined inherits the tier; null explicitly uses the model default. */
|
|
19
|
+
readonly reasoningEffort?: ModelReasoningEffort | null;
|
|
20
|
+
/** Undefined inherits the tier; false explicitly selects the normal channel. */
|
|
21
|
+
readonly fastMode?: boolean;
|
|
18
22
|
};
|
|
19
23
|
export interface ModelTierBinding {
|
|
20
24
|
readonly primary: string;
|
|
21
25
|
readonly fallbacks?: readonly string[];
|
|
26
|
+
readonly reasoningEffort?: ModelReasoningEffort;
|
|
27
|
+
readonly fastMode?: boolean;
|
|
22
28
|
}
|
|
29
|
+
/** Admission matches the existing priority request encoders, never a model-name guess. */
|
|
30
|
+
export declare function modelSupportsFastMode(provider: {
|
|
31
|
+
readonly authMethod?: unknown;
|
|
32
|
+
}): boolean;
|
|
33
|
+
export declare function routingParameters(setting: RoleSetting, tiers: Partial<Record<ModelTier, ModelTierBinding>>): {
|
|
34
|
+
reasoningEffort: ModelReasoningEffort | undefined;
|
|
35
|
+
fastMode: boolean;
|
|
36
|
+
};
|
|
23
37
|
export interface ModelRoutingSettings {
|
|
24
38
|
readonly tiers: Partial<Record<ModelTier, ModelTierBinding>>;
|
|
25
39
|
readonly roles: Partial<Record<ModelRole, RoleSetting>>;
|
|
@@ -42,6 +56,8 @@ export interface RuntimeModelSelection {
|
|
|
42
56
|
readonly modelId: string;
|
|
43
57
|
readonly modelProviderId: string;
|
|
44
58
|
readonly reasoningEffort?: string;
|
|
59
|
+
/** Subscription priority channel. Encoding still admits only ChatGPT and Grok OAuth. */
|
|
60
|
+
readonly fastMode?: boolean;
|
|
45
61
|
readonly family: string;
|
|
46
62
|
}
|
|
47
63
|
export interface ModelSelectionSnapshot {
|
|
@@ -110,6 +126,7 @@ export interface CatalogModel {
|
|
|
110
126
|
readonly local?: boolean;
|
|
111
127
|
readonly reasoningEffort?: string;
|
|
112
128
|
readonly reasoningEffortLevels?: readonly ModelReasoningEffort[];
|
|
129
|
+
readonly supportsFastMode?: boolean;
|
|
113
130
|
}
|
|
114
131
|
export type ModelResolution = {
|
|
115
132
|
readonly ok: true;
|
|
@@ -118,7 +135,7 @@ export type ModelResolution = {
|
|
|
118
135
|
readonly sameFamilyAsWorker?: boolean;
|
|
119
136
|
} | {
|
|
120
137
|
readonly ok: false;
|
|
121
|
-
readonly reason: 'capability' | 'scope' | 'auto_pool' | 'empty' | 'reasoning';
|
|
138
|
+
readonly reason: 'capability' | 'scope' | 'auto_pool' | 'empty' | 'reasoning' | 'fast_mode';
|
|
122
139
|
readonly missing: string;
|
|
123
140
|
};
|
|
124
141
|
export interface RoleModelRequest {
|
package/dist/model-routing.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import { modelDefaultReasoningEffort, modelReasoningLevels } from "./model-reasoning.js";
|
|
2
|
+
/** Admission matches the existing priority request encoders, never a model-name guess. */
|
|
3
|
+
export function modelSupportsFastMode(provider) {
|
|
4
|
+
return provider.authMethod === 'oauth_chatgpt' || provider.authMethod === 'oauth_grok';
|
|
5
|
+
}
|
|
6
|
+
export function routingParameters(setting, tiers) {
|
|
7
|
+
const tier = setting.mode === 'tier' ? tiers[setting.tier] : undefined;
|
|
8
|
+
return {
|
|
9
|
+
reasoningEffort: (setting.reasoningEffort === undefined ? tier?.reasoningEffort : setting.reasoningEffort) ?? undefined,
|
|
10
|
+
fastMode: setting.fastMode ?? tier?.fastMode ?? false,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
2
13
|
/** Project one configured provider into the routing menu contract. */
|
|
3
14
|
export function projectModelRoutingMenuOption(provider) {
|
|
4
15
|
if (!provider || typeof provider.id !== 'string' || !provider.id.trim())
|
|
@@ -75,6 +86,8 @@ function inScope(model, policy) {
|
|
|
75
86
|
return true;
|
|
76
87
|
}
|
|
77
88
|
function missingText(input, reason) {
|
|
89
|
+
if (reason === 'fast_mode')
|
|
90
|
+
return '所选连接不支持快速通道,请选择正常通道或支持的连接';
|
|
78
91
|
if (reason === 'reasoning')
|
|
79
92
|
return '所选模型不支持该推理强度';
|
|
80
93
|
if (reason === 'auto_pool')
|
|
@@ -228,13 +241,20 @@ export function resolveRoleModel(input) {
|
|
|
228
241
|
const chosen = ordered[0];
|
|
229
242
|
if (!chosen)
|
|
230
243
|
return fail(input, 'empty');
|
|
231
|
-
const
|
|
244
|
+
const parameters = routingParameters(layer.setting, input.routing.tiers);
|
|
245
|
+
const requestedEffort = parameters.reasoningEffort;
|
|
232
246
|
if (requestedEffort !== undefined && !chosen.reasoningEffortLevels?.includes(requestedEffort))
|
|
233
247
|
return fail(input, 'reasoning');
|
|
248
|
+
if (parameters.fastMode && chosen.supportsFastMode !== true)
|
|
249
|
+
return fail(input, 'fast_mode');
|
|
234
250
|
const source = layer.setting.mode === 'auto' ? 'auto' : layer.source;
|
|
235
251
|
return {
|
|
236
252
|
ok: true,
|
|
237
|
-
selection: {
|
|
253
|
+
selection: {
|
|
254
|
+
...toSelection(chosen),
|
|
255
|
+
...(requestedEffort !== undefined ? { reasoningEffort: requestedEffort } : {}),
|
|
256
|
+
fastMode: parameters.fastMode,
|
|
257
|
+
},
|
|
238
258
|
source,
|
|
239
259
|
...(input.role === 'verifier'
|
|
240
260
|
? { sameFamilyAsWorker: sameFamily(chosen, input.workerModel) }
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { ResourceFeedback } from './resource-feedback.ts';
|
|
2
|
+
import type { ProjectInputAttachment, ProjectAgentSubmitInputResult } from './delegation.ts';
|
|
3
|
+
export type LocalInputSurface = 'desktop' | 'quick_chat' | 'tui';
|
|
4
|
+
export interface InputDraftQuote {
|
|
5
|
+
readonly messageId: string;
|
|
6
|
+
readonly text: string;
|
|
7
|
+
}
|
|
8
|
+
export interface InputDraftValue {
|
|
9
|
+
readonly text: string;
|
|
10
|
+
readonly quote: InputDraftQuote | null;
|
|
11
|
+
readonly attachments: readonly ProjectInputAttachment[];
|
|
12
|
+
readonly resourceFeedback?: readonly ResourceFeedback[];
|
|
13
|
+
}
|
|
14
|
+
/** User intent only. Presence here never means the input was received or executed. */
|
|
15
|
+
export interface UnconfirmedProjectInput {
|
|
16
|
+
readonly inputId: string;
|
|
17
|
+
readonly text: string;
|
|
18
|
+
readonly quoteRefs: readonly string[];
|
|
19
|
+
readonly answerTo?: string;
|
|
20
|
+
readonly attachments: readonly ProjectInputAttachment[];
|
|
21
|
+
readonly resourceFeedback?: readonly ResourceFeedback[];
|
|
22
|
+
readonly createdAt: string;
|
|
23
|
+
}
|
|
24
|
+
export interface ProjectInputDraftSnapshot {
|
|
25
|
+
readonly revision: number;
|
|
26
|
+
readonly draft: InputDraftValue;
|
|
27
|
+
readonly pending: readonly UnconfirmedProjectInput[];
|
|
28
|
+
}
|
|
29
|
+
export interface ProjectInputDraftReadRequest {
|
|
30
|
+
readonly workspaceId: string;
|
|
31
|
+
readonly surface: LocalInputSurface;
|
|
32
|
+
}
|
|
33
|
+
export type ProjectInputDraftReadResult = {
|
|
34
|
+
readonly ok: true;
|
|
35
|
+
readonly snapshot: ProjectInputDraftSnapshot;
|
|
36
|
+
} | {
|
|
37
|
+
readonly ok: false;
|
|
38
|
+
readonly code: string;
|
|
39
|
+
};
|
|
40
|
+
export interface ProjectInputDraftWriteRequest extends ProjectInputDraftReadRequest {
|
|
41
|
+
readonly revision: number;
|
|
42
|
+
readonly draft: Omit<InputDraftValue, 'attachments'> & {
|
|
43
|
+
readonly attachmentIds: readonly string[];
|
|
44
|
+
};
|
|
45
|
+
readonly pending: readonly (Omit<UnconfirmedProjectInput, 'attachments'> & {
|
|
46
|
+
readonly attachmentIds: readonly string[];
|
|
47
|
+
})[];
|
|
48
|
+
/** Already-stored attachments are referred to by ID; large bytes are sent only once. */
|
|
49
|
+
readonly uploads: readonly ProjectInputAttachment[];
|
|
50
|
+
}
|
|
51
|
+
export type ProjectInputDraftWriteResult = {
|
|
52
|
+
readonly ok: true;
|
|
53
|
+
readonly revision: number;
|
|
54
|
+
} | {
|
|
55
|
+
readonly ok: false;
|
|
56
|
+
readonly code: string;
|
|
57
|
+
};
|
|
58
|
+
export interface ProjectInputRecoveryPort {
|
|
59
|
+
read(request: ProjectInputDraftReadRequest): Promise<ProjectInputDraftReadResult>;
|
|
60
|
+
write(request: ProjectInputDraftWriteRequest): Promise<ProjectInputDraftWriteResult>;
|
|
61
|
+
submit(request: UnconfirmedProjectInput & ProjectInputDraftReadRequest): Promise<ProjectAgentSubmitInputResult>;
|
|
62
|
+
}
|
|
63
|
+
export declare function emptyInputDraft(): InputDraftValue;
|
|
64
|
+
/** A handoff failure may follow a durable receipt. Generic ok alone proves nothing. */
|
|
65
|
+
export declare function projectInputWasReceived(result: ProjectAgentSubmitInputResult | null | undefined, workspaceId: string, inputId: string): boolean;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export function emptyInputDraft() { return { text: '', quote: null, attachments: [] }; }
|
|
2
|
+
/** A handoff failure may follow a durable receipt. Generic ok alone proves nothing. */
|
|
3
|
+
export function projectInputWasReceived(result, workspaceId, inputId) {
|
|
4
|
+
return result?.input?.workspaceId === workspaceId && result.input.inputId === inputId;
|
|
5
|
+
}
|
package/dist/project.d.ts
CHANGED
|
@@ -219,9 +219,13 @@ export interface ProjectAgentPublicUpdate {
|
|
|
219
219
|
}
|
|
220
220
|
/** Ephemeral interactive-turn presentation, including explicit wake retries. No hidden reasoning or Evidence. */
|
|
221
221
|
export interface ProjectAgentActivity {
|
|
222
|
+
/** Same-turn successful local file results only; navigation hints never grant access. */
|
|
223
|
+
readonly resourceReferences?: readonly import('./document-reference.ts').BotResourceReferenceHint[];
|
|
222
224
|
readonly workspaceId: string;
|
|
223
225
|
readonly conversationId: string;
|
|
224
226
|
readonly turnId: string;
|
|
227
|
+
/** Existing coordination identity; several execution attempts may serve one reply. */
|
|
228
|
+
readonly workId?: string;
|
|
225
229
|
readonly revision: number;
|
|
226
230
|
readonly startedAt: string;
|
|
227
231
|
readonly finishedAt?: string;
|
|
@@ -229,6 +233,8 @@ export interface ProjectAgentActivity {
|
|
|
229
233
|
readonly replyTo: readonly string[];
|
|
230
234
|
readonly phase: 'waiting' | 'thinking' | 'responding' | 'tool' | 'awaiting_permission' | 'settling' | 'done' | 'error' | 'stopped' | 'disposed';
|
|
231
235
|
readonly replyText: string;
|
|
236
|
+
/** A factual recovery event, cleared when the next provider event arrives. */
|
|
237
|
+
readonly recovery?: 'connection' | 'provider';
|
|
232
238
|
readonly segments: readonly (({
|
|
233
239
|
readonly kind: 'text';
|
|
234
240
|
} & ProjectAgentPublicUpdate) | ProjectAgentToolActivity)[];
|