@ycodium-ai/plugin-im 0.2.3028 → 0.2.3054

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 (3) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +16 -17
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -158,7 +158,7 @@ The agent's questions and the messages queued behind a running turn use the
158
158
  optional `choiceCards` surface (`ImChoiceCard`, `src/adapter.ts`): Lark patches a
159
159
  card, Telegram edits a message and its inline keyboard. A request is posted on
160
160
  `thread.user-input-pending` (read with `listPendingUserInputs`), one card per
161
- question, and answered with one `thread.user-input.respond` once every question
161
+ question, and answered through `ctx.threads.userInput.respond` once every question
162
162
  has an answer; a free-form answer is the next ordinary message in the chat, and
163
163
  `thread.request-resolved` freezes the cards of a question answered elsewhere or
164
164
  closed unanswered. WeCom has no buttons: it writes the options as numbers and the
package/dist/index.js CHANGED
@@ -127178,7 +127178,8 @@ var makeApprovals = (core, anchors) => {
127178
127178
  return {
127179
127179
  requestId: approval.requestId,
127180
127180
  title: approval.appName ?? "Ycodium",
127181
- body: approval.detail ?? event.summary,
127181
+ // 正文用这道题自己的说明;事件的 summary 只是宿主拼的「哪条会话在等批准」,最后才用。
127182
+ body: approval.detail ?? approval.summary ?? event.summary,
127182
127183
  buttons: buttons.map(({ label, token }) => ({ label, token }))
127183
127184
  };
127184
127185
  }
@@ -129014,13 +129015,11 @@ var makeQuestionFlow = (host) => {
129014
129015
  return true;
129015
129016
  }
129016
129017
  try {
129017
- await host.dispatch({
129018
- type: "thread.user-input.respond",
129019
- commandId: host.newId(),
129018
+ await host.respondToUserInput({
129019
+ requestId: host.newId(),
129020
129020
  threadId: after.threadId,
129021
- requestId,
129022
- answers: Object.fromEntries(after.items.map((entry) => [entry.id, entry.answer])),
129023
- createdAt: host.now()
129021
+ userInputRequestId: requestId,
129022
+ answers: Object.fromEntries(after.items.map((entry) => [entry.id, entry.answer]))
129024
129023
  });
129025
129024
  } catch (error) {
129026
129025
  host.warn("chat could not hand the answer to the agent", error);
@@ -129405,6 +129404,7 @@ var makeInteractions = (core, deps) => {
129405
129404
  });
129406
129405
  return false;
129407
129406
  },
129407
+ respondToUserInput: (input) => host.threads.userInput.respond(input),
129408
129408
  dispatch: (command) => host.commands.dispatch(command),
129409
129409
  say: async (chatKey, text3) => {
129410
129410
  const binding = bindingForChatKey(chatKey);
@@ -139084,9 +139084,8 @@ var makeModelPlan = (core, deps) => {
139084
139084
  const threadId = chatOf(core.state, chatKey).threadId;
139085
139085
  if (threadId !== null && await threadStillUsable(binding, threadId)) {
139086
139086
  try {
139087
- await host.commands.dispatch({
139088
- type: "thread.meta.update",
139089
- commandId: crypto.randomUUID(),
139087
+ await host.threads.update({
139088
+ requestId: crypto.randomUUID(),
139090
139089
  threadId,
139091
139090
  modelSelection: selection
139092
139091
  });
@@ -141697,21 +141696,21 @@ var makeTurns = (core, deps) => {
141697
141696
  }
141698
141697
  }
141699
141698
  try {
141700
- await host.commands.dispatch({
141701
- type: "thread.turn.start",
141702
- commandId: crypto.randomUUID(),
141699
+ await host.threads.turns.start({
141700
+ requestId: crypto.randomUUID(),
141703
141701
  threadId,
141704
141702
  message: {
141705
141703
  messageId: userMessageId,
141706
141704
  role: "user",
141707
141705
  text: notes.length === 0 ? text3 : [text3, ...notes].join("\n"),
141708
- attachments
141706
+ attachments: attachments.map(
141707
+ (attachment) => attachment.type === "image" ? { ...attachment, type: "image" } : { ...attachment, type: "file" }
141708
+ )
141709
141709
  },
141710
141710
  titleSeed: titleFrom(text3 || attachments[0]?.name || "Chat"),
141711
141711
  runtimeMode: binding.runtimeMode,
141712
141712
  interactionMode: interactionModeOf(chatKey),
141713
- ...intentAction !== void 0 ? { intentAction } : {},
141714
- createdAt: (/* @__PURE__ */ new Date()).toISOString()
141713
+ ...intentAction !== void 0 ? { intentAction } : {}
141715
141714
  });
141716
141715
  } catch (error) {
141717
141716
  if (carried !== void 0) pendingByChat.set(chatKey, carried);
@@ -143999,7 +143998,7 @@ var makeWecomAppAdapter = (deps) => {
143999
143998
  // src/index.ts
144000
143999
  var imPlugin = definePlugin({
144001
144000
  id: "im",
144002
- apiVersion: 9,
144001
+ apiVersion: 11,
144003
144002
  activate: async (ctx) => {
144004
144003
  const { t, setLanguage } = makeLiveTranslate(
144005
144004
  parseReplyLanguage(ctx.config[REPLY_LANGUAGE_FIELD])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/plugin-im",
3
- "version": "0.2.3028",
3
+ "version": "0.2.3054",
4
4
  "description": "Talk to your agents from Telegram, WeCom, Lark, or WeChat (experimental).",
5
5
  "keywords": [
6
6
  "im",
@@ -32,7 +32,7 @@
32
32
  "markdown-it": "^15.0.2",
33
33
  "react": "19.2.6",
34
34
  "vite-plus": "0.2.2",
35
- "@ycodium-ai/plugin-api": "0.2.3028"
35
+ "@ycodium-ai/plugin-api": "0.2.3054"
36
36
  },
37
37
  "ycodium": {
38
38
  "plugin": "./dist/index.js",