@korso/shepherd-ui 0.1.0 → 0.2.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 (99) hide show
  1. package/dist/ShepherdProvider.d.ts +12 -0
  2. package/dist/ShepherdProvider.js +33 -0
  3. package/dist/ShepherdProvider.test.d.ts +1 -0
  4. package/dist/ShepherdProvider.test.js +47 -0
  5. package/dist/ShepherdRoot.d.ts +9 -0
  6. package/dist/ShepherdRoot.js +88 -0
  7. package/dist/ShepherdRoot.routing.test.d.ts +1 -0
  8. package/dist/ShepherdRoot.routing.test.js +61 -0
  9. package/dist/ShepherdRoot.test.d.ts +1 -0
  10. package/dist/ShepherdRoot.test.js +37 -0
  11. package/dist/app/assets/index-CDOCIg6s.js +11 -0
  12. package/dist/app/index.html +12 -0
  13. package/dist/client.d.ts +107 -0
  14. package/dist/client.js +238 -0
  15. package/dist/client.test.d.ts +1 -0
  16. package/dist/client.test.js +298 -0
  17. package/dist/components/ActiveList.d.ts +22 -0
  18. package/dist/components/ActiveList.js +59 -0
  19. package/dist/components/Chat.d.ts +30 -0
  20. package/dist/components/Chat.js +61 -0
  21. package/dist/components/Composer.d.ts +37 -0
  22. package/dist/components/Composer.js +146 -0
  23. package/dist/components/Crew.d.ts +23 -0
  24. package/dist/components/Crew.js +31 -0
  25. package/dist/components/Dashboard.d.ts +34 -0
  26. package/dist/components/Dashboard.js +209 -0
  27. package/dist/components/DoneList.d.ts +29 -0
  28. package/dist/components/DoneList.js +50 -0
  29. package/dist/components/RepoSelect.d.ts +38 -0
  30. package/dist/components/RepoSelect.js +56 -0
  31. package/dist/components/Territory.d.ts +21 -0
  32. package/dist/components/Territory.js +21 -0
  33. package/dist/config/ConnectAgent.d.ts +10 -0
  34. package/dist/config/ConnectAgent.js +119 -0
  35. package/dist/config/ConnectAgent.test.d.ts +1 -0
  36. package/dist/config/ConnectAgent.test.js +92 -0
  37. package/dist/config/EmptyState.d.ts +12 -0
  38. package/dist/config/EmptyState.js +4 -0
  39. package/dist/config/EmptyState.test.d.ts +1 -0
  40. package/dist/config/EmptyState.test.js +32 -0
  41. package/dist/config/Members.d.ts +10 -0
  42. package/dist/config/Members.js +83 -0
  43. package/dist/config/Members.test.d.ts +1 -0
  44. package/dist/config/Members.test.js +66 -0
  45. package/dist/config/Workspaces.d.ts +12 -0
  46. package/dist/config/Workspaces.js +96 -0
  47. package/dist/config/Workspaces.test.d.ts +1 -0
  48. package/dist/config/Workspaces.test.js +90 -0
  49. package/dist/config/index.d.ts +8 -0
  50. package/dist/config/index.js +6 -0
  51. package/dist/context.d.ts +28 -0
  52. package/dist/context.js +36 -0
  53. package/dist/index.cjs +5289 -0
  54. package/dist/index.cjs.map +1 -0
  55. package/dist/index.d.cts +149 -0
  56. package/dist/index.d.ts +18 -0
  57. package/dist/index.js +15 -0
  58. package/dist/index.js.map +1 -0
  59. package/dist/lib/Dashboard-CG6KeFQ3.js +1214 -0
  60. package/dist/lib/index.d.ts +438 -16
  61. package/dist/lib/index.js +455 -6
  62. package/dist/lib/selfhost.js +9 -9
  63. package/dist/lib/styles.css +27 -0
  64. package/dist/logic.d.ts +208 -0
  65. package/dist/logic.js +372 -0
  66. package/dist/main.d.ts +1 -0
  67. package/dist/main.js +11 -0
  68. package/dist/selfhost/assets/{index-tSyzirZa.css → index-BZmImfYZ.css} +1 -1
  69. package/dist/selfhost/assets/index-CS268KSw.js +40 -0
  70. package/dist/selfhost/index.html +2 -2
  71. package/dist/selfhost.d.ts +22 -0
  72. package/dist/selfhost.js +97 -0
  73. package/dist/test/mockClient.d.ts +6 -0
  74. package/dist/test/mockClient.js +45 -0
  75. package/dist/test/setup.d.ts +1 -0
  76. package/dist/test/setup.js +2 -0
  77. package/dist/useLandscapePolling.d.ts +63 -0
  78. package/dist/useLandscapePolling.js +129 -0
  79. package/dist/views/Chat.d.ts +5 -0
  80. package/dist/views/Chat.js +60 -0
  81. package/dist/views/Chat.test.d.ts +1 -0
  82. package/dist/views/Chat.test.js +92 -0
  83. package/dist/views/Config.d.ts +12 -0
  84. package/dist/views/Config.js +6 -0
  85. package/dist/views/Tasks.d.ts +5 -0
  86. package/dist/views/Tasks.js +75 -0
  87. package/dist/views/Tasks.test.d.ts +1 -0
  88. package/dist/views/Tasks.test.js +115 -0
  89. package/dist/views/useLandscape.d.ts +14 -0
  90. package/dist/views/useLandscape.js +74 -0
  91. package/dist/views/useLandscape.test.d.ts +1 -0
  92. package/dist/views/useLandscape.test.js +101 -0
  93. package/dist/views/wallboard.d.ts +46 -0
  94. package/dist/views/wallboard.js +209 -0
  95. package/dist/views/wallboard.test.d.ts +1 -0
  96. package/dist/views/wallboard.test.js +143 -0
  97. package/package.json +1 -1
  98. package/dist/lib/Dashboard-CB6SL-J2.js +0 -1064
  99. package/dist/selfhost/assets/index-BBx3vo2Y.js +0 -40
