@skillcdn/console 0.4.6 → 0.4.7

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 (131) hide show
  1. package/README.md +4 -4
  2. package/dist/api.d.ts +2 -2
  3. package/dist/api.d.ts.map +1 -1
  4. package/dist/api.js +2 -2
  5. package/dist/api.js.map +1 -1
  6. package/dist/cli/cli.d.ts +6 -0
  7. package/dist/cli/cli.d.ts.map +1 -1
  8. package/dist/cli/cli.js +60 -30
  9. package/dist/cli/cli.js.map +1 -1
  10. package/dist/cli/format.d.ts.map +1 -1
  11. package/dist/cli/format.js +1 -0
  12. package/dist/cli/format.js.map +1 -1
  13. package/dist/cli/help.js +5 -5
  14. package/dist/cli/help.js.map +1 -1
  15. package/dist/cli/keys.d.ts +10 -0
  16. package/dist/cli/keys.d.ts.map +1 -0
  17. package/dist/cli/keys.js +59 -0
  18. package/dist/cli/keys.js.map +1 -0
  19. package/dist/cli/main.js +2 -1
  20. package/dist/cli/main.js.map +1 -1
  21. package/dist/cli/terminal.d.ts +7 -0
  22. package/dist/cli/terminal.d.ts.map +1 -1
  23. package/dist/cli/terminal.js +39 -0
  24. package/dist/cli/terminal.js.map +1 -1
  25. package/dist/client.d.ts +7 -1
  26. package/dist/client.d.ts.map +1 -1
  27. package/dist/client.js +4 -1
  28. package/dist/client.js.map +1 -1
  29. package/dist/components/plugin-frame.d.ts.map +1 -1
  30. package/dist/components/plugin-frame.js +53 -10
  31. package/dist/components/plugin-frame.js.map +1 -1
  32. package/dist/components/sessions.d.ts +15 -0
  33. package/dist/components/sessions.d.ts.map +1 -0
  34. package/dist/components/sessions.js +17 -0
  35. package/dist/components/sessions.js.map +1 -0
  36. package/dist/components/shell.d.ts.map +1 -1
  37. package/dist/components/shell.js +198 -28
  38. package/dist/components/shell.js.map +1 -1
  39. package/dist/components/workspace.d.ts +2 -0
  40. package/dist/components/workspace.d.ts.map +1 -1
  41. package/dist/components/workspace.js +19 -4
  42. package/dist/components/workspace.js.map +1 -1
  43. package/dist/console.css +228 -21
  44. package/dist/console.d.ts +5 -2
  45. package/dist/console.d.ts.map +1 -1
  46. package/dist/console.js +106 -21
  47. package/dist/console.js.map +1 -1
  48. package/dist/data.d.ts +7 -1
  49. package/dist/data.d.ts.map +1 -1
  50. package/dist/data.js +26 -5
  51. package/dist/data.js.map +1 -1
  52. package/dist/i18n/en.d.ts +24 -0
  53. package/dist/i18n/en.d.ts.map +1 -1
  54. package/dist/i18n/en.js +21 -0
  55. package/dist/i18n/en.js.map +1 -1
  56. package/dist/i18n/index.d.ts +2 -2
  57. package/dist/i18n/index.d.ts.map +1 -1
  58. package/dist/i18n/index.js +7 -3
  59. package/dist/i18n/index.js.map +1 -1
  60. package/dist/i18n/ko.d.ts.map +1 -1
  61. package/dist/i18n/ko.js +23 -2
  62. package/dist/i18n/ko.js.map +1 -1
  63. package/dist/index.d.ts +1 -0
  64. package/dist/index.d.ts.map +1 -1
  65. package/dist/index.js +1 -0
  66. package/dist/index.js.map +1 -1
  67. package/dist/plugin/bridge.d.ts +3 -0
  68. package/dist/plugin/bridge.d.ts.map +1 -1
  69. package/dist/plugin/bridge.js +1 -0
  70. package/dist/plugin/bridge.js.map +1 -1
  71. package/dist/plugin/context.d.ts +9 -0
  72. package/dist/plugin/context.d.ts.map +1 -1
  73. package/dist/plugin/define.d.ts.map +1 -1
  74. package/dist/plugin/define.js +6 -3
  75. package/dist/plugin/define.js.map +1 -1
  76. package/dist/plugin/sandbox.d.ts.map +1 -1
  77. package/dist/plugin/sandbox.js +8 -1
  78. package/dist/plugin/sandbox.js.map +1 -1
  79. package/dist/router.d.ts +6 -0
  80. package/dist/router.d.ts.map +1 -1
  81. package/dist/router.js +5 -0
  82. package/dist/router.js.map +1 -1
  83. package/dist/routes.d.ts +3 -1
  84. package/dist/routes.d.ts.map +1 -1
  85. package/dist/routes.js +2 -0
  86. package/dist/routes.js.map +1 -1
  87. package/dist/schemas.d.ts +38 -0
  88. package/dist/schemas.d.ts.map +1 -1
  89. package/dist/schemas.js +37 -1
  90. package/dist/schemas.js.map +1 -1
  91. package/dist/tokens.d.ts.map +1 -1
  92. package/dist/tokens.js +1 -0
  93. package/dist/tokens.js.map +1 -1
  94. package/dist/vocabulary.d.ts +6 -0
  95. package/dist/vocabulary.d.ts.map +1 -1
  96. package/dist/vocabulary.js +7 -0
  97. package/dist/vocabulary.js.map +1 -1
  98. package/docs/specs/cli.md +3 -3
  99. package/docs/specs/plugins.md +7 -6
  100. package/docs/specs/rest.md +9 -5
  101. package/package.json +1 -1
  102. package/skills/building-a-plugin/SKILL.md +2 -2
  103. package/skills/planning-the-board/references/setting-up.md +1 -1
  104. package/src/api.ts +6 -0
  105. package/src/cli/cli.ts +81 -29
  106. package/src/cli/format.ts +1 -0
  107. package/src/cli/help.ts +5 -5
  108. package/src/cli/keys.ts +69 -0
  109. package/src/cli/main.ts +2 -1
  110. package/src/cli/terminal.ts +40 -0
  111. package/src/client.ts +14 -0
  112. package/src/components/plugin-frame.tsx +72 -17
  113. package/src/components/sessions.tsx +108 -0
  114. package/src/components/shell.tsx +265 -52
  115. package/src/components/workspace.tsx +46 -2
  116. package/src/console.tsx +181 -16
  117. package/src/data.ts +33 -5
  118. package/src/i18n/en.ts +25 -0
  119. package/src/i18n/index.ts +11 -3
  120. package/src/i18n/ko.ts +27 -2
  121. package/src/index.ts +1 -0
  122. package/src/plugin/bridge.ts +4 -0
  123. package/src/plugin/context.ts +9 -0
  124. package/src/plugin/define.ts +10 -2
  125. package/src/plugin/sandbox.ts +9 -1
  126. package/src/router.ts +7 -0
  127. package/src/routes.ts +3 -1
  128. package/src/schemas.ts +41 -0
  129. package/src/styles/console.css +228 -21
  130. package/src/tokens.ts +1 -0
  131. package/src/vocabulary.ts +9 -0
