@soba-so/react 0.0.19 → 0.0.21

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.
package/README.md CHANGED
@@ -26,7 +26,7 @@ ephemeral keys work.
26
26
  // app/api/soba/session/route.ts
27
27
  export async function POST() {
28
28
  const session = await auth() // your auth, your rules
29
- const res = await fetch("https://www.soba.so/v1/end_users/session", {
29
+ const res = await fetch("https://soba.so/v1/end_users/session", {
30
30
  method: "POST",
31
31
  headers: {
32
32
  authorization: `Bearer ${process.env.SOBA_KEY}`,
@@ -0,0 +1,31 @@
1
+ import type { Machine } from "./types.js";
2
+ export interface ConnectPillProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
3
+ /** The machine the pill is about. `useConnectButton().machine` is the one to
4
+ * pass; `compute.machines[0]` is not, because that list is ordered by
5
+ * heartbeat and a laptop that slept a minute ago outranks a desktop that has
6
+ * been serving for an hour. */
7
+ machine: Machine | null;
8
+ }
9
+ /**
10
+ * WHAT IS CONNECTED AND WHETHER IT IS AWAKE, AS ONE CONTROL FOR A HEADER.
11
+ *
12
+ * ```jsx
13
+ * const { machine } = useConnectButton()
14
+ *
15
+ * <ConnectPill machine={machine} onClick={() => setOpen(true)} />
16
+ * ```
17
+ *
18
+ * The reporting half of `<ConnectButton />`, which is that pill plus our
19
+ * popover plus the pairing flow. Reach for this one when the app has its own
20
+ * idea of what pressing it does — its own panel, its own sheet, its own route —
21
+ * and for the usual case reach for `<ConnectButton />`, which wires all three.
22
+ *
23
+ * NOTHING IN IT IS THIS PACKAGE'S. The words, the dot's tone and the accessible
24
+ * name are `connectSays`, the same function the button and the dashboard's bar
25
+ * read, so three controls on three surfaces cannot end up disagreeing about one
26
+ * laptop. Pressing it is the only thing left for a host to decide.
27
+ *
28
+ * IT DRAWS NOTHING WITH NOTHING PAIRED. A pill reporting "no compute" is a
29
+ * readout of an absence; `<ConnectButton />` draws the door instead.
30
+ */
31
+ export declare const ConnectPill: import("react").ForwardRefExoticComponent<ConnectPillProps & import("react").RefAttributes<HTMLButtonElement>>;
@@ -12,7 +12,7 @@ export interface SobaProviderProps {
12
12
  * expects `{ session, expires_in }` back. Four lines on your server:
13
13
  *
14
14
  * ```ts
15
- * const res = await fetch("https://www.soba.so/v1/end_users/session", {
15
+ * const res = await fetch("https://soba.so/v1/end_users/session", {
16
16
  * method: "POST",
17
17
  * headers: { authorization: `Bearer ${process.env.SOBA_KEY}` },
18
18
  * body: JSON.stringify({ user: sobaUserId(session.user.username) }),
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export { ConnectButton, type ConnectButtonProps } from "./ConnectButton.js";
3
3
  export { ConnectCompute, type ConnectComputeProps } from "./ConnectCompute.js";
4
4
  export { ConnectModal, type ConnectModalProps } from "./ConnectModal.js";
5
5
  export { ConnectNudge, type ConnectNudgeProps } from "./ConnectNudge.js";
6
+ export { ConnectPill, type ConnectPillProps } from "./ConnectPill.js";
6
7
  export { type ComputeState, type ConnectReason, type ConnectState, type PlanState, type RunRequest, type SobaContextValue, useSoba, } from "./context.js";
7
8
  export { collectText, parseEvent, readEvents } from "./events.js";
8
9
  export { ModelPicker, type ModelPickerProps } from "./ModelPicker.js";
@@ -21,9 +22,9 @@ export { type ComputeMachine, type ComputeRuntime, type ComputeView, useCompute,
21
22
  export { type ConnectButtonView, connectSays, useConnectButton } from "./useConnectButton.js";
22
23
  export { type NudgeReason, type NudgeStalled, type NudgeStep, type NudgeView, type UseConnectNudgeOptions, useConnectNudge, } from "./useConnectNudge.js";
23
24
  export { type AllowanceState, type CurrentPlanReward, type CurrentPlanView, useCurrentPlan, } from "./useCurrentPlan.js";
25
+ export { type MachineRunsOptions, type MachineRunsView, useMachineRuns } from "./useMachineRuns.js";
24
26
  export { type ModelView, type UseModelOptions, useModel } from "./useModel.js";
25
27
  export { useOpenSobaConnect } from "./useOpenSobaConnect.js";
26
28
  export { type PlanCompute, type PlanConnect, type PlanCta, type PlanOffer, type PlanPrice, type PlansOptions, type PlansView, usePlans, } from "./usePlans.js";
27
29
  export { type LimitReason, type Offer, sobaErrorCode, useRunLimit } from "./useRunLimit.js";
28
30
  export { type RunStream, type WatchOptions, watchRun } from "./watch.js";
29
- export { type MachineRunsOptions, type MachineRunsView, useMachineRuns } from "./useMachineRuns.js";