@soba-so/react 0.0.16 → 0.0.18

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.
@@ -0,0 +1,31 @@
1
+ import { type UseModelOptions } from "./useModel.js";
2
+ export interface ModelPickerProps extends UseModelOptions {
3
+ /** A word before the value. Left out: in a composer there is no room for a
4
+ * caption, and "Opus ⌄" already says what it is. */
5
+ caption?: string;
6
+ disabled?: boolean;
7
+ className?: string;
8
+ }
9
+ /**
10
+ * WHICH MODEL ANSWERS, AS ONE PILL THAT GOES BESIDE A SEND BUTTON.
11
+ *
12
+ * ```jsx
13
+ * const { run } = useSoba()
14
+ * const model = useModel()
15
+ *
16
+ * <ModelPicker />
17
+ * <button onClick={() => run({ prompt, ...model.run })}>Send</button>
18
+ * ```
19
+ *
20
+ * Mount it and read `useModel().run` where you start the run — the two share
21
+ * the provider's state, so the pill and the run cannot disagree about which
22
+ * model was chosen. Or pass `value` and `onChange` and keep the pick wherever
23
+ * the rest of your composer's state lives.
24
+ *
25
+ * IT DRAWS NOTHING WITH NOTHING CONNECTED, which is most apps on their first
26
+ * day. The options are read off the person's own machines, so before they pair
27
+ * anything the only one is Automatic — and a menu with one row in it is a
28
+ * label that looks pressable. `<ConnectNudge />` is the component whose job is
29
+ * that case; this one stays out of its way and appears when there is a choice.
30
+ */
31
+ export declare function ModelPicker({ caption, disabled, className, ...options }: ModelPickerProps): import("react").JSX.Element | null;
@@ -27,6 +27,17 @@ export interface SobaProviderProps {
27
27
  * `sobaUserId` from `@soba-so/sdk/identity` derives one; the reasoning is at
28
28
  * https://soba.so/docs/identity. */
29
29
  user?: string;
30
+ /**
31
+ * REUSE THE SESSION ACROSS PAGE LOADS AND TABS: the signed-in person's own
32
+ * id in YOUR app. Without it every page load asks `sessionEndpoint` for a new
33
+ * session; with it a session is kept until it is about to expire, so reloads
34
+ * and other tabs cost your server nothing.
35
+ *
36
+ * It must be that person's id, never a constant: a session acts as the person
37
+ * it was minted for, and a second person signing in on the same browser
38
+ * under the same key would act as the first.
39
+ */
40
+ sessionCacheKey?: string;
30
41
  /** Your route that starts a run with `@soba-so/sdk` and forwards the stream. */
31
42
  runEndpoint?: string;
32
43
  baseUrl?: string;
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export { ConnectModal, type ConnectModalProps } from "./ConnectModal.js";
5
5
  export { ConnectNudge, type ConnectNudgeProps } from "./ConnectNudge.js";
6
6
  export { type ComputeState, type ConnectReason, type ConnectState, type PlanState, type RunRequest, type SobaContextValue, useSoba, } from "./context.js";
7
7
  export { collectText, parseEvent, readEvents } from "./events.js";
8
+ export { ModelPicker, type ModelPickerProps } from "./ModelPicker.js";
8
9
  export { RunError, type RunErrorProps, runErrorMessage } from "./RunError.js";
9
10
  export { RunLimit, type RunLimitProps } from "./RunLimit.js";
10
11
  export { SobaBilling, type SobaBillingProps } from "./SobaBilling.js";
@@ -13,7 +14,15 @@ export { SobaCurrentPlan, type SobaCurrentPlanProps } from "./SobaCurrentPlan.js
13
14
  export { SobaPlans, type SobaPlansProps } from "./SobaPlans.js";
14
15
  export { SobaProvider, type SobaProviderProps } from "./SobaProvider.js";
15
16
  export { injectStyles } from "./styles.js";
16
- export type { AgentEvent, AgentEventType, ConnectApi, ConnectContext, CostClass, CurrentPlan, Machine, MachineState, Message, PendingCode, Plan, Runtime, RunUsage, } from "./types.js";
17
+ export { tierLabel } from "./tier.js";
18
+ export type { AgentEvent, AgentEventType, ConnectApi, ConnectContext, CostClass, CurrentPlan, Launch, Machine, MachineState, Message, ModelGroup, ModelOption, ModelOptionKind, PendingCode, Plan, Runtime, RunUsage, } from "./types.js";
19
+ export { type CheckoutView, type UseCheckoutOptions, useCheckout } from "./useCheckout.js";
20
+ export { type ComputeMachine, type ComputeRuntime, type ComputeView, useCompute, } from "./useCompute.js";
21
+ export { type ConnectButtonView, connectSays, useConnectButton } from "./useConnectButton.js";
22
+ export { type NudgeReason, type NudgeStalled, type NudgeStep, type NudgeView, type UseConnectNudgeOptions, useConnectNudge, } from "./useConnectNudge.js";
17
23
  export { type AllowanceState, type CurrentPlanReward, type CurrentPlanView, useCurrentPlan, } from "./useCurrentPlan.js";
24
+ export { type ModelView, type UseModelOptions, useModel } from "./useModel.js";
25
+ export { useOpenSobaConnect } from "./useOpenSobaConnect.js";
18
26
  export { type PlanCompute, type PlanConnect, type PlanCta, type PlanOffer, type PlanPrice, type PlansOptions, type PlansView, usePlans, } from "./usePlans.js";
19
27
  export { type LimitReason, type Offer, sobaErrorCode, useRunLimit } from "./useRunLimit.js";
28
+ export { type RunStream, type WatchOptions, watchRun } from "./watch.js";