@ycodium-ai/plugin-im 0.2.2998 → 0.2.3002

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/dist/index.js +17 -10
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -127710,7 +127710,7 @@ var makeCommands = (core, deps) => {
127710
127710
  const planLine = chatOf(core.state, chatKey).plan ? [t("status.planOn")] : [];
127711
127711
  const projectLine2 = [
127712
127712
  binding.projectId === "" ? t("status.noProject") : t("status.project", {
127713
- title: (await host.projections.getProject(binding.projectId).catch(() => null))?.title ?? binding.projectId
127713
+ title: (await host.projects.get({ projectId: binding.projectId }).catch(() => null))?.title ?? binding.projectId
127714
127714
  })
127715
127715
  ];
127716
127716
  if (threadId === void 0) {
@@ -128469,6 +128469,9 @@ var makeInboundAttachments = (core) => {
128469
128469
  return { pendingByChat, pendingFor, collectResources };
128470
128470
  };
128471
128471
 
128472
+ // src/inbound.ts
128473
+ import { projectOrNull } from "@ycodium-ai/plugin-api";
128474
+
128472
128475
  // src/boundedSeen.ts
128473
128476
  var makeBoundedSeen = (limit) => {
128474
128477
  const seen = /* @__PURE__ */ new Set();
@@ -128715,7 +128718,7 @@ var makeInbound = (core, deps) => {
128715
128718
  if (boundThread !== null && message.text !== "" && await questionFlow.answerByText(chatKey, boundThread, message.text)) {
128716
128719
  return;
128717
128720
  }
128718
- const project = await host.projections.getProject(target2.projectId);
128721
+ const project = await projectOrNull(host.projects, target2.projectId);
128719
128722
  if (project === null || project.archivedAt != null) {
128720
128723
  if (project === null) {
128721
128724
  host.log.warn("chat cannot start work: the chat's project is gone", {
@@ -139048,7 +139051,7 @@ var makeModelPlan = (core, deps) => {
139048
139051
  }
139049
139052
  }
139050
139053
  if (chat.model !== null) return chat.model;
139051
- const project = binding.projectId === "" ? null : await host.projections.getProject(binding.projectId).catch(() => null);
139054
+ const project = binding.projectId === "" ? null : await host.projects.get({ projectId: binding.projectId }).catch(() => null);
139052
139055
  const fallback = project?.defaultModelSelection ?? null;
139053
139056
  return fallback === null ? null : { instanceId: fallback.instanceId, model: fallback.model };
139054
139057
  };
@@ -139782,11 +139785,13 @@ var makeProjectRows = (core) => {
139782
139785
  const { host } = core;
139783
139786
  const projectRowsFor = async (chatKey) => {
139784
139787
  const current = chatOf(core.state, chatKey).projectId ?? null;
139785
- return (await host.projections.listProjects()).filter((project) => project.archivedAt == null).map((project) => ({
139786
- projectId: project.projectId,
139787
- title: project.title,
139788
- current: project.projectId === current
139789
- }));
139788
+ return (await host.projects.list({ archived: "exclude", repositoryIdentity: "skip" })).map(
139789
+ (project) => ({
139790
+ projectId: project.id,
139791
+ title: project.title,
139792
+ current: project.id === current
139793
+ })
139794
+ );
139790
139795
  };
139791
139796
  const listedProjectsByChat = /* @__PURE__ */ new Map();
139792
139797
  return { projectRowsFor, listedProjectsByChat };
@@ -141512,6 +141517,7 @@ ${line}`
141512
141517
  };
141513
141518
 
141514
141519
  // src/turns.ts
141520
+ import { projectOrNull as projectOrNull2 } from "@ycodium-ai/plugin-api";
141515
141521
  var TITLE_MAX_CHARS = 72;
141516
141522
  var titleFrom = (text3) => text3.replace(/\s+/g, " ").slice(0, TITLE_MAX_CHARS) || "Chat thread";
141517
141523
  var makeTurns = (core, deps) => {
@@ -141544,7 +141550,7 @@ var makeTurns = (core, deps) => {
141544
141550
  await deliver(binding, t("reply.threadGone"));
141545
141551
  }
141546
141552
  if (threadId !== void 0) return threadId;
141547
- const project = await host.projections.getProject(binding.projectId);
141553
+ const project = await projectOrNull2(host.projects, binding.projectId);
141548
141554
  if (project === null) {
141549
141555
  host.log.warn("chat cannot start a thread: the configured project is gone", {
141550
141556
  bot: binding.displayName,
@@ -143921,7 +143927,7 @@ var makeWecomAppAdapter = (deps) => {
143921
143927
  // src/index.ts
143922
143928
  var imPlugin = definePlugin({
143923
143929
  id: "im",
143924
- apiVersion: 5,
143930
+ apiVersion: 6,
143925
143931
  activate: async (ctx) => {
143926
143932
  const { t, setLanguage } = makeLiveTranslate(
143927
143933
  parseReplyLanguage(ctx.config[REPLY_LANGUAGE_FIELD])
@@ -143987,6 +143993,7 @@ var imPlugin = definePlugin({
143987
143993
  host: {
143988
143994
  log: ctx.log,
143989
143995
  projections: ctx.projections,
143996
+ projects: ctx.projects,
143990
143997
  threads: ctx.threads,
143991
143998
  approvals: ctx.approvals,
143992
143999
  commands: ctx.commands,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/plugin-im",
3
- "version": "0.2.2998",
3
+ "version": "0.2.3002",
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.2998"
35
+ "@ycodium-ai/plugin-api": "0.2.3002"
36
36
  },
37
37
  "ycodium": {
38
38
  "plugin": "./dist/index.js",