botmux 2.88.0 β†’ 2.89.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 (178) hide show
  1. package/dist/bot-registry.d.ts +2 -0
  2. package/dist/bot-registry.d.ts.map +1 -1
  3. package/dist/bot-registry.js +4 -0
  4. package/dist/bot-registry.js.map +1 -1
  5. package/dist/cli/dashboard-endpoint.d.ts.map +1 -1
  6. package/dist/cli/dashboard-endpoint.js +9 -3
  7. package/dist/cli/dashboard-endpoint.js.map +1 -1
  8. package/dist/cli.d.ts.map +1 -1
  9. package/dist/cli.js +11 -3
  10. package/dist/cli.js.map +1 -1
  11. package/dist/core/command-handler.d.ts.map +1 -1
  12. package/dist/core/command-handler.js +9 -1
  13. package/dist/core/command-handler.js.map +1 -1
  14. package/dist/core/dashboard-command/groups.d.ts +20 -0
  15. package/dist/core/dashboard-command/groups.d.ts.map +1 -0
  16. package/dist/core/dashboard-command/groups.js +52 -0
  17. package/dist/core/dashboard-command/groups.js.map +1 -0
  18. package/dist/core/dashboard-command/index.d.ts +30 -0
  19. package/dist/core/dashboard-command/index.d.ts.map +1 -0
  20. package/dist/core/dashboard-command/index.js +81 -0
  21. package/dist/core/dashboard-command/index.js.map +1 -0
  22. package/dist/core/dashboard-command/overview.d.ts +29 -0
  23. package/dist/core/dashboard-command/overview.d.ts.map +1 -0
  24. package/dist/core/dashboard-command/overview.js +61 -0
  25. package/dist/core/dashboard-command/overview.js.map +1 -0
  26. package/dist/core/dashboard-command/owner-gate.d.ts +41 -0
  27. package/dist/core/dashboard-command/owner-gate.d.ts.map +1 -0
  28. package/dist/core/dashboard-command/owner-gate.js +40 -0
  29. package/dist/core/dashboard-command/owner-gate.js.map +1 -0
  30. package/dist/core/dashboard-command/schedules.d.ts +20 -0
  31. package/dist/core/dashboard-command/schedules.d.ts.map +1 -0
  32. package/dist/core/dashboard-command/schedules.js +47 -0
  33. package/dist/core/dashboard-command/schedules.js.map +1 -0
  34. package/dist/core/dashboard-command/sessions.d.ts +22 -0
  35. package/dist/core/dashboard-command/sessions.d.ts.map +1 -0
  36. package/dist/core/dashboard-command/sessions.js +43 -0
  37. package/dist/core/dashboard-command/sessions.js.map +1 -0
  38. package/dist/core/dashboard-command/settings.d.ts +21 -0
  39. package/dist/core/dashboard-command/settings.d.ts.map +1 -0
  40. package/dist/core/dashboard-command/settings.js +55 -0
  41. package/dist/core/dashboard-command/settings.js.map +1 -0
  42. package/dist/core/dashboard-command/stub.d.ts +16 -0
  43. package/dist/core/dashboard-command/stub.d.ts.map +1 -0
  44. package/dist/core/dashboard-command/stub.js +28 -0
  45. package/dist/core/dashboard-command/stub.js.map +1 -0
  46. package/dist/core/dashboard-command/workflows.d.ts +20 -0
  47. package/dist/core/dashboard-command/workflows.d.ts.map +1 -0
  48. package/dist/core/dashboard-command/workflows.js +45 -0
  49. package/dist/core/dashboard-command/workflows.js.map +1 -0
  50. package/dist/core/passthrough-commands.d.ts.map +1 -1
  51. package/dist/core/passthrough-commands.js +1 -1
  52. package/dist/core/passthrough-commands.js.map +1 -1
  53. package/dist/core/session-create.d.ts +0 -1
  54. package/dist/core/session-create.d.ts.map +1 -1
  55. package/dist/core/session-create.js +0 -3
  56. package/dist/core/session-create.js.map +1 -1
  57. package/dist/core/session-manager.d.ts.map +1 -1
  58. package/dist/core/session-manager.js +3 -2
  59. package/dist/core/session-manager.js.map +1 -1
  60. package/dist/daemon-internal-client-wrapper.d.ts +41 -0
  61. package/dist/daemon-internal-client-wrapper.d.ts.map +1 -0
  62. package/dist/daemon-internal-client-wrapper.js +65 -0
  63. package/dist/daemon-internal-client-wrapper.js.map +1 -0
  64. package/dist/dashboard/aggregator.d.ts +12 -0
  65. package/dist/dashboard/aggregator.d.ts.map +1 -1
  66. package/dist/dashboard/aggregator.js +16 -0
  67. package/dist/dashboard/aggregator.js.map +1 -1
  68. package/dist/dashboard/auth.d.ts +7 -0
  69. package/dist/dashboard/auth.d.ts.map +1 -1
  70. package/dist/dashboard/auth.js +21 -0
  71. package/dist/dashboard/auth.js.map +1 -1
  72. package/dist/dashboard/card-model-types.d.ts +50 -0
  73. package/dist/dashboard/card-model-types.d.ts.map +1 -0
  74. package/dist/dashboard/card-model-types.js +9 -0
  75. package/dist/dashboard/card-model-types.js.map +1 -0
  76. package/dist/dashboard/daemon-internal-api.d.ts +90 -0
  77. package/dist/dashboard/daemon-internal-api.d.ts.map +1 -0
  78. package/dist/dashboard/daemon-internal-api.js +534 -0
  79. package/dist/dashboard/daemon-internal-api.js.map +1 -0
  80. package/dist/dashboard/daemon-internal-auth.d.ts +124 -0
  81. package/dist/dashboard/daemon-internal-auth.d.ts.map +1 -0
  82. package/dist/dashboard/daemon-internal-auth.js +188 -0
  83. package/dist/dashboard/daemon-internal-auth.js.map +1 -0
  84. package/dist/dashboard/daemon-internal-client.d.ts +67 -0
  85. package/dist/dashboard/daemon-internal-client.d.ts.map +1 -0
  86. package/dist/dashboard/daemon-internal-client.js +157 -0
  87. package/dist/dashboard/daemon-internal-client.js.map +1 -0
  88. package/dist/dashboard/dashboard-admins.d.ts +8 -0
  89. package/dist/dashboard/dashboard-admins.d.ts.map +1 -0
  90. package/dist/dashboard/dashboard-admins.js +15 -0
  91. package/dist/dashboard/dashboard-admins.js.map +1 -0
  92. package/dist/dashboard/federation-spoke-api.d.ts +3 -0
  93. package/dist/dashboard/federation-spoke-api.d.ts.map +1 -1
  94. package/dist/dashboard/federation-spoke-api.js +11 -8
  95. package/dist/dashboard/federation-spoke-api.js.map +1 -1
  96. package/dist/dashboard/groups-action-helpers.d.ts +69 -0
  97. package/dist/dashboard/groups-action-helpers.d.ts.map +1 -0
  98. package/dist/dashboard/groups-action-helpers.js +141 -0
  99. package/dist/dashboard/groups-action-helpers.js.map +1 -0
  100. package/dist/dashboard/groups-card-model.d.ts +120 -0
  101. package/dist/dashboard/groups-card-model.d.ts.map +1 -0
  102. package/dist/dashboard/groups-card-model.js +175 -0
  103. package/dist/dashboard/groups-card-model.js.map +1 -0
  104. package/dist/dashboard/schedule-card-model.d.ts +172 -0
  105. package/dist/dashboard/schedule-card-model.d.ts.map +1 -0
  106. package/dist/dashboard/schedule-card-model.js +290 -0
  107. package/dist/dashboard/schedule-card-model.js.map +1 -0
  108. package/dist/dashboard/session-card-model.d.ts +83 -0
  109. package/dist/dashboard/session-card-model.d.ts.map +1 -0
  110. package/dist/dashboard/session-card-model.js +196 -0
  111. package/dist/dashboard/session-card-model.js.map +1 -0
  112. package/dist/dashboard/settings-card-model.d.ts +73 -0
  113. package/dist/dashboard/settings-card-model.d.ts.map +1 -0
  114. package/dist/dashboard/settings-card-model.js +94 -0
  115. package/dist/dashboard/settings-card-model.js.map +1 -0
  116. package/dist/dashboard/settings-owner-resolver.d.ts +32 -0
  117. package/dist/dashboard/settings-owner-resolver.d.ts.map +1 -0
  118. package/dist/dashboard/settings-owner-resolver.js +43 -0
  119. package/dist/dashboard/settings-owner-resolver.js.map +1 -0
  120. package/dist/dashboard/settings-write-applier.d.ts +84 -0
  121. package/dist/dashboard/settings-write-applier.d.ts.map +1 -0
  122. package/dist/dashboard/settings-write-applier.js +119 -0
  123. package/dist/dashboard/settings-write-applier.js.map +1 -0
  124. package/dist/dashboard/workflow-api.d.ts.map +1 -1
  125. package/dist/dashboard/workflow-api.js +38 -119
  126. package/dist/dashboard/workflow-api.js.map +1 -1
  127. package/dist/dashboard/workflow-card-model.d.ts +127 -0
  128. package/dist/dashboard/workflow-card-model.d.ts.map +1 -0
  129. package/dist/dashboard/workflow-card-model.js +186 -0
  130. package/dist/dashboard/workflow-card-model.js.map +1 -0
  131. package/dist/dashboard/workflows-action-helpers.d.ts +105 -0
  132. package/dist/dashboard/workflows-action-helpers.d.ts.map +1 -0
  133. package/dist/dashboard/workflows-action-helpers.js +196 -0
  134. package/dist/dashboard/workflows-action-helpers.js.map +1 -0
  135. package/dist/dashboard.js +196 -271
  136. package/dist/dashboard.js.map +1 -1
  137. package/dist/i18n/en.d.ts.map +1 -1
  138. package/dist/i18n/en.js +266 -0
  139. package/dist/i18n/en.js.map +1 -1
  140. package/dist/i18n/zh.d.ts.map +1 -1
  141. package/dist/i18n/zh.js +266 -0
  142. package/dist/i18n/zh.js.map +1 -1
  143. package/dist/im/lark/card-builder.d.ts +2 -0
  144. package/dist/im/lark/card-builder.d.ts.map +1 -1
  145. package/dist/im/lark/card-builder.js +2 -1
  146. package/dist/im/lark/card-builder.js.map +1 -1
  147. package/dist/im/lark/card-handler.d.ts +54 -2
  148. package/dist/im/lark/card-handler.d.ts.map +1 -1
  149. package/dist/im/lark/card-handler.js +127 -1
  150. package/dist/im/lark/card-handler.js.map +1 -1
  151. package/dist/im/lark/event-dispatcher.d.ts.map +1 -1
  152. package/dist/im/lark/event-dispatcher.js +22 -0
  153. package/dist/im/lark/event-dispatcher.js.map +1 -1
  154. package/dist/im/lark/groups-card.d.ts +90 -0
  155. package/dist/im/lark/groups-card.d.ts.map +1 -0
  156. package/dist/im/lark/groups-card.js +832 -0
  157. package/dist/im/lark/groups-card.js.map +1 -0
  158. package/dist/im/lark/overview-card.d.ts +101 -0
  159. package/dist/im/lark/overview-card.d.ts.map +1 -0
  160. package/dist/im/lark/overview-card.js +475 -0
  161. package/dist/im/lark/overview-card.js.map +1 -0
  162. package/dist/im/lark/schedules-card.d.ts +96 -0
  163. package/dist/im/lark/schedules-card.d.ts.map +1 -0
  164. package/dist/im/lark/schedules-card.js +892 -0
  165. package/dist/im/lark/schedules-card.js.map +1 -0
  166. package/dist/im/lark/sessions-card.d.ts +117 -0
  167. package/dist/im/lark/sessions-card.d.ts.map +1 -0
  168. package/dist/im/lark/sessions-card.js +870 -0
  169. package/dist/im/lark/sessions-card.js.map +1 -0
  170. package/dist/im/lark/settings-card.d.ts +125 -0
  171. package/dist/im/lark/settings-card.d.ts.map +1 -0
  172. package/dist/im/lark/settings-card.js +433 -0
  173. package/dist/im/lark/settings-card.js.map +1 -0
  174. package/dist/im/lark/workflows-card.d.ts +102 -0
  175. package/dist/im/lark/workflows-card.d.ts.map +1 -0
  176. package/dist/im/lark/workflows-card.js +737 -0
  177. package/dist/im/lark/workflows-card.js.map +1 -0
  178. package/package.json +1 -1
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Workflows dashboard card.
3
+ *
4
+ * The list view is compact, paginated, refreshable, and read-only except for
5
+ * per-row detail entry. The detail view exposes cancel and back actions.
6
+ *
7
+ * Cancel callbacks block on Route B and then refetch because a workflow can
8
+ * land in its terminal state asynchronously. If refetch fails or the row
9
+ * disappears, the card falls back to a cancelled-state synth so the user still
10
+ * gets a usable detail view, possibly stale for one render. Failures return
11
+ * toast-only.
12
+ *
13
+ * Security:
14
+ * - `invokerOpenId` pins callbacks to the admin who opened the card.
15
+ * - sender union_id never lands on `action.value`.
16
+ * - command entry and callbacks both enforce the dashboard admin gate.
17
+ * - row ids are routing keys only; Route B still enforces row ownership.
18
+ * - cancel re-runs the model availability matrix and owner-routability check
19
+ * before POSTing.
20
+ */
21
+ import type { WorkflowRunDetailDto, WorkflowRunInput } from '../../dashboard/workflow-card-model.js';
22
+ import type { DaemonClient } from '../../dashboard/daemon-internal-client.js';
23
+ import { type Locale } from '../../i18n/index.js';
24
+ import type { CardActionData } from './card-handler.js';
25
+ export declare const WORKFLOWS_ACTION_REFRESH: "dash_workflows_refresh";
26
+ export declare const WORKFLOWS_ACTION_PAGE: "dash_workflows_page";
27
+ export declare const WORKFLOWS_ACTION_DETAIL: "dash_workflows_detail";
28
+ export declare const WORKFLOWS_ACTION_CANCEL: "dash_workflows_cancel";
29
+ export declare const WORKFLOWS_ACTION_BACK_TO_LIST: "dash_workflows_back_to_list";
30
+ export interface BuildWorkflowsCardOpts {
31
+ invokerOpenId: string;
32
+ locale: Locale;
33
+ /** 1-based page index. Caller clamps; this just renders what's given. */
34
+ page: number;
35
+ /** Page size override, threaded through every button value. */
36
+ pageSize?: number;
37
+ /** Navigation origin. `'overview'` means this card was opened via
38
+ * `/dashboard overview` β†’ goto workflows; the footer renders an extra
39
+ * "πŸ”™ θΏ”ε›žζ€»θ§ˆ" button, and every button.value carries `origin=overview`
40
+ * to keep that affordance across rebuilds. Undefined β†’ standalone card. */
41
+ origin?: 'overview';
42
+ /** Dashboard scope. `'global'` means `/dashboard` shows workflow runs
43
+ * from every bot, and cancel callbacks route by the run's true owner. */
44
+ scope?: 'global';
45
+ }
46
+ /** Build the workflows list card JSON. Pure (paginates + renders).
47
+ * Server-side listRuns order is preserved verbatim β€” no client-side resort.
48
+ * See module docblock for the rationale. */
49
+ export declare function buildWorkflowsCard(rows: ReadonlyArray<WorkflowRunInput>, opts: BuildWorkflowsCardOpts, nowMs: number): string;
50
+ /** Options for the detail card. */
51
+ export interface BuildWorkflowsDetailCardOpts {
52
+ invokerOpenId: string;
53
+ locale: Locale;
54
+ /** Override `Date.now()` so the relative-time formatter is deterministic in tests. */
55
+ nowMs?: number;
56
+ /** Overview drilldown nav state β€” threaded into the "πŸ”™ θΏ”ε›ž" button so the
57
+ * list rebuilt by `BACK_TO_LIST` is still drilldown-shaped (5/page +
58
+ * return-to-overview). Detail itself does NOT render a return-to-overview
59
+ * button. */
60
+ origin?: 'overview';
61
+ pageSize?: number;
62
+ /** Source list page. Detail actions round-trip this so BACK_TO_LIST restores
63
+ * the page that opened the detail card. */
64
+ sourcePage?: number;
65
+ /** Dashboard scope. Threaded into cancel/back buttons. */
66
+ scope?: 'global';
67
+ }
68
+ /**
69
+ * Build the workflow detail card: run metadata, optional node progress, cancel
70
+ * action, and back action.
71
+ *
72
+ * The cancel button is disabled when EITHER:
73
+ * - `computeActionAvailability(status).cancel.enabled === false`
74
+ * (terminal status: succeeded / failed / cancelled), OR
75
+ * - `chatBinding.larkAppId` is missing β€” no routable owner for Route B to
76
+ * proxy to. The `runCancel` helper would 409 `needs_cli_cancel` here, so
77
+ * we fail-closed at the UI layer too.
78
+ * Both disabled reasons surface as inline notes next to the button.
79
+ */
80
+ export declare function buildWorkflowsDetailCard(detail: WorkflowRunDetailDto, opts: BuildWorkflowsDetailCardOpts): string;
81
+ /** ─── Handler ─────────────────────────────────────────────────────────── */
82
+ export interface WorkflowsCardHandlerDeps {
83
+ getOwnerOpenId?: (larkAppId: string) => string | undefined;
84
+ getDashboardAdminOpenIds?: (larkAppId: string) => ReadonlyArray<string> | undefined;
85
+ createClient: (larkAppId: string) => DaemonClient;
86
+ locale?: Locale;
87
+ /** Override `Date.now()` so tests are deterministic. */
88
+ nowMs?: () => number;
89
+ }
90
+ export interface WorkflowsCardHandlerResult {
91
+ toast?: {
92
+ type: 'info' | 'success' | 'error';
93
+ content: string;
94
+ };
95
+ card?: {
96
+ type: 'raw';
97
+ data: Record<string, unknown>;
98
+ };
99
+ }
100
+ /** Dispatch a `dash_workflows_*` action callback. */
101
+ export declare function handleWorkflowsCardAction(data: CardActionData, larkAppId: string, deps: WorkflowsCardHandlerDeps): Promise<WorkflowsCardHandlerResult>;
102
+ //# sourceMappingURL=workflows-card.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflows-card.d.ts","sourceRoot":"","sources":["../../../src/im/lark/workflows-card.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EACV,oBAAoB,EAEpB,gBAAgB,EAEjB,MAAM,wCAAwC,CAAC;AAMhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,KAAK,MAAM,EAAK,MAAM,qBAAqB,CAAC;AAErD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,eAAO,MAAM,wBAAwB,EAAG,wBAAiC,CAAC;AAC1E,eAAO,MAAM,qBAAqB,EAAG,qBAA8B,CAAC;AACpE,eAAO,MAAM,uBAAuB,EAAG,uBAAgC,CAAC;AACxE,eAAO,MAAM,uBAAuB,EAAG,uBAAgC,CAAC;AACxE,eAAO,MAAM,6BAA6B,EAAG,6BAAsC,CAAC;AAgDpF,MAAM,WAAW,sBAAsB;IACrC,aAAa,EAAE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