@ycodium-ai/plugin-im 0.2.3130 → 0.2.3158
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/README.md +9 -7
- package/dist/index.js +26 -40
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -176,9 +176,9 @@ closed unanswered. WeCom has no buttons: it writes the options as numbers and th
|
|
|
176
176
|
reply is parsed in `src/questionCards.ts`. A message that lands behind a running
|
|
177
177
|
turn gets a queued card (Steer, Withdraw, Resume sending) drawn from
|
|
178
178
|
`getThreadExecution` and refreshed when the turn intents or the queue change
|
|
179
|
-
(`src/queueCards.ts`, `src/queueFlow.ts`); the buttons
|
|
180
|
-
`
|
|
181
|
-
and `
|
|
179
|
+
(`src/queueCards.ts`, `src/queueFlow.ts`); the buttons call
|
|
180
|
+
`threads.turnIntents.run` (steer, with the active turn id), `threads.turnIntents.cancel`
|
|
181
|
+
and `threads.turnQueue.resume`, and the card is the user's own action, so no
|
|
182
182
|
`intentAction` is sent. WeCom only gets a one-line notice, since steering
|
|
183
183
|
and withdrawing need buttons (resuming is the `/continue` command). Editing a queued message is not offered:
|
|
184
184
|
the host does not let a plugin dispatch `thread.turn-intent.edit`.
|
|
@@ -249,7 +249,7 @@ Chat commands: `/stop`, `/continue`, `/status`, `/new`, `/sessions`, `/resume`,
|
|
|
249
249
|
`/plan`, `/repo`, `/group`, `/team`, `/thread`, `/help`, `/panel`. In a chat with no project
|
|
250
250
|
`/sessions`, `/resume` and the team commands answer with the project picker. `/sessions` and `/resume` only list and
|
|
251
251
|
switch threads this plugin opened, since the host lets a plugin send only into
|
|
252
|
-
its own threads. `/continue`
|
|
252
|
+
its own threads. `/continue` calls `threads.turnQueue.resume` for the chat's thread
|
|
253
253
|
when its queue is paused (a `/stop` or a failure pauses it), which is how WeCom, with
|
|
254
254
|
no buttons, resumes; it is not `/resume`, which already switches threads.
|
|
255
255
|
|
|
@@ -277,11 +277,13 @@ interface language instead. The copy lives in `locales/en.json` and
|
|
|
277
277
|
## Requirements
|
|
278
278
|
|
|
279
279
|
A Ycodium server. The plugin asks to read files in the project of the conversation that
|
|
280
|
-
calls its tool (`workspace.read`, used only by `im_send_file`)
|
|
280
|
+
calls its tool (`workspace.read`, used only by `im_send_file`). Its generated session ports
|
|
281
|
+
require the `commands.dispatch` declarations for `thread.create`,
|
|
281
282
|
`thread.meta.update`, `thread.turn.start`, `thread.turn.interrupt`,
|
|
282
283
|
`thread.approval.respond`, `thread.user-input.respond`, `thread.turn-intent.run`,
|
|
283
|
-
`thread.turn-intent.cancel` and `thread.turn-queue.resume`.
|
|
284
|
-
|
|
284
|
+
`thread.turn-intent.cancel` and `thread.turn-queue.resume`. The plugin calls the generated
|
|
285
|
+
`threads` and `approvals` ports; it does not send session commands through
|
|
286
|
+
`commands.dispatch`. These ports only write to threads this plugin started.
|
|
285
287
|
|
|
286
288
|
## Install
|
|
287
289
|
|
package/dist/index.js
CHANGED
|
@@ -127290,13 +127290,12 @@ var makeApprovals = (core, anchors) => {
|
|
|
127290
127290
|
};
|
|
127291
127291
|
const answerApproval = async (approval, decision, label) => {
|
|
127292
127292
|
commit("approval-resolved", { requestId: approval.requestId });
|
|
127293
|
-
await host.
|
|
127294
|
-
|
|
127295
|
-
commandId: crypto.randomUUID(),
|
|
127293
|
+
await host.approvals.respond({
|
|
127294
|
+
requestId: crypto.randomUUID(),
|
|
127296
127295
|
threadId: approval.threadId,
|
|
127297
|
-
|
|
127298
|
-
|
|
127299
|
-
|
|
127296
|
+
approvalRequestId: approval.requestId,
|
|
127297
|
+
// 落盘按钮保留 string 形状;合法决定仍由端口 schema 校验。
|
|
127298
|
+
decision
|
|
127300
127299
|
});
|
|
127301
127300
|
host.log.info("chat answered an approval", { threadId: approval.threadId, decision });
|
|
127302
127301
|
await settleApprovalCard(core.state.approvals[approval.requestId] ?? approval, {
|
|
@@ -127904,11 +127903,9 @@ var makeCommands = (core, deps) => {
|
|
|
127904
127903
|
return true;
|
|
127905
127904
|
}
|
|
127906
127905
|
try {
|
|
127907
|
-
await host.
|
|
127908
|
-
|
|
127909
|
-
|
|
127910
|
-
threadId,
|
|
127911
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
127906
|
+
await host.threads.turnQueue.resume({
|
|
127907
|
+
requestId: crypto.randomUUID(),
|
|
127908
|
+
threadId
|
|
127912
127909
|
});
|
|
127913
127910
|
} catch (error) {
|
|
127914
127911
|
host.log.warn("chat could not resume the turn queue", { error: describeError(error) });
|
|
@@ -127931,12 +127928,10 @@ var makeCommands = (core, deps) => {
|
|
|
127931
127928
|
return true;
|
|
127932
127929
|
}
|
|
127933
127930
|
stopRequested.add(threadId);
|
|
127934
|
-
await host.
|
|
127935
|
-
|
|
127936
|
-
commandId: crypto.randomUUID(),
|
|
127931
|
+
await host.threads.turns.interrupt({
|
|
127932
|
+
requestId: crypto.randomUUID(),
|
|
127937
127933
|
threadId,
|
|
127938
|
-
turnId: activeTurnId
|
|
127939
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
127934
|
+
turnId: activeTurnId
|
|
127940
127935
|
});
|
|
127941
127936
|
await clearWorking(binding, threadId, "stopped");
|
|
127942
127937
|
await deliver(binding, t("command.stopped"));
|
|
@@ -129466,14 +129461,12 @@ var makeQueueFlow = (host, deps) => {
|
|
|
129466
129461
|
if (execution?.activeTurnId == null) return false;
|
|
129467
129462
|
host.commit("queue-steering", { intentId: record3.intentId, steering: true });
|
|
129468
129463
|
try {
|
|
129469
|
-
await host.
|
|
129470
|
-
|
|
129471
|
-
commandId: host.newId(),
|
|
129464
|
+
await host.turnIntents.run({
|
|
129465
|
+
requestId: host.newId(),
|
|
129472
129466
|
threadId: record3.threadId,
|
|
129473
129467
|
intentId: record3.intentId,
|
|
129474
129468
|
mode: "steer",
|
|
129475
|
-
expectedTurnId: execution.activeTurnId
|
|
129476
|
-
createdAt: host.now()
|
|
129469
|
+
expectedTurnId: execution.activeTurnId
|
|
129477
129470
|
});
|
|
129478
129471
|
return true;
|
|
129479
129472
|
} catch (error) {
|
|
@@ -129494,15 +129487,13 @@ var makeQueueFlow = (host, deps) => {
|
|
|
129494
129487
|
void run(
|
|
129495
129488
|
record3,
|
|
129496
129489
|
async () => {
|
|
129497
|
-
await host.
|
|
129498
|
-
|
|
129499
|
-
commandId: host.newId(),
|
|
129490
|
+
await host.turnIntents.cancel({
|
|
129491
|
+
requestId: host.newId(),
|
|
129500
129492
|
threadId: record3.threadId,
|
|
129501
129493
|
intentId: record3.intentId,
|
|
129502
129494
|
// 只撤还没开始发送的:已经在路上的由宿主拒绝,而不是被当成「已放弃」。
|
|
129503
129495
|
expectedStatus: "queued",
|
|
129504
|
-
expectedDeliveryCertainty: "not-dispatched"
|
|
129505
|
-
createdAt: host.now()
|
|
129496
|
+
expectedDeliveryCertainty: "not-dispatched"
|
|
129506
129497
|
});
|
|
129507
129498
|
return true;
|
|
129508
129499
|
},
|
|
@@ -129512,11 +129503,9 @@ var makeQueueFlow = (host, deps) => {
|
|
|
129512
129503
|
void run(
|
|
129513
129504
|
record3,
|
|
129514
129505
|
async () => {
|
|
129515
|
-
await host.
|
|
129516
|
-
|
|
129517
|
-
|
|
129518
|
-
threadId: record3.threadId,
|
|
129519
|
-
createdAt: host.now()
|
|
129506
|
+
await host.turnQueue.resume({
|
|
129507
|
+
requestId: host.newId(),
|
|
129508
|
+
threadId: record3.threadId
|
|
129520
129509
|
});
|
|
129521
129510
|
return true;
|
|
129522
129511
|
},
|
|
@@ -129568,14 +129557,14 @@ var makeInteractions = (core, deps) => {
|
|
|
129568
129557
|
return false;
|
|
129569
129558
|
},
|
|
129570
129559
|
respondToUserInput: (input) => host.threads.userInput.respond(input),
|
|
129571
|
-
|
|
129560
|
+
turnIntents: host.threads.turnIntents,
|
|
129561
|
+
turnQueue: host.threads.turnQueue,
|
|
129572
129562
|
say: async (chatKey, text4) => {
|
|
129573
129563
|
const binding = bindingForChatKey(chatKey);
|
|
129574
129564
|
if (binding !== void 0) await deliver(binding, text4);
|
|
129575
129565
|
},
|
|
129576
129566
|
newToken: () => crypto.randomUUID().slice(0, 8),
|
|
129577
129567
|
newId: () => crypto.randomUUID(),
|
|
129578
|
-
now: () => (/* @__PURE__ */ new Date()).toISOString(),
|
|
129579
129568
|
warn: (message, error) => {
|
|
129580
129569
|
host.log.warn(`chat ${message}`, error === void 0 ? {} : { error: describeError(error) });
|
|
129581
129570
|
}
|
|
@@ -142222,9 +142211,8 @@ var makeTurns = (core, deps) => {
|
|
|
142222
142211
|
return null;
|
|
142223
142212
|
}
|
|
142224
142213
|
const createdThreadId = crypto.randomUUID();
|
|
142225
|
-
await host.
|
|
142226
|
-
|
|
142227
|
-
commandId: crypto.randomUUID(),
|
|
142214
|
+
await host.threads.create({
|
|
142215
|
+
requestId: crypto.randomUUID(),
|
|
142228
142216
|
threadId: createdThreadId,
|
|
142229
142217
|
projectId: binding.projectId,
|
|
142230
142218
|
title: titleFrom(titleSeed),
|
|
@@ -142232,8 +142220,7 @@ var makeTurns = (core, deps) => {
|
|
|
142232
142220
|
runtimeMode: binding.runtimeMode,
|
|
142233
142221
|
interactionMode: interactionModeOf(chatKey),
|
|
142234
142222
|
branch: null,
|
|
142235
|
-
worktreePath: null
|
|
142236
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
142223
|
+
worktreePath: null
|
|
142237
142224
|
});
|
|
142238
142225
|
commit("thread-opened", {
|
|
142239
142226
|
chatKey,
|
|
@@ -144631,7 +144618,7 @@ var makeWecomAppAdapter = (deps) => {
|
|
|
144631
144618
|
// src/index.ts
|
|
144632
144619
|
var imPlugin = definePlugin({
|
|
144633
144620
|
id: "im",
|
|
144634
|
-
apiVersion:
|
|
144621
|
+
apiVersion: 15,
|
|
144635
144622
|
activate: async (ctx) => {
|
|
144636
144623
|
const { t, setLanguage } = makeLiveTranslate(
|
|
144637
144624
|
parseReplyLanguage(ctx.config[REPLY_LANGUAGE_FIELD])
|
|
@@ -144700,7 +144687,6 @@ var imPlugin = definePlugin({
|
|
|
144700
144687
|
projects: ctx.projects,
|
|
144701
144688
|
threads: ctx.threads,
|
|
144702
144689
|
approvals: ctx.approvals,
|
|
144703
|
-
commands: ctx.commands,
|
|
144704
144690
|
plugins: ctx.plugins,
|
|
144705
144691
|
attachments: ctx.attachments,
|
|
144706
144692
|
providers: ctx.providers,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ycodium-ai/plugin-im",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3158",
|
|
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.
|
|
35
|
+
"@ycodium-ai/plugin-api": "0.2.3158"
|
|
36
36
|
},
|
|
37
37
|
"ycodium": {
|
|
38
38
|
"plugin": "./dist/index.js",
|