@takagaki/cortex-decisions-viewer 0.12.265 → 0.12.268

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.
@@ -19,6 +19,7 @@ exports.sourceStateOf = sourceStateOf;
19
19
  exports.sourceFacts = sourceFacts;
20
20
  exports.sourceTags = sourceTags;
21
21
  exports.sourceRowName = sourceRowName;
22
+ exports.startCheckConnectedOf = startCheckConnectedOf;
22
23
  exports.sourceRowView = sourceRowView;
23
24
  exports.sourceMeetingHead = sourceMeetingHead;
24
25
  exports.sourceTileLine = sourceTileLine;
@@ -213,6 +214,42 @@ function sourceRowName(row) {
213
214
  const r = row || {};
214
215
  return String(r.currentName || r.name || r.ref || "");
215
216
  }
217
+ /**
218
+ * 記憶の更新を開始する前の画面の「つながっているデータソース」(cortex-engine #2838)。**つながっている物だけ**を、ツールごとに 1 まとまりで返す。
219
+ * 数え方は受け口の `connectedSourceCountOf`(`infra/lambda/intake/config-intent.mjs`)と同じ: 止めていない行 + 会議(暦があれば 1)。
220
+ * 状態(問題あり等)では落とさない。外した行(`sourceGone`)は呼び手が先に除いて渡す。ツール名で分岐せず `SOURCE_ROW_TOOLS` の表を引く。
221
+ * @param groups `sources.groups`(`{ kind, rows }` の配列)
222
+ * @param meeting `sources.meeting`(暦があれば非 null)
223
+ * @param calendarName 暦の表示名(無ければ空)
224
+ * @returns {{ kind, tile, toolName, names: string[], more: number, count: number, problem: boolean }[]} `names` は 3 つまで・残りは `more`
225
+ */
226
+ function startCheckConnectedOf(groups, meeting, calendarName) {
227
+ const out = [];
228
+ (Array.isArray(groups) ? groups : []).forEach(function (g) {
229
+ if (!g || typeof g !== "object")
230
+ return;
231
+ // 表に無い種類(Google Chat・今後増えるツール)も落とさない——受け口は種類を問わず数える。名前は群の見出し(無ければ種類名)
232
+ const t = SOURCE_ROW_TOOLS[g.kind] || { tile: g.kind, toolName: String(g.label || g.kind), placeName: "" };
233
+ const rows = (Array.isArray(g.rows) ? g.rows : []).filter(function (r) { return !!r && typeof r === "object" && r.paused !== true; });
234
+ if (!rows.length)
235
+ return;
236
+ const mark = t.placeName === "チャンネル" ? "#" : "";
237
+ const names = rows.map(function (r) {
238
+ const n = String(r.currentName || r.name || r.ref || "");
239
+ return mark && n && n.charAt(0) !== mark ? mark + n : n;
240
+ });
241
+ out.push({
242
+ kind: g.kind, tile: t.tile, toolName: t.toolName, names: names.slice(0, 3), more: names.length > 3 ? names.length - 3 : 0, count: rows.length,
243
+ problem: rows.some(function (r) { return r.status === "failed"; }),
244
+ });
245
+ });
246
+ if (meeting && typeof meeting === "object") {
247
+ const m = SOURCE_ROW_TOOLS.meet;
248
+ const name = typeof calendarName === "string" ? calendarName.replace(/\s+/g, " ").trim() : "";
249
+ out.push({ kind: "meet", tile: m.tile, toolName: m.toolName, names: name ? [name] : [], more: 0, count: 1, problem: meeting.status === "failed" });
250
+ }
251
+ return out;
252
+ }
216
253
  /**
217
254
  * 行の見え方(ボタンの並びと強さ・理由の文)。ボタンの順はいつも同じ: 接続を確認 → 通知先 → 〈鍵〉を変更する → この接続先を外す(右の端)。
218
255
  * 強くするのは「問題あり」のときの次にすることのボタン 1 つだけ。外すボタンは強くしない(赤い枠のまま)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takagaki/cortex-decisions-viewer",
3
- "version": "0.12.265",
3
+ "version": "0.12.268",
4
4
  "description": "Cortexの意思決定記録(Decisions/*.md)を静的サイトにビルドして閲覧する。各レコードに「Edit on GitHub」リンクを付与する。",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,