@takagaki/cortex-decisions-viewer 0.12.303 → 0.12.306

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.
@@ -21,6 +21,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var connection_words_exports = {};
22
22
  __export(connection_words_exports, {
23
23
  CONNECTION_WORDS: () => CONNECTION_WORDS,
24
+ PERSON_REGRANT_BUTTON: () => PERSON_REGRANT_BUTTON,
25
+ PERSON_ROW_WORDS: () => PERSON_ROW_WORDS,
24
26
  WORD_ACTS: () => WORD_ACTS,
25
27
  WORD_FIXERS: () => WORD_FIXERS,
26
28
  WORD_PLACES: () => WORD_PLACES,
@@ -219,9 +221,24 @@ function connectionWordLines(w, nouns, o) {
219
221
  const steps = d.steps.filter((s) => s.needs.every((k) => has[k])).map((s) => ({ act: s.act, text: fill(s.text) }));
220
222
  return { word: code, why: fill(d.why), steps, who: d.who ? fill(d.who) : "", fixer: d.fixer, transient: d.transient };
221
223
  }
224
+ var PERSON_ROW_WORDS = Object.freeze({
225
+ owner_unconfirmed: Object.freeze({
226
+ why: "\u3053\u306E\u30D5\u30A9\u30EB\u30C0\u3092\u8DB3\u3057\u305F\u4EBA\u306E Google \u306E\u8A31\u53EF\u304C\u5207\u308C\u307E\u3057\u305F\u3002\u8A31\u53EF\u3057\u76F4\u3059\u307E\u3067\u3001\u8AAD\u307F\u307E\u305B\u3093\u3002",
227
+ mine: "\u300C{confirm}\u300D\u3092\u62BC\u3057\u3066\u3001\u540C\u3058\u30D5\u30A9\u30EB\u30C0\u3092\u9078\u3073\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
228
+ other: "\u8A31\u53EF\u3057\u76F4\u305B\u308B\u306E\u306F\u3001\u3053\u306E\u30D5\u30A9\u30EB\u30C0\u3092\u8DB3\u3057\u305F\u4EBA\u3060\u3051\u3067\u3059\u3002\u8DB3\u3057\u305F\u4EBA\u306B\u983C\u3080\u304B\u3001\u300C\u3053\u306E\u63A5\u7D9A\u5148\u3092\u5916\u3059\u300D\u3067\u5916\u3057\u3066\u8DB3\u3057\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002"
229
+ }),
230
+ permission_missing: Object.freeze({
231
+ why: "\u3053\u306E\u30D5\u30A9\u30EB\u30C0\u3092\u8DB3\u3057\u305F\u4EBA\u306E Google \u306E\u8A31\u53EF\u3067\u306F\u3001\u3053\u306E\u30D5\u30A9\u30EB\u30C0\u3092\u958B\u3051\u306A\u304F\u306A\u308A\u307E\u3057\u305F\uFF08\u79FB\u3055\u308C\u305F\u30FB\u5171\u6709\u3092\u5916\u3055\u308C\u305F\uFF09\u3002",
232
+ mine: "\u30D5\u30A9\u30EB\u30C0\u3092\u958B\u3051\u308B Google \u30A2\u30AB\u30A6\u30F3\u30C8\u3067\u300C{confirm}\u300D\u3092\u62BC\u3057\u3066\u3001\u540C\u3058\u30D5\u30A9\u30EB\u30C0\u3092\u9078\u3073\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
233
+ other: "\u8A31\u53EF\u3057\u76F4\u305B\u308B\u306E\u306F\u3001\u3053\u306E\u30D5\u30A9\u30EB\u30C0\u3092\u8DB3\u3057\u305F\u4EBA\u3060\u3051\u3067\u3059\u3002\u8DB3\u3057\u305F\u4EBA\u306B\u983C\u3080\u304B\u3001\u300C\u3053\u306E\u63A5\u7D9A\u5148\u3092\u5916\u3059\u300D\u3067\u5916\u3057\u3066\u8DB3\u3057\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002"
234
+ })
235
+ });
236
+ var PERSON_REGRANT_BUTTON = "Google \u3067\u8A31\u53EF\u3057\u76F4\u3059";
222
237
  // Annotate the CommonJS export names for ESM import in node:
223
238
  0 && (module.exports = {
224
239
  CONNECTION_WORDS,
240
+ PERSON_REGRANT_BUTTON,
241
+ PERSON_ROW_WORDS,
225
242
  WORD_ACTS,
226
243
  WORD_FIXERS,
227
244
  WORD_PLACES,
@@ -120,6 +120,7 @@ __export(source_state_view_exports, {
120
120
  module.exports = __toCommonJS(source_state_view_exports);
121
121
 
122
122
  // ../infra/lambda/shared/secret-names.mjs
123
+ var PORTAL_USER_ID_RE = /^[0-9A-HJKMNP-TV-Z]{26}$/;
123
124
  var FLEET_LEGACY = {
124
125
  "intake-tokens": "cortex/intake/tokens",
125
126
  "backlog-webhook-tokens": "cortex/backlog-webhook/tokens",
@@ -528,7 +529,7 @@ var GITHUB_REPO_RE = /^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$/;
528
529
  var GITHUB_READS = Object.freeze(["issues", "discussions"]);
529
530
  var FIGMA_KEY_RE = /^[A-Za-z0-9_-]{8,}$/;
530
531
  var DRIVE_FOLDER_ID_RE = /^[A-Za-z0-9_-]+$/;
531
- var PORTAL_USER_ID_RE = /^[0-9A-HJKMNP-TV-Z]{26}$/;
532
+ var PORTAL_USER_ID_RE2 = /^[0-9A-HJKMNP-TV-Z]{26}$/;
532
533
  var GUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
533
534
  var TEAMS_CHANNEL_RE = /^19:\S+$/;
534
535
  var TEAMS_FOLDER_RE = /^\S+$/;
@@ -741,7 +742,7 @@ function checkDrive(conn, at, errors, ctx) {
741
742
  }
742
743
  checkKeys(p, ["kind", "userId"], pat, errors);
743
744
  if (p.kind !== "person") errors.push(`${pat}.kind \u306F person \u3060\u3051\u3067\u3059: ${JSON.stringify(p.kind)}`);
744
- if (typeof p.userId !== "string" || !PORTAL_USER_ID_RE.test(p.userId)) {
745
+ if (typeof p.userId !== "string" || !PORTAL_USER_ID_RE2.test(p.userId)) {
745
746
  errors.push(`${pat}.userId \u304C\u30DD\u30FC\u30BF\u30EB\u306E\u4EBA\u306E ID\uFF08\u5927\u6587\u5B57\u306E 26 \u5B57\uFF09\u306E\u5F62\u3067\u306F\u3042\u308A\u307E\u305B\u3093: ${JSON.stringify(p.userId)}`);
746
747
  }
747
748
  }
@@ -938,6 +939,16 @@ function sourceItemsOf(sources) {
938
939
  return out;
939
940
  }
940
941
 
942
+ // ../infra/lambda/shared/drive-person-token.mjs
943
+ var isObj3 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
944
+ var OWNER_INVALID = Object.freeze({ kind: "invalid" });
945
+ function driveOwnerOf(principal) {
946
+ if (principal === void 0) return null;
947
+ const ok = isObj3(principal) && Object.keys(principal).length === 2 && principal.kind === "person" && typeof principal.userId === "string" && PORTAL_USER_ID_RE.test(principal.userId);
948
+ return ok ? { kind: "person", userId: principal.userId } : OWNER_INVALID;
949
+ }
950
+ var DRIVE_PERSON_BUSY_403_REASONS = Object.freeze(["rateLimitExceeded", "userRateLimitExceeded", "dailyLimitExceeded", "sharingRateLimitExceeded"]);
951
+
941
952
  // ../infra/lambda/shared/adapters.mjs
942
953
  var GOLD_NIGHT_SCHEDULE = Object.freeze({
943
954
  via: "marker",
@@ -1752,10 +1763,10 @@ var ADAPTERS = [
1752
1763
  var SOURCE_CHECK_ROUTES = Object.freeze(["inline"]);
1753
1764
  var SOURCE_CHECK_FIELDS = Object.freeze(["fn", "none", "manual", "auto", "autoNone", "add", "route"]);
1754
1765
  var SOURCE_CHECK_ADD_FIELDS = Object.freeze(["notify", "ownerLogin", "origin", "key", "removable"]);
1755
- var isObj3 = (v) => v != null && typeof v === "object" && !Array.isArray(v);
1766
+ var isObj4 = (v) => v != null && typeof v === "object" && !Array.isArray(v);
1756
1767
  function sourceCheckOf(id, adapters = ADAPTERS) {
1757
1768
  const a = adapters.find((x) => x.id === id);
1758
- return a && isObj3(a.sourceCheck) ? a.sourceCheck : null;
1769
+ return a && isObj4(a.sourceCheck) ? a.sourceCheck : null;
1759
1770
  }
1760
1771
 
1761
1772
  // ../infra/lambda/shared/source-state.mjs
@@ -2186,11 +2197,23 @@ var WORD_TOOL_NOUNS = Object.freeze({
2186
2197
  "google-drive": Object.freeze({ partner: "Google Workspace", confirm: "Google \u3067\u78BA\u8A8D\u3059\u308B", connect: null }),
2187
2198
  "google-meet": Object.freeze({ partner: "Google Workspace", confirm: null, connect: null })
2188
2199
  });
2200
+ var PERSON_ROW_WORDS = Object.freeze({
2201
+ owner_unconfirmed: Object.freeze({
2202
+ why: "\u3053\u306E\u30D5\u30A9\u30EB\u30C0\u3092\u8DB3\u3057\u305F\u4EBA\u306E Google \u306E\u8A31\u53EF\u304C\u5207\u308C\u307E\u3057\u305F\u3002\u8A31\u53EF\u3057\u76F4\u3059\u307E\u3067\u3001\u8AAD\u307F\u307E\u305B\u3093\u3002",
2203
+ mine: "\u300C{confirm}\u300D\u3092\u62BC\u3057\u3066\u3001\u540C\u3058\u30D5\u30A9\u30EB\u30C0\u3092\u9078\u3073\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
2204
+ other: "\u8A31\u53EF\u3057\u76F4\u305B\u308B\u306E\u306F\u3001\u3053\u306E\u30D5\u30A9\u30EB\u30C0\u3092\u8DB3\u3057\u305F\u4EBA\u3060\u3051\u3067\u3059\u3002\u8DB3\u3057\u305F\u4EBA\u306B\u983C\u3080\u304B\u3001\u300C\u3053\u306E\u63A5\u7D9A\u5148\u3092\u5916\u3059\u300D\u3067\u5916\u3057\u3066\u8DB3\u3057\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002"
2205
+ }),
2206
+ permission_missing: Object.freeze({
2207
+ why: "\u3053\u306E\u30D5\u30A9\u30EB\u30C0\u3092\u8DB3\u3057\u305F\u4EBA\u306E Google \u306E\u8A31\u53EF\u3067\u306F\u3001\u3053\u306E\u30D5\u30A9\u30EB\u30C0\u3092\u958B\u3051\u306A\u304F\u306A\u308A\u307E\u3057\u305F\uFF08\u79FB\u3055\u308C\u305F\u30FB\u5171\u6709\u3092\u5916\u3055\u308C\u305F\uFF09\u3002",
2208
+ mine: "\u30D5\u30A9\u30EB\u30C0\u3092\u958B\u3051\u308B Google \u30A2\u30AB\u30A6\u30F3\u30C8\u3067\u300C{confirm}\u300D\u3092\u62BC\u3057\u3066\u3001\u540C\u3058\u30D5\u30A9\u30EB\u30C0\u3092\u9078\u3073\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
2209
+ other: "\u8A31\u53EF\u3057\u76F4\u305B\u308B\u306E\u306F\u3001\u3053\u306E\u30D5\u30A9\u30EB\u30C0\u3092\u8DB3\u3057\u305F\u4EBA\u3060\u3051\u3067\u3059\u3002\u8DB3\u3057\u305F\u4EBA\u306B\u983C\u3080\u304B\u3001\u300C\u3053\u306E\u63A5\u7D9A\u5148\u3092\u5916\u3059\u300D\u3067\u5916\u3057\u3066\u8DB3\u3057\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002"
2210
+ })
2211
+ });
2189
2212
 
2190
2213
  // ../infra/lambda/shared/source-state-view.mjs
2191
2214
  var SOURCES_VIEW_VERSION = 1;
2192
2215
  var SOURCES_UNAVAILABLE_REASONS = Object.freeze(["no-store", "read-failed", "bad-config"]);
2193
- var isObj4 = (v) => v != null && typeof v === "object" && !Array.isArray(v);
2216
+ var isObj5 = (v) => v != null && typeof v === "object" && !Array.isArray(v);
2194
2217
  var timeOf = (s) => typeof s === "string" ? Date.parse(s) : NaN;
2195
2218
  var DETAIL_MAX2 = 200;
2196
2219
  var NAME_MAX = 100;
@@ -2261,7 +2284,7 @@ function stateCoreOf(item, table = source_state_exports) {
2261
2284
  const detail = tag ? `${tag}${raw ? `,${raw}` : ""}`.slice(0, DETAIL_MAX2) : raw;
2262
2285
  return { ...base, reason, ...detail ? { detail } : {} };
2263
2286
  }
2264
- function buildSourcesView({ project, sources, calendar = null, items, notifyRows = [], secretsNow = null, table = source_state_exports }) {
2287
+ function buildSourcesView({ project, sources, calendar = null, items, notifyRows = [], secretsNow = null, viewerUserId = null, table = source_state_exports }) {
2265
2288
  let pk;
2266
2289
  try {
2267
2290
  pk = sourceStatePk(project);
@@ -2279,16 +2302,16 @@ function buildSourcesView({ project, sources, calendar = null, items, notifyRows
2279
2302
  };
2280
2303
  const s = parse(sources);
2281
2304
  const c = parse(calendar);
2282
- if (!isObj4(s) || !Array.isArray(s.connections) || c === void 0 || c !== null && !isObj4(c)) return sourcesUnavailable("bad-config");
2305
+ if (!isObj5(s) || !Array.isArray(s.connections) || c === void 0 || c !== null && !isObj5(c)) return sourcesUnavailable("bad-config");
2283
2306
  const bySk = /* @__PURE__ */ new Map();
2284
2307
  for (const it of Array.isArray(items) ? items : []) {
2285
- if (isObj4(it) && typeof it.sk === "string" && (it.pk === void 0 || it.pk === pk) && !bySk.has(it.sk)) bySk.set(it.sk, it);
2308
+ if (isObj5(it) && typeof it.sk === "string" && (it.pk === void 0 || it.pk === pk) && !bySk.has(it.sk)) bySk.set(it.sk, it);
2286
2309
  }
2287
- const on = new Set((Array.isArray(notifyRows) ? notifyRows : []).filter((r) => isObj4(r) && r.on === true).map((r) => `${r.kind} ${r.workspace ?? ""} ${r.ref}`));
2288
- const secrets = Array.isArray(secretsNow) ? secretsNow.filter(isObj4) : null;
2310
+ const on = new Set((Array.isArray(notifyRows) ? notifyRows : []).filter((r) => isObj5(r) && r.on === true).map((r) => `${r.kind} ${r.workspace ?? ""} ${r.ref}`));
2311
+ const secrets = Array.isArray(secretsNow) ? secretsNow.filter(isObj5) : null;
2289
2312
  const groups = /* @__PURE__ */ new Map();
2290
2313
  const seen = /* @__PURE__ */ new Set();
2291
- for (const conn of s.connections.filter(isObj4)) {
2314
+ for (const conn of s.connections.filter(isObj5)) {
2292
2315
  const cap = capOfTool(conn.tool);
2293
2316
  for (const it of sourceItemsOf({ connections: [conn] })) {
2294
2317
  const sc = sourceCheckOf(it.kind);
@@ -2322,6 +2345,14 @@ function buildSourcesView({ project, sources, calendar = null, items, notifyRows
2322
2345
  canOwnerLogin: !!(sc && sc.add.ownerLogin),
2323
2346
  removable: !!(sc && sc.add.removable)
2324
2347
  };
2348
+ if (conn.tool === "google-drive" && Array.isArray(conn.folders)) {
2349
+ const folder = conn.folders.find((f) => isObj5(f) && f.id === it.ref);
2350
+ const owner = folder ? driveOwnerOf(folder.principal) : null;
2351
+ if (owner && owner.kind === "person") {
2352
+ row.ownerKind = "person";
2353
+ row.ownerMine = typeof viewerUserId === "string" && viewerUserId !== "" && viewerUserId === owner.userId;
2354
+ }
2355
+ }
2325
2356
  if (sc && sc.add.origin && typeof conn[sc.add.origin.field] === "string" && conn[sc.add.origin.field]) {
2326
2357
  row.origin = { label: sc.add.origin.label, id: conn[sc.add.origin.field] };
2327
2358
  }
@@ -2359,7 +2390,7 @@ function buildSourcesView({ project, sources, calendar = null, items, notifyRows
2359
2390
  }
2360
2391
  function validateSourcesView(v, table = source_state_exports) {
2361
2392
  const errs = [];
2362
- if (!isObj4(v)) return ["sources \u304C\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u306F\u3042\u308A\u307E\u305B\u3093"];
2393
+ if (!isObj5(v)) return ["sources \u304C\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u306F\u3042\u308A\u307E\u305B\u3093"];
2363
2394
  const only = (obj, allowed, where) => {
2364
2395
  for (const k of Object.keys(obj)) if (!allowed.includes(k)) errs.push(`${where}.${k} \u306F\u5951\u7D04\u306B\u7121\u3044\u6B04\u3067\u3059`);
2365
2396
  };
@@ -2401,29 +2432,31 @@ function validateSourcesView(v, table = source_state_exports) {
2401
2432
  let problems = 0;
2402
2433
  v.groups.forEach((g, gi) => {
2403
2434
  const gw = `sources.groups[${gi}]`;
2404
- if (!isObj4(g)) return errs.push(`${gw} \u304C\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u306F\u3042\u308A\u307E\u305B\u3093`);
2435
+ if (!isObj5(g)) return errs.push(`${gw} \u304C\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u306F\u3042\u308A\u307E\u305B\u3093`);
2405
2436
  only(g, ["kind", "label", "count", "problems", "rows"], gw);
2406
2437
  if (!Array.isArray(g.rows)) return errs.push(`${gw}.rows \u306F\u914D\u5217\u3067\u3059`);
2407
- const gp = g.rows.filter((r) => isObj4(r) && r.status === "failed" && r.fixer !== "wait").length;
2438
+ const gp = g.rows.filter((r) => isObj5(r) && r.status === "failed" && r.fixer !== "wait").length;
2408
2439
  if (g.count !== g.rows.length) errs.push(`${gw}.count \u304C\u884C\u306E\u6570\u3068\u9055\u3044\u307E\u3059`);
2409
2440
  if (g.problems !== gp) errs.push(`${gw}.problems \u304C\u300C\u554F\u984C\u3042\u308A\u300D\u306E\u6570\u3068\u9055\u3044\u307E\u3059`);
2410
2441
  total += g.rows.length;
2411
2442
  problems += gp;
2412
2443
  g.rows.forEach((r, ri) => {
2413
2444
  const rw = `${gw}.rows[${ri}]`;
2414
- if (!isObj4(r)) return errs.push(`${rw} \u304C\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u306F\u3042\u308A\u307E\u305B\u3093`);
2415
- only(r, ["kind", "ref", "workspace", "name", "currentName", "status", "reason", "detail", "fixer", "checkedAt", "ingestedAt", "paused", "notify", "fixedIp", "origin", "key", "canCheck", "canOwnerLogin", "removable"], rw);
2445
+ if (!isObj5(r)) return errs.push(`${rw} \u304C\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u306F\u3042\u308A\u307E\u305B\u3093`);
2446
+ only(r, ["kind", "ref", "workspace", "name", "currentName", "status", "reason", "detail", "fixer", "checkedAt", "ingestedAt", "paused", "notify", "fixedIp", "origin", "key", "canCheck", "canOwnerLogin", "removable", "ownerKind", "ownerMine"], rw);
2416
2447
  if (r.kind !== g.kind) errs.push(`${rw}.kind \u304C\u307E\u3068\u307E\u308A\u3068\u9055\u3044\u307E\u3059`);
2417
2448
  for (const k of ["ref", "name"]) if (!(typeof r[k] === "string" && r[k])) errs.push(`${rw}.${k} \u306F\u7A7A\u3067\u306A\u3044\u6587\u5B57\u5217\u3067\u3059`);
2418
2449
  if ("currentName" in r && !(typeof r.currentName === "string" && r.currentName && r.currentName.length <= NAME_MAX && !CONTROL_RE.test(r.currentName))) errs.push(`${rw}.currentName \u306F ${NAME_MAX} \u5B57\u307E\u3067\u306E\u5236\u5FA1\u6587\u5B57\u306E\u306A\u3044\u6587\u5B57\u5217\u3067\u3059`);
2419
2450
  for (const k of ["paused", "notify", "fixedIp", "canCheck", "canOwnerLogin", "removable"]) if (typeof r[k] !== "boolean") errs.push(`${rw}.${k} \u306F\u771F\u507D\u5024\u3067\u3059`);
2451
+ if ("ownerKind" in r && r.ownerKind !== "person") errs.push(`${rw}.ownerKind \u306F "person" \u3060\u3051\u3067\u3059`);
2452
+ if ("ownerKind" in r !== "ownerMine" in r || "ownerMine" in r && typeof r.ownerMine !== "boolean") errs.push(`${rw}.ownerKind \u3068 ownerMine \u306F\u7D44\u3067\u3001ownerMine \u306F\u771F\u507D\u5024\u3067\u3059`);
2420
2453
  checkState(r, rw);
2421
2454
  checkFixer(r, rw);
2422
2455
  });
2423
2456
  });
2424
2457
  if (v.total !== total) errs.push("sources.total \u304C\u884C\u306E\u6570\u306E\u5408\u8A08\u3068\u9055\u3044\u307E\u3059");
2425
2458
  if (v.meeting !== null) {
2426
- if (!isObj4(v.meeting)) errs.push("sources.meeting \u306F\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u304B null \u3067\u3059");
2459
+ if (!isObj5(v.meeting)) errs.push("sources.meeting \u306F\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u304B null \u3067\u3059");
2427
2460
  else {
2428
2461
  only(v.meeting, ["status", "reason", "detail", "checkedAt", "ingestedAt"], "sources.meeting");
2429
2462
  checkState(v.meeting, "sources.meeting");
@@ -305,7 +305,7 @@ function googleConfirmPageJs() {
305
305
  function needsPerson(info) {
306
306
  var p = info && info.drivePerson;
307
307
  // 🔴 名乗りの券が無ければ挟まない(受け口は本人の棚を名乗りで引く。券が無いと connect-drive-person が通らず、承認を繰り返すだけになる)
308
- return ctx.kind === "drive" && !!ctx.ticket && !personDone && !!p && p.granted === false && typeof p.clientId === "string" && !!p.clientId;
308
+ return ctx.kind === "drive" && !!ctx.ticket && !personDone && !!p && (p.granted === false || ctx.regrant === true) && typeof p.clientId === "string" && !!p.clientId;
309
309
  }
310
310
  /**
311
311
  * 人の許可の承認(cortex-engine #3149): 認可コード+ID トークン(nonce を読むため)がフラグメントで返る・offline・初めての許可なので同意を出す。
@@ -415,6 +415,8 @@ function googleConfirmPageJs() {
415
415
  info = i;
416
416
  // 人の許可がまだなら、先にその承認へ(nonce の種別は drive-person・行の ID は結ばない)
417
417
  person = needsPerson(info);
418
+ // 許可し直しなのに人の許可の承認を挟めない(受け口が人の許可を返さない)なら、成功に見せず止める(cortex-engine #3420)
419
+ if (ctx.regrant === true && !personDone && !person) throw { message: UNAVAILABLE };
418
420
  if (person) return callIntake({ op: "google-nonce", kind: "drive-person" });
419
421
  var body = { op: "google-nonce", kind: ctx.kind };
420
422
  if (ctx.kind === "google-chat") body.url = ctx.url || ctx.id;
@@ -583,6 +585,8 @@ function googleConfirmPageJs() {
583
585
  ctx = { confirmNestedIds: d.kind === "drive" ? nestedIdsOf(d.confirmNestedIds) : [], intake: d.intake, ticket: typeof d.ticket === "string" ? d.ticket : null, kind: d.kind, mode: d.kind === "drive-account" ? "connect" : d.mode === "confirm" ? "confirm" : "add", url: typeof d.url === "string" ? d.url : "", id: d.kind === "drive-account" ? "" : typeof d.id === "string" ? d.id : "", intent: d.kind === "drive-account" ? null : intentOf(d.intent) };
584
586
  // まとめて選ぶ(Drive・意図が揃っているときだけ。揃わなければ今の流れ)。選び直しの一覧は形の合う ID だけ・押した行を先頭に・PICK_MAX(10)まで
585
587
  ctx.pick = d.pick === true && ctx.kind === "drive" && !!ctx.intent;
588
+ // 許可し直し(cortex-engine #3420): 棚に許可が残っていても人の許可の承認を挟み直す(切れた許可は棚の有無では分からない)
589
+ ctx.regrant = d.regrant === true && ctx.kind === "drive" && ctx.mode === "confirm";
586
590
  ctx.top = ctx.pick && ctx.mode === "confirm" && d.top === true && !!ctx.id;
587
591
  ctx.ids = !ctx.pick ? [] : [ctx.id].concat(Array.isArray(d.ids) ? d.ids : []).filter(function (x, i, a) { return typeof x === "string" && PICK_ID_RE.test(x) && a.indexOf(x) === i; }).slice(0, PICK_MAX);
588
592
  if (ctx.pick && ctx.mode === "confirm" && !ctx.top && !ctx.ids.length) ctx.pick = false;
package/dist/render.js CHANGED
@@ -5195,6 +5195,17 @@ a:hover { text-decoration: underline; }
5195
5195
  .sk-cmd .rt-copy-text { font-size: 12px; padding: 2px 8px; }
5196
5196
  .sk-use-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 12px; }
5197
5197
  .sk-use-row .ai-edit-btn { padding: 5px 12px; font-size: 13px; }
5198
+ .sk-import-btn, .sk-import-close { font-family: inherit; cursor: pointer; }
5199
+ .sk-import { margin: 0 0 14px; padding: 12px 14px; border: 1px solid var(--border, #d0d7de); border-radius: 8px; }
5200
+ .sk-import-title { margin: 0 0 8px; font-size: 14px; }
5201
+ .sk-import-note { margin: 0 0 8px; font-size: 13px; }
5202
+ .sk-import-list { display: flex; flex-direction: column; gap: 6px; margin: 0 0 10px; }
5203
+ .sk-import-opt { display: flex; align-items: center; gap: 8px; text-align: left; font: inherit; font-size: 13px; padding: 6px 10px; border: 1px solid var(--border, #d0d7de); border-radius: 6px; background: transparent; color: inherit; cursor: pointer; }
5204
+ .sk-import-opt.is-picked { border-color: var(--accent, #2563eb); box-shadow: 0 0 0 1px var(--accent, #2563eb); }
5205
+ .sk-import-opt:disabled { opacity: .55; cursor: not-allowed; }
5206
+ .sk-import-icon { width: 20px; height: 20px; border-radius: 4px; }
5207
+ .sk-import-actions { display: flex; align-items: center; gap: 12px; }
5208
+ .sk-import-close { background: none; border: none; color: inherit; text-decoration: underline; font-size: 13px; }
5198
5209
  /* 狭い幅では題を潰さずにボタンを題の下へ回す */
5199
5210
  .skills-page .detail-head { flex-wrap: wrap; }
5200
5211
  .skills-page .detail-head > div:first-child { flex: 1 1 280px; }
@@ -7232,6 +7243,12 @@ const CLIENT_JS = `
7232
7243
  }
7233
7244
  /** 行に人の確認の要る印(ownerPending)を重ねた写し(印が要らなければ元の行のまま)。行・タイル・[記憶の更新を開始]の確かめが同じ物を使う */
7234
7245
  function sourceOwnerRow(r) {
7246
+ // 許可し直しの口が使えない画面(栓が切・選ぶ受け口でない)では、人の行の印を外して今の文のまま(押せないボタンを名指さない・cortex-engine #3420)
7247
+ if (r && r.ownerKind === "person" && !(intakeKindOpen("drive") && googleConfirmReady() && googlePickOn())) {
7248
+ var plain = {};
7249
+ for (var pf in r) if (Object.prototype.hasOwnProperty.call(r, pf) && pf !== "ownerKind" && pf !== "ownerMine") plain[pf] = r[pf];
7250
+ r = plain;
7251
+ }
7235
7252
  if (!sourceOwnerPending(r)) return r;
7236
7253
  var out = {};
7237
7254
  for (var f in r) if (Object.prototype.hasOwnProperty.call(r, f)) out[f] = r[f];
@@ -7331,6 +7348,8 @@ const CLIENT_JS = `
7331
7348
  };
7332
7349
  if (intentNow()) start.intent = intent;
7333
7350
  if (nestedIds.length && opts.kind === "drive") start.confirmNestedIds = nestedIds.slice();
7351
+ // 許可し直し(cortex-engine #3420): 棚に許可が残っていても、人の許可の承認をもう一度挟む
7352
+ if (opts.regrant === true) start.regrant = true;
7334
7353
  if (opts.pick === true) {
7335
7354
  start.pick = true;
7336
7355
  if (Array.isArray(opts.ids)) start.ids = opts.ids;
@@ -7536,6 +7555,33 @@ const CLIENT_JS = `
7536
7555
  // note: 語 owner_unconfirmed の文が言わない訳(共有ドライブの一番上の行の「直下を選ぶ」)だけ。ほかは空(理由の箱と繰り返さない)
7537
7556
  return { btn: btn, msg: msg, why: words.why, note: words === GOOGLE_VERIFY_WORDS.driveTop ? words.why : "", setLocked: setLocked };
7538
7557
  }
7558
+ /**
7559
+ * 持ち主が人の Drive の行で、許可が切れた・開けなくなった時の[Google で許可し直す](cortex-engine #3420)。押せるのは持ち主だけ(行の ownerMine)。
7560
+ * 押すと人の許可の承認を挟み直し(regrant)、同じフォルダを選び直す。選べたら、その行の確かめ([接続を確認]と同じ口)を自分で走らせる
7561
+ * (選び直しは新しい行を足さないので、受け口は確かめを返さない)。確認済みの行にも出す(googleVerifyAction は確認済みの行に出さない)
7562
+ */
7563
+ function googleRegrantAction(r, btnClass, label) {
7564
+ if (!r || r.kind !== "drive" || !intakeKindOpen("drive") || !googleConfirmReady() || !googlePickOn()) return null;
7565
+ var msg = el("div", { class: "ds-toggle-msg src-gverify-msg" });
7566
+ var btn = el("button", { class: btnClass, type: "button", text: label, "data-src-act": "google-regrant" });
7567
+ var locked = false;
7568
+ btn.addEventListener("click", async function () {
7569
+ if (locked) return;
7570
+ btn.disabled = true;
7571
+ msg.className = "ds-toggle-msg src-gverify-msg";
7572
+ msg.textContent = "Google の画面で許可してください…";
7573
+ var res = await openGoogleConfirm({ kind: "drive", mode: "confirm", id: r.ref, url: r.ref, pick: true, top: false, ids: [r.ref], regrant: true });
7574
+ btn.disabled = locked;
7575
+ msg.className = "ds-toggle-msg src-gverify-msg" + (res.ok ? " is-ok" : " is-error");
7576
+ msg.textContent = (res.ok ? "✓ " : "✗ ") + res.message;
7577
+ if (res.ok) {
7578
+ afterGoogleConfirm();
7579
+ sourceCheck(r);
7580
+ }
7581
+ });
7582
+ function setLocked(v) { locked = !!v; btn.disabled = locked; }
7583
+ return { btn: btn, msg: msg, setLocked: setLocked };
7584
+ }
7539
7585
  /** 今ある行の「未確認」の印と[確認する](確認済みの行には何も足さない・期限で外さない) */
7540
7586
  function appendGoogleVerifyUi(row, kind, id) {
7541
7587
  // 組織の受け口は Google の接続先を受けない(確認の結果を保存する口が閉じている)
@@ -7790,6 +7836,8 @@ var SOURCE_ROW_TOOLS = ${JSON.stringify(source_rows_1.SOURCE_ROW_TOOLS)};
7790
7836
  // 訳の語の表(cortex-engine #3142)。行の理由の文と足す時の断りの 1 行は、ここから出す(束ねた原本の表と関数をそのまま流す・写さない)
7791
7837
  var CONNECTION_WORDS = ${JSON.stringify(source_rows_1.CONNECTION_WORDS)};
7792
7838
  var WORD_TOOL_NOUNS = ${JSON.stringify(source_rows_1.WORD_TOOL_NOUNS)};
7839
+ var PERSON_ROW_WORDS = ${JSON.stringify(source_rows_1.PERSON_ROW_WORDS)};
7840
+ var PERSON_REGRANT_BUTTON = ${JSON.stringify(source_rows_1.PERSON_REGRANT_BUTTON)};
7793
7841
  var SOURCE_ROW_ACTS = ${JSON.stringify(source_rows_1.SOURCE_ROW_ACTS)};
7794
7842
  var SOURCE_STEP_MARKS = ${JSON.stringify(source_rows_1.SOURCE_STEP_MARKS)};
7795
7843
  ${source_rows_1.connectionWordLines.toString()}
@@ -9320,11 +9368,13 @@ ${story_1.evidenceToggleHidden.toString()}
9320
9368
  a.setAttribute("data-ai-work", work);
9321
9369
  a.setAttribute("data-ai-read", read.join(","));
9322
9370
  }
9323
- function aiLink(cls, prompt, text) {
9324
- var read = ownDevRepos();
9325
- var a = el("a", { class: cls, href: claudeCodeUrl({ prompt: prompt, work: REPO_SLUG, read: read }), target: "_blank", rel: "noopener", text: text });
9371
+ // 第 4 引数(任意)は作業するリポ・読むリポを呼び出し側が決めるとき(取り込み・cortex-engine #3280 便 T3)。無ければ今まで通り自分のリポ+登録済みの開発リポ
9372
+ function aiLink(cls, prompt, text, repos) {
9373
+ var work = repos ? repos.work : REPO_SLUG;
9374
+ var read = repos ? repos.read : ownDevRepos();
9375
+ var a = el("a", { class: cls, href: claudeCodeUrl({ prompt: prompt, work: work, read: read }), target: "_blank", rel: "noopener", text: text });
9326
9376
  a.setAttribute("data-ai-prompt", prompt);
9327
- setAiRepos(a, REPO_SLUG, read);
9377
+ setAiRepos(a, work, read);
9328
9378
  return a;
9329
9379
  }
9330
9380
  // 接続状況が届いた・保存が効いたときに、画面に出ている AI 導線の href を組み直す。
@@ -9454,6 +9504,15 @@ ${story_1.evidenceToggleHidden.toString()}
9454
9504
  "何をするかは、まずわたしに質問してください。",
9455
9505
  ].join("\\n") + AI_COMMON;
9456
9506
  },
9507
+ // 他のプロジェクトのスキルを、このプロジェクトに取り込む(cortex-engine #3280 便 T3・設計 11-3 の文のまま)。
9508
+ // 元のリポ・名前・案件キーは外から書ける値なので aiFenceScrub を通す。元の案件キーは画面が知っている値(SITE.intake.projectKey)を渡す
9509
+ importSkill: function (sk, sourceRepo, originKey) {
9510
+ return [
9511
+ aiFenceScrub(sourceRepo) + " の .claude/skills/" + aiFenceScrub(sk.name) + "/ のスキルを、このプロジェクトに取り込んでください。",
9512
+ "スキル capture-skill の「よそのスキルを取り込む」の手順で進めてください。",
9513
+ "元の印は " + aiFenceScrub(originKey) + "/" + aiFenceScrub(sk.name) + " です。",
9514
+ ].join("\\n") + AI_COMMON;
9515
+ },
9457
9516
  };
9458
9517
  // 「AIで編集」の起動文の status の指示。**記憶 v2 の案件には出さない**(common.no-draft-lock・draft/active の印を持たない)。
9459
9518
  // 非 v2 は今のまま(statusKeepLine と同じ文)。v2 では null を返し、呼び出し側が filter(Boolean) で落とす
@@ -10280,6 +10339,8 @@ ${story_1.evidenceToggleHidden.toString()}
10280
10339
  function skillUrl(name) { return "?rail=skills" + (name ? "&skill=" + encodeURIComponent(name) : ""); }
10281
10340
  function goSkill(name) {
10282
10341
  SKILL_VIEW = name;
10342
+ IMPORT_OPEN = false;
10343
+ IMPORT_PICK = null;
10283
10344
  history.pushState({}, "", skillUrl(name));
10284
10345
  renderList();
10285
10346
  window.scrollTo(0, 0);
@@ -10346,6 +10407,97 @@ ${story_1.evidenceToggleHidden.toString()}
10346
10407
  function skillFactSlot(kind, sk, cls, tag) {
10347
10408
  return el(tag || "span", { class: cls, "data-skill-fact": kind, "data-skill-name": sk.name });
10348
10409
  }
10410
+ // ---- 取り込む(cortex-engine #3280 便 T3)----
10411
+ // 「使う」の行の[取り込む]で、同じ画面の中の枠(.sk-import)が開く。開いている印は URL の import=1(route が読む・閉じると外す)。
10412
+ // 候補(取り込める先)は intake の skill-import-targets を開いた時に 1 回だけ読み、ここでは絞らず並べ直さず描くだけ(絞るのはポータル)。
10413
+ // 🔴 確定は a(claudeCodeUrl が href を決める)。work は取り込み先のリポ・read は元のリポだけ(syncAiLinks は work が自分のリポでない a を組み直さない)。
10414
+ var IMPORT_OPEN = false;
10415
+ var IMPORT_PICK = null;
10416
+ var IMPORT_TARGETS = null;
10417
+ var importState = "idle";
10418
+ /** 取り込みの口を出せる構成か(元の案件キー・元のリポ・口・券が揃う時だけ。押しても読めない物を置かない) */
10419
+ function importAvailable() {
10420
+ return !!(SITE.intake && SITE.intake.projectKey && REPO_SLUG && intakeOpen("skill-import-targets") && actorTicket());
10421
+ }
10422
+ function loadImportTargets() {
10423
+ if (importState !== "idle" || !importAvailable()) return;
10424
+ importState = "loading";
10425
+ memberJson(callIntake("skill-import-targets", {})).then(function (r) {
10426
+ var list = r && r.ok && r.j && Array.isArray(r.j.targets) ? r.j.targets : null;
10427
+ // 読めなかった時はページを開いているあいだ聞き直さない(loadSkillFacts と同じ)
10428
+ importState = list ? "ok" : "failed";
10429
+ IMPORT_TARGETS = list || [];
10430
+ fillSkillImport();
10431
+ }, function () { importState = "failed"; IMPORT_TARGETS = []; fillSkillImport(); });
10432
+ }
10433
+ function setImportOpen(open) {
10434
+ IMPORT_OPEN = open;
10435
+ if (!open) IMPORT_PICK = null;
10436
+ try {
10437
+ var u = new URL(location.href);
10438
+ if (open) u.searchParams.set("import", "1"); else u.searchParams.delete("import");
10439
+ history.replaceState(history.state, "", u.search + u.hash);
10440
+ } catch (e) { /* 書き換えられなくても枠は出す */ }
10441
+ if (open) loadImportTargets();
10442
+ fillSkillImport();
10443
+ }
10444
+ /** 枠の中だけを埋め直す(全体の描き直しで選択が消えないように) */
10445
+ function fillSkillImport() {
10446
+ var slot = app.querySelector("[data-skill-import]");
10447
+ if (!slot) return;
10448
+ var sk = SKILL_VIEW ? skillByName(SKILL_VIEW) : null;
10449
+ slot.innerHTML = "";
10450
+ var btn = app.querySelector(".sk-import-btn");
10451
+ if (btn) btn.setAttribute("aria-expanded", IMPORT_OPEN ? "true" : "false");
10452
+ if (!sk || !IMPORT_OPEN || !importAvailable()) return;
10453
+ slot.appendChild(renderSkillImport(sk));
10454
+ // 描き直しでキーボードの位置が失われないよう、選んだ行へ戻す
10455
+ var picked = slot.querySelector(".sk-import-opt.is-picked");
10456
+ if (picked && picked.focus) picked.focus();
10457
+ }
10458
+ function renderSkillImport(sk) {
10459
+ var wrap = el("div", { class: "sk-import" });
10460
+ wrap.appendChild(el("h3", { class: "sk-import-title", text: "このスキルを取り込むプロジェクト" }));
10461
+ var targets = importState === "ok" ? IMPORT_TARGETS : [];
10462
+ if (importState === "idle" || importState === "loading") {
10463
+ wrap.appendChild(el("p", { class: "sk-import-note", text: "取り込み先を読み込んでいます…" }));
10464
+ } else if (importState === "failed") {
10465
+ wrap.appendChild(el("p", { class: "sk-import-note", text: "取り込み先を読み込めませんでした。再読み込みしてください" }));
10466
+ } else if (!targets.length) {
10467
+ wrap.appendChild(el("p", { class: "sk-import-note", text: "取り込めるプロジェクトがありません" }));
10468
+ } else {
10469
+ var list = el("div", { class: "sk-import-list", role: "group", "aria-label": "取り込み先" });
10470
+ targets.forEach(function (t) {
10471
+ if (!t || typeof t.name !== "string") return;
10472
+ var ok = typeof t.repository === "string" && isRepositorySlug(t.repository);
10473
+ var row = el("button", { type: "button", class: "sk-import-opt" + (ok && IMPORT_PICK === t.repository ? " is-picked" : ""), "aria-pressed": ok && IMPORT_PICK === t.repository ? "true" : "false" });
10474
+ if (typeof t.iconUrl === "string" && isHttp(t.iconUrl)) row.appendChild(el("img", { class: "sk-import-icon", src: t.iconUrl, alt: "" }));
10475
+ row.appendChild(el("span", { class: "sk-import-name", text: t.name }));
10476
+ if (!ok) {
10477
+ row.disabled = true;
10478
+ row.appendChild(el("span", { class: "sk-import-hint", text: "(リポジトリを確認できないため選べません)" }));
10479
+ } else {
10480
+ row.addEventListener("click", function () { IMPORT_PICK = t.repository; fillSkillImport(); });
10481
+ }
10482
+ list.appendChild(row);
10483
+ });
10484
+ wrap.appendChild(list);
10485
+ }
10486
+ var acts = el("div", { class: "sk-import-actions" });
10487
+ var go;
10488
+ if (IMPORT_PICK && importState === "ok") {
10489
+ go = aiLink("ai-edit-btn sk-import-go", AI_PROMPTS.importSkill(sk, REPO_SLUG, SITE.intake.projectKey), "このプロジェクトに取り込む", { work: IMPORT_PICK, read: [REPO_SLUG] });
10490
+ } else {
10491
+ go = el("a", { class: "ai-edit-btn sk-import-go", text: "このプロジェクトに取り込む" });
10492
+ disableDetailLink(go);
10493
+ }
10494
+ acts.appendChild(go);
10495
+ var close = el("button", { type: "button", class: "sk-import-close", text: "閉じる" });
10496
+ close.addEventListener("click", function () { setImportOpen(false); });
10497
+ acts.appendChild(close);
10498
+ wrap.appendChild(acts);
10499
+ return wrap;
10500
+ }
10349
10501
  function renderSkills() {
10350
10502
  var box = el("section", { class: "skills-page" });
10351
10503
  app.appendChild(box);
@@ -10362,6 +10514,7 @@ ${story_1.evidenceToggleHidden.toString()}
10362
10514
  else renderSkillList(box);
10363
10515
  fillSkillFacts();
10364
10516
  loadSkillFacts();
10517
+ if (sk && IMPORT_OPEN) { loadImportTargets(); fillSkillImport(); }
10365
10518
  }
10366
10519
  function renderSkillList(box) {
10367
10520
  box.appendChild(el("h2", { text: "スキル" }));
@@ -10467,7 +10620,14 @@ ${story_1.evidenceToggleHidden.toString()}
10467
10620
 
10468
10621
  // 使う口の 1 行: コマンドのチップ+コピー+「AIで使う」(取り込むは便 T3 が同じ行に足す)
10469
10622
  var cmd = skillCopyChip("/" + sk.name);
10470
- box.appendChild(el("div", { class: "sk-use-row" }, [cmd, aiLink("ai-edit-btn sk-use-btn", AI_PROMPTS.skillUse(sk), "AIで使う")]));
10623
+ var useRow = el("div", { class: "sk-use-row" }, [cmd, aiLink("ai-edit-btn sk-use-btn", AI_PROMPTS.skillUse(sk), "AIで使う")]);
10624
+ if (importAvailable()) {
10625
+ var impBtn = el("button", { type: "button", class: "ai-edit-btn sk-use-btn sk-import-btn", text: "取り込む", "aria-expanded": IMPORT_OPEN ? "true" : "false" });
10626
+ impBtn.addEventListener("click", function () { setImportOpen(!IMPORT_OPEN); });
10627
+ useRow.appendChild(impBtn);
10628
+ }
10629
+ box.appendChild(useRow);
10630
+ if (importAvailable()) box.appendChild(el("div", { class: "sk-import-slot", "data-skill-import": "1" }));
10471
10631
 
10472
10632
  var meta = el("div", { class: "detail-meta sk-detail-meta" });
10473
10633
  if (sk.author) {
@@ -19694,7 +19854,14 @@ ${intake_scope_1.tenantIntakeOpen.toString()}
19694
19854
  // 持ち主の確かめは、人の確認が済んでいない行(sourceOwnerPending・門が掛かる時だけ)に、[Google で確認する]を行の右のボタン群に 1 つ(外すの左・便 S44-5d の直し 2)。
19695
19855
  // 札は「要対応」の 1 つ・文は語 owner_unconfirmed(「接続OK」と「確認がまだ」を同時に出さない・cortex-engine #3142)。強いボタンはこれ 1 つ。
19696
19856
  // 古い「未確認」の札と[確認する](gc-verify-row)は組み直したプロジェクトの行に出さない
19697
- var gverify = open && sourceOwnerPending(r) ? googleVerifyAction(r.kind, r.ref, "src-btn" + (v.ownerStrong ? " is-strong" : "")) : null;
19857
+ // 持ち主が人の行の[Google で許可し直す](持ち主だけ・cortex-engine #3420)。出る行は[Google で選び直す]を置き換える(押す先は同じ選ぶ流れ)
19858
+ var regrant = open && v.regrant === "button" ? googleRegrantAction(r, "src-btn is-strong", v.regrantText) : null;
19859
+ if (regrant) {
19860
+ regrant.setLocked(busy || saving);
19861
+ var outBtn2 = acts.querySelector('[data-src-act="remove"]');
19862
+ if (outBtn2) acts.insertBefore(regrant.btn, outBtn2); else acts.appendChild(regrant.btn);
19863
+ }
19864
+ var gverify = open && !regrant && sourceOwnerPending(r) && !(v.regrant) ? googleVerifyAction(r.kind, r.ref, "src-btn" + (v.ownerStrong ? " is-strong" : "")) : null;
19698
19865
  if (gverify) {
19699
19866
  gverify.setLocked(busy || saving);
19700
19867
  var outBtn = acts.querySelector('[data-src-act="remove"]');
@@ -19731,6 +19898,7 @@ ${intake_scope_1.tenantIntakeOpen.toString()}
19731
19898
  if (SOURCE_KEY_NOTES[key]) item.appendChild(el("div", { class: "ds-toggle-msg is-ok src-key-note", text: SOURCE_KEY_NOTES[key] }));
19732
19899
  if (SOURCE_NOTES[key]) item.appendChild(el("div", { class: "ds-toggle-msg is-error", text: SOURCE_NOTES[key] }));
19733
19900
  if (gverify) item.appendChild(gverify.msg);
19901
+ if (regrant) item.appendChild(regrant.msg);
19734
19902
  if (saving) item.appendChild(el("div", { class: "ds-toggle-msg ds-config-saving", text: "保存中…" }));
19735
19903
  var note = saving ? null : configNoteEl(key);
19736
19904
  if (note) item.appendChild(note);
@@ -28287,6 +28455,8 @@ ${intake_scope_1.tenantIntakeOpen.toString()}
28287
28455
  if (rail === "skills" && HAS_SKILLS) {
28288
28456
  railPage = "skills";
28289
28457
  SKILL_VIEW = getParam("skill") || null;
28458
+ IMPORT_OPEN = !!SKILL_VIEW && getParam("import") === "1";
28459
+ IMPORT_PICK = null;
28290
28460
  renderList();
28291
28461
  return;
28292
28462
  }
@@ -11,7 +11,7 @@
11
11
  * - 理由の文・次の一手は訳の語の表(tools `infra/lambda/shared/connection-words.mjs`・仕様書 `docs/connection-experience-spec.md` §4)から出す
12
12
  */
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.SOURCE_FIXED_IP_WAIT_TEXT = exports.SOURCE_CHECK_FAILED_TEXT = exports.SOURCE_TILE_WORDS = exports.SOURCE_INGEST_NONE = exports.SOURCE_INGEST_HEAD = exports.SOURCE_STATE_WORDS = exports.SOURCE_CORTEX_TEXT = exports.SOURCE_RATE_UNTIL_TEXT = exports.SOURCE_UNTIL_FIXED_TEXT = exports.SOURCE_CHECK_WORD = exports.SOURCE_NEXT_NO_CHECK = exports.SOURCE_NEXT_TAIL_AUTO = exports.SOURCE_NEXT_TAIL_CHECK = exports.SOURCE_STEP_MARKS = exports.SOURCE_ROW_ACTS = exports.connectionWordLines = exports.WORD_TOOL_NOUNS = exports.CONNECTION_WORDS = exports.SOURCE_JOIN_STEPS = exports.SOURCE_ROW_TOOLS = exports.SOURCE_MEMORY_OFF_NOTE = exports.SOURCE_ADD_NOT_YET_TEXT = exports.SOURCE_ADD_OK_TEXT = void 0;
14
+ exports.SOURCE_FIXED_IP_WAIT_TEXT = exports.SOURCE_CHECK_FAILED_TEXT = exports.SOURCE_TILE_WORDS = exports.SOURCE_INGEST_NONE = exports.SOURCE_INGEST_HEAD = exports.SOURCE_STATE_WORDS = exports.SOURCE_CORTEX_TEXT = exports.SOURCE_RATE_UNTIL_TEXT = exports.SOURCE_UNTIL_FIXED_TEXT = exports.SOURCE_CHECK_WORD = exports.SOURCE_NEXT_NO_CHECK = exports.SOURCE_NEXT_TAIL_AUTO = exports.SOURCE_NEXT_TAIL_CHECK = exports.SOURCE_STEP_MARKS = exports.SOURCE_ROW_ACTS = exports.connectionWordLines = exports.WORD_TOOL_NOUNS = exports.PERSON_REGRANT_BUTTON = exports.PERSON_ROW_WORDS = exports.CONNECTION_WORDS = exports.SOURCE_JOIN_STEPS = exports.SOURCE_ROW_TOOLS = exports.SOURCE_MEMORY_OFF_NOTE = exports.SOURCE_ADD_NOT_YET_TEXT = exports.SOURCE_ADD_OK_TEXT = void 0;
15
15
  exports.sourceReasonLines = sourceReasonLines;
16
16
  exports.sourceWordConnects = sourceWordConnects;
17
17
  exports.sourceAddWordLines = sourceAddWordLines;
@@ -55,10 +55,12 @@ exports.SOURCE_JOIN_STEPS = SOURCE_JOIN_STEPS;
55
55
  * 画面へは表を `JSON.stringify`・`connectionWordLines` を `toString()` で流す(render.ts)。名詞は `SOURCE_ROW_TOOLS` + 語の表の `WORD_TOOL_NOUNS`(鍵は `tool`)
56
56
  */
57
57
  // eslint-disable-next-line @typescript-eslint/no-var-requires
58
- const { CONNECTION_WORDS, WORD_TOOL_NOUNS, connectionWordLines } = require("./engine/connection-words");
58
+ const { CONNECTION_WORDS, WORD_TOOL_NOUNS, connectionWordLines, PERSON_ROW_WORDS, PERSON_REGRANT_BUTTON } = require("./engine/connection-words");
59
59
  exports.CONNECTION_WORDS = CONNECTION_WORDS;
60
60
  exports.WORD_TOOL_NOUNS = WORD_TOOL_NOUNS;
61
61
  exports.connectionWordLines = connectionWordLines;
62
+ exports.PERSON_ROW_WORDS = PERSON_ROW_WORDS;
63
+ exports.PERSON_REGRANT_BUTTON = PERSON_REGRANT_BUTTON;
62
64
  /** 一手の押す物のうち、行のボタンにある物(強くする候補) */
63
65
  const SOURCE_ROW_ACTS = ["check", "key", "owner"];
64
66
  exports.SOURCE_ROW_ACTS = SOURCE_ROW_ACTS;
@@ -414,9 +416,19 @@ function sourceRowView(row, busy, nowMs, copies) {
414
416
  let strong = null;
415
417
  let gap = "";
416
418
  let connect = false;
417
- const owner = r.ownerPending === true && facts.state === "user";
419
+ // 持ち主が人の Drive の行で、許可が切れた・フォルダを開けなくなった時(cortex-engine #3420)。文は行の持ち主に向け、押せるのは持ち主だけ
420
+ // 人の確認が済んでいない印(ownerPending)の行は理由を持たない(画面が足す印)ので、語は owner_unconfirmed として引く
421
+ const personReason = r.ownerPending === true && !r.reason ? "owner_unconfirmed" : String(r.reason || "");
422
+ const personWord = r.ownerKind === "person" && facts.state === "user" && Object.prototype.hasOwnProperty.call(PERSON_ROW_WORDS, personReason) ? PERSON_ROW_WORDS[personReason] : null;
423
+ const regrant = personWord ? (r.ownerMine === true ? "button" : "ask") : null;
424
+ const owner = !personWord && r.ownerPending === true && facts.state === "user";
418
425
  const shown = facts.state === "user" || facts.state === "cortex";
419
- if (shown) {
426
+ if (personWord) {
427
+ why = personWord.why;
428
+ next = (regrant === "button" ? personWord.mine : personWord.other).split("{confirm}").join(PERSON_REGRANT_BUTTON);
429
+ gap = sourceReasonLines(r.kind, "unreadable", "user", "", nowMs).gap;
430
+ }
431
+ else if (shown) {
420
432
  const l = sourceReasonLines(r.kind, owner ? "owner_unconfirmed" : String(r.reason || ""), facts.state, owner ? "" : typeof r.detail === "string" ? r.detail : "", nowMs, owner && typeof r.ownerConfirm === "string" ? r.ownerConfirm : undefined);
421
433
  why = l.why;
422
434
  next = l.next;
@@ -443,7 +455,7 @@ function sourceRowView(row, busy, nowMs, copies) {
443
455
  const copyVal = copyKey && copies && typeof copies[copyKey] === "string" ? copies[copyKey] : "";
444
456
  const st = copyKey && Object.prototype.hasOwnProperty.call(SOURCE_JOIN_STEPS, copyKey) ? SOURCE_JOIN_STEPS[copyKey] : null;
445
457
  const steps = shown && !owner && next && r.reason === "not_member" && copyVal && st ? [st.before, { copy: copyVal }, st.after] : null;
446
- return { facts: facts, buttons: buttons, why: why, gap: gap, next: next, connect: connect, detail: shown && !owner && typeof r.detail === "string" ? r.detail : "", ownerStrong: strong === "owner", steps: steps };
458
+ return { facts: facts, buttons: buttons, why: why, gap: gap, next: next, connect: connect, detail: shown && !owner && !personWord && typeof r.detail === "string" ? r.detail : "", ownerStrong: strong === "owner", regrant: regrant, regrantText: PERSON_REGRANT_BUTTON, steps: steps };
447
459
  }
448
460
  /**
449
461
  * 会議のまとまりの頭(画面 9)。会議は行にしない。状態のかたまりと、要対応・Cortex 側で対応中のときは理由と次にすること、待てば直る時は語の文を 1 文。ボタンは無い。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takagaki/cortex-decisions-viewer",
3
- "version": "0.12.303",
3
+ "version": "0.12.306",
4
4
  "description": "Cortexの意思決定記録(Decisions/*.md)を静的サイトにビルドして閲覧する。各レコードに「Edit on GitHub」リンクを付与する。",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,