@peer-agent/protocol 0.1.0-rc.45 → 0.1.0-rc.46

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.
@@ -89,6 +89,8 @@ export interface WorkSessionConversationMeta extends SessionQueueFacts {
89
89
  readonly conversationId?: string;
90
90
  readonly workspaceId: string;
91
91
  readonly spawnedAt?: string;
92
+ readonly startedAt?: string;
93
+ readonly endedAt?: string;
92
94
  readonly origin: DelegationOrigin;
93
95
  readonly supersededBy?: string;
94
96
  readonly acceptance?: 'auto' | 'confirm';
@@ -121,6 +123,8 @@ export interface WorkSession extends SessionQueueFacts {
121
123
  readonly cancelable?: boolean;
122
124
  readonly needsYouReason?: TaskOverviewItem['needsYouReason'];
123
125
  readonly spawnedAt: string;
126
+ readonly startedAt?: string;
127
+ readonly endedAt?: string;
124
128
  readonly conversationId?: string;
125
129
  readonly origin: DelegationOrigin;
126
130
  readonly supersededBy?: string;
@@ -95,6 +95,8 @@ export function projectWorkSession(plan, conversationMeta) {
95
95
  ...(projected.needsYouReason ? { needsYouReason: projected.needsYouReason } : {}),
96
96
  ...(conversationMeta.coordination ? { coordination: conversationMeta.coordination } : {}),
97
97
  spawnedAt: conversationMeta.spawnedAt ?? plan.updatedAt ?? '',
98
+ ...(conversationMeta.startedAt ? { startedAt: conversationMeta.startedAt } : {}),
99
+ ...(conversationMeta.endedAt ? { endedAt: conversationMeta.endedAt } : {}),
98
100
  ...(conversationMeta.conversationId ? { conversationId: conversationMeta.conversationId } : {}),
99
101
  origin: conversationMeta.origin,
100
102
  ...(conversationMeta.resourceBlocker ? { resourceBlocker: conversationMeta.resourceBlocker } : {}),
package/dist/index.d.ts CHANGED
@@ -936,3 +936,4 @@ export * from './interactive-verification.ts';
936
936
  export { normalizeConversationExecution, conversationExecutionPermitsNewRun } from './conversation-execution.ts';
937
937
  export type { ConversationExecutionIdentity, ConversationExecution } from './conversation-execution.ts';
938
938
  export * from './quiet-reply.js';
939
+ export type { WorkingPlanStepStatus, WorkingPlanStepView, WorkingPlanView } from './working-plan.ts';
@@ -68,6 +68,16 @@ export interface ProjectInputRecoveryPort {
68
68
  write(request: ProjectInputDraftWriteRequest): Promise<ProjectInputDraftWriteResult>;
69
69
  submit(request: UnconfirmedProjectInput & ProjectInputDraftReadRequest): Promise<ProjectAgentSubmitInputResult>;
70
70
  }
71
+ export type ProjectInputMutationResult = {
72
+ readonly ok: true;
73
+ } | {
74
+ readonly ok: false;
75
+ readonly code: string;
76
+ };
77
+ export declare const DEFINITE_PROJECT_INPUT_REJECTION_CODES: ReadonlySet<string>;
71
78
  export declare function emptyInputDraft(): InputDraftValue;
72
79
  /** A handoff failure may follow a durable receipt. Generic ok alone proves nothing. */
73
80
  export declare function projectInputWasReceived(result: ProjectAgentSubmitInputResult | null | undefined, workspaceId: string, inputId: string): boolean;
81
+ export declare function isDefiniteProjectInputRejectionCode(code: string | null | undefined): boolean;
82
+ /** True only when the host rejected the input before enqueuing it (no durable receipt). */
83
+ export declare function isDefiniteProjectInputRejection(result: ProjectAgentSubmitInputResult | null | undefined, workspaceId: string, inputId: string): boolean;
@@ -1,5 +1,25 @@
1
+ export const DEFINITE_PROJECT_INPUT_REJECTION_CODES = new Set([
2
+ 'QUESTION_CLOSED',
3
+ 'INVALID_INPUT',
4
+ 'INVALID_INPUT_ID',
5
+ 'INVALID_RESOURCE_FEEDBACK',
6
+ 'RESOURCE_FEEDBACK_RECIPIENT_CHANGED',
7
+ 'RESOURCE_FEEDBACK_ATTACHMENT_LIMIT',
8
+ 'INTERACTIVE_FEEDBACK_UNAVAILABLE',
9
+ 'NOT_FOUND',
10
+ 'WORKSPACE_NOT_FOUND',
11
+ ]);
1
12
  export function emptyInputDraft() { return { text: '', quote: null, attachments: [] }; }
2
13
  /** A handoff failure may follow a durable receipt. Generic ok alone proves nothing. */
3
14
  export function projectInputWasReceived(result, workspaceId, inputId) {
4
15
  return result?.input?.workspaceId === workspaceId && result.input.inputId === inputId;
5
16
  }
17
+ export function isDefiniteProjectInputRejectionCode(code) {
18
+ return typeof code === 'string' && DEFINITE_PROJECT_INPUT_REJECTION_CODES.has(code);
19
+ }
20
+ /** True only when the host rejected the input before enqueuing it (no durable receipt). */
21
+ export function isDefiniteProjectInputRejection(result, workspaceId, inputId) {
22
+ if (!result || result.ok || projectInputWasReceived(result, workspaceId, inputId))
23
+ return false;
24
+ return isDefiniteProjectInputRejectionCode(result.code);
25
+ }
package/dist/project.d.ts CHANGED
@@ -302,6 +302,8 @@ export type ProjectAgentStopResponseResult = {
302
302
  readonly code: 'PROJECT_AGENT_DISABLED' | 'NOT_FOUND' | 'HOST_OFFLINE' | 'STALE_TURN' | 'INVALID_INPUT';
303
303
  };
304
304
  export interface BotListSession {
305
+ readonly startedAt?: string;
306
+ readonly endedAt?: string;
305
307
  readonly sessionId?: string;
306
308
  readonly title?: string;
307
309
  readonly status: WorkSessionStatus;
@@ -40,6 +40,39 @@ export interface SkillMarketplaceInstallResult {
40
40
  readonly skillId?: string;
41
41
  readonly error?: string;
42
42
  }
43
+ export interface SkillInstallTarget {
44
+ readonly id: string;
45
+ readonly workspaceId: string;
46
+ readonly name: string;
47
+ readonly path: string;
48
+ readonly kind: 'bot' | 'workspace';
49
+ readonly available: boolean;
50
+ readonly unavailableReason?: string;
51
+ readonly isActive: boolean;
52
+ }
53
+ export interface SkillInstallTargetRequest {
54
+ readonly workspaceId?: string;
55
+ readonly workspacePath?: string;
56
+ }
57
+ export type SkillInstallTargetResult = {
58
+ readonly workspaceId: string | null;
59
+ readonly name: string;
60
+ readonly path: string | null;
61
+ } & ({
62
+ readonly ok: true;
63
+ readonly skillId: string;
64
+ } | {
65
+ readonly ok: false;
66
+ readonly error: string;
67
+ readonly code?: string;
68
+ });
69
+ export interface SkillInstallBatchReceipt {
70
+ readonly partial: boolean;
71
+ readonly succeededCount: number;
72
+ readonly failedCount: number;
73
+ readonly results: readonly SkillInstallTargetResult[];
74
+ }
75
+ export type SkillHubInstallResult = SkillMarketplaceInstallResult & Partial<SkillInstallBatchReceipt>;
43
76
  /**
44
77
  * SkillHub 官方列表排序(GET /api/skills?sortBy=):
45
78
  * - score: 全部 / 综合评分
@@ -106,9 +139,10 @@ export interface SkillHubInstallRequest {
106
139
  readonly namespace: string;
107
140
  readonly slug: string;
108
141
  readonly version: string;
109
- /** 默认 global;workspace 必须同时指定一个由 Desktop 主进程校验的登记工作区。 */
142
+ /** 默认 global。工作区安装使用 targets,旧调用方可传 workspacePath。 */
110
143
  readonly scope?: SkillHubInstallScope;
111
144
  readonly workspacePath?: string;
145
+ readonly targets?: readonly SkillInstallTargetRequest[];
112
146
  /** 市场图标 URL;安装时写入本地 _meta.json,供已安装列表展示。 */
113
147
  readonly iconUrl?: string | null;
114
148
  }
@@ -206,12 +240,13 @@ export interface QoderInstallIdentity {
206
240
  readonly skillId: string;
207
241
  readonly scope?: QoderInstallScope;
208
242
  readonly workspacePath?: string;
243
+ readonly targets?: readonly SkillInstallTargetRequest[];
209
244
  readonly iconUrl?: string | null;
210
245
  }
211
- export interface QoderInstallResult {
246
+ export interface QoderInstallResult extends Partial<SkillInstallBatchReceipt> {
212
247
  readonly ok: boolean;
213
248
  readonly skillId: string;
214
- readonly installedSkillId: string;
215
- readonly version: string;
249
+ readonly installedSkillId?: string;
250
+ readonly version?: string;
216
251
  readonly scope: QoderInstallScope;
217
252
  }
@@ -0,0 +1,18 @@
1
+ export type WorkingPlanStepStatus = 'pending' | 'in_progress' | 'completed' | 'blocked';
2
+ export interface WorkingPlanStepView {
3
+ readonly title: string;
4
+ readonly status: WorkingPlanStepStatus;
5
+ readonly check?: string;
6
+ readonly note?: string;
7
+ }
8
+ export interface WorkingPlanView {
9
+ readonly epoch: number;
10
+ readonly revision: number;
11
+ readonly updatedAt: string;
12
+ readonly summary?: string;
13
+ readonly invariants?: readonly string[];
14
+ readonly completed: number;
15
+ readonly total: number;
16
+ readonly blocked: number;
17
+ readonly steps: readonly WorkingPlanStepView[];
18
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peer-agent/protocol",
3
- "version": "0.1.0-rc.45",
3
+ "version": "0.1.0-rc.46",
4
4
  "description": "Shared host-neutral protocol contracts for Peer Agent runtimes and clients.",
5
5
  "type": "module",
6
6
  "license": "MIT",