@ycodium-ai/plugin-api 0.2.2972 → 0.2.2976

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/README.md +39 -13
  2. package/dist/communication.d.ts +13 -79
  3. package/dist/communication.d.ts.map +1 -1
  4. package/dist/communication.js +1 -10
  5. package/dist/communication.js.map +1 -1
  6. package/dist/conversation.d.ts +15 -1587
  7. package/dist/conversation.d.ts.map +1 -1
  8. package/dist/conversation.js.map +1 -1
  9. package/dist/conversationBase.d.ts +89 -0
  10. package/dist/conversationBase.d.ts.map +1 -0
  11. package/dist/conversationBase.js +2 -0
  12. package/dist/conversationBase.js.map +1 -0
  13. package/dist/conversationComposerApi.d.ts +246 -0
  14. package/dist/conversationComposerApi.d.ts.map +1 -0
  15. package/dist/conversationComposerApi.js +2 -0
  16. package/dist/conversationComposerApi.js.map +1 -0
  17. package/dist/conversationComposerEnvironment.d.ts +71 -0
  18. package/dist/conversationComposerEnvironment.d.ts.map +1 -0
  19. package/dist/conversationComposerEnvironment.js +2 -0
  20. package/dist/conversationComposerEnvironment.js.map +1 -0
  21. package/dist/conversationComposerHandle.d.ts +80 -0
  22. package/dist/conversationComposerHandle.d.ts.map +1 -0
  23. package/dist/conversationComposerHandle.js +2 -0
  24. package/dist/conversationComposerHandle.js.map +1 -0
  25. package/dist/conversationDerive.d.ts +132 -0
  26. package/dist/conversationDerive.d.ts.map +1 -0
  27. package/dist/conversationDerive.js +2 -0
  28. package/dist/conversationDerive.js.map +1 -0
  29. package/dist/conversationDrafts.d.ts +220 -0
  30. package/dist/conversationDrafts.d.ts.map +1 -0
  31. package/dist/conversationDrafts.js +2 -0
  32. package/dist/conversationDrafts.js.map +1 -0
  33. package/dist/conversationHostModels.d.ts +378 -0
  34. package/dist/conversationHostModels.d.ts.map +1 -0
  35. package/dist/conversationHostModels.js +2 -0
  36. package/dist/conversationHostModels.js.map +1 -0
  37. package/dist/conversationRows.d.ts +96 -0
  38. package/dist/conversationRows.d.ts.map +1 -0
  39. package/dist/conversationRows.js +2 -0
  40. package/dist/conversationRows.js.map +1 -0
  41. package/dist/conversationViewProps.d.ts +366 -0
  42. package/dist/conversationViewProps.d.ts.map +1 -0
  43. package/dist/conversationViewProps.js +2 -0
  44. package/dist/conversationViewProps.js.map +1 -0
  45. package/dist/dataPorts.gen.d.ts +548 -0
  46. package/dist/dataPorts.gen.d.ts.map +1 -0
  47. package/dist/dataPorts.gen.js +4 -0
  48. package/dist/dataPorts.gen.js.map +1 -0
  49. package/dist/executor.d.ts +4 -6
  50. package/dist/executor.d.ts.map +1 -1
  51. package/dist/executor.js.map +1 -1
  52. package/dist/executorProcesses.d.ts +38 -0
  53. package/dist/executorProcesses.d.ts.map +1 -0
  54. package/dist/executorProcesses.js +5 -0
  55. package/dist/executorProcesses.js.map +1 -0
  56. package/dist/index.d.ts +16 -35
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +7 -4
  59. package/dist/index.js.map +1 -1
  60. package/dist/pending-requests.d.ts +14 -23
  61. package/dist/pending-requests.d.ts.map +1 -1
  62. package/dist/settings-actions.d.ts +25 -2
  63. package/dist/settings-actions.d.ts.map +1 -1
  64. package/dist/settings-actions.js +0 -6
  65. package/dist/settings-actions.js.map +1 -1
  66. package/dist/settings-ui.d.ts +46 -0
  67. package/dist/settings-ui.d.ts.map +1 -0
  68. package/dist/settings-ui.js +2 -0
  69. package/dist/settings-ui.js.map +1 -0
  70. package/dist/ui.d.ts +1 -0
  71. package/dist/ui.d.ts.map +1 -1
  72. package/dist/ui.js.map +1 -1
  73. package/package.json +1 -1
  74. package/dist/threadList.d.ts +0 -41
  75. package/dist/threadList.d.ts.map +0 -1
  76. package/dist/threadList.js +0 -2
  77. package/dist/threadList.js.map +0 -1