@@ -0,0 +1,149 @@
1
+ import { ListWorkspacesResponseT, CreateWorkspaceRequestT, CreateWorkspaceResponseT, MintTokenRequestT, MintTokenResponseT, ListTokensResponseT, CreateInviteRequestT, InviteResponseT, RedeemInviteResponseT, ListMembersResponseT, WorkspaceLandscapeResponseT, WorkspaceAnnounceRequestT, WorkspaceAnnounceResponseT, WorkspaceSummaryT } from '@shepherd/shared';
2
+ import * as react from 'react';
3
+ import { ReactNode } from 'react';
4
+
5
+ /**
6
+ * Caller-supplied configuration. No auth types here on purpose: `getAuthHeader`
7
+ * returns whatever header value the host's auth scheme produces (or none).
8
+ */
9
+ interface ShepherdClientConfig {
10
+ /** Hub base URL, e.g. "https://hub.example.com" or "" for same-origin. */
11
+ baseUrl: string;
12
+ /**
13
+ * Returns the credential for the next request, as either:
14
+ * - a string → sent as the `Authorization` header value (e.g. "Bearer …"),
15
+ * - a header map → merged verbatim into the request headers, or
16
+ * - undefined → no auth header added (same-origin BFF supplies the cookie).
17
+ * May be async (e.g. refreshing a short-lived token). Omit entirely for an
18
+ * unauthenticated/same-origin deployment.
19
+ */
20
+ getAuthHeader?: () => string | Record<string, string> | undefined | Promise<string | Record<string, string> | undefined>;
21
+ }
22
+ /**
23
+ * Thrown on any non-2xx Hub response. Carries the HTTP status/statusText and the
24
+ * parsed error body (if the response carried JSON) so callers can branch on
25
+ * `status` (e.g. 401 → re-auth, 403 → not a member) without re-reading the body.
26
+ */
27
+ declare class ShepherdHttpError extends Error {
28
+ readonly status: number;
29
+ readonly statusText: string;
30
+ readonly body: unknown;
31
+ constructor(status: number, statusText: string, body: unknown);
32
+ }
33
+ /**
34
+ * The typed Hub management surface. Workspace-scoped methods take an explicit
35
+ * `workspaceId` and use the `/workspaces/:id/...` form, which works in both
36
+ * deployments: a bearer credential resolves its own workspace and ignores the
37
+ * `:id`, while a browser session validates membership of `:id`.
38
+ */
39
+ interface ShepherdClient {
40
+ readonly baseUrl: string;
41
+ listWorkspaces(): Promise<ListWorkspacesResponseT>;
42
+ createWorkspace(body: CreateWorkspaceRequestT): Promise<CreateWorkspaceResponseT>;
43
+ mintToken(workspaceId: string, body: MintTokenRequestT): Promise<MintTokenResponseT>;
44
+ listTokens(workspaceId: string): Promise<ListTokensResponseT>;
45
+ revokeToken(workspaceId: string, tokenId: string): Promise<void>;
46
+ createInvite(workspaceId: string, body: CreateInviteRequestT): Promise<InviteResponseT>;
47
+ revokeInvite(workspaceId: string, code: string): Promise<void>;
48
+ redeemInvite(code: string): Promise<RedeemInviteResponseT>;
49
+ listMembers(workspaceId: string): Promise<ListMembersResponseT>;
50
+ removeMember(workspaceId: string, accountId: string): Promise<void>;
51
+ leave(workspaceId: string): Promise<void>;
52
+ landscape(workspaceId: string): Promise<WorkspaceLandscapeResponseT>;
53
+ announce(workspaceId: string, body: WorkspaceAnnounceRequestT): Promise<WorkspaceAnnounceResponseT>;
54
+ }
55
+ /**
56
+ * Create a Shepherd Hub client. The returned object holds no per-instance mutable
57
+ * state beyond the captured config, so a stable `config` reference yields a stable
58
+ * client; the provider memoises on the config identity.
59
+ */
60
+ declare function createShepherdClient(config: ShepherdClientConfig): ShepherdClient;
61
+
62
+ interface ShepherdProviderProps {
63
+ /** A pre-built client. Mutually exclusive with `config`. */
64
+ client?: ShepherdClient;
65
+ /** Config to build a client from, when one is not supplied directly. */
66
+ config?: ShepherdClientConfig;
67
+ children: ReactNode;
68
+ }
69
+ declare function ShepherdProvider({ client, config, children }: ShepherdProviderProps): react.JSX.Element;
70
+ /** Access the ShepherdClient from context. Throws if used outside a provider. */
71
+ declare function useShepherdClient(): ShepherdClient;
72
+
73
+ interface ShepherdRootProps {
74
+ /**
75
+ * The DIRECT Hub URL embedded in the agent install command (planning decision
76
+ * #2: the headless agent connects straight to the Hub, not the BFF). Defaults
77
+ * to the client's baseUrl, which is correct for self-host.
78
+ */
79
+ hubUrl?: string;
80
+ }
81
+ declare function ShepherdRoot({ hubUrl }: ShepherdRootProps): react.JSX.Element;
82
+
83
+ interface TasksProps {
84
+ /** The workspace whose wallboard to render. Selected by the shell. */
85
+ workspaceId: string;
86
+ }
87
+ declare function Tasks({ workspaceId }: TasksProps): react.JSX.Element;
88
+
89
+ interface ChatProps {
90
+ /** The workspace whose chat to render. Selected by the shell. */
91
+ workspaceId: string;
92
+ }
93
+ declare function Chat({ workspaceId }: ChatProps): react.JSX.Element;
94
+
95
+ interface ConfigProps {
96
+ workspaces: WorkspaceSummaryT[];
97
+ selected: WorkspaceSummaryT | null;
98
+ /** The DIRECT Hub URL embedded in the agent install command (decision #2). */
99
+ hubUrl?: string;
100
+ /** Refetch the workspace list after a create/join. */
101
+ onChanged: () => void;
102
+ /** Switch the active workspace. */
103
+ onSelect?: (workspaceId: string) => void;
104
+ }
105
+ declare function Config({ workspaces, selected, hubUrl, onChanged, onSelect }: ConfigProps): react.JSX.Element;
106
+
107
+ interface ConnectAgentProps {
108
+ workspaceId: string;
109
+ /**
110
+ * The DIRECT Hub URL the agent connects to (public Cloud Run URL when hosted).
111
+ * Defaults to the dashboard client's baseUrl, which is correct for self-host
112
+ * where the agent and the dashboard share the Hub origin.
113
+ */
114
+ hubUrl?: string;
115
+ }
116
+ declare function ConnectAgent({ workspaceId, hubUrl }: ConnectAgentProps): react.JSX.Element;
117
+
118
+ interface WorkspacesProps {
119
+ /** All workspaces the account belongs to (for the switcher / context). */
120
+ workspaces: WorkspaceSummaryT[];
121
+ /** The currently-selected workspace, or null when the account has none. */
122
+ selected: WorkspaceSummaryT | null;
123
+ /** Called after a mutation that changes membership (create / join / leave). */
124
+ onChanged: () => void;
125
+ /** Switch the active workspace (optional simple switcher). */
126
+ onSelect?: (workspaceId: string) => void;
127
+ }
128
+ declare function Workspaces({ workspaces, selected, onChanged, onSelect }: WorkspacesProps): react.JSX.Element;
129
+
130
+ interface MembersProps {
131
+ workspaceId: string;
132
+ /** Bumped by the parent to force a refetch (e.g. after an invite is redeemed). */
133
+ refreshKey?: number;
134
+ }
135
+ declare function Members({ workspaceId, refreshKey }: MembersProps): react.JSX.Element;
136
+
137
+ interface EmptyStateProps {
138
+ /** Heading text. Defaults to a generic "no workspace yet" prompt. */
139
+ title?: string;
140
+ /** Supporting copy. */
141
+ children?: ReactNode;
142
+ /** Invoked when the user clicks the call-to-action (e.g. switch to Config). */
143
+ onGetStarted?: () => void;
144
+ /** CTA label. */
145
+ ctaLabel?: string;
146
+ }
147
+ declare function EmptyState({ title, children, onGetStarted, ctaLabel, }: EmptyStateProps): react.JSX.Element;
148
+
149
+ export { Chat, type ChatProps, Config, type ConfigProps, ConnectAgent, type ConnectAgentProps, EmptyState, type EmptyStateProps, Members, type MembersProps, type ShepherdClient, type ShepherdClientConfig, ShepherdHttpError, ShepherdProvider, type ShepherdProviderProps, ShepherdRoot, type ShepherdRootProps, Tasks, type TasksProps, Workspaces, type WorkspacesProps, createShepherdClient, useShepherdClient };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Public `.` entry for `@korso/shepherd-ui` — the auth-agnostic surface hosted
3
+ * consumers import. It deliberately does NOT export {@link SelfHostApp} (the
4
+ * token-gated self-host root lives behind the `./selfhost` export) and does NOT
5
+ * import `styles.css` — hosted consumers opt into styling via
6
+ * `@korso/shepherd-ui/styles.css`. This keeps the token gate out of `.` so the
7
+ * core stays auth-neutral.
8
+ */
9
+ export { createShepherdClient, ShepherdClientError, describeError, } from "./client.js";
10
+ export type { ShepherdClient, ShepherdClientConfig } from "./client.js";
11
+ export { ShepherdClientProvider, useShepherdClient, } from "./context.js";
12
+ export { ShepherdRoot } from "./ShepherdRoot.js";
13
+ export type { ShepherdRootProps } from "./ShepherdRoot.js";
14
+ export { Dashboard } from "./components/Dashboard.js";
15
+ export type { DashboardProps } from "./components/Dashboard.js";
16
+ export { Workspaces, Members, ConnectAgent, EmptyState, } from "./config/index.js";
17
+ export type { WorkspacesProps, MembersProps, ConnectAgentProps, EmptyStateProps, } from "./config/index.js";
18
+ export type { WorkspaceLandscapeResponseT, WorkspaceSummaryT, TokenSummaryT, MemberSummaryT, InviteResponseT, } from "@shepherd/shared";
package/dist/index.js ADDED
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Public `.` entry for `@korso/shepherd-ui` — the auth-agnostic surface hosted
3
+ * consumers import. It deliberately does NOT export {@link SelfHostApp} (the
4
+ * token-gated self-host root lives behind the `./selfhost` export) and does NOT
5
+ * import `styles.css` — hosted consumers opt into styling via
6
+ * `@korso/shepherd-ui/styles.css`. This keeps the token gate out of `.` so the
7
+ * core stays auth-neutral.
8
+ */
9
+ export { createShepherdClient, ShepherdClientError, describeError, } from "./client.js";
10
+ export { ShepherdClientProvider, useShepherdClient, } from "./context.js";
11
+ export { ShepherdRoot } from "./ShepherdRoot.js";
12
+ export { Dashboard } from "./components/Dashboard.js";
13
+ // Config screens — re-exported so consumers can compose the management surface
14
+ // directly without the full ShepherdRoot shell.
15
+ export { Workspaces, Members, ConnectAgent, EmptyState, } from "./config/index.js";