package/src/i18n/ko.ts CHANGED
@@ -222,6 +222,7 @@ export const ko: Messages = {
222
222
  "task.too_many": "프로젝트에 만들 수 있는 작업 수를 다 채웠습니다.",
223
223
  "token.expiry_at_most": "이 콘솔에서는 토큰을 그렇게 오래 쓰도록 만들 수 없습니다.",
224
224
  "token.not_found": "토큰을 찾을 수 없습니다.",
225
+ "session.not_found": "세션을 찾을 수 없습니다.",
225
226
  "token.too_many": "만들 수 있는 토큰 수를 다 채웠습니다. 먼저 하나를 삭제하세요.",
226
227
  "workspace.pack_connect_refused": "SkillCDN이 연결을 거부했습니다.",
227
228
  "workspace.pack_connect_unsupported": "이 콘솔에서는 팩을 연결할 수 없습니다.",
@@ -500,7 +501,7 @@ export const ko: Messages = {
500
501
  packToken: {
501
502
  aria: "SkillCDN 토큰",
502
503
  intro:
503
- "비공개 팩은 저장소에 대한 SkillCDN 토큰으로 읽습니다. 공개 팩에는 필요 없습니다. SkillCDN에서 승인한 코드로 연결하거나, 거기서 직접 만든 토큰을 붙여 넣으세요. 콘솔은 토큰을 봉인해 보관하고 누구에게도 보여 주지 않습니다. 조직의 팩을 읽는 프로젝트는 워크스페이스 설정의 토큰을 그대로 쓸 수 있습니다.",
504
+ "비공개 팩은 저장소에 대한 SkillCDN 토큰으로 읽습니다. 공개 팩에는 필요 없습니다. SkillCDN에서 승인한 코드로 연결하거나, 거기서 직접 만든 토큰을 붙여 넣으세요. 콘솔은 토큰을 암호화해 보관하고 누구에게도 보여 주지 않습니다. 조직의 팩을 읽는 프로젝트는 워크스페이스 설정의 토큰을 그대로 쓸 수 있습니다.",
504
505
  connectTitle: "SkillCDN에서 승인한 코드로",
505
506
  pasteTitle: "직접 만든 토큰으로",
506
507
  pasteAria: "토큰 붙여넣기",
@@ -854,6 +855,7 @@ export const ko: Messages = {
854
855
 
855
856
  settings: {
856
857
  title: "설정",
858
+ views: { aria: "설정", workspace: "워크스페이스", sessions: "로그인 세션" },
857
859
  categories: "카테고리",
858
860
  manageCategories: "카테고리 관리",
859
861
  skills: "스킬",
@@ -864,12 +866,16 @@ export const ko: Messages = {
864
866
  "콘솔을 운영하는 쪽이 설정으로 정합니다. 스킬을 읽어 오는 배포와 조직의 주소.",
865
867
  skillsToken: "SkillCDN 토큰",
866
868
  skillsTokenIntro:
867
- "자기 주소도 자기 토큰도 없는 모든 프로젝트가 이 토큰으로 조직의 팩을 읽습니다. 공개 팩에는 필요 없습니다. SkillCDN에서 승인한 코드로 연결하거나, 거기서 직접 만든 토큰을 붙여 넣으세요. 콘솔은 토큰을 봉인해 보관하고 누구에게도 보여 주지 않습니다.",
869
+ "자기 주소도 자기 토큰도 없는 모든 프로젝트가 이 토큰으로 조직의 팩을 읽습니다. 공개 팩에는 필요 없습니다. SkillCDN에서 승인한 코드로 연결하거나, 거기서 직접 만든 토큰을 붙여 넣으세요. 콘솔은 토큰을 암호화해 보관하고 누구에게도 보여 주지 않습니다.",
868
870
  workspace: {
869
871
  title: "워크스페이스",
870
872
  aria: "워크스페이스 설정",
871
873
  consoleVersion: "콘솔 버전",
872
874
  consoleTakes: (range) => `받는 console 명령: ${range}`,
875
+ language: "기본 언어",
876
+ languageHint:
877
+ "언어를 정하지 않은 사람에게 쓰는 언어입니다. 브라우저가 콘솔이 쓰지 않는 언어만 요청하는 사람에게 화면이 이 언어로 나오고, 콘솔을 한 번도 열지 않은 사람에게 플러그인이 결정·태스크·채팅으로 쓰는 글도 이 언어로 씁니다. 자기 언어를 정한 사람은 그대로입니다.",
878
+ languageNone: "정하지 않음: 영어",
873
879
  peopleVisibility: "멤버 공개 범위",
874
880
  peopleVisibilityHint:
875
881
  "멤버가 사람들 페이지와 선택 목록에서 보는 범위: 워크스페이스의 모두, 또는 같은 프로젝트에 속한 사람만. 관리자는 언제나 모두를 보고, 워크스페이스에 공개된 프로젝트에는 모두가 속합니다.",
@@ -965,6 +971,7 @@ export const ko: Messages = {
965
971
  peopleVisibility: "멤버 공개 범위",
966
972
  weekStart: "주의 시작 요일",
967
973
  timeZone: "타임존",
974
+ language: "기본 언어",
968
975
  packToken: "SkillCDN 토큰",
969
976
  },
970
977
  event: {
@@ -1345,6 +1352,24 @@ export const ko: Messages = {
1345
1352
  },
1346
1353
  },
1347
1354
 
1355
+ sessions: {
1356
+ title: "로그인 세션",
1357
+ list: "내 로그인 세션",
1358
+ loading: "로그인 세션을 불러오는 중",
1359
+ intro:
1360
+ "내 계정으로 로그인한 브라우저입니다. 모르는 브라우저나 더 쓰지 않는 브라우저는 로그아웃하세요.",
1361
+ introIdle: (days) =>
1362
+ `내 계정으로 로그인한 브라우저입니다. 모르는 브라우저나 더 쓰지 않는 브라우저는 로그아웃하세요. ${days}일 동안 쓰지 않은 세션은 자동으로 로그아웃됩니다.`,
1363
+ current: "현재 세션",
1364
+ on: (browser, platform) => `${browser} · ${platform}`,
1365
+ unknownBrowser: "알 수 없는 브라우저",
1366
+ lastActive: "마지막 활동",
1367
+ signedIn: "로그인",
1368
+ from: (address) => `IP ${address}`,
1369
+ end: "로그아웃",
1370
+ endOthers: "다른 세션 모두 로그아웃",
1371
+ },
1372
+
1348
1373
  connect: {
1349
1374
  title: "에이전트 연결",
1350
1375
  aria: "연결",
package/src/index.ts CHANGED
@@ -188,6 +188,7 @@ export {
188
188
  peopleSearch,
189
189
  projectsSearch,
190
190
  } from "./components/searches.js";
191
+ export { SessionList, type SessionListProps } from "./components/sessions.js";
191
192
  export {
192
193
  type Brand,
193
194
  isPlainClick,
@@ -45,6 +45,9 @@ export interface BridgePerson {
45
45
  /** The workspace as a page lays itself out for it: what it is called, the languages it writes in, its clock and the day its week begins on. */
46
46
  export interface BridgeWorkspace {
47
47
  readonly name: string;
48
+ /** The language for whoever has none of their own (ADR-0081): the workspace's, else `en`; none from a console older than it. */
49
+ readonly language?: string;
50
+ /** The languages the console speaks, the workspace's first. */
48
51
  readonly languages: readonly string[];
49
52
  readonly timeZone: string;
50
53
  /** The workspace's setting (ADR-0035): `auto` leaves the week to the language of the pages. */
@@ -274,6 +277,7 @@ function isWorkspace(value: unknown): boolean {
274
277
  return (
275
278
  isRecord(value) &&
276
279
  typeof value.name === "string" &&
280
+ (value.language === undefined || isLine(value.language, 35)) &&
277
281
  Array.isArray(value.languages) &&
278
282
  value.languages.every((language) => typeof language === "string") &&
279
283
  isLine(value.timeZone, 100) &&
@@ -287,6 +287,15 @@ export type PluginCaller = PersonCaller | ConsoleCaller | PluginAsCaller;
287
287
 
288
288
  export interface PluginWorkspace {
289
289
  readonly name: string;
290
+ /**
291
+ * The language for whoever has none of their own (ADR-0081): the workspace's, else `en`, as
292
+ * `languageSet` says, so that what a plugin writes to someone who never opened the pages, in a
293
+ * decision, a task or a message elsewhere, is in the organization's language.
294
+ */
295
+ readonly language: string;
296
+ /** Whether an administrator set the workspace's language: `false` where it is English because nobody said otherwise. */
297
+ readonly languageSet: boolean;
298
+ /** The languages the console speaks, `language` first. */
290
299
  readonly languages: readonly string[];
291
300
  /** The zone the workspace's times of day are read in; `UTC` where none is set, as `timeZoneSet` says. */
292
301
  readonly timeZone: string;
@@ -28,6 +28,7 @@ import {
28
28
  PLUGIN_KEY_PATTERN,
29
29
  RESERVED_ARG_NAMES,
30
30
  RESERVED_COMMAND_NAMES,
31
+ SETTING_KEY_PATTERN,
31
32
  } from "./manifest.js";
32
33
 
33
34
  const FIELD = /^[A-Za-z_][A-Za-z0-9_]{0,63}$/;
@@ -363,8 +364,15 @@ export function defineEndpoint(input: EndpointInput): EndpointDefinition {
363
364
  if (input?.auth === "webhook" && input.roles !== undefined) {
364
365
  problems.push("a webhook endpoint names no roles: nobody is signed in");
365
366
  }
366
- if (input?.secret !== undefined && (!isKey(input.secret) || input.auth !== "webhook")) {
367
- problems.push("an endpoint's secret names a secret setting, for a webhook alone");
367
+ if (
368
+ input?.secret !== undefined &&
369
+ (typeof input.secret !== "string" ||
370
+ !SETTING_KEY_PATTERN.test(input.secret) ||
371
+ input.auth !== "webhook")
372
+ ) {
373
+ problems.push(
374
+ "an endpoint's secret names a secret setting, as settings are named (slackSigningSecret), for a webhook alone",
375
+ );
368
376
  }
369
377
  const methods = input?.methods ?? ["POST"];
370
378
  if (
@@ -58,7 +58,15 @@ export function forbiddenImportsIn(source: string): string[] {
58
58
  return [...found];
59
59
  }
60
60
 
61
- const GLOBAL_USES = /\b(fetch|WebSocket|EventSource|process\.binding|process\.dlopen)\s*\(/g;
61
+ /**
62
+ * A call of a removed global by its bare name, or through the global object, `globalThis` or
63
+ * Node's `global`: `fetch(`, `globalThis.fetch(` and `global?.fetch(`, and not `ctx.fetch(` or
64
+ * `this.#fetch(`, a member, which is what the host offers in the global's place. Text, not a
65
+ * parse: a name bound to the context's fetch, `({ fetch }) => fetch(url)`, or a method of that
66
+ * name, reads as the global too.
67
+ */
68
+ const GLOBAL_USES =
69
+ /(?:\b(?:globalThis|global)\s*\??\.\s*|(?<![.\w$#]))(fetch|WebSocket|EventSource|process\.binding|process\.dlopen)\s*\(/g;
62
70
 
63
71
  /** The removed globals a bundle's text calls, each once; a plugin that calls them fails at runtime. */
64
72
  export function removedGlobalsIn(source: string): string[] {
package/src/router.ts CHANGED
@@ -93,6 +93,8 @@ export type Route =
93
93
  readonly name: "workspace-settings";
94
94
  readonly form: "rules" | "workspace" | "pack-token" | undefined;
95
95
  }
96
+ /** The browsers whoever is signed in is signed in on (board #309): the settings' view of their own. */
97
+ | { readonly name: "sessions" }
96
98
  | { readonly name: "people" }
97
99
  /** The form where an administrator lets someone in by login (ADR-0022). */
98
100
  | { readonly name: "new-listing" }
@@ -184,6 +186,8 @@ export const PATHS = {
184
186
  categories: "/categories",
185
187
  /** The workspace's settings: the rules, the categories, the skills (ADR-0023). */
186
188
  settings: "/settings",
189
+ /** The browsers whoever is signed in is signed in on: the settings' view of their own (board #309). */
190
+ sessions: "/settings/sessions",
187
191
  /** Where the pages a console adds of its own are: `/pages/<key>`, and `/projects/<key>/pages/<page>` on a project. */
188
192
  pages: "/pages",
189
193
  /** Where the plugins' pages are: `/plugins/<key>[/<page>[/<rest>]]`, and `/projects/<key>/plugins/<key>...` on a project (ADR-0054). */
@@ -328,6 +332,9 @@ export function matchRoute(pathname: string, search = ""): Route {
328
332
  if (path === PATHS.categories) {
329
333
  return { name: "categories" };
330
334
  }
335
+ if (path === PATHS.sessions) {
336
+ return { name: "sessions" };
337
+ }
331
338
  if (path === PATHS.pluginSettings) {
332
339
  return { name: "plugins-settings", plugin: undefined };
333
340
  }
package/src/routes.ts CHANGED
@@ -27,6 +27,8 @@ export const REST_ROUTES = {
27
27
  events: "/api/v1/events",
28
28
  /** The tokens of whoever asks: what their agents, scripts and consoles act as them with. */
29
29
  tokens: "/api/v1/tokens",
30
+ /** The browsers whoever asks is signed in on (board #309), seen and ended by a person on the console's own pages; `/others` under it ends every other. */
31
+ sessions: "/api/v1/sessions",
30
32
  /** Connecting an agent (ADR-0011): begun as nobody, approved by a person, claimed by the command. */
31
33
  connect: "/api/v1/connect",
32
34
  /** The categories tasks are sorted into (ADR-0019): the workspace's vocabulary, kept by an administrator. */
@@ -143,7 +145,7 @@ export function signInPath(page: string, failure: SignInFailure): string {
143
145
 
144
146
  /** The REST path of one person, listing, token, project or team: the collection, then the id or the key. */
145
147
  export function restPath(
146
- collection: "people" | "listings" | "tokens" | "projects" | "teams",
148
+ collection: "people" | "listings" | "tokens" | "sessions" | "projects" | "teams",
147
149
  id: string,
148
150
  ): string {
149
151
  return `${REST_ROUTES[collection]}/${encodeURIComponent(id)}`;
package/src/schemas.ts CHANGED
@@ -53,6 +53,7 @@ import {
53
53
  ARTIFACT_KINDS,
54
54
  CATEGORY_COLORS,
55
55
  COLOR_NAMES,
56
+ CONSOLE_LANGUAGES,
56
57
  EVENT_KINDS,
57
58
  GOAL_STATES,
58
59
  LINK_SOURCES,
@@ -363,6 +364,13 @@ export const restWorkspaceSchema = z.object({
363
364
  * none, when they stay as the API gives them, in UTC. Optional as above; none then.
364
365
  */
365
366
  timeZone: z.optional(z.nullable(timeZoneName)),
367
+ /**
368
+ * The workspace's language (ADR-0081), one the console speaks: the pages speak it to whoever
369
+ * has no language of their own and a browser that asks for none the console speaks, and a
370
+ * plugin writes to whoever has none in it; `null` for none set, English then. Optional as
371
+ * above; none then.
372
+ */
373
+ language: z.optional(z.nullable(languageTag)),
366
374
  });
367
375
  export type RestWorkspace = z.infer<typeof restWorkspaceSchema>;
368
376
 
@@ -373,6 +381,8 @@ export const restWorkspacePatchSchema = z
373
381
  weekStart: z.optional(z.enum(WEEK_STARTS)),
374
382
  /** A zone's name, or `null` for none. */
375
383
  timeZone: z.optional(z.nullable(timeZoneName)),
384
+ /** One of the languages the console speaks, or `null` for none. */
385
+ language: z.optional(z.nullable(z.enum(CONSOLE_LANGUAGES))),
376
386
  })
377
387
  .check(
378
388
  z.refine((patch) => Object.values(patch).some((value) => value !== undefined), {
@@ -1224,6 +1234,37 @@ export type RestToken = z.infer<typeof restTokenSchema>;
1224
1234
  export const restTokensSchema = z.object({ items: z.array(restTokenSchema) });
1225
1235
  export type RestTokens = z.infer<typeof restTokensSchema>;
1226
1236
 
1237
+ /**
1238
+ * A browser a person is signed in on, as their own page lists it (board #309): what the browser
1239
+ * called itself, read as a browser and a platform, where it last came from and when; never the
1240
+ * cookie's token.
1241
+ */
1242
+ export const restSessionSchema = z.object({
1243
+ id: uuid,
1244
+ /** Whether it is the session the request was made on: the browser the person looks from. */
1245
+ current: z.boolean(),
1246
+ createdAt: instant,
1247
+ /** When the session was last used, noted at most hourly. */
1248
+ lastSeenAt: instant,
1249
+ /** When it ends unless it is used before: the idle limit from the last use. */
1250
+ expiresAt: instant,
1251
+ /** The browser by family (`Chrome`), or `null` when what it called itself names none the console knows. */
1252
+ browser: z.nullable(z.string()),
1253
+ /** The platform by family (`Windows`), or `null`. */
1254
+ platform: z.nullable(z.string()),
1255
+ /** Where the browser last came from, as the server saw it, or `null` until seen. */
1256
+ address: z.nullable(z.string()),
1257
+ });
1258
+ export type RestSession = z.infer<typeof restSessionSchema>;
1259
+
1260
+ /** `GET /api/v1/sessions`: the sessions of whoever asks, the current first and then the last used first, and how long one lives unused. */
1261
+ export const restSessionsSchema = z.object({
1262
+ items: z.array(restSessionSchema),
1263
+ /** How many days a session lasts without being used: the deployment's `SESSION_TTL_DAYS`. */
1264
+ idleDays: z.int(),
1265
+ });
1266
+ export type RestSessions = z.infer<typeof restSessionsSchema>;
1267
+
1227
1268
  /** What `POST /api/v1/tokens` is sent: a name, and for how many days it is good. */
1228
1269
  export const restTokenInputSchema = z.object({
1229
1270
  name: line(MAX_TOKEN_NAME_LENGTH),
@@ -86,6 +86,8 @@
86
86
  0 0.5rem 1.25rem -0.5rem color-mix(in srgb, var(--sc-color-accent-solid) 22%, transparent),
87
87
  0 1.25rem 3rem -1rem color-mix(in srgb, var(--sc-color-accent-solid) 11%, transparent);
88
88
  --sc-shadow-stage: 0 1.25rem 3.5rem #1a2b552e;
89
+ /* What a menu casts, open over the page: close under it, and soft. */
90
+ --sc-shadow-menu: 0 0.75rem 2rem -0.5rem #1a2b5533, 0 0.125rem 0.375rem #1a2b5514;
89
91
 
90
92
  /* Type. The Korean face comes first where the page provides it; the Latin stays with the
91
93
  system's faces. */
@@ -487,25 +489,38 @@ table {
487
489
  color: var(--sc-color-text);
488
490
  }
489
491
 
490
- /* A tab that opens a list of pages: a group of several plugins (ADR-0054). */
492
+ /* A tab that opens a list of pages: a group of several plugins (ADR-0054). A button; its list is
493
+ a popover, .sc-tab-group-panel below the menu's panel. */
491
494
 
492
495
  .sc-tab-group {
493
- position: relative;
496
+ display: inline-flex;
494
497
  }
495
498
 
496
499
  .sc-tab-summary {
497
- list-style: none;
500
+ font-family: inherit;
501
+ line-height: inherit;
498
502
  cursor: pointer;
499
503
  }
500
504
 
501
- .sc-tab-summary::-webkit-details-marker {
502
- display: none;
505
+ /* The caret turns while the list is open. */
506
+ .sc-tab-summary .sc-menu-caret {
507
+ transition: transform var(--sc-transition);
503
508
  }
504
509
 
505
- .sc-tab-group-panel {
506
- right: auto;
507
- left: 0;
508
- top: 100%;
510
+ .sc-tab-summary[aria-expanded="true"] .sc-menu-caret {
511
+ transform: rotate(180deg);
512
+ }
513
+
514
+ .sc-tab-summary[aria-expanded="true"] {
515
+ color: var(--sc-color-text);
516
+ }
517
+
518
+ /* A tab's name: a long one stops short with an ellipsis, and the tab's title says it whole. */
519
+ .sc-tab-label {
520
+ min-width: 0;
521
+ max-width: 15rem;
522
+ overflow: hidden;
523
+ text-overflow: ellipsis;
509
524
  }
510
525
 
511
526
  /* The pages of a plugin: the header's tabs going on a row lower, on the same gutters, the line
@@ -548,25 +563,45 @@ table {
548
563
  color: var(--sc-color-text);
549
564
  }
550
565
 
551
- /* A plugin's frame: the width of the page, as tall as the frame says. */
566
+ /* A plugin's frame, in a box the console draws: the width of the page, as tall as the frame
567
+ says; until the plugin's page has drawn, a spinner stands in the box, over a frame not shown. */
552
568
 
553
- .sc-plugin-frame {
569
+ .sc-plugin-frame-box {
570
+ position: relative;
554
571
  display: block;
555
572
  width: 100%;
556
573
  min-height: 2.5rem;
557
- border: 0;
558
- border-radius: var(--sc-radius-lg);
559
- background: transparent;
560
574
  }
561
575
 
562
576
  /* A page pads itself by a step, for the shadows of what is in it, which the frame would cut. The
563
577
  frame stands that step outside the page's column, so that the page's first words line up with
564
578
  the tabs above it, and with every other page's. */
565
- .sc-plugin-frame-page {
579
+ .sc-plugin-frame-box-page {
566
580
  width: calc(100% + 2 * var(--sc-space-4));
567
581
  margin: calc(var(--sc-space-4) * -1);
568
582
  }
569
583
 
584
+ .sc-plugin-frame {
585
+ display: block;
586
+ width: 100%;
587
+ height: 100%;
588
+ border: 0;
589
+ border-radius: var(--sc-radius-lg);
590
+ background: transparent;
591
+ transition: opacity var(--sc-transition);
592
+ }
593
+
594
+ .sc-plugin-frame-loading .sc-plugin-frame {
595
+ opacity: 0;
596
+ }
597
+
598
+ .sc-plugin-frame-wait {
599
+ position: absolute;
600
+ inset: 0;
601
+ display: grid;
602
+ place-items: center;
603
+ }
604
+
570
605
  /* A plugin's frame document, which the console serves marked with data-console: it paints no
571
606
  background and is as tall as its content, so that the box the console draws shows through and
572
607
  the frame shrinks as well as grows; no room is kept for a scrollbar it never shows. */
@@ -659,8 +694,67 @@ html[data-console] body {
659
694
  padding: var(--sc-space-1);
660
695
  border: var(--sc-border);
661
696
  border-radius: var(--sc-radius-lg);
662
- background: var(--sc-color-bg-inset);
663
- box-shadow: var(--sc-shadow-stage);
697
+ background: var(--sc-color-bg-raised);
698
+ box-shadow: var(--sc-shadow-menu);
699
+ /* A menu longer than the window has room for under the header scrolls within itself, so that
700
+ its last items, the way out among them, are always reached. */
701
+ max-height: calc(100dvh - 4.5rem);
702
+ overflow-y: auto;
703
+ overscroll-behavior: contain;
704
+ }
705
+
706
+ /* The list a group tab opens: a popover in the top layer, placed under its tab by the shell, so
707
+ that the row of tabs, which scrolls sideways and clips whatever hangs out of it, clips nothing
708
+ of the list. In the type of the tabs; as wide as its names, within a column a name reads at a
709
+ glance in, and within the window. */
710
+ .sc-tab-group-panel {
711
+ position: fixed;
712
+ inset: auto;
713
+ min-width: 11rem;
714
+ max-width: min(18rem, calc(100vw - 1rem));
715
+ margin: 0;
716
+ color: var(--sc-color-text);
717
+ font-size: var(--sc-text-sm);
718
+ }
719
+
720
+ /* Where the browser has no popover, the tab shows and hides the list itself. */
721
+ .sc-tab-group-panel[hidden] {
722
+ display: none;
723
+ }
724
+
725
+ .sc-tab-group-panel:popover-open {
726
+ animation: sc-menu-in 120ms ease-out;
727
+ }
728
+
729
+ @keyframes sc-menu-in {
730
+ from {
731
+ opacity: 0;
732
+ transform: translateY(-0.25rem);
733
+ }
734
+ }
735
+
736
+ @media (prefers-reduced-motion: reduce) {
737
+ .sc-tab-group-panel:popover-open {
738
+ animation: none;
739
+ }
740
+ }
741
+
742
+ /* A plugin in a group's list: its name alone, lined up under the tab's, which wraps rather than
743
+ run out of the list. The one the page is on is in the accent. */
744
+ .sc-menu-link.sc-group-link {
745
+ padding: var(--sc-space-2) 0.625rem;
746
+ color: var(--sc-color-text);
747
+ line-height: var(--sc-leading-snug);
748
+ overflow-wrap: anywhere;
749
+ }
750
+
751
+ .sc-group-link + .sc-group-link {
752
+ margin-top: 0.125rem;
753
+ }
754
+
755
+ .sc-group-link[aria-current="page"] {
756
+ background: color-mix(in srgb, var(--sc-color-accent-subtle) 55%, transparent);
757
+ color: var(--sc-color-accent);
664
758
  }
665
759
 
666
760
  .sc-menu-who {
@@ -702,7 +796,7 @@ html[data-console] body {
702
796
  }
703
797
 
704
798
  .sc-menu-link:hover {
705
- background: var(--sc-color-bg-raised);
799
+ background: var(--sc-color-bg-inset);
706
800
  color: var(--sc-color-text);
707
801
  }
708
802
 
@@ -2923,6 +3017,119 @@ select.sc-input-quiet {
2923
3017
  align-items: baseline;
2924
3018
  }
2925
3019
 
3020
+ /* The views of the settings: the workspace's, and the browsers the person is signed in on. */
3021
+ .sc-settings-views {
3022
+ margin-bottom: var(--sc-space-5);
3023
+ }
3024
+
3025
+ /* The sessions (board #309): a row for each browser in the panel, parted by hairlines, a screen or
3026
+ a phone drawn before it, the current one in the accent; what it is first, then when it was
3027
+ last used, where from and the day it signed in, in the small type of a row's facts. */
3028
+ .sc-session-list {
3029
+ margin: var(--sc-space-4) 0 0;
3030
+ padding: 0;
3031
+ list-style: none;
3032
+ }
3033
+
3034
+ .sc-session {
3035
+ display: flex;
3036
+ align-items: center;
3037
+ gap: var(--sc-space-3);
3038
+ padding-block: var(--sc-space-3);
3039
+ border-top: var(--sc-hairline);
3040
+ }
3041
+
3042
+ .sc-session:last-child {
3043
+ padding-bottom: 0;
3044
+ }
3045
+
3046
+ .sc-session-icon {
3047
+ display: inline-flex;
3048
+ flex: none;
3049
+ align-items: center;
3050
+ justify-content: center;
3051
+ width: 2.25rem;
3052
+ height: 2.25rem;
3053
+ border-radius: var(--sc-radius-md);
3054
+ background: var(--sc-color-bg-inset);
3055
+ color: var(--sc-color-text-muted);
3056
+ }
3057
+
3058
+ .sc-session-current .sc-session-icon {
3059
+ background: var(--sc-color-accent-subtle);
3060
+ color: var(--sc-color-accent);
3061
+ }
3062
+
3063
+ .sc-session-icon svg {
3064
+ width: 1.25rem;
3065
+ height: 1.25rem;
3066
+ fill: none;
3067
+ stroke: currentColor;
3068
+ stroke-width: 1.5;
3069
+ stroke-linecap: round;
3070
+ stroke-linejoin: round;
3071
+ }
3072
+
3073
+ .sc-session-body {
3074
+ flex: 1;
3075
+ min-width: 0;
3076
+ }
3077
+
3078
+ .sc-session-name {
3079
+ display: flex;
3080
+ flex-wrap: wrap;
3081
+ align-items: center;
3082
+ gap: var(--sc-space-1) var(--sc-space-2);
3083
+ font-weight: var(--sc-weight-medium);
3084
+ }
3085
+
3086
+ .sc-session-meta {
3087
+ display: flex;
3088
+ flex-wrap: wrap;
3089
+ gap: 0 var(--sc-space-2);
3090
+ margin-top: 0.125rem;
3091
+ color: var(--sc-color-text-faint);
3092
+ font-size: var(--sc-text-xs);
3093
+ }
3094
+
3095
+ .sc-session-meta > span {
3096
+ white-space: nowrap;
3097
+ }
3098
+
3099
+ .sc-session-meta > span + span {
3100
+ padding-inline-start: var(--sc-space-2);
3101
+ border-inline-start: var(--sc-hairline);
3102
+ }
3103
+
3104
+ .sc-session-end {
3105
+ flex: none;
3106
+ align-self: center;
3107
+ }
3108
+
3109
+ /* On a phone the facts of a row stand one under another, where a line has no room for them. */
3110
+ @media (max-width: 40rem) {
3111
+ .sc-session {
3112
+ align-items: flex-start;
3113
+ }
3114
+
3115
+ .sc-session-meta {
3116
+ flex-direction: column;
3117
+ }
3118
+
3119
+ .sc-session-meta > span {
3120
+ white-space: normal;
3121
+ }
3122
+
3123
+ .sc-session-meta > span + span {
3124
+ padding-inline-start: 0;
3125
+ border-inline-start: 0;
3126
+ }
3127
+
3128
+ .sc-session-end {
3129
+ align-self: flex-start;
3130
+ }
3131
+ }
3132
+
2926
3133
  .sc-tab-count {
2927
3134
  color: var(--sc-color-text-faint);
2928
3135
  font-size: var(--sc-text-xs);
@@ -5417,8 +5624,8 @@ select.sc-input-quiet {
5417
5624
  padding: var(--sc-space-1);
5418
5625
  border: var(--sc-border);
5419
5626
  border-radius: var(--sc-radius-md);
5420
- background: var(--sc-color-bg-inset);
5421
- box-shadow: var(--sc-shadow-stage);
5627
+ background: var(--sc-color-bg-raised);
5628
+ box-shadow: var(--sc-shadow-menu);
5422
5629
  font-size: var(--sc-text-sm);
5423
5630
  }
5424
5631
 
@@ -6653,7 +6860,7 @@ a.sc-tile-project:focus-visible {
6653
6860
  white-space: nowrap;
6654
6861
  }
6655
6862
 
6656
- .sc-tile-widget .sc-plugin-frame-widget {
6863
+ .sc-tile-widget .sc-plugin-frame-box {
6657
6864
  height: 100%;
6658
6865
  min-height: 0;
6659
6866
  }
package/src/tokens.ts CHANGED
@@ -49,6 +49,7 @@ export const CONSOLE_TOKENS: readonly string[] = [
49
49
  "--sc-color-sheet-hover",
50
50
  "--sc-glow",
51
51
  "--sc-shadow-stage",
52
+ "--sc-shadow-menu",
52
53
  "--sc-font-sans",
53
54
  "--sc-font-mono",
54
55
  "--sc-text-xs",
package/src/vocabulary.ts CHANGED
@@ -62,6 +62,15 @@ export type ProjectIconType = (typeof PROJECT_ICON_TYPES)[number];
62
62
  /** The identity providers people may sign in through: the git host, and Google (Workspace). */
63
63
  /** The languages the console's pages speak, and a plugin's words are given in. */
64
64
  export const CONSOLE_LANGUAGES = ["en", "ko"] as const;
65
+ export type ConsoleLanguage = (typeof CONSOLE_LANGUAGES)[number];
66
+
67
+ /**
68
+ * The languages the console speaks with one of them first: the workspace's (ADR-0081), so that
69
+ * the first of what a plugin reads as `languages` is the language for whoever has none of their own.
70
+ */
71
+ export function languagesFirst(first: string): string[] {
72
+ return [first, ...CONSOLE_LANGUAGES.filter((tag) => tag !== first)];
73
+ }
65
74
 
66
75
  export const PROVIDER_KEYS = ["gh", "google"] as const;
67
76