package/README.md CHANGED
@@ -56,7 +56,7 @@ import { definePlugin } from "@ycodium-ai/plugin-api";
56
56
 
57
57
  export default definePlugin({
58
58
  id: "my-plugin",
59
- apiVersion: 4,
59
+ apiVersion: 5,
60
60
  activate: (ctx) => {
61
61
  ctx.log.info("hello");
62
62
 
@@ -230,13 +230,25 @@ shows up there without anyone registering it.
230
230
 
231
231
  ## THERE WILL BE COMPATIBILITY-BREAKING CHANGES
232
232
 
233
- The definition's `apiVersion` is a closed window: the host loads 3 and 4, and refuses every other
233
+ The definition's `apiVersion` is a closed window: the host loads 5, and refuses every other
234
234
  value. Declare the version your plugin targets as a literal; do not read the host's
235
- `PLUGIN_API_VERSION` to make the declaration automatically match. The current API is 4. Plugins
236
- that still declare 3 continue to load. Plugins targeting API 1 or 2 are refused before activation;
237
- the message names the version the plugin declared and the ones this Ycodium loads, and the plugin
238
- card offers an update. A plugin that declares a version newer than 4 is refused until Ycodium
239
- itself is updated, with no update button.
235
+ `PLUGIN_API_VERSION` to make the declaration automatically match. The current API is 5. Plugins
236
+ targeting an older API are refused before activation; the message names the version the plugin
237
+ declared and the one this Ycodium loads, and the plugin card offers an update. A plugin that
238
+ declares a version newer than 5 is refused until Ycodium itself is updated, with no update button.
239
+
240
+ API 5 removed four handwritten data members. Their replacements are assembled from the host's data
241
+ capability table and typed by `PluginDataPorts`: the member path is the capability id, the input is
242
+ checked against the capability's public contract, and the result is the same shape a client reads.
243
+
244
+ | Removed in 5 | Use instead |
245
+ | ------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |
246
+ | `ctx.projections.listThreads(query)` | `ctx.threads.list(input)`: returns `{ items, nextCursor, snapshotSequence }`; `includeArchived` became `archived: "exclude" \| "include" \| "only"` |
247
+ | `ctx.projections.listPendingApprovals(id)` | `ctx.approvals.pending.list({ threadId })`: `detail`, `appName` and `options` are absent when the provider gave none; a missing thread rejects |
248
+ | `ctx.communication.listForThreads(input)` | `ctx.communication.records.list(input)`: same fields; a `limit` outside 1–1000 is refused instead of clamped |
249
+ | `ctx.communication.getByIds(recordIds)` | `ctx.communication.records.get({ recordIds })`: at most 100 ids per call; records carry every field a client reads |
250
+
251
+ `ctx.threads.history(input)` is new in 5: the thread detail a client opens a session with.
240
252
 
241
253
  ### API 4
242
254
 
@@ -272,6 +284,20 @@ your plugin's install, so you only see receipts for commands your plugin dispatc
272
284
  `threadId` may be left out for them; commands on an existing thread still need `threadId` and
273
285
  thread ownership. Both are optional additions, so the API version was not bumped.
274
286
 
287
+ Added within API 4, for a plugin that draws its own settings in the `settings.section` seat. None
288
+ of these bumped the API version.
289
+
290
+ - `presentation: "hidden"` on `ctx.settingsCard`: clients stop drawing the card's form. Keep the
291
+ field declarations: a `kind: "proxy"` field is how the host knows which proxy you use, and
292
+ `password` fields and columns are how it knows which positions are secrets.
293
+ - `clearSecrets` in the options of `ctx.settings.write`: paths whose stored password is removed.
294
+ The host drops the key at each path from the config it writes, whatever you put there. A path
295
+ listed in both `secrets` and `clearSecrets` rejects the write.
296
+ - `bridge.ui.QRCodeSvg` and `bridge.ui.ProxyChoiceSelect`, typed by `QRCodeSvgProps` and
297
+ `ProxyChoiceSelectProps` in `@ycodium-ai/plugin-api/ui`. The proxy select draws the options you
298
+ pass it; get them from `ctx.proxies.list()` in a command of your own. An older host does not
299
+ have them, so check that they exist before rendering.
300
+
275
301
  ### API 3
276
302
 
277
303
  API 3 deletes the host's old usage path and fixes the executor contract that the built-in agents
@@ -308,12 +334,12 @@ Added (all optional unless noted):
308
334
  `placeholderKey`) resolved from the plugin's own `locales/`, and the pure validation helpers
309
335
  are published as `@ycodium-ai/plugin-api/settings-card`.
310
336
  - `ctx.fs.createReadStream(path, { start, end })` reads an inclusive byte range.
311
- - `ctx.communication.listForThreads({ threadIds, since, until, before, limit })` (**required** on the context):
312
- read-only host communication records that have a side in those threads, newest `limit` in time
313
- order, with their three stages. Subscribe to the `communication.record-*` events to re-read.
314
- `ctx.communication.getByIds(recordIds)` (**required** on the context) reads up to
315
- `PLUGIN_COMMUNICATION_MAX_RECORDS` (1000) records by id, skipping unknown ids; stage events name only the owning thread, so read a record back to see
316
- both sides.
337
+ - `ctx.communication.records.list({ threadIds, since, until, before, limit })` (**required** on the
338
+ context): read-only host communication records that have a side in those threads, newest `limit`
339
+ in time order, with their three stages. Subscribe to the `communication.record-*` events to
340
+ re-read. `ctx.communication.records.get({ recordIds })` (**required** on the context) reads up to
341
+ 100 records by id, skipping unknown ids; stage events name only the owning thread, so read a
342
+ record back to see both sides.
317
343
  - Conversation views: tool rows may carry `toolIcon`, and `ConversationHostData.SiteIcon` draws
318
344
  a site icon. Trajectory rows for a sent message carry `communication` (record id, delivery,
319
345
  recipient with its thread title), and `ConversationHostData.useCommunicationRecord` watches
@@ -1,86 +1,20 @@
1
1
  /**
2
- * 宿主通信记录的只读查询(`ctx.communication`)。会话之间、会话与人之间每发一句,宿主记一条
3
- * 记录,带三段状态:落盘、已交给 agent(收件方取件了)、已回。从包根导出。
2
+ * 宿主通信记录的形状。会话之间、会话与人之间每发一句,宿主记一条记录,带三段状态:落盘、已交给 agent
3
+ * (收件方取件了)、已回。从包根导出。
4
4
  *
5
- * 只读:发信走编排工具 `send_message`,插件写不了记录。
5
+ * 读走登记表组装的端口 `ctx.communication.records.get` / `ctx.communication.records.list`(见
6
+ * `PluginDataPorts`);这里的两个名字是它们返回的那份记录。只读:发信走编排工具 `send_message`。
6
7
  *
7
8
  * @module @ycodium-ai/plugin-api/communication
8
9
  */
10
+ import type { CommunicationRecordsGetOutput } from "./dataPorts.gen.ts";
11
+ /**
12
+ * 一条通信记录,与客户端读到的同一份。`delivery`:`quiet` 等收件方下次取件,`wake` 叫醒收件方,`steer` 插进
13
+ * 收件方正在跑的那一轮。`stages.handedOff.certainty`:`confirmed` 是收件方取件了,`not-dispatched` 是还没取,
14
+ * `unknown` 是投递结果不明(不会重投)。`stages.replied` 带 `recordId` 是收件方那条回信,只有 `turnId` 表示
15
+ * 处理它的那一轮结束了。`to` 只有回填的历史团队消息在角色当时没人挂接时才是 null。
16
+ */
17
+ export type PluginCommunicationRecord = CommunicationRecordsGetOutput[number];
9
18
  /** 记录的一方:会话(一个会话就是一个 agent)或人(账号快照)。 */
10
- export type PluginCommunicationParticipant = {
11
- readonly kind: "thread";
12
- /** 缺省 = 记录所在的这台机器;从旧团队信箱回填的历史记录一律缺省。 */
13
- readonly environmentId?: string | undefined;
14
- readonly threadId: string;
15
- } | {
16
- readonly kind: "user";
17
- readonly userId: string;
18
- readonly displayName: string;
19
- };
20
- export interface PluginCommunicationRecord {
21
- readonly recordId: string;
22
- readonly from: PluginCommunicationParticipant;
23
- /** 只有回填的历史团队消息在角色当时没人挂接时才是 null。 */
24
- readonly to: PluginCommunicationParticipant | null;
25
- /** 这条在回哪一条。 */
26
- readonly replyTo: string | null;
27
- readonly text: string;
28
- /** `quiet` 等收件方下次取件;`wake` 叫醒收件方;`steer` 插进收件方正在跑的那一轮。 */
29
- readonly delivery: "quiet" | "wake" | "steer";
30
- readonly createdAt: string;
31
- readonly stages: {
32
- /** 落盘时刻,与 `createdAt` 同值。 */
33
- readonly persisted: string;
34
- /**
35
- * 交给 agent:`confirmed` 是收件方取件了;`not-dispatched` 是还没取;`unknown` 是投递结果
36
- * 不明(不会重投)。
37
- */
38
- readonly handedOff: {
39
- readonly certainty: "not-dispatched" | "confirmed" | "unknown";
40
- /** 确认凭的是什么:`pickup` 是收件方自己取走了正文。旧记录当时没记,就没有这一格。 */
41
- readonly evidence?: "pickup" | undefined;
42
- readonly turnId?: string | undefined;
43
- readonly at?: string | undefined;
44
- };
45
- /** 回了:`recordId` 是收件方那条回信(界面显示「已回」);只有 `turnId` 表示处理它的那一轮结束了。 */
46
- readonly replied: {
47
- readonly recordId?: string | undefined;
48
- readonly turnId?: string | undefined;
49
- readonly at: string;
50
- } | null;
51
- };
52
- }
53
- /** 一次最多取这么多条:`listForThreads` 的 `limit` 与 `getByIds` 的号数都以它为上限。 */
54
- export declare const PLUGIN_COMMUNICATION_MAX_RECORDS = 1000;
55
- export interface PluginCommunicationListForThreadsInput {
56
- /** 一方(发件或收件)落在这些会话里的记录都算。 */
57
- readonly threadIds: readonly string[];
58
- /** 只要这一刻(ISO 时间)之后落盘的;缺省从头取。 */
59
- readonly since?: string | null | undefined;
60
- /**
61
- * 只要这一刻(ISO 时间)及之前落盘的;缺省不限。按它过滤发生在取 `limit` 条之前,所以一页
62
- * 不满就说明这个范围里更早的已经没有了(已结束的 run 按结束时间传它)。
63
- */
64
- readonly until?: string | null | undefined;
65
- /**
66
- * 往上翻页:只要排在这条记录之前的(按落盘时间、同一刻再按记录号)。传手里最旧那条的
67
- * `recordId`;这条记录不存在时结果为空。缺省从最新取。
68
- */
69
- readonly before?: string | null | undefined;
70
- /** 取最新的多少条,缺省 200,最多 1000。 */
71
- readonly limit?: number | undefined;
72
- }
73
- export interface PluginCommunication {
74
- /**
75
- * 一方落在这些会话里的记录,取最新的 `limit` 条,按落盘时间从旧到新返回。`threadIds` 为空
76
- * 返回空数组。三段状态是读那一刻的值;要跟着变,订 `communication.record-sent`、
77
- * `communication.record-handed-off`、`communication.record-replied` 三种事件后重读。
78
- */
79
- readonly listForThreads: (input: PluginCommunicationListForThreadsInput) => Promise<readonly PluginCommunicationRecord[]>;
80
- /**
81
- * 按记录号取记录,一次最多 1000 个;不存在的号跳过,返回顺序不保证。用来跟着三种通信事件
82
- * 更新手里那几条:阶段事件只带归属会话,不带两端,要判一条记录属于谁就按号读回来。
83
- */
84
- readonly getByIds: (recordIds: readonly string[]) => Promise<readonly PluginCommunicationRecord[]>;
85
- }
19
+ export type PluginCommunicationParticipant = PluginCommunicationRecord["from"];
86
20
  //# sourceMappingURL=communication.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"communication.d.ts","sourceRoot":"","sources":["../src/communication.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,wCAAwC;AACxC,MAAM,MAAM,8BAA8B,GACtC;IACE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,wCAAwC;IACxC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC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I,CAAC;KACV,CAAC;CACH;AAED,mEAAmE;AACnE,eAAO,MAAM,gCAAgC,OAAO,CAAC;AAErD,MAAM,WAAW,sCAAsC;IACrD,6BAA6B;IAC7B,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,gCAAgC;IAChC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC3C;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC3C;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC5C,8BAA8B;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC;AAED,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,QAAQ,CAAC,cAAc,EAAE,CACvB,KAAK,EAAE,sCAAsC,KAC1C,OAAO,CAAC,SAAS,yBAAyB,EAAE,CAAC,CAAC;IACnD;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,CACjB,SAAS,EAAE,SAAS,MAAM,EAAE,KACzB,OAAO,CAAC,SAAS,yBAAyB,EAAE,CAAC,CAAC;CACpD"}
1
+ {"version":3,"file":"communication.d.ts","sourceRoot":"","sources":["../src/communication.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AAExE;;;;;GAKG;AACH,MAAM,MAAM,yBAAyB,GAAG,6BAA6B,CAAC,MAAM,CAAC,CAAC;AAE9E,wCAAwC;AACxC,MAAM,MAAM,8BAA8B,GAAG,yBAAyB,CAAC,MAAM,CAAC,CAAC"}
@@ -1,11 +1,2 @@
1
- /**
2
- * 宿主通信记录的只读查询(`ctx.communication`)。会话之间、会话与人之间每发一句,宿主记一条
3
- * 记录,带三段状态:落盘、已交给 agent(收件方取件了)、已回。从包根导出。
4
- *
5
- * 只读:发信走编排工具 `send_message`,插件写不了记录。
6
- *
7
- * @module @ycodium-ai/plugin-api/communication
8
- */
9
- /** 一次最多取这么多条:`listForThreads` 的 `limit` 与 `getByIds` 的号数都以它为上限。 */
10
- export const PLUGIN_COMMUNICATION_MAX_RECORDS = 1000;
1
+ export {};
11
2
  //# sourceMappingURL=communication.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"communication.js","sourceRoot":"","sources":["../src/communication.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA8CH,mEAAmE;AACnE,MAAM,CAAC,MAAM,gCAAgC,GAAG,IAAI,CAAC"}
1
+ {"version":3,"file":"communication.js","sourceRoot":"","sources":["../src/communication.ts"],"names":[],"mappings":""}