@eum-agent/channel-feishu 1.0.1 → 1.1.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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/ui/ui.js +115 -92
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "en-US": "Feishu Message Channel",
5
5
  "zh-CN": "消息渠道 · 飞书"
6
6
  },
7
- "version": "1.0.1",
7
+ "version": "1.1.0",
8
8
  "type": "module",
9
9
  "description": "Feishu conversations, streaming cards and interactive replies",
10
10
  "license": "MIT",
@@ -26,7 +26,7 @@
26
26
  "@eum-agent/container": "1.0.0",
27
27
  "@eum-agent/gateway": "1.0.0",
28
28
  "@eum-agent/kernel": "1.0.0",
29
- "@eum-agent/plugin": "1.0.1",
29
+ "@eum-agent/plugin": "1.1.0",
30
30
  "@eum-agent/protocol": "1.0.0",
31
31
  "@eum-agent/runtime": "1.0.0",
32
32
  "@types/react": "^19.2.18",
@@ -44,7 +44,7 @@
44
44
  "kind": "extension",
45
45
  "foundationDependencies": {
46
46
  "@eum-agent/infra-local": "1.0.1",
47
- "@eum-agent/storage-sqlite": "1.0.1"
47
+ "@eum-agent/storage-sqlite": "1.1.0"
48
48
  }
49
49
  },
