@ftai/plugin-host-api 2.0.0 → 2.3.0
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/lib/attachments.d.ts +112 -1
- package/lib/capabilities.d.ts +99 -0
- package/lib/capabilities.js +21 -0
- package/lib/cmdline.d.ts +52 -0
- package/lib/cmdline.js +68 -0
- package/lib/credentials.d.ts +92 -0
- package/lib/credentials.js +41 -0
- package/lib/fs.d.ts +69 -5
- package/lib/generated.d.ts +3935 -316
- package/lib/generated.js +66 -6
- package/lib/index.d.ts +365 -69
- package/lib/index.js +44 -3
- package/lib/jobs.d.ts +88 -0
- package/lib/jobs.js +2 -0
- package/lib/llm.d.ts +124 -21
- package/lib/llm.js +45 -3
- package/lib/local-install.d.ts +38 -0
- package/lib/local-install.js +9 -0
- package/lib/permissions.d.ts +97 -0
- package/lib/permissions.js +11 -0
- package/lib/platform.d.ts +167 -0
- package/lib/platform.js +74 -0
- package/lib/porting.d.ts +23 -7
- package/lib/porting.js +692 -67
- package/lib/prompt.d.ts +117 -0
- package/lib/prompt.js +43 -0
- package/lib/runtime-context.d.ts +29 -0
- package/lib/runtime-context.js +6 -0
- package/lib/schedule-types.d.ts +333 -0
- package/lib/schedule-types.js +4 -0
- package/lib/session-events.d.ts +194 -0
- package/lib/session-events.js +2 -0
- package/lib/sessions.d.ts +246 -0
- package/lib/sessions.js +2 -0
- package/lib/settings.d.ts +86 -0
- package/lib/settings.js +13 -0
- package/lib/storage.d.ts +144 -0
- package/lib/storage.js +62 -0
- package/lib/subagents.d.ts +57 -0
- package/lib/subagents.js +17 -0
- package/lib/subprocess.d.ts +97 -0
- package/lib/subprocess.js +8 -0
- package/lib/tools.d.ts +212 -0
- package/lib/tools.js +2 -0
- package/lib/web.d.ts +192 -0
- package/lib/web.js +53 -0
- package/package.json +1 -1
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 工作区登记、Goal、已安排的任务与压缩(0.12 的 `ctx.workspaceRegistry`、`ctx.goals`、`ctx.schedule`、`ctx.compaction`),名字与参数顺序
|
|
3
|
+
* 照 0.12,与界面走同一条路径。形状变化见移植指南的对照表,共同的三点:
|
|
4
|
+
*
|
|
5
|
+
* - 全部是异步的(跨进程);
|
|
6
|
+
* - 0.12 收 agent 句柄的参数,这里收会话 id(`sessionId`),可以操作任意会话;
|
|
7
|
+
* - 工作目录(`ctx.workingDirectory`)没有另包一层,类型在 generated.ts。
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import type { CompactionResult, CompactionTrigger, GoalBlockReason, GoalChange, GoalCreateRequest, GoalEditRequest, GoalRef, GoalView, SessionActivity, Workspace } from './generated.ts';
|
|
11
|
+
import type { ScheduleCatalogEntry, ScheduleCreateRequest, ScheduleDeleteResult, ScheduleDeliveryHistoryRequest, ScheduleDeliveryHistoryResult, ScheduleRecord, ScheduleTaskRequest, ScheduleUpdateRequest, ScheduleUpdateResult } from './schedule-types.ts';
|
|
12
|
+
export type * from './schedule-types.ts';
|
|
13
|
+
/** 就是字符串:0.12 的品牌类型。 */
|
|
14
|
+
export type GoalId = string;
|
|
15
|
+
/** 就是字符串:0.12 的品牌类型。 */
|
|
16
|
+
export type ScheduleId = string;
|
|
17
|
+
/** 没有这个会话时报 `session/not-found` 的两个操作(同 0.12)。 */
|
|
18
|
+
export declare class WorkspaceUnknownSessionError extends Error {
|
|
19
|
+
readonly sessionId: string;
|
|
20
|
+
constructor(sessionId: string, verb: 'archive' | 'pin', options?: ErrorOptions);
|
|
21
|
+
}
|
|
22
|
+
/** 不带 `stopActivity` 归档时会话还有工作:什么都没写,`activity` 列出要先停下的(同 0.12)。 */
|
|
23
|
+
export declare class WorkspaceActiveSessionError extends Error {
|
|
24
|
+
readonly sessionId: string;
|
|
25
|
+
readonly activity: readonly SessionActivity[];
|
|
26
|
+
constructor(sessionId: string, activity: readonly SessionActivity[]);
|
|
27
|
+
}
|
|
28
|
+
/** 置顶已归档的会话(同 0.12):置顶与归档互斥。 */
|
|
29
|
+
export declare class WorkspaceArchivedSessionPinError extends Error {
|
|
30
|
+
readonly sessionId: string;
|
|
31
|
+
constructor(sessionId: string, options?: ErrorOptions);
|
|
32
|
+
}
|
|
33
|
+
/** 排序时工作区或锚点不在登记里(同 0.12)。 */
|
|
34
|
+
export declare class WorkspaceOrderInvalidError extends Error {
|
|
35
|
+
readonly workspaceId: string;
|
|
36
|
+
constructor(workspaceId: string, options?: ErrorOptions);
|
|
37
|
+
}
|
|
38
|
+
export interface ArchiveSessionOptions {
|
|
39
|
+
/** 先写归档,再请各方停下这个会话的工作(`workspace/session-stop`);不带时会话有工作就拒绝。 */
|
|
40
|
+
readonly stopActivity?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/** 工作区登记。工作区是读到那一刻的数据,不是 0.12 的活对象。 */
|
|
43
|
+
export interface WorkspaceRegistry {
|
|
44
|
+
/**
|
|
45
|
+
* 为已有的目录登记工作区,或取回已登记的同一目录(按真实路径)。
|
|
46
|
+
* @param title 只在新建时用,不给时取目录名。
|
|
47
|
+
*/
|
|
48
|
+
create(path: string, title?: string): Promise<Workspace>;
|
|
49
|
+
get(id: string): Promise<Workspace | undefined>;
|
|
50
|
+
/** 按显示顺序。 */
|
|
51
|
+
list(): Promise<Workspace[]>;
|
|
52
|
+
/** 撤销登记,目录与会话日志都不动;不认识的 id 返回 false。 */
|
|
53
|
+
delete(id: string): Promise<boolean>;
|
|
54
|
+
/**
|
|
55
|
+
* 在显示顺序里移动:给了锚点就放到它前面,不给就放到最后。
|
|
56
|
+
* @returns 整个顺序。
|
|
57
|
+
* @throws {WorkspaceOrderInvalidError} 没有这个工作区或锚点。
|
|
58
|
+
*/
|
|
59
|
+
insertBefore(id: string, before?: string): Promise<readonly string[]>;
|
|
60
|
+
/**
|
|
61
|
+
* 归档,同时取消置顶。已归档的直接返回。
|
|
62
|
+
* @throws {WorkspaceActiveSessionError} 不带 `stopActivity` 而会话有工作。
|
|
63
|
+
* @throws {WorkspaceUnknownSessionError} 没有这个会话。
|
|
64
|
+
*/
|
|
65
|
+
archiveSession(sessionId: string, options?: ArchiveSessionOptions): Promise<void>;
|
|
66
|
+
unarchiveSession(sessionId: string): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* 置顶,排到最前。已置顶的直接返回。
|
|
69
|
+
* @throws {WorkspaceArchivedSessionPinError} 会话已归档。
|
|
70
|
+
* @throws {WorkspaceUnknownSessionError} 没有这个会话。
|
|
71
|
+
*/
|
|
72
|
+
pinSession(sessionId: string): Promise<void>;
|
|
73
|
+
unpinSession(sessionId: string): Promise<void>;
|
|
74
|
+
/** 按真实路径找工作区,不写登记。路径不存在时报错,目录没有登记时为 undefined。 */
|
|
75
|
+
resolveByPath(path: string): Promise<Workspace | undefined>;
|
|
76
|
+
/** 归档集,按归档的先后(0.12 是同步的属性)。 */
|
|
77
|
+
archivedSessionIds(): Promise<readonly string[]>;
|
|
78
|
+
/** 置顶集,最近置顶的在前(0.12 是同步的属性)。 */
|
|
79
|
+
pinnedSessionIds(): Promise<readonly string[]>;
|
|
80
|
+
}
|
|
81
|
+
export declare const GOAL_ERROR_CODES: readonly ["GOAL_AGENT_NOT_LIVE", "GOAL_NOT_FOUND", "GOAL_ALREADY_EXISTS", "GOAL_STALE_REVISION", "GOAL_INVALID_OBJECTIVE", "GOAL_INVALID_MAX_ROUNDS", "GOAL_INVALID_BLOCK_REASON", "GOAL_INVALID_EDIT", "GOAL_INVALID_TRANSITION"];
|
|
82
|
+
export type GoalErrorCode = typeof GOAL_ERROR_CODES[number];
|
|
83
|
+
/** 读写 Goal 被拒绝(同 0.12)。日志里的 Goal 记录不合规则、会话写不了时是普通的 Error。 */
|
|
84
|
+
export declare class GoalError extends Error {
|
|
85
|
+
readonly code: GoalErrorCode;
|
|
86
|
+
constructor(message: string, code: GoalErrorCode, options?: ErrorOptions);
|
|
87
|
+
}
|
|
88
|
+
/** 变更的种类(0.12 的 `GoalOperation`)。 */
|
|
89
|
+
export type GoalOperation = GoalChange['operation'];
|
|
90
|
+
/** 会话的 Goal。写操作按 id 与修订号比较并交换,过期的修订报 `GOAL_STALE_REVISION`。 */
|
|
91
|
+
export interface GoalService {
|
|
92
|
+
/** 当前的 Goal;没有 Goal 或没有这个会话时为 undefined。 */
|
|
93
|
+
get(sessionId: string): Promise<GoalView | undefined>;
|
|
94
|
+
/** 创建并激活,会话空闲时随即开始第一轮(同界面)。不给 `maxGoalRounds` 时上限是 256 轮。子 agent 的会话拒绝。 */
|
|
95
|
+
create(sessionId: string, request: GoalCreateRequest): Promise<GoalView>;
|
|
96
|
+
/** 改目标和(或)轮数上限,阶段不变。 */
|
|
97
|
+
edit(sessionId: string, ref: GoalRef, request: GoalEditRequest): Promise<GoalView>;
|
|
98
|
+
/** 暂停并解除激活,停下正在跑的这一轮(同界面;0.12 的服务不停,由调用方停)。 */
|
|
99
|
+
pause(sessionId: string, ref: GoalRef): Promise<GoalView>;
|
|
100
|
+
/** 继续暂停或受阻的 Goal,或重新激活进行中但未激活的,会话空闲时随即开始下一轮。 */
|
|
101
|
+
resume(sessionId: string, ref: GoalRef): Promise<GoalView>;
|
|
102
|
+
complete(sessionId: string, ref: GoalRef): Promise<GoalView>;
|
|
103
|
+
block(sessionId: string, ref: GoalRef, reason: GoalBlockReason): Promise<GoalView>;
|
|
104
|
+
/** 清除,留下标记。返回的修订号比清除的那个大一。 */
|
|
105
|
+
clear(sessionId: string, ref: GoalRef): Promise<GoalRef>;
|
|
106
|
+
/** 只解除激活,不改阶段与修订,排着的一轮撤下。没有当前的 Goal 时为 undefined。 */
|
|
107
|
+
disarm(sessionId: string): Promise<GoalView | undefined>;
|
|
108
|
+
}
|
|
109
|
+
export declare const SCHEDULE_INPUT_ERROR_CODES: readonly ["invalid_prompt", "invalid_selector", "invalid_rule", "invalid_time_zone", "not_future", "time_out_of_range", "frequency_too_high", "subagent_session"];
|
|
110
|
+
export type ScheduleInputErrorCode = typeof SCHEDULE_INPUT_ERROR_CODES[number];
|
|
111
|
+
/** 任务的规则或目标会话不合规(同 0.12)。 */
|
|
112
|
+
export declare class ScheduleInputError extends Error {
|
|
113
|
+
readonly code: ScheduleInputErrorCode;
|
|
114
|
+
constructor(code: ScheduleInputErrorCode, message: string, options?: ErrorOptions);
|
|
115
|
+
}
|
|
116
|
+
/** 删除的请求(0.12 的 `ScheduleDeleteRequest`)。 */
|
|
117
|
+
export type ScheduleDeleteRequest = ScheduleTaskRequest;
|
|
118
|
+
/** 已安排的任务:宿主级的,可以往任意会话排,都不打开会话。 */
|
|
119
|
+
export interface ScheduleService {
|
|
120
|
+
/**
|
|
121
|
+
* 建一个绑定到会话的任务。
|
|
122
|
+
* @throws {ScheduleInputError} 规则不合规,或会话是子 agent 的(投递永远到不了)。
|
|
123
|
+
*/
|
|
124
|
+
create(sessionId: string, request: ScheduleCreateRequest, signal?: AbortSignal): Promise<ScheduleRecord>;
|
|
125
|
+
/** 会话里进行中的任务,按存储顺序。 */
|
|
126
|
+
list(request: {
|
|
127
|
+
readonly sessionId: string;
|
|
128
|
+
}): Promise<ScheduleRecord[]>;
|
|
129
|
+
/** 全部会话的任务(各种状态,比 0.12 多 `paused`),按下一次的时刻、再按 id 排序。 */
|
|
130
|
+
catalog(): Promise<ScheduleCatalogEntry[]>;
|
|
131
|
+
/** 发送记录的一页,从新到旧;找不到任务或游标时是带 `code` 的结果。 */
|
|
132
|
+
history(request: ScheduleDeliveryHistoryRequest): Promise<ScheduleDeliveryHistoryResult>;
|
|
133
|
+
/** 删除一个任务,已经排进会话的消息不动;找不到时 `deleted` 为 false。 */
|
|
134
|
+
delete(request: ScheduleDeleteRequest, signal?: AbortSignal): Promise<ScheduleDeleteResult>;
|
|
135
|
+
/** 先核对再修改;不合规、找不到或冲突时是不改动的结果,不抛错。 */
|
|
136
|
+
update(request: ScheduleUpdateRequest, signal?: AbortSignal): Promise<ScheduleUpdateResult>;
|
|
137
|
+
}
|
|
138
|
+
export declare const MANUAL_COMPACTION_ERROR_CODES: readonly ["busy", "cancelled", "changed", "summary", "commit", "persistence"];
|
|
139
|
+
export type ManualCompactionErrorCode = typeof MANUAL_COMPACTION_ERROR_CODES[number];
|
|
140
|
+
/** 压缩没做成(同 0.12)。宿主记事件时同步落盘,不会有 `persistence`。 */
|
|
141
|
+
export declare class ManualCompactionError extends Error {
|
|
142
|
+
readonly code: ManualCompactionErrorCode;
|
|
143
|
+
constructor(code: ManualCompactionErrorCode, message: string, options?: ErrorOptions);
|
|
144
|
+
}
|
|
145
|
+
/** 上下文压缩。`signal` 中止时抛它的原因;已经开始的压缩收到取消,在日志里照常收尾。 */
|
|
146
|
+
export interface CompactionService {
|
|
147
|
+
/**
|
|
148
|
+
* 会话空闲时压缩一次,阈值以下也压。期间的发送排进队列,结束后接着跑。
|
|
149
|
+
* @param sourceCommandId 记进压缩事件;这里不写命令事件。
|
|
150
|
+
* @returns 没有可压的历史时为 null。
|
|
151
|
+
* @throws {ManualCompactionError} 会话不空闲是 `busy`。
|
|
152
|
+
*/
|
|
153
|
+
compactNow(sessionId: string, signal?: AbortSignal, sourceCommandId?: string): Promise<CompactionResult | null>;
|
|
154
|
+
/**
|
|
155
|
+
* 按触发原因判断要不要压缩。真的要摘要时要在进行中的一轮里(如 `agent/pre-step` 的监听者),否则以 `summary` 失败。
|
|
156
|
+
* @returns 没有压缩时为 null。
|
|
157
|
+
*/
|
|
158
|
+
compactIfNeeded(sessionId: string, trigger: CompactionTrigger, signal?: AbortSignal): Promise<CompactionResult | null>;
|
|
159
|
+
}
|
|
160
|
+
declare module 'cordis' {
|
|
161
|
+
interface Context {
|
|
162
|
+
workspaceRegistry: WorkspaceRegistry;
|
|
163
|
+
goals: GoalService;
|
|
164
|
+
schedule: ScheduleService;
|
|
165
|
+
compaction: CompactionService;
|
|
166
|
+
}
|
|
167
|
+
}
|
package/lib/platform.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/** 没有这个会话时报 `session/not-found` 的两个操作(同 0.12)。 */
|
|
2
|
+
export class WorkspaceUnknownSessionError extends Error {
|
|
3
|
+
sessionId;
|
|
4
|
+
constructor(sessionId, verb, options) {
|
|
5
|
+
super(`cannot ${verb} session '${sessionId}': live sessions and session persistence hold no such session`, options);
|
|
6
|
+
this.sessionId = sessionId;
|
|
7
|
+
this.name = 'WorkspaceUnknownSessionError';
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
/** 不带 `stopActivity` 归档时会话还有工作:什么都没写,`activity` 列出要先停下的(同 0.12)。 */
|
|
11
|
+
export class WorkspaceActiveSessionError extends Error {
|
|
12
|
+
sessionId;
|
|
13
|
+
activity;
|
|
14
|
+
constructor(sessionId, activity) {
|
|
15
|
+
super(`cannot archive session '${sessionId}': the session is active (${activity.map((entry) => entry.kind).join(', ')})`);
|
|
16
|
+
this.sessionId = sessionId;
|
|
17
|
+
this.activity = activity;
|
|
18
|
+
this.name = 'WorkspaceActiveSessionError';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/** 置顶已归档的会话(同 0.12):置顶与归档互斥。 */
|
|
22
|
+
export class WorkspaceArchivedSessionPinError extends Error {
|
|
23
|
+
sessionId;
|
|
24
|
+
constructor(sessionId, options) {
|
|
25
|
+
super(`cannot pin session '${sessionId}': the session is archived`, options);
|
|
26
|
+
this.sessionId = sessionId;
|
|
27
|
+
this.name = 'WorkspaceArchivedSessionPinError';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/** 排序时工作区或锚点不在登记里(同 0.12)。 */
|
|
31
|
+
export class WorkspaceOrderInvalidError extends Error {
|
|
32
|
+
workspaceId;
|
|
33
|
+
constructor(workspaceId, options) {
|
|
34
|
+
super(`cannot reorder unknown workspace '${workspaceId}'`, options);
|
|
35
|
+
this.workspaceId = workspaceId;
|
|
36
|
+
this.name = 'WorkspaceOrderInvalidError';
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export const GOAL_ERROR_CODES = [
|
|
40
|
+
'GOAL_AGENT_NOT_LIVE', 'GOAL_NOT_FOUND', 'GOAL_ALREADY_EXISTS', 'GOAL_STALE_REVISION', 'GOAL_INVALID_OBJECTIVE', 'GOAL_INVALID_MAX_ROUNDS',
|
|
41
|
+
'GOAL_INVALID_BLOCK_REASON', 'GOAL_INVALID_EDIT', 'GOAL_INVALID_TRANSITION',
|
|
42
|
+
];
|
|
43
|
+
/** 读写 Goal 被拒绝(同 0.12)。日志里的 Goal 记录不合规则、会话写不了时是普通的 Error。 */
|
|
44
|
+
export class GoalError extends Error {
|
|
45
|
+
code;
|
|
46
|
+
constructor(message, code, options) {
|
|
47
|
+
super(message, options);
|
|
48
|
+
this.code = code;
|
|
49
|
+
this.name = 'GoalError';
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export const SCHEDULE_INPUT_ERROR_CODES = [
|
|
53
|
+
'invalid_prompt', 'invalid_selector', 'invalid_rule', 'invalid_time_zone', 'not_future', 'time_out_of_range', 'frequency_too_high', 'subagent_session',
|
|
54
|
+
];
|
|
55
|
+
/** 任务的规则或目标会话不合规(同 0.12)。 */
|
|
56
|
+
export class ScheduleInputError extends Error {
|
|
57
|
+
code;
|
|
58
|
+
constructor(code, message, options) {
|
|
59
|
+
super(message, options);
|
|
60
|
+
this.code = code;
|
|
61
|
+
this.name = 'ScheduleInputError';
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
export const MANUAL_COMPACTION_ERROR_CODES = ['busy', 'cancelled', 'changed', 'summary', 'commit', 'persistence'];
|
|
65
|
+
/** 压缩没做成(同 0.12)。宿主记事件时同步落盘,不会有 `persistence`。 */
|
|
66
|
+
export class ManualCompactionError extends Error {
|
|
67
|
+
code;
|
|
68
|
+
constructor(code, message, options) {
|
|
69
|
+
super(message, options);
|
|
70
|
+
this.code = code;
|
|
71
|
+
this.name = 'ManualCompactionError';
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=platform.js.map
|
package/lib/porting.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 对照表:0.12 写法(0.12 插件契约)的每项服务、扩展点与常用函数在 SDK 2.
|
|
2
|
+
* 对照表:0.12 写法(0.12 插件契约)的每项服务、扩展点与常用函数在 SDK 2.x 里的对应(docs/rust-host/architecture.md
|
|
3
3
|
* 「移植路径」)。插件契约文档里的对照表、codemod 的改写与插件运行时加载失败的提示都取自这里。
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* 覆盖面由测试守住(tests/porting-table.test.ts):0.12 宿主的 255 项核心接口(tests/fixtures/dsh-core-surface.json,补齐的
|
|
6
|
+
* 方案与阶段见 docs/rust-host/plugin-parity.md)、0.12 契约的 17 项服务、现有 TS 插件与 0.12 模板用到的全部 0.12 导出、服务、
|
|
7
|
+
* 成员与扩展点都要有一行;写着 SDK 对应名字的行,SDK 里要真有这个导出。
|
|
8
|
+
*
|
|
9
|
+
* 0.12 是 dsh 0.2.1-alpha.2,表以它为准;也覆盖第三方插件实际依赖的 dsh 0.1.0-rc.7 到 0.2.2-rc.1(docs/rust-host/dsh-porting-plan.md
|
|
10
|
+
* 的 A5):形状与 0.12 不同的在说明里按版本写明(「dsh 0.2.2-rc.1 起…」),只在别的版本里有的服务也各有一行
|
|
11
|
+
* (tests/fixtures/dsh-services-versions.json)。
|
|
7
12
|
*
|
|
8
13
|
* 表里的 `@deepseek-ai/*` 是 0.12 插件里写的旧包名,仓库已不依赖这些包:留着是为了给按 0.12 写的第三方插件指出对应,
|
|
9
14
|
* codemod 也要按它们认出要改写的引用。
|
|
@@ -11,24 +16,35 @@
|
|
|
11
16
|
*/
|
|
12
17
|
/**
|
|
13
18
|
* - `same`:同名同形,换 import 即可(codemod 自动改);
|
|
14
|
-
* - `changed`:形状有变,`note` 写改法(codemod 只插 TODO
|
|
19
|
+
* - `changed`:形状有变,`note` 写改法(codemod 只插 TODO,不改写;标了 `awaited`、`brand` 或名字不同的除外);
|
|
15
20
|
* - `removed`:不再提供,`note` 写替代;
|
|
16
|
-
* - `pending`:宿主还没有提供,`note`
|
|
21
|
+
* - `pending`:宿主还没有提供,`note` 写由哪个阶段提供(plugin-parity.md);在此之前用到这项服务的插件加载失败。
|
|
17
22
|
*/
|
|
18
23
|
export type PortingStatus = 'same' | 'changed' | 'removed' | 'pending';
|
|
19
24
|
export interface PortingEntry {
|
|
20
25
|
/**
|
|
21
26
|
* 0.12 一侧:服务写成 `ctx.<服务名>`,服务的成员写成 `ctx.<服务名>.<成员>`,扩展点写成它的名字(如 `tools/pre-execute`),
|
|
22
|
-
* 包的导出写成 `<包名>#<导出名>`(默认导出写成 `<包名>#default
|
|
27
|
+
* 包的导出写成 `<包名>#<导出名>`(默认导出写成 `<包名>#default`),类型上的成员写成 `<包名>#<类型>.<成员>`(如
|
|
28
|
+
* `@deepseek-ai/dsh-agent#Agent.cancel`),插件清单与入口的配置写成它的名字。
|
|
23
29
|
*/
|
|
24
30
|
readonly legacy: string;
|
|
25
31
|
readonly status: PortingStatus;
|
|
26
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* SDK 一侧的对应:`@ftai/plugin-sdk/host#<导出名>`、`ctx.<服务名>`、`cordis#<导出名>` 或扩展点名;没有时不写。
|
|
34
|
+
* 导出名与 0.12 不同时,codemod 连引用一起改名。
|
|
35
|
+
*/
|
|
27
36
|
readonly sdk?: string;
|
|
28
37
|
/** 改法、替代或由谁提供;同名同形时可以不写。 */
|
|
29
38
|
readonly note?: string;
|
|
30
39
|
/** 形状有变,但照 0.12 写的用法多数不用改(如载荷换成句柄、用法不变):codemod 不在用到它的地方插 TODO。 */
|
|
31
40
|
readonly todo?: false;
|
|
41
|
+
/**
|
|
42
|
+
* 同步读取跨进程后变成 Promise,codemod 自动加 `await`,所在函数改成 async;加不了的地方(顶层、构造函数、数组方法的回调等)
|
|
43
|
+
* 照旧插 TODO。`call` 是调用的结果,`read` 是读属性的结果。
|
|
44
|
+
*/
|
|
45
|
+
readonly awaited?: 'call' | 'read';
|
|
46
|
+
/** 0.12 的品牌类型:值是包装函数,SDK 里就是字符串。codemod 去掉 `X(...)` 包装,import 改成只引类型。 */
|
|
47
|
+
readonly brand?: true;
|
|
32
48
|
}
|
|
33
49
|
export declare const PORTING_TABLE: readonly PortingEntry[];
|
|
34
50
|
/** 按 0.12 一侧的名字查一行。 */
|