cli-funnel-react 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.
- package/dist/index.d.ts +5 -3
- package/dist/index.js +4 -3
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { FunnelClient, Selection, ModelInfo, ProviderOverview, AuthStatus, LoginEvent, FunnelEvent, Usage, ApprovalRequest, ApprovalDecision } from 'cli-funnel/client';
|
|
1
|
+
import { FunnelClient, Selection, ModelInfo, ProviderOverview, RunInput, AuthStatus, LoginEvent, FunnelEvent, Usage, ApprovalRequest, ApprovalDecision } from 'cli-funnel/client';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
|
|
4
4
|
type SelectionField = keyof Selection;
|
|
5
|
+
/** Extra fields for one `useRun().send` call. */
|
|
6
|
+
type RunOptions = Pick<RunInput, "system" | "attachments" | "responseSchema" | "maxOutputTokens">;
|
|
5
7
|
/** Loads installed providers and their login state. */
|
|
6
8
|
declare function useProviders(client: FunnelClient): {
|
|
7
9
|
providers: ProviderOverview[];
|
|
@@ -77,7 +79,7 @@ declare function useRun(client: FunnelClient): {
|
|
|
77
79
|
} | undefined;
|
|
78
80
|
/** Same as `session?.id`. */
|
|
79
81
|
sessionId: string | undefined;
|
|
80
|
-
send: (prompt: string, selection: Selection) => Promise<void>;
|
|
82
|
+
send: (prompt: string, selection: Selection, options?: RunOptions) => Promise<void>;
|
|
81
83
|
approve: (id: string, decision: ApprovalDecision) => Promise<void>;
|
|
82
84
|
cancel: () => void | undefined;
|
|
83
85
|
newConversation: () => void;
|
|
@@ -121,4 +123,4 @@ interface ApprovalPromptProps {
|
|
|
121
123
|
/** The approve button for supervised runs. Render one per entry in `useRun().approvals`. */
|
|
122
124
|
declare function ApprovalPrompt({ request, onDecide, className }: ApprovalPromptProps): react.JSX.Element;
|
|
123
125
|
|
|
124
|
-
export { ApprovalPrompt, type ApprovalPromptProps, FunnelLogin, type FunnelLoginProps, FunnelPicker, type FunnelPickerProps, FunnelPickerView, type SelectionField, type SelectionState, useAuth, useProviders, useRun, useSelection };
|
|
126
|
+
export { ApprovalPrompt, type ApprovalPromptProps, FunnelLogin, type FunnelLoginProps, FunnelPicker, type FunnelPickerProps, FunnelPickerView, type RunOptions, type SelectionField, type SelectionState, useAuth, useProviders, useRun, useSelection };
|
package/dist/index.js
CHANGED
|
@@ -41,7 +41,7 @@ function useSelection(client, opts = {}) {
|
|
|
41
41
|
const pickedEffort = model?.id === picked?.model && model?.efforts.some((e) => e.id === picked?.effort) ? picked?.effort : void 0;
|
|
42
42
|
const effort = model?.efforts.some((e) => e.id === draft.effort) ? draft.effort : pickedEffort ?? model?.defaultEffort ?? model?.efforts[0]?.id;
|
|
43
43
|
const contextWindow = model?.contextWindows.includes(draft.contextWindow ?? -1) ? draft.contextWindow : model?.defaultContextWindow ?? model?.contextWindows[0];
|
|
44
|
-
const access = cap.access.includes(draft.access) ? draft.access : cap.access[0];
|
|
44
|
+
const access = cap.access.includes(draft.access) ? draft.access : cap.access.find((a) => a !== "none") ?? cap.access[0];
|
|
45
45
|
return {
|
|
46
46
|
provider: providerId,
|
|
47
47
|
model: model?.id,
|
|
@@ -142,7 +142,7 @@ function useRun(client) {
|
|
|
142
142
|
const runId = useRef(void 0);
|
|
143
143
|
const abort = useRef(void 0);
|
|
144
144
|
const send = useCallback(
|
|
145
|
-
async (prompt, selection) => {
|
|
145
|
+
async (prompt, selection, options = {}) => {
|
|
146
146
|
abort.current = new AbortController();
|
|
147
147
|
setText("");
|
|
148
148
|
setEvents([]);
|
|
@@ -151,7 +151,7 @@ function useRun(client) {
|
|
|
151
151
|
setStatus("running");
|
|
152
152
|
try {
|
|
153
153
|
const resume = session && session.provider === selection.provider && session.cwd === selection.cwd ? session.id : void 0;
|
|
154
|
-
for await (const e of client.run({ prompt, selection, sessionId: resume }, abort.current.signal)) {
|
|
154
|
+
for await (const e of client.run({ ...options, prompt, selection, sessionId: resume }, abort.current.signal)) {
|
|
155
155
|
if (e.type === "run") {
|
|
156
156
|
runId.current = e.runId;
|
|
157
157
|
continue;
|
|
@@ -222,6 +222,7 @@ function useRun(client) {
|
|
|
222
222
|
import { useEffect as useEffect2, useId, useState as useState2 } from "react";
|
|
223
223
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
224
224
|
var ACCESS_LABELS = {
|
|
225
|
+
none: { label: "No tools", hint: "Answers only. Cannot edit files or run commands" },
|
|
225
226
|
supervised: { label: "Supervised", hint: "Asks before every action" },
|
|
226
227
|
"accept-edits": { label: "Accept edits", hint: "Edits files freely, asks for the rest" },
|
|
227
228
|
auto: { label: "Auto", hint: "A classifier approves safe actions" },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cli-funnel-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "React hooks and components for cli-funnel: model picker, folder picker, access level, login and one-click update.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"*.css"
|
|
19
19
|
],
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"cli-funnel": "^0.
|
|
21
|
+
"cli-funnel": "^0.2.0",
|
|
22
22
|
"react": ">=18"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|