50
50
  "scripts": {
package/ui/ui.js CHANGED
@@ -5295,6 +5295,8 @@ var CATALOGUES = {
5295
5295
  "feishu.appId": "AppID",
5296
5296
  "feishu.appSecret": "AppSecret",
5297
5297
  "feishu.enabled": "启用",
5298
+ "feishu.connectionOn": "开启",
5299
+ "feishu.connectionOff": "关闭",
5298
5300
  "feishu.save": "保存",
5299
5301
  "feishu.cancel": "取消",
5300
5302
  "feishu.menu": "飞书",
@@ -5447,6 +5449,8 @@ var CATALOGUES = {
5447
5449
  "feishu.appId": "App ID",
5448
5450
  "feishu.appSecret": "App Secret",
5449
5451
  "feishu.enabled": "Enabled",
5452
+ "feishu.connectionOn": "On",
5453
+ "feishu.connectionOff": "Off",
5450
5454
  "feishu.save": "Save",
5451
5455
  "feishu.cancel": "Cancel",
5452
5456
  "feishu.menu": "Feishu",
@@ -5514,7 +5518,7 @@ function channelOperations(ctx) {
5514
5518
  /** Builds the connection tab for one stored Feishu bot. */
5515
5519
  function connectionTabFor(ctx) {
5516
5520
  const t = ctx.i18n.t;
5517
- const { AlertDialog, Button, Field, Input, SecretInput, Switch } = ctx.ui;
5521
+ const { AlertDialog, Button, Field, Input, SecretInput, Segmented } = ctx.ui;
5518
5522
  return function ConnectionTab({ instanceId, onLeaveGuard }) {
5519
5523
  const [bot, setBot] = useState(null);
5520
5524
  const [loadError, setLoadError] = useState(null);
@@ -5608,103 +5612,119 @@ function connectionTabFor(ctx) {
5608
5612
  children: t("feishu.loading")
5609
5613
  });
5610
5614
  return /* @__PURE__ */ jsxs("div", {
5611
- className: "feishu-form feishu-tab",
5615
+ className: "feishu-connection feishu-tab",
5612
5616
  children: [
5613
- /* @__PURE__ */ jsx(Field, {
5614
- className: "settings-field-row",
5615
- label: t("feishu.enabled"),
5616
- inline: true,
5617
- children: () => /* @__PURE__ */ jsx(Switch, {
5618
- checked: enabled,
5619
- disabled: busy,
5620
- onCheckedChange: (value) => {
5621
- dirtyRef.current = true;
5622
- setEnabled(value);
5623
- },
5624
- "aria-label": t("feishu.enabled")
5625
- })
5626
- }),
5627
- /* @__PURE__ */ jsx(Field, {
5628
- className: "settings-field-row",
5629
- label: t("feishu.name"),
5630
- required: true,
5631
- inline: true,
5632
- children: (field) => /* @__PURE__ */ jsx(Input, {
5633
- ...field,
5634
- value: name,
5635
- maxLength: 40,
5636
- disabled: busy,
5637
- onChange: (event) => {
5638
- dirtyRef.current = true;
5639
- setName(event.target.value);
5640
- }
5641
- })
5642
- }),
5643
- /* @__PURE__ */ jsx(Field, {
5644
- className: "settings-field-row",
5645
- label: t("feishu.appId"),
5646
- required: true,
5647
- inline: true,
5648
- children: (field) => /* @__PURE__ */ jsx(Input, {
5649
- ...field,
5650
- value: appId,
5651
- disabled: busy,
5652
- onChange: (event) => {
5653
- dirtyRef.current = true;
5654
- setAppId(event.target.value);
5655
- }
5656
- })
5657
- }),
5658
- /* @__PURE__ */ jsx(Field, {
5659
- className: "settings-field-row",
5660
- label: t("feishu.appSecret"),
5661
- inline: true,
5662
- children: (field) => /* @__PURE__ */ jsx(SecretInput, {
5663
- ...field,
5664
- label: t("feishu.appSecret"),
5665
- value: secret,
5666
- disabled: busy,
5667
- stored: bot.secret.set,
5668
- ...bot.secret.hint ? { hint: bot.secret.hint } : {},
5669
- onValueChange: (value) => {
5670
- dirtyRef.current = true;
5671
- setSecret(value);
5672
- }
5673
- })
5674
- }),
5675
- bot.permissionIssues.map((issue) => {
5676
- const optionalName = issue.operation === "userName" && issue.scopes.includes("contact:contact.base:readonly") && issue.scopes.every((scope) => scope.startsWith("contact:"));
5677
- return /* @__PURE__ */ jsxs("div", {
5678
- className: "feishu-permission-issue",
5679
- role: "status",
5680
- children: [
5681
- /* @__PURE__ */ jsx("p", { children: t(optionalName ? "feishu.nameUnavailable" : "feishu.permissionRefused") }),
5682
- optionalName ? /* @__PURE__ */ jsx("p", { children: t("feishu.namePermission") }) : null,
5683
- /* @__PURE__ */ jsxs("details", { children: [
5684
- /* @__PURE__ */ jsx("summary", { children: t("feishu.permissionDetails") }),
5685
- /* @__PURE__ */ jsx("p", { children: t(issue.operation === "userName" ? "feishu.operation.userName" : "feishu.operation.other") }),
5686
- issue.scopes.length === 0 ? null : /* @__PURE__ */ jsxs("p", { children: [
5687
- t("feishu.permissionCandidates"),
5688
- " ",
5689
- issue.scopes.join("、")
5690
- ] }),
5691
- /* @__PURE__ */ jsx("pre", { children: issue.reason })
5692
- ] })
5693
- ]
5694
- }, `${issue.operation}:${[...issue.scopes].sort().join(",")}`);
5695
- }),
5696
- error === null ? null : /* @__PURE__ */ jsx("p", {
5697
- className: "feishu-error",
5698
- children: error
5617
+ /* @__PURE__ */ jsxs("div", {
5618
+ className: "feishu-form feishu-connection-body",
5619
+ children: [
5620
+ /* @__PURE__ */ jsx(Field, {
5621
+ className: "settings-field-row",
5622
+ label: t("feishu.enabled"),
5623
+ inline: true,
5624
+ children: () => /* @__PURE__ */ jsx("div", {
5625
+ className: "flex min-w-0 justify-end",
5626
+ children: /* @__PURE__ */ jsx(Segmented, {
5627
+ label: t("feishu.enabled"),
5628
+ value: enabled ? "on" : "off",
5629
+ options: [{
5630
+ value: "off",
5631
+ label: t("feishu.connectionOff")
5632
+ }, {
5633
+ value: "on",
5634
+ label: t("feishu.connectionOn")
5635
+ }],
5636
+ disabled: busy,
5637
+ onSelect: (value) => {
5638
+ dirtyRef.current = true;
5639
+ setEnabled(value === "on");
5640
+ }
5641
+ })
5642
+ })
5643
+ }),
5644
+ /* @__PURE__ */ jsx(Field, {
5645
+ className: "settings-field-row",
5646
+ label: t("feishu.name"),
5647
+ required: true,
5648
+ inline: true,
5649
+ children: (field) => /* @__PURE__ */ jsx(Input, {
5650
+ ...field,
5651
+ value: name,
5652
+ maxLength: 40,
5653
+ disabled: busy,
5654
+ onChange: (event) => {
5655
+ dirtyRef.current = true;
5656
+ setName(event.target.value);
5657
+ }
5658
+ })
5659
+ }),
5660
+ /* @__PURE__ */ jsx(Field, {
5661
+ className: "settings-field-row",
5662
+ label: t("feishu.appId"),
5663
+ required: true,
5664
+ inline: true,
5665
+ children: (field) => /* @__PURE__ */ jsx(Input, {
5666
+ ...field,
5667
+ value: appId,
5668
+ disabled: busy,
5669
+ onChange: (event) => {
5670
+ dirtyRef.current = true;
5671
+ setAppId(event.target.value);
5672
+ }
5673
+ })
5674
+ }),
5675
+ /* @__PURE__ */ jsx(Field, {
5676
+ className: "settings-field-row",
5677
+ label: t("feishu.appSecret"),
5678
+ inline: true,
5679
+ children: (field) => /* @__PURE__ */ jsx(SecretInput, {
5680
+ ...field,
5681
+ label: t("feishu.appSecret"),
5682
+ value: secret,
5683
+ disabled: busy,
5684
+ stored: bot.secret.set,
5685
+ ...bot.secret.hint ? { hint: bot.secret.hint } : {},
5686
+ onValueChange: (value) => {
5687
+ dirtyRef.current = true;
5688
+ setSecret(value);
5689
+ }
5690
+ })
5691
+ }),
5692
+ bot.permissionIssues.map((issue) => {
5693
+ const optionalName = issue.operation === "userName" && issue.scopes.includes("contact:contact.base:readonly") && issue.scopes.every((scope) => scope.startsWith("contact:"));
5694
+ return /* @__PURE__ */ jsxs("div", {
5695
+ className: "feishu-permission-issue",
5696
+ role: "status",
5697
+ children: [
5698
+ /* @__PURE__ */ jsx("p", { children: t(optionalName ? "feishu.nameUnavailable" : "feishu.permissionRefused") }),
5699
+ optionalName ? /* @__PURE__ */ jsx("p", { children: t("feishu.namePermission") }) : null,
5700
+ /* @__PURE__ */ jsxs("details", { children: [
5701
+ /* @__PURE__ */ jsx("summary", { children: t("feishu.permissionDetails") }),
5702
+ /* @__PURE__ */ jsx("p", { children: t(issue.operation === "userName" ? "feishu.operation.userName" : "feishu.operation.other") }),
5703
+ issue.scopes.length === 0 ? null : /* @__PURE__ */ jsxs("p", { children: [
5704
+ t("feishu.permissionCandidates"),
5705
+ " ",
5706
+ issue.scopes.join("、")
5707
+ ] }),
5708
+ /* @__PURE__ */ jsx("pre", { children: issue.reason })
5709
+ ] })
5710
+ ]
5711
+ }, `${issue.operation}:${[...issue.scopes].sort().join(",")}`);
5712
+ })
5713
+ ]
5699
5714
  }),
5700
- /* @__PURE__ */ jsx("div", {
5701
- className: "feishu-actions",
5702
- children: /* @__PURE__ */ jsx(Button, {
5715
+ /* @__PURE__ */ jsxs("footer", {
5716
+ className: "feishu-connection-footer",
5717
+ children: [error === null ? null : /* @__PURE__ */ jsx("p", {
5718
+ className: "feishu-error",
5719
+ role: "alert",
5720
+ children: error
5721
+ }), /* @__PURE__ */ jsx(Button, {
5703
5722
  variant: "primary",
5723
+ icon: "save",
5704
5724
  disabled: busy || name.trim() === "" || appId.trim() === "",
5705
5725
  onClick: () => void save(),
5706
5726
  children: t("feishu.save")
5707
- })
5727
+ })]
5708
5728
  }),
5709
5729
  /* @__PURE__ */ jsx(AlertDialog, {
5710
5730
  open: leavePrompt,
@@ -6520,6 +6540,9 @@ var STYLES = `
6520
6540
  .feishu-sync .feishu-member-row > :last-child { margin-left: auto; }
6521
6541
  }
6522
6542
  .feishu-tab { box-sizing: border-box; min-width: 0; }
6543
+ .feishu-connection { display: flex; height: 100%; min-height: 0; flex-direction: column; }
6544
+ .feishu-connection-body { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: .25rem; }
6545
+ .feishu-connection-footer { display: flex; flex: none; flex-direction: column; gap: .75rem; padding-top: .5rem; }
6523
6546
  .feishu-pair { display: flex; min-width: 0; flex-direction: column; gap: .5rem; }
6524
6547
  .feishu-pair p { margin: 0; }
6525
6548
  .feishu-pair-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .75rem; min-height: var(--form-control-height); }