opencode-feishu-plugin 0.1.2 → 0.1.3
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/dist/index.js +22 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -146606,8 +146606,8 @@ function buildFormCard(form, answers, opts = {}) {
|
|
|
146606
146606
|
});
|
|
146607
146607
|
const hints = [];
|
|
146608
146608
|
if (opts.notice) hints.push(opts.notice);
|
|
146609
|
-
if (missing2.length > 0 && visible.length > 1) hints.push(`\u8FD8\u9700\u56DE\u7B54\uFF1A${missing2.join("\u3001")}`);
|
|
146610
|
-
else if (missing2.length > 0) hints.push("\
|
|
146609
|
+
if (missing2.length > 0 && visible.length > 1) hints.push(`\u8FD8\u9700\u56DE\u7B54\uFF1A${missing2.join("\u3001")}\uFF08\u53EF\u76F4\u63A5\u53D1\u6587\u5B57\u56DE\u7B54\uFF09`);
|
|
146610
|
+
else if (missing2.length > 0) hints.push("\u53EF\u76F4\u63A5\u53D1\u6587\u5B57\u56DE\u7B54\uFF0C\u6216\u70B9\u4E0A\u65B9\u9009\u9879\u3002");
|
|
146611
146611
|
if (hints.length > 0) elements.push({ tag: "markdown", content: truncateCardContent(hints.join("\n\n")) });
|
|
146612
146612
|
const header = headerFor(form);
|
|
146613
146613
|
return {
|
|
@@ -146671,20 +146671,29 @@ var FormRelay = class {
|
|
|
146671
146671
|
this.deps.log.warn("\u8868\u5355\u5361\u53D1\u9001\u5931\u8D25", { formID: form.id, error: res.error ?? "unknown" });
|
|
146672
146672
|
return;
|
|
146673
146673
|
}
|
|
146674
|
-
|
|
146674
|
+
const firstVisible = form.fields.find((f) => f.hidden !== true);
|
|
146675
|
+
const pending = {
|
|
146675
146676
|
form,
|
|
146676
146677
|
sessionID: form.sessionID,
|
|
146677
146678
|
chatId: link2.chatId,
|
|
146678
146679
|
messageId: res.messageId,
|
|
146679
146680
|
...link2.dir ? { directory: link2.dir } : {},
|
|
146680
146681
|
answers: {},
|
|
146681
|
-
settled: false
|
|
146682
|
-
|
|
146682
|
+
settled: false,
|
|
146683
|
+
// 自动进入「等待文字回答」状态:用户直接发文字即可作为答案,
|
|
146684
|
+
// 无需先点「直接回复答案」按钮。第一个可见字段作为默认答案字段。
|
|
146685
|
+
...firstVisible ? { awaitingField: firstVisible.key } : {}
|
|
146686
|
+
};
|
|
146687
|
+
this.forms.set(form.id, pending);
|
|
146688
|
+
if (firstVisible) {
|
|
146689
|
+
this.awaiting.set(form.sessionID, form.id);
|
|
146690
|
+
}
|
|
146683
146691
|
this.deps.log.info("\u8868\u5355\u5361\u5DF2\u53D1\u9001", {
|
|
146684
146692
|
formID: form.id,
|
|
146685
146693
|
sessionID: form.sessionID,
|
|
146686
146694
|
fieldCount: form.fields.length,
|
|
146687
|
-
isQuestion: form.metadata?.kind === "question"
|
|
146695
|
+
isQuestion: form.metadata?.kind === "question",
|
|
146696
|
+
awaitingField: firstVisible?.key
|
|
146688
146697
|
});
|
|
146689
146698
|
}
|
|
146690
146699
|
/**
|
|
@@ -146714,8 +146723,13 @@ var FormRelay = class {
|
|
|
146714
146723
|
if (parsed.v === void 0) return TOAST("error", "\u65E0\u6CD5\u8BC6\u522B\u7684\u64CD\u4F5C");
|
|
146715
146724
|
const value3 = field?.type === "multiselect" && !Array.isArray(parsed.v) ? [String(parsed.v)] : parsed.v;
|
|
146716
146725
|
pending.answers[parsed.k] = value3;
|
|
146717
|
-
pending.
|
|
146718
|
-
|
|
146726
|
+
const nextField = pending.form.fields.find((f) => f.hidden !== true && pending.answers[f.key] === void 0);
|
|
146727
|
+
pending.awaitingField = nextField?.key;
|
|
146728
|
+
if (pending.awaitingField) {
|
|
146729
|
+
this.awaiting.set(pending.sessionID, pending.form.id);
|
|
146730
|
+
} else {
|
|
146731
|
+
this.awaiting.delete(pending.sessionID);
|
|
146732
|
+
}
|
|
146719
146733
|
if (isComplete(pending.form, pending.answers)) {
|
|
146720
146734
|
pending.settled = true;
|
|
146721
146735
|
void this.submit(pending);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-feishu-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Feishu/Lark plugin for OpenCode V2 — single-user topics as sessions, in-card permission approvals, streaming cards. Minimal permissions, no public endpoint.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|